22
31
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
23
32
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
26
35
* Author: Ryan Troll <ryan+@andrew.cmu.edu>
28
* $Id: snmp_pdu.h,v 1.11 2003/01/23 00:36:48 robertc Exp $
30
39
**********************************************************************/
36
typedef struct sockaddr_in ipaddr;
40
int command; /* Type of this PDU */
41
ipaddr address; /* Address of peer */
43
int reqid; /* Integer32: Request id */
44
int errstat; /* INTEGER: Error status */
45
int errindex; /* INTEGER: Error index */
47
/* SNMPv2 Bulk Request */
48
int non_repeaters; /* INTEGER: */
49
int max_repetitions; /* INTEGER: */
51
struct variable_list *variables; /* Variable Bindings */
53
/* Trap information */
54
oid *enterprise; /* System OID */
55
int enterprise_length;
56
ipaddr agent_addr; /* address of object generating trap */
57
int trap_type; /* generic trap type */
58
int specific_type; /* specific type */
59
u_int time; /* Uptime */
62
struct snmp_pdu *snmp_pdu_create(int);
63
struct snmp_pdu *snmp_pdu_clone(struct snmp_pdu *);
64
struct snmp_pdu *snmp_pdu_fix(struct snmp_pdu *, int);
65
struct snmp_pdu *snmp_fix_pdu(struct snmp_pdu *, int);
66
void snmp_free_pdu(struct snmp_pdu *);
67
void snmp_pdu_free(struct snmp_pdu *);
69
u_char *snmp_pdu_encode(u_char *, int *, struct snmp_pdu *);
70
u_char *snmp_pdu_decode(u_char *, int *, struct snmp_pdu *);
46
typedef struct sockaddr_in ipaddr;
50
int command; /* Type of this PDU */
51
ipaddr address; /* Address of peer */
53
int reqid; /* Integer32: Request id */
54
int errstat; /* INTEGER: Error status */
55
int errindex; /* INTEGER: Error index */
57
/* SNMPv2 Bulk Request */
58
int non_repeaters; /* INTEGER: */
59
int max_repetitions; /* INTEGER: */
61
struct variable_list *variables; /* Variable Bindings */
63
/* Trap information */
64
oid *enterprise; /* System OID */
65
int enterprise_length;
66
ipaddr agent_addr; /* address of object generating trap */
67
int trap_type; /* generic trap type */
68
int specific_type; /* specific type */
69
u_int time; /* Uptime */
72
struct snmp_pdu *snmp_pdu_create(int);
73
struct snmp_pdu *snmp_pdu_clone(struct snmp_pdu *);
74
struct snmp_pdu *snmp_pdu_fix(struct snmp_pdu *, int);
75
struct snmp_pdu *snmp_fix_pdu(struct snmp_pdu *, int);
76
void snmp_free_pdu(struct snmp_pdu *);
77
void snmp_pdu_free(struct snmp_pdu *);
79
u_char *snmp_pdu_encode(u_char *, int *, struct snmp_pdu *);
80
u_char *snmp_pdu_decode(u_char *, int *, struct snmp_pdu *);
72
82
/* Add a NULL Variable to a PDU */
73
void snmp_add_null_var(struct snmp_pdu *, oid *, int);
83
void snmp_add_null_var(struct snmp_pdu *, oid *, int);
75
/* RFC 1905: Protocol Operations for SNMPv2
77
* RFC 1157: A Simple Network Management Protocol (SNMP)
85
/* RFC 1905: Protocol Operations for SNMPv2
87
* RFC 1157: A Simple Network Management Protocol (SNMP)
81
91
#define SNMP_PDU_GET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0)
82
92
#define SNMP_PDU_GETNEXT (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1)
83
93
#define SNMP_PDU_RESPONSE (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2)