Represents an IP address as described in RFC 2741, section 5.4. More...
#include <IpAddressValue.hpp>
Public Member Functions | |
| IpAddressValue (binary::const_iterator &pos, const binary::const_iterator &end, bool big_endian=true) | |
| Parse Constructor. | |
| binary | serialize () const |
| Encode the object as described in RFC 2741, section 5.4 / 5.3. | |
| IpAddressValue (uint8_t a, uint8_t b, uint8_t c, uint8_t d) | |
| Construct an IpAddressValue object. | |
| void | set_value (uint8_t a, uint8_t b, uint8_t c, uint8_t d) |
| Set the IpAddress. | |
| uint8_t & | operator[] (unsigned index) |
| Access a component of the stored IpAddress. | |
Public Member Functions inherited from agentxcpp::AbstractValue | |
| virtual | ~AbstractValue () |
| Destructor. | |
Private Member Functions | |
| IpAddressValue () | |
| Hide default constructor. | |
Private Attributes | |
| uint8_t | address [4] |
| The IP address. | |
Represents an IP address as described in RFC 2741, section 5.4.
Definition at line 35 of file IpAddressValue.hpp.
|
private |
Hide default constructor.
| IpAddressValue::IpAddressValue | ( | binary::const_iterator & | pos, |
| const binary::const_iterator & | end, | ||
| bool | big_endian = true |
||
| ) |
Parse Constructor.
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.
| pos | Iterator pointing to the current stream position. The iterator is advanced while reading the header. |
| end | Iterator pointing one element past the end of the current stream. This is needed to mark the end of the buffer. |
| big_endian | Whether the input stream is in big endian format |
Definition at line 45 of file IpAddressValue.cpp.
References address, and agentxcpp::read32().
|
inline |
Construct an IpAddressValue object.
The stored IpAddress is initialized to "a.b.c.d".
| None. |
Definition at line 97 of file IpAddressValue.hpp.
References address.
|
inline |
Access a component of the stored IpAddress.
This function returns the component with the given index. Note that exactly 4 components are stored. The return value is a reference to the component, so that it can be read/written, in other words, the IpAddressValue object can be accessed like an ordinary array.
| index | The index (value in the range 0...3). |
| inval_param | If the index is out of bound. |
Definition at line 141 of file IpAddressValue.hpp.
References address.
|
virtual |
Encode the object as described in RFC 2741, section 5.4 / 5.3.
Note: We always use big endian.
Implements agentxcpp::AbstractValue.
Definition at line 25 of file IpAddressValue.cpp.
References address.
|
inline |
Set the IpAddress.
The stored IpAddress is updated to "a.b.c.d".
| None. |
Definition at line 115 of file IpAddressValue.hpp.
References address.
|
private |
The IP address.
According to RFC 2578, IpAddress is a 32-bit number.
Definition at line 48 of file IpAddressValue.hpp.
Referenced by IpAddressValue(), operator[](), serialize(), and set_value().