summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-05-15 12:50:04 +0200
committerHarald Welte <laforge@gnumonks.org>2017-05-15 13:42:03 +0200
commit20725b9eea15720a5dbad19aac6236b86a3e34c6 (patch)
treeed76d626ab497385c903e5a7c2af1cb993b5319d
parentbfe62e5781e3ee895a44ca9ccc155ff87c42bf43 (diff)
gsm0808 + ipa: fix compilation on systems without sys/socket.h
Change-Id: I60f5d4982cd96ab29f9924ec11b46bf56fbfc346
-rw-r--r--include/osmocom/gsm/gsm0808.h2
-rw-r--r--include/osmocom/gsm/gsm0808_utils.h2
-rw-r--r--src/gsm/gsm0808_utils.c10
-rw-r--r--src/gsm/ipa.c8
4 files changed, 17 insertions, 5 deletions
diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h
index a9f610a8..9be229c6 100644
--- a/include/osmocom/gsm/gsm0808.h
+++ b/include/osmocom/gsm/gsm0808.h
@@ -21,7 +21,7 @@
#include "tlv.h"
#include <osmocom/gsm/protocol/gsm_08_08.h>
-#include <sys/socket.h>
+struct sockaddr_storage;
struct msgb;
diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h
index e6e55a7e..c11bf8d3 100644
--- a/include/osmocom/gsm/gsm0808_utils.h
+++ b/include/osmocom/gsm/gsm0808_utils.h
@@ -19,7 +19,7 @@
*/
#pragma once
-#include <sys/socket.h>
+struct sockaddr_storage;
#include <osmocom/gsm/protocol/gsm_08_08.h>
diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c
index 2fa265a9..ff97b2d2 100644
--- a/src/gsm/gsm0808_utils.c
+++ b/src/gsm/gsm0808_utils.c
@@ -18,12 +18,12 @@
*
*/
+#include "config.h"
+
#include <osmocom/core/utils.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/byteswap.h>
#include <string.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
#include <errno.h>
#include <osmocom/gsm/protocol/gsm_08_08.h>
@@ -35,6 +35,10 @@
#define CHANNEL_TYPE_ELEMENT_MINLEN 3
#define ENCRYPT_INFO_ELEMENT_MINLEN 1
+#ifdef HAVE_SYS_SOCKET_H
+
+#include <sys/socket.h>
+#include <netinet/in.h>
/* Encode AoIP transport address element */
uint8_t gsm0808_enc_aoip_trasp_addr(struct msgb *msg,
const struct sockaddr_storage *ss)
@@ -125,6 +129,8 @@ int gsm0808_dec_aoip_trasp_addr(struct sockaddr_storage *ss,
return (int)(elem - old_elem);
}
+#endif /* HAVE_SYS_SOCKET_H */
+
/* Helper function for gsm0808_enc_speech_codec()
* and gsm0808_enc_speech_codec_list() */
static uint8_t enc_speech_codec(struct msgb *msg,
diff --git a/src/gsm/ipa.c b/src/gsm/ipa.c
index 90cf0eb6..fa6a8b0d 100644
--- a/src/gsm/ipa.c
+++ b/src/gsm/ipa.c
@@ -21,13 +21,14 @@
*
*/
+#include "config.h"
+
#include <unistd.h>
#include <stdint.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/types.h>
-#include <sys/socket.h>
#include <osmocom/core/byteswap.h>
#include <osmocom/core/msgb.h>
@@ -435,6 +436,9 @@ void ipa_prepend_header(struct msgb *msg, int proto)
hh->proto = proto;
}
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+
int ipa_msg_recv(int fd, struct msgb **rmsg)
{
int rc = ipa_msg_recv_buffered(fd, rmsg, NULL);
@@ -564,6 +568,8 @@ discard_msg:
return ret;
}
+#endif /* SYS_SOCKET_H */
+
struct msgb *ipa_msg_alloc(int headroom)
{
struct msgb *nmsg;