diff options
Diffstat (limited to 'utils.h')
-rw-r--r-- | utils.h | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -5,8 +5,6 @@ #include <stdbool.h> #include <stdlib.h> -int strtou16_strict(const char *str, uint16_t *result); - struct list_head { struct list_head *next; struct list_head *prev; @@ -86,6 +84,21 @@ static inline void* zmalloc(size_t size) return calloc(1, size); } +#define ADDRSTRLEN (9 /*strlen("AF_INETX ")*/ + INET6_ADDRSTRLEN + 6 /*strlen(" 65535")*/ + 1) +struct sockaddr_in46 { + union { + struct sockaddr_storage storage; + struct sockaddr_in in4; + struct sockaddr_in6 in6; + }; + socklen_t addrlen; + struct list_head list; +}; + +int strtou16_strict(const char *str, uint16_t *result); + +char *sockaddr_to_str(struct sockaddr_in46 *addr, char *buf, size_t buflen); + /* #define _cleanup_(x) __attribute__((cleanup(x))) |