rstp.c
Go to the documentation of this file.
1 /**
2  * @file rstp.c
3  * @brief RSTP (Rapid Spanning Tree Protocol)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2019-2026 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneSTP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.6.0
29  **/
30 
31 //Switch to the appropriate trace level
32 #define TRACE_LEVEL RSTP_TRACE_LEVEL
33 
34 //Dependencies
35 #include "rstp/rstp.h"
36 #include "rstp/rstp_mgmt.h"
37 #include "rstp/rstp_fsm.h"
38 #include "rstp/rstp_conditions.h"
39 #include "rstp/rstp_misc.h"
40 #include "debug.h"
41 
42 //Check TCP/IP stack configuration
43 #if (RSTP_SUPPORT == ENABLED)
44 
45 
46 /**
47  * @brief Initialize settings with default values
48  * @param[out] settings Structure that contains RSTP bridge settings
49  **/
50 
52 {
53  //Underlying network interface
54  settings->interface = NULL;
55 
56  //Number of ports
57  settings->numPorts = 0;
58  //Bridge's ports
59  settings->ports = NULL;
60 }
61 
62 
63 /**
64  * @brief Initialize RSTP bridge context
65  * @param[in] context Pointer to the RSTP bridge context
66  * @param[in] settings RSTP bridge specific settings
67  * @return Error code
68  **/
69 
71 {
72  uint_t i;
74 
75  //Debug message
76  TRACE_INFO("Initializing RSTP bridge...\r\n");
77 
78  //Ensure the parameters are valid
79  if(context == NULL || settings == NULL)
81 
82  //The bridge must be bound to a valid interface
83  if(settings->interface == NULL)
85 
86  //Sanity check
87  if(settings->numPorts < 1 || settings->ports == NULL)
89 
90  //Clear RSTP bridge context
91  osMemset(context, 0, sizeof(RstpBridgeContext));
92 
93  //Attach TCP/IP stack context
94  context->netContext = settings->interface->netContext;
95 
96  //Save user settings
97  context->interface = settings->interface;
98  context->bridgeId.addr = settings->interface->macAddr;
99  context->bridgeId.priority = RSTP_DEFAULT_BRIDGE_PRIORITY;
100  context->numPorts = settings->numPorts;
101  context->ports = settings->ports;
102 
103  //Default bridge parameters
104  context->params.forceProtocolVersion = RSTP_PROTOCOL_VERSION;
105  context->params.migrateTime = RSTP_DEFAULT_MIGRATE_TIME;
106  context->params.bridgeMaxAge = RSTP_DEFAULT_BRIDGE_MAX_AGE;
107  context->params.bridgeHelloTime = RSTP_DEFAULT_BRIDGE_HELLO_TIME;
108  context->params.bridgeForwardDelay = RSTP_DEFAULT_BRIDGE_FORWARD_DELAY;
109  context->params.transmitHoldCount = RSTP_DEFAULT_TRANSMIT_HOLD_COUNT;
110  context->params.ageingTime = RSTP_DEFAULT_AGEING_TIME;
111 
112  //Loop through the ports of the bridge
113  for(i = 0; i < context->numPorts; i++)
114  {
115  //Point to the current bridge port
116  port = &context->ports[i];
117 
118  //Attach RSTP bridge context to each port
119  port->context = context;
120 
121  //Set port index
122  port->portIndex = i + 1;
123  //Default port identifier
124  port->portId = (RSTP_DEFAULT_PORT_PRIORITY << 8) | port->portIndex;
125 
126  //Each port must assigned a unique MAC address
128 
129  //Default port parameters
130  port->params.adminPortState = FALSE;
131  port->params.adminPathCost = RSTP_DEFAULT_PORT_PATH_COST;
132  port->params.adminPointToPointMac = RSTP_ADMIN_P2P_MAC_FORCE_TRUE;
133  port->params.adminEdgePort = FALSE;
134  port->params.autoEdgePort = TRUE;
135 
136  //Default operation mode
137  port->macOperState = FALSE;
138  port->linkSpeed = NIC_LINK_SPEED_UNKNOWN;
139  port->duplexMode = NIC_UNKNOWN_DUPLEX_MODE;
140 
141  //The portEnabled variable is set if the MAC entity can transmit and
142  //receive frames to and from the attached LAN
143  port->portEnabled = port->macOperState && port->params.adminPortState;
144 
145  //Recalculate the contribution of the port to the root path cost
147 
148  //The MAC is considered to be connected to a point-to-point LAN if the
149  //MAC entity is configured for full duplex operation
151  }
152 
153  //Get exclusive access
154  rstpLock(context);
155  //Initialize RSTP state machine
156  rstpFsmInit(context);
157  //Release exclusive access
158  rstpUnlock(context);
159 
160  //Successful initialization
161  return NO_ERROR;
162 }
163 
164 
165 /**
166  * @brief Start RSTP bridge operation
167  * @param[in] context Pointer to the RSTP bridge context
168  * @return Error code
169  **/
170 
172 {
173  error_t error;
174  NetInterface *interface;
175 
176  //Make sure the RSTP bridge context is valid
177  if(context == NULL)
179 
180  //Debug message
181  TRACE_INFO("Starting RSTP bridge...\r\n");
182 
183  //Get exclusive access
184  rstpLock(context);
185 
186  //Check RSTP bridge operation state
187  if(!context->running)
188  {
189  //Point to the underlying network interface
190  interface = context->interface;
191 
192  //Start of exception handling block
193  do
194  {
195  //The Bridge Group Address is used as destination MAC address to
196  //carry BPDUs between STP entities
197  error = ethAcceptMacAddr(interface, &RSTP_BRIDGE_GROUP_ADDR);
198  //Any error to report?
199  if(error)
200  break;
201 
202  //Configure the permanent database
203  error = rstpConfigurePermanentDatabase(context);
204  //Any error to report?
205  if(error)
206  break;
207 
208  //Register a callback to process incoming LLC frames
209  error = ethAttachLlcRxCallback(interface, rstpProcessLlcFrame,
210  context);
211  //Any error to report?
212  if(error)
213  break;
214 
215  //Register timer callback
216  error = netAttachTimerCallback(context->netContext, RSTP_TICK_INTERVAL,
217  (NetTimerCallback) rstpTick, context);
218  //Any error to report?
219  if(error)
220  break;
221 
222  //The RSTP bridge is now running
223  context->running = TRUE;
224  //Reinitialize RSTP state machine
225  rstpFsmInit(context);
226 
227  //End of exception handling block
228  } while(0);
229 
230  //Check status code
231  if(error)
232  {
233  //Clean up side effects
236 
237  //Unregister LLC receive callback function
238  ethDetachLlcRxCallback(interface);
239 
240  //Unregister timer callback
241  netDetachTimerCallback(context->netContext,
242  (NetTimerCallback) rstpTick, context);
243  }
244  }
245  else
246  {
247  //The RSTP bridge is already running
248  error = ERROR_ALREADY_RUNNING;
249  }
250 
251  //Release exclusive access
252  rstpUnlock(context);
253 
254  //Return status code
255  return error;
256 }
257 
258 
259 /**
260  * @brief Stop RSTP bridge operation
261  * @param[in] context Pointer to the RSTP bridge context
262  * @return Error code
263  **/
264 
266 {
267  uint_t i;
268  NetInterface *interface;
269 
270  //Make sure the RSTP bridge context is valid
271  if(context == NULL)
273 
274  //Debug message
275  TRACE_INFO("Stopping RSTP bridge...\r\n");
276 
277  //Get exclusive access
278  rstpLock(context);
279 
280  //Check RSTP bridge operation state
281  if(context->running)
282  {
283  //Point to the underlying network interface
284  interface = context->interface;
285 
286  //Remove the Bridge Group Address from the MAC filter table
288  //Unconfigure the permanent database
290 
291  //Unregister LLC receive callback function
292  ethDetachLlcRxCallback(interface);
293 
294  //Unregister timer callback
295  netDetachTimerCallback(context->netContext, (NetTimerCallback) rstpTick,
296  context);
297 
298  //Restore default ageing time
300 
301  //Loop through the ports of the bridge
302  for(i = 0; i < context->numPorts; i++)
303  {
304  //Restore default port state
306  }
307 
308  //The RSTP bridge is not running anymore
309  context->running = FALSE;
310  }
311 
312  //Release exclusive access
313  rstpUnlock(context);
314 
315  //Successful processing
316  return NO_ERROR;
317 }
318 
319 
320 /**
321  * @brief Set protocol version
322  * @param[in] context Pointer to the RSTP bridge context
323  * @param[in] value Protocol version
324  * @return Error code
325  **/
326 
328 {
329  error_t error;
330 
331  //Make sure the RSTP bridge context is valid
332  if(context != NULL)
333  {
334  //Acquire exclusive access to the RSTP bridge context
335  rstpLock(context);
336  //Perform management operation
337  error = rstpMgmtSetVersion(context, value, TRUE);
338  //Release exclusive access to the RSTP bridge context
339  rstpUnlock(context);
340  }
341  else
342  {
343  //Report an error
344  error = ERROR_INVALID_PARAMETER;
345  }
346 
347  //Return status code
348  return error;
349 }
350 
351 
352 /**
353  * @brief Set bridge priority
354  * @param[in] context Pointer to the RSTP bridge context
355  * @param[in] value Bridge priority
356  * @return Error code
357  **/
358 
360 {
361  error_t error;
362 
363  //Make sure the RSTP bridge context is valid
364  if(context != NULL)
365  {
366  //Acquire exclusive access to the RSTP bridge context
367  rstpLock(context);
368  //Perform management operation
369  error = rstpMgmtSetBridgePriority(context, value, TRUE);
370  //Release exclusive access to the RSTP bridge context
371  rstpUnlock(context);
372  }
373  else
374  {
375  //Report an error
376  error = ERROR_INVALID_PARAMETER;
377  }
378 
379  //Return status code
380  return error;
381 }
382 
383 
384 /**
385  * @brief Set Bridge Max Age parameter
386  * @param[in] context Pointer to the RSTP bridge context
387  * @param[in] value Value of the Bridge Max Age parameter, in seconds
388  * @return Error code
389  **/
390 
392 {
393  error_t error;
394 
395  //Make sure the RSTP bridge context is valid
396  if(context != NULL)
397  {
398  //Acquire exclusive access to the RSTP bridge context
399  rstpLock(context);
400  //Perform management operation
401  error = rstpMgmtSetBridgeMaxAge(context, value, TRUE);
402  //Release exclusive access to the RSTP bridge context
403  rstpUnlock(context);
404  }
405  else
406  {
407  //Report an error
408  error = ERROR_INVALID_PARAMETER;
409  }
410 
411  //Return status code
412  return error;
413 }
414 
415 
416 /**
417  * @brief Set Bridge Hello Time parameter
418  * @param[in] context Pointer to the RSTP bridge context
419  * @param[in] value Value of the Bridge Hello Time parameter, in seconds
420  * @return Error code
421  **/
422 
424 {
425  error_t error;
426 
427  //Make sure the RSTP bridge context is valid
428  if(context != NULL)
429  {
430  //Acquire exclusive access to the RSTP bridge context
431  rstpLock(context);
432  //Perform management operation
433  error = rstpMgmtSetBridgeHelloTime(context, value, TRUE);
434  //Release exclusive access to the RSTP bridge context
435  rstpUnlock(context);
436  }
437  else
438  {
439  //Report an error
440  error = ERROR_INVALID_PARAMETER;
441  }
442 
443  //Return status code
444  return error;
445 }
446 
447 
448 /**
449  * @brief Set Bridge Forward Delay parameter
450  * @param[in] context Pointer to the RSTP bridge context
451  * @param[in] value Value of the Bridge Forward Delay parameter, in seconds
452  * @return Error code
453  **/
454 
456 {
457  error_t error;
458 
459  //Make sure the RSTP bridge context is valid
460  if(context != NULL)
461  {
462  //Acquire exclusive access to the RSTP bridge context
463  rstpLock(context);
464  //Perform management operation
465  error = rstpMgmtSetBridgeForwardDelay(context, value, TRUE);
466  //Release exclusive access to the RSTP bridge context
467  rstpUnlock(context);
468  }
469  else
470  {
471  //Report an error
472  error = ERROR_INVALID_PARAMETER;
473  }
474 
475  //Return status code
476  return error;
477 }
478 
479 
480 /**
481  * @brief Set Transmit Hold Count parameter
482  * @param[in] context Pointer to the RSTP bridge context
483  * @param[in] value Value of the Transmit Hold Count parameter
484  * @return Error code
485  **/
486 
488 {
489  error_t error;
490 
491  //Make sure the RSTP bridge context is valid
492  if(context != NULL)
493  {
494  //Acquire exclusive access to the RSTP bridge context
495  rstpLock(context);
496  //Perform management operation
497  error = rstpMgmtSetTxHoldCount(context, value, TRUE);
498  //Release exclusive access to the RSTP bridge context
499  rstpUnlock(context);
500  }
501  else
502  {
503  //Report an error
504  error = ERROR_INVALID_PARAMETER;
505  }
506 
507  //Return status code
508  return error;
509 }
510 
511 
512 /**
513  * @brief Set Ageing Time parameter
514  * @param[in] context Pointer to the RSTP bridge context
515  * @param[in] value Value of the Ageing Time parameter
516  * @return Error code
517  **/
518 
520 {
521  error_t error;
522 
523  //Make sure the RSTP bridge context is valid
524  if(context != NULL)
525  {
526  //Acquire exclusive access to the RSTP bridge context
527  rstpLock(context);
528  //Perform management operation
529  error = rstpMgmtSetAgeingTime(context, value, TRUE);
530  //Release exclusive access to the RSTP bridge context
531  rstpUnlock(context);
532  }
533  else
534  {
535  //Report an error
536  error = ERROR_INVALID_PARAMETER;
537  }
538 
539  //Return status code
540  return error;
541 }
542 
543 
544 /**
545  * @brief Get the number of ports
546  * @param[in] context Pointer to the RSTP bridge context
547  * @param[out] value Number of ports
548  * @return Error code
549  **/
550 
552 {
553  error_t error;
554 
555  //Make sure the RSTP bridge context is valid
556  if(context != NULL)
557  {
558  //Acquire exclusive access to the RSTP bridge context
559  rstpLock(context);
560  //Perform management operation
561  error = rstpMgmtGetNumPorts(context, value);
562  //Release exclusive access to the RSTP bridge context
563  rstpUnlock(context);
564  }
565  else
566  {
567  //Report an error
568  error = ERROR_INVALID_PARAMETER;
569  }
570 
571  //Return status code
572  return error;
573 }
574 
575 
576 /**
577  * @brief Get assigned protocol version
578  * @param[in] context Pointer to the RSTP bridge context
579  * @param[out] value Protocol version
580  * @return Error code
581  **/
582 
584 {
585  error_t error;
586 
587  //Make sure the RSTP bridge context is valid
588  if(context != NULL)
589  {
590  //Acquire exclusive access to the RSTP bridge context
591  rstpLock(context);
592  //Perform management operation
593  error = rstpMgmtGetVersion(context, value);
594  //Release exclusive access to the RSTP bridge context
595  rstpUnlock(context);
596  }
597  else
598  {
599  //Report an error
600  error = ERROR_INVALID_PARAMETER;
601  }
602 
603  //Return status code
604  return error;
605 }
606 
607 
608 /**
609  * @brief Get the MAC address assigned to the bridge
610  * @param[in] context Pointer to the RSTP bridge context
611  * @param[out] value MAC address of the bridge
612  * @return Error code
613  **/
614 
616 {
617  error_t error;
618 
619  //Make sure the RSTP bridge context is valid
620  if(context != NULL)
621  {
622  //Acquire exclusive access to the RSTP bridge context
623  rstpLock(context);
624  //Perform management operation
625  error = rstpMgmtGetBridgeAddr(context, value);
626  //Release exclusive access to the RSTP bridge context
627  rstpUnlock(context);
628  }
629  else
630  {
631  //Report an error
632  error = ERROR_INVALID_PARAMETER;
633  }
634 
635  //Return status code
636  return error;
637 }
638 
639 
640 /**
641  * @brief Get the assigned bridge priority
642  * @param[in] context Pointer to the RSTP bridge context
643  * @param[out] value Bridge priority
644  * @return Error code
645  **/
646 
648 {
649  error_t error;
650 
651  //Make sure the RSTP bridge context is valid
652  if(context != NULL)
653  {
654  //Acquire exclusive access to the RSTP bridge context
655  rstpLock(context);
656  //Perform management operation
657  error = rstpMgmtGetBridgePriority(context, value);
658  //Release exclusive access to the RSTP bridge context
659  rstpUnlock(context);
660  }
661  else
662  {
663  //Report an error
664  error = ERROR_INVALID_PARAMETER;
665  }
666 
667  //Return status code
668  return error;
669 }
670 
671 
672 /**
673  * @brief Get the assigned value of the Bridge Max Age parameter
674  * @param[in] context Pointer to the RSTP bridge context
675  * @param[out] value Value of the Bridge Max Age parameter, in seconds
676  * @return Error code
677  **/
678 
680 {
681  error_t error;
682 
683  //Make sure the RSTP bridge context is valid
684  if(context != NULL)
685  {
686  //Acquire exclusive access to the RSTP bridge context
687  rstpLock(context);
688  //Perform management operation
689  error = rstpMgmtGetBridgeMaxAge(context, value);
690  //Release exclusive access to the RSTP bridge context
691  rstpUnlock(context);
692  }
693  else
694  {
695  //Report an error
696  error = ERROR_INVALID_PARAMETER;
697  }
698 
699  //Return status code
700  return error;
701 }
702 
703 
704 /**
705  * @brief Get the assigned value of the Bridge Hello Time parameter
706  * @param[in] context Pointer to the RSTP bridge context
707  * @param[out] value Value of the Bridge Hello Time parameter, in seconds
708  * @return Error code
709  **/
710 
712 {
713  error_t error;
714 
715  //Make sure the RSTP bridge context is valid
716  if(context != NULL)
717  {
718  //Acquire exclusive access to the RSTP bridge context
719  rstpLock(context);
720  //Perform management operation
721  error = rstpMgmtGetBridgeHelloTime(context, value);
722  //Release exclusive access to the RSTP bridge context
723  rstpUnlock(context);
724  }
725  else
726  {
727  //Report an error
728  error = ERROR_INVALID_PARAMETER;
729  }
730 
731  //Return status code
732  return error;
733 }
734 
735 
736 /**
737  * @brief Get the assigned value of the Bridge Forward Delay parameter
738  * @param[in] context Pointer to the RSTP bridge context
739  * @param[out] value Value of the Bridge Forward Delay parameter, in seconds
740  * @return Error code
741  **/
742 
744 {
745  error_t error;
746 
747  //Make sure the RSTP bridge context is valid
748  if(context != NULL)
749  {
750  //Acquire exclusive access to the RSTP bridge context
751  rstpLock(context);
752  //Perform management operation
753  error = rstpMgmtGetBridgeForwardDelay(context, value);
754  //Release exclusive access to the RSTP bridge context
755  rstpUnlock(context);
756  }
757  else
758  {
759  //Report an error
760  error = ERROR_INVALID_PARAMETER;
761  }
762 
763  //Return status code
764  return error;
765 }
766 
767 
768 /**
769  * @brief Get the assigned value of the Transmit Hold Count parameter
770  * @param[in] context Pointer to the RSTP bridge context
771  * @param[out] value Value of the Transmit Hold Count parameter
772  * @return Error code
773  **/
774 
776 {
777  error_t error;
778 
779  //Make sure the RSTP bridge context is valid
780  if(context != NULL)
781  {
782  //Acquire exclusive access to the RSTP bridge context
783  rstpLock(context);
784  //Perform management operation
785  error = rstpMgmtGetTxHoldCount(context, value);
786  //Release exclusive access to the RSTP bridge context
787  rstpUnlock(context);
788  }
789  else
790  {
791  //Report an error
792  error = ERROR_INVALID_PARAMETER;
793  }
794 
795  //Return status code
796  return error;
797 }
798 
799 
800 /**
801  * @brief Get the assigned value of the Ageing Time parameter
802  * @param[in] context Pointer to the RSTP bridge context
803  * @param[out] value Value of the Ageing Time parameter
804  * @return Error code
805  **/
806 
808 {
809  error_t error;
810 
811  //Make sure the RSTP bridge context is valid
812  if(context != NULL)
813  {
814  //Acquire exclusive access to the RSTP bridge context
815  rstpLock(context);
816  //Perform management operation
817  error = rstpMgmtGetAgeingTime(context, value);
818  //Release exclusive access to the RSTP bridge context
819  rstpUnlock(context);
820  }
821  else
822  {
823  //Report an error
824  error = ERROR_INVALID_PARAMETER;
825  }
826 
827  //Return status code
828  return error;
829 }
830 
831 
832 /**
833  * @brief Get the bridge identifier of the root of the spanning tree
834  * @param[in] context Pointer to the RSTP bridge context
835  * @param[out] value Bridge identifier
836  * @return Error code
837  **/
838 
840 {
841  error_t error;
842 
843  //Make sure the RSTP bridge context is valid
844  if(context != NULL)
845  {
846  //Acquire exclusive access to the RSTP bridge context
847  rstpLock(context);
848  //Perform management operation
849  error = rstpMgmtGetDesignatedRoot(context, value);
850  //Release exclusive access to the RSTP bridge context
851  rstpUnlock(context);
852  }
853  else
854  {
855  //Report an error
856  error = ERROR_INVALID_PARAMETER;
857  }
858 
859  //Return status code
860  return error;
861 }
862 
863 
864 /**
865  * @brief Get the current cost of the path to the root
866  * @param[in] context Pointer to the RSTP bridge context
867  * @param[out] value Root path cost
868  * @return Error code
869  **/
870 
872 {
873  error_t error;
874 
875  //Make sure the RSTP bridge context is valid
876  if(context != NULL)
877  {
878  //Acquire exclusive access to the RSTP bridge context
879  rstpLock(context);
880  //Perform management operation
881  error = rstpMgmtGetRootPathCost(context, value);
882  //Release exclusive access to the RSTP bridge context
883  rstpUnlock(context);
884  }
885  else
886  {
887  //Report an error
888  error = ERROR_INVALID_PARAMETER;
889  }
890 
891  //Return status code
892  return error;
893 }
894 
895 
896 /**
897  * @brief Get the current root port
898  * @param[in] context Pointer to the RSTP bridge context
899  * @param[out] value Port number
900  * @return Error code
901  **/
902 
904 {
905  error_t error;
906 
907  //Make sure the RSTP bridge context is valid
908  if(context != NULL)
909  {
910  //Acquire exclusive access to the RSTP bridge context
911  rstpLock(context);
912  //Perform management operation
913  error = rstpMgmtGetRootPort(context, value);
914  //Release exclusive access to the RSTP bridge context
915  rstpUnlock(context);
916  }
917  else
918  {
919  //Report an error
920  error = ERROR_INVALID_PARAMETER;
921  }
922 
923  //Return status code
924  return error;
925 }
926 
927 
928 /**
929  * @brief Get the current Max Age value
930  * @param[in] context Pointer to the RSTP bridge context
931  * @param[out] value Max Age value, in seconds
932  * @return Error code
933  **/
934 
936 {
937  error_t error;
938 
939  //Make sure the RSTP bridge context is valid
940  if(context != NULL)
941  {
942  //Acquire exclusive access to the RSTP bridge context
943  rstpLock(context);
944  //Perform management operation
945  error = rstpMgmtGetMaxAge(context, value);
946  //Release exclusive access to the RSTP bridge context
947  rstpUnlock(context);
948  }
949  else
950  {
951  //Report an error
952  error = ERROR_INVALID_PARAMETER;
953  }
954 
955  //Return status code
956  return error;
957 }
958 
959 
960 /**
961  * @brief Get the current Hello Time value
962  * @param[in] context Pointer to the RSTP bridge context
963  * @param[out] value Hello Time value, in seconds
964  * @return Error code
965  **/
966 
968 {
969  error_t error;
970 
971  //Make sure the RSTP bridge context is valid
972  if(context != NULL)
973  {
974  //Acquire exclusive access to the RSTP bridge context
975  rstpLock(context);
976  //Perform management operation
977  error = rstpMgmtGetHelloTime(context, value);
978  //Release exclusive access to the RSTP bridge context
979  rstpUnlock(context);
980  }
981  else
982  {
983  //Report an error
984  error = ERROR_INVALID_PARAMETER;
985  }
986 
987  //Return status code
988  return error;
989 }
990 
991 
992 /**
993  * @brief Get the current Forward Delay value
994  * @param[in] context Pointer to the RSTP bridge context
995  * @param[out] value Forward Delay value, in seconds
996  * @return Error code
997  **/
999 {
1000  error_t error;
1001 
1002  //Make sure the RSTP bridge context is valid
1003  if(context != NULL)
1004  {
1005  //Acquire exclusive access to the RSTP bridge context
1006  rstpLock(context);
1007  //Perform management operation
1008  error = rstpMgmtGetForwardDelay(context, value);
1009  //Release exclusive access to the RSTP bridge context
1010  rstpUnlock(context);
1011  }
1012  else
1013  {
1014  //Report an error
1015  error = ERROR_INVALID_PARAMETER;
1016  }
1017 
1018  //Return status code
1019  return error;
1020 }
1021 
1022 
1023 /**
1024  * @brief Get the number of topology changes
1025  * @param[in] context Pointer to the RSTP bridge context
1026  * @param[out] value Number of topology changes
1027  * @return Error code
1028  **/
1029 
1031 {
1032  error_t error;
1033 
1034  //Make sure the RSTP bridge context is valid
1035  if(context != NULL)
1036  {
1037  //Acquire exclusive access to the RSTP bridge context
1038  rstpLock(context);
1039  //Perform management operation
1040  error = rstpMgmtGetTopologyChanges(context, value);
1041  //Release exclusive access to the RSTP bridge context
1042  rstpUnlock(context);
1043  }
1044  else
1045  {
1046  //Report an error
1047  error = ERROR_INVALID_PARAMETER;
1048  }
1049 
1050  //Return status code
1051  return error;
1052 }
1053 
1054 
1055 /**
1056  * @brief Get the time since a topology change was last detected
1057  * @param[in] context Pointer to the RSTP bridge context
1058  * @param[out] value Time since a topology change was last detected
1059  * @return Error code
1060  **/
1061 
1063  uint_t *value)
1064 {
1065  error_t error;
1066 
1067  //Make sure the RSTP bridge context is valid
1068  if(context != NULL)
1069  {
1070  //Acquire exclusive access to the RSTP bridge context
1071  rstpLock(context);
1072  //Perform management operation
1073  error = rstpMgmtGetTimeSinceTopologyChange(context, value);
1074  //Release exclusive access to the RSTP bridge context
1075  rstpUnlock(context);
1076  }
1077  else
1078  {
1079  //Report an error
1080  error = ERROR_INVALID_PARAMETER;
1081  }
1082 
1083  //Return status code
1084  return error;
1085 }
1086 
1087 
1088 /**
1089  * @brief Set port number
1090  * @param[in] context Pointer to the RSTP bridge context
1091  * @param[in] portIndex Port index
1092  * @param[in] value Port number
1093  * @return Error code
1094  **/
1095 
1097  uint16_t value)
1098 {
1099  error_t error;
1101 
1102  //Initialize status code
1103  error = NO_ERROR;
1104 
1105  //Make sure the RSTP bridge context is valid
1106  if(context != NULL)
1107  {
1108  //Acquire exclusive access to the RSTP bridge context
1109  rstpLock(context);
1110 
1111  //Valid port index?
1112  if(portIndex >= 1 && portIndex <= context->numPorts)
1113  {
1114  //Point to the port that matches the specified port index
1115  port = &context->ports[portIndex - 1];
1116 
1117  //Check the value of the parameter
1118  if(value <= 4095)
1119  {
1120  //The port identifier is updated using the supplied value
1121  port->portId = (port->portId & RSTP_PORT_PRIORITY_MASK) | value;
1122  }
1123  else
1124  {
1125  //The parameter value is not valid
1126  error = ERROR_INVALID_VALUE;
1127  }
1128  }
1129  else
1130  {
1131  //The port index is out of range
1132  error = ERROR_INVALID_PORT;
1133  }
1134 
1135  //Release exclusive access to the RSTP bridge context
1136  rstpUnlock(context);
1137  }
1138  else
1139  {
1140  //Report an error
1141  error = ERROR_INVALID_PARAMETER;
1142  }
1143 
1144  //Return status code
1145  return error;
1146 }
1147 
1148 
1149 /**
1150  * @brief Set port address
1151  * @param[in] context Pointer to the RSTP bridge context
1152  * @param[in] portIndex Port index
1153  * @param[in] value MAC address of the individual MAC entity for the port
1154  * @return Error code
1155  **/
1156 
1158  const MacAddr *value)
1159 {
1160  error_t error;
1162 
1163  //Initialize status code
1164  error = NO_ERROR;
1165 
1166  //Make sure the RSTP bridge context is valid
1167  if(context != NULL)
1168  {
1169  //Acquire exclusive access to the RSTP bridge context
1170  rstpLock(context);
1171 
1172  //Valid port index?
1173  if(portIndex >= 1 && portIndex <= context->numPorts)
1174  {
1175  //Point to the port that matches the specified port index
1176  port = &context->ports[portIndex - 1];
1177  //Set the MAC address of the individual MAC entity for the port
1178  port->macAddr = *value;
1179  }
1180  else
1181  {
1182  //The port index is out of range
1183  error = ERROR_INVALID_PORT;
1184  }
1185 
1186  //Release exclusive access to the RSTP bridge context
1187  rstpUnlock(context);
1188  }
1189  else
1190  {
1191  //Report an error
1192  error = ERROR_INVALID_PARAMETER;
1193  }
1194 
1195  //Return status code
1196  return error;
1197 }
1198 
1199 
1200 /**
1201  * @brief Set port priority
1202  * @param[in] context Pointer to the RSTP bridge context
1203  * @param[in] portIndex Port index
1204  * @param[in] value Port priority
1205  * @return Error code
1206  **/
1207 
1209  uint8_t value)
1210 {
1211  error_t error;
1212 
1213  //Make sure the RSTP bridge context is valid
1214  if(context != NULL)
1215  {
1216  //Acquire exclusive access to the RSTP bridge context
1217  rstpLock(context);
1218  //Perform management operation
1219  error = rstpMgmtSetPortPriority(context, portIndex, value, TRUE);
1220  //Release exclusive access to the RSTP bridge context
1221  rstpUnlock(context);
1222  }
1223  else
1224  {
1225  //Report an error
1226  error = ERROR_INVALID_PARAMETER;
1227  }
1228 
1229  //Return status code
1230  return error;
1231 }
1232 
1233 
1234 /**
1235  * @brief Set administrative bridge port state
1236  * @param[in] context Pointer to the RSTP bridge context
1237  * @param[in] portIndex Port index
1238  * @param[in] value Administrative bridge port state
1239  * @return Error code
1240  **/
1241 
1243  bool_t value)
1244 {
1245  error_t error;
1246 
1247  //Make sure the RSTP bridge context is valid
1248  if(context != NULL)
1249  {
1250  //Acquire exclusive access to the RSTP bridge context
1251  rstpLock(context);
1252  //Perform management operation
1253  error = rstpMgmtSetAdminPortState(context, portIndex, value, TRUE);
1254  //Release exclusive access to the RSTP bridge context
1255  rstpUnlock(context);
1256  }
1257  else
1258  {
1259  //Report an error
1260  error = ERROR_INVALID_PARAMETER;
1261  }
1262 
1263  //Return status code
1264  return error;
1265 }
1266 
1267 
1268 /**
1269  * @brief Set administrative port path cost
1270  * @param[in] context Pointer to the RSTP bridge context
1271  * @param[in] portIndex Port index
1272  * @param[in] value Administrative port path cost
1273  * @return Error code
1274  **/
1275 
1277  uint32_t value)
1278 {
1279  error_t error;
1280 
1281  //Make sure the RSTP bridge context is valid
1282  if(context != NULL)
1283  {
1284  //Acquire exclusive access to the RSTP bridge context
1285  rstpLock(context);
1286  //Perform management operation
1287  error = rstpMgmtSetAdminPortPathCost(context, portIndex, value, TRUE);
1288  //Release exclusive access to the RSTP bridge context
1289  rstpUnlock(context);
1290  }
1291  else
1292  {
1293  //Report an error
1294  error = ERROR_INVALID_PARAMETER;
1295  }
1296 
1297  //Return status code
1298  return error;
1299 }
1300 
1301 
1302 /**
1303  * @brief Set administrative point-to-point status of the LAN segment
1304  * @param[in] context Pointer to the RSTP bridge context
1305  * @param[in] portIndex Port index
1306  * @param[in] value Administrative point-to-point status of the LAN segment
1307  * attached to this port
1308  * @return Error code
1309  **/
1310 
1313 {
1314  error_t error;
1315 
1316  //Make sure the RSTP bridge context is valid
1317  if(context != NULL)
1318  {
1319  //Acquire exclusive access to the RSTP bridge context
1320  rstpLock(context);
1321  //Perform management operation
1322  error = rstpMgmtSetAdminPointToPointMac(context, portIndex, value, TRUE);
1323  //Release exclusive access to the RSTP bridge context
1324  rstpUnlock(context);
1325  }
1326  else
1327  {
1328  //Report an error
1329  error = ERROR_INVALID_PARAMETER;
1330  }
1331 
1332  //Return status code
1333  return error;
1334 }
1335 
1336 
1337 /**
1338  * @brief Set administrative value of the Edge Port parameter
1339  * @param[in] context Pointer to the RSTP bridge context
1340  * @param[in] portIndex Port index
1341  * @param[in] value Administrative value of the Edge Port parameter
1342  * @return Error code
1343  **/
1344 
1346  bool_t value)
1347 {
1348  error_t error;
1349 
1350  //Make sure the RSTP bridge context is valid
1351  if(context != NULL)
1352  {
1353  //Acquire exclusive access to the RSTP bridge context
1354  rstpLock(context);
1355  //Perform management operation
1356  error = rstpMgmtSetAdminEdgePort(context, portIndex, value, TRUE);
1357  //Release exclusive access to the RSTP bridge context
1358  rstpUnlock(context);
1359  }
1360  else
1361  {
1362  //Report an error
1363  error = ERROR_INVALID_PARAMETER;
1364  }
1365 
1366  //Return status code
1367  return error;
1368 }
1369 
1370 /**
1371  * @brief Set AutoEdgePort parameter
1372  * @param[in] context Pointer to the RSTP bridge context
1373  * @param[in] portIndex Port index
1374  * @param[in] value AutoEdgePort parameter for the port
1375  * @return Error code
1376  **/
1377 
1379  bool_t value)
1380 {
1381  error_t error;
1382 
1383  //Make sure the RSTP bridge context is valid
1384  if(context != NULL)
1385  {
1386  //Acquire exclusive access to the RSTP bridge context
1387  rstpLock(context);
1388  //Perform management operation
1389  error = rstpMgmtSetAutoEdgePort(context, portIndex, value, TRUE);
1390  //Release exclusive access to the RSTP bridge context
1391  rstpUnlock(context);
1392  }
1393  else
1394  {
1395  //Report an error
1396  error = ERROR_INVALID_PARAMETER;
1397  }
1398 
1399  //Return status code
1400  return error;
1401 }
1402 
1403 
1404 /**
1405  * @brief Force protocol migration
1406  * @param[in] context Pointer to the RSTP bridge context
1407  * @param[in] portIndex Port index
1408  * @param[in] value Value of the mcheck parameter. Setting mcheck variable to
1409  * FALSE has no effect
1410  * @return Error code
1411  **/
1412 
1414  bool_t value)
1415 {
1416  error_t error;
1417 
1418  //Make sure the RSTP bridge context is valid
1419  if(context != NULL)
1420  {
1421  //Acquire exclusive access to the RSTP bridge context
1422  rstpLock(context);
1423  //Perform management operation
1424  error = rstpMgmtSetProtocolMigration(context, portIndex, value, TRUE);
1425  //Release exclusive access to the RSTP bridge context
1426  rstpUnlock(context);
1427  }
1428  else
1429  {
1430  //Report an error
1431  error = ERROR_INVALID_PARAMETER;
1432  }
1433 
1434  //Return status code
1435  return error;
1436 }
1437 
1438 
1439 /**
1440  * @brief Get the port number assigned to the port
1441  * @param[in] context Pointer to the RSTP bridge context
1442  * @param[in] portIndex Port index
1443  * @param[out] value Port number
1444  * @return Error code
1445  **/
1446 
1448  uint16_t *value)
1449 {
1450  error_t error;
1452 
1453  //Make sure the RSTP bridge context is valid
1454  if(context != NULL)
1455  {
1456  //Acquire exclusive access to the RSTP bridge context
1457  rstpLock(context);
1458 
1459  //Valid port index?
1460  if(portIndex >= 1 && portIndex <= context->numPorts)
1461  {
1462  //Point to the port that matches the specified port index
1463  port = &context->ports[portIndex - 1];
1464  //Retrieve the assigned port number
1465  *value = port->portId & RSTP_PORT_NUM_MASK;
1466  }
1467  else
1468  {
1469  //The port index is out of range
1470  error = ERROR_INVALID_PORT;
1471  }
1472 
1473  //Release exclusive access to the RSTP bridge context
1474  rstpUnlock(context);
1475  }
1476  else
1477  {
1478  //Report an error
1479  error = ERROR_INVALID_PARAMETER;
1480  }
1481 
1482  //Return status code
1483  return error;
1484 }
1485 
1486 
1487 /**
1488  * @brief Get the MAC address assigned to the port
1489  * @param[in] context Pointer to the RSTP bridge context
1490  * @param[in] portIndex Port index
1491  * @param[out] value MAC address of the individual MAC entity for the port
1492  * @return Error code
1493  **/
1494 
1496  MacAddr *value)
1497 {
1498  error_t error;
1499 
1500  //Make sure the RSTP bridge context is valid
1501  if(context != NULL)
1502  {
1503  //Acquire exclusive access to the RSTP bridge context
1504  rstpLock(context);
1505  //Perform management operation
1506  error = rstpMgmtGetPortAddr(context, portIndex, value);
1507  //Release exclusive access to the RSTP bridge context
1508  rstpUnlock(context);
1509  }
1510  else
1511  {
1512  //Report an error
1513  error = ERROR_INVALID_PARAMETER;
1514  }
1515 
1516  //Return status code
1517  return error;
1518 }
1519 
1520 
1521 /**
1522  * @brief Get the priority assigned to the port
1523  * @param[in] context Pointer to the RSTP bridge context
1524  * @param[in] portIndex Port index
1525  * @param[out] value Port priority
1526  * @return Error code
1527  **/
1528 
1530  uint8_t *value)
1531 {
1532  error_t error;
1533 
1534  //Make sure the RSTP bridge context is valid
1535  if(context != NULL)
1536  {
1537  //Acquire exclusive access to the RSTP bridge context
1538  rstpLock(context);
1539  //Perform management operation
1540  error = rstpMgmtGetPortPriority(context, portIndex, value);
1541  //Release exclusive access to the RSTP bridge context
1542  rstpUnlock(context);
1543  }
1544  else
1545  {
1546  //Report an error
1547  error = ERROR_INVALID_PARAMETER;
1548  }
1549 
1550  //Return status code
1551  return error;
1552 }
1553 
1554 
1555 /**
1556  * @brief Get the administrative port state
1557  * @param[in] context Pointer to the RSTP bridge context
1558  * @param[in] portIndex Port index
1559  * @param[out] value Administrative port state
1560  * @return Error code
1561  **/
1562 
1564  bool_t *value)
1565 {
1566  error_t error;
1567 
1568  //Make sure the RSTP bridge context is valid
1569  if(context != NULL)
1570  {
1571  //Acquire exclusive access to the RSTP bridge context
1572  rstpLock(context);
1573  //Perform management operation
1574  error = rstpMgmtGetAdminPortState(context, portIndex, value);
1575  //Release exclusive access to the RSTP bridge context
1576  rstpUnlock(context);
1577  }
1578  else
1579  {
1580  //Report an error
1581  error = ERROR_INVALID_PARAMETER;
1582  }
1583 
1584  //Return status code
1585  return error;
1586 }
1587 
1588 
1589 /**
1590  * @brief Get the current MAC operational state
1591  * @param[in] context Pointer to the RSTP bridge context
1592  * @param[in] portIndex Port index
1593  * @param[out] value MAC operational state
1594  * @return Error code
1595  **/
1596 
1598  bool_t *value)
1599 {
1600  error_t error;
1601 
1602  //Make sure the RSTP bridge context is valid
1603  if(context != NULL)
1604  {
1605  //Acquire exclusive access to the RSTP bridge context
1606  rstpLock(context);
1607  //Perform management operation
1608  error = rstpMgmtGetMacOperState(context, portIndex, value);
1609  //Release exclusive access to the RSTP bridge context
1610  rstpUnlock(context);
1611  }
1612  else
1613  {
1614  //Report an error
1615  error = ERROR_INVALID_PARAMETER;
1616  }
1617 
1618  //Return status code
1619  return error;
1620 }
1621 
1622 
1623 /**
1624  * @brief Get the administrative port path cost
1625  * @param[in] context Pointer to the RSTP bridge context
1626  * @param[in] portIndex Port index
1627  * @param[out] value Administrative port path cost
1628  * @return Error code
1629  **/
1630 
1632  uint32_t *value)
1633 {
1634  error_t error;
1635 
1636  //Make sure the RSTP bridge context is valid
1637  if(context != NULL)
1638  {
1639  //Acquire exclusive access to the RSTP bridge context
1640  rstpLock(context);
1641  //Perform management operation
1642  error = rstpMgmtGetAdminPortPathCost(context, portIndex, value);
1643  //Release exclusive access to the RSTP bridge context
1644  rstpUnlock(context);
1645  }
1646  else
1647  {
1648  //Report an error
1649  error = ERROR_INVALID_PARAMETER;
1650  }
1651 
1652  //Return status code
1653  return error;
1654 }
1655 
1656 
1657 /**
1658  * @brief Get the current value of the port path cost
1659  * @param[in] context Pointer to the RSTP bridge context
1660  * @param[in] portIndex Port index
1661  * @param[out] value Port path cost
1662  * @return Error code
1663  **/
1664 
1666  uint32_t *value)
1667 {
1668  error_t error;
1669 
1670  //Make sure the RSTP bridge context is valid
1671  if(context != NULL)
1672  {
1673  //Acquire exclusive access to the RSTP bridge context
1674  rstpLock(context);
1675  //Perform management operation
1676  error = rstpMgmtGetPortPathCost(context, portIndex, value);
1677  //Release exclusive access to the RSTP bridge context
1678  rstpUnlock(context);
1679  }
1680  else
1681  {
1682  //Report an error
1683  error = ERROR_INVALID_PARAMETER;
1684  }
1685 
1686  //Return status code
1687  return error;
1688 }
1689 
1690 
1691 /**
1692  * @brief Get the administrative point-to-point status of the LAN segment
1693  * @param[in] context Pointer to the RSTP bridge context
1694  * @param[in] portIndex Port index
1695  * @param[out] value Administrative point-to-point status of the LAN segment
1696  * attached to this port
1697  * @return Error code
1698  **/
1699 
1702 {
1703  error_t error;
1704 
1705  //Make sure the RSTP bridge context is valid
1706  if(context != NULL)
1707  {
1708  //Acquire exclusive access to the RSTP bridge context
1709  rstpLock(context);
1710  //Perform management operation
1711  error = rstpMgmtGetAdminPointToPointMac(context, portIndex, value);
1712  //Release exclusive access to the RSTP bridge context
1713  rstpUnlock(context);
1714  }
1715  else
1716  {
1717  //Report an error
1718  error = ERROR_INVALID_PARAMETER;
1719  }
1720 
1721  //Return status code
1722  return error;
1723 }
1724 
1725 
1726 /**
1727  * @brief Get the operational point-to-point status of the LAN segment
1728  * @param[in] context Pointer to the RSTP bridge context
1729  * @param[in] portIndex Port index
1730  * @param[out] value Operational point-to-point status of the LAN segment
1731  * attached to this port
1732  * @return Error code
1733  **/
1734 
1736  uint_t portIndex, bool_t *value)
1737 {
1738  error_t error;
1739 
1740  //Make sure the RSTP bridge context is valid
1741  if(context != NULL)
1742  {
1743  //Acquire exclusive access to the RSTP bridge context
1744  rstpLock(context);
1745  //Perform management operation
1746  error = rstpMgmtGetOperPointToPointMac(context, portIndex, value);
1747  //Release exclusive access to the RSTP bridge context
1748  rstpUnlock(context);
1749  }
1750  else
1751  {
1752  //Report an error
1753  error = ERROR_INVALID_PARAMETER;
1754  }
1755 
1756  //Return status code
1757  return error;
1758 }
1759 
1760 
1761 /**
1762  * @brief Get the administrative value of the Edge Port parameter
1763  * @param[in] context Pointer to the RSTP bridge context
1764  * @param[in] portIndex Port index
1765  * @param[out] value Administrative value of the Edge Port parameter
1766  * @return Error code
1767  **/
1768 
1770  bool_t *value)
1771 {
1772  error_t error;
1773 
1774  //Make sure the RSTP bridge context is valid
1775  if(context != NULL)
1776  {
1777  //Acquire exclusive access to the RSTP bridge context
1778  rstpLock(context);
1779  //Perform management operation
1780  error = rstpMgmtGetAdminEdgePort(context, portIndex, value);
1781  //Release exclusive access to the RSTP bridge context
1782  rstpUnlock(context);
1783  }
1784  else
1785  {
1786  //Report an error
1787  error = ERROR_INVALID_PARAMETER;
1788  }
1789 
1790  //Return status code
1791  return error;
1792 }
1793 
1794 
1795 /**
1796  * @brief Get the value of the AutoEdgePort parameter
1797  * @param[in] context Pointer to the RSTP bridge context
1798  * @param[in] portIndex Port index
1799  * @param[out] value Value of the AutoEdgePort parameter for the port
1800  * @return Error code
1801  **/
1802 
1804  bool_t *value)
1805 {
1806  error_t error;
1807 
1808  //Make sure the RSTP bridge context is valid
1809  if(context != NULL)
1810  {
1811  //Acquire exclusive access to the RSTP bridge context
1812  rstpLock(context);
1813  //Perform management operation
1814  error = rstpMgmtGetAutoEdgePort(context, portIndex, value);
1815  //Release exclusive access to the RSTP bridge context
1816  rstpUnlock(context);
1817  }
1818  else
1819  {
1820  //Report an error
1821  error = ERROR_INVALID_PARAMETER;
1822  }
1823 
1824  //Return status code
1825  return error;
1826 }
1827 
1828 
1829 /**
1830  * @brief Get the operational value of the Edge Port parameter
1831  * @param[in] context Pointer to the RSTP bridge context
1832  * @param[in] portIndex Port index
1833  * @param[out] value Operational value of the Edge Port parameter
1834  * @return Error code
1835  **/
1836 
1838  bool_t *value)
1839 {
1840  error_t error;
1841 
1842  //Make sure the RSTP bridge context is valid
1843  if(context != NULL)
1844  {
1845  //Acquire exclusive access to the RSTP bridge context
1846  rstpLock(context);
1847  //Perform management operation
1848  error = rstpMgmtGetOperEdgePort(context, portIndex, value);
1849  //Release exclusive access to the RSTP bridge context
1850  rstpUnlock(context);
1851  }
1852  else
1853  {
1854  //Report an error
1855  error = ERROR_INVALID_PARAMETER;
1856  }
1857 
1858  //Return status code
1859  return error;
1860 }
1861 
1862 
1863 /**
1864  * @brief Get the current state of the port
1865  * @param[in] context Pointer to the RSTP bridge context
1866  * @param[in] portIndex Port index
1867  * @param[out] value Port state
1868  * @return Error code
1869  **/
1870 
1873 {
1874  error_t error;
1875 
1876  //Make sure the RSTP bridge context is valid
1877  if(context != NULL)
1878  {
1879  //Acquire exclusive access to the RSTP bridge context
1880  rstpLock(context);
1881  //Perform management operation
1882  error = rstpMgmtGetPortState(context, portIndex, value);
1883  //Release exclusive access to the RSTP bridge context
1884  rstpUnlock(context);
1885  }
1886  else
1887  {
1888  //Report an error
1889  error = ERROR_INVALID_PARAMETER;
1890  }
1891 
1892  //Return status code
1893  return error;
1894 }
1895 
1896 
1897 /**
1898  * @brief Get the assigned role of the port
1899  * @param[in] context Pointer to the RSTP bridge context
1900  * @param[in] portIndex Port index
1901  * @param[out] value Port role
1902  * @return Error code
1903  **/
1904 
1906  StpPortRole *value)
1907 {
1908  error_t error;
1909 
1910  //Make sure the RSTP bridge context is valid
1911  if(context != NULL)
1912  {
1913  //Acquire exclusive access to the RSTP bridge context
1914  rstpLock(context);
1915  //Perform management operation
1916  error = rstpMgmtGetPortRole(context, portIndex, value);
1917  //Release exclusive access to the RSTP bridge context
1918  rstpUnlock(context);
1919  }
1920  else
1921  {
1922  //Report an error
1923  error = ERROR_INVALID_PARAMETER;
1924  }
1925 
1926  //Return status code
1927  return error;
1928 }
1929 
1930 
1931 /**
1932  * @brief Get the bridge identifier of the designated root bridge
1933  * @param[in] context Pointer to the RSTP bridge context
1934  * @param[in] portIndex Port index
1935  * @param[out] value Bridge identifier
1936  * @return Error code
1937  **/
1938 
1940  StpBridgeId *value)
1941 {
1942  error_t error;
1943 
1944  //Make sure the RSTP bridge context is valid
1945  if(context != NULL)
1946  {
1947  //Acquire exclusive access to the RSTP bridge context
1948  rstpLock(context);
1949  //Perform management operation
1950  error = rstpMgmtGetPortDesignatedRoot(context, portIndex, value);
1951  //Release exclusive access to the RSTP bridge context
1952  rstpUnlock(context);
1953  }
1954  else
1955  {
1956  //Report an error
1957  error = ERROR_INVALID_PARAMETER;
1958  }
1959 
1960  //Return status code
1961  return error;
1962 }
1963 
1964 
1965 /**
1966  * @brief Get the designated cost of the port
1967  * @param[in] context Pointer to the RSTP bridge context
1968  * @param[in] portIndex Port index
1969  * @param[out] value Designated cost of the port
1970  * @return Error code
1971  **/
1972 
1974  uint32_t *value)
1975 {
1976  error_t error;
1977 
1978  //Make sure the RSTP bridge context is valid
1979  if(context != NULL)
1980  {
1981  //Acquire exclusive access to the RSTP bridge context
1982  rstpLock(context);
1983  //Perform management operation
1984  error = rstpMgmtGetPortDesignatedCost(context, portIndex, value);
1985  //Release exclusive access to the RSTP bridge context
1986  rstpUnlock(context);
1987  }
1988  else
1989  {
1990  //Report an error
1991  error = ERROR_INVALID_PARAMETER;
1992  }
1993 
1994  //Return status code
1995  return error;
1996 }
1997 
1998 
1999 /**
2000  * @brief Get the bridge identifier of the designated bridge
2001  * @param[in] context Pointer to the RSTP bridge context
2002  * @param[in] portIndex Port index
2003  * @param[out] value Bridge identifier
2004  * @return Error code
2005  **/
2006 
2008  uint_t portIndex, StpBridgeId *value)
2009 {
2010  error_t error;
2011 
2012  //Make sure the RSTP bridge context is valid
2013  if(context != NULL)
2014  {
2015  //Acquire exclusive access to the RSTP bridge context
2016  rstpLock(context);
2017  //Perform management operation
2018  error = rstpMgmtGetPortDesignatedBridge(context, portIndex, value);
2019  //Release exclusive access to the RSTP bridge context
2020  rstpUnlock(context);
2021  }
2022  else
2023  {
2024  //Report an error
2025  error = ERROR_INVALID_PARAMETER;
2026  }
2027 
2028  //Return status code
2029  return error;
2030 }
2031 
2032 
2033 /**
2034  * @brief Get the port identifier of the designated bridge
2035  * @param[in] context Pointer to the RSTP bridge context
2036  * @param[in] portIndex Port index
2037  * @param[out] value Port identifier
2038  * @return Error code
2039  **/
2040 
2042  uint16_t *value)
2043 {
2044  error_t error;
2045 
2046  //Make sure the RSTP bridge context is valid
2047  if(context != NULL)
2048  {
2049  //Acquire exclusive access to the RSTP bridge context
2050  rstpLock(context);
2051  //Perform management operation
2052  error = rstpMgmtGetPortDesignatedPort(context, portIndex, value);
2053  //Release exclusive access to the RSTP bridge context
2054  rstpUnlock(context);
2055  }
2056  else
2057  {
2058  //Report an error
2059  error = ERROR_INVALID_PARAMETER;
2060  }
2061 
2062  //Return status code
2063  return error;
2064 }
2065 
2066 
2067 /**
2068  * @brief Get the number of times the port has transitioned to Forwarding state
2069  * @param[in] context Pointer to the RSTP bridge context
2070  * @param[in] portIndex Port index
2071  * @param[out] value Number of transitions to Forwarding state
2072  * @return Error code
2073  **/
2074 
2076  uint_t *value)
2077 {
2078  error_t error;
2079 
2080  //Make sure the RSTP bridge context is valid
2081  if(context != NULL)
2082  {
2083  //Acquire exclusive access to the RSTP bridge context
2084  rstpLock(context);
2085  //Perform management operation
2086  error = rstpMgmtGetForwardTransitions(context, portIndex, value);
2087  //Release exclusive access to the RSTP bridge context
2088  rstpUnlock(context);
2089  }
2090  else
2091  {
2092  //Report an error
2093  error = ERROR_INVALID_PARAMETER;
2094  }
2095 
2096  //Return status code
2097  return error;
2098 }
2099 
2100 
2101 /**
2102  * @brief Release RSTP bridge context
2103  * @param[in] context Pointer to the RSTP bridge context
2104  **/
2105 
2107 {
2108  //Make sure the RSTP bridge context is valid
2109  if(context != NULL)
2110  {
2111  //Clear RSTP bridge context
2112  osMemset(context, 0, sizeof(RstpBridgeContext));
2113  }
2114 }
2115 
2116 #endif
error_t rstpGetPortPathCost(RstpBridgeContext *context, uint_t portIndex, uint32_t *value)
Get the current value of the port path cost.
Definition: rstp.c:1665
error_t ethAcceptMacAddr(NetInterface *interface, const MacAddr *macAddr)
Add a unicast/multicast address to the MAC filter table.
Definition: ethernet.c:601
void rstpLock(RstpBridgeContext *context)
Acquire exclusive access to the RSTP bridge context.
Definition: rstp_misc.c:50
error_t rstpMgmtGetRootPort(RstpBridgeContext *context, uint16_t *value)
Get the current root port.
Definition: rstp_mgmt.c:668
error_t ethDetachLlcRxCallback(NetInterface *interface)
Unregister LLC frame received callback.
Definition: ethernet.c:756
error_t rstpSetPortNum(RstpBridgeContext *context, uint_t portIndex, uint16_t value)
Set port number.
Definition: rstp.c:1096
error_t rstpGetMaxAge(RstpBridgeContext *context, uint_t *value)
Get the current Max Age value.
Definition: rstp.c:935
error_t rstpMgmtGetAutoEdgePort(RstpBridgeContext *context, uint_t portIndex, bool_t *value)
Get the value of the AutoEdgePort parameter.
Definition: rstp_mgmt.c:1472
#define RSTP_DEFAULT_PORT_PRIORITY
Definition: rstp.h:79
int bool_t
Definition: compiler_port.h:63
@ NIC_LINK_SPEED_UNKNOWN
Definition: nic.h:110
#define RSTP_DEFAULT_AGEING_TIME
Definition: rstp.h:184
error_t rstpSetBridgeForwardDelay(RstpBridgeContext *context, uint_t value)
Set Bridge Forward Delay parameter.
Definition: rstp.c:455
void rstpGeneratePortAddr(RstpBridgePort *port)
Port's MAC address generation.
Definition: rstp_misc.c:815
void rstpTick(RstpBridgeContext *context)
RSTP tick handler.
Definition: rstp_misc.c:77
#define RSTP_PORT_PRIORITY_MASK
Definition: rstp_bpdu.h:43
error_t netDetachTimerCallback(NetContext *context, NetTimerCallback callback, void *param)
Unregister timer callback.
Definition: net_misc.c:385
#define RSTP_DEFAULT_BRIDGE_PRIORITY
Definition: rstp.h:72
error_t rstpMgmtSetBridgeHelloTime(RstpBridgeContext *context, uint_t value, bool_t commit)
Set Bridge Hello Time parameter.
Definition: rstp_mgmt.c:216
error_t rstpSetAgeingTime(RstpBridgeContext *context, uint_t value)
Set Ageing Time parameter.
Definition: rstp.c:519
RSTP state machine conditions.
error_t rstpSetAdminPortPathCost(RstpBridgeContext *context, uint_t portIndex, uint32_t value)
Set administrative port path cost.
Definition: rstp.c:1276
error_t rstpMgmtGetAdminEdgePort(RstpBridgeContext *context, uint_t portIndex, bool_t *value)
Get the administrative value of the Edge Port parameter.
Definition: rstp_mgmt.c:1440
#define TRUE
Definition: os_port.h:50
error_t rstpGetPortDesignatedRoot(RstpBridgeContext *context, uint_t portIndex, StpBridgeId *value)
Get the bridge identifier of the designated root bridge.
Definition: rstp.c:1939
error_t rstpMgmtGetBridgeHelloTime(RstpBridgeContext *context, uint_t *value)
Get the assigned value of the Bridge Hello Time parameter.
Definition: rstp_mgmt.c:541
error_t rstpMgmtSetAdminPointToPointMac(RstpBridgeContext *context, uint_t portIndex, RstpAdminPointToPointMac value, bool_t commit)
Set administrative point-to-point status of the LAN segment.
Definition: rstp_mgmt.c:971
error_t rstpGetAdminPortState(RstpBridgeContext *context, uint_t portIndex, bool_t *value)
Get the administrative port state.
Definition: rstp.c:1563
void rstpDeinit(RstpBridgeContext *context)
Release RSTP bridge context.
Definition: rstp.c:2106
error_t rstpMgmtGetRootPathCost(RstpBridgeContext *context, uint32_t *value)
Get the current cost of the path to the root.
Definition: rstp_mgmt.c:647
error_t rstpMgmtGetBridgeMaxAge(RstpBridgeContext *context, uint_t *value)
Get the assigned value of the Bridge Max Age parameter.
Definition: rstp_mgmt.c:520
error_t rstpMgmtGetDesignatedRoot(RstpBridgeContext *context, StpBridgeId *value)
Get the bridge identifier of the root of the spanning tree.
Definition: rstp_mgmt.c:625
RSTP helper functions.
error_t rstpGetPortAddr(RstpBridgeContext *context, uint_t portIndex, MacAddr *value)
Get the MAC address assigned to the port.
Definition: rstp.c:1495
@ ERROR_INVALID_PORT
Definition: error.h:104
error_t rstpGetDesignatedRoot(RstpBridgeContext *context, StpBridgeId *value)
Get the bridge identifier of the root of the spanning tree.
Definition: rstp.c:839
error_t rstpGetTimeSinceTopologyChange(RstpBridgeContext *context, uint_t *value)
Get the time since a topology change was last detected.
Definition: rstp.c:1062
error_t rstpMgmtGetVersion(RstpBridgeContext *context, uint_t *value)
Get assigned protocol version.
Definition: rstp_mgmt.c:456
error_t rstpGetAgeingTime(RstpBridgeContext *context, uint_t *value)
Get the assigned value of the Ageing Time parameter.
Definition: rstp.c:807
error_t rstpGetPortDesignatedPort(RstpBridgeContext *context, uint_t portIndex, uint16_t *value)
Get the port identifier of the designated bridge.
Definition: rstp.c:2041
error_t rstpGetBridgeMaxAge(RstpBridgeContext *context, uint_t *value)
Get the assigned value of the Bridge Max Age parameter.
Definition: rstp.c:679
void rstpUpdateOperPointToPointMac(RstpBridgePort *port)
Update the value of the operPointToPointMac variable.
Definition: rstp_misc.c:455
error_t rstpSetBridgeMaxAge(RstpBridgeContext *context, uint_t value)
Set Bridge Max Age parameter.
Definition: rstp.c:391
error_t rstpStop(RstpBridgeContext *context)
Stop RSTP bridge operation.
Definition: rstp.c:265
#define RSTP_DEFAULT_BRIDGE_HELLO_TIME
Definition: rstp.h:121
Management of the RSTP bridge.
NetInterface * interface
Underlying network interface.
Definition: rstp.h:410
error_t ethDropMacAddr(NetInterface *interface, const MacAddr *macAddr)
Remove a unicast/multicast address from the MAC filter table.
Definition: ethernet.c:673
error_t rstpMgmtGetForwardTransitions(RstpBridgeContext *context, uint_t portIndex, uint_t *value)
Get the number of times the port has transitioned to Forwarding state.
Definition: rstp_mgmt.c:1789
error_t rstpMgmtGetForwardDelay(RstpBridgeContext *context, uint_t *value)
Get the current Forward Delay value.
Definition: rstp_mgmt.c:735
error_t rstpMgmtSetAdminPortPathCost(RstpBridgeContext *context, uint_t portIndex, uint32_t value, bool_t commit)
Set administrative port path cost.
Definition: rstp_mgmt.c:910
#define RstpBridgeContext
Definition: rstp.h:36
error_t rstpSetTxHoldCount(RstpBridgeContext *context, uint_t value)
Set Transmit Hold Count parameter.
Definition: rstp.c:487
error_t rstpSetPortPriority(RstpBridgeContext *context, uint_t portIndex, uint8_t value)
Set port priority.
Definition: rstp.c:1208
error_t rstpMgmtGetPortPathCost(RstpBridgeContext *context, uint_t portIndex, uint32_t *value)
Get the current value of the port path cost.
Definition: rstp_mgmt.c:1340
error_t rstpGetTopologyChanges(RstpBridgeContext *context, uint_t *value)
Get the number of topology changes.
Definition: rstp.c:1030
#define FALSE
Definition: os_port.h:46
error_t rstpGetAutoEdgePort(RstpBridgeContext *context, uint_t portIndex, bool_t *value)
Get the value of the AutoEdgePort parameter.
Definition: rstp.c:1803
error_t rstpStart(RstpBridgeContext *context)
Start RSTP bridge operation.
Definition: rstp.c:171
@ ERROR_INVALID_PARAMETER
Invalid parameter.
Definition: error.h:47
error_t rstpMgmtGetNumPorts(RstpBridgeContext *context, uint_t *value)
Get the number of ports.
Definition: rstp_mgmt.c:435
error_t rstpSetAdminPointToPointMac(RstpBridgeContext *context, uint_t portIndex, RstpAdminPointToPointMac value)
Set administrative point-to-point status of the LAN segment.
Definition: rstp.c:1311
error_t
Error codes.
Definition: error.h:43
StpPortRole
Port role values.
Definition: stp_common.h:123
error_t rstpMgmtGetMaxAge(RstpBridgeContext *context, uint_t *value)
Get the current Max Age value.
Definition: rstp_mgmt.c:690
error_t rstpGetTxHoldCount(RstpBridgeContext *context, uint_t *value)
Get the assigned value of the Transmit Hold Count parameter.
Definition: rstp.c:775
RstpAdminPointToPointMac
Administrative state of the point-to-point status.
Definition: rstp.h:255
RSTP (Rapid Spanning Tree Protocol)
RSTP bridge settings.
Definition: rstp.h:409
error_t rstpMgmtGetPortPriority(RstpBridgeContext *context, uint_t portIndex, uint8_t *value)
Get the priority assigned to the port.
Definition: rstp_mgmt.c:1212
void rstpUpdateAgeingTime(RstpBridgeContext *context, uint32_t ageingTime)
Set ageing time for dynamic filtering entries.
Definition: rstp_misc.c:527
error_t rstpMgmtGetTxHoldCount(RstpBridgeContext *context, uint_t *value)
Get the assigned value of the Transmit Hold Count parameter.
Definition: rstp_mgmt.c:583
error_t rstpMgmtSetAdminEdgePort(RstpBridgeContext *context, uint_t portIndex, bool_t value, bool_t commit)
Set administrative value of the Edge Port parameter.
Definition: rstp_mgmt.c:1029
error_t rstpMgmtGetAdminPortPathCost(RstpBridgeContext *context, uint_t portIndex, uint32_t *value)
Get the administrative port path cost.
Definition: rstp_mgmt.c:1308
#define NetInterface
Definition: net.h:40
error_t rstpGetForwardDelay(RstpBridgeContext *context, uint_t *value)
Get the current Forward Delay value.
Definition: rstp.c:998
#define RSTP_DEFAULT_MIGRATE_TIME
Definition: rstp.h:86
error_t rstpSetAdminPortState(RstpBridgeContext *context, uint_t portIndex, bool_t value)
Set administrative bridge port state.
Definition: rstp.c:1242
error_t rstpGetBridgeAddr(RstpBridgeContext *context, MacAddr *value)
Get the MAC address assigned to the bridge.
Definition: rstp.c:615
error_t netAttachTimerCallback(NetContext *context, systime_t period, NetTimerCallback callback, void *param)
Register timer callback.
Definition: net_misc.c:346
error_t rstpMgmtSetTxHoldCount(RstpBridgeContext *context, uint_t value, bool_t commit)
Set Transmit Hold Count parameter.
Definition: rstp_mgmt.c:339
error_t rstpMgmtGetPortRole(RstpBridgeContext *context, uint_t portIndex, StpPortRole *value)
Get the assigned role of the port.
Definition: rstp_mgmt.c:1624
error_t rstpMgmtSetAgeingTime(RstpBridgeContext *context, uint_t value, bool_t commit)
Set Ageing Time parameter.
Definition: rstp_mgmt.c:391
error_t rstpMgmtGetBridgePriority(RstpBridgeContext *context, uint16_t *value)
Get the assigned bridge priority.
Definition: rstp_mgmt.c:499
#define RSTP_DEFAULT_PORT_PATH_COST
Definition: rstp.h:205
error_t rstpMgmtGetPortDesignatedBridge(RstpBridgeContext *context, uint_t portIndex, StpBridgeId *value)
Get the bridge identifier of the designated bridge.
Definition: rstp_mgmt.c:1723
error_t rstpMgmtSetAdminPortState(RstpBridgeContext *context, uint_t portIndex, bool_t value, bool_t commit)
Set administrative bridge port state.
Definition: rstp_mgmt.c:860
error_t rstpMgmtGetPortState(RstpBridgeContext *context, uint_t portIndex, StpPortState *value)
Get the current state of the port.
Definition: rstp_mgmt.c:1536
error_t rstpMgmtSetBridgeForwardDelay(RstpBridgeContext *context, uint_t value, bool_t commit)
Set Bridge Forward Delay parameter.
Definition: rstp_mgmt.c:276
error_t rstpGetBridgePriority(RstpBridgeContext *context, uint16_t *value)
Get the assigned bridge priority.
Definition: rstp.c:647
error_t rstpMgmtSetPortPriority(RstpBridgeContext *context, uint_t portIndex, uint8_t value, bool_t commit)
Set port priority.
Definition: rstp_mgmt.c:804
@ RSTP_ADMIN_P2P_MAC_FORCE_TRUE
Definition: rstp.h:257
error_t rstpMgmtGetBridgeForwardDelay(RstpBridgeContext *context, uint_t *value)
Get the assigned value of the Bridge Forward Delay parameter.
Definition: rstp_mgmt.c:562
void rstpFsmInit(RstpBridgeContext *context)
RSTP state machine initialization.
Definition: rstp_fsm.c:49
void rstpUpdatePortPathCost(RstpBridgePort *port)
Update the value of the portPathCost variable.
Definition: rstp_misc.c:425
error_t rstpGetAdminPortPathCost(RstpBridgeContext *context, uint_t portIndex, uint32_t *value)
Get the administrative port path cost.
Definition: rstp.c:1631
#define RSTP_PORT_NUM_MASK
Definition: rstp_bpdu.h:44
uint_t numPorts
Number of ports.
Definition: rstp.h:411
error_t rstpMgmtGetOperPointToPointMac(RstpBridgeContext *context, uint_t portIndex, bool_t *value)
Get the operational point-to-point status of the LAN segment.
Definition: rstp_mgmt.c:1408
#define TRACE_INFO(...)
Definition: debug.h:105
const MacAddr RSTP_BRIDGE_GROUP_ADDR
Definition: rstp_bpdu.c:46
void rstpGetDefaultSettings(RstpBridgeSettings *settings)
Initialize settings with default values.
Definition: rstp.c:51
error_t rstpSetBridgeHelloTime(RstpBridgeContext *context, uint_t value)
Set Bridge Hello Time parameter.
Definition: rstp.c:423
error_t rstpMgmtGetTimeSinceTopologyChange(RstpBridgeContext *context, uint_t *value)
Get the time since a topology change was last detected.
Definition: rstp_mgmt.c:778
error_t rstpConfigurePermanentDatabase(RstpBridgeContext *context)
Configure the permanent database.
Definition: rstp_misc.c:743
error_t rstpGetOperEdgePort(RstpBridgeContext *context, uint_t portIndex, bool_t *value)
Get the operational value of the Edge Port parameter.
Definition: rstp.c:1837
void rstpUnconfigurePermanentDatabase(RstpBridgeContext *context)
Unconfigure the permanent database.
Definition: rstp_misc.c:788
error_t rstpGetOperPointToPointMac(RstpBridgeContext *context, uint_t portIndex, bool_t *value)
Get the operational point-to-point status of the LAN segment.
Definition: rstp.c:1735
MacAddr
Definition: ethernet.h:197
error_t ethAttachLlcRxCallback(NetInterface *interface, LlcRxCallback callback, void *param)
Register LLC frame received callback.
Definition: ethernet.c:728
error_t rstpSetAdminEdgePort(RstpBridgeContext *context, uint_t portIndex, bool_t value)
Set administrative value of the Edge Port parameter.
Definition: rstp.c:1345
@ SWITCH_PORT_STATE_FORWARDING
Definition: nic.h:140
error_t rstpMgmtSetBridgeMaxAge(RstpBridgeContext *context, uint_t value, bool_t commit)
Set Bridge Max Age parameter.
Definition: rstp_mgmt.c:156
uint16_t port
Definition: dns_common.h:270
error_t rstpMgmtGetAdminPortState(RstpBridgeContext *context, uint_t portIndex, bool_t *value)
Get the administrative port state.
Definition: rstp_mgmt.c:1244
error_t rstpSetProtocolMigration(RstpBridgeContext *context, uint_t portIndex, bool_t value)
Force protocol migration.
Definition: rstp.c:1413
error_t rstpGetForwardTransitions(RstpBridgeContext *context, uint_t portIndex, uint_t *value)
Get the number of times the port has transitioned to Forwarding state.
Definition: rstp.c:2075
error_t rstpGetAdminEdgePort(RstpBridgeContext *context, uint_t portIndex, bool_t *value)
Get the administrative value of the Edge Port parameter.
Definition: rstp.c:1769
error_t rstpMgmtGetBridgeAddr(RstpBridgeContext *context, MacAddr *value)
Get the MAC address assigned to the bridge.
Definition: rstp_mgmt.c:478
error_t rstpMgmtSetVersion(RstpBridgeContext *context, uint_t value, bool_t commit)
Set protocol version.
Definition: rstp_mgmt.c:55
error_t rstpGetRootPort(RstpBridgeContext *context, uint16_t *value)
Get the current root port.
Definition: rstp.c:903
error_t rstpMgmtGetHelloTime(RstpBridgeContext *context, uint_t *value)
Get the current Hello Time value.
Definition: rstp_mgmt.c:712
void rstpUpdatePortState(RstpBridgePort *port, SwitchPortState state)
Set port state.
Definition: rstp_misc.c:495
@ ERROR_INVALID_VALUE
Definition: error.h:116
error_t rstpMgmtGetAdminPointToPointMac(RstpBridgeContext *context, uint_t portIndex, RstpAdminPointToPointMac *value)
Get the administrative point-to-point status of the LAN segment.
Definition: rstp_mgmt.c:1374
error_t rstpMgmtGetPortDesignatedPort(RstpBridgeContext *context, uint_t portIndex, uint16_t *value)
Get the port identifier of the designated bridge.
Definition: rstp_mgmt.c:1756
error_t rstpGetHelloTime(RstpBridgeContext *context, uint_t *value)
Get the current Hello Time value.
Definition: rstp.c:967
#define RSTP_DEFAULT_BRIDGE_FORWARD_DELAY
Definition: rstp.h:142
error_t rstpSetPortAddr(RstpBridgeContext *context, uint_t portIndex, const MacAddr *value)
Set port address.
Definition: rstp.c:1157
error_t rstpInit(RstpBridgeContext *context, RstpBridgeSettings *settings)
Initialize RSTP bridge context.
Definition: rstp.c:70
error_t rstpMgmtGetPortAddr(RstpBridgeContext *context, uint_t portIndex, MacAddr *value)
Get the MAC address assigned to the port.
Definition: rstp_mgmt.c:1180
error_t rstpMgmtSetProtocolMigration(RstpBridgeContext *context, uint_t portIndex, bool_t value, bool_t commit)
Force protocol migration.
Definition: rstp_mgmt.c:1127
StpBridgeId
Definition: stp_common.h:148
error_t rstpGetMacOperState(RstpBridgeContext *context, uint_t portIndex, bool_t *value)
Get the current MAC operational state.
Definition: rstp.c:1597
uint8_t value[]
Definition: tcp.h:376
error_t rstpMgmtGetPortDesignatedCost(RstpBridgeContext *context, uint_t portIndex, uint32_t *value)
Get the designated cost of the port.
Definition: rstp_mgmt.c:1690
error_t rstpSetAutoEdgePort(RstpBridgeContext *context, uint_t portIndex, bool_t value)
Set AutoEdgePort parameter.
Definition: rstp.c:1378
error_t rstpGetPortDesignatedBridge(RstpBridgeContext *context, uint_t portIndex, StpBridgeId *value)
Get the bridge identifier of the designated bridge.
Definition: rstp.c:2007
void rstpProcessLlcFrame(NetInterface *interface, EthHeader *ethHeader, const uint8_t *data, size_t length, NetRxAncillary *ancillary, void *param)
Process incoming LLC frame.
Definition: rstp_bpdu.c:75
error_t rstpGetVersion(RstpBridgeContext *context, uint_t *value)
Get assigned protocol version.
Definition: rstp.c:583
error_t rstpGetBridgeForwardDelay(RstpBridgeContext *context, uint_t *value)
Get the assigned value of the Bridge Forward Delay parameter.
Definition: rstp.c:743
@ NIC_UNKNOWN_DUPLEX_MODE
Definition: nic.h:123
error_t rstpGetAdminPointToPointMac(RstpBridgeContext *context, uint_t portIndex, RstpAdminPointToPointMac *value)
Get the administrative point-to-point status of the LAN segment.
Definition: rstp.c:1700
error_t rstpGetPortPriority(RstpBridgeContext *context, uint_t portIndex, uint8_t *value)
Get the priority assigned to the port.
Definition: rstp.c:1529
StpPortState
Port states.
Definition: stp_common.h:108
@ RSTP_PROTOCOL_VERSION
RSTP version.
Definition: stp_common.h:98
error_t rstpMgmtSetAutoEdgePort(RstpBridgeContext *context, uint_t portIndex, bool_t value, bool_t commit)
Set AutoEdgePort parameter.
Definition: rstp_mgmt.c:1079
error_t rstpMgmtGetPortDesignatedRoot(RstpBridgeContext *context, uint_t portIndex, StpBridgeId *value)
Get the bridge identifier of the designated root bridge.
Definition: rstp_mgmt.c:1656
error_t rstpGetRootPathCost(RstpBridgeContext *context, uint32_t *value)
Get the current cost of the path to the root.
Definition: rstp.c:871
error_t rstpSetVersion(RstpBridgeContext *context, uint_t value)
Set protocol version.
Definition: rstp.c:327
error_t rstpMgmtGetTopologyChanges(RstpBridgeContext *context, uint_t *value)
Get the number of topology changes.
Definition: rstp_mgmt.c:757
RstpBridgePort * ports
Bridge's ports.
Definition: rstp.h:412
error_t rstpMgmtGetMacOperState(RstpBridgeContext *context, uint_t portIndex, bool_t *value)
Get the current MAC operational state.
Definition: rstp_mgmt.c:1276
unsigned int uint_t
Definition: compiler_port.h:57
#define osMemset(p, value, length)
Definition: os_port.h:138
error_t rstpSetBridgePriority(RstpBridgeContext *context, uint16_t value)
Set bridge priority.
Definition: rstp.c:359
error_t rstpGetNumPorts(RstpBridgeContext *context, uint_t *value)
Get the number of ports.
Definition: rstp.c:551
error_t rstpGetPortRole(RstpBridgeContext *context, uint_t portIndex, StpPortRole *value)
Get the assigned role of the port.
Definition: rstp.c:1905
void rstpUnlock(RstpBridgeContext *context)
Release exclusive access to the RSTP bridge context.
Definition: rstp_misc.c:62
error_t rstpGetBridgeHelloTime(RstpBridgeContext *context, uint_t *value)
Get the assigned value of the Bridge Hello Time parameter.
Definition: rstp.c:711
error_t rstpGetPortState(RstpBridgeContext *context, uint_t portIndex, StpPortState *value)
Get the current state of the port.
Definition: rstp.c:1871
error_t rstpMgmtGetAgeingTime(RstpBridgeContext *context, uint_t *value)
Get the assigned value of the Ageing Time parameter.
Definition: rstp_mgmt.c:604
error_t rstpGetPortNum(RstpBridgeContext *context, uint_t portIndex, uint16_t *value)
Get the port number assigned to the port.
Definition: rstp.c:1447
@ ERROR_ALREADY_RUNNING
Definition: error.h:294
error_t rstpGetPortDesignatedCost(RstpBridgeContext *context, uint_t portIndex, uint32_t *value)
Get the designated cost of the port.
Definition: rstp.c:1973
#define RSTP_TICK_INTERVAL
Definition: rstp.h:65
@ NO_ERROR
Success.
Definition: error.h:44
error_t rstpMgmtGetOperEdgePort(RstpBridgeContext *context, uint_t portIndex, bool_t *value)
Get the operational value of the Edge Port parameter.
Definition: rstp_mgmt.c:1504
Debugging facilities.
#define RSTP_DEFAULT_BRIDGE_MAX_AGE
Definition: rstp.h:100
#define RSTP_DEFAULT_TRANSMIT_HOLD_COUNT
Definition: rstp.h:163
void(* NetTimerCallback)(void *param)
Timer callback.
Definition: net_misc.h:84
#define RstpBridgePort
Definition: rstp.h:40
error_t rstpMgmtSetBridgePriority(RstpBridgeContext *context, uint16_t value, bool_t commit)
Set bridge priority.
Definition: rstp_mgmt.c:96
Rapid Spanning Tree state machines.