AgentXcpp  Revision:0.1
Internals Documentation
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends
agentxcpp::IpAddress Class Reference

Represents an IP address as descibed in RFC 2741, section 5.4. More...

#include <IpAddress.hpp>

Inheritance diagram for agentxcpp::IpAddress:
[legend]
Collaboration diagram for agentxcpp::IpAddress:
[legend]

List of all members.

Public Member Functions

 IpAddress (data_t::const_iterator &pos, const data_t::const_iterator &end, bool big_endian=true)
 Construct the object from input stream.
data_t serialize () const
 Encode the object as described in RFC 2741, section 5.4 / 5.3.
 IpAddress (uint32_t a, uint32_t b, uint32_t c, uint32_t d)
 Construct an IpAddress object.
virtual void update ()
 Update the internal state of the object.
virtual IpAddress get ()
 Obtain the current value for the object.

Private Member Functions

 IpAddress ()
 Hide default constructor.

Private Attributes

uint8_t address [4]
 The IP address.

Detailed Description

Represents an IP address as descibed in RFC 2741, section 5.4.

Definition at line 32 of file IpAddress.hpp.


Constructor & Destructor Documentation

Hide default constructor.

IpAddress::IpAddress ( data_t::const_iterator &  pos,
const data_t::const_iterator &  end,
bool  big_endian = true 
)

Construct the object from input stream.

This constructor parses the serialized form of the object. It takes an iterator, starts parsing at the position of the iterator and advances the iterator to the position right behind the object.

The constructor expects valid data from the stream; if parsing fails, parse_error is thrown. In this case, the iterator position is undefined.

Parameters:
posIterator pointing to the current stream position. The iterator is advanced while reading the header.
endIterator pointing one element past the end of the current stream. This is needed to mark the end of the buffer.
big_endianWhether the input stream is in big endian format

Definition at line 45 of file IpAddress.cpp.

References address, and read32().

Construct an IpAddress object.

The stored IpAddress is initialized to "a.b.c.d".

Exceptions:
None.

Definition at line 95 of file IpAddress.hpp.

References address.


Member Function Documentation

virtual IpAddress agentxcpp::IpAddress::get ( ) [inline, virtual]

Obtain the current value for the object.

This member function is derived by classes representing SNMP variables and shall return the current value of the object.

The default implementation throws generic_error.

Returns:
The current value of the object.
Exceptions:
generic_errorIf obtaining the current value fails. No other exception shall be thrown.

Definition at line 138 of file IpAddress.hpp.

data_t IpAddress::serialize ( ) const [virtual]

Encode the object as described in RFC 2741, section 5.4 / 5.3.

Note: We always use big endian.

Implements agentxcpp::variable.

Definition at line 25 of file IpAddress.cpp.

References address.

virtual void agentxcpp::IpAddress::update ( ) [inline, virtual]

Update the internal state of the object.

This function calls get() to obtain a new value and writes that value to the 'address' member.

Exceptions:
generic_errorIf obtaining the new value failed.

Implements agentxcpp::variable.

Definition at line 116 of file IpAddress.hpp.

References address.


Member Data Documentation

The IP address.

According to RFC 2578, IpAddress is a 32-bit number.

Definition at line 46 of file IpAddress.hpp.

Referenced by IpAddress(), serialize(), and update().


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