//!< text for debug messages.
uint8_t id; //!< Node ID (index in node array).
- fr_socket_addr_t addr; //!< Current node address.
- fr_socket_addr_t pending_addr; //!< New node address to be applied when the pool
+ fr_socket_t addr; //!< Current node address.
+ fr_socket_t pending_addr; //!< New node address to be applied when the pool
//!< is reconnected.
fr_redis_cluster_t *cluster; //!< Commmon configuration (database number,
* - FR_REDIS_CLUSTER_RCODE_SUCCESS on success.
* - FR_REDIS_CLUSTER_RCODE_BAD_INPUT if the server returned an invalid redirect.
*/
-static fr_redis_cluster_rcode_t cluster_node_conf_from_redirect(uint16_t *key_slot, fr_socket_addr_t *node_addr,
+static fr_redis_cluster_rcode_t cluster_node_conf_from_redirect(uint16_t *key_slot, fr_socket_t *node_addr,
redisReply *redirect)
{
char *p, *q;
* - -1 if no such node exists.
*/
int fr_redis_cluster_pool_by_node_addr(fr_pool_t **pool, fr_redis_cluster_t *cluster,
- fr_socket_addr_t *node_addr, bool create)
+ fr_socket_t *node_addr, bool create)
{
fr_redis_cluster_node_t find, *found;
bool is_master;
bool is_slave;
uint8_t count;
- fr_socket_addr_t *found;
+ fr_socket_t *found;
} addr_by_role_ctx_t;
/** Walk all used pools, recording the IP addresses of ones matching the filter
* @param[in] is_slave If true, include the addresses of all the slaves nodes.
* @return the number of ip addresses written to out.
*/
-ssize_t fr_redis_cluster_node_addr_by_role(TALLOC_CTX *ctx, fr_socket_addr_t *out[],
+ssize_t fr_redis_cluster_node_addr_by_role(TALLOC_CTX *ctx, fr_socket_t *out[],
fr_redis_cluster_t *cluster, bool is_master, bool is_slave)
{
addr_by_role_ctx_t context;
context.is_master = is_master;
context.is_slave = is_slave;
context.count = 0;
- context.found = talloc_zero_array(ctx, fr_socket_addr_t, in_use);
+ context.found = talloc_zero_array(ctx, fr_socket_t, in_use);
if (!context.found) {
fr_strerror_printf("Out of memory");
return -1;
int proto; //!< Protocol.
int fd; //!< File descriptor if this is a live socket.
-} fr_socket_addr_t;
+} fr_socket_t;
/** Check the proto value is sane/supported
*
#define FR_SOCKET_ADDR_ALLOC_DEF_FUNC(_func, ...) \
{ \
- fr_socket_addr_t *addr; \
- addr = talloc(ctx, fr_socket_addr_t); \
+ fr_socket_t *addr; \
+ addr = talloc(ctx, fr_socket_t); \
if (unlikely(!addr)) return NULL; \
return _func(addr, ##__VA_ARGS__); \
}
-/** Swap src/dst information of a fr_socket_addr_t
+/** Swap src/dst information of a fr_socket_t
*
* @param[out] dst Where to write the swapped addresses. May be the same as src.
* @param[in] src Socket address to swap.
*/
-static inline void fr_socket_addr_swap(fr_socket_addr_t *dst, fr_socket_addr_t const *src)
+static inline void fr_socket_addr_swap(fr_socket_t *dst, fr_socket_t const *src)
{
- fr_socket_addr_t tmp = *src;
+ fr_socket_t tmp = *src;
if (dst != src) *dst = tmp;
}
}
-/** Initialise a fr_socket_addr_t for connecting to a remote host using a specific src interface, address and port
+/** Initialise a fr_socket_t for connecting to a remote host using a specific src interface, address and port
*
* Can also be used to record information from an incoming packet so that we can
* identify the correct return path later.
* @param[in] dst_port The destination port of the packet.
* @return
* - NULL if invalid parameters are provided.
- * - An initialised fr_socket_addr_t struct.
+ * - An initialised fr_socket_t struct.
*/
-static inline fr_socket_addr_t *fr_socket_addr_init_inet(fr_socket_addr_t *addr,
+static inline fr_socket_t *fr_socket_addr_init_inet(fr_socket_t *addr,
int proto,
int ifindex, fr_ipaddr_t const *src_ipaddr, int src_port,
fr_ipaddr_t const *dst_ipaddr, int dst_port)
{
if (!fr_socket_is_inet(proto)) return NULL;
- *addr = (fr_socket_addr_t){
+ *addr = (fr_socket_t){
.proto = proto,
.inet = {
.ifindex = ifindex,
return addr;
}
-static inline fr_socket_addr_t *fr_socket_addr_alloc_inet(TALLOC_CTX *ctx, int proto,
+static inline fr_socket_t *fr_socket_addr_alloc_inet(TALLOC_CTX *ctx, int proto,
int ifindex, fr_ipaddr_t const *src_ipaddr, int src_port,
fr_ipaddr_t const *dst_ipaddr, int dst_port)
FR_SOCKET_ADDR_ALLOC_DEF_FUNC(fr_socket_addr_init_inet,
proto, ifindex, src_ipaddr, src_port, dst_ipaddr, dst_port)
-/** Initialise a fr_socket_addr_t for binding to a local socket
+/** Initialise a fr_socket_t for binding to a local socket
*
* @param[out] addr to initialise.
* @param[in] proto one of the IPPROTO_* macros, i.e. IPPROTO_TCP, IPPROTO_UDP
* @param[in] port The source port to bind to.
* @return
* - NULL if invalid parameters are provided.
- * - An initialised fr_socket_addr_t struct.
+ * - An initialised fr_socket_t struct.
*/
-static inline fr_socket_addr_t *fr_socket_addr_init_inet_src(fr_socket_addr_t *addr,
+static inline fr_socket_t *fr_socket_addr_init_inet_src(fr_socket_t *addr,
int proto, int ifindex, fr_ipaddr_t const *ipaddr, int port)
{
if (!fr_socket_is_inet(proto)) return NULL;
- *addr = (fr_socket_addr_t){
+ *addr = (fr_socket_t){
.proto = proto,
.inet = {
.ifindex = ifindex,
return addr;
}
-static inline fr_socket_addr_t *fr_socket_addr_alloc_inet_src(TALLOC_CTX *ctx, int proto,
+static inline fr_socket_t *fr_socket_addr_alloc_inet_src(TALLOC_CTX *ctx, int proto,
int ifindex, fr_ipaddr_t const *ipaddr, int port)
FR_SOCKET_ADDR_ALLOC_DEF_FUNC(fr_socket_addr_init_inet_src, proto, ifindex, ipaddr, port)
-/** Initialise a fr_socket_addr_t for connecting to a remote host
+/** Initialise a fr_socket_t for connecting to a remote host
*
* @param[out] addr to initialise.
* @param[in] proto one of the IPPROTO_* macros, i.e. IPPROTO_TCP, IPPROTO_UDP
* @param[in] port The source port to bind to.
* @return
* - NULL if invalid parameters are provided.
- * - An initialised fr_socket_addr_t struct.
+ * - An initialised fr_socket_t struct.
*/
-static inline fr_socket_addr_t *fr_socket_addr_init_inet_dst(fr_socket_addr_t *addr,
+static inline fr_socket_t *fr_socket_addr_init_inet_dst(fr_socket_t *addr,
int proto, fr_ipaddr_t const *ipaddr, int port)
{
if (!fr_socket_is_inet(proto)) return NULL;
- *addr = (fr_socket_addr_t){
+ *addr = (fr_socket_t){
.proto = proto,
.inet = {
.dst_ipaddr = *ipaddr,
return addr;
}
-static inline fr_socket_addr_t *fr_socket_addr_alloc_inet_dst(TALLOC_CTX *ctx, int proto,
+static inline fr_socket_t *fr_socket_addr_alloc_inet_dst(TALLOC_CTX *ctx, int proto,
fr_ipaddr_t const *ipaddr, int port)
FR_SOCKET_ADDR_ALLOC_DEF_FUNC(fr_socket_addr_init_inet_dst, proto, ipaddr, port)