📄 spantree.h
字号:
typedef struct{ Identifier designated_root; /* (8.5.3.1) */ Cost_t root_path_cost; /* (8.5.3.2) */ Int root_port; /* (8.5.3.3) */ Time_t max_age; /* (8.5.3.4) */ Time_t hello_time; /* (8.5.3.5) */ Time_t forward_delay; /* (8.5.3.6) */ Identifier bridge_id; /* (8.5.3.7) */ Time_t bridge_max_age; /* (8.5.3.8) */ Time_t bridge_hello_time; /* (8.5.3.9) */ Time_t bridge_forward_delay; /* (8.5.3.10) */ Boolean topology_change_detected; /* (8.5.3.11) */ Boolean topology_change; /* (8.5.3.12) */ Time_t topology_change_time; /* (8.5.3.13) */ Time_t hold_time; /* (8.5.3.14) */} Bridge_data;/** Port Parameters (8.5.5) **/typedef struct{ Port_id port_id; /* (8.5.5.1) */ State_t state; /* (8.5.5.2) */ Int path_cost; /* (8.5.5.3) */ Identifier designated_root; /* (8.5.5.4) */ Int designated_cost; /* (8.5.5.5) */ Identifier designated_bridge; /* (8.5.5.6) */ Port_id designated_port; /* (8.5.5.7) */ Boolean topology_change_acknowledge; /* (8.5.5.8) */ Boolean config_pending; /* (8.5.5.9) */ Boolean change_detection_enabled; /* (8.5.5.10) */ Boolean portLinkBlockSet; Boolean protocol_enabled;} Port_data;/** types to support timers for this pseudo-implementation. **/typedef struct{ Boolean active; /* timer in use. */ Time_t value; /* current value of timer, counting up. */} Timer;/** BPDU packet formats. **/typedef ushort_t Protocol_identifier;typedef uchar_t Flag_t;typedef struct { uchar_t dest[6]; uchar_t src[6]; ushort_t ether_type;} machdr_t;typedef struct { Protocol_identifier identifier; Protocol_version version; Bpdu_type type;} Bpdu_header_t;typedef struct { Bpdu_header_t header; Flag_t flags; Identifier root_id; Cost_t root_path_cost; Identifier bridge_id; Port_id port_id; Time_t message_age; Time_t max_age; Time_t hello_time; Time_t forward_delay;} Config_pkt_t;typedef struct { Bpdu_header_t header; Flag_t flags; Identifier root_id; uchar_t root_path_cost[4]; Identifier bridge_id; uchar_t port_id[2]; uchar_t message_age[2]; uchar_t max_age[2]; uchar_t hello_time[2]; uchar_t forward_delay[2];} Config_pkt_pkt_t;typedef struct { Bpdu_header_t header;} Tcn_pkt_t;IMPORT void span_send_config_bpdu( Int port_no, Config_bpdu *bpdu );IMPORT void span_send_tcn_bpdu( Int port_no, Tcn_bpdu *bpdu );IMPORT void span_set_aging(ulong_t value);IMPORT void span_set_port_state( Int port_no, State_t state );IMPORT void received_config_bpdu(Int port_no, Config_bpdu * config);IMPORT void received_tcn_bpdu(Int port_no, Tcn_bpdu * tcn);IMPORT void bridgeParmsUpdated( void );void set_port_priority(Int port_no, Port_id new_port_id);void enable_port(Int port_no);void disable_port(Int port_no);void set_path_cost(Int port_no, Cost_t path_cost);/* * UplinkFast/PortFast related definitions */#define ST_FAST 1 /* undefine in order to remove PortFast/UplinkFast */enum boolean {NO, YES};typedef enum { stFastON=1, stFastOFF=2 }stFast_t;/** interface functions*/IMPORT void count_forward_transitions( ulong_t port );IMPORT ulong_t get_stp_port_forward_transitions( ulong_t port );IMPORT const uchar_t *get_stp_port_designated_port( ulong_t port );IMPORT const uchar_t *get_stp_port_designated_bridge( ulong_t port );IMPORT ulong_t get_stp_port_designated_cost( ulong_t port );IMPORT const uchar_t *get_stp_port_designated_root( ulong_t port );IMPORT ulong_t get_stp_port_path_cost( ulong_t port );IMPORT ulong_t get_stp_port_enable( ulong_t port );IMPORT ulong_t get_stp_port_state( ulong_t port );IMPORT ulong_t get_stp_port_priority( ulong_t port );IMPORT ulong_t get_stp_port( ulong_t port );IMPORT ulong_t get_stp_bridge_forward_delay( void );IMPORT ulong_t get_stp_bridge_hello_time( void );IMPORT ulong_t get_stp_bridge_max_age( void );IMPORT ulong_t get_stp_forward_delay( void );IMPORT ulong_t get_stp_hold_time( void );IMPORT ulong_t get_stp_hello_time();IMPORT ulong_t get_stp_max_age( void );IMPORT ulong_t get_stp_root_port( void );IMPORT ulong_t get_stp_root_cost( void );IMPORT const uchar_t *get_stp_designated_root( void );IMPORT void count_topology_change( void );IMPORT ulong_t get_stp_topology_change_count( void );IMPORT ulong_t get_stp_time_since_topology_change( void );IMPORT void set_stp_priority( ulong_t priority, Boolean startup );IMPORT ulong_t get_stp_priority( void );IMPORT ulong_t get_stp_protocol_spec( void );IMPORT ulong_t get_span_tree_enable( void );IMPORT ulong_t get_stp_protocol_state( ulong_t port );IMPORT ulong_t spanTreeNumPorts( void );IMPORT Boolean get_stp_global_enable( void );IMPORT void set_stp_protocol_state( ulong_t port, ulong_t state, Boolean startup );IMPORT void set_stp_port_enable( ulong_t port, ulong_t status, Boolean startup );IMPORT void set_stp_global_enable( Boolean state );IMPORT void set_span_tree_enable( ulong_t state );IMPORT void set_stp_bridge_max_age(ulong_t max_age, Boolean startup);IMPORT void set_stp_bridge_hello_time( ulong_t hello_time, Boolean startup );IMPORT void set_stp_bridge_forward_delay( ulong_t forward_delay, Boolean startup );IMPORT void set_stp_port_priority( ulong_t port, ulong_t priority, Boolean startup );IMPORT void set_stp_port_path_cost( ulong_t port, ulong_t cost, Boolean startup );IMPORT void span_update_bridge_parms( void );/* * UplinkFast/PortFast */IMPORT ulong_t stUplinkFastInit (void);IMPORT ulong_t stPortFastInit (void);IMPORT ulong_t root_port (ulong_t port);IMPORT ulong_t stGetPortFast (ulong_t port);IMPORT ulong_t stSetPortFast (ulong_t port, ulong_t state);IMPORT ulong_t stGetUplinkFast (void);IMPORT ulong_t stSetUplinkFast (ulong_t state);IMPORT int stpPortBitmask( int event, int port );void stShow ();IMPORT Boolean root_bridge( void );IMPORT void root_selection( void );IMPORT void transmit_config(Int port_no);IMPORT void send_config_bpdu(Int port_no, Config_bpdu * bpdu);IMPORT void record_config_timeout_values(Config_bpdu * config);IMPORT void config_bpdu_generation( void );IMPORT void reply(Int port_no);IMPORT void transmit_tcn( void );IMPORT void send_tcn_bpdu(Int port_no, Tcn_bpdu * bpdu);IMPORT void configuration_update( void );IMPORT void designated_port_selection( void );IMPORT void become_designated_port(Int port_no);IMPORT void port_state_selection( void );IMPORT void make_forwarding(Int port_no);IMPORT void make_blocking(Int port_no);IMPORT void set_port_state(Int port_no, State_t state);IMPORT void topology_change_detection( void );IMPORT void topology_change_acknowledged( void );IMPORT void acknowledge_topology_change(Int port_no);IMPORT void hello_timer_expiry( void );IMPORT void message_age_timer_expiry(Int port_no);IMPORT void forward_delay_timer_expiry(Int port_no);IMPORT Boolean designated_for_some_port( void );IMPORT Boolean supersedes_port_info(Int port_no, Config_bpdu * config);IMPORT Boolean designated_port(Int port_no);IMPORT void tcn_timer_expiry( void );IMPORT void topology_change_timer_expiry( void );IMPORT void hold_timer_expiry(Int port_no);IMPORT void span_init( void );IMPORT void initialize_port(Int port_no);IMPORT void set_bridge_priority(Identifier new_bridge_id);IMPORT void enable_change_detection(Int port_no);IMPORT void disable_change_detection(Int port_no);IMPORT void start_hello_timer( void );IMPORT void stop_hello_timer( void );IMPORT void start_tcn_timer( void );IMPORT void stop_tcn_timer( void );IMPORT void start_topology_change_timer( void );IMPORT void stop_topology_change_timer( void );IMPORT void start_message_age_timer(Int port_no, Time_t message_age);IMPORT void stop_message_age_timer(Int port_no);IMPORT void start_forward_delay_timer(Int port_no);IMPORT void stop_forward_delay_timer(Int port_no);IMPORT void start_hold_timer(Int port_no);IMPORT void stop_hold_timer(Int port_no);IMPORT void linkDown_port(Int port_no);IMPORT Boolean hello_timer_expired( void );IMPORT Boolean tcn_timer_expired( void );IMPORT Boolean topology_change_timer_expired( void );IMPORT Boolean message_age_timer_expired(Int port_no);IMPORT Boolean forward_delay_timer_expired(Int port_no);IMPORT Boolean hold_timer_expired(Int port_no);IMPORT ulong_t get_stp_hello_time( void );IMPORT void sysAgentSend1493Trap( ulong_t );IMPORT void span_tick( void );IMPORT STATUS stpInit( char *, void *, void * );IMPORT ulong_t isRootPort( ulong_t port );#ifdef __cplusplus}#endif /* __cplusplus */#endif /* __INCspantreeh */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -