Moved event.c/h
authorIvo Timmermans <ivo@lychnis.net>
Thu, 2 May 2002 13:11:55 +0000 (13:11 +0000)
committerIvo Timmermans <ivo@lychnis.net>
Thu, 2 May 2002 13:11:55 +0000 (13:11 +0000)
lib/Makefile.am
lib/event.c [new file with mode: 0644]
lib/event.h [new file with mode: 0644]
src/Makefile.am
src/event.c [deleted file]
src/event.h [deleted file]
src/pokey/Makefile.am
src/pokey/event.c [deleted file]
src/pokey/event.h [deleted file]

index f0a012216b1c3397425c8174c5ae85e1d4129e9e..082d4c55b8f296b283149675a6e20f3886f18d9b 100644 (file)
@@ -1,17 +1,17 @@
 ## Process this file with automake to produce Makefile.in
-# $Id: Makefile.am,v 1.8 2002/05/02 11:50:07 zarq Exp $
+# $Id: Makefile.am,v 1.9 2002/05/02 13:11:55 zarq Exp $
 
 noinst_LIBRARIES = libtinc.a
 
 INCLUDES = @INCLUDES@ -I. -I$(top_builddir) -I$(top_srcdir)/intl
 
 libtinc_a_SOURCES = xmalloc.c pidfile.c utils.c getopt.c getopt1.c     \
-       list.c avl_tree.c hooks.c dropin.c edge.c conf.c netutl.c logging.c connection.c subnet.c node.c graph.c
+       list.c avl_tree.c hooks.c dropin.c edge.c conf.c netutl.c logging.c connection.c subnet.c node.c graph.c event.c
 
 libtinc_a_LIBADD = @LIBOBJS@ @ALLOCA@
 libtinc_a_DEPENDENCIES = $(libvpn_a_LIBADD)
 
 noinst_HEADERS = xalloc.h pidfile.h utils.h getopt.h list.h avl_tree.h \
-       hooks.h dropin.h edge.h net.h conf.h netutl.h logging.h connection.h subnet.h node.h graph.h
+       hooks.h dropin.h edge.h net.h conf.h netutl.h logging.h connection.h subnet.h node.h graph.h event.h
 
 EXTRA_DIST = README
diff --git a/lib/event.c b/lib/event.c
new file mode 100644 (file)
index 0000000..3c54c69
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+    event.c -- event queue
+    Copyright (C) 2002 Guus Sliepen <guus@sliepen.warande.net>,
+                  2002 Ivo Timmermans <itimmermans@bigfoot.com>
+
+    This program 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.
+
+    This program 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 this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+    $Id: event.c,v 1.1 2002/05/02 13:11:55 zarq Exp $
+*/
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <xalloc.h>
+#include <string.h>
+#include <utils.h>
+#include <avl_tree.h>
+#include <time.h>
+
+#include "event.h"
+
+#include "system.h"
+
+avl_tree_t *event_tree;
+extern time_t now;
+
+int id;
+
+int event_compare(event_t *a, event_t *b)
+{
+  if(a->time > b->time)
+    return 1;
+  if(a->time < b->time)
+    return -1;
+  return a->id - b->id; 
+}
+
+void init_events(void)
+{
+cp
+  event_tree = avl_alloc_tree((avl_compare_t)event_compare, NULL);
+cp
+}
+
+void exit_events(void)
+{
+cp
+  avl_delete_tree(event_tree);
+cp
+}
+
+event_t *new_event(void)
+{
+  event_t *event;
+cp
+  event = (event_t *)xmalloc_and_zero(sizeof(*event));
+cp
+  return event;
+}
+
+void free_event(event_t *event)
+{
+cp
+  free(event);
+cp
+}
+
+void event_add(event_t *event)
+{
+cp
+  event->id = ++id;
+  avl_insert(event_tree, event);
+cp
+}
+
+void event_del(event_t *event)
+{
+cp
+  avl_delete(event_tree, event);
+cp
+}
+
+event_t *get_expired_event(void)
+{
+  event_t *event;
+cp
+  if(event_tree->head)
+  {
+    event = (event_t *)event_tree->head->data;
+    if(event->time < now)
+    {
+      avl_delete(event_tree, event);
+      return event;
+    }
+  }
+cp  
+  return NULL;
+}
diff --git a/lib/event.h b/lib/event.h
new file mode 100644 (file)
index 0000000..df0c6d8
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+    event.h -- header for event.c
+    Copyright (C) 2002 Guus Sliepen <guus@sliepen.warande.net>,
+                  2002 Ivo Timmermans <itimmermans@bigfoot.com>
+
+    This program 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.
+
+    This program 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 this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+    $Id: event.h,v 1.1 2002/05/02 13:11:55 zarq Exp $
+*/
+
+#ifndef __TINC_EVENT_H__
+#define __TINC_EVENT_H__
+
+#include <time.h>
+#include <avl_tree.h>
+
+avl_tree_t *event_tree;
+
+typedef void (*event_handler_t)(void *);
+
+typedef struct {
+  time_t time;
+  int id;
+  event_handler_t handler;
+  void *data;
+} event_t;
+
+extern void init_events(void);
+extern void exit_events(void);
+extern event_t *new_event(void);
+extern void free_event(event_t *);
+extern void event_add(event_t *);
+extern void event_del(event_t *);
+extern event_t *get_expired_event(void);
+
+#endif /* __TINC_EVENT_H__ */
index b4efc964f2a79a48287ca6ee03b54638e2f4ca54..eb7d3f21bcb76c5a16013d01b4e4119810c2d9ac 100644 (file)
@@ -1,5 +1,5 @@
 ## Produce this file with automake to get Makefile.in
-# $Id: Makefile.am,v 1.11 2002/05/02 11:50:07 zarq Exp $
+# $Id: Makefile.am,v 1.12 2002/05/02 13:11:55 zarq Exp $
 
 SUBDIRS = pokey
 
@@ -7,13 +7,13 @@ sbin_PROGRAMS = tincd
 
 EXTRA_DIST = linux/device.c freebsd/device.c openbsd/device.c solaris/device.c
 
-tincd_SOURCES = read_conf.c device.c event.c  meta.c net_packet.c net_setup.c  \
+tincd_SOURCES = read_conf.c device.c   meta.c net_packet.c net_setup.c \
        net_socket.c process.c protocol.c protocol_auth.c protocol_edge.c protocol_misc.c       \
        protocol_key.c protocol_subnet.c route.c tincd.c net.c callbacks.c
 
 INCLUDES = @INCLUDES@ -I$(top_builddir) -I$(top_srcdir)/lib -I$(top_srcdir)/intl
 
-noinst_HEADERS = read_conf.h  device.h event.h  meta.h process.h       \
+noinst_HEADERS = read_conf.h  device.h   meta.h process.h      \
        protocol.h route.h callbacks.h
 
 LIBS = @LIBS@ @INTLLIBS@
diff --git a/src/event.c b/src/event.c
deleted file mode 100644 (file)
index 8e332fa..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
-    event.c -- event queue
-    Copyright (C) 2002 Guus Sliepen <guus@sliepen.warande.net>,
-                  2002 Ivo Timmermans <itimmermans@bigfoot.com>
-
-    This program 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.
-
-    This program 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 this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-    $Id: event.c,v 1.2 2002/04/09 15:26:00 zarq Exp $
-*/
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <xalloc.h>
-#include <string.h>
-#include <utils.h>
-#include <avl_tree.h>
-#include <time.h>
-
-#include "event.h"
-
-#include "system.h"
-
-avl_tree_t *event_tree;
-extern time_t now;
-
-int id;
-
-int event_compare(event_t *a, event_t *b)
-{
-  if(a->time > b->time)
-    return 1;
-  if(a->time < b->time)
-    return -1;
-  return a->id - b->id; 
-}
-
-void init_events(void)
-{
-cp
-  event_tree = avl_alloc_tree((avl_compare_t)event_compare, NULL);
-cp
-}
-
-void exit_events(void)
-{
-cp
-  avl_delete_tree(event_tree);
-cp
-}
-
-event_t *new_event(void)
-{
-  event_t *event;
-cp
-  event = (event_t *)xmalloc_and_zero(sizeof(*event));
-cp
-  return event;
-}
-
-void free_event(event_t *event)
-{
-cp
-  free(event);
-cp
-}
-
-void event_add(event_t *event)
-{
-cp
-  event->id = ++id;
-  avl_insert(event_tree, event);
-cp
-}
-
-void event_del(event_t *event)
-{
-cp
-  avl_delete(event_tree, event);
-cp
-}
-
-event_t *get_expired_event(void)
-{
-  event_t *event;
-cp
-  if(event_tree->head)
-  {
-    event = (event_t *)event_tree->head->data;
-    if(event->time < now)
-    {
-      avl_delete(event_tree, event);
-      return event;
-    }
-  }
-cp  
-  return NULL;
-}
diff --git a/src/event.h b/src/event.h
deleted file mode 100644 (file)
index 4b238cc..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-    event.h -- header for event.c
-    Copyright (C) 2002 Guus Sliepen <guus@sliepen.warande.net>,
-                  2002 Ivo Timmermans <itimmermans@bigfoot.com>
-
-    This program 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.
-
-    This program 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 this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-    $Id: event.h,v 1.2 2002/04/09 15:26:00 zarq Exp $
-*/
-
-#ifndef __TINC_EVENT_H__
-#define __TINC_EVENT_H__
-
-#include <time.h>
-#include <avl_tree.h>
-
-avl_tree_t *event_tree;
-
-typedef void (*event_handler_t)(void *);
-
-typedef struct {
-  time_t time;
-  int id;
-  event_handler_t handler;
-  void *data;
-} event_t;
-
-extern void init_events(void);
-extern void exit_events(void);
-extern event_t *new_event(void);
-extern void free_event(event_t *);
-extern void event_add(event_t *);
-extern void event_del(event_t *);
-extern event_t *get_expired_event(void);
-
-#endif /* __TINC_EVENT_H__ */
index 20281743ccb5c0aec8b1d3afc7d9070730c87ef7..48e9f498410bcf70b26a78ec27b23e3d947c84db 100644 (file)
@@ -1,9 +1,9 @@
 ## Produce this file with automake to get Makefile.in
-# $Id: Makefile.am,v 1.3 2002/05/02 11:50:07 zarq Exp $
+# $Id: Makefile.am,v 1.4 2002/05/02 13:11:55 zarq Exp $
 
 sbin_PROGRAMS = pokey
 
-pokey_SOURCES = event.c graph.c        \
+pokey_SOURCES =  graph.c       \
        interface.c meta.c net.c net_packet.c net_setup.c net_socket.c netutl.c \
         process.c protocol.c protocol_auth.c protocol_edge.c   \
        protocol_misc.c protocol_key.c protocol_subnet.c route.c        \
@@ -11,7 +11,7 @@ pokey_SOURCES = event.c graph.c       \
 
 INCLUDES = @INCLUDES@ -I$(top_builddir) -I$(top_srcdir)/lib -I$(top_srcdir)/intl -I$(top_srcdir)/src -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/include/libglade-1.0 -I/usr/include/gnome-1.0 -I/usr/include/gnome-xml -I/usr/include/libglade-1.0 -I/usr/include/gnome-1.0 -DNEED_GNOMESUPPORT_H -I/usr/lib/gnome-libs/include -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/include/orbit-1.0 -I/usr/include/gtk-1.2 -I/usr/X11R6/include
 
-noinst_HEADERS =  device.h event.h graph.h meta.h net.h netutl.h  process.h    \
+noinst_HEADERS =  device.h  graph.h meta.h net.h netutl.h  process.h   \
        protocol.h route.h  read_conf.h
 
 LIBS = @LIBS@ @INTLLIBS@
diff --git a/src/pokey/event.c b/src/pokey/event.c
deleted file mode 100644 (file)
index 87a1c8a..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
-    event.c -- event queue
-    Copyright (C) 2002 Guus Sliepen <guus@sliepen.warande.net>,
-                  2002 Ivo Timmermans <itimmermans@bigfoot.com>
-
-    This program 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.
-
-    This program 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 this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-    $Id: event.c,v 1.1 2002/04/28 12:46:26 zarq Exp $
-*/
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <xalloc.h>
-#include <string.h>
-#include <utils.h>
-#include <avl_tree.h>
-#include <time.h>
-
-#include "event.h"
-
-#include "system.h"
-
-avl_tree_t *event_tree;
-extern time_t now;
-
-int id;
-
-int event_compare(event_t *a, event_t *b)
-{
-  if(a->time > b->time)
-    return 1;
-  if(a->time < b->time)
-    return -1;
-  return a->id - b->id; 
-}
-
-void init_events(void)
-{
-cp
-  event_tree = avl_alloc_tree((avl_compare_t)event_compare, NULL);
-cp
-}
-
-void exit_events(void)
-{
-cp
-  avl_delete_tree(event_tree);
-cp
-}
-
-event_t *new_event(void)
-{
-  event_t *event;
-cp
-  event = (event_t *)xmalloc_and_zero(sizeof(*event));
-cp
-  return event;
-}
-
-void free_event(event_t *event)
-{
-cp
-  free(event);
-cp
-}
-
-void event_add(event_t *event)
-{
-cp
-  event->id = ++id;
-  avl_insert(event_tree, event);
-cp
-}
-
-void event_del(event_t *event)
-{
-cp
-  avl_delete(event_tree, event);
-cp
-}
-
-event_t *get_expired_event(void)
-{
-  event_t *event;
-cp
-  if(event_tree->head)
-  {
-    event = (event_t *)event_tree->head->data;
-    if(event->time < now)
-    {
-      avl_delete(event_tree, event);
-      return event;
-    }
-  }
-cp  
-  return NULL;
-}
diff --git a/src/pokey/event.h b/src/pokey/event.h
deleted file mode 100644 (file)
index 989cc07..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-    event.h -- header for event.c
-    Copyright (C) 2002 Guus Sliepen <guus@sliepen.warande.net>,
-                  2002 Ivo Timmermans <itimmermans@bigfoot.com>
-
-    This program 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.
-
-    This program 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 this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-    $Id: event.h,v 1.1 2002/04/28 12:46:26 zarq Exp $
-*/
-
-#ifndef __TINC_EVENT_H__
-#define __TINC_EVENT_H__
-
-#include <time.h>
-#include <avl_tree.h>
-
-avl_tree_t *event_tree;
-
-typedef void (*event_handler_t)(void *);
-
-typedef struct {
-  time_t time;
-  int id;
-  event_handler_t handler;
-  void *data;
-} event_t;
-
-extern void init_events(void);
-extern void exit_events(void);
-extern event_t *new_event(void);
-extern void free_event(event_t *);
-extern void event_add(event_t *);
-extern void event_del(event_t *);
-extern event_t *get_expired_event(void);
-
-#endif /* __TINC_EVENT_H__ */