add more timer cookies
authorBernd Petrovitsch <bernd@firmix.at>
Mon, 10 Nov 2008 22:39:05 +0000 (23:39 +0100)
committerBernd Petrovitsch <bernd@firmix.at>
Mon, 10 Nov 2008 22:39:05 +0000 (23:39 +0100)
especially in some plugins

lib/arprefresh/src/olsrd_arprefresh.c
lib/nameservice/src/mapwrite.c
lib/nameservice/src/nameservice.c
lib/nameservice/src/nameservice.h
lib/tas/src/plugin.c

index 5521b8a..d170bd6 100644 (file)
@@ -89,6 +89,7 @@ typedef struct
 
 static int arprefresh_sockfd = -1;
 static const int arprefresh_portnum = 698;
+static struct olsr_cookie_info *arp_event_timer_cookie;
 
 /**
  * Scheduled event to fetch gathered packets and update the ARP cache
@@ -158,6 +159,7 @@ static void olsr_arp_event(void* foo __attribute__((unused)))
 int olsrd_plugin_init(void)
 {
        int ret = 0;
+       arp_event_timer_cookie  = olsr_alloc_cookie("Arprefresh: event", OLSR_COOKIE_TYPE_TIMER);
        if (AF_INET == olsr_cnf->ip_version)
        {
                int flags;
@@ -191,7 +193,7 @@ int olsrd_plugin_init(void)
                {
                        /* Register the ARP refresh event */
                         olsr_start_timer(2 * MSEC_PER_SEC, 0, OLSR_TIMER_PERIODIC,
-                                         &olsr_arp_event, NULL, 0);
+                                         &olsr_arp_event, NULL, arp_event_timer_cookie->ci_id);
                        ret = 1;
                }
                else
index d38c8f0..d607166 100644 (file)
@@ -257,7 +257,7 @@ int mapwrite_init(const char* fifoname)
     else
     {
       the_fifoname = fifoname;
-      olsr_start_timer(100, 5, OLSR_TIMER_PERIODIC, &mapwrite_poll, NULL, 0);
+      olsr_start_timer(100, 5, OLSR_TIMER_PERIODIC, &mapwrite_poll, NULL, map_poll_timer_cookie->ci_id);
     }
   }
   return OLSR_TRUE;
index b1fa19b..3be5cf0 100644 (file)
@@ -83,6 +83,9 @@ static char my_services_change_script[MAX_FILE + 1];
 static char latlon_in_file[MAX_FILE + 1];
 static char my_latlon_file[MAX_FILE + 1];
 float my_lat = 0.0, my_lon = 0.0;
+static struct olsr_cookie_info *msg_gen_timer_cookie;
+static struct olsr_cookie_info *write_file_timer_cookie;
+struct olsr_cookie_info *map_poll_timer_cookie;
 
 /* the databases (using hashing)
  * for hostnames, service_lines and dns-servers
@@ -92,7 +95,6 @@ float my_lat = 0.0, my_lon = 0.0;
  * */
 static struct list_node name_list[HASHSIZE];
 struct name_entry *my_names = NULL;
-struct timer_entry *name_table_write = NULL;
 static olsr_bool name_table_changed = OLSR_TRUE;
 
 static struct list_node service_list[HASHSIZE];
@@ -172,7 +174,9 @@ name_constructor(void)
                list_head_init(&latlon_list[i]);
        }
        
-
+       msg_gen_timer_cookie = olsr_alloc_cookie("Nameservice: message gen", OLSR_COOKIE_TYPE_TIMER);
+       write_file_timer_cookie = olsr_alloc_cookie("Nameservice: write file", OLSR_COOKIE_TYPE_TIMER);
+       map_poll_timer_cookie = olsr_alloc_cookie("Nameservice: map poll", OLSR_COOKIE_TYPE_TIMER);
 }
 
 
@@ -396,7 +400,7 @@ name_init(void)
        /* periodic message generation */
        msg_gen_timer = olsr_start_timer(my_interval * MSEC_PER_SEC, EMISSION_JITTER,
                                                                         OLSR_TIMER_PERIODIC, &olsr_namesvc_gen,
-                                                                        NULL, 0);
+                                                                        NULL, msg_gen_timer_cookie->ci_id);
 
        mapwrite_init(my_latlon_file);
 
@@ -530,7 +534,7 @@ olsr_start_write_file_timer(void)
        }
 
        write_file_timer = olsr_start_timer(5 * MSEC_PER_SEC, 5, OLSR_TIMER_ONESHOT,
-                                                                               olsr_expire_write_file_timer, NULL, 0);
+                                                                               olsr_expire_write_file_timer, NULL, write_file_timer_cookie->ci_id);
 }
 
 /*
index acf6383..88868b5 100644 (file)
@@ -119,6 +119,7 @@ LISTNODE2STRUCT(list2db, struct db_entry, db_list);
 extern struct name_entry *my_names;
 extern struct list_node latlon_list[HASHSIZE];
 extern float my_lat, my_lon;
+extern struct olsr_cookie_info *map_poll_timer_cookie;
 
 void olsr_expire_write_file_timer(void *);
 void olsr_namesvc_delete_db_entry(struct db_entry *);
index 4235fd0..e2b9297 100644 (file)
@@ -92,6 +92,8 @@ static struct neighbor_entry *iterNeighTab = NULL;
 static struct tc_entry *iterTcTab = NULL;
 static struct rt_entry *iterRouteTab = NULL;
 
+static struct olsr_cookie_info *service_timer_cookie;
+
 static void __attribute__((constructor)) banner(void)
 {
   printf("Tiny Application Server 0.1 by olsr.org\n");
@@ -452,11 +454,12 @@ int olsrd_plugin_init(void)
 {
   intTab = ifnet;
   neighTab = neighbortable;
+  service_timer_cookie  = olsr_alloc_cookie("Tas: service", OLSR_COOKIE_TYPE_TIMER);
 
   httpInit();
   
   olsr_start_timer(OLSR_TAS_SERVICE_INT, 0, OLSR_TIMER_PERIODIC,
-                   &serviceFunc, NULL, 0);
+                   &serviceFunc, NULL, service_timer_cookie->ci_id);
 
   olsr_parser_add_function(parserFunc, MESSAGE_TYPE, 1);