This file is indexed.

/usr/include/gsnmp/pdu.h is in libgsnmp0-dev 0.3.0-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
/*
 * GNET-SNMP -- glib-based SNMP library
 *
 * Copyright (c) 2003 Juergen Schoenwaelder
 * Copyright (c) 1998 Gregory McLean & Jochen Friedrich
 * Copyright (c) 1990 Dirk Wisse
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * $Id: pdu.h 1992 2006-08-22 12:48:31Z schoenw $
 */

#ifndef __GNET_SNMP_PDU_H__
#define __GNET_SNMP_PDU_H__

#include "ber.h"

#define GNET_SNMP_SIZE_OBJECTID		(128)

/*
 * Distinguished SNMP varbind types as defined in RFC 3416.
 */

typedef enum {
    GNET_SNMP_VARBIND_TYPE_NULL		  = 0,
    GNET_SNMP_VARBIND_TYPE_OCTETSTRING	  = 1,
    GNET_SNMP_VARBIND_TYPE_OBJECTID	  = 2,
    GNET_SNMP_VARBIND_TYPE_IPADDRESS	  = 3,
    GNET_SNMP_VARBIND_TYPE_INTEGER32	  = 4,
    GNET_SNMP_VARBIND_TYPE_UNSIGNED32	  = 5,	/* also Gauge32 */
    GNET_SNMP_VARBIND_TYPE_COUNTER32	  = 6,
    GNET_SNMP_VARBIND_TYPE_TIMETICKS	  = 7,
    GNET_SNMP_VARBIND_TYPE_OPAQUE	  = 8,
    GNET_SNMP_VARBIND_TYPE_COUNTER64	  = 9,
    GNET_SNMP_VARBIND_TYPE_NOSUCHOBJECT   = 10,
    GNET_SNMP_VARBIND_TYPE_NOSUCHINSTANCE = 11,
    GNET_SNMP_VARBIND_TYPE_ENDOFMIBVIEW   = 12
} GNetSnmpVarBindType;

typedef struct  _GNetSnmpVarBind	GNetSnmpVarBind;

struct _GNetSnmpVarBind
{
    guint32		*oid;		/* name of the variable */
    gsize		oid_len;	/* length of the name */
    GNetSnmpVarBindType	type;		/* variable type / exception */
    union {
	gint32   i32;			/* 32 bit signed   */
	guint32  ui32;			/* 32 bit unsigned */
	gint64   i64;			/* 64 bit signed   */
	guint64  ui64;			/* 64 bit unsigned */
	guint8  *ui8v;			/*  8 bit unsigned vector */
	guint32 *ui32v;			/* 32 bit unsigned vector */
    }			value;		/* value of the variable */
    gsize		value_len;	/* length of a vector in bytes */
};

GNetSnmpVarBind* gnet_snmp_varbind_new	(const guint32 *oid,
					 const gsize oid_len,
					 const GNetSnmpVarBindType type,
					 const gpointer value,
					 const gsize value_len);
void     gnet_snmp_varbind_delete	(GNetSnmpVarBind *vb);

gboolean gnet_snmp_ber_enc_varbind	(GNetSnmpBer *ber,
					 GNetSnmpVarBind *vb,
					 GError **error);
gboolean gnet_snmp_ber_enc_varbind_null	(GNetSnmpBer *ber,
					 GNetSnmpVarBind *vb,
					 GError **error);
gboolean gnet_snmp_ber_dec_varbind	(GNetSnmpBer *ber,
					 GNetSnmpVarBind **vb,
					 GError **error);

/*
 * SNMP VarBindLists are represented as GLists of GNetSnmpVarBinds.
 * This allows us to use all the nice GList functions to manipulate
 * and navigate SNMP VarBindLists.
 */

gboolean gnet_snmp_ber_enc_varbind_list	(GNetSnmpBer *ber,
					 GList *list,
					 GError **error);

gboolean gnet_snmp_ber_enc_varbind_list_null(GNetSnmpBer *ber,
					     GList *list,
					     GError **error);

gboolean gnet_snmp_ber_dec_varbind_list	(GNetSnmpBer *ber,
					 GList **list,
					 GError **error);

/*
 * SNMP protocol operations as defined in RFC 3416.
 */

typedef enum {
    GNET_SNMP_PDU_GET		= 0,
    GNET_SNMP_PDU_NEXT		= 1,
    GNET_SNMP_PDU_RESPONSE	= 2,
    GNET_SNMP_PDU_SET		= 3,
    GNET_SNMP_PDU_TRAP		= 4,
    GNET_SNMP_PDU_BULK		= 5,
    GNET_SNMP_PDU_INFORM	= 6
} GNetSnmpPduType;

/*
 * SNMP protocol operation classes as defined in RFC 3411.
 */

#define GNET_SNMP_PDU_CLASS_READ(p) \
	(p == GNET_SNMP_PDU_GET || \
         p == GNET_SNMP_PDU_NEXT || \
         p == GNET_SNMP_PDU_BULK)

#define GNET_SNMP_PDU_CLASS_WRITE(p) \
	(p == GNET_SNMP_PDU_SET)

#define GNET_SNMP_PDU_CLASS_RESPONSE(p) \
	(p == GNET_SNMP_PDU_RESPONSE)

#define GNET_SNMP_PDU_CLASS_NOTIFICATION(p) \
	(p == GNET_SNMP_PDU_TRAP || p == GNET_SNMP_PDU_INFORM)

/*
 * SNMP protocol error codes as defined in RFC 3416.
 * Negative error codes are GNET-SNMP internal codes.
 */

typedef enum {
    GNET_SNMP_PDU_ERR_DONE		    = -4,
    GNET_SNMP_PDU_ERR_PROCEDURE		    = -3,
    GNET_SNMP_PDU_ERR_INTERNAL		    = -2,
    GNET_SNMP_PDU_ERR_NORESPONSE	    = -1,
    GNET_SNMP_PDU_ERR_NOERROR		    = 0,
    GNET_SNMP_PDU_ERR_TOOBIG                = 1,
    GNET_SNMP_PDU_ERR_NOSUCHNAME            = 2,
    GNET_SNMP_PDU_ERR_BADVALUE              = 3,
    GNET_SNMP_PDU_ERR_READONLY              = 4,
    GNET_SNMP_PDU_ERR_GENERROR              = 5,
    GNET_SNMP_PDU_ERR_NOACCESS              = 6,
    GNET_SNMP_PDU_ERR_WRONGTYPE             = 7,
    GNET_SNMP_PDU_ERR_WRONGLENGTH           = 8,
    GNET_SNMP_PDU_ERR_WRONGENCODING         = 9,
    GNET_SNMP_PDU_ERR_WRONGVALUE            = 10,
    GNET_SNMP_PDU_ERR_NOCREATION            = 11,
    GNET_SNMP_PDU_ERR_INCONSISTENTVALUE     = 12,
    GNET_SNMP_PDU_ERR_RESOURCEUNAVAILABLE   = 13,
    GNET_SNMP_PDU_ERR_COMMITFAILED          = 14,
    GNET_SNMP_PDU_ERR_UNDOFAILED            = 15,
    GNET_SNMP_PDU_ERR_AUTHORIZATIONERROR    = 16,
    GNET_SNMP_PDU_ERR_NOTWRITABLE           = 17,
    GNET_SNMP_PDU_ERR_INCONSISTENTNAME      = 18
} GNetSnmpPduError;

/*
 * SNMPv1 trap PDUs have a slightly different format. This library
 * implements the notification mappings defined in RFC 2576 so that
 * applications will always see the SNMPv2c/SNMPv3 notification PDU
 * format. Also note that the GNetSnmpPdu represents a scoped PDU as
 * defined in RFC 3411 and RFC 3412.
 */

typedef struct _GNetSnmpPdu	GNetSnmpPdu;

struct _GNetSnmpPdu {
    guchar	   *context_engineid;
    gsize	    context_engineid_len;
    guchar         *context_name;
    gsize           context_name_len;
    GNetSnmpPduType type;
    gint32          request_id;
    gint32          error_status;	/* holds a GNetSnmpError */
    gint32          error_index;
    GList          *varbind_list;
};

/*
 * The following encoding/decoding functions are for the different SNMP
 * protocol versions supported by this library.
 */

gboolean gnet_snmp_ber_enc_pdu_v1	(GNetSnmpBer *ber, GNetSnmpPdu *pdu,
					 GError **error);
gboolean gnet_snmp_ber_dec_pdu_v1	(GNetSnmpBer *ber, GNetSnmpPdu *pdu,
					 GError **error);
gboolean gnet_snmp_ber_enc_pdu_v2	(GNetSnmpBer *ber, GNetSnmpPdu *pdu,
					 GError **error);
gboolean gnet_snmp_ber_dec_pdu_v2	(GNetSnmpBer *ber, GNetSnmpPdu *pdu,
					 GError **error);
gboolean gnet_snmp_ber_enc_pdu_v3	(GNetSnmpBer *ber, GNetSnmpPdu *pdu,
					 GError **error);
gboolean gnet_snmp_ber_dec_pdu_v3	(GNetSnmpBer *ber, GNetSnmpPdu *pdu,
					 GError **error);

/* ------------------------ stuff we should get rid off ----------------- */


/* SNMP hooks for debugging, profiling, statistics, ... */

extern void (*g_snmp_list_decode_hook)(GList *list);
extern void (*g_snmp_list_encode_hook)(GList *list);

#endif /* __GNET_SNMP_PDU_H__ */