XAddress
typedef struct XAddress XAddress;
typedef struct XAddress XAddress;
typedef enum{
X_NET_AF_IPV4=1,
X_NET_AF_IPV6=2,
}XAddressFamily;
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
);
XAddress *out_addrint32_t familyuint16_t portNothing.
Clear an XAddress structure (set to zero).
void x_net_address_clear(XAddress *addr);
XAddress *addrNothing.
Compare two XAddress values for equality.
int32_t x_net_address_equal(
const XAddress *a,
const XAddress *b
);
Non-zero if equal, 0 if not equal.
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
);
const int8_t *ipuint16_t portXAddress *out_addr0 on success, or -1 on failure.
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
);
const XAddress *addrchar *bufint32_t buf_lenNumber of characters written (excluding terminator), or -1 on failure.
Format an address as a human-readable string.
int32_t x_net_format_address(
const XAddress *addr,
char *out_str,
int32_t maxlen
);
const XAddress *addrchar *out_strint32_t maxlenNumber of characters written (excluding terminator), or -1 on failure.
Join an IPv4 multicast group by textual group address.
bool x_net_join_multicast_ipv4(
XSocket sock,
const int8_t *group
);
XSocket sockconst int8_t *groupTrue on success, false on failure.
Join an IPv4 multicast group using an XAddress structure.
bool x_net_join_multicast_ipv4_addr(
XSocket sock,
const XAddress *group_addr
);
True on success, false on failure.
Join an IPv6 multicast group.
bool x_net_join_multicast_ipv6(
XSocket sock,
const int8_t *multicast_ip,
uint32_t ifindex
);
XSocket sockconst int8_t *multicast_ipuint32_t ifindexTrue on success, false on failure.
Leave an IPv4 multicast group by textual group address.
bool x_net_leave_multicast_ipv4(
XSocket sock,
const int8_t *group
);
XSocket sockconst int8_t *groupTrue on success, false on failure.
Leave an IPv4 multicast group using an XAddress structure.
bool x_net_leave_multicast_ipv4_addr(
XSocket sock,
const XAddress *group_addr
);
True on success, false on failure.
Leave an IPv6 multicast group.
bool x_net_leave_multicast_ipv6(
XSocket sock,
const int8_t *multicast_ip,
uint32_t ifindex
);
XSocket sockconst int8_t *multicast_ipuint32_t ifindexTrue on success, false on failure.
Parse an IP string into a raw binary address.
int32_t x_net_parse_ip(
XAddressFamily family,
const int8_t *ip,
void *out_addr
);
XAddressFamily familyconst int8_t *ipvoid *out_addr0 on success, or -1 on failure.