34 PROTOCORE_IP_NONE = 0,
38static_assert(
sizeof(protocore_ip_family) == 1,
"protocore_ip_family must stay one byte (EMBED_ENUM_BYTE); "
39 "protocore_ip is embedded wherever an address is stored");
43 PROTOCORE_IP_SCOPE_UNSPECIFIED = 0,
44 PROTOCORE_IP_SCOPE_LOOPBACK,
45 PROTOCORE_IP_SCOPE_LINK_LOCAL,
46 PROTOCORE_IP_SCOPE_PRIVATE,
47 PROTOCORE_IP_SCOPE_MULTICAST,
48 PROTOCORE_IP_SCOPE_GLOBAL,
50static_assert(
sizeof(protocore_ip_scope) == 1,
"protocore_ip_scope must stay one byte (EMBED_ENUM_BYTE)");
60#define PROTOCORE_IP_STR_MAX 46
147 void (*
const parse)(
const uint8_t *work);
148 void (*
const format)(
const uint8_t *work);
150 void (*
const equal)(
const uint8_t *work);
168static const IpNs Ip __attribute__((unused)) = {
uint32_t protocore_ip_to_v4_be(const protocore_ip *ip)
The v4 address as a big-endian (network-order) uint32 (a<<24 | b<<16 | c<<8 | d).
EMBED_BEGIN_DECLS EMBED_ENUM_BYTE(protocore_ip_family, PROTOCORE_IP_NONE=0, PROTOCORE_IP_V4=4, PROTOCORE_IP_V6=6,)
Address family tag.
protocore_ip protocore_ip_from_v4_octets(uint8_t a, uint8_t b, uint8_t c, uint8_t d)
Build a v4 protocore_ip from four octets (a.b.c.d).
void protocore_ip_classify(const uint8_t *work)
void protocore_ip_equal(const uint8_t *work)
protocore_ip protocore_ip_from_v6_bytes(const uint8_t bytes[16])
Build a v6 protocore_ip from 16 address bytes in network (big-endian) order.
void protocore_ip_is_unspecified(const uint8_t *work)
void protocore_ip_format(const uint8_t *work)
IpVars IpV
The operands and the outcome.
void protocore_ip_parse(const uint8_t *work)
void protocore_ip_prefix_match(const uint8_t *work)
embed_bool protocore_ip_is_v4_mapped(const protocore_ip *ip)
Parse an IPv4 or IPv6 textual address (RFC 4291 §2.2) into out.
True if ip is empty (PROTOCORE_IP_NONE) or the all-zero unspecified address (0.0.0....
char * buf
where a format writes
const char * text
the textual address a parse reads
uint8_t prefix_len
the prefix length a match tests to
size_t cap
how much room that has
const protocore_ip * b
the second address a compare or a prefix test reads
protocore_ip * out
where a parse lands its result
const protocore_ip * ip
the address a call reads
void(*const equal)(const uint8_t *work)
void(*const parse)(const uint8_t *work)
void(*const is_unspecified)(const uint8_t *work)
void(*const classify)(const uint8_t *work)
void(*const format)(const uint8_t *work)
void(*const prefix_match)(const uint8_t *work)
A v4 or v6 address in network (big-endian) byte order.
uint8_t bytes[16]
network order; v4 uses the first 4
protocore_ip_family family
address family tag