1 /************************************************************************
2 * RSTP library - Rapid Spanning Tree (802.1t, 802.1w)
3 * Copyright (C) 2001-2003 Optical Access
6 * This file is part of RSTP library.
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
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.
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
21 **********************************************************************/
23 /* STP machine instance : bridge per VLAN: 17.17 */
24 /* The Clause 17.13 points: "NOTE:The operation of the Bridge as a whole can
25 * be represented by the interaction between Bridge Ports specified,
26 * and by parameters of the Bridge stored in ‘Port 0’. This removes the
27 * need for any ‘per Bridge’ specification elements, and helps ensure
28 * the minimum dependencies between Bridge Ports. This in turn supports
29 * the development of implementations that scale well with increasing
30 * numbers of Bridge Ports. This shift of focus to ‘per Port operation’
31 * for the RSTP is supported by underlying technical changes from the
32 * Spanning Tree Algorithm and Protocol (Clause 8):"
33 * Newetheless, it seems to me, the behaviour of of the bridge, its variables
34 * and functions are so distinct from Port, that I decided to design Bridge
35 * instance. I called this object 'stpm' from STP machine. I'd like to see
36 * another procedural model, more corresponding to this note on Clause 17.13 */
38 #ifndef _STP_MACHINE_H__
39 #define _STP_MACHINE_H__
44 #define TxHoldCount 3 /* 17.16.6, 17.28.2(Table 17-5) */
46 typedef enum {/* 17.12, 17.16.1 */
56 /* The only "per bridge" state machine */
57 STATE_MACH_T
* rolesel
; /* the Port Role Selection State machione: 17.22 */
58 STATE_MACH_T
* machines
;
61 PROTOCOL_VERSION_T ForceVersion
; /* 17.12, 17.16.1 */
62 BRIDGE_ID BrId
; /* 17.17.2 */
63 TIMEVALUES_T BrTimes
; /* 17.17.4 */
64 PORT_ID rootPortId
; /* 17.17.5 */
65 PRIO_VECTOR_T rootPrio
; /* 17.17.6 */
66 TIMEVALUES_T rootTimes
; /* 17.17.7 */
68 int vlan_id
; /* let's say: tag */
69 char* name
; /* name of the VLAN, maily for debugging */
70 UID_STP_MODE_T admin_state
; /* STP_DISABLED or STP_ENABLED; type see in UiD */
72 unsigned long timeSince_Topo_Change
; /* 14.8.1.1.3.b */
73 unsigned long Topo_Change_Count
; /* 14.8.1.1.3.c */
74 unsigned char Topo_Change
; /* 14.8.1.1.3.d */
79 typedef struct stpm_t STPM_T
;
82 /* Functions prototypes */
85 STP_stpm_one_second (STPM_T
* param
);
88 STP_stpm_create (int vlan_id
, char* name
);
91 STP_stpm_enable (STPM_T
* this, UID_STP_MODE_T admin_state
);
94 STP_stpm_delete (STPM_T
* this);
97 STP_stpm_start (STPM_T
* this);
100 STP_stpm_stop (STPM_T
* this);
103 STP_stpm_update (STPM_T
* this);
106 STP_compute_bridge_id (STPM_T
* this);
109 STP_stpm_get_the_list (void);
112 STP_stpm_update_after_bridge_management (STPM_T
* this);
115 STP_stpm_check_bridge_priority (STPM_T
* this);
118 STP_stpm_get_port_name_by_id (STPM_T
* this, PORT_ID port_id
);
120 STPM_T
* stpapi_stpm_find (int vlan_id
);
122 int stp_in_stpm_enable (int vlan_id
, char* name
,
123 UID_STP_MODE_T admin_state
);
124 void* stp_in_stpm_create (int vlan_id
, char *name
, int *err_code
);
126 #endif /* _STP_MACHINE_H__ */