SNMP Manager Programmer's Guide
Constructing and Interpreting Packets
SNMP Manager Programmer’s Guide–134249
5-14
SNMP_Create_Trap()
SNMP_Create_Trap()
This function initializes a trap packet. It dynamically allocates memory for a packet 
structure of type SNMP_PKT_T, assigns to it all trap packet variables except variable 
bindings, and returns a pointer to the structure. To associate variable bindings with the 
packet, use the functions defined in Functions for Binding MIB Objects
 on page 5-17. 
To deallocate memory used by a trap packet you no longer need, use SNMP_Free(), 
described in Function for Releasing Packet Memory on page 5-33. 
packet
is a pointer to a structure of type SNMP_PKT_T if the function succeeds or 0 if it 
fails.
version
is one of the following defines, all of which equate to 0, indicating Version 1 of 
SNMP:
VERSION_RFC1067
VERSION_RFC1098
VERSION_RFC1157
SNMP_VERSION_1
community-length
is the number of bytes in the community identifier to which community-
identifier points.
packet = SNMP_Create_Trap(version, 
 community-length,
 community-identifier,
 enterprise-count,
 enterprise-components, 
 address,
 generic-trap,
 specific-trap;
 timestamp,
 num-varbinds);
SNMP_PKT_T* SNMP_Create_Trap(int version,
 int community-length,
 char *community-identifier,
 int enterprise-count,
 OIDC_T *enterprise-
components,
 OCTET_T *address,
 int generic-trap,
 INT_32_T specific-trap,
 UINT_32_T timestamp,
 int num-varbinds);










