gsm0808 + ipa: fix compilation on systems without sys/socket.h

Change-Id: I60f5d4982cd96ab29f9924ec11b46bf56fbfc346
This commit is contained in:
Harald Welte 2017-05-15 12:50:04 +02:00
parent bfe62e5781
commit 20725b9eea
4 changed files with 17 additions and 5 deletions

View File

@ -21,7 +21,7 @@
#include "tlv.h"
#include <osmocom/gsm/protocol/gsm_08_08.h>
#include <sys/socket.h>
struct sockaddr_storage;
struct msgb;

View File

@ -19,7 +19,7 @@
*/
#pragma once
#include <sys/socket.h>
struct sockaddr_storage;
#include <osmocom/gsm/protocol/gsm_08_08.h>

View File

@ -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,

View File

@ -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;