1 /* Copyright 2005 Renzo davoli VDE-2
2 * Some code from vde_switch Copyright 2002 Jeff Dike
3 * Licensed under the GPLv2
9 typedef unsigned char uchar
;
10 /* FAST SPANNING TREE PROTOCOL (experimental)*/
12 /* POLL Main LOOP Optimization */
16 #define free(X) ({ printf("MDBG-FREE %p %s %d\n",(X),__FILE__,__LINE__); \
18 #define malloc(X) ({ void *x; x=malloc(X); \
19 printf("MDBG-MALLOC %p %s %d\n",x,__FILE__,__LINE__); \
21 #define strdup(X) ({ void *x; x=strdup(X); \
22 printf("MDBG-STRDUP %p %s %d\n",x,__FILE__,__LINE__); \
24 #define realloc(Y,X) ({ void *x,*old; \
27 printf("MDBG-REALLOC %p->%p %s %d\n",old,x,__FILE__,__LINE__); \
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"
55 #define INIT_HASH_SIZE 128
56 #define DEFAULT_PRIORITY 0x8000
57 #define INIT_NUMPORTS 32
58 #define DEFAULT_COST 20000000 /* 1Mbit line */
61 extern unsigned char switchmac
[];
62 extern unsigned int priority
;
64 #define NUMOFVLAN 4095