File: snmp_vars.h

package info (click to toggle)
squid 2.6.5-6etch5
  • links: PTS
  • area: main
  • in suites: etch
  • size: 12,540 kB
  • ctags: 13,801
  • sloc: ansic: 105,278; sh: 6,083; makefile: 1,297; perl: 1,245; awk: 40
file content (76 lines) | stat: -rw-r--r-- 3,100 bytes parent folder | download | duplicates (7)
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
#ifndef SQUID_SNMP_VARS_H
#define SQUID_SNMP_VARS_H

/**********************************************************************
 *
 *           Copyright 1997 by Carnegie Mellon University
 * 
 *                       All Rights Reserved
 * 
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose and without fee is hereby granted,
 * provided that the above copyright notice appear in all copies and that
 * both that copyright notice and this permission notice appear in
 * supporting documentation, and that the name of CMU not be
 * used in advertising or publicity pertaining to distribution of the
 * software without specific, written prior permission.
 * 
 * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
 * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 * SOFTWARE.
 * 
 * Author: Ryan Troll <ryan+@andrew.cmu.edu>
 * 
 * $Id: snmp_vars.h,v 1.11 2001/10/08 16:18:31 hno Exp $
 * 
 **********************************************************************/

struct variable_list {
    struct variable_list *next_variable;	/* NULL for last variable */
    oid *name;			/* Object identifier of variable */
    int name_length;		/* number of subid's in name */
    u_char type;		/* ASN type of variable */
    union {			/* value of variable */
	int *integer;
	u_char *string;
	oid *objid;
    } val;
    int val_len;
};

struct variable_list *snmp_var_new(oid *, int);
struct variable_list *snmp_var_new_integer(oid *, int, int, unsigned char);
struct variable_list *snmp_var_clone(struct variable_list *);
void snmp_var_free(struct variable_list *);

u_char *snmp_var_EncodeVarBind(u_char *, int *, struct variable_list *, int);
u_char *snmp_var_DecodeVarBind(u_char *, int *, struct variable_list **, int);

#define MAX_NAME_LEN	64	/* number of subid's in a objid */

/* RFC 1902: Structure of Management Information for SNMPv2
 *
 * Defined Types
 */
#define SMI_INTEGER     ASN_INTEGER
#define SMI_STRING      ASN_OCTET_STR
#define SMI_OBJID       ASN_OBJECT_ID
#define SMI_NULLOBJ     ASN_NULL
#define SMI_IPADDRESS  (ASN_APPLICATION | 0)	/* OCTET STRING, net byte order */
#define SMI_COUNTER32  (ASN_APPLICATION | 1)	/* INTEGER */
#define SMI_GAUGE32    (ASN_APPLICATION | 2)	/* INTEGER */
#define SMI_UNSIGNED32 SMI_GAUGE32
#define SMI_TIMETICKS  (ASN_APPLICATION | 3)	/* INTEGER */
#define SMI_OPAQUE     (ASN_APPLICATION | 4)	/* OCTET STRING */
#define SMI_COUNTER64  (ASN_APPLICATION | 6)	/* INTEGER */
#define SMI_NOSUCHOBJECT   (ASN_CONTEXT | ASN_PRIMITIVE | 0x0)
#define SMI_NOSUCHINSTANCE (ASN_CONTEXT | ASN_PRIMITIVE | 0x1)
#define SMI_ENDOFMIBVIEW   (ASN_CONTEXT | ASN_PRIMITIVE | 0x2)
typedef struct variable variable;
typedef struct variable_list variable_list;

#endif /* SQUID_SNMP_VARS_H */