Windows port compiles again. Moved all LQ packet functions to a single
authorThomas Lopatic <thomas@lopatic.de>
Wed, 3 Nov 2004 18:19:54 +0000 (18:19 +0000)
committerThomas Lopatic <thomas@lopatic.de>
Wed, 3 Nov 2004 18:19:54 +0000 (18:19 +0000)
file. Rudimentary LQ HELLO processing compiles. Not tested, yet.

31 files changed:
Makefile.win32.in
src/build_msg.c
src/build_msg.h
src/defs.h
src/generate_msg.c
src/generate_msg.h
src/link_set.c
src/link_set.h
src/linux/ifnet.c
src/lq_packet.c [new file with mode: 0644]
src/lq_packet.h [new file with mode: 0644]
src/main.c
src/olsr_protocol.h
src/packet.c
src/packet.h
src/parser.c
src/process_package.c
src/process_package.h
src/rebuild_packet.c
src/rebuild_packet.h
src/win32/apm.c
src/win32/arpa/inet.h
src/win32/compat.c
src/win32/ifnet.c
src/win32/kernel_routes.c
src/win32/net.c
src/win32/net/route.h
src/win32/netinet/in.h
src/win32/pthread.h
src/win32/sys/time.h
src/win32/tunnel.c

index f823ff7..8ea3c55 100644 (file)
@@ -33,6 +33,7 @@ MAINOBJS =    src/build_msg.o \
                src/cfgparser/oparse.o \
                src/cfgparser/oscan.o \
                src/cfgparser/olsrd_conf.o \
+               src/lq_packet.o \
                src/win32/apm.o \
                src/win32/compat.o \
                src/win32/ifnet.o \
index 68a64a6..8db21c1 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: build_msg.c,v 1.19 2004/11/03 10:00:10 kattemat Exp $
+ * $Id: build_msg.c,v 1.20 2004/11/03 18:19:53 tlopatic Exp $
  *
  */
 
@@ -1263,379 +1263,3 @@ hna_build6(struct interface *ifp)
   return;
 
 }
-
-#if defined USE_LINK_QUALITY
-void
-lq_hello_build(struct lq_hello_message *msg, struct interface *outif)
-{
-  int off, rem, size, req;
-  union olsr_message *olsr_msg;
-  struct lq_hello_header *head;
-  struct lq_hello_info_header *info_head;
-  struct lq_hello_neighbor *neigh;
-  unsigned char *buff;
-  olsr_bool is_first;
-  int i, j;
-
-  if (msg == NULL || outif == NULL)
-    return;
-
-  olsr_msg = (union olsr_message *)msg_buffer;
-
-  // initialize the OLSR header
-
-  if (olsr_cnf->ip_version == AF_INET)
-    {
-      olsr_msg->v4.olsr_msgtype = LQ_HELLO_MESSAGE;
-      olsr_msg->v4.olsr_vtime = outif->valtimes.hello;
-
-      COPY_IP(&olsr_msg->v4.originator, &msg->main);
-
-      olsr_msg->v4.ttl = msg->ttl;
-      olsr_msg->v4.hopcnt = msg->hops;
-    }
-
-  else
-    {
-      olsr_msg->v6.olsr_msgtype = LQ_HELLO_MESSAGE;
-      olsr_msg->v6.olsr_vtime = outif->valtimes.hello;
-
-      COPY_IP(&olsr_msg->v6.originator, &msg->main);
-
-      olsr_msg->v6.ttl = msg->ttl;
-      olsr_msg->v6.hopcnt = msg->hops;
-    }
-
-  off = 8 + ipsize;
-
-  // initialize the LQ_HELLO header
-
-  head = (struct lq_hello_header *)(msg_buffer + off);
-
-  head->reserved = 0;
-  head->htime = outif->hello_etime;
-  head->will = msg->will; 
-
-  // 'off' is the offset of the byte following the LQ_HELLO header
-
-  off += sizeof (struct lq_hello_header);
-
-  // our work buffer starts at 'off'...
-
-  buff = msg_buffer + off;
-
-  // ... that's why we start with a 'size' of 0 and subtract 'off' from
-  // the remaining bytes in the output buffer
-
-  size = 0;
-  rem = net_outbuffer_bytes_left(outif) - off;
-
-  // initially, we want to put at least an info header, an IP address,
-  // and the corresponding link quality into the message
-
-  if (rem < sizeof (struct lq_hello_info_header) + ipsize + 4)
-  {
-    net_output(outif);
-
-    rem = net_outbuffer_bytes_left(outif) - off;
-  }
-
-  info_head = NULL;
-
-  // iterate through all neighbor types ('i') and all link types ('j')
-
-  for (i = 0; i <= MAX_NEIGH; i++) 
-    {
-      for(j = 0; j <= MAX_LINK; j++)
-       {
-         if(j == HIDE_LINK)
-             continue;
-
-          is_first = TRUE;
-
-          // loop through neighbors
-
-         for (neigh = msg->neigh; neigh != NULL; neigh = neigh->next)
-           {  
-             if (neigh->neigh_type != i || neigh->link_type != j)
-                continue;
-
-              // we need space for an IP address plus link quality
-              // information
-
-              req = ipsize + 4;
-
-              // no, we also need space for an info header, as this is the
-              // first neighbor with the current neighor type and link type
-
-              if (is_first)
-                req += sizeof (struct lq_hello_info_header);
-
-              // we do not have enough space left
-
-              if (size + req > rem)
-                {
-                  // finalize the OLSR header
-                  
-                  if (olsr_cnf->ip_version == AF_INET)
-                    {
-                      olsr_msg->v4.seqno = htons(get_msg_seqno());
-                      olsr_msg->v4.olsr_msgsize = htons(size + off);
-                    }
-
-                  else
-                    {
-                      olsr_msg->v6.seqno = htons(get_msg_seqno());
-                      olsr_msg->v6.olsr_msgsize = htons(size + off);
-                    }
-                             
-                  // finalize the info header
-
-                  info_head->size =
-                    ntohs(buff + size - (unsigned char *)info_head);
-                             
-                  // output packet
-
-                  net_outbuffer_push(outif, msg_buffer, size + off);
-
-                  net_output(outif);
-
-                  // move to the beginning of the buffer
-
-                  size = 0;
-                  rem = net_outbuffer_bytes_left(outif) - off;
-
-                  // we need a new info header
-
-                  is_first = TRUE;
-                }
-
-              // create a new info header
-
-              if (is_first)
-                {
-                  info_head = (struct lq_hello_info_header *)(buff + size);
-                  size += sizeof (struct lq_hello_info_header);
-
-                  info_head->reserved = 0;
-                  info_head->link_code = CREATE_LINK_CODE(i, j);
-                }
-
-#ifdef DEBUG
-              olsr_printf(5, "\tLink status of %s: %d\n",
-                          olsr_ip_to_string(&neigh->address), neigh->link);
-#endif
-                 
-              // add the current neighbor's IP address
-
-              COPY_IP(buff + size, &neigh->addr);
-              size += ipsize;
-
-              // add the corresponding link quality
-
-              buff[size++] = (unsigned char)(neigh->link_quality * 256);
-
-              // pad
-
-              buff[size++] = 0;
-              buff[size++] = 0;
-              buff[size++] = 0;
-
-              is_first = FALSE;
-           }
-
-          // finalize the info header, if there are any neighbors with the
-          // current neighbor type and link type
-
-         if (!is_first)
-            info_head->size = ntohs(buff + size - (unsigned char *)info_head);
-       }
-    }
-
-  // finalize the OLSR header
-     
-  if (olsr_cnf->ip_version == AF_INET)
-    {
-      olsr_msg->v4.seqno = htons(get_msg_seqno());
-      olsr_msg->v4.olsr_msgsize = htons(size + off);
-    }
-
-  else
-    {
-      olsr_msg->v6.seqno = htons(get_msg_seqno());
-      olsr_msg->v6.olsr_msgsize = htons(size + off);
-    }
-                             
-  // move the message to the output buffer
-
-  net_outbuffer_push(outif, msg_buffer, size + off);
-
-  // clean-up
-
-  olsr_destroy_lq_hello_message(msg);
-}
-
-void
-lq_tc_build(struct lq_tc_message *msg, struct interface *outif)
-{
-  int off, rem, size;
-  union olsr_message *olsr_msg;
-  struct lq_tc_header *head;
-  struct lq_tc_neighbor *neigh;
-  unsigned char *buff;
-  olsr_bool is_empty;
-
-  if (msg == NULL || outif == NULL)
-    return;
-
-  olsr_msg = (union olsr_message *)msg_buffer;
-
-  // initialize the OLSR header
-
-  if (olsr_cnf->ip_version == AF_INET)
-    {
-      olsr_msg->v4.olsr_msgtype = LQ_TC_MESSAGE;
-      olsr_msg->v4.olsr_vtime = outif->valtimes.tc;
-
-      COPY_IP(&olsr_msg->v4.originator, &msg->main);
-
-      olsr_msg->v4.ttl = msg->ttl;
-      olsr_msg->v4.hopcnt = msg->hops;
-    }
-
-  else
-    {
-      olsr_msg->v6.olsr_msgtype = LQ_TC_MESSAGE;
-      olsr_msg->v6.olsr_vtime = outif->valtimes.tc;
-
-      COPY_IP(&olsr_msg->v6.originator, &msg->main);
-
-      olsr_msg->v6.ttl = msg->ttl;
-      olsr_msg->v6.hopcnt = msg->hops;
-    }
-
-  off = 8 + ipsize;
-
-  // initialize the LQ_TC header
-
-  head = (struct lq_tc_header *)(msg_buffer + off);
-
-  head->ansn = htons(msg->ansn);
-  head->reserved = 0;
-
-  // 'off' is the offset of the byte following the LQ_TC header
-
-  off += sizeof (struct lq_tc_header);
-
-  // our work buffer starts at 'off'...
-
-  buff = msg_buffer + off;
-
-  // ... that's why we start with a 'size' of 0 and subtract 'off' from
-  // the remaining bytes in the output buffer
-
-  size = 0;
-  rem = net_outbuffer_bytes_left(outif) - off;
-
-  // initially, we want to put at least an IP address and the corresponding
-  // link quality into the message
-
-  if (rem < ipsize + 4)
-  {
-    net_output(outif);
-
-    rem = net_outbuffer_bytes_left(outif) - off;
-  }
-
-  // initially, we're empty
-
-  is_empty = TRUE;
-
-  // loop through neighbors
-
-  for (neigh = msg->neigh; neigh != NULL; neigh = neigh->next)
-    {  
-      // we need space for an IP address plus link quality
-      // information
-
-      if (size + ipsize + 4 > rem)
-        {
-          // finalize the OLSR header
-                  
-          if (olsr_cnf->ip_version == AF_INET)
-            {
-              olsr_msg->v4.seqno = htons(get_msg_seqno());
-              olsr_msg->v4.olsr_msgsize = htons(size + off);
-            }
-
-          else
-            {
-              olsr_msg->v6.seqno = htons(get_msg_seqno());
-              olsr_msg->v6.olsr_msgsize = htons(size + off);
-            }
-
-          // output packet
-
-          net_outbuffer_push(outif, msg_buffer, size + off);
-
-          net_output(outif);
-
-          // move to the beginning of the buffer
-
-          size = 0;
-          rem = net_outbuffer_bytes_left(outif) - off;
-        }
-
-      // add the current neighbor's IP address
-
-      COPY_IP(buff + size, &neigh->main);
-      size += ipsize;
-
-      // add the corresponding link quality
-
-      buff[size++] = (unsigned char)(neigh->link_quality * 256);
-
-      // pad
-
-      buff[size++] = 0;
-      buff[size++] = 0;
-      buff[size++] = 0;
-
-      // we're not empty any longer
-
-      is_empty = FALSE;
-    }
-
-  // finalize the OLSR header
-     
-  if (olsr_cnf->ip_version == AF_INET)
-    {
-      olsr_msg->v4.seqno = htons(get_msg_seqno());
-      olsr_msg->v4.olsr_msgsize = htons(size + off);
-    }
-
-  else
-    {
-      olsr_msg->v6.seqno = htons(get_msg_seqno());
-      olsr_msg->v6.olsr_msgsize = htons(size + off);
-    }
-                             
-  // if we did not advertise any neighbors, we might still want to
-  // send empty LQ_TC messages
-
-  if (is_empty && !TIMED_OUT(&send_empty_tc))
-  {
-    olsr_printf(1, "LQ_TC: Sending empty package\n");
-    is_empty = FALSE;
-  }
-
-  // move the message to the output buffer
-
-  if (!is_empty)
-    net_outbuffer_push(outif, msg_buffer, size + off);
-
-  // clean-up
-
-  olsr_destroy_lq_tc_message(msg);
-}
-#endif
index 6566c34..617ed86 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: build_msg.h,v 1.8 2004/11/01 19:27:10 tlopatic Exp $
+ * $Id: build_msg.h,v 1.9 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -41,12 +41,4 @@ mid_build(struct interface *);
 void
 hna_build(struct interface *);
 
-#if defined USE_LINK_QUALITY
-void
-lq_hello_build(struct lq_hello_message *msg, struct interface *outif);
-
-void
-lq_tc_build(struct lq_tc_message *msg, struct interface *outif);
-#endif
-
 #endif
index 07ce1b1..abe21b2 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: defs.h,v 1.21 2004/11/03 10:00:10 kattemat Exp $
+ * $Id: defs.h,v 1.22 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -31,7 +31,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 #include <errno.h>
+#include <time.h>
 
 #include "log.h"
 #include "olsr_protocol.h"
 #include "olsr.h" /* Everybody uses theese */
 #include "olsr_cfg.h"
 
+#if defined USE_LINK_QUALITY
+#include "lq_packet.h"
+#endif
+
 #define VERSION "0.4.8-pre"
 #define SOFTWARE_VERSION "olsr.org - " VERSION
 
index 5c8d9ce..c93a940 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: generate_msg.c,v 1.11 2004/11/01 19:27:10 tlopatic Exp $
+ * $Id: generate_msg.c,v 1.12 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -37,9 +37,6 @@
 #include "mpr_selector_set.h"
 #include "duplicate_set.h"
 #include "neighbor_table.h"
-#if defined USE_LINK_QUALITY
-#include "link_set.h"
-#endif
 
 
 void
@@ -70,34 +67,6 @@ generate_tc(void *p)
     }
 }
 
-#if defined USE_LINK_QUALITY
-void
-generate_lq_hello(void *para)
-{
-  struct lq_hello_message lq_hello;
-  struct interface *outif = (struct interface *)para;
-
-  olsr_build_lq_hello_packet(&lq_hello, outif);
-  lq_hello_build(&lq_hello, outif);
-      
-  if(net_output_pending(outif))
-    net_output(outif);
-}
-
-void
-generate_lq_tc(void *para)
-{
-  struct lq_tc_message lq_tc;
-  struct interface *outif = (struct interface *)para;
-
-  olsr_build_lq_tc_packet(&lq_tc);
-  lq_tc_build(&lq_tc, outif);
-
-  if(net_output_pending(outif) && TIMED_OUT(&fwdtimer[outif->if_nr]))
-    set_buffer_timer(outif);
-}
-#endif
-
 void
 generate_mid(void *p)
 {
@@ -134,9 +103,6 @@ generate_tabledisplay(void *foo)
 {
   if(olsr_cnf->debug_level > 0) 
     {
-#if defined USE_LINK_QUALITY
-      olsr_print_link_set();
-#endif
       olsr_print_neighbor_table();
       
       if(olsr_cnf->debug_level > 1)
index 657eb4f..cf54993 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: generate_msg.h,v 1.8 2004/11/01 20:04:12 tlopatic Exp $
+ * $Id: generate_msg.h,v 1.9 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -45,12 +45,4 @@ generate_tc(void *);
 void
 generate_tabledisplay(void *);
 
-#if defined USE_LINK_QUALITY
-void
-generate_lq_hello(void *para);
-
-void
-generate_lq_tc(void *para);
-#endif
-
 #endif
index 42852f1..71adf4a 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: link_set.c,v 1.12 2004/11/03 09:22:59 kattemat Exp $
+ * $Id: link_set.c,v 1.13 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -37,8 +37,6 @@
 
 #include "link_layer.h"
 
-
-
 /* Begin:
  * Prototypes for internal functions 
  */
@@ -1015,4 +1013,53 @@ float olsr_neighbor_best_link_quality(union olsr_ip_addr *main)
 
   return res;
 }
+
+struct link_entry *update_lq_link_entry(union olsr_ip_addr *local,
+                                        union olsr_ip_addr *remote,
+                                        struct lq_hello_message *lq_hello,
+                                        struct interface *inif)
+{
+  struct lq_hello_neighbor *neigh;
+  int stat;
+  struct link_entry *link;
+  struct interface *inter;
+
+  link = add_new_entry(local, remote, &lq_hello->comm.orig,
+                       lq_hello->comm.vtime, lq_hello->htime);
+
+  olsr_get_timestamp((olsr_u32_t)(lq_hello->comm.vtime * 1000),
+                     &link->ASYM_time);
+
+  for (neigh = lq_hello->neigh; neigh != NULL; neigh = neigh->next)
+      for (inter = ifnet; inter != NULL; inter = inter->int_next) 
+        if(COMP_IP(&neigh->addr, &inter->ip_addr))
+          break;
+
+  stat = (neigh != NULL) ? neigh->link_type : UNSPEC_LINK;
+
+  if (stat == LOST_LINK)
+    {
+      link->SYM_time = now;
+      link->SYM_time.tv_sec -= 1;
+    }
+
+  else if (stat == SYM_LINK || stat == ASYM_LINK)
+    {
+      olsr_get_timestamp((olsr_u32_t)(lq_hello->comm.vtime * 1000),
+                         &link->SYM_time);
+      timeradd(&link->SYM_time, &hold_time_neighbor, &link->time);
+    }
+
+  if(timercmp(&link->time, &link->ASYM_time, <))
+    link->time = link->ASYM_time;
+
+  if(olsr_cnf->use_hysteresis)
+    olsr_process_hysteresis(link);
+
+  stat = get_neighbor_status(remote);
+
+  update_neighbor_status(link->neighbor, stat);
+
+  return link;
+}
 #endif
index 0bcd4b0..0baaa32 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: link_set.h,v 1.10 2004/11/01 19:27:10 tlopatic Exp $
+ * $Id: link_set.h,v 1.11 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -126,6 +126,10 @@ void olsr_update_packet_loss(union olsr_ip_addr *rem, union olsr_ip_addr *loc,
                         olsr_u16_t seqno);
 void olsr_print_link_set(void);
 float olsr_neighbor_best_link_quality(union olsr_ip_addr *main);
+struct link_entry *update_lq_link_entry(union olsr_ip_addr *local,
+                                        union olsr_ip_addr *remote,
+                                        struct lq_hello_message *lq_hello,
+                                        struct interface *inif);
 #endif
 
 #endif
index 4dd535a..e957026 100644 (file)
@@ -20,7 +20,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: ifnet.c,v 1.16 2004/11/02 21:14:12 kattemat Exp $
+ * $Id: ifnet.c,v 1.17 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -448,12 +448,12 @@ chk_if_changed(struct olsr_if *iface)
                              0, 
                              NULL);
 #else
-  olsr_remove_scheduler_event(&generate_lq_hello, 
+  olsr_remove_scheduler_event(&olsr_output_lq_hello, 
                              ifp, 
                              iface->cnf->hello_params.emission_interval, 
                              0, 
                              NULL);
-  olsr_remove_scheduler_event(&generate_lq_tc, 
+  olsr_remove_scheduler_event(&olsr_output_lq_tc, 
                              ifp, 
                              iface->cnf->tc_params.emission_interval,
                              0, 
@@ -786,12 +786,12 @@ chk_if_up(struct olsr_if *iface, int debuglvl)
                                0, 
                                NULL);
 #else
-  olsr_register_scheduler_event(&generate_lq_hello, 
+  olsr_register_scheduler_event(&olsr_output_lq_hello, 
                                ifp, 
                                iface->cnf->hello_params.emission_interval, 
                                0, 
                                NULL);
-  olsr_register_scheduler_event(&generate_lq_tc, 
+  olsr_register_scheduler_event(&olsr_output_lq_tc, 
                                ifp, 
                                iface->cnf->tc_params.emission_interval,
                                0, 
diff --git a/src/lq_packet.c b/src/lq_packet.c
new file mode 100644 (file)
index 0000000..5230ae2
--- /dev/null
@@ -0,0 +1,807 @@
+/*
+ * OLSR ad-hoc routing table management protocol
+ * Copyright (C) 2003 Andreas Tønnesen (andreto@ifi.uio.no)
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)
+ *
+ * This file is part of the olsr.org OLSR daemon.
+ *
+ * olsr.org is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * olsr.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with olsr.org; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * 
+ * 
+ * $Id: lq_packet.c,v 1.1 2004/11/03 18:19:54 tlopatic Exp $
+ *
+ */
+
+#if defined USE_LINK_QUALITY
+#include "olsr_protocol.h"
+#include "defs.h"
+#include "interfaces.h"
+#include "link_set.h"
+#include "neighbor_table.h"
+#include "mpr_selector_set.h"
+#include "mid_set.h"
+#include "mantissa.h"
+#include "process_package.h" // XXX - remove
+#include "two_hop_neighbor_table.h"
+#include "hysteresis.h"
+
+static unsigned char msg_buffer[MAXMESSAGESIZE - OLSR_HEADERSIZE];
+
+static void
+create_lq_hello(struct lq_hello_message *lq_hello, struct interface *outif)
+{
+  struct lq_hello_neighbor *neigh;
+  struct link_entry *walker;
+
+  lq_hello->comm.type = LQ_HELLO_MESSAGE;
+  lq_hello->comm.vtime = me_to_double(outif->valtimes.hello);
+  lq_hello->comm.size = 0;
+
+  COPY_IP(&lq_hello->comm.orig, &main_addr);
+
+  lq_hello->comm.ttl = 1;
+  lq_hello->comm.hops = 0;
+  lq_hello->comm.seqno = get_msg_seqno();
+
+  lq_hello->htime = me_to_double(outif->hello_etime);
+  lq_hello->will = olsr_cnf->willingness;
+
+  lq_hello->neigh = NULL;
+  
+  for (walker = link_set; walker != NULL; walker = walker->next)
+    {
+      neigh = olsr_malloc(sizeof (struct lq_hello_neighbor), "Build LQ_HELLO");
+      
+      if(!COMP_IP(&walker->local_iface_addr, &outif->ip_addr))
+        neigh->link_type = UNSPEC_LINK;
+      
+      else
+        neigh->link_type = lookup_link_status(walker);
+
+      neigh->link_quality = walker->loss_link_quality;
+
+      if(walker->neighbor->is_mpr)
+        neigh->neigh_type = MPR_NEIGH;
+
+      else if (walker->neighbor->status == SYM)
+        neigh->neigh_type = SYM_NEIGH;
+
+      else if (walker->neighbor->status == NOT_SYM)
+        neigh->neigh_type = NOT_NEIGH;
+  
+      COPY_IP(&neigh->addr, &walker->neighbor_iface_addr);
+      
+      neigh->next = lq_hello->neigh;
+      lq_hello->neigh = neigh;
+    }
+}
+
+static void
+destroy_lq_hello(struct lq_hello_message *lq_hello)
+{
+  struct lq_hello_neighbor *walker, *aux;
+
+  for (walker = lq_hello->neigh; walker != NULL; walker = aux)
+    {
+      aux = walker->next;
+      free(walker);
+    }
+}
+
+static void
+create_lq_tc(struct lq_tc_message *lq_tc, struct interface *outif)
+{
+  struct lq_tc_neighbor *neigh;
+  int i;
+  struct neighbor_entry *walker;
+
+  lq_tc->comm.type = LQ_TC_MESSAGE;
+  lq_tc->comm.vtime = me_to_double(outif->valtimes.tc);
+  lq_tc->comm.size = 0;
+
+  COPY_IP(&lq_tc->comm.orig, &main_addr);
+
+  lq_tc->comm.ttl = MAX_TTL;
+  lq_tc->comm.hops = 0;
+  lq_tc->comm.seqno = get_msg_seqno();
+
+  COPY_IP(&lq_tc->from, &main_addr);
+
+  lq_tc->ansn = ansn;
+
+  lq_tc->neigh = NULL;
+  for(i = 0; i < HASHSIZE; i++)
+    {
+      for(walker = neighbortable[i].next; walker != &neighbortable[i];
+          walker = walker->next)
+        {
+          if(walker->status != SYM)
+            continue;
+
+          if (olsr_cnf->tc_redundancy == 1 && !walker->is_mpr &&
+              olsr_lookup_mprs_set(&walker->neighbor_main_addr) == NULL)
+            continue;
+
+          else if (olsr_cnf->tc_redundancy == 0 &&
+                   olsr_lookup_mprs_set(&walker->neighbor_main_addr) == NULL)
+            continue;
+
+          neigh = olsr_malloc(sizeof (struct lq_tc_neighbor), "Build LQ_TC");
+               
+          COPY_IP(&neigh->main, &walker->neighbor_main_addr);
+
+          neigh->link_quality =
+            olsr_neighbor_best_link_quality(&neigh->main);
+
+          neigh->next = lq_tc->neigh;
+          lq_tc->neigh = neigh;
+        }
+    }
+}
+
+static void
+destroy_lq_tc(struct lq_tc_message *lq_tc)
+{
+  struct lq_tc_neighbor *walker, *aux;
+
+  for (walker = lq_tc->neigh; walker != NULL; walker = aux)
+    {
+      aux = walker->next;
+      free(walker);
+    }
+}
+
+static int common_size(void)
+{
+  return (olsr_cnf->ip_version == AF_INET) ?
+    sizeof (struct olsr_header_v4) : sizeof (struct olsr_header_v6);
+}
+
+static void serialize_common(struct olsr_common *comm)
+{
+  struct olsr_header_v4 *olsr_head_v4;
+  struct olsr_header_v6 *olsr_head_v6;
+
+  if (olsr_cnf->ip_version == AF_INET)
+    {
+      olsr_head_v4 = (struct olsr_header_v4 *)msg_buffer;
+
+      olsr_head_v4->type = comm->type;
+      olsr_head_v4->vtime = double_to_me(comm->vtime);
+      olsr_head_v4->size = htons(comm->size);
+
+      COPY_IP(&olsr_head_v4->orig, &comm->orig);
+
+      olsr_head_v4->ttl = comm->ttl;
+      olsr_head_v4->hops = comm->hops;
+      olsr_head_v4->seqno = htons(comm->seqno);
+    }
+
+  olsr_head_v6 = (struct olsr_header_v6 *)msg_buffer;
+
+  olsr_head_v6->type = comm->type;
+  olsr_head_v6->vtime = double_to_me(comm->vtime);
+  olsr_head_v6->size = htons(comm->size);
+
+  COPY_IP(&olsr_head_v6->orig, &comm->orig);
+
+  olsr_head_v6->ttl = comm->ttl;
+  olsr_head_v6->hops = comm->hops;
+  olsr_head_v6->seqno = htons(comm->seqno);
+}
+
+static void
+serialize_lq_hello(struct lq_hello_message *lq_hello, struct interface *outif)
+{
+  int off, rem, size, req;
+  struct lq_hello_header *head;
+  struct lq_hello_info_header *info_head;
+  struct lq_hello_neighbor *neigh;
+  unsigned char *buff;
+  int is_first;
+  int i, j;
+
+  if (lq_hello == NULL || outif == NULL)
+    return;
+
+  // leave space for the OLSR header
+
+  off = common_size();
+
+  // initialize the LQ_HELLO header
+
+  head = (struct lq_hello_header *)(msg_buffer + off);
+
+  head->reserved = 0;
+  head->htime = double_to_me(lq_hello->htime);
+  head->will = lq_hello->will; 
+
+  // 'off' is the offset of the byte following the LQ_HELLO header
+
+  off += sizeof (struct lq_hello_header);
+
+  // our work buffer starts at 'off'...
+
+  buff = msg_buffer + off;
+
+  // ... that's why we start with a 'size' of 0 and subtract 'off' from
+  // the remaining bytes in the output buffer
+
+  size = 0;
+  rem = net_outbuffer_bytes_left(outif) - off;
+
+  // initially, we want to put at least an info header, an IP address,
+  // and the corresponding link quality into the message
+
+  if (rem < sizeof (struct lq_hello_info_header) + ipsize + 4)
+  {
+    net_output(outif);
+
+    rem = net_outbuffer_bytes_left(outif) - off;
+  }
+
+  info_head = NULL;
+
+  // iterate through all neighbor types ('i') and all link types ('j')
+
+  for (i = 0; i <= MAX_NEIGH; i++) 
+    {
+      for(j = 0; j <= MAX_LINK; j++)
+        {
+          if(j == HIDE_LINK)
+            continue;
+
+          is_first = 1;
+
+          // loop through neighbors
+
+          for (neigh = lq_hello->neigh; neigh != NULL; neigh = neigh->next)
+            {  
+              if (neigh->neigh_type != i || neigh->link_type != j)
+                continue;
+
+              // we need space for an IP address plus link quality
+              // information
+
+              req = ipsize + 4;
+
+              // no, we also need space for an info header, as this is the
+              // first neighbor with the current neighor type and link type
+
+              if (is_first != 0)
+                req += sizeof (struct lq_hello_info_header);
+
+              // we do not have enough space left
+
+              if (size + req > rem)
+                {
+                  // finalize the OLSR header
+
+                  lq_hello->comm.size = size + off;
+
+                  serialize_common((struct olsr_common *)lq_hello);
+
+                  // finalize the info header
+
+                  info_head->size =
+                    ntohs(buff + size - (unsigned char *)info_head);
+                             
+                  // output packet
+
+                  net_outbuffer_push(outif, msg_buffer, size + off);
+
+                  net_output(outif);
+
+                  // move to the beginning of the buffer
+
+                  size = 0;
+                  rem = net_outbuffer_bytes_left(outif) - off;
+
+                  // we need a new info header
+
+                  is_first = 1;
+                }
+
+              // create a new info header
+
+              if (is_first != 0)
+                {
+                  info_head = (struct lq_hello_info_header *)(buff + size);
+                  size += sizeof (struct lq_hello_info_header);
+
+                  info_head->reserved = 0;
+                  info_head->link_code = CREATE_LINK_CODE(i, j);
+                }
+
+              // add the current neighbor's IP address
+
+              COPY_IP(buff + size, &neigh->addr);
+              size += ipsize;
+
+              // add the corresponding link quality
+
+              buff[size++] = (unsigned char)(neigh->link_quality * 256);
+
+              // pad
+
+              buff[size++] = 0;
+              buff[size++] = 0;
+              buff[size++] = 0;
+
+              is_first = 0;
+            }
+
+          // finalize the info header, if there are any neighbors with the
+          // current neighbor type and link type
+
+          if (is_first == 0)
+            info_head->size = ntohs(buff + size - (unsigned char *)info_head);
+        }
+    }
+
+  // finalize the OLSR header
+
+  lq_hello->comm.size = size + off;
+
+  serialize_common((struct olsr_common *)lq_hello);
+
+  // move the message to the output buffer
+
+  net_outbuffer_push(outif, msg_buffer, size + off);
+}
+
+static void
+serialize_lq_tc(struct lq_tc_message *lq_tc, struct interface *outif)
+{
+  int off, rem, size;
+  struct lq_tc_header *head;
+  struct lq_tc_neighbor *neigh;
+  unsigned char *buff;
+
+  if (lq_tc == NULL || outif == NULL)
+    return;
+
+  // leave space for the OLSR header
+
+  off = common_size();
+
+  // initialize the LQ_TC header
+
+  head = (struct lq_tc_header *)(msg_buffer + off);
+
+  head->ansn = htons(lq_tc->ansn);
+  head->reserved = 0;
+
+  // 'off' is the offset of the byte following the LQ_TC header
+
+  off += sizeof (struct lq_tc_header);
+
+  // our work buffer starts at 'off'...
+
+  buff = msg_buffer + off;
+
+  // ... that's why we start with a 'size' of 0 and subtract 'off' from
+  // the remaining bytes in the output buffer
+
+  size = 0;
+  rem = net_outbuffer_bytes_left(outif) - off;
+
+  // initially, we want to put at least an IP address and the corresponding
+  // link quality into the message
+
+  if (rem < ipsize + 4)
+  {
+    net_output(outif);
+
+    rem = net_outbuffer_bytes_left(outif) - off;
+  }
+
+  // loop through neighbors
+
+  for (neigh = lq_tc->neigh; neigh != NULL; neigh = neigh->next)
+    {  
+      // we need space for an IP address plus link quality
+      // information
+
+      if (size + ipsize + 4 > rem)
+        {
+          // finalize the OLSR header
+
+          lq_tc->comm.size = size + off;
+
+          serialize_common((struct olsr_common *)lq_tc);
+
+          // output packet
+
+          net_outbuffer_push(outif, msg_buffer, size + off);
+
+          net_output(outif);
+
+          // move to the beginning of the buffer
+
+          size = 0;
+          rem = net_outbuffer_bytes_left(outif) - off;
+        }
+
+      // add the current neighbor's IP address
+
+      COPY_IP(buff + size, &neigh->main);
+      size += ipsize;
+
+      // add the corresponding link quality
+
+      buff[size++] = (unsigned char)(neigh->link_quality * 256);
+
+      // pad
+
+      buff[size++] = 0;
+      buff[size++] = 0;
+      buff[size++] = 0;
+    }
+
+  // finalize the OLSR header
+
+  lq_tc->comm.size = size + off;
+
+  serialize_common((struct olsr_common *)lq_tc);
+
+  net_outbuffer_push(outif, msg_buffer, size + off);
+}
+
+static void *deserialize_common(struct olsr_common *comm, void *ser)
+{
+  struct olsr_header_v4 *olsr_head_v4;
+  struct olsr_header_v6 *olsr_head_v6;
+
+  if (olsr_cnf->ip_version == AF_INET)
+    {
+      olsr_head_v4 = (struct olsr_header_v4 *)ser;
+
+      comm->type = olsr_head_v4->type;
+      comm->vtime = me_to_double(olsr_head_v4->vtime);
+      comm->size = ntohs(olsr_head_v4->size);
+
+      COPY_IP(&comm->orig, &olsr_head_v4->orig);
+
+      comm->ttl = olsr_head_v4->ttl;
+      comm->hops = olsr_head_v4->hops;
+      comm->seqno = ntohs(olsr_head_v4->seqno);
+
+      return (void *)(olsr_head_v4 + 1);
+    }
+
+  olsr_head_v6 = (struct olsr_header_v6 *)ser;
+
+  comm->type = olsr_head_v6->type;
+  comm->vtime = me_to_double(olsr_head_v6->vtime);
+  comm->size = ntohs(olsr_head_v6->size);
+
+  COPY_IP(&comm->orig, &olsr_head_v6->orig);
+
+  comm->ttl = olsr_head_v6->ttl;
+  comm->hops = olsr_head_v6->hops;
+  comm->seqno = ntohs(olsr_head_v6->seqno);
+
+  return (void *)(olsr_head_v6 + 1);
+}
+
+static void
+deserialize_lq_hello(struct lq_hello_message *lq_hello, void *ser)
+{
+  struct lq_hello_header *head;
+  struct lq_hello_info_header *info_head;
+  unsigned char *curr, *limit, *limit2;
+  struct lq_hello_neighbor *neigh;
+  
+  lq_hello->neigh = NULL;
+
+  if (ser == NULL)
+    return;
+
+  head = (struct lq_hello_header *)
+    deserialize_common((struct olsr_common *)lq_hello, ser);
+
+  if (lq_hello->comm.type != LQ_HELLO_MESSAGE)
+    return;
+
+  limit = ((unsigned char *)ser) + lq_hello->comm.size;
+
+  lq_hello->htime = me_to_double(head->htime);
+  lq_hello->will = head->will;
+
+  curr = (unsigned char *)(head + 1);
+
+  while (curr < limit)
+    {
+      info_head = (struct lq_hello_info_header *)curr;
+
+      limit2 = curr + ntohs(info_head->size);
+
+      curr = (unsigned char *)(info_head + 1);
+      
+      while (curr < limit2)
+        {
+          neigh = olsr_malloc(sizeof (struct lq_tc_neighbor),
+                              "LQ_HELLO deserialization");
+
+          COPY_IP(&neigh->addr, curr);
+          curr += ipsize;
+
+          neigh->link_quality = (double)*curr / 256.0;
+          curr += 4;
+
+          neigh->link_type = EXTRACT_LINK(info_head->link_code);
+          neigh->neigh_type = EXTRACT_STATUS(info_head->link_code);
+
+          neigh->next = lq_hello->neigh;
+          lq_hello->neigh = neigh;
+        }
+    }
+}
+
+static void
+deserialize_lq_tc(struct lq_tc_message *lq_tc, void *ser,
+                  union olsr_ip_addr *from)
+{
+  struct lq_tc_header *head;
+  union olsr_ip_addr *addr;
+  unsigned char *curr, *limit;
+  struct lq_tc_neighbor *neigh;
+
+  lq_tc->neigh = NULL;
+
+  if (ser == NULL)
+    return;
+
+  head = (struct lq_tc_header *)
+    deserialize_common((struct olsr_common *)lq_tc, ser);
+
+  if (lq_tc->comm.type != LQ_TC_MESSAGE)
+    return;
+
+  limit = ((unsigned char *)ser) + lq_tc->comm.size;
+
+  addr = mid_lookup_main_addr(from);
+
+  if (addr == 0)
+    COPY_IP(&lq_tc->from, from);
+
+  else
+    COPY_IP(&lq_tc->from, addr);
+
+  lq_tc->ansn =  ntohs(head->ansn);
+
+  curr = (unsigned char *)(head + 1);
+
+  while (curr < limit)
+    {
+      neigh = olsr_malloc(sizeof (struct lq_tc_neighbor),
+                          "LQ_TC deserialization");
+
+      COPY_IP(&neigh->main, curr);
+      curr += ipsize;
+
+      neigh->link_quality = (double)*curr / 256.0;
+      curr += 4;
+
+      neigh->next = lq_tc->neigh;
+      lq_tc->neigh = neigh;
+    }
+}
+
+static void process_lq_hello(struct lq_hello_message *lq_hello,
+                             struct interface *inif,
+                             union olsr_ip_addr *from)
+{
+  struct link_entry *link;
+  struct lq_hello_neighbor *neigh;
+  union olsr_ip_addr *addr;
+  struct neighbor_2_list_entry *n2le;
+  struct neighbor_2_entry *n2e;
+
+  // XXX - TODO: parse the link quality values
+
+  // create or update the link and neighbor entries
+
+  link = update_lq_link_entry(&inif->ip_addr, from, lq_hello, inif);
+
+  // pass the hello interval to the packet loss detector
+
+  olsr_update_packet_loss_hello_int(link, lq_hello->htime);
+
+  // pass the hello interval to hysteresis
+
+  if (olsr_cnf->use_hysteresis != 0)
+    olsr_update_hysteresis_hello(link, lq_hello->htime);
+
+  // have we been selected as an MPR?
+
+  for (neigh = lq_hello->neigh; neigh != NULL; neigh = neigh->next)
+    if (neigh->link_type == SYM_LINK && neigh->neigh_type == MPR_NEIGH &&
+        COMP_IP(&neigh->addr, &inif->ip_addr))
+      break;
+
+  // yes, we have
+
+  if (neigh != NULL)
+    olsr_update_mprs_set(&lq_hello->comm.orig, lq_hello->comm.vtime);
+
+  // our neighbor's willingness has changed
+
+  if(link->neighbor->willingness != lq_hello->will)
+    {
+      link->neighbor->willingness = lq_hello->will;
+
+      changes_neighborhood = TRUE;
+      changes_topology = TRUE;
+    }
+
+  // we'll never be able to reach a two-hop neighbor via this neighbor,
+  // so there's nothing left to do
+
+  if(link->neighbor->willingness == WILL_NEVER)
+    {
+      olsr_process_changes();
+      return;
+    }
+  
+  // go through all neighbor entries in the LQ HELLO message
+
+  for (neigh = lq_hello->neigh; neigh != NULL; neigh = neigh->next)
+    {
+      // we cannot be our own two-hop neighbor
+
+      if (if_ifwithaddr(&neigh->addr) != NULL)
+        continue;
+
+      // find the the two-hop neighbor's main address
+
+      addr = mid_lookup_main_addr(&neigh->addr);
+
+      if (addr == NULL)
+        addr = &neigh->addr;
+
+      // our neighbor has a symmetric link to the two-hop neighbor
+
+      if(neigh->neigh_type == SYM_NEIGH || neigh->neigh_type == MPR_NEIGH)
+        {
+          // do we already know what we can reach this two-hop neighbor
+          // via the current neighbor?
+
+          n2le = olsr_lookup_my_neighbors(link->neighbor, addr);
+
+          // yes, we already know -> only update the timeout value
+
+          if (n2le != NULL)
+            olsr_get_timestamp((olsr_u32_t)lq_hello->comm.vtime * 1000,
+                               &n2le->neighbor_2_timer);
+
+          else
+            {
+              // do we already know this two-hop neighbor?
+              
+              n2e = olsr_lookup_two_hop_neighbor_table(addr);
+
+              // no, we don't -> create a new two-hop neighbor entry
+
+              if (n2e == NULL)
+                {
+                  n2e = olsr_malloc(sizeof(struct neighbor_2_entry),
+                                    "Process LQ_HELLO");
+                 
+                  n2e->neighbor_2_nblist.next = &n2e->neighbor_2_nblist;
+
+                  n2e->neighbor_2_nblist.prev = &n2e->neighbor_2_nblist;
+
+                  n2e->neighbor_2_pointer = 0;
+                  
+                  COPY_IP(&n2e->neighbor_2_addr, addr);
+
+                  olsr_insert_two_hop_neighbor_table(n2e);
+                }
+
+              // memorize that we can reach this two-hop neighbor via the
+              // current neighbor
+
+              olsr_linking_this_2_entries(link->neighbor, n2e,
+                                          (float)lq_hello->comm.vtime);
+
+              changes_neighborhood = TRUE;
+              changes_topology = TRUE;
+            }
+        }
+    }
+
+  olsr_process_changes();
+}
+
+static void process_lq_tc(struct lq_tc_message *lq_tc)
+{
+}
+
+void
+olsr_output_lq_hello(void *para)
+{
+  struct lq_hello_message lq_hello;
+  struct interface *outif = (struct interface *)para;
+
+  create_lq_hello(&lq_hello, outif);
+  serialize_lq_hello(&lq_hello, outif);
+  destroy_lq_hello(&lq_hello);
+
+  if(net_output_pending(outif))
+    net_output(outif);
+}
+
+void
+olsr_output_lq_tc(void *para)
+{
+  static int prev_empty = 1;
+  struct lq_tc_message lq_tc;
+  struct interface *outif = (struct interface *)para;
+  struct timeval timer;
+
+  create_lq_tc(&lq_tc, outif);
+
+  if (lq_tc.neigh != NULL)
+    {
+      prev_empty = 0;
+
+      serialize_lq_tc(&lq_tc, outif);
+    }
+
+  else if (prev_empty == 0)
+    {
+      olsr_init_timer((olsr_u32_t)(max_tc_vtime * 3) * 1000, &timer);
+      timeradd(&now, &timer, &send_empty_tc);
+
+      prev_empty = 1;
+
+      serialize_lq_tc(&lq_tc, outif);
+    }
+
+  else if (!TIMED_OUT(&send_empty_tc))
+    serialize_lq_tc(&lq_tc, outif);
+
+  destroy_lq_tc(&lq_tc);
+
+  if(net_output_pending(outif) && TIMED_OUT(&fwdtimer[outif->if_nr]))
+    set_buffer_timer(outif);
+}
+
+void
+olsr_input_lq_hello(union olsr_message *ser,
+                    struct interface *inif,
+                    union olsr_ip_addr *from)
+{
+  struct lq_hello_message lq_hello;
+
+  deserialize_lq_hello(&lq_hello, ser);
+  process_lq_hello(&lq_hello, inif, from);
+  destroy_lq_hello(&lq_hello);
+}
+
+void
+olsr_input_lq_tc(union olsr_message *ser, struct interface *inif,
+                 union olsr_ip_addr *from)
+{
+  struct lq_tc_message lq_tc;
+
+  deserialize_lq_tc(&lq_tc, ser, from);
+  process_lq_tc(&lq_tc);
+  destroy_lq_tc(&lq_tc);
+}
+#endif
diff --git a/src/lq_packet.h b/src/lq_packet.h
new file mode 100644 (file)
index 0000000..4f4700d
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+ * OLSR ad-hoc routing table management protocol
+ * Copyright (C) 2003 Andreas Tønnesen (andreto@ifi.uio.no)
+ *
+ * This file is part of the olsr.org OLSR daemon.
+ *
+ * olsr.org is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * olsr.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with olsr.org; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * 
+ * 
+ * $Id: lq_packet.h,v 1.1 2004/11/03 18:19:54 tlopatic Exp $
+ *
+ */
+
+#define LQ_HELLO_MESSAGE      5
+#define LQ_TC_MESSAGE         6
+
+// deserialized OLSR header
+
+struct olsr_common
+{
+  olsr_u8_t          type;
+  double             vtime;
+  olsr_u16_t         size;
+  union olsr_ip_addr orig;
+  olsr_u8_t          ttl;
+  olsr_u8_t          hops;
+  olsr_u16_t         seqno;
+};
+
+// serialized IPv4 OLSR header
+
+struct olsr_header_v4
+{
+  olsr_u8_t  type;
+  olsr_u8_t  vtime;
+  olsr_u16_t size;
+  olsr_u32_t orig;
+  olsr_u8_t  ttl;
+  olsr_u8_t  hops;
+  olsr_u16_t seqno;
+};
+
+// serialized IPv6 OLSR header
+
+struct olsr_header_v6
+{
+  olsr_u8_t     type;
+  olsr_u8_t     vtime;
+  olsr_u16_t    size;
+  unsigned char orig[16];
+  olsr_u8_t     ttl;
+  olsr_u8_t     hops;
+  olsr_u16_t    seqno;
+};
+
+// deserialized LQ_HELLO
+
+struct lq_hello_neighbor
+{
+  olsr_u8_t                link_type;
+  olsr_u8_t                neigh_type;
+  double                   link_quality;
+  union olsr_ip_addr       addr;
+  struct lq_hello_neighbor *next;
+};
+
+struct lq_hello_message
+{
+  struct olsr_common       comm;
+  double                   htime;
+  olsr_u8_t                will;
+  struct lq_hello_neighbor *neigh;
+};
+
+// serialized LQ_HELLO
+
+struct lq_hello_info_header
+{
+  olsr_u8_t  link_code;
+  olsr_u8_t  reserved;
+  olsr_u16_t size;
+};
+
+struct lq_hello_header
+{
+  olsr_u16_t reserved;
+  olsr_u8_t  htime;
+  olsr_u8_t  will;
+};
+
+// deserialized LQ_TC
+
+struct lq_tc_neighbor
+{
+  double                link_quality;
+  union olsr_ip_addr    main;
+  struct lq_tc_neighbor *next;
+};
+
+struct lq_tc_message
+{
+  struct olsr_common    comm;
+  union olsr_ip_addr    from;
+  olsr_u16_t            ansn;
+  struct lq_tc_neighbor *neigh;
+};
+
+// serialized LQ_TC
+
+struct lq_tc_header
+{
+  olsr_u16_t ansn;
+  olsr_u16_t reserved;
+};
+
+void olsr_output_lq_hello(void *para);
+
+void olsr_output_lq_tc(void *para);
+
+void olsr_input_lq_hello(union olsr_message *ser, struct interface *inif,
+                         union olsr_ip_addr *from);
+
+void olsr_input_lq_tc(union olsr_message *ser, struct interface *inif,
+                      union olsr_ip_addr *from);
index 5d99095..22198d1 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: main.c,v 1.25 2004/11/03 10:00:10 kattemat Exp $
+ * $Id: main.c,v 1.26 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -65,12 +65,13 @@ set_default_values(void);
 static int
 set_default_ifcnfs(struct olsr_if *, struct if_config_options *);
 
-
+#ifndef WIN32
 /*
  * Local variable declarations 
  */
 
 static pthread_t main_thread;
+#endif
 
 
 /**
index c976df3..d2e1d5c 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: olsr_protocol.h,v 1.8 2004/11/03 09:22:59 kattemat Exp $
+ * $Id: olsr_protocol.h,v 1.9 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -131,13 +131,7 @@ union olsr_ip_addr
 #define TC_MESSAGE            2
 #define MID_MESSAGE           3
 #define HNA_MESSAGE           4
-#if !defined USE_LINK_QUALITY
 #define MAX_MESSAGE           4
-#else
-#define LQ_HELLO_MESSAGE      5
-#define LQ_TC_MESSAGE         6
-#define MAX_MESSAGE           6
-#endif
 
 /*
  *Link Types
@@ -282,28 +276,6 @@ struct hellomsg6
   struct hellinfo6   hell_info[1];
 };
 
-#if defined USE_LINK_QUALITY
-struct lq_hello_header
-{
-  olsr_u16_t reserved;
-  olsr_u8_t  htime;
-  olsr_u8_t  will;
-};
-
-struct lq_hello_info_header
-{
-  olsr_u8_t  link_code;
-  olsr_u8_t  reserved;
-  olsr_u16_t size;
-};
-
-struct lq_tc_header
-{
-  olsr_u16_t ansn;
-  olsr_u16_t reserved;
-};
-#endif
-
 /*
  * Topology Control packet
  */
@@ -437,10 +409,6 @@ struct olsrmsg
     struct tcmsg    tc;
     struct hnamsg   hna;
     struct midmsg   mid;
-#if defined USE_LINK_QUALITY
-    struct lq_hello_header lq_hello;
-    struct lq_tc_header    lq_tc;
-#endif
   } message;
 
 };
@@ -465,10 +433,6 @@ struct olsrmsg6
     struct tcmsg6    tc;
     struct hnamsg6   hna;
     struct midmsg6   mid;
-#if defined USE_LINK_QUALITY
-    struct lq_hello_header lq_hello;
-    struct lq_tc_header    lq_tc;
-#endif
   } message;
 
 };
index bf545c9..6855bfa 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: packet.c,v 1.10 2004/11/03 10:00:11 kattemat Exp $
+ * $Id: packet.c,v 1.11 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -487,141 +487,3 @@ olsr_destroy_mid_message(struct mid_message *message)
       free(tmp_adr2);
     }
 }
-
-#if defined USE_LINK_QUALITY
-int
-olsr_build_lq_hello_packet(struct lq_hello_message *msg,
-                           struct interface *outif)
-{
-  struct lq_hello_neighbor *neigh;
-  struct link_entry *walker;
-
-  olsr_printf(3, "\tBuilding LQ_HELLO on interface %d\n", outif->if_nr);
-
-  COPY_IP(&msg->main, &main_addr);
-
-  msg->seqno = 0;
-  msg->hops = 0;
-  msg->ttl = 1;
-  msg->will = olsr_cnf->willingness;
-  msg->neigh = NULL;
-  
-  for (walker = link_set; walker != NULL; walker = walker->next)
-    {
-      neigh = olsr_malloc(sizeof (struct lq_hello_neighbor), "Build LQ_HELLO");
-      
-      if(!COMP_IP(&walker->local_iface_addr, &outif->ip_addr))
-        neigh->link_type = UNSPEC_LINK;
-      
-      else
-        neigh->link_type = lookup_link_status(walker);
-
-      neigh->link_quality = walker->loss_link_quality;
-
-      if(walker->neighbor->is_mpr)
-        neigh->neigh_type = MPR_NEIGH;
-
-      else if (walker->neighbor->status == SYM)
-        neigh->neigh_type = SYM_NEIGH;
-
-      else if (walker->neighbor->status == NOT_SYM)
-        neigh->neigh_type = NOT_NEIGH;
-  
-      // COPY_IP(&neigh->main, &walker->neighbor->neighbor_main_addr);
-      COPY_IP(&neigh->addr, &walker->neighbor_iface_addr);
-      
-      olsr_printf(5, "%s - ", olsr_ip_to_string(&neigh->addr));
-      olsr_printf(5, " neighbor type %d\n", neigh->neigh_type);
-      
-      neigh->next = msg->neigh;
-      msg->neigh = neigh;
-    }
-  
-  return 0;
-}
-
-void
-olsr_destroy_lq_hello_message(struct lq_hello_message *msg)
-{
-  struct lq_hello_neighbor *walker, *aux;
-
-  for (walker = msg->neigh; walker != NULL; walker = aux)
-    {
-      aux = walker->next;
-      free(walker);
-    }
-}
-
-int
-olsr_build_lq_tc_packet(struct lq_tc_message *msg)
-{
-  struct lq_tc_neighbor *neigh;
-  int i;
-  struct neighbor_entry *walker;
-  struct timeval timer;
-
-  COPY_IP(&msg->main, &main_addr);
-  COPY_IP(&msg->orig, &main_addr);
-  
-  msg->seqno = 0;
-  msg->hops = 0;
-  msg->ttl = MAX_TTL;
-  msg->ansn = ansn;
-  msg->neigh = NULL;
-  for(i = 0; i < HASHSIZE; i++)
-    {
-      for(walker = neighbortable[i].next; walker != &neighbortable[i];
-         walker = walker->next)
-       {
-         if(walker->status != SYM)
-           continue;
-
-          if (olsr_cnf->tc_redundancy == 1 && !walker->is_mpr &&
-              olsr_lookup_mprs_set(&walker->neighbor_main_addr) == NULL)
-            continue;
-
-          else if (olsr_cnf->tc_redundancy == 0 &&
-              olsr_lookup_mprs_set(&walker->neighbor_main_addr) == NULL)
-            continue;
-
-          neigh = olsr_malloc(sizeof (struct lq_tc_neighbor), "Build LQ_TC");
-               
-          COPY_IP(&neigh->main, &walker->neighbor_main_addr);
-
-          neigh->link_quality =
-            olsr_neighbor_best_link_quality(&neigh->main);
-
-          neigh->next = msg->neigh;
-          msg->neigh = neigh;
-        }
-    }
-
-  if (msg->neigh != NULL)
-    sending_tc = TRUE;
-
-  else if (sending_tc)
-    {
-      olsr_init_timer((olsr_u32_t)(max_tc_vtime * 3) * 1000, &timer);
-      timeradd(&now, &timer, &send_empty_tc);
-
-      olsr_printf(3, "No more MPR selectors - will send empty LQ_TCs\n");
-      
-      sending_tc = FALSE;
-    }
-
-  return 0;
-}
-
-void
-olsr_destroy_lq_tc_message(struct lq_tc_message *msg)
-{
-  struct lq_tc_neighbor *walker, *aux;
-
-  for (walker = msg->neigh; walker != NULL; walker = aux)
-    {
-      aux = walker->next;
-      free(walker);
-    }
-}
-#endif
index e7fc599..09f1f08 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: packet.h,v 1.7 2004/11/02 22:55:42 tlopatic Exp $
+ * $Id: packet.h,v 1.8 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -61,29 +61,6 @@ struct hello_message
   
 };
 
-#if defined USE_LINK_QUALITY
-struct lq_hello_neighbor
-{
-  olsr_u8_t                link_type;
-  olsr_u8_t                neigh_type;
-  double                   link_quality;
-  union olsr_ip_addr       addr;
-  struct lq_hello_neighbor *next;
-};
-
-struct lq_hello_message
-{
-  double                   vtime;
-  double                   htime;
-  union olsr_ip_addr       main;
-  olsr_u16_t               seqno;
-  olsr_u8_t                hops;
-  olsr_u8_t                ttl;
-  olsr_u8_t                will;
-  struct lq_hello_neighbor *neigh;
-};
-#endif
-
 struct tc_mpr_addr
 {
 
@@ -103,27 +80,6 @@ struct tc_message
   struct tc_mpr_addr  *multipoint_relay_selector_address;
 };
 
-#if defined USE_LINK_QUALITY
-struct lq_tc_neighbor
-{
-  double                link_quality;
-  union olsr_ip_addr    main;
-  struct lq_tc_neighbor *next;
-};
-
-struct lq_tc_message
-{
-  double                vtime;
-  union olsr_ip_addr    main;
-  union olsr_ip_addr    orig;
-  olsr_u16_t            seqno;
-  olsr_u8_t             hops;
-  olsr_u8_t             ttl;
-  olsr_u16_t            ansn;
-  struct lq_tc_neighbor *neigh;
-};
-#endif
-
 /*
  *HNA message format:
  *NET
@@ -205,18 +161,4 @@ olsr_destroy_hna_message(struct hna_message *);
 void
 olsr_destroy_tc_message(struct tc_message *);
 
-#if defined USE_LINK_QUALITY
-int
-olsr_build_lq_hello_packet(struct lq_hello_message *, struct interface *);
-
-int
-olsr_build_lq_tc_packet(struct lq_tc_message *);
-
-void
-olsr_destroy_lq_hello_message(struct lq_hello_message *);
-
-void
-olsr_destroy_lq_tc_message(struct lq_tc_message *);
-#endif
-
 #endif
index f5c71b8..5047086 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: parser.c,v 1.10 2004/10/20 17:11:33 tlopatic Exp $
+ * $Id: parser.c,v 1.11 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -245,16 +245,6 @@ parse_packet(struct olsr *olsr, int size, struct interface *in_if, union olsr_ip
   if (count < minsize)
     return;
 
-#if defined USE_LINK_QUALITY
-  // simulate packet loss
-
-  if (0 && random() % 100 < 40)
-    {
-      printf("*** PACKET LOST ***\n");
-      return;
-    }
-#endif
-
   if (ntohs(olsr->olsr_packlen) != size)
     {
       olsr_printf(1, "Size error detected in received packet.\nRecieved %d, in packet %d\n", size, ntohs(olsr->olsr_packlen));
index 86be8d2..d8b4309 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: process_package.c,v 1.9 2004/11/03 09:22:59 kattemat Exp $
+ * $Id: process_package.c,v 1.10 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -36,7 +36,6 @@
 #include "duplicate_set.h"
 #include "rebuild_packet.h"
 
-
 #ifdef linux 
 #include "linux/tunnel.h"
 #elif defined WIN32
@@ -54,10 +53,8 @@ olsr_init_package_process()
   olsr_parser_add_function(&olsr_process_received_hello, HELLO_MESSAGE, 1);
   olsr_parser_add_function(&olsr_process_received_tc, TC_MESSAGE, 1);
 #else
-  olsr_parser_add_function(&olsr_process_received_lq_hello,
-                           LQ_HELLO_MESSAGE, 1);
-  olsr_parser_add_function(&olsr_process_received_lq_tc,
-                           LQ_TC_MESSAGE, 1);
+  olsr_parser_add_function(&olsr_input_lq_hello, LQ_HELLO_MESSAGE, 1);
+  olsr_parser_add_function(&olsr_input_lq_tc, LQ_TC_MESSAGE, 1);
 #endif
   olsr_parser_add_function(&olsr_process_received_mid, MID_MESSAGE, 1);
   olsr_parser_add_function(&olsr_process_received_hna, HNA_MESSAGE, 1);
@@ -643,24 +640,3 @@ olsr_lookup_mpr_status(struct hello_message *message, struct interface *in_if)
   /* Not found */
   return 0;
 }
-
-#if defined USE_LINK_QUALITY
-void
-olsr_process_received_lq_hello(union olsr_message *ser,
-                               struct interface *inif,
-                               union olsr_ip_addr *from)
-{
-  struct lq_hello_message deser;
-
-  lq_hello_chgestruct(&deser, ser);
-}
-
-void
-olsr_process_received_lq_tc(union olsr_message *ser, struct interface *inif,
-                            union olsr_ip_addr *from)
-{
-  struct lq_tc_message deser;
-
-  lq_tc_chgestruct(&deser, ser, from);
-}
-#endif
index 203cb52..155d955 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: process_package.h,v 1.7 2004/11/02 22:55:43 tlopatic Exp $
+ * $Id: process_package.h,v 1.8 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -57,15 +57,4 @@ olsr_linking_this_2_entries(struct neighbor_entry *,struct neighbor_2_entry *, f
 int
 olsr_lookup_mpr_status(struct hello_message *, struct interface *);
 
-#if defined USE_LINK_QUALITY
-void
-olsr_process_received_lq_hello(union olsr_message *ser,
-                               struct interface *inif,
-                               union olsr_ip_addr *from);
-
-void
-olsr_process_received_lq_tc(union olsr_message *ser, struct interface *inif,
-                            union olsr_ip_addr *from);
-#endif
-
 #endif
index 945418d..844e1d5 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: rebuild_packet.c,v 1.9 2004/11/02 22:55:43 tlopatic Exp $
+ * $Id: rebuild_packet.c,v 1.10 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -563,143 +563,3 @@ tc_chgestruct(struct tc_message *tmsg, union olsr_message *m, union olsr_ip_addr
     }
 
 }
-
-#if defined USE_LINK_QUALITY
-void
-lq_hello_chgestruct(struct lq_hello_message *deser, union olsr_message *ser)
-{
-  struct lq_hello_header *head;
-  struct lq_hello_info_header *info_head;
-  unsigned char *curr, *limit, *limit2;
-  struct lq_hello_neighbor *neigh;
-  
-  deser->neigh = NULL;
-
-  if (ser == NULL || ser->v4.olsr_msgtype != LQ_HELLO_MESSAGE)
-    return;
-
-  deser->vtime = me_to_double(ser->v4.olsr_vtime);
-
-  if (olsr_cnf->ip_version == AF_INET)
-    {
-      COPY_IP(&deser->main, &ser->v4.originator);
-
-      deser->seqno = ntohs(ser->v4.seqno);
-
-      head = &ser->v4.message.lq_hello;
-    }
-
-  else
-    {
-      COPY_IP(&deser->main, &ser->v6.originator);
-
-      deser->seqno = ntohs(ser->v6.seqno);
-
-      head = &ser->v6.message.lq_hello;
-    }
-
-  deser->htime = me_to_double(head->htime);
-  deser->will = head->will;
-
-  // XXX - deserialize TTL and hop count?
-
-  curr = (unsigned char *)(head + 1);
-
-  limit = ((unsigned char *)ser) + ntohs(ser->v4.olsr_msgsize);
-
-  while (curr < limit)
-    {
-      info_head = (struct lq_hello_info_header *)curr;
-
-      limit2 = curr + ntohs(info_head->size);
-
-      curr = (unsigned char *)(info_head + 1);
-      
-      while (curr < limit2)
-        {
-          neigh = olsr_malloc(sizeof (struct lq_tc_neighbor),
-                              "LQ HELLO deserialization");
-
-          COPY_IP(&neigh->addr, curr);
-          curr += ipsize;
-
-          neigh->link_quality = (double)*curr / 256.0;
-          curr += 4;
-
-          neigh->link_type = EXTRACT_LINK(info_head->link_code);
-          neigh->neigh_type = EXTRACT_STATUS(info_head->link_code);
-
-          neigh->next = deser->neigh;
-          deser->neigh = neigh;
-        }
-    }
-}
-
-void
-lq_tc_chgestruct(struct lq_tc_message *deser, union olsr_message *ser,
-                 union olsr_ip_addr *from)
-{
-  struct lq_tc_header *head;
-  union olsr_ip_addr *addr;
-  unsigned char *curr, *limit;
-  struct lq_tc_neighbor *neigh;
-
-  deser->neigh = NULL;
-
-  if (ser == NULL || ser->v4.olsr_msgtype != LQ_TC_MESSAGE)
-    return;
-
-  deser->vtime = me_to_double(ser->v4.olsr_vtime);
-
-  addr = mid_lookup_main_addr(from);
-
-  if (addr == 0)
-    COPY_IP(&deser->main, from);
-
-  else
-    COPY_IP(&deser->main, addr);
-
-  if (olsr_cnf->ip_version == AF_INET)
-    {
-      COPY_IP(&deser->orig, &ser->v4.originator);
-
-      deser->seqno = ntohs(ser->v4.seqno);
-      deser->hops =  ser->v4.hopcnt;
-
-      head = &ser->v4.message.lq_tc;
-    }
-
-  else
-    {
-      COPY_IP(&deser->orig, &ser->v6.originator);
-
-      deser->seqno = ntohs(ser->v6.seqno);
-      deser->hops =  ser->v6.hopcnt;
-
-      head = &ser->v6.message.lq_tc;
-    }
-
-  deser->ansn =  ntohs(head->ansn);
-
-  // XXX - deserialize TTL?
-
-  curr = (unsigned char *)(head + 1);
-
-  limit = ((unsigned char *)ser) + ntohs(ser->v4.olsr_msgsize);
-
-  while (curr < limit)
-    {
-      neigh = olsr_malloc(sizeof (struct lq_tc_neighbor),
-                          "LQ TC deserialization");
-
-      COPY_IP(&neigh->main, curr);
-      curr += ipsize;
-
-      neigh->link_quality = (double)*curr / 256.0;
-      curr += 4;
-
-      neigh->next = deser->neigh;
-      deser->neigh = neigh;
-    }
-}
-#endif
index dc7a1b8..4426b5d 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: rebuild_packet.h,v 1.6 2004/11/02 22:55:43 tlopatic Exp $
+ * $Id: rebuild_packet.h,v 1.7 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -47,13 +47,4 @@ hello_chgestruct(struct hello_message *, union olsr_message *);
 void
 tc_chgestruct(struct tc_message *, union olsr_message *, union olsr_ip_addr *);
 
-#if defined USE_LINK_QUALITY
-void
-lq_hello_chgestruct(struct lq_hello_message *deser, union olsr_message *ser);
-
-void
-lq_tc_chgestruct(struct lq_tc_message *deser, union olsr_message *ser,
-                 union olsr_ip_addr *from);
-#endif
-
 #endif
index 42d139b..8c97d77 100644 (file)
@@ -21,7 +21,7 @@
  * along with olsr.org; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: apm.c,v 1.5 2004/10/19 13:58:46 tlopatic Exp $
+ * $Id: apm.c,v 1.6 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
 #include <stdio.h>
 #include <string.h>
 
+#undef interface
+#undef TRUE
+#undef FALSE
+
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
-#undef interface
 
 extern int olsr_printf(int, char *, ...);
 
index 02a7e7e..d7ce6a9 100644 (file)
@@ -18,7 +18,7 @@
  * along with olsr.org; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: inet.h,v 1.3 2004/10/19 13:58:46 tlopatic Exp $
+ * $Id: inet.h,v 1.4 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -30,6 +30,8 @@
 #include <winsock2.h>
 #include <ws2tcpip.h>
 #undef interface
+#undef TRUE
+#undef FALSE
 
 int inet_aton(char *cp, struct in_addr *addr);
 int inet_pton(int af, char *src, void *dst);
index 1ec031c..ff690b1 100644 (file)
@@ -18,7 +18,7 @@
  * along with olsr.org; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: compat.c,v 1.4 2004/10/19 13:58:46 tlopatic Exp $
+ * $Id: compat.c,v 1.5 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
 #include <ctype.h>
 #include "defs.h"
 
+#undef interface
+#undef TRUE
+#undef FALSE
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
 struct ThreadPara
 {
   void *(*Func)(void *);
index f92fba9..2c20907 100644 (file)
@@ -21,7 +21,7 @@
  * along with olsr.org; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: ifnet.c,v 1.7 2004/11/01 20:04:12 tlopatic Exp $
+ * $Id: ifnet.c,v 1.8 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
 #include "../scheduler.h"
 #include "../mantissa.h"
 
+#undef interface
+#undef TRUE
+#undef FALSE
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
 #include <iphlpapi.h>
 #include <iprtrmib.h>
 
@@ -522,11 +528,11 @@ void RemoveInterface(struct olsr_if *IntConf)
                               IntConf->cnf->tc_params.emission_interval,
                               0, NULL);
 #else
-  olsr_remove_scheduler_event(&generate_lq_hello, Int,
+  olsr_remove_scheduler_event(&olsr_output_lq_hello, Int,
                               IntConf->cnf->hello_params.emission_interval,
                               0, NULL);
 
-  olsr_remove_scheduler_event(&generate_lq_tc, Int,
+  olsr_remove_scheduler_event(&olsr_output_lq_tc, Int,
                               IntConf->cnf->tc_params.emission_interval,
                               0, NULL);
 #endif
@@ -808,11 +814,11 @@ int chk_if_up(struct olsr_if *IntConf, int DebugLevel)
                                 IntConf->cnf->tc_params.emission_interval,
                                 0, NULL);
 #else
-  olsr_register_scheduler_event(&generate_lq_hello, New,
+  olsr_register_scheduler_event(&olsr_output_lq_hello, New,
                                 IntConf->cnf->hello_params.emission_interval,
                                 0, NULL);
 
-  olsr_register_scheduler_event(&generate_lq_tc, New,
+  olsr_register_scheduler_event(&olsr_output_lq_tc, New,
                                 IntConf->cnf->tc_params.emission_interval,
                                 0, NULL);
 #endif
index 727aa9c..4dca4c4 100644 (file)
@@ -18,7 +18,7 @@
  * along with olsr.org; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: kernel_routes.c,v 1.5 2004/10/19 21:44:56 tlopatic Exp $
+ * $Id: kernel_routes.c,v 1.6 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
 #include "../kernel_routes.h"
 #include "../defs.h"
 
+#undef interface
+#undef TRUE
+#undef FALSE
+
 #define WIN32_LEAN_AND_MEAN
+#include <windows.h>
 #include <iprtrmib.h>
 #include <iphlpapi.h>
-#undef interface
 
 char *StrError(unsigned int ErrNo);
 
index 772df11..875319e 100644 (file)
  * along with olsr.org; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: net.c,v 1.3 2004/10/19 13:58:46 tlopatic Exp $
+ * $Id: net.c,v 1.4 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
 #include <stdio.h>
 
+#undef interface
+#undef TRUE
+#undef FALSE
+
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <winsock2.h>
 #include <ws2tcpip.h>
 #include <iphlpapi.h>
-#undef interface
 
 void WinSockPError(char *Str);
 void PError(char *);
index 29a78e5..8efed1c 100644 (file)
@@ -18,7 +18,7 @@
  * along with olsr.org; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: route.h,v 1.3 2004/10/19 13:58:46 tlopatic Exp $
+ * $Id: route.h,v 1.4 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -30,6 +30,8 @@
 #include <winsock2.h>
 #include <ws2tcpip.h>
 #undef interface
+#undef TRUE
+#undef FALSE
 
 struct in6_rtmsg
 {
index 5312b00..a6400d8 100644 (file)
@@ -18,7 +18,7 @@
  * along with olsr.org; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: in.h,v 1.3 2004/10/19 13:58:46 tlopatic Exp $
+ * $Id: in.h,v 1.4 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -30,5 +30,7 @@
 #include <winsock2.h>
 #include <ws2tcpip.h>
 #undef interface
+#undef TRUE
+#undef FALSE
 
 #endif
index 53d7fe8..40b16d6 100644 (file)
@@ -18,7 +18,7 @@
  * along with olsr.org; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: pthread.h,v 1.3 2004/10/19 13:58:46 tlopatic Exp $
+ * $Id: pthread.h,v 1.4 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -29,6 +29,8 @@
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #undef interface
+#undef TRUE
+#undef FALSE
 
 typedef HANDLE pthread_mutex_t;
 typedef HANDLE pthread_t;
index d5d53bf..7ff8708 100644 (file)
@@ -18,7 +18,7 @@
  * along with olsr.org; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: time.h,v 1.3 2004/10/19 13:58:46 tlopatic Exp $
+ * $Id: time.h,v 1.4 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -30,6 +30,8 @@
 #include <winsock2.h>
 #include <ws2tcpip.h>
 #undef interface
+#undef TRUE
+#undef FALSE
 
 #define timeradd(x, y, z)                       \
   do                                            \
index fba98ec..6137d24 100644 (file)
@@ -18,7 +18,7 @@
  * along with olsr.org; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: tunnel.c,v 1.3 2004/10/19 13:58:46 tlopatic Exp $
+ * $Id: tunnel.c,v 1.4 2004/11/03 18:19:54 tlopatic Exp $
  *
  */
 
@@ -29,6 +29,8 @@
 #include <windows.h>
 #include <stdio.h>
 #undef interface
+#undef TRUE
+#undef FALSE
 
 #include "../olsr.h"