OpenNSL API Guide and Reference Manual
Macros | Functions | Variables
example_link_monitor.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sal/driver.h>
#include <opennsl/error.h>
#include <opennsl/vlan.h>
#include <opennsl/link.h>
#include <examples/util.h>

Go to the source code of this file.

Macros

#define DEFAULT_UNIT   0
 
#define DEFAULT_VLAN   1
 
#define FALSE   0
 
#define LINK_MON_OFF   2
 
#define LINK_MON_ON   1
 
#define LINKMON_MAX_DOWN_PORTS   10
 
#define MAX_DIGITS_IN_CHOICE   5
 
#define TRUE   1
 

Functions

int main (int argc, char *argv[])
 Main function for link monitoring application.
 

Variables

int dport [LINKMON_MAX_DOWN_PORTS]
 
int dport_cnt
 
char example_usage []
 
int uport = -1
 
int verbose = 2
 

Macro Definition Documentation

#define DEFAULT_UNIT   0

Definition at line 55 of file example_link_monitor.c.

Referenced by main().

#define DEFAULT_VLAN   1

Definition at line 53 of file example_link_monitor.c.

#define FALSE   0

Definition at line 57 of file example_link_monitor.c.

#define LINK_MON_OFF   2

Definition at line 59 of file example_link_monitor.c.

Referenced by main().

#define LINK_MON_ON   1

Definition at line 58 of file example_link_monitor.c.

Referenced by main().

#define LINKMON_MAX_DOWN_PORTS   10

Definition at line 54 of file example_link_monitor.c.

Referenced by main().

#define MAX_DIGITS_IN_CHOICE   5

Definition at line 60 of file example_link_monitor.c.

#define TRUE   1

Definition at line 56 of file example_link_monitor.c.

Function Documentation

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

Main function for link monitoring application.

Parameters
argc,argvcommands line arguments
Returns
OPENNSL_E_XXX OpenNSL API return code

Definition at line 82 of file example_link_monitor.c.

References DEFAULT_UNIT, dport, dport_cnt, example_port_default_config(), example_read_user_choice(), example_usage, LINK_MON_OFF, LINK_MON_ON, LINKMON_MAX_DOWN_PORTS, NULL, opennsl_driver_exit(), opennsl_driver_init(), OPENNSL_E_NONE, OPENNSL_E_PARAM, opennsl_errmsg, uport, and verbose.

Variable Documentation

Definition at line 65 of file example_link_monitor.c.

Referenced by main().

int dport_cnt

Definition at line 66 of file example_link_monitor.c.

Referenced by main().

char example_usage[]
Initial value:
=
"Syntax: example_link_monitor uplink_port downlink_ports \n\r"
" \n\r"
"Paramaters: \n\r"
" uplink_port - Uplink port number to be monitored. \n\r"
" downlink_ports - List of ports that follow the link state \n\r"
" of uplink port. \n\r"
" Maximum of 10 ports supported. \n\r"
" \n\r"
"Example: The following command is used to configure ports 2 and 3 \n\r"
" to follow the link state of port 1. \n\r"
" example_link_monitor 1 2 3 \n\r"
" \n\r"
"Usage Guidelines: This program assumes that software linkscan \n\r"
" is enabled on the system. \n\r"

Definition at line 37 of file example_link_monitor.c.

int uport = -1

Definition at line 62 of file example_link_monitor.c.

Referenced by main().

int verbose = 2

Definition at line 69 of file example_link_monitor.c.