aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/core
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2019-01-14 11:59:11 +0100
committerPhilipp Maier <pmaier@sysmocom.de>2019-01-17 17:46:08 +0100
commit64b51eb68bd272b6b1f2cefa2b33e9dd74024d0c (patch)
treeb7093354ea3140b0f8c6d4e048793a4feeaba4c0 /include/osmocom/core
parent1bec3908c6c25a0814872ca3c383f5bfe6babbe8 (diff)
socket: add define for socket name length
The function osmo_sock_get_name_buf() can be used to write a string representation to a user provided memory. Unfortunately the proper length for the user provided memory is not obvious. To make using osmo_sock_get_name_buf() more practical, add a define constant that defines the length of the required memory. Also use this define in socket.c. Change-Id: If8be8c2c0d4935da17ab13b2c2127b719ceefbcc
Diffstat (limited to 'include/osmocom/core')
-rw-r--r--include/osmocom/core/socket.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/osmocom/core/socket.h b/include/osmocom/core/socket.h
index 43604ec..c183532 100644
--- a/include/osmocom/core/socket.h
+++ b/include/osmocom/core/socket.h
@@ -28,6 +28,8 @@ struct osmo_fd;
#define OSMO_SOCK_F_NO_MCAST_ALL (1 << 4)
/*! use SO_REUSEADDR on UDP ports (required for multicast) */
#define OSMO_SOCK_F_UDP_REUSEADDR (1 << 5)
+/*! maximum length of a socket name ("r=1.2.3.4:123<->l=5.6.7.8:987") */
+#define OSMO_SOCK_NAME_MAXLEN (2 + INET6_ADDRSTRLEN + 1 + 5 + 3 + 2 + INET6_ADDRSTRLEN + 1 + 5 + 1)
int osmo_sock_init(uint16_t family, uint16_t type, uint8_t proto,
const char *host, uint16_t port, unsigned int flags);