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

This is the (typical) UDP transport. More...

#include <udp.hpp>

Inheritance diagram for Udp:
BasicSocketTransport Transport

Public Member Functions

 Udp (std::weak_ptr< Context::PrivateData > context, const std::string &connectionString) throw ( Exception )
 This instantiates a new UDP transport instance. More...
 
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...
 
- 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 = 484
 
const unsigned int RECOMMENDED_MESSAGE_SIZE = 1472
 
- Public Attributes inherited from Transport
std::shared_ptr< ByteStreamreaderStream
 
std::shared_ptr< ByteStreamwriterStream
 

Additional Inherited Members

- 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)
 
- 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 (typical) UDP transport.

Constructor & Destructor Documentation

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

This instantiates a new UDP 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
virtual

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
virtual

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: