|
OpenNSL API Guide and Reference Manual
|
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sal/driver.h>#include <opennsl/types.h>#include <opennsl/port.h>#include <opennsl/vlan.h>#include <opennsl/error.h>#include <opennsl/stg.h>#include <examples/util.h>Go to the source code of this file.
Data Structures | |
| struct | stg_info_s |
Macros | |
| #define | CALL_IF_ERROR_RETURN(op) |
| #define | DEFAULT_UNIT 0 |
| #define | MAX_DIGITS_IN_CHOICE 5 |
| #define | VLANID 100 |
Functions | |
| int | example_stg_create (int unit, stg_info_s *info) |
| To add a given set of ports and VLAN to spanning tree instance. | |
| int | example_stg_init (int unit, stg_info_s *info, int port1, int port2) |
| Initialization routine to create spanning tree instance and initialize the structures. | |
| int | main (int argc, char *argv[]) |
| Main function for Spanning Tree Protocol (STP) sample application. | |
| int | revert_stg (int unit, stg_info_s *info) |
| To destroy the spanning tree instance and VLAN's associate with it. | |
Variables | |
| char | example_usage [] |
| char * | stp_state_str [] |
| int | verbose = 3 |
| #define CALL_IF_ERROR_RETURN | ( | op | ) |
Definition at line 90 of file example_stp.c.
Referenced by main().
| #define DEFAULT_UNIT 0 |
Definition at line 63 of file example_stp.c.
Referenced by example_stg_create(), and main().
| #define MAX_DIGITS_IN_CHOICE 5 |
Definition at line 65 of file example_stp.c.
| #define VLANID 100 |
Definition at line 64 of file example_stp.c.
Referenced by example_stg_init().
| int example_stg_create | ( | int | unit, |
| stg_info_s * | info | ||
| ) |
To add a given set of ports and VLAN to spanning tree instance.
| unit | [IN] Unit number. |
| *info | [IN] Pointer to a location where STG information is stored |
Definition at line 295 of file example_stp.c.
References DEFAULT_UNIT, OPENNSL_E_NONE, opennsl_errmsg, OPENNSL_PBMP_CLEAR, OPENNSL_PBMP_PORT_ADD, opennsl_stg_stp_set(), opennsl_stg_vlan_add(), opennsl_vlan_create(), opennsl_vlan_port_add(), stg_info_s::port_1, stg_info_s::port_2, stg_info_s::stg, stg_info_s::stp_state_1, stg_info_s::stp_state_2, stp_state_str, verbose, and stg_info_s::vlan_1.
Referenced by main().
| int example_stg_init | ( | int | unit, |
| stg_info_s * | info, | ||
| int | port1, | ||
| int | port2 | ||
| ) |
Initialization routine to create spanning tree instance and initialize the structures.
| unit | [IN] Unit number. |
| *info | [IN] Pointer to a location where STG information is stored |
| port1 | [IN] First port number. |
| port2 | [IN] Second port number. |
Definition at line 273 of file example_stp.c.
References opennsl_stg_create(), OPENNSL_STG_STP_FORWARD, stg_info_s::port_1, stg_info_s::port_2, stg_info_s::stg, stg_info_s::stp_state_1, stg_info_s::stp_state_2, stg_info_s::vlan_1, and VLANID.
Referenced by main().
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Main function for Spanning Tree Protocol (STP) sample application.
| argc,argv | commands line arguments |
Definition at line 113 of file example_stp.c.
References CALL_IF_ERROR_RETURN, DEFAULT_UNIT, example_port_default_config(), example_read_user_choice(), example_stg_create(), example_stg_init(), example_usage, NULL, opennsl_driver_exit(), opennsl_driver_init(), OPENNSL_E_NONE, OPENNSL_E_PARAM, opennsl_errmsg, OPENNSL_STG_STP_BLOCK, OPENNSL_STG_STP_FORWARD, opennsl_stg_stp_get(), opennsl_stg_stp_set(), port(), stg_info_s::port_1, stg_info_s::port_2, stg_info_s::stg, stp_state_str, and verbose.
| int revert_stg | ( | int | unit, |
| stg_info_s * | info | ||
| ) |
To destroy the spanning tree instance and VLAN's associate with it.
| unit | [IN] Unit number. |
| *info | [IN] Pointer to a location where STG information is stored |
Definition at line 372 of file example_stp.c.
References OPENNSL_E_NONE, opennsl_stg_destroy(), opennsl_vlan_destroy(), stg_info_s::stg, and stg_info_s::vlan_1.
| char example_usage[] |
Definition at line 40 of file example_stp.c.
| char* stp_state_str[] |
Definition at line 77 of file example_stp.c.
Referenced by example_stg_create(), and main().
| int verbose = 3 |
Definition at line 88 of file example_stp.c.