summaryrefslogtreecommitdiff
path: root/lib/zebra.h
diff options
context:
space:
mode:
authorpaul <paul>2003-05-19 21:06:32 +0000
committerpaul <paul>2003-05-19 21:06:32 +0000
commitf04385215b363f57ed3d3dd8f6bfa53ac4e2c1da (patch)
treedc2a7e6eff78285b57602649489a51c0c82a791c /lib/zebra.h
parent733e8102dc513a49363c73597fbf9d3fe061acd5 (diff)
From: Paul Jakma <paul@clubi.ie>
Subject: [zebra 19097] HAVE_ASM_TYPES does anyone know why lib/zebra.h has: #ifdef HAVE_ASM_TYPES_H #include <asm/types.h> #endif /* HAVE_ASM_TYPES_H */ There's no need for it that i can see (least not on linux) and it causes compile warnings. Is it needed? If so, why?
Diffstat (limited to 'lib/zebra.h')
-rw-r--r--lib/zebra.h50
1 files changed, 46 insertions, 4 deletions
diff --git a/lib/zebra.h b/lib/zebra.h
index 06302b3d..c3e41284 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -28,8 +28,15 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#ifdef SUNOS_5
#define _XPG4_2
#define __EXTENSIONS__
+typedef unsigned int u_int32_t;
+typedef unsigned short u_int16_t;
+typedef unsigned short u_int8_t;
#endif /* SUNOS_5 */
+#ifndef HAVE_SOCKLEN_T
+typedef int socklen_t;
+#endif /* HAVE_SOCKLEN_T */
+
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -78,10 +85,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include <linux/version.h>
#endif /* HAVE_LINUX_VERSION_H */
-#ifdef HAVE_ASM_TYPES_H
-#include <asm/types.h>
-#endif /* HAVE_ASM_TYPES_H */
-
/* misc include group */
#include <stdarg.h>
#include <assert.h>
@@ -309,4 +312,43 @@ typedef u_char safi_t;
typedef u_int16_t zebra_size_t;
typedef u_int8_t zebra_command_t;
+/* FIFO -- first in first out structure and macros. */
+struct fifo
+{
+ struct fifo *next;
+ struct fifo *prev;
+};
+
+#define FIFO_INIT(F) \
+ do { \
+ struct fifo *Xfifo = (struct fifo *)(F); \
+ Xfifo->next = Xfifo->prev = Xfifo; \
+ } while (0)
+
+#define FIFO_ADD(F,N) \
+ do { \
+ struct fifo *Xfifo = (struct fifo *)(F); \
+ struct fifo *Xnode = (struct fifo *)(N); \
+ Xnode->next = Xfifo; \
+ Xnode->prev = Xfifo->prev; \
+ Xfifo->prev = Xfifo->prev->next = Xnode; \
+ } while (0)
+
+#define FIFO_DEL(N) \
+ do { \
+ struct fifo *Xnode = (struct fifo *)(N); \
+ Xnode->prev->next = Xnode->next; \
+ Xnode->next->prev = Xnode->prev; \
+ } while (0)
+
+#define FIFO_HEAD(F) \
+ ((((struct fifo *)(F))->next == (struct fifo *)(F)) \
+ ? NULL : (F)->next)
+
+#define FIFO_EMPTY(F) \
+ (((struct fifo *)(F))->next == (struct fifo *)(F))
+
+#define FIFO_TOP(F) \
+ (FIFO_EMPTY(F) ? NULL : ((struct fifo *)(F))->next)
+
#endif /* _ZEBRA_H */