OpenNSL API Guide and Reference Manual
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sal/driver.h>
#include <opennsl/error.h>
#include <opennsl/l2.h>
#include <opennsl/switch.h>
#include <opennsl/vlan.h>
#include <examples/util.h>
Go to the source code of this file.
Macros | |
#define | DEFAULT_UNIT 0 |
#define | DEFAULT_VLAN 1 |
#define | MAX_DIGITS_IN_CHOICE 5 |
Functions | |
int | _opennsl_l2_traverse_cb (int unit, opennsl_l2_addr_t *info, void *user_data) |
Callback function to show L2 table information. | |
int | example_l2_firewall_allow_station (int unit, opennsl_mac_t mac, opennsl_vlan_t vlan) |
Unblock the given station MAC address in the given VLAN. | |
int | example_l2_firewall_block_station (int unit, opennsl_mac_t mac, opennsl_vlan_t vlan) |
Block the given station MAC address in the given VLAN. | |
int | main (int argc, char *argv[]) |
Main function for Layer2 firewall application. | |
Variables | |
char | example_usage [] |
int | max_l2_count = 0 |
#define DEFAULT_UNIT 0 |
Definition at line 52 of file example_l2_firewall.c.
Referenced by main().
#define DEFAULT_VLAN 1 |
Definition at line 53 of file example_l2_firewall.c.
#define MAX_DIGITS_IN_CHOICE 5 |
Definition at line 54 of file example_l2_firewall.c.
int _opennsl_l2_traverse_cb | ( | int | unit, |
opennsl_l2_addr_t * | info, | ||
void * | user_data | ||
) |
Callback function to show L2 table information.
unit | [IN] unit number |
info | [IN] L2 address structure |
*user_data | [IN] User specified cookie |
Definition at line 131 of file example_l2_firewall.c.
References opennsl_l2_addr_s::mac, max_l2_count, OPENNSL_E_NONE, opennsl_l2_addr_s::port, and opennsl_l2_addr_s::vid.
Referenced by main().
int example_l2_firewall_allow_station | ( | int | unit, |
opennsl_mac_t | mac, | ||
opennsl_vlan_t | vlan | ||
) |
Unblock the given station MAC address in the given VLAN.
unit | [IN] Unit number |
mac | [IN] 802.3 MAC address |
vlan | [IN] VLAN ID |
Definition at line 105 of file example_l2_firewall.c.
References OPENNSL_E_NONE, opennsl_l2_addr_delete(), and opennsl_l2_addr_get().
Referenced by main().
int example_l2_firewall_block_station | ( | int | unit, |
opennsl_mac_t | mac, | ||
opennsl_vlan_t | vlan | ||
) |
Block the given station MAC address in the given VLAN.
unit | [IN] Unit number |
mac | [IN] 802.3 MAC address |
vlan | [IN] VLAN ID |
Definition at line 78 of file example_l2_firewall.c.
References opennsl_l2_addr_s::flags, opennsl_l2_addr_add(), opennsl_l2_addr_t_init(), OPENNSL_L2_DISCARD_DST, OPENNSL_L2_DISCARD_SRC, and OPENNSL_L2_STATIC.
Referenced by main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Main function for Layer2 firewall application.
argc,argv | commands line arguments |
Definition at line 149 of file example_l2_firewall.c.
References _opennsl_l2_traverse_cb(), DEFAULT_UNIT, example_l2_firewall_allow_station(), example_l2_firewall_block_station(), example_port_default_config(), example_read_user_choice(), example_switch_default_vlan_config(), example_usage, max_l2_count, NULL, OPENNSL_BOOT_F_WARM_BOOT, opennsl_driver_boot_flags_get(), opennsl_driver_exit(), opennsl_driver_init(), OPENNSL_E_NONE, OPENNSL_E_NOT_FOUND, OPENNSL_E_PARAM, opennsl_errmsg, opennsl_l2_age_timer_get(), opennsl_l2_age_timer_set(), opennsl_l2_traverse(), opennsl_switch_control_set(), and opennslSwitchControlSync.
char example_usage[] |
Definition at line 57 of file example_l2_firewall.c.
int max_l2_count = 0 |
Definition at line 56 of file example_l2_firewall.c.
Referenced by _opennsl_l2_traverse_cb(), and main().