OpenNSL API Guide and Reference Manual
Data Structures | Files | Macros | Typedefs | Functions
Initialization

Data Structures

struct  opennsl_info_s
 OPENNSL Information structure. More...
 

Files

file  init.h
 
file  initX.h
 

Macros

#define _opennsl_shutdown(unit)   OPENNSL_E_NONE
 

Typedefs

typedef struct opennsl_info_s opennsl_info_t
 OPENNSL Information structure.
 

Functions

int opennsl_attach (int unit, char *type, char *subtype, int remunit) LIB_DLL_EXPORTED
 Attach a device as a OPENNSL unit.
 
int opennsl_attach_check (int unit) LIB_DLL_EXPORTED
 Determine if a OPENNSL unit is attached.
 
int opennsl_attach_max (int *max_units) LIB_DLL_EXPORTED
 Determine the highest OPENNSL unit currently attached.
 
int opennsl_detach (int unit) LIB_DLL_EXPORTED
 Detach a device as a OPENNSL unit.
 
int opennsl_info_get (int unit, opennsl_info_t *info) LIB_DLL_EXPORTED
 Get information about a OPENNSL unit.
 
void opennsl_info_t_init (opennsl_info_t *info) LIB_DLL_EXPORTED
 Initialize the OPENNSL Information structure.
 

Detailed Description

Macro Definition Documentation

#define _opennsl_shutdown (   unit)    OPENNSL_E_NONE

Definition at line 146 of file init.h.

Typedef Documentation

OPENNSL Information structure.

Function Documentation

int opennsl_attach ( int  unit,
char *  type,
char *  subtype,
int  remunit 
)

Attach a device as a OPENNSL unit.

Description
Create a OPENNSL unit instance. If the unit parameter is non-negative, use that value as the unit number for the attached device. Otherwise, search for an unused OPENNSL unit number. If the type parameter is NULL, then search for an appropriate dispatch driver.
Parameters
unit[IN] Unit number.
type[IN] Type of OPENNSL API dispatch driver
subtype[IN] Argument to dispatch driver
remunit[IN] Underlying remote unit
Return values
unitthe attached non-negative unit number (if successful)
OPENNSL_E_MEMORYmemory allocation failure
OPENNSL_E_CONFIGdispatch driver not found
OPENNSL_E_FULLno available unit numbers
OPENNSL_E_EXISTSrequested unit number already attached
OPENNSL_E_XXX
int opennsl_attach_check ( int  unit)

Determine if a OPENNSL unit is attached.

Parameters
unit[IN] Unit number.
Return values
OPENNSL_E_UNITunit is not attached
OPENNSL_E_NONEunit is attached
int opennsl_attach_max ( int *  max_units)

Determine the highest OPENNSL unit currently attached.

Description
The parameter is filled with the highest currently attached unit number. If no OPENNSL units are attached, then -1 will be stored through the parameter.
Parameters
max_units[OUT] highest unit number
Return values
OPENNSL_E_NONE

Referenced by main().

int opennsl_detach ( int  unit)

Detach a device as a OPENNSL unit.

Description
Destroy a OPENNSL unit instance. The unit is removed from the list of OPENNSL dispatchable units. Detaching a unit does not affect the underlying device if it was attached as a loopback or remote unit. This API is not thread-safe. In a multi-threaded environment where multiple threads may be calling various OPENNSL APIs, it is recommended that such threads be stopped before invoking opennsl_detach().
Parameters
unit[IN] Unit number.
Return values
OPENNSL_E_XXX
int opennsl_info_get ( int  unit,
opennsl_info_t info 
)

Get information about a OPENNSL unit.

Description
The OPENNSL device information structure given as an argument is filled in for the OPENNSL unit.
Parameters
unit[IN] Unit number.
info[OUT] OPENNSL information structure, as defined in =opennsl_info_t
Return values
OPENNSL_E_XXX

Referenced by example_create_meter(), example_is_dnx_device(), example_is_qmx_device(), init_portmap(), and main().

void opennsl_info_t_init ( opennsl_info_t info)

Initialize the OPENNSL Information structure.

Description
Initializes OPENNSL Information structure to default values. This function should be used to initialize any OPENNSL Information structure prior to filling it out and passing it to an API function. This ensures that subsequent API releases may add new structure members to the opennsl_info_t structure, and opennsl_info_t_init will initialize the new members to correct default values.
Parameters
info[IN,OUT] Pointer to OPENNSL Information structure.
Return values
None.