Dangerous SNMP
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
pdu.hpp
1 #pragma once
2 
3 #include "types.hpp"
4 
5 namespace dangerous { namespace snmp {
6 
12 public:
16  enum ErrorStatus {
17  noError = 0,
18  tooBig = 1,
19  noSuchName = 2, //< Only for version-1 compatibility.
20  badValue = 3, //< Only for version-1 compatibility.
21  readOnly = 4, //< Only for version-1 compatibility.
22  genErr = 5,
23  noAccess = 6,
24  wrongType = 7,
25  wrongLength = 8,
26  wrongEncoding = 9,
27  wrongValue = 10,
28  noCreation = 11,
29  inconsistentValue = 12,
30  resourceUnavailable = 13,
31  commitFailed = 14,
32  undoFailed = 15,
33  authorizationError = 16,
34  notWritable = 17,
35  inconsistentName = 18
36  };
37 
45  static const char* name( int errorStatus );
46 };
47 
56 class PDU {
57 public:
65  static const char* errorName( int errorStatus );
66 
67 public:
72  PDU();
73 
79  PDU( const PDU& pdu );
80 
84  ~PDU();
85 
86 public:
91  void addOid( const NumericOid& oid );
92 
98  bool containsOid( const NumericOid& oid );
99 
100 public: //< TODO????
110 
117 
125 
128 };
129 
135 void printPdu( std::ostream& out, const PDU& pdu );
136 
137 } }
138 
static const char * name(int errorStatus)
This returns a pointer to a statically allocated string that contains the standard name for the error...
A PDU represents an SNMP Protocol Data Unit (PDU).
Definition: pdu.hpp:56
void printPdu(std::ostream &out, const PDU &pdu)
This prints a PDU to a standard output stream.
~PDU()
Destructor.
void addOid(const NumericOid &oid)
This adds a new VarBind to the PDU (with a null value).
int errorStatus
This is the ErrorStatus for the PDU.
Definition: pdu.hpp:116
PDU()
Default constructor.
A NumericOid represents an "true" OID; that is, one identified by a series of integers (as opposed to...
Definition: numericoid.hpp:22
int errorIndex
This is the ErrorIndex for the PDU.
Definition: pdu.hpp:124
This is a container class for the enumerations of the PDU "errorStatus" field.
Definition: pdu.hpp:11
bool containsOid(const NumericOid &oid)
This checks to see if the PDU contains the given OID.
ErrorStatus
An ErrorStatus represents the specific error for a PDU.
Definition: pdu.hpp:16
static const char * errorName(int errorStatus)
This returns a pointer to a statically allocated string that contains the standard name for the error...
int requestId
This is the RequestID for the PDU.
Definition: pdu.hpp:109
std::vector< std::unique_ptr< VarBind > > VarBindList
This defines a list of varbinds.
Definition: types.hpp:116
VarBindList varbinds
This is the list of VarBinds in the PDU.
Definition: pdu.hpp:127