00001
00002
00003
00004
00005
00006
00007 #ifdef P_SNMP
00008
00009 #ifndef __PSNMP_H
00010 #define __PSNMP_H
00011
00012 #ifdef P_USE_PRAGMA
00013 #pragma interface
00014 #endif
00015
00016 #include <ptclib/asner.h>
00017 #include <ptclib/rfc1155.h>
00018
00019
00020
00021
00022
00023
00024 class PSNMP_Message : public PASN_Sequence
00025 {
00026 #ifndef PASN_LEANANDMEAN
00027 PCLASSINFO(PSNMP_Message, PASN_Sequence);
00028 #endif
00029 public:
00030 PSNMP_Message(unsigned tag = UniversalSequence, TagClass tagClass = UniversalTagClass);
00031
00032 PASN_Integer m_version;
00033 PASN_OctetString m_community;
00034 PASN_OctetString m_data;
00035
00036 PINDEX GetDataLength() const;
00037 BOOL Decode(PASN_Stream & strm);
00038 void Encode(PASN_Stream & strm) const;
00039 #ifndef PASN_NOPRINTON
00040 void PrintOn(ostream & strm) const;
00041 #endif
00042 Comparison Compare(const PObject & obj) const;
00043 PObject * Clone() const;
00044 };
00045
00046
00047
00048
00049
00050
00051 class PSNMP_GetRequest_PDU;
00052 class PSNMP_GetNextRequest_PDU;
00053 class PSNMP_GetResponse_PDU;
00054 class PSNMP_SetRequest_PDU;
00055 class PSNMP_Trap_PDU;
00056
00057 class PSNMP_PDUs : public PASN_Choice
00058 {
00059 #ifndef PASN_LEANANDMEAN
00060 PCLASSINFO(PSNMP_PDUs, PASN_Choice);
00061 #endif
00062 public:
00063 PSNMP_PDUs(unsigned tag = 0, TagClass tagClass = UniversalTagClass);
00064
00065 enum Choices {
00066 e_get_request,
00067 e_get_next_request,
00068 e_get_response,
00069 e_set_request,
00070 e_trap
00071 };
00072
00073 #if defined(__GNUC__) && __GNUC__ <= 2 && __GNUC_MINOR__ < 9
00074 operator PSNMP_GetRequest_PDU &() const;
00075 #else
00076 operator PSNMP_GetRequest_PDU &();
00077 operator const PSNMP_GetRequest_PDU &() const;
00078 #endif
00079 #if defined(__GNUC__) && __GNUC__ <= 2 && __GNUC_MINOR__ < 9
00080 operator PSNMP_GetNextRequest_PDU &() const;
00081 #else
00082 operator PSNMP_GetNextRequest_PDU &();
00083 operator const PSNMP_GetNextRequest_PDU &() const;
00084 #endif
00085 #if defined(__GNUC__) && __GNUC__ <= 2 && __GNUC_MINOR__ < 9
00086 operator PSNMP_GetResponse_PDU &() const;
00087 #else
00088 operator PSNMP_GetResponse_PDU &();
00089 operator const PSNMP_GetResponse_PDU &() const;
00090 #endif
00091 #if defined(__GNUC__) && __GNUC__ <= 2 && __GNUC_MINOR__ < 9
00092 operator PSNMP_SetRequest_PDU &() const;
00093 #else
00094 operator PSNMP_SetRequest_PDU &();
00095 operator const PSNMP_SetRequest_PDU &() const;
00096 #endif
00097 #if defined(__GNUC__) && __GNUC__ <= 2 && __GNUC_MINOR__ < 9
00098 operator PSNMP_Trap_PDU &() const;
00099 #else
00100 operator PSNMP_Trap_PDU &();
00101 operator const PSNMP_Trap_PDU &() const;
00102 #endif
00103
00104 BOOL CreateObject();
00105 PObject * Clone() const;
00106 };
00107
00108
00109
00110
00111
00112
00113 class PSNMP_VarBind : public PASN_Sequence
00114 {
00115 #ifndef PASN_LEANANDMEAN
00116 PCLASSINFO(PSNMP_VarBind, PASN_Sequence);
00117 #endif
00118 public:
00119 PSNMP_VarBind(unsigned tag = UniversalSequence, TagClass tagClass = UniversalTagClass);
00120
00121 PRFC1155_ObjectName m_name;
00122 PRFC1155_ObjectSyntax m_value;
00123
00124 PINDEX GetDataLength() const;
00125 BOOL Decode(PASN_Stream & strm);
00126 void Encode(PASN_Stream & strm) const;
00127 #ifndef PASN_NOPRINTON
00128 void PrintOn(ostream & strm) const;
00129 #endif
00130 Comparison Compare(const PObject & obj) const;
00131 PObject * Clone() const;
00132 };
00133
00134
00135
00136
00137
00138
00139 class PSNMP_VarBind;
00140
00141 class PSNMP_VarBindList : public PASN_Array
00142 {
00143 #ifndef PASN_LEANANDMEAN
00144 PCLASSINFO(PSNMP_VarBindList, PASN_Array);
00145 #endif
00146 public:
00147 PSNMP_VarBindList(unsigned tag = UniversalSequence, TagClass tagClass = UniversalTagClass);
00148
00149 PASN_Object * CreateObject() const;
00150 PSNMP_VarBind & operator[](PINDEX i) const;
00151 PObject * Clone() const;
00152 };
00153
00154
00155
00156
00157
00158
00159 class PSNMP_PDU : public PASN_Sequence
00160 {
00161 #ifndef PASN_LEANANDMEAN
00162 PCLASSINFO(PSNMP_PDU, PASN_Sequence);
00163 #endif
00164 public:
00165 PSNMP_PDU(unsigned tag = UniversalSequence, TagClass tagClass = UniversalTagClass);
00166
00167 PASN_Integer m_request_id;
00168 PASN_Integer m_error_status;
00169 PASN_Integer m_error_index;
00170 PSNMP_VarBindList m_variable_bindings;
00171
00172 PINDEX GetDataLength() const;
00173 BOOL Decode(PASN_Stream & strm);
00174 void Encode(PASN_Stream & strm) const;
00175 #ifndef PASN_NOPRINTON
00176 void PrintOn(ostream & strm) const;
00177 #endif
00178 Comparison Compare(const PObject & obj) const;
00179 PObject * Clone() const;
00180 };
00181
00182
00183
00184
00185
00186
00187 class PSNMP_Trap_PDU : public PASN_Sequence
00188 {
00189 #ifndef PASN_LEANANDMEAN
00190 PCLASSINFO(PSNMP_Trap_PDU, PASN_Sequence);
00191 #endif
00192 public:
00193 PSNMP_Trap_PDU(unsigned tag = 4, TagClass tagClass = ContextSpecificTagClass);
00194
00195 PASN_ObjectId m_enterprise;
00196 PRFC1155_NetworkAddress m_agent_addr;
00197 PASN_Integer m_generic_trap;
00198 PASN_Integer m_specific_trap;
00199 PRFC1155_TimeTicks m_time_stamp;
00200 PSNMP_VarBindList m_variable_bindings;
00201
00202 PINDEX GetDataLength() const;
00203 BOOL Decode(PASN_Stream & strm);
00204 void Encode(PASN_Stream & strm) const;
00205 #ifndef PASN_NOPRINTON
00206 void PrintOn(ostream & strm) const;
00207 #endif
00208 Comparison Compare(const PObject & obj) const;
00209 PObject * Clone() const;
00210 };
00211
00212
00213
00214
00215
00216
00217 class PSNMP_GetRequest_PDU : public PSNMP_PDU
00218 {
00219 #ifndef PASN_LEANANDMEAN
00220 PCLASSINFO(PSNMP_GetRequest_PDU, PSNMP_PDU);
00221 #endif
00222 public:
00223 PSNMP_GetRequest_PDU(unsigned tag = 0, TagClass tagClass = ContextSpecificTagClass);
00224
00225 PObject * Clone() const;
00226 };
00227
00228
00229
00230
00231
00232
00233 class PSNMP_GetNextRequest_PDU : public PSNMP_PDU
00234 {
00235 #ifndef PASN_LEANANDMEAN
00236 PCLASSINFO(PSNMP_GetNextRequest_PDU, PSNMP_PDU);
00237 #endif
00238 public:
00239 PSNMP_GetNextRequest_PDU(unsigned tag = 1, TagClass tagClass = ContextSpecificTagClass);
00240
00241 PObject * Clone() const;
00242 };
00243
00244
00245
00246
00247
00248
00249 class PSNMP_GetResponse_PDU : public PSNMP_PDU
00250 {
00251 #ifndef PASN_LEANANDMEAN
00252 PCLASSINFO(PSNMP_GetResponse_PDU, PSNMP_PDU);
00253 #endif
00254 public:
00255 PSNMP_GetResponse_PDU(unsigned tag = 2, TagClass tagClass = ContextSpecificTagClass);
00256
00257 PObject * Clone() const;
00258 };
00259
00260
00261
00262
00263
00264
00265 class PSNMP_SetRequest_PDU : public PSNMP_PDU
00266 {
00267 #ifndef PASN_LEANANDMEAN
00268 PCLASSINFO(PSNMP_SetRequest_PDU, PSNMP_PDU);
00269 #endif
00270 public:
00271 PSNMP_SetRequest_PDU(unsigned tag = 3, TagClass tagClass = ContextSpecificTagClass);
00272
00273 PObject * Clone() const;
00274 };
00275
00276
00277 #endif // __PSNMP_H
00278
00279 #endif // if ! H323_DISABLE_PSNMP
00280
00281
00282