~ubuntu-branches/ubuntu/lucid/vde2/lucid-proposed

« back to all changes in this revision

Viewing changes to switch.h

  • Committer: Bazaar Package Importer
  • Author(s): Filippo Giunchedi
  • Date: 2008-06-17 15:36:32 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080617153632-5318x7iv0zwmu3zu
Tags: 2.2.1-1
* New upstream release
  - fix vlan commands on amd64 (Closes: #484295)
  - fix mac addresses switch between ports (Closes: #469098)
* Suggest: qemu and kvm as requested in #461514
* Expand and spell-check README.Debian, add manual method example
  (Closes: #466363)
* Do not assume MAKEDEV presence in postinst
* Remove /usr/bin/daemon usage from ifupdown scripts (and Recommends)
* Add manpage for vde_tunctl
* Upgrade to S-V 3.8.0 (add Homepage field) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright 2005 Renzo davoli VDE-2
2
 
 * Some code from vde_switch Copyright 2002 Jeff Dike
3
 
 * Licensed under the GPLv2
4
 
 */
5
 
 
6
 
#ifndef __SWITCH_H__
7
 
#define __SWITCH_H__
8
 
 
9
 
typedef unsigned char uchar;
10
 
/* FAST SPANNING TREE PROTOCOL (experimental)*/
11
 
#define FSTP
12
 
/* POLL Main LOOP Optimization */
13
 
#define OPTPOLL
14
 
 
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
30
 
 
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;
42
 
};
43
 
 
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);
50
 
 
51
 
#define STDRCFILE "/etc/vde2/vde_switch.rc"
52
 
 
53
 
#define ETH_ALEN 6
54
 
 
55
 
#define INIT_HASH_SIZE 128
56
 
#define DEFAULT_PRIORITY 0x8000
57
 
#define INIT_NUMPORTS 32
58
 
#define DEFAULT_COST 20000000 /* 1Mbit line */
59
 
 
60
 
extern char *prog;
61
 
extern unsigned char switchmac[];
62
 
extern unsigned int  priority;
63
 
 
64
 
#define NUMOFVLAN 4095
65
 
#define NOVLAN 0xfff
66
 
 
67
 
#endif