]> git.ipfire.org Git - thirdparty/squid.git/blob - include/snmp_pdu.h
Bug 3676: Fix Shadowed variables
[thirdparty/squid.git] / include / snmp_pdu.h
1 #ifndef SQUID_SNMP_PDU_H
2 #define SQUID_SNMP_PDU_H
3
4 /* required for oid typedef */
5 #include "asn1.h"
6
7 #if HAVE_NETINET_IN_H
8 /* required for sockaddr_in definition */
9 #include <netinet/in.h>
10 #endif
11
12 /**********************************************************************
13 *
14 * Copyright 1997 by Carnegie Mellon University
15 *
16 * All Rights Reserved
17 *
18 * Permission to use, copy, modify, and distribute this software and its
19 * documentation for any purpose and without fee is hereby granted,
20 * provided that the above copyright notice appear in all copies and that
21 * both that copyright notice and this permission notice appear in
22 * supporting documentation, and that the name of CMU not be
23 * used in advertising or publicity pertaining to distribution of the
24 * software without specific, written prior permission.
25 *
26 * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
27 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
28 * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
29 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
31 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
32 * SOFTWARE.
33 *
34 * Author: Ryan Troll <ryan+@andrew.cmu.edu>
35 *
36 **********************************************************************/
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 /* An SNMP PDU */
43 struct snmp_pdu {
44 int command; /* Type of this PDU */
45 struct sockaddr_in address; /* Address of peer */
46
47 int reqid; /* Integer32: Request id */
48 int errstat; /* INTEGER: Error status */
49 int errindex; /* INTEGER: Error index */
50
51 /* SNMPv2 Bulk Request */
52 int non_repeaters; /* INTEGER: */
53 int max_repetitions; /* INTEGER: */
54
55 struct variable_list *variables; /* Variable Bindings */
56
57 /* Trap information */
58 oid *enterprise; /* System OID */
59 int enterprise_length;
60 struct sockaddr_in agent_addr; /* address of object generating trap */
61 int trap_type; /* generic trap type */
62 int specific_type; /* specific type */
63 u_int time; /* Uptime */
64 };
65
66 struct snmp_pdu *snmp_pdu_create(int);
67 struct snmp_pdu *snmp_pdu_clone(struct snmp_pdu *);
68 struct snmp_pdu *snmp_pdu_fix(struct snmp_pdu *, int);
69 struct snmp_pdu *snmp_fix_pdu(struct snmp_pdu *, int);
70 void snmp_free_pdu(struct snmp_pdu *);
71 void snmp_pdu_free(struct snmp_pdu *);
72
73 u_char *snmp_pdu_encode(u_char *, int *, struct snmp_pdu *);
74 u_char *snmp_pdu_decode(u_char *, int *, struct snmp_pdu *);
75
76 /* Add a NULL Variable to a PDU */
77 void snmp_add_null_var(struct snmp_pdu *, oid *, int);
78
79 /* RFC 1905: Protocol Operations for SNMPv2
80 *
81 * RFC 1157: A Simple Network Management Protocol (SNMP)
82 *
83 * PDU Types
84 */
85 #define SNMP_PDU_GET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0)
86 #define SNMP_PDU_GETNEXT (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1)
87 #define SNMP_PDU_RESPONSE (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2)
88 #ifdef UNUSED_CODE
89 #define SNMP_PDU_SET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3)
90 #define TRP_REQ_MSG (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /*Obsolete */
91 #endif
92 #define SNMP_PDU_GETBULK (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5)
93 #ifdef UNUSED_CODE
94 #define SNMP_PDU_INFORM (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6)
95 #define SNMP_PDU_V2TRAP (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7)
96 #define SNMP_PDU_REPORT (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8)
97 #endif
98 #define MAX_BINDINGS 2147483647 /* PDU Defaults */
99 #define SNMP_DEFAULT_ERRSTAT -1
100 #define SNMP_DEFAULT_ERRINDEX -1
101 #define SNMP_DEFAULT_ADDRESS 0
102 #define SNMP_DEFAULT_REQID 0
103
104 /* RFC 1907: Management Information Base for SNMPv2
105 *
106 * RFC 1157: A Simple Network Management Protocol (SNMP)
107 *
108 * Trap Types
109 */
110 #if UNUSED_CODE
111 #define SNMP_TRAP_COLDSTART (0x0)
112 #define SNMP_TRAP_WARMSTART (0x1)
113 #define SNMP_TRAP_LINKDOWN (0x2)
114 #define SNMP_TRAP_LINKUP (0x3)
115 #define SNMP_TRAP_AUTHENTICATIONFAILURE (0x4)
116 #define SNMP_TRAP_EGPNEIGHBORLOSS (0x5)
117 #define SNMP_TRAP_ENTERPRISESPECIFIC (0x6)
118 #endif
119
120 #ifdef __cplusplus
121 }
122 #endif
123
124 #endif /* SQUID_SNMP_PDU_H */