Go to the documentation of this file.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
00052
00053 #ifndef SNMP_PORT
00054
00056 #define SNMP_PORT 161
00057 #endif
00058
00059 #ifndef SNMP_TRAP_PORT
00060
00062 #define SNMP_TRAP_PORT 162
00063 #endif
00064
00065 #ifndef SNMP_MAX_LEN
00066
00068 #define SNMP_MAX_LEN 500
00069 #endif
00070
00075 #define SNMP_VERSION_1 0
00076
00085 #define SNMP_VERSION_2C 1
00086
00095 #define SNMP_VERSION_3 3
00096
00097
00098
00099
00100 #define SNMP_MSG_GET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0)
00101 #define SNMP_MSG_GETNEXT (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1)
00102 #define SNMP_MSG_RESPONSE (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2)
00103 #define SNMP_MSG_SET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3)
00104
00105
00106
00107
00108 #define SNMP_MSG_TRAP (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4)
00109
00110
00111
00112
00113 #define SNMP_MSG_GETBULK (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5)
00114 #define SNMP_MSG_INFORM (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6)
00115 #define SNMP_MSG_TRAP2 (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7)
00116
00117
00118
00119
00120 #define SNMP_MSG_REPORT (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8)
00121
00122
00123
00124
00125 #define SNMP_NOSUCHOBJECT (ASN_CONTEXT | ASN_PRIMITIVE | 0x0)
00126 #define SNMP_NOSUCHINSTANCE (ASN_CONTEXT | ASN_PRIMITIVE | 0x1)
00127 #define SNMP_ENDOFMIBVIEW (ASN_CONTEXT | ASN_PRIMITIVE | 0x2)
00128
00129
00130
00131
00132 #define SNMP_ERR_NOERROR 0
00133 #define SNMP_ERR_TOOBIG 1
00134 #define SNMP_ERR_NOSUCHNAME 2
00135 #define SNMP_ERR_BADVALUE 3
00136 #define SNMP_ERR_READONLY 4
00137 #define SNMP_ERR_GENERR 5
00138
00139
00140
00141
00142 #define SNMP_ERR_NOACCESS 6
00143 #define SNMP_ERR_WRONGTYPE 7
00144 #define SNMP_ERR_WRONGLENGTH 8
00145 #define SNMP_ERR_WRONGENCODING 9
00146 #define SNMP_ERR_WRONGVALUE 10
00147 #define SNMP_ERR_NOCREATION 11
00148 #define SNMP_ERR_INCONSISTENTVALUE 12
00149 #define SNMP_ERR_RESOURCEUNAVAILABLE 13
00150 #define SNMP_ERR_COMMITFAILED 14
00151 #define SNMP_ERR_UNDOFAILED 15
00152 #define SNMP_ERR_AUTHORIZATIONERROR 16
00153 #define SNMP_ERR_NOTWRITABLE 17
00154 #define SNMP_ERR_INCONSISTENTNAME 18
00155
00156
00157
00158
00159 #define SNMP_TRAP_COLDSTART 0
00160 #define SNMP_TRAP_WARMSTART 1
00161 #define SNMP_TRAP_LINKDOWN 2
00162 #define SNMP_TRAP_LINKUP 3
00163 #define SNMP_TRAP_AUTHFAIL 4
00164 #define SNMP_TRAP_EGPNEIGHBORLOSS 5
00165 #define SNMP_TRAP_ENTERPRISESPECIFIC 6
00166
00167
00168
00169
00170 #define SNMP_OID_INTERNET 1, 3, 6, 1
00171 #define SNMP_OID_ENTERPRISES SNMP_OID_INTERNET, 4, 1
00172 #define SNMP_OID_MIB2 SNMP_OID_INTERNET, 2, 1
00173 #define SNMP_OID_SNMPV2 SNMP_OID_INTERNET, 6
00174 #define SNMP_OID_SNMPMODULES SNMP_OID_SNMPV2, 3
00175
00176
00177
00178 #define SNMP_PARSE_ERROR -1
00179 #define SNMP_BUILD_ERROR -2
00180
00182 #define MAX_SID_LEN 32
00183
00184 #define MAX_NAME_LEN 128
00185
00186 #define SNMP_ACT_RESERVE1 0
00187 #define SNMP_ACT_RESERVE2 1
00188 #define SNMP_ACT_COMMIT 2
00189 #define SNMP_ACT_ACTION 3
00190 #define SNMP_ACT_FREE 4
00191
00194 extern CONST uint8_t *SnmpVarParse(CONST uint8_t *, size_t *, OID *, size_t *, uint8_t *, uint8_t **, size_t *);
00195 extern uint8_t *SnmpVarBuild(uint8_t *, size_t *, CONST OID *, size_t, uint8_t , CONST uint8_t *, size_t);
00196
00197 #endif