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