socket-util: add sockaddr_in_addr() helper

This extracts the IP address (as union in_addr_union) from a socket
address (i.e. a struct sockaddr).
This commit is contained in:
Lennart Poettering
2020-12-02 15:14:21 +01:00
parent 9c2c6692f3
commit 3132597182
2 changed files with 21 additions and 1 deletions
+1
View File
@@ -102,6 +102,7 @@ const char* socket_address_get_path(const SocketAddress *a);
bool socket_ipv6_is_supported(void);
int sockaddr_port(const struct sockaddr *_sa, unsigned *port);
const union in_addr_union *sockaddr_in_addr(const struct sockaddr *sa);
int sockaddr_pretty(const struct sockaddr *_sa, socklen_t salen, bool translate_ipv6, bool include_port, char **ret);
int getpeername_pretty(int fd, bool include_port, char **ret);