Dangerous SNMP
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
messageprocessor.hpp
1 #pragma once
2 
3 #include "dangerous/snmp/exception.hpp"
4 #include "dangerous/snmp/securitymodel.hpp"
5 #include "dangerous/snmp/types.hpp"
6 
7 #include <memory>
8 #include <string>
9 #include <vector>
10 
11 
12 namespace dangerous { namespace snmp {
13 
14 class ByteStream;
15 
16 
29 public:
30  enum Version {
31  SNMPv1 = 0,
32  SNMPv2 = 1,
33  SNMPv3 = 3
34  };
35 
36 public:
37  virtual ~MessageProcessor();
38 
43  Version version() const { return _version; }
44 
53  virtual std::vector<char> encode( const SecurityModel* securityModel, ConfirmedClass::Type confirmedClass, const std::vector<char>& pduBytes ) throw( Exception ) = 0;
54 
63  virtual std::unique_ptr<ByteStream> decode( const SecurityModel* securityModel, ByteStream& byteStream, std::unique_ptr<SecurityModel>& incomingSecurityModel ) throw( Exception ) = 0;
64 
65 protected:
66  Version _version;
67 };
68 
69 } }
70 
A ByteStream is an object that is basically a big wrapper around a character buffer.
Definition: bytestream.hpp:30
virtual std::unique_ptr< ByteStream > decode(const SecurityModel *securityModel, ByteStream &byteStream, std::unique_ptr< SecurityModel > &incomingSecurityModel)=0
This decodes a message.
A MessaqeProcessor is responsible for creating an envelope around a particular payload and also remov...
Definition: messageprocessor.hpp:28
This defines the base exception class for Dangerous SNMP.
Definition: exception.hpp:10
Type
A Type represents one of the two defined values for the "confirmed class" of a PDU.
Definition: types.hpp:65
This class is the base class for all security models.
Definition: securitymodel.hpp:29
virtual std::vector< char > encode(const SecurityModel *securityModel, ConfirmedClass::Type confirmedClass, const std::vector< char > &pduBytes)=0
This encodes a new message.
Version version() const
This returns the SNMP version of the Message Processor.
Definition: messageprocessor.hpp:43