[Previous] [Contents] [Index] [Next]

Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

snmp_pdu

Structure that describes an SNMP Protocol Data Unit (transaction)

Synopsis:

#include <snmp/snmp_api.h>

struct snmp_pdu {
    int version;
    ipaddr address;
    oid * srcParty;
    int srcPartyLen;
    oid * dstParty;
    int dstPartyLen;
    oid * context;
    int contextLen;
    u_char * community;
    int community_len;
    int command;
    long reqid;
    long errstat;
    long errindex;

    /* Trap information */
    oid * enterprise;
    int enterprise_length;
    ipaddr agent_addr;
    int trap_type;
    int specific_type;
    u_long time;

    struct variable_list * variables;
};

Description:

The snmp_pdu structure describes a Protocol Data Unit (PDU), a transaction that's performed over an open session. It contains the headers and variables of an SNMP packet. The structure includes the following members:

version
The version of SNMP: either SNMP_VERSION_1 or SNMP_VERSION_2.
address
The destination IP address.
srcParty
The source party being used.
srcPartyLen
The number of object identifier (OID) elements in srcParty. For example, if srcParty is .1.3.6, the length is 3.
dstParty
The destination party being used.
dstPartyLen
The number of OID elements in dstParty.
context
The context being used.
contextLen
The number of OID elements in context.
community
The community for outgoing requests.
community_len
The length of the community name.
command
The type of this PDU.
reqid
The request ID. The default is SNMP_DEFAULT_REQID (0).
errstat
The error status (non_repeaters in GetBulk). The default is SNMP_DEFAULT_ERRSTAT (-1).
errindex
The error index (max_repetitions in GetBulk). The default is SNMP_DEFAULT_ERRINDEX (-1).
enterprise
The system OID.
enterprise_length
The number of OID elements in enterprise. The default is SNMP_DEFAULT_ENTERPRISE_LENGTH (0).
agent_addr
The address of the object generating the trap.
trap_type
The trap type.
specific_type
The specific type.
time
The up time. The default is SNMP_DEFAULT_TIME (0).
variables
A linked list of variables, of type variable_list.

The variable_list structure is defined as:

typedef    struct    sockaddr_in ipaddr;

struct variable_list {
    struct variable_list* next_variable;
    oid*       name;
    int        name_length;
    u_char     type;
    union { 
        long*     integer;
        u_char*   string;
        oid*      objid;
        u_char*   bitstring;
        struct counter64* counter64;
    } val;
    int        val_len;
};

The members are:

next_variable
A pointer to the next variable. This is NULL for the last variable in the list.
name
The object identifier of the variable.
name_length
The number of sub IDs in name.
type
The ASN type of variable.
val.integer
The value of the variable if it's an integer.
val.string
The value of the variable if it's a string.
val.objid
The value of the variable if it's an object ID.
bitstring
The value of the variable if it's a bitstring.
counter64
The value of the variable if it's a counter64.
val_len
The length of the value.

Classification:

SNMP

See also:

snmp_close(), snmp_free_pdu(), snmp_open(), snmp_pdu_create(), snmp_read(), snmp_send(), snmp_session

RFC 1157, FAQ in Internet newsgroup comp.protocols.snmp

Marshall T. Rose, The Simple Book: An Introduction to Internet Management, Revised 2nd ed. (Prentice-Hall, 1996, ISBN 0-13-451659-1)


[Previous] [Contents] [Index] [Next]