NDP message codec.
More...
#include <ndp_message.hpp>
|
| ssize_t | serialize (const RouterSolicitation &packet, char *data, size_t maxSize) const |
| | serialize a router solicitation into a buffer.
|
| |
| ssize_t | serialize (const RouterAdvertisement &packet, char *data, size_t maxSize) const |
| | serialize a router advertisement into a buffer.
|
| |
| ssize_t | serialize (const RouterAdvertisement &packet, char *data, size_t maxSize, const MacAddress &link) const |
| | serialize a router advertisement into a buffer with the given link layer address.
|
| |
| ssize_t | serialize (const NeighborSolicitation &packet, char *data, size_t maxSize) const |
| | serialize a neighbor solicitation into a buffer.
|
| |
| ssize_t | serialize (const NeighborAdvertisement &packet, char *data, size_t maxSize) const |
| | serialize a neighbor advertisement into a buffer.
|
| |
| ssize_t | serialize (const NeighborAdvertisement &packet, char *data, size_t maxSize, const MacAddress &link) const |
| | serialize a neighbor advertisement into a buffer with the given link layer address.
|
| |
| int | deserialize (RouterSolicitation &packet, const char *data, size_t size) const |
| | deserialize a router solicitation from a buffer.
|
| |
| int | deserialize (RouterAdvertisement &packet, const char *data, size_t size) const |
| | deserialize a router advertisement from a buffer.
|
| |
| int | deserialize (NeighborSolicitation &packet, const char *data, size_t size) const |
| | deserialize a neighbor solicitation from a buffer.
|
| |
| int | deserialize (NeighborAdvertisement &packet, const char *data, size_t size) const |
| | deserialize a neighbor advertisement from a buffer.
|
| |
|
| static constexpr size_t | maxRouterSolicitationSize |
| | biggest router solicitation the codec writes, link layer address option included.
|
| |
| static constexpr size_t | maxNeighborSolicitationSize |
| | biggest neighbor solicitation the codec writes, link layer address option included.
|
| |
| static constexpr size_t | maxNeighborAdvertisementSize |
| | biggest neighbor advertisement the codec writes, link layer address option included.
|
| |
|
| struct | __attribute__ ((packed)) RdnssHeader |
| | recursive DNS server option header, RFC 8106 section 5.1.
|
| |
|
| static bool | writeLinkAddress (char *&cur, const char *end, const MacAddress &link, OptionType type=SourceLinkAddress) |
| | write a link layer address option into a buffer.
|
| |
| template<typename Handler > |
| static int | readOptions (const char *cur, const char *end, Handler &&handler) |
| | walk through the options of a message, RFC 4861 section 4.6.
|
| |
|
| static constexpr size_t | _optionHeaderSize = 2 |
| | size of an option type and length fields.
|
| |
| static constexpr size_t | _maxOptionSize = 255 << 3 |
| | biggest option, its length field counts units of 8 octets.
|
| |
| static constexpr size_t | _maxDnsServers = 127 |
| | most recursive DNS servers a single option can carry.
|
| |
◆ MessageType
NDP message types, RFC 4861 section 4.
| Enumerator |
|---|
| RouterSolicit | a host looking for routers.
|
| RouterAdvert | a router advertising its presence.
|
| NeighborSolicit | a node resolving a neighbor or checking its reachability.
|
| NeighborAdvert | a node answering a solicitation or announcing a change.
|
◆ OptionType
NDP option types.
| Enumerator |
|---|
| SourceLinkAddress | link layer address of the sender.
|
| TargetLinkAddress | link layer address of the target.
|
| PrefixInformation | on-link and autoconfiguration prefix.
|
| Mtu | link MTU.
|
| RecursiveDnsServer | recursive DNS servers, RFC 8106.
|
◆ __attribute__()
| struct join::NdpMessage::__attribute__ |
( |
(packed) | | ) |
|
|
inlineprotected |
recursive DNS server option header, RFC 8106 section 5.1.
option type.
option length in units of 8 octets.
reserved.
time in seconds the servers may be used for.
◆ deserialize() [1/4]
| int join::NdpMessage::deserialize |
( |
NeighborAdvertisement & | packet, |
|
|
const char * | data, |
|
|
size_t | size ) const |
|
inline |
deserialize a neighbor advertisement from a buffer.
- Parameters
-
| packet | neighbor advertisement to deserialize into. |
| data | buffer holding the message to deserialize. |
| size | message size. |
- Returns
- 0 on success, -1 on failure.
◆ deserialize() [2/4]
| int join::NdpMessage::deserialize |
( |
NeighborSolicitation & | packet, |
|
|
const char * | data, |
|
|
size_t | size ) const |
|
inline |
deserialize a neighbor solicitation from a buffer.
- Parameters
-
| packet | neighbor solicitation to deserialize into. |
| data | buffer holding the message to deserialize. |
| size | message size. |
- Returns
- 0 on success, -1 on failure.
◆ deserialize() [3/4]
| int join::NdpMessage::deserialize |
( |
RouterAdvertisement & | packet, |
|
|
const char * | data, |
|
|
size_t | size ) const |
|
inline |
deserialize a router advertisement from a buffer.
- Parameters
-
| packet | router advertisement to deserialize into. |
| data | buffer holding the message to deserialize. |
| size | message size. |
- Returns
- 0 on success, -1 on failure.
◆ deserialize() [4/4]
| int join::NdpMessage::deserialize |
( |
RouterSolicitation & | packet, |
|
|
const char * | data, |
|
|
size_t | size ) const |
|
inline |
deserialize a router solicitation from a buffer.
- Parameters
-
| packet | router solicitation to deserialize into. |
| data | buffer holding the message to deserialize. |
| size | message size. |
- Returns
- 0 on success, -1 on failure.
◆ readOptions()
template<typename Handler >
| static int join::NdpMessage::readOptions |
( |
const char * | cur, |
|
|
const char * | end, |
|
|
Handler && | handler ) |
|
inlinestaticprotected |
walk through the options of a message, RFC 4861 section 4.6.
- Parameters
-
| cur | beginning of the options. |
| end | end of the options. |
| handler | function called with each option, header included, and its size. |
- Returns
- 0 on success, -1 if an option is malformed.
◆ serialize() [1/6]
| ssize_t join::NdpMessage::serialize |
( |
const NeighborAdvertisement & | packet, |
|
|
char * | data, |
|
|
size_t | maxSize ) const |
|
inline |
serialize a neighbor advertisement into a buffer.
- Parameters
-
| packet | neighbor advertisement to serialize. |
| data | buffer to serialize the message into. |
| maxSize | buffer size. |
- Returns
- the message size, -1 on failure.
◆ serialize() [2/6]
serialize a neighbor advertisement into a buffer with the given link layer address.
- Parameters
-
| packet | neighbor advertisement to serialize. |
| data | buffer to serialize the message into. |
| maxSize | buffer size. |
| link | link layer address to carry instead of the one of the advertisement. |
- Returns
- the message size, -1 on failure.
◆ serialize() [3/6]
| ssize_t join::NdpMessage::serialize |
( |
const NeighborSolicitation & | packet, |
|
|
char * | data, |
|
|
size_t | maxSize ) const |
|
inline |
serialize a neighbor solicitation into a buffer.
- Parameters
-
| packet | neighbor solicitation to serialize. |
| data | buffer to serialize the message into. |
| maxSize | buffer size. |
- Returns
- the message size, -1 on failure.
◆ serialize() [4/6]
| ssize_t join::NdpMessage::serialize |
( |
const RouterAdvertisement & | packet, |
|
|
char * | data, |
|
|
size_t | maxSize ) const |
|
inline |
serialize a router advertisement into a buffer.
- Parameters
-
| packet | router advertisement to serialize. |
| data | buffer to serialize the message into. |
| maxSize | buffer size. |
- Returns
- the message size, -1 on failure.
◆ serialize() [5/6]
serialize a router advertisement into a buffer with the given link layer address.
- Parameters
-
| packet | router advertisement to serialize. |
| data | buffer to serialize the message into. |
| maxSize | buffer size. |
| link | link layer address to carry instead of the one of the advertisement. |
- Returns
- the message size, -1 on failure.
◆ serialize() [6/6]
| ssize_t join::NdpMessage::serialize |
( |
const RouterSolicitation & | packet, |
|
|
char * | data, |
|
|
size_t | maxSize ) const |
|
inline |
serialize a router solicitation into a buffer.
- Parameters
-
| packet | router solicitation to serialize. |
| data | buffer to serialize the message into. |
| maxSize | buffer size. |
- Returns
- the message size, -1 on failure.
◆ writeLinkAddress()
write a link layer address option into a buffer.
- Parameters
-
| cur | current position in the buffer, advanced on success. |
| end | end of the buffer. |
| link | link layer address, nothing is written if wildcard. |
| type | option type, source or target link layer address. |
- Returns
- true on success, false if the buffer is too small.
◆ _maxDnsServers
| size_t join::NdpMessage::_maxDnsServers = 127 |
|
staticconstexprprotected |
most recursive DNS servers a single option can carry.
◆ _maxOptionSize
| size_t join::NdpMessage::_maxOptionSize = 255 << 3 |
|
staticconstexprprotected |
biggest option, its length field counts units of 8 octets.
◆ _optionHeaderSize
| size_t join::NdpMessage::_optionHeaderSize = 2 |
|
staticconstexprprotected |
size of an option type and length fields.
◆ maxNeighborAdvertisementSize
| size_t join::NdpMessage::maxNeighborAdvertisementSize |
|
staticconstexpr |
Initial value:=
static constexpr size_t _optionHeaderSize
size of an option type and length fields.
Definition ndp_message.hpp:684
biggest neighbor advertisement the codec writes, link layer address option included.
◆ maxNeighborSolicitationSize
| size_t join::NdpMessage::maxNeighborSolicitationSize |
|
staticconstexpr |
Initial value:
biggest neighbor solicitation the codec writes, link layer address option included.
◆ maxRouterSolicitationSize
| size_t join::NdpMessage::maxRouterSolicitationSize |
|
staticconstexpr |
Initial value:
biggest router solicitation the codec writes, link layer address option included.
The documentation for this class was generated from the following file: