aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2018-10-25 11:16:36 +0200
committerHarald Welte <laforge@gnumonks.org>2018-10-26 17:54:16 +0000
commit7acd5d039491a14a05b6aa08890d28590dde8b96 (patch)
tree8636060ce73f1259c7c60a9df518adccff823282 /include
parente74f49d973da4d6dce741deee0d249e5848d06ce (diff)
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
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/core/socket.h6
1 files changed, 6 insertions, 0 deletions
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 <stdint.h>
#include <stdbool.h>
+#include <stddef.h>
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);