]> git.ipfire.org Git - people/ms/rstp.git/blame - rstplib/uid_stp.h
RSTP testing - PATCH: source MAC address of BPDU
[people/ms/rstp.git] / rstplib / uid_stp.h
CommitLineData
ad02a0eb
SH
1/************************************************************************
2 * RSTP library - Rapid Spanning Tree (802.1t, 802.1w)
3 * Copyright (C) 2001-2003 Optical Access
4 * Author: Alex Rozin
5 *
6 * This file is part of RSTP library.
7 *
8 * RSTP library is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by the
10 * Free Software Foundation; version 2.1
11 *
12 * RSTP library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with RSTP library; see the file COPYING. If not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 * 02111-1307, USA.
21 **********************************************************************/
22
23/* External management communication API definitions */
24
25#ifndef _UID_STP_H__
26#define _UID_STP_H__
27
28#define NAME_LEN 20
29
30typedef enum {
31 STP_DISABLED,
32 STP_ENABLED,
33} UID_STP_MODE_T;
34
35typedef struct {
36 unsigned short prio;
37 unsigned char addr[6];
38} UID_BRIDGE_ID_T;
39
40typedef struct {
41 char vlan_name[NAME_LEN]; /* name of the VLAN, key of the bridge */
42 char action; /* 1-create, 0- delete */
43} UID_STP_BR_CTRL_T;
44
45#define BR_CFG_STATE (1L << 0)
46#define BR_CFG_PRIO (1L << 1)
47#define BR_CFG_AGE (1L << 2)
48#define BR_CFG_HELLO (1L << 3)
49#define BR_CFG_DELAY (1L << 4)
50#define BR_CFG_FORCE_VER (1L << 5)
51#define BR_CFG_AGE_MODE (1L << 6)
52#define BR_CFG_AGE_TIME (1L << 7)
53#define BR_CFG_HOLD_TIME (1L << 8)
54#define BR_CFG_ALL BR_CFG_STATE | \
55 BR_CFG_PRIO | \
56 BR_CFG_AGE | \
57 BR_CFG_HELLO | \
58 BR_CFG_DELAY | \
59 BR_CFG_FORCE_VER | \
60 BR_CFG_AGE_MODE | \
61 BR_CFG_AGE_TIME | \
62 BR_CFG_HOLD_TIME
63
64typedef struct {
65 /* service data */
66 unsigned long field_mask; /* which fields to change */
67 UID_STP_MODE_T stp_enabled;
68 char vlan_name[NAME_LEN]; /* name of the VLAN, key of the bridge */
69
70 /* protocol data */
71 int bridge_priority;
72 int max_age;
73 int hello_time;
74 int forward_delay;
75 int force_version;
76 int hold_time;
77} UID_STP_CFG_T;
78
79typedef struct {
80 /* service data */
81 char vlan_name[NAME_LEN]; /* name of the VLAN, key of the bridge */
82 unsigned long vlan_id;
83 UID_STP_MODE_T stp_enabled;
84
85 /* protocol data */
86 UID_BRIDGE_ID_T designated_root;
87 unsigned long root_path_cost;
88
89 unsigned long timeSince_Topo_Change; /* 14.8.1.1.3.b: TBD */
90 unsigned long Topo_Change_Count; /* 14.8.1.1.3.c: TBD */
91 unsigned char Topo_Change; /* 14.8.1.1.3.d: TBD */
92
93 unsigned short root_port;
94 int max_age;
95 int hello_time;
96 int forward_delay;
97 UID_BRIDGE_ID_T bridge_id;
98} UID_STP_STATE_T;
99
100typedef enum {
101 UID_PORT_DISABLED = 0,
102 UID_PORT_DISCARDING,
103 UID_PORT_LEARNING,
104 UID_PORT_FORWARDING,
105 UID_PORT_NON_STP
106} RSTP_PORT_STATE;
107
108typedef unsigned short UID_PORT_ID;
109
110typedef enum {
111 P2P_FORCE_TRUE,
112 P2P_FORCE_FALSE,
113 P2P_AUTO,
114} ADMIN_P2P_T;
115
116#ifdef __BITMAP_H
117
118#define PT_CFG_STATE (1L << 0)
119#define PT_CFG_COST (1L << 1)
120#define PT_CFG_PRIO (1L << 2)
121#define PT_CFG_P2P (1L << 3)
122#define PT_CFG_EDGE (1L << 4)
123#define PT_CFG_MCHECK (1L << 5)
124#define PT_CFG_NON_STP (1L << 6)
125#ifdef STP_DBG
126#define PT_CFG_DBG_SKIP_RX (1L << 16)
127#define PT_CFG_DBG_SKIP_TX (1L << 17)
128#endif
129
130#define PT_CFG_ALL PT_CFG_STATE | \
131 PT_CFG_COST | \
132 PT_CFG_PRIO | \
133 PT_CFG_P2P | \
134 PT_CFG_EDGE | \
135 PT_CFG_MCHECK | \
136 PT_CFG_NON_STP
137
138#define ADMIN_PORT_PATH_COST_AUTO 0
139
140typedef struct {
141 /* service data */
142 unsigned long field_mask; /* which fields to change */
143 BITMAP_T port_bmp;
144 char vlan_name[NAME_LEN]; /* name of the VLAN, key of the bridge */
145
146 /* protocol data */
147 int port_priority;
148 unsigned long admin_port_path_cost; /* ADMIN_PORT_PATH_COST_AUTO - auto sence */
149 ADMIN_P2P_T admin_point2point;
150 unsigned char admin_edge;
151 unsigned char admin_non_stp; /* 1- doesn't participate in STP, 1 - regular */
152#ifdef STP_DBG
153 unsigned int skip_rx;
154 unsigned int skip_tx;
155#endif
156
157} UID_STP_PORT_CFG_T;
158#endif
159
160typedef struct {
161 /* service data */
162 char vlan_name[NAME_LEN]; /* name of the VLAN, key of the bridge */
163 unsigned int port_no; /* key of the entry */
164
165 /* protocol data */
166 UID_PORT_ID port_id;
167 RSTP_PORT_STATE state;
168 unsigned long path_cost;
169
170 UID_BRIDGE_ID_T designated_root;
171 unsigned long designated_cost;
172 UID_BRIDGE_ID_T designated_bridge;
173 UID_PORT_ID designated_port;
174
175#if 0
176 int infoIs;
177 unsigned short handshake_flags;
178#endif
179
180 unsigned long rx_cfg_bpdu_cnt;
181 unsigned long rx_rstp_bpdu_cnt;
182 unsigned long rx_tcn_bpdu_cnt;
183 int fdWhile; /* 17.15.1 */
184 int helloWhen; /* 17.15.2 */
185 int mdelayWhile; /* 17.15.3 */
186 int rbWhile; /* 17.15.4 */
187 int rcvdInfoWhile;/* 17.15.5 */
188 int rrWhile; /* 17.15.6 */
189 int tcWhile; /* 17.15.7 */
190 int txCount; /* 17.18.40 */
191 int lnkWhile;
192
193 unsigned long uptime; /* 14.8.2.1.3.a */
194 unsigned long oper_port_path_cost;
195 unsigned char role;
196 unsigned char oper_point2point;
197 unsigned char oper_edge;
198 unsigned char oper_stp_neigb;
199 unsigned char top_change_ack;
200 unsigned char tc;
201} UID_STP_PORT_STATE_T;
202
203#endif
204