Dangerous SNMP
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Tcp Class Reference

This is the TCP transport (see http://tools.ietf.org/html/rfc3430). More...

#include <tcp.hpp>

Inheritance diagram for Tcp:
BasicSocketTransport Transport

Public Member Functions

 Tcp (std::weak_ptr< Context::PrivateData > context, const std::string &connectionString) throw ( Exception )
 This instantiates a new TCP transport instance. More...
 
- Public Member Functions inherited from BasicSocketTransport
 BasicSocketTransport (std::weak_ptr< Context::PrivateData > context)
 
virtual bool isConnected ()
 This returns whether or not the transport is connected. More...
 
virtual void connect ()
 This instructs the transport to connect to its endpoint. More...
 
virtual void disconnect ()
 This shuts down the transport (if it was already connected). More...
 
bool send (const std::vector< char > &bytes)
 
std::vector< char > receive (const std::chrono::milliseconds &timeout)
 
- Public Member Functions inherited from Transport
unsigned int maximumIncomingMessageSize ()
 
unsigned int maximumOutgoingMessageSize ()
 
void commitWrite ()
 

Public Attributes

const unsigned int MINIMUM_MESSAGE_SIZE = 8192
 
const unsigned int RECOMMENDED_MESSAGE_SIZE = 8192
 
- Public Attributes inherited from Transport
std::shared_ptr< ByteStreamreaderStream
 
std::shared_ptr< ByteStreamwriterStream
 

Protected Member Functions

virtual int socketOptions () const
 When creating a socket, this is called to set the options that should be passed to the call. More...
 
virtual int protocolNumber () const
 When creating a socket, this is called to set the protocol that should be passed to the call. More...
 
- Protected Member Functions inherited from Transport
 Transport (std::weak_ptr< Context::PrivateData > context)
 
void registerReadWriteStreams (int readHandle, int writeHandle)
 
void unregisterReadWriteStreams (int readHandle, int writeHandle)
 

Additional Inherited Members

- Protected Attributes inherited from BasicSocketTransport
int socketHandle
 This is the socket handle.
 
std::string address
 This is the address to which to connect. More...
 
std::string port
 This is the port on which to connect. More...
 
- Protected Attributes inherited from Transport
unsigned int _maximumIncomingMessageSize
 
unsigned int _maximumOutgoingMessageSize
 
std::weak_ptr
< Context::PrivateData
context
 

Detailed Description

This is the TCP transport (see http://tools.ietf.org/html/rfc3430).

Constructor & Destructor Documentation

Tcp ( std::weak_ptr< Context::PrivateData context,
const std::string &  connectionString 
)
throw (Exception
)

This instantiates a new TCP transport instance.

The connection string must be of the form: <address>[:<port>] However, <address> can be an actual IPv4 or IPv6 address, and it can also be a domain name. <port> can be an actual port number or text that will resolve to a port number. If omitted, the port will be 161.

Parameters
connectionStringThe string to use to establish a connection.

Member Function Documentation

virtual int protocolNumber ( ) const
protectedvirtual

When creating a socket, this is called to set the protocol that should be passed to the call.

It is the responsibility of the subclass to properly fill this out.

Returns
The relevant value for addrinfo.ai_protocol.

Reimplemented from BasicSocketTransport.

virtual int socketOptions ( ) const
protectedvirtual

When creating a socket, this is called to set the options that should be passed to the call.

It is the responsibility of the subclass to properly fill this out.

Returns
The relevant value for addrinfo.ai_socktype.

Reimplemented from BasicSocketTransport.


The documentation for this class was generated from the following file: