File cleanup
authorBernd Petrovitsch <bernd@firmix.at>
Wed, 5 Nov 2008 01:07:44 +0000 (02:07 +0100)
committerBernd Petrovitsch <bernd@firmix.at>
Wed, 5 Nov 2008 01:07:44 +0000 (02:07 +0100)
- made olsr_hello_tap() "static" as it is only used locally
- syntax cleanup
- killed white space the line end

src/packet.h
src/process_package.c
src/process_package.h

index 6c7c122..73f34cc 100644 (file)
@@ -63,8 +63,7 @@ struct hello_message {
   olsr_u8_t              hop_count;
   olsr_u8_t              ttl;
   olsr_u8_t              willingness;
-  struct hello_neighbor  *neighbors;
-  
+  struct hello_neighbor  *neighbors;  
 };
 
 struct tc_mpr_addr {
index f014b24..998f2c8 100644 (file)
@@ -3,31 +3,31 @@
  * Copyright (c) 2004, Andreas T√łnnesen(andreto@olsr.org)
  * All rights reserved.
  *
- * Redistribution and use in source and binary forms, with or without 
- * modification, are permitted provided that the following conditions 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
  * are met:
  *
- * * Redistributions of source code must retain the above copyright 
+ * * Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright 
- *   notice, this list of conditions and the following disclaimer in 
- *   the documentation and/or other materials provided with the 
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
  *   distribution.
- * * Neither the name of olsr.org, olsrd nor the names of its 
- *   contributors may be used to endorse or promote products derived 
+ * * Neither the name of olsr.org, olsrd nor the names of its
+ *   contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
  * Visit http://www.olsr.org for more information.
  */
 
 #include "process_package.h"
-#include "ipcalc.h"
-#include "defs.h"
-#include "lq_packet.h"
+#include "link_set.h"
 #include "hysteresis.h"
+#include "hna_set.h"
 #include "two_hop_neighbor_table.h"
-#include "tc_set.h"
+#include "neighbor_table.h"
 #include "mpr_selector_set.h"
 #include "mid_set.h"
 #include "olsr.h"
 #include "parser.h"
-#include "duplicate_set.h"
-#include "scheduler.h"
-#include "net_olsr.h"
-#include "lq_plugin.h"
-
-#include <stddef.h>
 
 static void process_message_neighbors(struct neighbor_entry *,
                                       const struct hello_message *);
 
 static void linking_this_2_entries(struct neighbor_entry *,
-                                   struct neighbor_2_entry *, olsr_reltime);
+                                   struct neighbor_2_entry *,
+                                   olsr_reltime);
 
 static olsr_bool lookup_mpr_status(const struct hello_message *,
                                    const struct interface *);
 
+static void hello_tap(struct hello_message *, struct interface *,
+                      const union olsr_ip_addr *);
+
 
 /**
- *Processes an list of neighbors from an incoming HELLO message.
- *@param neighbor the neighbor who sent the message.
- *@param message the HELLO message
- *@return nada
+ * Processes an list of neighbors from an incoming HELLO message.
+ * @param neighbor the neighbor who sent the message.
+ * @param message the HELLO message
+ * @return nada
  */
 static void
 process_message_neighbors(struct neighbor_entry *neighbor, const struct hello_message *message)
 {
-  struct hello_neighbor        *message_neighbors;
+  struct hello_neighbor *message_neighbors;
 
-  for(message_neighbors = message->neighbors;
-      message_neighbors != NULL;
-      message_neighbors = message_neighbors->next)
-    {
+  for (message_neighbors = message->neighbors;
+       message_neighbors != NULL;
+       message_neighbors = message_neighbors->next) {
 #ifdef DEBUG
-      struct ipaddr_str buf;
+    struct ipaddr_str buf;
 #endif
-      union olsr_ip_addr      *neigh_addr;
-      struct neighbor_2_entry *two_hop_neighbor;
-
-      /*
-       *check all interfaces
-       *so that we don't add ourselves to the
-       *2 hop list
-       *IMPORTANT!
-       */
-      if(if_ifwithaddr(&message_neighbors->address) != NULL)
-        continue;
-
-      /* Get the main address */
-      neigh_addr = olsr_lookup_main_addr_by_alias(&message_neighbors->address);
+    union olsr_ip_addr      *neigh_addr;
+    struct neighbor_2_entry *two_hop_neighbor;
 
-      if (neigh_addr != NULL) {
-        message_neighbors->address = *neigh_addr;
-      }
+    /*
+     * check all interfaces
+     * so that we don't add ourselves to the
+     * 2 hop list
+     * IMPORTANT!
+     */
+    if (if_ifwithaddr(&message_neighbors->address) != NULL) {
+        continue;
+    }
+    /* Get the main address */
+    neigh_addr = olsr_lookup_main_addr_by_alias(&message_neighbors->address);
+    if (neigh_addr != NULL) {
+      message_neighbors->address = *neigh_addr;
+    }
 
-      if(((message_neighbors->status == SYM_NEIGH) ||
-          (message_neighbors->status == MPR_NEIGH)))
-        {
-         struct neighbor_2_list_entry *two_hop_neighbor_yet =
-            olsr_lookup_my_neighbors(neighbor, &message_neighbors->address);
+    if (message_neighbors->status == SYM_NEIGH ||
+        message_neighbors->status == MPR_NEIGH) {
+      struct neighbor_2_list_entry *two_hop_neighbor_yet =
+        olsr_lookup_my_neighbors(neighbor, &message_neighbors->address);
 #ifdef DEBUG
-          OLSR_PRINTF(7, "\tProcessing %s\n", olsr_ip_to_string(&buf, &message_neighbors->address));
+      OLSR_PRINTF(7, "\tProcessing %s\n", olsr_ip_to_string(&buf, &message_neighbors->address));
 #endif
-          if (two_hop_neighbor_yet != NULL)
-            {
-              /* Updating the holding time for this neighbor */
-              olsr_set_timer(&two_hop_neighbor_yet->nbr2_list_timer,
-                             message->vtime, OLSR_NBR2_LIST_JITTER,
-                             OLSR_TIMER_ONESHOT, &olsr_expire_nbr2_list,
-                             two_hop_neighbor_yet, 0);
-              two_hop_neighbor = two_hop_neighbor_yet->neighbor_2;
-
-              /*
-               * For link quality OLSR, reset the path link quality here.
-               * The path link quality will be calculated in the second pass, below.
-               * Keep the saved_path_link_quality for reference.
-               */
-
-              if (olsr_cnf->lq_level > 0)
-                {
-                  /*
-                   * loop through the one-hop neighbors that see this
-                   * 'two_hop_neighbor'
-                   */
-
-                  struct neighbor_list_entry *walker;
-
-                  for (walker = two_hop_neighbor->neighbor_2_nblist.next;
-                       walker != &two_hop_neighbor->neighbor_2_nblist;
-                       walker = walker->next)
-                    {
-                      /*
-                       * have we found the one-hop neighbor that sent the
-                       * HELLO message that we're current processing?
-                       */
-
-                      if (walker->neighbor == neighbor)
-                        {
-                          walker->path_linkcost = LINK_COST_BROKEN;
-                        }
-                    }
-                }
+      if (two_hop_neighbor_yet != NULL) {
+        /* Updating the holding time for this neighbor */
+        olsr_set_timer(&two_hop_neighbor_yet->nbr2_list_timer,
+                       message->vtime, OLSR_NBR2_LIST_JITTER,
+                       OLSR_TIMER_ONESHOT, &olsr_expire_nbr2_list,
+                       two_hop_neighbor_yet, 0);
+        two_hop_neighbor = two_hop_neighbor_yet->neighbor_2;
+
+        /*
+         * For link quality OLSR, reset the path link quality here.
+         * The path link quality will be calculated in the second pass, below.
+         * Keep the saved_path_link_quality for reference.
+         */
+        if (olsr_cnf->lq_level > 0) {
+          /*
+           * loop through the one-hop neighbors that see this
+           * 'two_hop_neighbor'
+           */
+          struct neighbor_list_entry *walker;
+          for (walker = two_hop_neighbor->neighbor_2_nblist.next;
+               walker != &two_hop_neighbor->neighbor_2_nblist;
+               walker = walker->next){
+            /*
+             * have we found the one-hop neighbor that sent the
+             * HELLO message that we're current processing?
+             */
+
+            if (walker->neighbor == neighbor) {
+              walker->path_linkcost = LINK_COST_BROKEN;
             }
-          else
-            {
-              two_hop_neighbor =
-                olsr_lookup_two_hop_neighbor_table(&message_neighbors->address);
-              if (two_hop_neighbor == NULL)
-                {
+          }
+        }
+      } else {
+        two_hop_neighbor = olsr_lookup_two_hop_neighbor_table(&message_neighbors->address);
+        if (two_hop_neighbor == NULL) {
 #ifdef DEBUG
-                  OLSR_PRINTF(5, 
-                             "Adding 2 hop neighbor %s\n\n", 
-                             olsr_ip_to_string(&buf, &message_neighbors->address));
+          OLSR_PRINTF(5,
+                      "Adding 2 hop neighbor %s\n\n",
+                      olsr_ip_to_string(&buf, &message_neighbors->address));
 #endif
-                  changes_neighborhood = OLSR_TRUE;
-                  changes_topology = OLSR_TRUE;
-
-                  two_hop_neighbor =
-                    olsr_malloc(sizeof(struct neighbor_2_entry), "Process HELLO");
-                 
-                  two_hop_neighbor->neighbor_2_nblist.next =
-                    &two_hop_neighbor->neighbor_2_nblist;
-
-                  two_hop_neighbor->neighbor_2_nblist.prev =
-                    &two_hop_neighbor->neighbor_2_nblist;
-
-                  two_hop_neighbor->neighbor_2_pointer = 0;
-                 
-                  two_hop_neighbor->neighbor_2_addr = message_neighbors->address;
-
-                  olsr_insert_two_hop_neighbor_table(two_hop_neighbor);
-
-                  linking_this_2_entries(neighbor, two_hop_neighbor, message->vtime);
-                }
-              else
-                {
-                  /*
-                    linking to this two_hop_neighbor entry
-                  */   
-                  changes_neighborhood = OLSR_TRUE;
-                  changes_topology = OLSR_TRUE;
-                 
-                  linking_this_2_entries(neighbor, two_hop_neighbor, message->vtime); 
-                }
-            }
+          changes_neighborhood = OLSR_TRUE;
+          changes_topology = OLSR_TRUE;
+
+          two_hop_neighbor = olsr_malloc(sizeof(*two_hop_neighbor), "Process HELLO");
+
+          two_hop_neighbor->neighbor_2_nblist.next =&two_hop_neighbor->neighbor_2_nblist;
+          two_hop_neighbor->neighbor_2_nblist.prev =&two_hop_neighbor->neighbor_2_nblist;
+          two_hop_neighbor->neighbor_2_pointer = 0;
+          two_hop_neighbor->neighbor_2_addr = message_neighbors->address;
+          olsr_insert_two_hop_neighbor_table(two_hop_neighbor);
+          linking_this_2_entries(neighbor, two_hop_neighbor, message->vtime);
+        } else {
+          /*
+            linking to this two_hop_neighbor entry
+          */
+          changes_neighborhood = OLSR_TRUE;
+          changes_topology = OLSR_TRUE;
+
+          linking_this_2_entries(neighbor, two_hop_neighbor, message->vtime);
         }
+      }
     }
+  }
 
   /* Separate, second pass for link quality OLSR */
   /* Separate, second and third pass for link quality OLSR */
+  if (olsr_cnf->lq_level > 0) {
+    olsr_linkcost first_hop_pathcost;
+    struct link_entry *lnk = get_best_link_to_neighbor(&neighbor->neighbor_main_addr);
 
-  if (olsr_cnf->lq_level > 0)
-    {
-         olsr_linkcost first_hop_pathcost;
-      struct link_entry *lnk =
-        get_best_link_to_neighbor(&neighbor->neighbor_main_addr);
-
-      if(!lnk)
-       return;
-
-      /* calculate first hop path quality */
-      first_hop_pathcost = lnk->linkcost;
-      /*
-       *  Second pass for link quality OLSR: calculate the best 2-hop
-       * path costs to all the 2-hop neighbors indicated in the
-       * HELLO message. Since the same 2-hop neighbor may be listed
-       * more than once in the same HELLO message (each at a possibly
-       * different quality) we want to select only the best one, not just
-       * the last one listed in the HELLO message.
-       */
-
-      for(message_neighbors = message->neighbors;
-          message_neighbors != NULL;
-          message_neighbors = message_neighbors->next)
-        {
-          if(if_ifwithaddr(&message_neighbors->address) != NULL)
+    if (!lnk) {
+        return;
+    }
+    /* calculate first hop path quality */
+    first_hop_pathcost = lnk->linkcost;
+    /*
+     *  Second pass for link quality OLSR: calculate the best 2-hop
+     * path costs to all the 2-hop neighbors indicated in the
+     * HELLO message. Since the same 2-hop neighbor may be listed
+     * more than once in the same HELLO message (each at a possibly
+     * different quality) we want to select only the best one, not just
+     * the last one listed in the HELLO message.
+     */
+    for(message_neighbors = message->neighbors;
+        message_neighbors != NULL;
+        message_neighbors = message_neighbors->next) {
+      if (if_ifwithaddr(&message_neighbors->address) != NULL) {
             continue;
+      }
+      if (message_neighbors->status == SYM_NEIGH ||
+          message_neighbors->status == MPR_NEIGH) {
+        struct neighbor_list_entry *walker;
+        struct neighbor_2_list_entry *two_hop_neighbor_yet =
+          olsr_lookup_my_neighbors(neighbor, &message_neighbors->address);
+
+        if (!two_hop_neighbor_yet) {
+          continue;
+        }
 
-          if(((message_neighbors->status == SYM_NEIGH) ||
-              (message_neighbors->status == MPR_NEIGH)))
-            {
-              struct neighbor_list_entry *walker;
-              struct neighbor_2_entry *two_hop_neighbor;
-              struct neighbor_2_list_entry *two_hop_neighbor_yet =
-                olsr_lookup_my_neighbors(neighbor, &message_neighbors->address);
-
-              if(!two_hop_neighbor_yet)
-                continue;
-
-              two_hop_neighbor = two_hop_neighbor_yet->neighbor_2;
-
-              /*
-               *  loop through the one-hop neighbors that see this
-               * 'two_hop_neighbor'
-               */
-
-              for (walker = two_hop_neighbor->neighbor_2_nblist.next;
-                   walker != &two_hop_neighbor->neighbor_2_nblist;
-                   walker = walker->next)
-                {
-                  /*
-                   * have we found the one-hop neighbor that sent the
-                   * HELLO message that we're current processing?
-                   */
-
-                  if (walker->neighbor == neighbor)
-                    {
-                      olsr_linkcost new_second_hop_linkcost, new_path_linkcost;
-
-                      // the link cost between the 1-hop neighbour and the
-                      // 2-hop neighbour
-
-                      new_second_hop_linkcost = message_neighbors->cost;
-
-                      // the total cost for the route
-                      // "us --- 1-hop --- 2-hop"
-
-                      new_path_linkcost =
-                        first_hop_pathcost + new_second_hop_linkcost;
-
-                      // Only copy the link quality if it is better than what we have
-                      // for this 2-hop neighbor
-                      if (new_path_linkcost < walker->path_linkcost)
-                        {
-                          walker->second_hop_linkcost = new_second_hop_linkcost;
-                          walker->path_linkcost = new_path_linkcost;
-                          
-                          if (olsr_is_relevant_costchange(new_path_linkcost, walker->saved_path_linkcost))
-                            {
-                              walker->saved_path_linkcost = new_path_linkcost;
-
-                              if (olsr_cnf->lq_dlimit > 0)
-                              {
-                                changes_neighborhood = OLSR_TRUE;
-                                changes_topology = OLSR_TRUE;
-                              }
-
-                              else
-                                OLSR_PRINTF(3, "Skipping Dijkstra (3)\n");
-                            }
-                        }
-                    }
+        /*
+         *  loop through the one-hop neighbors that see this
+         * 'two_hop_neighbor_yet->neighbor_2'
+         */
+        for (walker = two_hop_neighbor_yet->neighbor_2->neighbor_2_nblist.next;
+             walker != &two_hop_neighbor_yet->neighbor_2->neighbor_2_nblist;
+             walker = walker->next) {
+          /*
+           * have we found the one-hop neighbor that sent the
+           * HELLO message that we're current processing?
+           */
+          if (walker->neighbor == neighbor) {
+            // the link cost between the 1-hop neighbour and the
+            // 2-hop neighbour
+            olsr_linkcost new_second_hop_linkcost = message_neighbors->cost;
+
+            // the total cost for the route
+            // "us --- 1-hop --- 2-hop"
+            olsr_linkcost new_path_linkcost = first_hop_pathcost + new_second_hop_linkcost;
+
+            // Only copy the link quality if it is better than what we have
+            // for this 2-hop neighbor
+            if (new_path_linkcost < walker->path_linkcost){
+              walker->second_hop_linkcost = new_second_hop_linkcost;
+              walker->path_linkcost = new_path_linkcost;
+
+              if (olsr_is_relevant_costchange(new_path_linkcost, walker->saved_path_linkcost)){
+                walker->saved_path_linkcost = new_path_linkcost;
+
+                if (olsr_cnf->lq_dlimit > 0) {
+                  changes_neighborhood = OLSR_TRUE;
+                  changes_topology = OLSR_TRUE;
+                } else {
+                  OLSR_PRINTF(3, "Skipping Dijkstra (3)\n");
                 }
+              }
             }
+          }
         }
+      }
     }
+  }
 }
 
 /**
- *Links a one-hop neighbor with a 2-hop neighbor.
+ * Links a one-hop neighbor with a 2-hop neighbor.
  *
- *@param neighbor the 1-hop neighbor
- *@param two_hop_neighbor the 2-hop neighbor
- *@return nada
+ * @param neighbor the 1-hop neighbor
+ * @param two_hop_neighbor the 2-hop neighbor
+ * @return nada
  */
 static void
 linking_this_2_entries(struct neighbor_entry *neighbor, struct neighbor_2_entry *two_hop_neighbor, olsr_reltime vtime)
 {
-  struct neighbor_list_entry    *list_of_1_neighbors = olsr_malloc(sizeof(struct neighbor_list_entry), "Link entries 1");
-  struct neighbor_2_list_entry  *list_of_2_neighbors = olsr_malloc(sizeof(struct neighbor_2_list_entry), "Link entries 2");
+  struct neighbor_list_entry    *list_of_1_neighbors = olsr_malloc(sizeof(*list_of_1_neighbors), "Link entries 1");
+  struct neighbor_2_list_entry  *list_of_2_neighbors = olsr_malloc(sizeof(*list_of_2_neighbors), "Link entries 2");
 
   list_of_1_neighbors->neighbor = neighbor;
 
@@ -323,7 +275,7 @@ linking_this_2_entries(struct neighbor_entry *neighbor, struct neighbor_2_entry
   list_of_1_neighbors->prev = &two_hop_neighbor->neighbor_2_nblist;
   list_of_2_neighbors->neighbor_2 = two_hop_neighbor;
   list_of_2_neighbors->nbr2_nbr = neighbor; /* XXX refcount */
-  
+
   olsr_change_timer(list_of_2_neighbors->nbr2_list_timer, vtime,
                     OLSR_NBR2_LIST_JITTER, OLSR_TIMER_ONESHOT);
 
@@ -332,7 +284,7 @@ linking_this_2_entries(struct neighbor_entry *neighbor, struct neighbor_2_entry
   list_of_2_neighbors->next = neighbor->neighbor_2_list.next;
   neighbor->neighbor_2_list.next = list_of_2_neighbors;
   list_of_2_neighbors->prev = &neighbor->neighbor_2_list;
-  
+
   /*increment the pointer counter*/
   two_hop_neighbor->neighbor_2_pointer++;
 }
@@ -343,23 +295,19 @@ linking_this_2_entries(struct neighbor_entry *neighbor, struct neighbor_2_entry
  * @param message the message to check
  * @param n_link the buffer to put the link status in
  *
- *@return 1 if we are selected as MPR 0 if not
+ * @return 1 if we are selected as MPR 0 if not
  */
 static olsr_bool
 lookup_mpr_status(const struct hello_message *message,
                   const struct interface *in_if)
-{  
-  struct hello_neighbor  *neighbors; 
+{
+  struct hello_neighbor *neighbors;
 
   for (neighbors = message->neighbors; neighbors; neighbors = neighbors->next) {
     if (olsr_cnf->ip_version == AF_INET
         ? ip4equal(&neighbors->address.v4, &in_if->ip_addr.v4)
         : ip6equal(&neighbors->address.v6, &in_if->int6_addr.sin6_addr)) {
-
-      if (neighbors->link == SYM_LINK && neighbors->status == MPR_NEIGH) {
-        return OLSR_TRUE;
-      }
-      break;
+      return neighbors->link == SYM_LINK && neighbors->status == MPR_NEIGH ? OLSR_TRUE : OLSR_FALSE;
     }
   }
   /* Not found */
@@ -368,7 +316,7 @@ lookup_mpr_status(const struct hello_message *message,
 
 /**
  * Initializing the parser functions we are using
- * For downwards compatibility reasons we also understand the non-LQ messages. 
+ * For downwards compatibility reasons we also understand the non-LQ messages.
  */
 void
 olsr_init_package_process(void)
@@ -418,7 +366,7 @@ deserialize_hello(struct hello_message *hello, const void *ser)
       pkt_get_ipaddress(&curr, &neigh->address);
 
       if (type == LQ_HELLO_MESSAGE) {
-       olsr_deserialize_hello_lq_pair(&curr, neigh);
+        olsr_deserialize_hello_lq_pair(&curr, neigh);
       }
       neigh->link = EXTRACT_LINK(info_head->link_code);
       neigh->status = EXTRACT_STATUS(info_head->link_code);
@@ -431,10 +379,10 @@ deserialize_hello(struct hello_message *hello, const void *ser)
 }
 
 
-void
-olsr_hello_tap(struct hello_message *message,
-               struct interface *in_if,
-               const union olsr_ip_addr *from_addr)
+static void
+hello_tap(struct hello_message *message,
+          struct interface *in_if,
+          const union olsr_ip_addr *from_addr)
 {
   /*
    * Update link status
@@ -449,7 +397,7 @@ olsr_hello_tap(struct hello_message *message,
     /* find the input interface in the list of neighbor interfaces */
     for (walker = message->neighbors; walker != NULL; walker = walker->next) {
       if (ipequal(&walker->address, &in_if->ip_addr)) {
-       break;
+        break;
       }
     }
 
@@ -464,25 +412,25 @@ olsr_hello_tap(struct hello_message *message,
   /*
    * Hysteresis
    */
-  if(olsr_cnf->use_hysteresis) {
+  if (olsr_cnf->use_hysteresis) {
     /* Update HELLO timeout */
     /* printf("MESSAGE HTIME: %f\n", message->htime);*/
     olsr_update_hysteresis_hello(lnk, message->htime);
   }
 
   /* Check if we are chosen as MPR */
-  if(lookup_mpr_status(message, in_if)) {
+  if (lookup_mpr_status(message, in_if)) {
     /* source_addr is always the main addr of a node! */
     olsr_update_mprs_set(&message->source_addr, message->vtime);
   }
 
   /* Check willingness */
-  if(lnk->neighbor->willingness != message->willingness) {
+  if (lnk->neighbor->willingness != message->willingness) {
     struct ipaddr_str buf;
-    OLSR_PRINTF(1, "Willingness for %s changed from %d to %d - UPDATING\n", 
-               olsr_ip_to_string(&buf, &lnk->neighbor->neighbor_main_addr),
-               lnk->neighbor->willingness,
-               message->willingness);
+    OLSR_PRINTF(1, "Willingness for %s changed from %d to %d - UPDATING\n",
+                olsr_ip_to_string(&buf, &lnk->neighbor->neighbor_main_addr),
+                lnk->neighbor->willingness,
+                message->willingness);
     /*
      *If willingness changed - recalculate
      */
@@ -492,7 +440,7 @@ olsr_hello_tap(struct hello_message *message,
   }
 
   /* Don't register neighbors of neighbors that announces WILL_NEVER */
-  if(lnk->neighbor->willingness != WILL_NEVER) {
+  if (lnk->neighbor->willingness != WILL_NEVER) {
     process_message_neighbors(lnk->neighbor, message);
   }
 
@@ -502,17 +450,17 @@ olsr_hello_tap(struct hello_message *message,
   olsr_free_hello_packet(message);
 }
 
-
-void olsr_input_hello(union olsr_message *msg, struct interface *inif, union olsr_ip_addr *from) {
+void olsr_input_hello(union olsr_message *msg, struct interface *inif, union olsr_ip_addr *from)
+{
   struct hello_message hello;
-       
+
   if (msg == NULL) {
     return;
   }
   if (deserialize_hello(&hello, msg) != 0) {
     return;
   }
-  olsr_hello_tap(&hello, inif, from);
+  hello_tap(&hello, inif, from);
 }
 
 /*
index 4a31656..eb22c71 100644 (file)
@@ -43,8 +43,6 @@
 #define _OLSR_PROCESS_PACKAGE
 
 #include "olsr_protocol.h"
-#include "packet.h"
-#include "neighbor_table.h"
 
 void
 olsr_input_hello(union olsr_message *ser, struct interface *inif, union olsr_ip_addr *from);
@@ -52,9 +50,6 @@ olsr_input_hello(union olsr_message *ser, struct interface *inif, union olsr_ip_
 void
 olsr_init_package_process(void);
 
-void
-olsr_hello_tap(struct hello_message *, struct interface *, const union olsr_ip_addr *);
-
 void
 olsr_process_received_hello(union olsr_message *, struct interface *, union olsr_ip_addr *);