From 7acd5d039491a14a05b6aa08890d28590dde8b96 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Thu, 25 Oct 2018 11:16:36 +0200 Subject: add osmo_sock_get_{local,remote}_ip{,_port}() Return only the IP or port of either the local or remote connection, not the whole set of IP and port of both the local and remote connection like osmo_sock_get_name() does it. This is needed for OS#2841, where we only want to print the remote IP. Related: OS#2841 Change-Id: I6803c204771c59a2002bc6a0e6b79c83c35f87e1 --- include/osmocom/core/socket.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/osmocom') diff --git a/include/osmocom/core/socket.h b/include/osmocom/core/socket.h index f23a2436..28f89a50 100644 --- a/include/osmocom/core/socket.h +++ b/include/osmocom/core/socket.h @@ -9,6 +9,7 @@ #include #include +#include struct sockaddr; struct osmo_fd; @@ -56,6 +57,11 @@ int osmo_sock_unix_init_ofd(struct osmo_fd *ofd, uint16_t type, uint8_t proto, const char *socket_path, unsigned int flags); char *osmo_sock_get_name(void *ctx, int fd); +int osmo_sock_get_local_ip(int fd, char *host, size_t len); +int osmo_sock_get_local_ip_port(int fd, char *port, size_t len); +int osmo_sock_get_remote_ip(int fd, char *host, size_t len); +int osmo_sock_get_remote_ip_port(int fd, char *port, size_t len); + int osmo_sock_mcast_loop_set(int fd, bool enable); int osmo_sock_mcast_ttl_set(int fd, uint8_t ttl); -- cgit v1.2.3