OpenNSL API Guide and Reference Manual
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <opennsl/error.h>
#include <opennsl/port.h>
#include <opennsl/vlan.h>
#include <opennsl/field.h>
#include <opennsl/policer.h>
#include <examples/util.h>
Go to the source code of this file.
Macros | |
#define | DEFAULT_UNIT 0 |
#define | DEFAULT_VLAN 1 |
Functions | |
opennsl_error_t | example_check_rates (int unit, int *stat_list, int stat_count) |
opennsl_error_t | example_create_policer (int unit, opennsl_field_group_t *group, opennsl_port_t port, opennsl_vlan_t vlan, int index, int *statId) |
int | example_policer_test (int unit) |
int | main (int argc, char *argv[]) |
Main function for policer application. | |
#define DEFAULT_UNIT 0 |
Definition at line 40 of file example_policer.c.
Referenced by main().
#define DEFAULT_VLAN 1 |
Definition at line 41 of file example_policer.c.
opennsl_error_t example_check_rates | ( | int | unit, |
int * | stat_list, | ||
int | stat_count | ||
) |
Definition at line 130 of file example_policer.c.
References OPENNSL_E_FAIL, OPENNSL_E_NONE, opennsl_field_stat_get(), opennsl_field_stat_set(), OPENNSL_IF_ERROR_RETURN, and opennslFieldStatNotRedBytes.
Referenced by example_policer_test().
opennsl_error_t example_create_policer | ( | int | unit, |
opennsl_field_group_t * | group, | ||
opennsl_port_t | port, | ||
opennsl_vlan_t | vlan, | ||
int | index, | ||
int * | statId | ||
) |
Definition at line 45 of file example_policer.c.
References opennsl_policer_config_s::ckbits_burst, opennsl_policer_config_s::ckbits_sec, opennsl_policer_config_s::flags, opennsl_policer_config_s::mode, OPENNSL_E_NONE, opennsl_field_action_add(), opennsl_field_entry_create(), opennsl_field_entry_install(), opennsl_field_entry_policer_attach(), opennsl_field_entry_stat_attach(), opennsl_field_group_create(), OPENNSL_FIELD_GROUP_PRIO_ANY, OPENNSL_FIELD_QSET_ADD, OPENNSL_FIELD_QSET_INIT, opennsl_field_qualify_InPort(), opennsl_field_qualify_OuterVlanId(), opennsl_field_stat_create(), OPENNSL_IF_ERROR_RETURN, OPENNSL_POLICER_COLOR_BLIND, opennsl_policer_config_t_init(), opennsl_policer_create(), opennslFieldActionRpDrop, opennslFieldQualifyInPort, opennslFieldQualifyOuterVlanId, opennslFieldQualifyStageIngress, opennslFieldStatNotRedBytes, opennslFieldStatRedBytes, opennslPolicerModeTrTcm, opennsl_policer_config_s::pkbits_burst, opennsl_policer_config_s::pkbits_sec, policer_id, and stats.
Referenced by example_policer_test().
int example_policer_test | ( | int | unit | ) |
Definition at line 243 of file example_policer.c.
References opennsl_port_config_s::e, example_check_rates(), example_create_policer(), OPENNSL_E_NONE, OPENNSL_IF_ERROR_RETURN, OPENNSL_PBMP_ITER, OPENNSL_PBMP_PORT_SET, opennsl_port_config_get(), OPENNSL_PORT_LOOPBACK_MAC, opennsl_port_loopback_set(), opennsl_vlan_port_remove(), and port().
Referenced by main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Main function for policer application.
argc,argv | commands line arguments |
Definition at line 320 of file example_policer.c.
References DEFAULT_UNIT, example_policer_test(), example_port_default_config(), example_switch_default_vlan_config(), NULL, opennsl_driver_init(), OPENNSL_E_NONE, and opennsl_errmsg.