summaryrefslogtreecommitdiffstats
path: root/src/shared/libosmocore
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-05-22 12:26:42 +0200
committerHarald Welte <laforge@gnumonks.org>2011-05-22 12:26:42 +0200
commit8226b8eae946c70bb7d23730029146f2cd320ad8 (patch)
treeca1b55128ca5537b980dcba1abb60c491a7b8f6e /src/shared/libosmocore
parent393ddf9e79c47878e53a318f69e18a36c317bab0 (diff)
parente476442cf0e84c65565ace545f5b73602b5f0ffc (diff)
Merge commit 'e476442cf0e84c65565ace545f5b73602b5f0ffc'
Diffstat (limited to 'src/shared/libosmocore')
-rw-r--r--src/shared/libosmocore/configure.in2
-rw-r--r--src/shared/libosmocore/include/osmocom/core/socket.h5
-rw-r--r--src/shared/libosmocore/src/gsmtap_util.c14
-rw-r--r--src/shared/libosmocore/src/socket.c6
4 files changed, 17 insertions, 10 deletions
diff --git a/src/shared/libosmocore/configure.in b/src/shared/libosmocore/configure.in
index ead18f07..2e22bb24 100644
--- a/src/shared/libosmocore/configure.in
+++ b/src/shared/libosmocore/configure.in
@@ -18,7 +18,7 @@ AC_CONFIG_MACRO_DIR([m4])
dnl checks for header files
AC_HEADER_STDC
-AC_CHECK_HEADERS(execinfo.h sys/select.h syslog.h ctype.h)
+AC_CHECK_HEADERS(execinfo.h sys/select.h sys/socket.h syslog.h ctype.h)
# The following test is taken from WebKit's webkit.m4
saved_CFLAGS="$CFLAGS"
diff --git a/src/shared/libosmocore/include/osmocom/core/socket.h b/src/shared/libosmocore/include/osmocom/core/socket.h
index 3ede524b..a3baa9d5 100644
--- a/src/shared/libosmocore/include/osmocom/core/socket.h
+++ b/src/shared/libosmocore/include/osmocom/core/socket.h
@@ -2,7 +2,8 @@
#define _OSMOCORE_SOCKET_H
#include <stdint.h>
-#include <sys/socket.h>
+
+struct sockaddr;
int osmo_sock_init(uint16_t family, uint16_t type, uint8_t proto,
const char *host, uint16_t port, int connect0_bind1);
@@ -11,6 +12,6 @@ int osmo_sock_init_sa(struct sockaddr *ss, uint16_t type,
uint8_t proto, int connect0_bind1);
/* determine if the given address is a local address */
-int osmo_sockaddr_is_local(struct sockaddr *addr, socklen_t addrlen);
+int osmo_sockaddr_is_local(struct sockaddr *addr, unsigned int addrlen);
#endif /* _OSMOCORE_SOCKET_H */
diff --git a/src/shared/libosmocore/src/gsmtap_util.c b/src/shared/libosmocore/src/gsmtap_util.c
index 15426358..5c68b6a0 100644
--- a/src/shared/libosmocore/src/gsmtap_util.c
+++ b/src/shared/libosmocore/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 @@ struct msgb *gsmtap_makemsg(uint16_t arfcn, uint8_t ts, uint8_t chan_type,
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 @@ int gsmtap_source_add_sink_fd(int gsmtap_fd)
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 @@ struct gsmtap_inst *gsmtap_source_init(const char *host, uint16_t port,
return gti;
}
-#endif /* HAVE_SYS_SELECT_H */
+#endif /* HAVE_SYS_SOCKET_H */
diff --git a/src/shared/libosmocore/src/socket.c b/src/shared/libosmocore/src/socket.c
index bd4914fd..e053c24d 100644
--- a/src/shared/libosmocore/src/socket.c
+++ b/src/shared/libosmocore/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 @@ int osmo_sock_init_sa(struct sockaddr *ss, uint16_t type,
}
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 @@ int osmo_sockaddr_is_local(struct sockaddr *addr, socklen_t addrlen)
return 0;
}
+
+#endif /* HAVE_SYS_SOCKET_H */