OpenNSL API Guide and Reference Manual
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <opennsl/error.h>
#include <opennsl/init.h>
#include <opennsl/port.h>
#include <opennsl/l2.h>
#include <opennsl/vlan.h>
#include <opennsl/field.h>
#include <opennsl/policer.h>
#include <opennsl/cosqX.h>
#include <examples/util.h>
Go to the source code of this file.
Macros | |
#define | DEFAULT_UNIT 0 |
#define | DEFAULT_VLAN 1 |
#define | MAC_DA {0x00, 0x00, 0x00, 0x00, 0x00, 0x01} |
#define | MAC_MASK {0xff, 0xff, 0xff, 0xff, 0xff, 0xff} |
Functions | |
opennsl_error_t | example_create_meter (int unit) |
opennsl_error_t | example_create_policy (int unit, opennsl_port_t in_port, opennsl_port_t out_port) |
int | main (int argc, char *argv[]) |
Main function for policer application. | |
#define DEFAULT_UNIT 0 |
Definition at line 76 of file example_policer.c.
Referenced by main().
#define DEFAULT_VLAN 1 |
Definition at line 77 of file example_policer.c.
#define MAC_DA {0x00, 0x00, 0x00, 0x00, 0x00, 0x01} |
Definition at line 78 of file example_policer.c.
Referenced by example_create_policy().
#define MAC_MASK {0xff, 0xff, 0xff, 0xff, 0xff, 0xff} |
Definition at line 80 of file example_policer.c.
Referenced by example_create_policy().
opennsl_error_t example_create_meter | ( | int | unit | ) |
Definition at line 90 of file example_policer.c.
References opennsl_policer_config_s::ckbits_burst, opennsl_policer_config_s::ckbits_sec, opennsl_policer_config_s::max_pkbits_sec, opennsl_policer_config_s::mode, OPENNSL_E_NONE, OPENNSL_FAILURE, opennsl_info_get(), opennsl_policer_config_t_init(), opennsl_policer_create(), opennslPolicerModeSrTcm, opennsl_policer_config_s::pkbits_burst, and policer_id.
Referenced by example_create_policy().
opennsl_error_t example_create_policy | ( | int | unit, |
opennsl_port_t | in_port, | ||
opennsl_port_t | out_port | ||
) |
Definition at line 126 of file example_policer.c.
References example_create_meter(), grp, MAC_DA, MAC_MASK, OPENNSL_COSQ_DISCARD_COLOR_BLACK, OPENNSL_COSQ_DISCARD_ENABLE, opennsl_cosq_discard_set(), OPENNSL_E_NONE, opennsl_errmsg, OPENNSL_FIELD_ASET_ADD, OPENNSL_FIELD_ASET_INIT, opennsl_field_entry_create(), opennsl_field_entry_policer_attach(), opennsl_field_entry_stat_attach(), opennsl_field_group_action_set(), opennsl_field_group_create_mode_id(), opennsl_field_group_install(), OPENNSL_FIELD_QSET_ADD, OPENNSL_FIELD_QSET_INIT, opennsl_field_qualify_DstMac(), opennsl_field_stat_create_id(), opennsl_l2_addr_add(), opennsl_l2_addr_t_init(), opennsl_port_vlan_priority_map_set(), opennslColorGreen, opennslColorYellow, opennslFieldActionPolicerLevel0, opennslFieldActionStat0, opennslFieldActionUsePolicerResult, opennslFieldGroupModeAuto, opennslFieldQualifyDstMac, opennslFieldStatAcceptedPackets, opennslFieldStatDroppedPackets, policer_id, opennsl_l2_addr_s::port, stat_id, and stats.
Referenced by main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Main function for policer application.
argc,argv | commands line arguments |
Definition at line 271 of file example_policer.c.
References accept_stats, DEFAULT_UNIT, drop_stats, example_create_policy(), example_port_default_config(), example_read_user_choice(), example_switch_default_vlan_config(), example_usage, NULL, opennsl_driver_exit(), opennsl_driver_init(), OPENNSL_E_NONE, OPENNSL_E_PARAM, opennsl_errmsg, opennsl_field_stat_get(), and stat_id.
opennsl_field_stat_t accept_stats = opennslFieldStatAcceptedPackets |
Definition at line 86 of file example_policer.c.
Referenced by main().
opennsl_field_stat_t drop_stats = opennslFieldStatDroppedPackets |
Definition at line 87 of file example_policer.c.
Referenced by main().
char example_usage[] |
Definition at line 61 of file example_policer.c.
opennsl_policer_t policer_id |
Definition at line 84 of file example_policer.c.
Referenced by example_create_meter(), example_create_policer(), and example_create_policy().
int stat_id = 2 |
Definition at line 85 of file example_policer.c.