GSMTAP/socket code: Check for sys/socket.h and conditionally compile
diff --git a/src/gsmtap_util.c b/src/gsmtap_util.c
index 1542635..5c68b6a 100644
--- a/src/gsmtap_util.c
+++ b/src/gsmtap_util.c
@@ -32,10 +32,9 @@
#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <osmocom/gsm/rsl.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
#include <sys/types.h>
-#include <netinet/in.h>
+
+#include <arpa/inet.h>
#include <stdio.h>
#include <unistd.h>
@@ -111,6 +110,11 @@
return msg;
}
+#ifdef HAVE_SYS_SOCKET_H
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+
/* Open a GSMTAP source (sending) socket, conncet it to host/port and
* return resulting fd */
int gsmtap_source_init_fd(const char *host, uint16_t port)
@@ -142,8 +146,6 @@
return -ENODEV;
}
-#ifdef HAVE_SYS_SELECT_H
-
int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg)
{
if (gti->ofd_wq_mode)
@@ -270,4 +272,4 @@
return gti;
}
-#endif /* HAVE_SYS_SELECT_H */
+#endif /* HAVE_SYS_SOCKET_H */
diff --git a/src/socket.c b/src/socket.c
index bd4914f..e053c24 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -1,5 +1,7 @@
#include "../config.h"
+#ifdef HAVE_SYS_SOCKET_H
+
#include <osmocom/core/logging.h>
#include <osmocom/core/select.h>
#include <osmocom/core/socket.h>
@@ -97,7 +99,7 @@
}
static int sockaddr_equal(const struct sockaddr *a,
- const struct sockaddr *b, socklen_t len)
+ const struct sockaddr *b, unsigned int len)
{
struct sockaddr_in *sin_a, *sin_b;
struct sockaddr_in6 *sin6_a, *sin6_b;
@@ -141,3 +143,5 @@
return 0;
}
+
+#endif /* HAVE_SYS_SOCKET_H */