OpenNSL API Guide and Reference Manual
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sal/driver.h>
#include <sal/version.h>
#include <opennsl/error.h>
#include <opennsl/vlan.h>
#include <opennsl/port.h>
#include <opennsl/switch.h>
#include <opennsl/pkt.h>
#include <opennsl/tx.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 | |
void | example_multi_pkt_send (int unit, int port, int count) |
Form a packet and send multiple packets from the specified port. | |
int | example_pkt_send (int unit, int port, char *data, int len) |
Send a packet on the specified port. | |
int | main (int argc, char *argv[]) |
Main function for packet transmission. | |
Variables | |
char | example_usage [] |
#define DEFAULT_UNIT 0 |
Definition at line 40 of file example_packet_transmit.c.
Referenced by main().
#define DEFAULT_VLAN 1 |
Definition at line 41 of file example_packet_transmit.c.
#define MAX_DIGITS_IN_CHOICE 5 |
Definition at line 42 of file example_packet_transmit.c.
void example_multi_pkt_send | ( | int | unit, |
int | port, | ||
int | count | ||
) |
Form a packet and send multiple packets from the specified port.
unit | [IN] Unit number. |
port | [IN] Port number. |
count | [IN] Number of packets to be transmitted. |
Definition at line 105 of file example_packet_transmit.c.
References example_pkt_send(), opennsl_errmsg, and OPENNSL_SUCCESS.
int example_pkt_send | ( | int | unit, |
int | port, | ||
char * | data, | ||
int | len | ||
) |
Send a packet on the specified port.
unit | [IN] Unit number. |
port | [IN] Port number. |
data | [IN] Pointer to packet data. |
len | [IN] Size of the packet data. |
Definition at line 65 of file example_packet_transmit.c.
References NULL, OPENNSL_PBMP_PORT_SET, opennsl_pkt_alloc(), opennsl_pkt_free(), opennsl_pkt_memcpy(), OPENNSL_SUCCESS, opennsl_tx(), and opennsl_pkt_s::tx_pbmp.
int main | ( | int | argc, |
char * | argv[] | ||
) |
Main function for packet transmission.
argc,argv | commands line arguments |
Definition at line 139 of file example_packet_transmit.c.
References DEFAULT_UNIT, example_multi_pkt_send(), 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_version_get(), and port().
char example_usage[] |
Definition at line 44 of file example_packet_transmit.c.