path: root/include
diff options
authorMax <msuraev@sysmocom.de>2018-11-20 15:18:31 +0100
committerMax <msuraev@sysmocom.de>2018-12-07 10:33:29 +0000
commit9d7a247da4e20acc6638fcd06198bfe673d0c384 (patch)
treed70896c6b7413d79aaf3feeb347a1b542c3d53fb /include
parent72dfd437995cd5af6da6d8701e81c984744bc5ae (diff)
Add osmo_sockaddr_in_to_str_and_uint()
It's similar to osmo_sockaddr_to_str_and_uint() but does not require odd typecasting for AF_INET case. Make osmo_sockaddr_to_str_and_uint() into wrapper around new function and make sure to check for address family before typecasting. Also use proper return type. Change-Id: Ie384483124d407a960ab6732e6a7fd90554389d2
Diffstat (limited to 'include')
1 files changed, 3 insertions, 0 deletions
diff --git a/include/osmocom/core/socket.h b/include/osmocom/core/socket.h
index 28f89a5..79a61bb 100644
--- a/include/osmocom/core/socket.h
+++ b/include/osmocom/core/socket.h
@@ -11,6 +11,7 @@
#include <stdbool.h>
#include <stddef.h>
+struct sockaddr_in;
struct sockaddr;
struct osmo_fd;
@@ -49,6 +50,8 @@ int osmo_sockaddr_is_local(struct sockaddr *addr, unsigned int addrlen);
unsigned int osmo_sockaddr_to_str_and_uint(char *addr, unsigned int addr_len, uint16_t *port,
const struct sockaddr *sa);
+size_t osmo_sockaddr_in_to_str_and_uint(char *addr, unsigned int addr_len, uint16_t *port,
+ const struct sockaddr_in *sin);
int osmo_sock_unix_init(uint16_t type, uint8_t proto,
const char *socket_path, unsigned int flags);