00001 #ifndef PRO_SNMP_H
00002 #define PRO_SNMP_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00046 #include <pro/asn1.h>
00047
00048 #ifndef SNMP_PORT
00049
00051 #define SNMP_PORT 161
00052 #endif
00053
00054 #ifndef SNMP_TRAP_PORT
00055
00057 #define SNMP_TRAP_PORT 162
00058 #endif
00059
00060 #ifndef SNMP_MAX_LEN
00061
00063 #define SNMP_MAX_LEN 500
00064 #endif
00065
00070 #define SNMP_VERSION_1 0
00071
00080 #define SNMP_VERSION_2C 1
00081
00090 #define SNMP_VERSION_3 3
00091
00092
00093
00094
00095 #define SNMP_MSG_GET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0)
00096 #define SNMP_MSG_GETNEXT (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1)
00097 #define SNMP_MSG_RESPONSE (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2)
00098 #define SNMP_MSG_SET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3)
00099
00100
00101
00102
00103 #define SNMP_MSG_TRAP (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4)
00104
00105
00106
00107
00108 #define SNMP_MSG_GETBULK (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5)
00109 #define SNMP_MSG_INFORM (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6)
00110 #define SNMP_MSG_TRAP2 (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7)
00111
00112
00113
00114
00115 #define SNMP_MSG_REPORT (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8)
00116
00117
00118
00119
00120 #define SNMP_NOSUCHOBJECT (ASN_CONTEXT | ASN_PRIMITIVE | 0x0)
00121 #define SNMP_NOSUCHINSTANCE (ASN_CONTEXT | ASN_PRIMITIVE | 0x1)
00122 #define SNMP_ENDOFMIBVIEW (ASN_CONTEXT | ASN_PRIMITIVE | 0x2)
00123
00124
00125
00126
00127 #define SNMP_ERR_NOERROR 0
00128 #define SNMP_ERR_TOOBIG 1
00129 #define SNMP_ERR_NOSUCHNAME 2
00130 #define SNMP_ERR_BADVALUE 3
00131 #define SNMP_ERR_READONLY 4
00132 #define SNMP_ERR_GENERR 5
00133
00134
00135
00136
00137 #define SNMP_ERR_NOACCESS 6
00138 #define SNMP_ERR_WRONGTYPE 7
00139 #define SNMP_ERR_WRONGLENGTH 8
00140 #define SNMP_ERR_WRONGENCODING 9
00141 #define SNMP_ERR_WRONGVALUE 10
00142 #define SNMP_ERR_NOCREATION 11
00143 #define SNMP_ERR_INCONSISTENTVALUE 12
00144 #define SNMP_ERR_RESOURCEUNAVAILABLE 13
00145 #define SNMP_ERR_COMMITFAILED 14
00146 #define SNMP_ERR_UNDOFAILED 15
00147 #define SNMP_ERR_AUTHORIZATIONERROR 16
00148 #define SNMP_ERR_NOTWRITABLE 17
00149 #define SNMP_ERR_INCONSISTENTNAME 18
00150
00151
00152
00153
00154 #define SNMP_TRAP_COLDSTART 0
00155 #define SNMP_TRAP_WARMSTART 1
00156 #define SNMP_TRAP_LINKDOWN 2
00157 #define SNMP_TRAP_LINKUP 3
00158 #define SNMP_TRAP_AUTHFAIL 4
00159 #define SNMP_TRAP_EGPNEIGHBORLOSS 5
00160 #define SNMP_TRAP_ENTERPRISESPECIFIC 6
00161
00162
00163
00164
00165 #define SNMP_OID_INTERNET 1, 3, 6, 1
00166 #define SNMP_OID_ENTERPRISES SNMP_OID_INTERNET, 4, 1
00167 #define SNMP_OID_MIB2 SNMP_OID_INTERNET, 2, 1
00168 #define SNMP_OID_SNMPV2 SNMP_OID_INTERNET, 6
00169 #define SNMP_OID_SNMPMODULES SNMP_OID_SNMPV2, 3
00170
00171
00172
00173 #define SNMP_PARSE_ERROR -1
00174 #define SNMP_BUILD_ERROR -2
00175
00177 #define MAX_SID_LEN 32
00178
00179 #define MAX_NAME_LEN 128
00180
00181 #define SNMP_ACT_RESERVE1 0
00182 #define SNMP_ACT_RESERVE2 1
00183 #define SNMP_ACT_COMMIT 2
00184 #define SNMP_ACT_ACTION 3
00185 #define SNMP_ACT_FREE 4
00186
00187 extern CONST u_char *SnmpVarParse(CONST u_char *, size_t *, OID *, size_t *, u_char *, u_char **, size_t *);
00188 extern u_char *SnmpVarBuild(u_char *, size_t *, CONST OID *, size_t, u_char , CONST u_char *, size_t);
00189
00190 #endif