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