further renames in the nbr code, preparation for neighbor refactoring
authorHannes Gredler <hannes@gredler.at>
Mon, 18 May 2009 13:34:23 +0000 (15:34 +0200)
committerHannes Gredler <hannes@gredler.at>
Mon, 18 May 2009 13:34:23 +0000 (15:34 +0200)
src/link_set.c
src/lq_mpr.c
src/mid_set.c
src/mpr.c
src/neighbor_table.c
src/neighbor_table.h
src/olsr.c
src/process_package.c
src/two_hop_neighbor_table.c

index bee423a..f404c5a 100644 (file)
@@ -293,7 +293,7 @@ olsr_delete_link_entry(struct link_entry *link)
 
   /* Delete neighbor entry */
   if (link->neighbor->linkcount == 1) {
-    olsr_delete_neighbor_table(&link->neighbor->neighbor_main_addr);
+    olsr_delete_nbr_entry(&link->neighbor->neighbor_main_addr);
   } else {
     link->neighbor->linkcount--;
   }
@@ -371,7 +371,7 @@ olsr_expire_link_sym_timer(void *context)
   }
 
   link->prev_status = lookup_link_status(link);
-  update_neighbor_status(link->neighbor, get_neighbor_status(&link->neighbor_iface_addr));
+  olsr_update_nbr_status(link->neighbor, get_neighbor_status(&link->neighbor_iface_addr));
   changes_neighborhood = true;
 }
 
@@ -386,7 +386,7 @@ olsr_expire_link_hello_timer(void *context)
   link = (struct link_entry *)context;
 
   /* update neighbor status */
-  update_neighbor_status(link->neighbor, get_neighbor_status(&link->neighbor_iface_addr));
+  olsr_update_nbr_status(link->neighbor, get_neighbor_status(&link->neighbor_iface_addr));
 }
 
 /**
@@ -499,10 +499,10 @@ add_link_entry(const union olsr_ip_addr *local,
    */
 
   /* Neighbor MUST exist! */
-  neighbor = olsr_lookup_neighbor_table(remote_main);
+  neighbor = olsr_lookup_nbr_entry(remote_main);
   if (!neighbor) {
     OLSR_DEBUG(LOG_LINKS, "ADDING NEW NEIGHBOR ENTRY %s FROM LINK SET\n", olsr_ip_to_string(&rembuf, remote_main));
-    neighbor = olsr_insert_neighbor_table(remote_main);
+    neighbor = olsr_add_nbr_entry(remote_main);
   }
 
   neighbor->linkcount++;
@@ -639,7 +639,7 @@ update_link_entry(const union olsr_ip_addr *local,
   }
 
   /* Update neighbor */
-  update_neighbor_status(entry->neighbor, get_neighbor_status(remote));
+  olsr_update_nbr_status(entry->neighbor, get_neighbor_status(remote));
 
   return entry;
 }
index 13d981d..0fa4c50 100644 (file)
@@ -90,7 +90,7 @@ olsr_calculate_lq_mpr(void)
 
       /* check whether this 2-hop neighbour is also a neighbour */
 
-      neigh = olsr_lookup_neighbor_table(&neigh2->neighbor_2_addr);
+      neigh = olsr_lookup_nbr_entry(&neigh2->neighbor_2_addr);
 
       /* if it's a neighbour and also symmetric, then examine
          the link quality */
index d11c056..52df3d9 100644 (file)
@@ -140,9 +140,9 @@ olsr_flush_nbr2_duplicates(struct mid_entry *alias)
     }
 
     /* Delete a possible neighbor entry */
-    nbr = olsr_lookup_neighbor_table_alias(&alias->mid_alias_addr);
+    nbr = olsr_lookup_nbr_entry_alias(&alias->mid_alias_addr);
     if (nbr) {
-      struct nbr_entry *real_nbr = olsr_lookup_neighbor_table_alias(&tc->addr);
+      struct nbr_entry *real_nbr = olsr_lookup_nbr_entry_alias(&tc->addr);
       if (real_nbr) {
 
         OLSR_DEBUG(LOG_MID, "Delete bogus neighbor entry %s (real %s)\n",
@@ -170,7 +170,7 @@ olsr_flush_nbr2_duplicates(struct mid_entry *alias)
 static void
 olsr_fixup_mid_main_addr(const union olsr_ip_addr *main_addr, const union olsr_ip_addr *alias_addr)
 {
-  struct nbr_entry *nbr_new, *nbr_old = olsr_lookup_neighbor_table_alias(alias_addr);
+  struct nbr_entry *nbr_new, *nbr_old = olsr_lookup_nbr_entry_alias(alias_addr);
   struct mid_entry *mid_old;
   int ne_ref_rp_count;
 #if !defined REMOVE_LOG_DEBUG
@@ -184,8 +184,8 @@ olsr_fixup_mid_main_addr(const union olsr_ip_addr *main_addr, const union olsr_i
   OLSR_DEBUG(LOG_MID, "Main address change %s -> %s detected.\n",
              olsr_ip_to_string(&buf1, alias_addr), olsr_ip_to_string(&buf2, main_addr));
 
-  olsr_delete_neighbor_table(alias_addr);
-  nbr_new = olsr_insert_neighbor_table(main_addr);
+  olsr_delete_nbr_entry(alias_addr);
+  nbr_new = olsr_add_nbr_entry(main_addr);
 
   /* Adjust pointers to neighbortable-entry in link_set */
   ne_ref_rp_count = replace_neighbor_link_set(nbr_old, nbr_new);
index e8eb064..c443866 100644 (file)
--- a/src/mpr.c
+++ b/src/mpr.c
@@ -115,7 +115,7 @@ olsr_find_2_hop_neighbors_with_1_link(int willingness)
       //two_hop_neighbor->neighbor_2_state=0;
       //two_hop_neighbor->mpr_covered_count = 0;
 
-      dup_neighbor = olsr_lookup_neighbor_table(&two_hop_neighbor->neighbor_2_addr);
+      dup_neighbor = olsr_lookup_nbr_entry(&two_hop_neighbor->neighbor_2_addr);
 
       if ((dup_neighbor != NULL) && (dup_neighbor->status != NOT_SYM)) {
         OLSR_DEBUG(LOG_MPR, "(1)Skipping 2h neighbor %s - already 1hop\n",
@@ -176,7 +176,7 @@ olsr_chosen_mpr(struct nbr_entry *one_hop_neighbor, uint16_t * two_hop_covered_c
 
   for (second_hop_entries = one_hop_neighbor->neighbor_2_list.next;
        second_hop_entries != &one_hop_neighbor->neighbor_2_list; second_hop_entries = second_hop_entries->next) {
-    dup_neighbor = olsr_lookup_neighbor_table(&second_hop_entries->neighbor_2->neighbor_2_addr);
+    dup_neighbor = olsr_lookup_nbr_entry(&second_hop_entries->neighbor_2->neighbor_2_addr);
 
     if ((dup_neighbor != NULL) && (dup_neighbor->status == SYM)) {
       OLSR_DEBUG(LOG_MPR, "(2)Skipping 2h neighbor %s - already 1hop\n",
@@ -357,7 +357,7 @@ olsr_calculate_two_hop_neighbors(void)
     for (twohop_neighbors = a_neighbor->neighbor_2_list.next;
          twohop_neighbors != &a_neighbor->neighbor_2_list; twohop_neighbors = twohop_neighbors->next) {
 
-      dup_neighbor = olsr_lookup_neighbor_table(&twohop_neighbors->neighbor_2->neighbor_2_addr);
+      dup_neighbor = olsr_lookup_nbr_entry(&twohop_neighbors->neighbor_2->neighbor_2_addr);
 
       if ((dup_neighbor == NULL) || (dup_neighbor->status != SYM)) {
         n_count++;
@@ -504,7 +504,7 @@ olsr_optimize_mpr_set(void)
         for (two_hop_list = a_neighbor->neighbor_2_list.next;
              two_hop_list != &a_neighbor->neighbor_2_list; two_hop_list = two_hop_list->next) {
 
-          const struct nbr_entry *dup_neighbor = olsr_lookup_neighbor_table(&two_hop_list->neighbor_2->neighbor_2_addr);
+          const struct nbr_entry *dup_neighbor = olsr_lookup_nbr_entry(&two_hop_list->neighbor_2->neighbor_2_addr);
 
           if ((dup_neighbor != NULL) && (dup_neighbor->status != NOT_SYM)) {
             continue;
index 887d1cd..91cfb77 100644 (file)
@@ -116,7 +116,7 @@ olsr_del_nbr2_list(struct nbr2_list_entry *nbr2_list)
  * @return positive if entry deleted
  */
 int
-olsr_delete_neighbor_2_pointer(struct nbr_entry *neighbor, struct neighbor_2_entry *neigh2)
+olsr_delete_nbr2_list_entry(struct nbr_entry *neighbor, struct neighbor_2_entry *neigh2)
 {
   struct nbr2_list_entry *nbr2_list;
 
@@ -145,7 +145,7 @@ olsr_delete_neighbor_2_pointer(struct nbr_entry *neighbor, struct neighbor_2_ent
  *representing the two hop neighbor if found. NULL if not found.
  */
 struct nbr2_list_entry *
-olsr_lookup_my_neighbors(const struct nbr_entry *neighbor, const union olsr_ip_addr *neighbor_main_address)
+olsr_lookup_nbr2_list_entry(const struct nbr_entry *neighbor, const union olsr_ip_addr *neighbor_main_address)
 {
   struct nbr2_list_entry *entry;
 
@@ -171,7 +171,7 @@ olsr_lookup_my_neighbors(const struct nbr_entry *neighbor, const union olsr_ip_a
  */
 
 int
-olsr_delete_neighbor_table(const union olsr_ip_addr *neighbor_addr)
+olsr_delete_nbr_entry(const union olsr_ip_addr *neighbor_addr)
 {
   struct nbr2_list_entry *two_hop_list, *two_hop_to_delete;
   uint32_t hash;
@@ -233,7 +233,7 @@ olsr_delete_neighbor_table(const union olsr_ip_addr *neighbor_addr)
  *@return 0 if neighbor already exists 1 if inserted
  */
 struct nbr_entry *
-olsr_insert_neighbor_table(const union olsr_ip_addr *main_addr)
+olsr_add_nbr_entry(const union olsr_ip_addr *main_addr)
 {
   uint32_t hash;
   struct nbr_entry *new_neigh;
@@ -283,7 +283,7 @@ olsr_insert_neighbor_table(const union olsr_ip_addr *main_addr)
  *address. NULL if not found.
  */
 struct nbr_entry *
-olsr_lookup_neighbor_table(const union olsr_ip_addr *dst)
+olsr_lookup_nbr_entry(const union olsr_ip_addr *dst)
 {
   /*
    *Find main address of node
@@ -291,7 +291,7 @@ olsr_lookup_neighbor_table(const union olsr_ip_addr *dst)
   union olsr_ip_addr *tmp_ip = olsr_lookup_main_addr_by_alias(dst);
   if (tmp_ip != NULL)
     dst = tmp_ip;
-  return olsr_lookup_neighbor_table_alias(dst);
+  return olsr_lookup_nbr_entry_alias(dst);
 }
 
 
@@ -304,7 +304,7 @@ olsr_lookup_neighbor_table(const union olsr_ip_addr *dst)
  *address. NULL if not found.
  */
 struct nbr_entry *
-olsr_lookup_neighbor_table_alias(const union olsr_ip_addr *dst)
+olsr_lookup_nbr_entry_alias(const union olsr_ip_addr *dst)
 {
   struct nbr_entry *entry;
   uint32_t hash = olsr_ip_hashing(dst);
@@ -321,7 +321,7 @@ olsr_lookup_neighbor_table_alias(const union olsr_ip_addr *dst)
 
 
 int
-update_neighbor_status(struct nbr_entry *entry, int lnk)
+olsr_update_nbr_status(struct nbr_entry *entry, int lnk)
 {
   /*
    * Update neighbor entry
index 3d98b28..3e49ab0 100644 (file)
@@ -94,18 +94,18 @@ EXPORT(neighbortable)[HASHSIZE];
        olsr_init_neighbor_table(void);
 
      int
-       olsr_delete_neighbor_2_pointer(struct nbr_entry *, struct neighbor_2_entry *);
+       olsr_delete_nbr2_list_entry(struct nbr_entry *, struct neighbor_2_entry *);
 
-     struct nbr2_list_entry *olsr_lookup_my_neighbors(const struct nbr_entry *, const union olsr_ip_addr *);
+     struct nbr2_list_entry *olsr_lookup_nbr2_list_entry(const struct nbr_entry *, const union olsr_ip_addr *);
 
      int
-       olsr_delete_neighbor_table(const union olsr_ip_addr *);
+       olsr_delete_nbr_entry(const union olsr_ip_addr *);
 
-     struct nbr_entry *olsr_insert_neighbor_table(const union olsr_ip_addr *);
+     struct nbr_entry *olsr_add_nbr_entry(const union olsr_ip_addr *);
 
-     struct nbr_entry *olsr_lookup_neighbor_table(const union olsr_ip_addr *);
+     struct nbr_entry *olsr_lookup_nbr_entry(const union olsr_ip_addr *);
 
-     struct nbr_entry *olsr_lookup_neighbor_table_alias(const union olsr_ip_addr *);
+     struct nbr_entry *olsr_lookup_nbr_entry_alias(const union olsr_ip_addr *);
 
      void
        olsr_time_out_two_hop_neighbors(struct nbr_entry *);
@@ -119,7 +119,7 @@ EXPORT(neighbortable)[HASHSIZE];
 
 
      int
-       update_neighbor_status(struct nbr_entry *, int);
+       olsr_update_nbr_status(struct nbr_entry *, int);
 
 #endif
 
index fb8dc84..4381834 100644 (file)
@@ -284,7 +284,7 @@ olsr_forward_message(union olsr_message *m, struct interface *in_if, union olsr_
   if (!src)
     src = from_addr;
 
-  neighbor = olsr_lookup_neighbor_table(src);
+  neighbor = olsr_lookup_nbr_entry(src);
   if (!neighbor)
     return 0;
 
index 043151f..f613dae 100644 (file)
@@ -96,7 +96,7 @@ process_message_neighbors(struct nbr_entry *neighbor, const struct lq_hello_mess
     }
 
     if (message_neighbors->neigh_type == SYM_NEIGH || message_neighbors->neigh_type == MPR_NEIGH) {
-      struct nbr2_list_entry *two_hop_neighbor_yet = olsr_lookup_my_neighbors(neighbor, &message_neighbors->addr);
+      struct nbr2_list_entry *two_hop_neighbor_yet = olsr_lookup_nbr2_list_entry(neighbor, &message_neighbors->addr);
       if (two_hop_neighbor_yet != NULL) {
         struct neighbor_list_entry *walker;
 
@@ -168,7 +168,7 @@ process_message_neighbors(struct nbr_entry *neighbor, const struct lq_hello_mess
     }
     if (message_neighbors->neigh_type == SYM_NEIGH || message_neighbors->neigh_type == MPR_NEIGH) {
       struct neighbor_list_entry *walker;
-      struct nbr2_list_entry *two_hop_neighbor_yet = olsr_lookup_my_neighbors(neighbor, &message_neighbors->addr);
+      struct nbr2_list_entry *two_hop_neighbor_yet = olsr_lookup_nbr2_list_entry(neighbor, &message_neighbors->addr);
 
       if (!two_hop_neighbor_yet) {
         continue;
index acc8698..a057259 100644 (file)
@@ -115,7 +115,7 @@ olsr_delete_two_hop_neighbor_table(struct neighbor_2_entry *two_hop_neighbor)
     struct nbr_entry *one_hop_entry = one_hop_list->neighbor;
     struct neighbor_list_entry *entry_to_delete = one_hop_list;
 
-    olsr_delete_neighbor_2_pointer(one_hop_entry, two_hop_neighbor);
+    olsr_delete_nbr2_list_entry(one_hop_entry, two_hop_neighbor);
     one_hop_list = one_hop_list->next;
     /* no need to dequeue */
     free(entry_to_delete);