[Olsr-cvs] olsrd-current/lib/secure/src olsrd_secure.c, 1.15, 1.16 olsrd_secure.h, 1.5, 1.6

Andreas T�nnesen (spam-protected)
Sat Nov 19 09:30:47 CET 2005


Update of /cvsroot/olsrd/olsrd-current/lib/secure/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2477/src

Modified Files:
	olsrd_secure.c olsrd_secure.h 
Log Message:
Fixes for timestamp issues. The plugin was not converted to the new clock_t timestam scheme

Index: olsrd_secure.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/secure/src/olsrd_secure.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** olsrd_secure.c	10 Nov 2005 19:25:37 -0000	1.15
--- olsrd_secure.c	19 Nov 2005 08:30:44 -0000	1.16
***************
*** 639,643 ****
  
    /* update validtime */
!   olsr_get_timestamp((olsr_u32_t) TIMESTAMP_HOLD_TIME*1000, &entry->valtime);
  
    return 1;
--- 639,644 ----
  
    /* update validtime */
! 
!   entry->valtime = GET_TIMESTAMP(TIMESTAMP_HOLD_TIME * 1000);
  
    return 1;
***************
*** 714,719 ****
  
    /* update validtime - not validated */
!   olsr_get_timestamp((olsr_u32_t) EXCHANGE_HOLD_TIME*1000, &entry->conftime);
!   
    hash = olsr_hashing(new_host);
    
--- 715,720 ----
  
    /* update validtime - not validated */
!   entry->conftime = GET_TIMESTAMP(EXCHANGE_HOLD_TIME * 1000);
! 
    hash = olsr_hashing(new_host);
    
***************
*** 811,815 ****
  
    /* update validtime - validated entry */
!   olsr_get_timestamp((olsr_u32_t) TIMESTAMP_HOLD_TIME*1000, &entry->valtime);
  
    olsr_printf(1, "[ENC]%s registered with diff %d!\n",
--- 812,816 ----
  
    /* update validtime - validated entry */
!   entry->valtime = GET_TIMESTAMP(TIMESTAMP_HOLD_TIME * 1000);
  
    olsr_printf(1, "[ENC]%s registered with diff %d!\n",
***************
*** 906,910 ****
  
    /* update validtime - validated entry */
!   olsr_get_timestamp((olsr_u32_t) TIMESTAMP_HOLD_TIME*1000, &entry->valtime);
  
    olsr_printf(1, "[ENC]%s registered with diff %d!\n",
--- 907,911 ----
  
    /* update validtime - validated entry */
!   entry->valtime = GET_TIMESTAMP(TIMESTAMP_HOLD_TIME * 1000);
  
    olsr_printf(1, "[ENC]%s registered with diff %d!\n",
***************
*** 992,997 ****
  
    /* update validtime - not validated */
!   olsr_get_timestamp((olsr_u32_t) EXCHANGE_HOLD_TIME*1000, &entry->conftime);
! 
  
    /* Build and send response */
--- 993,997 ----
  
    /* update validtime - not validated */
!   entry->conftime = GET_TIMESTAMP(EXCHANGE_HOLD_TIME * 1000);
  
    /* Build and send response */
***************
*** 1259,1327 ****
  }
  
- 
- /*************************************************************
-  *                 TOOLS DERIVED FROM OLSRD                  *
-  *************************************************************/
- 
- 
- /**
-  *Checks if a timer has times out. That means
-  *if it is smaller than present time.
-  *@param timer the timeval struct to evaluate
-  *@return positive if the timer has not timed out,
-  *0 if it matches with present time and negative
-  *if it is timed out.
-  */
- int
- olsr_timed_out(struct timeval *timer)
- {
-   return(timercmp(timer, &now, <));
- }
- 
- 
- 
- /**
-  *Initiates a "timer", wich is a timeval structure,
-  *with the value given in time_value.
-  *@param time_value the value to initialize the timer with
-  *@param hold_timer the timer itself
-  *@return nada
-  */
- void
- olsr_init_timer(olsr_u32_t time_value, struct timeval *hold_timer)
- { 
-   olsr_u16_t  time_value_sec;
-   olsr_u16_t  time_value_msec;
- 
-   time_value_sec = time_value/1000;
-   time_value_msec = time_value-(time_value_sec*1000);
- 
-   hold_timer->tv_sec = time_value_sec;
-   hold_timer->tv_usec = time_value_msec*1000;   
- }
- 
- 
- 
- 
- 
- /**
-  *Generaties a timestamp a certain number of milliseconds
-  *into the future.
-  *
-  *@param time_value how many milliseconds from now
-  *@param hold_timer the timer itself
-  *@return nada
-  */
- void
- olsr_get_timestamp(olsr_u32_t delay, struct timeval *hold_timer)
- { 
-   olsr_u16_t  time_value_sec;
-   olsr_u16_t  time_value_msec;
- 
-   time_value_sec = delay/1000;
-   time_value_msec= delay - (delay*1000);
- 
-   hold_timer->tv_sec = now.tv_sec + time_value_sec;
-   hold_timer->tv_usec = now.tv_usec + (time_value_msec*1000);   
- }
- 
--- 1259,1260 ----

Index: olsrd_secure.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/secure/src/olsrd_secure.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** olsrd_secure.h	29 May 2005 12:47:44 -0000	1.5
--- olsrd_secure.h	19 Nov 2005 08:30:45 -0000	1.6
***************
*** 79,84 ****
    olsr_u32_t challenge;
    olsr_u8_t validated;
!   struct timeval valtime; /* Validity time */
!   struct timeval conftime; /* Reconfiguration time */
    struct stamp *prev;
    struct stamp *next;
--- 79,84 ----
    olsr_u32_t challenge;
    olsr_u8_t validated;
!   clock_t valtime; /* Validity time */
!   clock_t conftime; /* Reconfiguration time */
    struct stamp *prev;
    struct stamp *next;
***************
*** 157,169 ****
  read_key_from_file(char *);
  
- void
- olsr_get_timestamp(olsr_u32_t, struct timeval *);
- 
- void
- olsr_init_timer(olsr_u32_t, struct timeval *);
- 
- int
- olsr_timed_out(struct timeval *);
- 
  int
  secure_plugin_init(void);
--- 157,160 ----





More information about the Olsr-cvs mailing list