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/vlan.h>
#include <opennsl/rx.h>
#include <opennsl/knet.h>
#include <examples/util.h>
Go to the source code of this file.
Data Structures | |
struct | knet_if_data_t |
Macros | |
#define | DEFAULT_PORT 1 |
#define | DEFAULT_UNIT 0 |
#define | DEFAULT_VLAN 1 |
#define | IP_ADDR_LEN 16 |
#define | KNET_INTF_COUNT 20 |
#define | MAX_DIGITS_IN_CHOICE 5 |
#define | NETMASK_LEN 16 |
Functions | |
void | example_ip_config (char *ifName, char *ip, char *netmask) |
void | example_knet_database_show () |
Update KNET interface database. | |
void | example_knet_database_update (int port, char *ifName, int nID, int fID) |
Update KNET interface database. | |
void | example_knet_intf_create (int unit) |
void | example_knet_intf_delete (int unit) |
int | example_linux_interface_create (int unit, int port, char *ifName) |
int | main (int argc, char *argv[]) |
Main function for KNET sample application. | |
Variables | |
char | example_usage [] |
knet_if_data_t | knet_if_data [KNET_INTF_COUNT] |
int | knet_intf_count = 0 |
#define DEFAULT_PORT 1 |
Definition at line 42 of file example_knet.c.
#define DEFAULT_UNIT 0 |
Definition at line 41 of file example_knet.c.
Referenced by main().
#define DEFAULT_VLAN 1 |
Definition at line 43 of file example_knet.c.
Referenced by main().
#define IP_ADDR_LEN 16 |
Definition at line 46 of file example_knet.c.
Referenced by example_knet_intf_create().
#define KNET_INTF_COUNT 20 |
Definition at line 45 of file example_knet.c.
Referenced by example_knet_database_show(), example_knet_database_update(), example_knet_intf_create(), and example_knet_intf_delete().
#define MAX_DIGITS_IN_CHOICE 5 |
Definition at line 44 of file example_knet.c.
#define NETMASK_LEN 16 |
Definition at line 47 of file example_knet.c.
Referenced by example_knet_intf_create().
void example_ip_config | ( | char * | ifName, |
char * | ip, | ||
char * | netmask | ||
) |
Definition at line 251 of file example_knet.c.
References system().
Referenced by example_knet_intf_create().
void example_knet_database_show | ( | ) |
Update KNET interface database.
Definition at line 143 of file example_knet.c.
References KNET_INTF_COUNT, knet_intf_count, and port().
Referenced by main().
void example_knet_database_update | ( | int | port, |
char * | ifName, | ||
int | nID, | ||
int | fID | ||
) |
Update KNET interface database.
port | [IN] port number |
ifName | [IN] interface name |
nID | [IN] KNET interface ID |
fID | [IN] KNET filter ID |
Definition at line 97 of file example_knet.c.
References knet_if_data_t::filterID, KNET_INTF_COUNT, knet_intf_count, knet_if_data_t::netIfID, knet_if_data_t::port, and port().
Referenced by example_linux_interface_create().
void example_knet_intf_create | ( | int | unit | ) |
Definition at line 285 of file example_knet.c.
References example_ip_config(), example_linux_interface_create(), example_read_user_choice(), example_read_user_string(), IP_ADDR_LEN, KNET_INTF_COUNT, knet_intf_count, NETMASK_LEN, NULL, OPENNSL_E_NONE, OPENNSL_KNET_NETIF_NAME_MAX, and port().
Referenced by main().
void example_knet_intf_delete | ( | int | unit | ) |
Definition at line 345 of file example_knet.c.
References example_read_user_string(), KNET_INTF_COUNT, knet_intf_count, NULL, opennsl_errmsg, opennsl_knet_filter_destroy(), opennsl_knet_netif_destroy(), and OPENNSL_KNET_NETIF_NAME_MAX.
Referenced by main().
int example_linux_interface_create | ( | int | unit, |
int | port, | ||
char * | ifName | ||
) |
Definition at line 178 of file example_knet.c.
References opennsl_knet_filter_s::dest_id, opennsl_knet_filter_s::dest_type, example_knet_database_update(), opennsl_knet_filter_s::flags, opennsl_knet_netif_s::id, opennsl_knet_filter_s::id, opennsl_knet_filter_s::m_ingport, opennsl_knet_netif_s::mac_addr, opennsl_knet_filter_s::match_flags, opennsl_knet_netif_s::name, OPENNSL_KNET_DEST_T_NETIF, opennsl_knet_filter_create(), OPENNSL_KNET_FILTER_F_STRIP_TAG, OPENNSL_KNET_FILTER_M_INGPORT, opennsl_knet_filter_t_init(), OPENNSL_KNET_FILTER_T_RX_PKT, opennsl_knet_netif_create(), opennsl_knet_netif_t_init(), OPENNSL_KNET_NETIF_T_TX_LOCAL_PORT, opennsl_knet_netif_s::port, port(), opennsl_knet_filter_s::priority, opennsl_knet_netif_s::type, and opennsl_knet_filter_s::type.
Referenced by example_knet_intf_create().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Main function for KNET sample application.
argc,argv | commands line arguments |
Definition at line 404 of file example_knet.c.
References opennsl_port_config_s::cpu, DEFAULT_UNIT, DEFAULT_VLAN, example_knet_database_show(), example_knet_intf_create(), example_knet_intf_delete(), 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_FAILURE, opennsl_port_config_get(), opennsl_rx_active(), opennsl_rx_start(), and opennsl_vlan_port_add().
char example_usage[] |
Definition at line 49 of file example_knet.c.
knet_if_data_t knet_if_data[KNET_INTF_COUNT] |
Definition at line 84 of file example_knet.c.
int knet_intf_count = 0 |
Definition at line 85 of file example_knet.c.
Referenced by example_knet_database_show(), example_knet_database_update(), example_knet_intf_create(), and example_knet_intf_delete().