[Olsr-cvs] olsrd-current/src mpr_selector_set.c, 1.18, 1.19 mpr_selector_set.h, 1.13, 1.14

Bernd Petrovitsch (spam-protected)
Sun Oct 21 22:55:13 CEST 2007


Update of /cvsroot/olsrd/olsrd-current/src
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31979/src

Modified Files:
	mpr_selector_set.c mpr_selector_set.h 
Log Message:
* cont'ified it

Index: mpr_selector_set.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/mpr_selector_set.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** mpr_selector_set.h	16 Dec 2005 08:21:59 -0000	1.13
--- mpr_selector_set.h	21 Oct 2007 20:55:11 -0000	1.14
***************
*** 63,80 ****
  increase_local_ansn(void);
  
! int
  olsr_init_mprs_set(void);
  
  
  struct mpr_selector *
! olsr_add_mpr_selector(union olsr_ip_addr *, float);
  
  
  struct mpr_selector *
! olsr_lookup_mprs_set(union olsr_ip_addr *);
  
  
  int
! olsr_update_mprs_set(union olsr_ip_addr *, float);
  
  
--- 63,80 ----
  increase_local_ansn(void);
  
! void
  olsr_init_mprs_set(void);
  
  
  struct mpr_selector *
! olsr_add_mpr_selector(const union olsr_ip_addr *, float);
  
  
  struct mpr_selector *
! olsr_lookup_mprs_set(const union olsr_ip_addr *);
  
  
  int
! olsr_update_mprs_set(const union olsr_ip_addr *, float);
  
  

Index: mpr_selector_set.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/mpr_selector_set.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** mpr_selector_set.c	17 Sep 2007 22:24:22 -0000	1.18
--- mpr_selector_set.c	21 Oct 2007 20:55:11 -0000	1.19
***************
*** 55,59 ****
   */
  
! int
  olsr_init_mprs_set(void)
  {
--- 55,59 ----
   */
  
! void
  olsr_init_mprs_set(void)
  {
***************
*** 66,71 ****
    mprs_list.next = &mprs_list;
    mprs_list.prev = &mprs_list;
- 
-   return 1;
  }
  
--- 66,69 ----
***************
*** 102,106 ****
   */
  struct mpr_selector *
! olsr_add_mpr_selector(union olsr_ip_addr *addr, float vtime)
  {
    struct mpr_selector *new_entry;
--- 100,104 ----
   */
  struct mpr_selector *
! olsr_add_mpr_selector(const union olsr_ip_addr *addr, float vtime)
  {
    struct mpr_selector *new_entry;
***************
*** 122,126 ****
    mprs_list.next = new_entry;
    */
- 
    return new_entry;
  }
--- 120,123 ----
***************
*** 137,141 ****
   */
  struct mpr_selector *
! olsr_lookup_mprs_set(union olsr_ip_addr *addr)
  {
    struct mpr_selector *mprs;
--- 134,138 ----
   */
  struct mpr_selector *
! olsr_lookup_mprs_set(const union olsr_ip_addr *addr)
  {
    struct mpr_selector *mprs;
***************
*** 145,161 ****
    //OLSR_PRINTF(1, "MPRS: Lookup....");
  
!   mprs = mprs_list.next;
! 
!   while(mprs != &mprs_list)
!     {
! 
!       if(COMP_IP(&mprs->MS_main_addr, addr))
! 	{
! 	  //OLSR_PRINTF(1, "MATCH\n");
! 	  return mprs;
! 	}
!       mprs = mprs->next;
      }
!   
    //OLSR_PRINTF(1, "NO MACH\n");
    return NULL;
--- 142,151 ----
    //OLSR_PRINTF(1, "MPRS: Lookup....");
  
!   for (mprs = mprs_list.next; mprs != &mprs_list; mprs = mprs->next) {
!     if(COMP_IP(&mprs->MS_main_addr, addr)) {
!       //OLSR_PRINTF(1, "MATCH\n");
!       return mprs;
      }
!   }
    //OLSR_PRINTF(1, "NO MACH\n");
    return NULL;
***************
*** 173,196 ****
   */
  int
! olsr_update_mprs_set(union olsr_ip_addr *addr, float vtime)
  {
!   struct mpr_selector *mprs;
!   int retval;
  
    OLSR_PRINTF(5, "MPRS: Update %s\n", olsr_ip_to_string(addr));
  
!   retval = 0;
! 
!   if(NULL == (mprs = olsr_lookup_mprs_set(addr)))
!     {
!       olsr_add_mpr_selector(addr, vtime);
!       retval = 1;
!       signal_link_changes(OLSR_TRUE);
!     }
!   else
!     {
!       mprs->MS_time = GET_TIMESTAMP(vtime*1000);
!     }
!   return retval;
  }
  
--- 163,179 ----
   */
  int
! olsr_update_mprs_set(const union olsr_ip_addr *addr, float vtime)
  {
!   struct mpr_selector *mprs = olsr_lookup_mprs_set(addr);
  
    OLSR_PRINTF(5, "MPRS: Update %s\n", olsr_ip_to_string(addr));
  
!   if(mprs == NULL) {
!     olsr_add_mpr_selector(addr, vtime);
!     signal_link_changes(OLSR_TRUE);
!     return 1;
!   }
!   mprs->MS_time = GET_TIMESTAMP(vtime*1000);
!   return 0;
  }
  
***************
*** 205,210 ****
    struct mpr_selector *mprs = mprs_list.next;
  
!   while(mprs != &mprs_list)
!     {
        if(TIMED_OUT(mprs->MS_time))
  	{
--- 188,192 ----
    struct mpr_selector *mprs = mprs_list.next;
  
!   while(mprs != &mprs_list) {
        if(TIMED_OUT(mprs->MS_time))
  	{
***************
*** 234,242 ****
    struct mpr_selector *mprs;
    OLSR_PRINTF(1, "MPR SELECTORS: ");
! 
!     for(mprs = mprs_list.next; mprs != &mprs_list; mprs = mprs->next)
!     {
!       OLSR_PRINTF(1, "%s ", olsr_ip_to_string(&mprs->MS_main_addr));
!     }
    OLSR_PRINTF(1, "\n");
  }
--- 216,222 ----
    struct mpr_selector *mprs;
    OLSR_PRINTF(1, "MPR SELECTORS: ");
!   for (mprs = mprs_list.next; mprs != &mprs_list; mprs = mprs->next) {
!     OLSR_PRINTF(1, "%s ", olsr_ip_to_string(&mprs->MS_main_addr));
!   }
    OLSR_PRINTF(1, "\n");
  }





More information about the Olsr-cvs mailing list