Loading...
Searching...
No Matches
ada::serializers Namespace Reference

IP address serialization functions. More...

## Functions

void | find_longest_sequence_of_ipv6_pieces (const std::array< uint16_t, 8 > &address, size_t &compress, size_t &compress_length) noexcept
std::string | ipv6 (const std::array< uint16_t, 8 > &address)
std::string | ipv4 (uint64_t address)

## Detailed Description

IP address serialization functions.

Contains utilities for serializing IPv4 and IPv6 addresses to strings.

## Function Documentation

## find_longest_sequence_of_ipv6_pieces()

void ada::serializers::find_longest_sequence_of_ipv6_pieces | ( | const std::array< uint16_t, 8 > & | address,
|  | size_t & | compress,
|  | size_t & | compress_length )

noexcept

Finds the longest consecutive sequence of zero pieces in an IPv6 address. Used for :: compression in IPv6 serialization.

Parameters

  | address | The 8 16-bit pieces of the IPv6 address.
  [out] | compress | Index of the start of the longest zero sequence.
  [out] | compress_length | Length of the longest zero sequence.

Definition at line 7 of file serializers.cpp.

Referenced by ipv6().

## ipv4()

std::string ada::serializers::ipv4 | ( | uint64_t | address | ) |

Serializes an IPv4 address to its dotted-decimal string representation.

Parameters

  address | The 32-bit IPv4 address as an integer.

Returns
  The serialized IPv4 string (e.g., "192.168.1.1").

See also
  https://url.spec.whatwg.org/#concept-ipv4-serializer

Definition at line 66 of file serializers.cpp.

## ipv6()

std::string ada::serializers::ipv6 | ( | const std::array< uint16_t, 8 > & | address | ) |

Serializes an IPv6 address to its string representation.

Parameters

  address | The 8 16-bit pieces of the IPv6 address.

Returns
  The serialized IPv6 string (e.g., "2001:db8::1").

See also
  https://url.spec.whatwg.org/#concept-ipv6-serializer

Definition at line 25 of file serializers.cpp.

References find_longest_sequence_of_ipv6_pieces().