Enum in stdx_network.h

XAddressFamily

typedef enum{
  X_NET_AF_IPV4=1,
  X_NET_AF_IPV6=2,
}XAddressFamily;
Function in stdx_network.h

x_net_address_any

Create an "any" address for binding on the given family and port.

void x_net_address_any(
 XAddress *out_addr,
 int32_t family,
 uint16_t port
);

Parameters

XAddress *out_addr
Output address to fill.
int32_t family
Address family (implementation expects a family code).
uint16_t port
Port to set.

Returns

Nothing.

Function in stdx_network.h

x_net_address_clear

Clear an XAddress structure (set to zero).

void x_net_address_clear(XAddress *addr);

Parameters

XAddress *addr
Address structure to clear.

Returns

Nothing.

Function in stdx_network.h

x_net_address_equal

Compare two XAddress values for equality.

int32_t x_net_address_equal(
 const XAddress *a,
 const XAddress *b
);

Parameters

const XAddress *a
First address.
const XAddress *b
Second address.

Returns

Non-zero if equal, 0 if not equal.

Function in stdx_network.h

x_net_address_from_ip_port

Build an XAddress from an IP string and port.

int32_t x_net_address_from_ip_port(
 const int8_t *ip,
 uint16_t port,
 XAddress *out_addr
);

Parameters

const int8_t *ip
IP address string.
uint16_t port
Port number.
XAddress *out_addr
Output address to fill.

Returns

0 on success, or -1 on failure.

Function in stdx_network.h

x_net_address_to_string

Convert an XAddress to a string representation (typically "IP:port").

int32_t x_net_address_to_string(
 const XAddress *addr,
 char *buf,
 int32_t buf_len
);

Parameters

const XAddress *addr
Address to format.
char *buf
Output buffer receiving the string.
int32_t buf_len
Size of buf in bytes/chars.

Returns

Number of characters written (excluding terminator), or -1 on failure.

Function in stdx_network.h

x_net_format_address

Format an address as a human-readable string.

int32_t x_net_format_address(
 const XAddress *addr,
 char *out_str,
 int32_t maxlen
);

Parameters

const XAddress *addr
Address to format.
char *out_str
Output buffer receiving the formatted string.
int32_t maxlen
Size of out_str in bytes/chars.

Returns

Number of characters written (excluding terminator), or -1 on failure.

Function in stdx_network.h

x_net_join_multicast_ipv4

Join an IPv4 multicast group by textual group address.

bool x_net_join_multicast_ipv4(
 XSocket sock,
 const int8_t *group
);

Parameters

XSocket sock
Socket handle.
const int8_t *group
Multicast group address string (e.g., "239.0.0.1").

Returns

True on success, false on failure.

Function in stdx_network.h

x_net_join_multicast_ipv4_addr

Join an IPv4 multicast group using an XAddress structure.

bool x_net_join_multicast_ipv4_addr(
 XSocket sock,
 const XAddress *group_addr
);

Parameters

XSocket sock
Socket handle.
const XAddress *group_addr
Multicast group address.

Returns

True on success, false on failure.

Function in stdx_network.h

x_net_join_multicast_ipv6

Join an IPv6 multicast group.

bool x_net_join_multicast_ipv6(
 XSocket sock,
 const int8_t *multicast_ip,
 uint32_t ifindex
);

Parameters

XSocket sock
Socket handle.
const int8_t *multicast_ip
Multicast group IPv6 address string.
uint32_t ifindex
Network interface index to join on.

Returns

True on success, false on failure.

Function in stdx_network.h

x_net_leave_multicast_ipv4

Leave an IPv4 multicast group by textual group address.

bool x_net_leave_multicast_ipv4(
 XSocket sock,
 const int8_t *group
);

Parameters

XSocket sock
Socket handle.
const int8_t *group
Multicast group address string.

Returns

True on success, false on failure.

Function in stdx_network.h

x_net_leave_multicast_ipv4_addr

Leave an IPv4 multicast group using an XAddress structure.

bool x_net_leave_multicast_ipv4_addr(
 XSocket sock,
 const XAddress *group_addr
);

Parameters

XSocket sock
Socket handle.
const XAddress *group_addr
Multicast group address.

Returns

True on success, false on failure.

Function in stdx_network.h

x_net_leave_multicast_ipv6

Leave an IPv6 multicast group.

bool x_net_leave_multicast_ipv6(
 XSocket sock,
 const int8_t *multicast_ip,
 uint32_t ifindex
);

Parameters

XSocket sock
Socket handle.
const int8_t *multicast_ip
Multicast group IPv6 address string.
uint32_t ifindex
Network interface index to leave on.

Returns

True on success, false on failure.

Function in stdx_network.h

x_net_parse_ip

Parse an IP string into a raw binary address.

int32_t x_net_parse_ip(
 XAddressFamily family,
 const int8_t *ip,
 void *out_addr
);

Parameters

XAddressFamily family
Address family (IPv4 or IPv6).
const int8_t *ip
IP address string.
void *out_addr
Output buffer receiving the raw address bytes.

Returns

0 on success, or -1 on failure.