Structure Definition
struct snmp_dpi_hdr {
unsigned char proto_major; /* always 2: SNMP_DPI_PROTOCOL*/
unsigned char proto_version; /* DPI version */
unsigned char proto_release; /* DPI release */
unsigned short packet_id; /* 16-bit, DPI packet ID */
unsigned char packet_type; /* DPI packet type */
union {
snmp_dpi_reg_packet *reg_p;
snmp_dpi_ureg_packet *ureg_p;
snmp_dpi_get_packet *get_p;
snmp_dpi_next_packet *next_p;
snmp_dpi_next_packet *bulk_p;
snmp_dpi_set_packet *set_p;
snmp_dpi_resp_packet *resp_p;
snmp_dpi_trap_packet *trap_p;
snmp_dpi_open_packet *open_p;
snmp_dpi_close_packet *close_p;
unsigned char *any_p;
} data_u;
};
typedef struct snmp_dpi_hdr snmp_dpi_hdr;
#define snmp_dpi_hdr_NULL_p ((snmp_dpi_hdr *)0)
Structure Members
proto_major
See DPI Packet Types for a list of currently defined DPI packet types
The fields proto_major, proto_version, proto_release, and packet_id are basically for DPI internal use. So the DPI programmer normally does not need to be concerned about them. If you work with an unreliable DPI "connection", such as UDP, you may want to use the packet_id field to ensure you are handling the correct packet.
Description
The snmp_dpi_hdr structure is the anchor of a DPI parse tree. At the subagent side, the snmp_dpi_hdr structure is normally created as a result of a call to pDPIpacket().
The DPI subagent programmer uses this structure to interrogate packets. Depending on the packet_type, the pointer to the chain of one or more packet_type specific structures that contain the actual packet data can be picked.
The storage for a DPI parse tree is always dynamically allocated. It is the responsibility of the caller to free this parse tree when it is no longer needed. You can use the fDPIparse() function to do that.
Note: Some mkDPIxxxx functions do free the parse tree that is passed to them. An example is the mkDPIpacket() function.
Related Information
The fDPIparse() Function The
pDPIpacket() Function
The snmp_dpi_close_packet Structure
The snmp_dpi_get_packet Structure
The snmp_dpi_next_packet Structure
The snmp_dpi_bulk_packet Structure
The snmp_dpi_resp_packet Structure
The snmp_dpi_set_packet Structure
The snmp_dpi_ureg_packet Structure