loadlwipv6 inlined
[vde.git] / vde-2 / vde_switch / switch.h
blob7ea6b08f2dc26f131257f2546968753c534ebd68
1 /* Copyright 2005 Renzo davoli VDE-2
2 * Some code from vde_switch Copyright 2002 Jeff Dike
3 * Licensed under the GPLv2
4 */
6 #ifndef __SWITCH_H__
7 #define __SWITCH_H__
9 typedef unsigned char uchar;
10 /* FAST SPANNING TREE PROTOCOL (experimental)*/
11 #define FSTP
12 /* POLL Main LOOP Optimization */
13 #define OPTPOLL
15 #ifdef _MALLOC_DEBUG
16 #define free(X) ({ printf("MDBG-FREE %p %s %d\n",(X),__FILE__,__LINE__); \
17 free(X); })
18 #define malloc(X) ({ void *x; x=malloc(X); \
19 printf("MDBG-MALLOC %p %s %d\n",x,__FILE__,__LINE__); \
20 x; })
21 #define strdup(X) ({ void *x; x=strdup(X); \
22 printf("MDBG-STRDUP %p %s %d\n",x,__FILE__,__LINE__); \
23 x; })
24 #define realloc(Y,X) ({ void *x,*old; \
25 old=(Y);\
26 x=realloc(old,(X)); \
27 printf("MDBG-REALLOC %p->%p %s %d\n",old,x,__FILE__,__LINE__); \
28 x; })
29 #endif
31 struct swmodule {
32 char *swmname; /* module name */
33 char swmtag; /* module tag - computer by the load sequence */
34 char swmnopts; /* number of options for getopt */
35 struct option *swmopts; /* options for getopt */
36 void (*usage)(void); /* usage function: command line opts explanation */
37 int (*parseopt)(int parm,char *optarg); /* parse getopt output */
38 void (*init)(void); /* init */
39 void (*handle_input)(unsigned char type,int fd,int revents,int *arg); /* handle input */
40 void (*cleanup)(unsigned char type,int fd,int arg); /*cleanup for files or final if fd == -1 */
41 struct swmodule *next;
44 void add_swm(struct swmodule *new);
45 void del_swm(struct swmodule *old);
46 unsigned char add_type(struct swmodule *mgr,int prio);
47 void del_type(unsigned char type);
48 void add_fd(int fd,unsigned char type,int arg);
49 void remove_fd(int fd);
51 #define STDRCFILE "/etc/vde2/vde_switch.rc"
53 #define ETH_ALEN 6
55 #define INIT_HASH_SIZE 128
56 #define DEFAULT_PRIORITY 0x8000
57 #define INIT_NUMPORTS 32
58 #define DEFAULT_COST 20000000 /* 1Mbit line */
60 extern char *prog;
61 extern unsigned char switchmac[];
62 extern unsigned int priority;
64 #define NUMOFVLAN 4095
65 #define NOVLAN 0xfff
67 #endif