~ubuntu-branches/ubuntu/gutsy/net-snmp/gutsy-security

« back to all changes in this revision

Viewing changes to include/net-snmp/library/snmp_impl.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2004-09-13 12:06:21 UTC
  • Revision ID: james.westby@ubuntu.com-20040913120621-g952ntonlleihcvm
Tags: upstream-5.1.1
ImportĀ upstreamĀ versionĀ 5.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef SNMP_IMPL_H
 
2
#define SNMP_IMPL_H
 
3
 
 
4
#ifdef __cplusplus
 
5
extern          "C" {
 
6
#endif
 
7
    /*
 
8
     * * file: snmp_impl.h
 
9
     */
 
10
 
 
11
    /*
 
12
     * Definitions for SNMP implementation.
 
13
     *
 
14
     *
 
15
     */
 
16
/***********************************************************
 
17
        Copyright 1988, 1989 by Carnegie Mellon University
 
18
 
 
19
                      All Rights Reserved
 
20
 
 
21
Permission to use, copy, modify, and distribute this software and its 
 
22
documentation for any purpose and without fee is hereby granted, 
 
23
provided that the above copyright notice appear in all copies and that
 
24
both that copyright notice and this permission notice appear in 
 
25
supporting documentation, and that the name of CMU not be
 
26
used in advertising or publicity pertaining to distribution of the
 
27
software without specific, written prior permission.  
 
28
 
 
29
CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 
30
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
 
31
CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
 
32
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
 
33
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 
34
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 
35
SOFTWARE.
 
36
******************************************************************/
 
37
 
 
38
#include<stdio.h>
 
39
#include<net-snmp/types.h>      /* for 'u_char', etc */
 
40
 
 
41
#define COMMUNITY_MAX_LEN       256
 
42
 
 
43
    /*
 
44
     * Space for character representation of an object identifier 
 
45
     */
 
46
#define SPRINT_MAX_LEN          2560
 
47
 
 
48
 
 
49
#ifndef NULL
 
50
#define NULL 0
 
51
#endif
 
52
 
 
53
#ifndef TRUE
 
54
#define TRUE    1
 
55
#endif
 
56
#ifndef FALSE
 
57
#define FALSE   0
 
58
#endif
 
59
 
 
60
#define READ        1
 
61
#define WRITE       0
 
62
 
 
63
#define RESERVE1    0
 
64
#define RESERVE2    1
 
65
#define ACTION      2
 
66
#define COMMIT      3
 
67
#define FREE        4
 
68
#define UNDO        5
 
69
#define FINISHED_SUCCESS        9
 
70
#define FINISHED_FAILURE        10
 
71
 
 
72
    /*
 
73
     * Access control statements for the agent 
 
74
     */
 
75
#define RONLY   0x1             /* read access only */
 
76
#define RWRITE  0x2             /* read and write access (must have 0x2 bit set) */
 
77
 
 
78
#define NOACCESS 0x0000         /* no access for anybody */
 
79
 
 
80
    /*
 
81
     * defined types (from the SMI, RFC 1157) 
 
82
     */
 
83
#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
 
84
#define ASN_COUNTER     (ASN_APPLICATION | 1)
 
85
#define ASN_GAUGE       (ASN_APPLICATION | 2)
 
86
#define ASN_UNSIGNED    (ASN_APPLICATION | 2)   /* RFC 1902 - same as GAUGE */
 
87
#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
 
88
#define ASN_OPAQUE      (ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
 
89
 
 
90
    /*
 
91
     * defined types (from the SMI, RFC 1442) 
 
92
     */
 
93
#define ASN_NSAP        (ASN_APPLICATION | 5)   /* historic - don't use */
 
94
#define ASN_COUNTER64   (ASN_APPLICATION | 6)
 
95
#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
 
96
 
 
97
#ifdef OPAQUE_SPECIAL_TYPES
 
98
    /*
 
99
     * defined types from draft-perkins-opaque-01.txt 
 
100
     */
 
101
#define ASN_FLOAT           (ASN_APPLICATION | 8)
 
102
#define ASN_DOUBLE          (ASN_APPLICATION | 9)
 
103
#define ASN_INTEGER64        (ASN_APPLICATION | 10)
 
104
#define ASN_UNSIGNED64       (ASN_APPLICATION | 11)
 
105
#endif                          /* OPAQUE_SPECIAL_TYPES */
 
106
 
 
107
    /*
 
108
     * changed to ERROR_MSG to eliminate conflict with other includes 
 
109
     */
 
110
#ifndef ERROR_MSG
 
111
#define ERROR_MSG(string)       snmp_set_detail(string)
 
112
#endif
 
113
 
 
114
    /*
 
115
     * from snmp.c 
 
116
     */
 
117
    extern u_char   sid[];      /* size SID_MAX_LEN */
 
118
    extern int      snmp_errno;
 
119
 
 
120
 
 
121
    /*
 
122
     * For calling secauth_build, FIRST_PASS is an indication that a new nonce
 
123
     * and lastTimeStamp should be recorded.  LAST_PASS is an indication that
 
124
     * the packet should be checksummed and encrypted if applicable, in
 
125
     * preparation for transmission.
 
126
     * 0 means do neither, FIRST_PASS | LAST_PASS means do both.
 
127
     * For secauth_parse, FIRST_PASS means decrypt the packet, otherwise leave it
 
128
     * alone.  LAST_PASS is ignored.
 
129
     */
 
130
#define FIRST_PASS      1
 
131
#define LAST_PASS       2
 
132
    u_char         *snmp_comstr_parse(u_char *, size_t *, u_char *,
 
133
                                      size_t *, long *);
 
134
    u_char         *snmp_comstr_build(u_char *, size_t *, u_char *,
 
135
                                      size_t *, long *, size_t);
 
136
 
 
137
    int             has_access(u_char, int, int, int);
 
138
#ifdef __cplusplus
 
139
}
 
140
#endif
 
141
#endif                          /* SNMP_IMPL_H */