VxWorks Reference Manual : Libraries

snmpIoLib

NAME

snmpIoLib - default transport routines for SNMP

ROUTINES

snmpIoInit( ) - initialization routine for SNMP transport endpoint
snmpIoWrite( ) - write a packet to the transport
snmpIoClose( ) - close the transport endpoint.
snmpIoMain( ) - main SNMP I/O routine
snmpIoTrapSend( ) - send a standard SNMP or MIB-II trap
snmpIoCommunityValidate( ) - sample community validation routine
snmpdMemoryAlloc( ) - allocate memory for the SNMP agent
snmpdMemoryFree( ) - free memory allocated by the SNMP agent

DESCRIPTION

This module implements the SNMP v1/v2c transport-dependent routines.

INCLUDE FILES

snmpdIoLib.h

SEE ALSO

snmpIoLib


Libraries : Routines

snmpIoInit( )

NAME

snmpIoInit( ) - initialization routine for SNMP transport endpoint

SYNOPSIS


STATUS snmpIoInit (void)

DESCRIPTION

This is the routine to be called to initialize the transport endpoint used by the SNMP agent. This routine is invoked from snmpIoMain( ). This implementation is for a socket based system. It will also call the masterIoInit( ) routine to create the IPC mechanism for the master agent.

GLOBALS

snmpSocket

RETURNS

ERROR if unable to create bound socket else OK.

SEE ALSO

snmpIoLib, snmpIoMain( )


Libraries : Routines

snmpIoWrite( )

NAME

snmpIoWrite( ) - write a packet to the transport

SYNOPSIS

void snmpIoWrite
    (
    void * pSocket, /* Socket descriptor for SNMP */
    char * pBuf,    /* Encoded SNMP packet */
    int    bufSize, /* Size of the packet */
    void * pRemote, /* Remote address of manager */
    void * pLocal   /* Local address */
    )

DESCRIPTION

This routine writes a datagram to the socket. The routine calls sendto( ) with flags always set to 0. The local parameter is not used in this case, but exists for conformance with our transport-independent interface.

RETURNS

N/A

SEE ALSO

snmpIoLib, sendto( ) <(VxWorks Reference Manual) >


Libraries : Routines

snmpIoClose( )

NAME

snmpIoClose( ) - close the transport endpoint.

SYNOPSIS


void snmpIoClose (void)

DESCRIPTION

This routine is invoked to deallocate the transport endpoint. It is invoked from the task deletion hook and also from snmpdExit( ).

RETURNS

N/A

SEE ALSO

snmpIoLib


Libraries : Routines

snmpIoMain( )

NAME

snmpIoMain( ) - main SNMP I/O routine

SYNOPSIS



void snmpIoMain (void)

DESCRIPTION

This routine is invoked by the agent after it has successsfully completed the preliminary initializations. In this routine, the user is required to initialize the transport endpoint and the views, and then complete initialization of the agent by calling snmpdInitFinish( ). Any configuration required for snmpIoTrapSend( ) must be done before calling snmpdInitFinish( ) since it will be invoked in there. Any hooks that are required by the user must be passed to snmpdInitFinish( ). The transport endpoint must be initialized before snmpdInitFinish( ) is called; the main loop is then invoked. Before calling snmpIoBody( ), the routine which waits on the socket, it calls snmpMonitorSpawn( ) which spawns the master-agent task.

RETURNS

This routine should never return, except on failure.

SEE ALSO

snmpIoLib, snmpdInitFinish( )


Libraries : Routines

snmpIoTrapSend( )

NAME

snmpIoTrapSend( ) - send a standard SNMP or MIB-II trap

SYNOPSIS

void snmpIoTrapSend
    (
    int trapType,    /* Type of the trap */
    int trapSpecific /* User defined specifics */
    )

DESCRIPTION

This routine sends a standard SNMP or MIB-II trap message to the network. It is called by the SNMP agent at startup (to indicate a cold start) and when interface states change. It takes two arguments: trapType, the trap type, and trapSpecific, the user-defined specifics on this trap.

The agent designer must rewrite this according to specific transport needs.

RETURNS

N/A

SEE ALSO

snmpIoLib, snmpdTrapSend( )


Libraries : Routines

snmpIoCommunityValidate( )

NAME

snmpIoCommunityValidate( ) - sample community validation routine

SYNOPSIS

int snmpIoCommunityValidate
    (
    SNMP_PKT_T * pPkt,        /* ptr to snmp pkt */
    SNMPADDR_T * pRemoteAddr, /* remote address */
    SNMPADDR_T * pLocalAddr   /* local address */
    )

DESCRIPTION

This routine is used to set up the view-index field in the SNMP packet. This product is shipped with defaults such that the "priv" community is allowed to set variables, and the "pub" community is allowed to get variables.

The agent designer is required to write this function according to the design of the application.

RETURNS

0 if the community is acceptable, otherwise 1.

SEE ALSO

snmpIoLib


Libraries : Routines

snmpdMemoryAlloc( )

NAME

snmpdMemoryAlloc( ) - allocate memory for the SNMP agent

SYNOPSIS

void * snmpdMemoryAlloc
    (
    size_t size /* size of memory to be allocated */
    )

DESCRIPTION

This routine allocates memory for the SNMP agent. The required size of the block is passed in size. This memory must be deallocated later with snmpdMemoryFree( ).

RETURNS

a pointer to the allocated buffer on success, otherwise NULL.

SEE ALSO

snmpIoLib, snmpdMemoryFree( )


Libraries : Routines

snmpdMemoryFree( )

NAME

snmpdMemoryFree( ) - free memory allocated by the SNMP agent

SYNOPSIS

void snmpdMemoryFree
    (
    void * pBuf /* buffer to free */
    )

DESCRIPTION

This routine deallocates memory which was previously allocated by the SNMP agent with snmpdMemoryAlloc( ).

RETURNS

N/A

SEE ALSO

snmpIoLib, snmpdMemoryAlloc( )