OpenNSL API Guide and Reference Manual
Functions | Variables
example_sflow.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sal/driver.h>
#include <opennsl/error.h>
#include <opennsl/switch.h>
#include <opennsl/rx.h>
#include <examples/util.h>

Go to the source code of this file.

Functions

opennsl_rx_t example_sflow_handle_rx_event (int unit, opennsl_pkt_t *pkt, void *cookie)
 Callback function to handle CPU bound packets.
 
int main (int argc, char *argv[])
 Main function for routing sample application.
 

Variables

char example_usage []
 
int verbose = 4
 

Function Documentation

opennsl_rx_t example_sflow_handle_rx_event ( int  unit,
opennsl_pkt_t pkt,
void *  cookie 
)

Callback function to handle CPU bound packets.

Parameters
unit[IN] Unit number.
pkt[IN] sampled packet description structure
cookie[IN] cookie passed to this function
Returns
OPENNSL_RX_HANDLED OpenNSL API return code

Definition at line 75 of file example_sflow.c.

References opennsl_pkt_s::cos, opennsl_pkt_blk_s::data, opennsl_pkt_s::flags, OPENNSL_RX_HANDLED, opennslRxReasonSampleSource, opennsl_pkt_s::pkt_data, opennsl_pkt_s::pkt_len, opennsl_pkt_s::rx_port, opennsl_pkt_s::rx_reason, opennsl_pkt_s::src_port, verbose, and opennsl_pkt_s::vlan.

Referenced by main().

int main ( int  argc,
char *  argv[] 
)

Variable Documentation

char example_usage[]
Initial value:
=
"Syntax: example_sflow \n\r"
" \n\r"
"Paramaters: None \n\r"
" \n\r"
"Example: The following command is used to demonstrate sFlow \n\r"
" example_sflow \n\r"
" \n\r"
"Usage Guidelines: This program allows the user to configure sFlow \n\r"
"parameters. It also has a provision to display the sFlow sampled \n\r"
"packet on the console. \n\r"
" \n\r"
"Note: Configure sFlow in such a way that less number of packets are \n\r"
"sampled, as it prints the packet on the console which is time consuming\n\r"

Definition at line 47 of file example_sflow.c.

int verbose = 4

Definition at line 63 of file example_sflow.c.