Lines Matching refs:this
32 _stp_stpm_init_machine (STATE_MACH_T* this)
34 this->State = BEGIN;
35 (*(this->concreteEnterState)) (this);
40 _stp_stpm_iterate_machines (STPM_T* this,
49 for (stater = this->machines; stater; stater = stater->next) {
58 for (port = this->ports; port; port = port->next) {
72 _stp_stpm_init_data (STPM_T* this)
74 STP_VECT_create (&this->rootPrio,
75 &this->BrId,
77 &this->BrId,
80 this->BrTimes.MessageAge = 0;
82 STP_copy_times (&this->rootTimes, &this->BrTimes);
86 _check_topoch (STPM_T* this)
90 for (port = this->ports; port; port = port->next) {
101 STPM_T* this = (STPM_T*) param;
105 if (STP_ENABLED != this->admin_state) return;
107 for (port = this->ports; port; port = port->next) {
116 (void) STP_stpm_update (this);
117 this->Topo_Change = _check_topoch (this);
118 if (this->Topo_Change) {
119 this->Topo_Change_Count++;
120 this->timeSince_Topo_Change = 0;
122 this->Topo_Change_Count = 0;
123 this->timeSince_Topo_Change++;
130 STPM_T* this;
132 STP_NEW_IN_LIST(this, STPM_T, bridges, "stp instance");
134 this->admin_state = STP_DISABLED;
136 this->vlan_id = vlan_id;
138 STP_STRDUP(this->name, name, "stp bridge name");
141 this->machines = NULL;
142 this->ports = NULL;
147 /* this->rolesel->debug = 2; */
150 return this;
154 STP_stpm_enable (STPM_T* this, UID_STP_MODE_T admin_state)
158 if (admin_state == this->admin_state) {
164 if (this->ports)
165 rc = STP_stpm_start (this);
166 this->admin_state = admin_state;
168 this->admin_state = admin_state;
169 STP_stpm_stop (this);
176 STP_stpm_delete (STPM_T* this)
184 (void) STP_stpm_enable (this, STP_DISABLED);
186 for (stater = this->machines; stater; ) {
189 this->machines = stater = (STATE_MACH_T*) pv;
192 for (port = this->ports; port; ) {
195 this->ports = port = (PORT_T*) pv;
200 if (tmp->vlan_id == this->vlan_id) {
202 prev->next = this->next;
204 bridges = this->next;
207 if (this->name)
208 STP_FREE(this->name, "stp bridge name");
209 STP_FREE(this, "stp instance");
217 STP_stpm_start (STPM_T* this)
221 if (! this->ports) { /* there are not any ports :( */
225 if (! STP_compute_bridge_id (this)) {/* can't compute bridge id ? :( */
230 if (0 != STP_stpm_check_bridge_priority (this)) {
235 _stp_stpm_init_data (this);
237 for (port = this->ports; port; port = port->next) {
238 STP_port_init (port, this, True);
249 STP_OUT_flush_lt (0, this->vlan_id, LT_FLASH_ONLY_THE_PORT, "start stpm");
252 (void) _stp_stpm_iterate_machines (this, _stp_stpm_init_machine, False);
253 (void) STP_stpm_update (this);
260 STP_stpm_stop (STPM_T* this)
265 STP_stpm_update (STPM_T* this) /* returns number of loops */
273 need_state_change = _stp_stpm_iterate_machines (this,
281 number_of_loops += _stp_stpm_iterate_machines (this,
291 STP_compute_bridge_id (STPM_T* this)
297 for (port = this->ports; port; port = port->next) {
306 STP_OUT_get_port_mac (min_num_port->port_index, this->BrId.addr);
308 return &this->BrId;
318 STP_stpm_update_after_bridge_management (STPM_T* this)
322 for (port = this->ports; port; port = port->next) {
329 STP_stpm_check_bridge_priority (STPM_T* this)
334 if (STP_ENABLED == oth->admin_state && oth != this &&
335 ! STP_VECT_compare_bridge_id (&this->BrId, &oth->BrId)) {
344 STP_stpm_get_port_name_by_id (STPM_T* this, PORT_ID port_id)
348 for (port = this->ports; port; port = port->next) {