~ubuntu-branches/ubuntu/karmic/bridge-utils/karmic

« back to all changes in this revision

Viewing changes to libbridge/libbridge.h

  • Committer: Bazaar Package Importer
  • Author(s): Santiago Garcia Mantinan
  • Date: 2004-06-10 16:04:37 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040610160437-7wpuv66abmdhujuc
Tags: 1.0.4-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include <net/if.h>
23
23
#include <linux/if_bridge.h>
24
24
 
25
 
struct bridge;
26
 
struct bridge_info;
27
 
struct fdb_entry;
28
 
struct port;
29
 
struct port_info;
30
 
 
31
25
struct bridge_id
32
26
{
33
27
        unsigned char prio[2];
38
32
{
39
33
        struct bridge_id designated_root;
40
34
        struct bridge_id bridge_id;
41
 
        int root_path_cost;
 
35
        unsigned root_path_cost;
42
36
        struct timeval max_age;
43
37
        struct timeval hello_time;
44
38
        struct timeval forward_delay;
45
39
        struct timeval bridge_max_age;
46
40
        struct timeval bridge_hello_time;
47
41
        struct timeval bridge_forward_delay;
48
 
        unsigned topology_change:1;
49
 
        unsigned topology_change_detected:1;
50
 
        int root_port;
51
 
        unsigned stp_enabled:1;
 
42
        u_int16_t root_port;
 
43
        unsigned char stp_enabled;
 
44
        unsigned char topology_change;
 
45
        unsigned char topology_change_detected;
52
46
        struct timeval ageing_time;
53
 
        struct timeval gc_interval;
54
47
        struct timeval hello_timer_value;
55
48
        struct timeval tcn_timer_value;
56
49
        struct timeval topology_change_timer_value;
57
50
        struct timeval gc_timer_value;
58
51
};
59
52
 
60
 
struct bridge
61
 
{
62
 
        struct bridge *next;
63
 
 
64
 
        int ifindex;
65
 
        char ifname[IFNAMSIZ];
66
 
        struct port *firstport;
67
 
        struct port *ports[256];
68
 
        struct bridge_info info;
69
 
};
70
 
 
71
53
struct fdb_entry
72
54
{
73
55
        u_int8_t mac_addr[6];
74
 
        int port_no;
75
 
        unsigned is_local:1;
 
56
        u_int16_t port_no;
 
57
        unsigned char is_local;
76
58
        struct timeval ageing_timer_value;
77
59
};
78
60
 
79
61
struct port_info
80
62
{
 
63
        unsigned port_no;
81
64
        struct bridge_id designated_root;
82
65
        struct bridge_id designated_bridge;
83
66
        u_int16_t port_id;
84
67
        u_int16_t designated_port;
85
 
        int path_cost;
86
 
        int designated_cost;
87
 
        int state;
88
 
        unsigned top_change_ack:1;
89
 
        unsigned config_pending:1;
 
68
        u_int8_t priority;
 
69
        unsigned char top_change_ack;
 
70
        unsigned char config_pending;
 
71
        unsigned char state;
 
72
        unsigned path_cost;
 
73
        unsigned designated_cost;
90
74
        struct timeval message_age_timer_value;
91
75
        struct timeval forward_delay_timer_value;
92
76
        struct timeval hold_timer_value;
93
77
};
94
78
 
95
 
struct port
96
 
{
97
 
        struct port *next;
98
 
 
99
 
        int index;
100
 
        int ifindex;
101
 
        struct bridge *parent;
102
 
        struct port_info info;
103
 
};
104
 
 
105
 
extern struct bridge *bridge_list;
106
 
 
107
 
int br_init(void);
108
 
int br_refresh(void);
109
 
struct bridge *br_find_bridge(char *brname);
110
 
struct port *br_find_port(struct bridge *br, char *portname);
111
 
char *br_get_state_name(int state);
112
 
 
113
 
int br_add_bridge(char *brname);
114
 
int br_del_bridge(char *brname);
115
 
int br_add_interface(struct bridge *br, int ifindex);
116
 
int br_del_interface(struct bridge *br, int ifindex);
117
 
int br_set_bridge_forward_delay(struct bridge *br, struct timeval *tv);
118
 
int br_set_bridge_hello_time(struct bridge *br, struct timeval *tv);
119
 
int br_set_bridge_max_age(struct bridge *br, struct timeval *tv);
120
 
int br_set_ageing_time(struct bridge *br, struct timeval *tv);
121
 
int br_set_gc_interval(struct bridge *br, struct timeval *tv);
122
 
int br_set_stp_state(struct bridge *br, int stp_state);
123
 
int br_set_bridge_priority(struct bridge *br, int bridge_priority);
124
 
int br_set_port_priority(struct port *p, int port_priority);
125
 
int br_set_path_cost(struct port *p, int path_cost);
126
 
int br_read_fdb(struct bridge *br, struct fdb_entry *fdbs, int offset, int num);
127
 
 
128
 
/* libc5 combatability */
129
 
char *if_indextoname(unsigned int __ifindex, char *__ifname);
130
 
unsigned int if_nametoindex(const char *__ifname);
131
 
 
 
79
extern int br_init(void);
 
80
extern int br_refresh(void);
 
81
extern void br_shutdown(void);
 
82
 
 
83
extern int br_foreach_bridge(int (*iterator)(const char *brname, void *),
 
84
                             void *arg);
 
85
extern int br_foreach_port(const char *brname,
 
86
                           int (*iterator)(const char *brname, const char *port,
 
87
                                           void *arg ),
 
88
                           void *arg);
 
89
extern const char *br_get_state_name(int state);
 
90
 
 
91
extern int br_get_bridge_info(const char *br, struct bridge_info *info);
 
92
extern int br_get_port_info(const char *brname, const char *port, 
 
93
                            struct port_info *info);
 
94
extern int br_add_bridge(const char *brname);
 
95
extern int br_del_bridge(const char *brname);
 
96
extern int br_add_interface(const char *br, const char *dev);
 
97
extern int br_del_interface(const char *br, const char *dev);
 
98
extern int br_set_bridge_forward_delay(const char *br, struct timeval *tv);
 
99
extern int br_set_bridge_hello_time(const char *br, struct timeval *tv);
 
100
extern int br_set_bridge_max_age(const char *br, struct timeval *tv);
 
101
extern int br_set_ageing_time(const char *br, struct timeval *tv);
 
102
extern int br_set_stp_state(const char *br, int stp_state);
 
103
extern int br_set_bridge_priority(const char *br, int bridge_priority);
 
104
extern int br_set_port_priority(const char *br, const char *p, 
 
105
                                int port_priority);
 
106
extern int br_set_path_cost(const char *br, const char *p, 
 
107
                            int path_cost);
 
108
extern int br_read_fdb(const char *br, struct fdb_entry *fdbs, 
 
109
                       unsigned long skip, int num);
132
110
#endif