esp8266ndn
NDN Arduino library for ESP8266 and more
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | List of all members
ndnph::port_transport_socket::Ipv6EndpointIdHelper< capacity > Class Template Reference

Helper to pack IPv6 endpoint into 64-bit EndpointId. More...

#include <ipv6-endpointid.hpp>

Public Member Functions

 Ipv6EndpointIdHelper ()
 
uint64_t encode (const uint8_t *addr, size_t addrLen, uint16_t port)
 Pack IP address+port into EndpointId. More...
 
size_t decode (uint64_t endpointId, uint8_t addr[16], uint16_t *port)
 Unpack IP address+port from EndpointId. More...
 

Detailed Description

template<int capacity>
class ndnph::port_transport_socket::Ipv6EndpointIdHelper< capacity >

Helper to pack IPv6 endpoint into 64-bit EndpointId.

Template Parameters
capacitymaximum is 15.

IPv6 address+port has 144 bits, longer than the 64-bit EndpointId. This data structure has an internal table to store parts of each full IPv6 endpoint, while the returned EndpointId contains an index into this table and a checksum. This table can track at least capacity distinct flows. Overflow may cause failed or incorrect unpacking.

Constructor & Destructor Documentation

◆ Ipv6EndpointIdHelper()

template<int capacity>
ndnph::port_transport_socket::Ipv6EndpointIdHelper< capacity >::Ipv6EndpointIdHelper ( )
inline

Member Function Documentation

◆ decode()

template<int capacity>
size_t ndnph::port_transport_socket::Ipv6EndpointIdHelper< capacity >::decode ( uint64_t  endpointId,
uint8_t  addr[16],
uint16_t *  port 
)
inline

Unpack IP address+port from EndpointId.

Parameters
endpointId64-bit EndpointId.
[out]addrIP address, 4 or 16 bytes.
[out]portport number.
Returns
address length; 0 indicates error.

◆ encode()

template<int capacity>
uint64_t ndnph::port_transport_socket::Ipv6EndpointIdHelper< capacity >::encode ( const uint8_t *  addr,
size_t  addrLen,
uint16_t  port 
)
inline

Pack IP address+port into EndpointId.

Parameters
addrIP address, 4 or 16 bytes.
addrLenIP address length, either 4 or 16.
portport number.
Returns
64-bit EndpointId.

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