aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libtrau
diff options
context:
space:
mode:
Diffstat (limited to 'openbsc/src/libtrau')
-rw-r--r--openbsc/src/libtrau/rtp_proxy.c50
-rw-r--r--openbsc/src/libtrau/subchan_demux.c28
-rw-r--r--openbsc/src/libtrau/trau_frame.c28
-rw-r--r--openbsc/src/libtrau/trau_mux.c16
4 files changed, 61 insertions, 61 deletions
diff --git a/openbsc/src/libtrau/rtp_proxy.c b/openbsc/src/libtrau/rtp_proxy.c
index 75f825600..97284ae18 100644
--- a/openbsc/src/libtrau/rtp_proxy.c
+++ b/openbsc/src/libtrau/rtp_proxy.c
@@ -60,9 +60,9 @@ enum rtp_bfd_priv {
/* according to RFC 1889 */
struct rtcp_hdr {
- u_int8_t byte0;
- u_int8_t type;
- u_int16_t length;
+ uint8_t byte0;
+ uint8_t type;
+ uint16_t length;
} __attribute__((packed));
#define RTCP_TYPE_SDES 202
@@ -72,40 +72,40 @@ struct rtcp_hdr {
/* according to RFC 3550 */
struct rtp_hdr {
#if __BYTE_ORDER == __LITTLE_ENDIAN
- u_int8_t csrc_count:4,
+ uint8_t csrc_count:4,
extension:1,
padding:1,
version:2;
- u_int8_t payload_type:7,
+ uint8_t payload_type:7,
marker:1;
#elif __BYTE_ORDER == __BIG_ENDIAN
- u_int8_t version:2,
+ uint8_t version:2,
padding:1,
extension:1,
csrc_count:4;
- u_int8_t marker:1,
+ uint8_t marker:1,
payload_type:7;
#endif
- u_int16_t sequence;
- u_int32_t timestamp;
- u_int32_t ssrc;
+ uint16_t sequence;
+ uint32_t timestamp;
+ uint32_t ssrc;
} __attribute__((packed));
struct rtp_x_hdr {
- u_int16_t by_profile;
- u_int16_t length;
+ uint16_t by_profile;
+ uint16_t length;
} __attribute__((packed));
#define RTP_VERSION 2
/* decode an rtp frame and create a new buffer with payload */
-static int rtp_decode(struct msgb *msg, u_int32_t callref, struct msgb **data)
+static int rtp_decode(struct msgb *msg, uint32_t callref, struct msgb **data)
{
struct msgb *new_msg;
struct gsm_data_frame *frame;
struct rtp_hdr *rtph = (struct rtp_hdr *)msg->data;
struct rtp_x_hdr *rtpxh;
- u_int8_t *payload;
+ uint8_t *payload;
int payload_len;
int msg_type;
int x_len;
@@ -286,11 +286,11 @@ int rtp_send_frame(struct rtp_socket *rs, struct gsm_data_frame *frame)
/* iterate over all chunks in one RTCP message, look for CNAME IEs and
* replace all of those with 'new_cname' */
static int rtcp_sdes_cname_mangle(struct msgb *msg, struct rtcp_hdr *rh,
- u_int16_t *rtcp_len, const char *new_cname)
+ uint16_t *rtcp_len, const char *new_cname)
{
- u_int8_t *rtcp_end;
- u_int8_t *cur = (u_int8_t *) rh;
- u_int8_t tag, len = 0;
+ uint8_t *rtcp_end;
+ uint8_t *cur = (uint8_t *) rh;
+ uint8_t tag, len = 0;
rtcp_end = cur + *rtcp_len;
/* move cur to end of RTP header */
@@ -343,7 +343,7 @@ static int rtcp_mangle(struct msgb *msg, struct rtp_socket *rs)
{
struct rtp_sub_socket *rss = &rs->rtcp;
struct rtcp_hdr *rtph;
- u_int16_t old_len;
+ uint16_t old_len;
int rc;
if (!mangle_rtcp_cname)
@@ -572,8 +572,8 @@ out_free:
return NULL;
}
-static int rtp_sub_socket_bind(struct rtp_sub_socket *rss, u_int32_t ip,
- u_int16_t port)
+static int rtp_sub_socket_bind(struct rtp_sub_socket *rss, uint32_t ip,
+ uint16_t port)
{
int rc;
socklen_t alen = sizeof(rss->sin_local);
@@ -598,7 +598,7 @@ static int rtp_sub_socket_bind(struct rtp_sub_socket *rss, u_int32_t ip,
static unsigned int next_udp_port = RTP_PORT_BASE;
/* bind a RTP socket to a local address */
-int rtp_socket_bind(struct rtp_socket *rs, u_int32_t ip)
+int rtp_socket_bind(struct rtp_socket *rs, uint32_t ip)
{
int rc = -EIO;
struct in_addr ia;
@@ -630,7 +630,7 @@ int rtp_socket_bind(struct rtp_socket *rs, u_int32_t ip)
}
static int rtp_sub_socket_connect(struct rtp_sub_socket *rss,
- u_int32_t ip, u_int16_t port)
+ uint32_t ip, uint16_t port)
{
int rc;
socklen_t alen = sizeof(rss->sin_local);
@@ -649,7 +649,7 @@ static int rtp_sub_socket_connect(struct rtp_sub_socket *rss,
}
/* 'connect' a RTP socket to a remote peer */
-int rtp_socket_connect(struct rtp_socket *rs, u_int32_t ip, u_int16_t port)
+int rtp_socket_connect(struct rtp_socket *rs, uint32_t ip, uint16_t port)
{
int rc;
struct in_addr ia;
@@ -682,7 +682,7 @@ int rtp_socket_proxy(struct rtp_socket *this, struct rtp_socket *other)
/* bind RTP/RTCP socket to application */
int rtp_socket_upstream(struct rtp_socket *this, struct gsm_network *net,
- u_int32_t callref)
+ uint32_t callref)
{
DEBUGP(DMUX, "rtp_socket_proxy(this=%p, callref=%u)\n",
this, callref);
diff --git a/openbsc/src/libtrau/subchan_demux.c b/openbsc/src/libtrau/subchan_demux.c
index ee62d41d3..740d2caaf 100644
--- a/openbsc/src/libtrau/subchan_demux.c
+++ b/openbsc/src/libtrau/subchan_demux.c
@@ -32,17 +32,17 @@
void *tall_tqe_ctx;
-static inline void append_bit(struct demux_subch *sch, u_int8_t bit)
+static inline void append_bit(struct demux_subch *sch, uint8_t bit)
{
sch->out_bitbuf[sch->out_idx++] = bit;
}
#define SYNC_HDR_BITS 16
-static const u_int8_t nullbytes[SYNC_HDR_BITS];
+static const uint8_t nullbytes[SYNC_HDR_BITS];
/* check if we have just completed the 16 bit zero sync header,
* in accordance with GSM TS 08.60 Chapter 4.8.1 */
-static int sync_hdr_complete(struct demux_subch *sch, u_int8_t bit)
+static int sync_hdr_complete(struct demux_subch *sch, uint8_t bit)
{
if (bit == 0)
sch->consecutive_zeros++;
@@ -83,7 +83,7 @@ int subch_demux_init(struct subch_demux *dmx)
/* input some arbitrary (modulo 4) number of bytes of a 64k E1 channel,
* split it into the 16k subchannels */
-int subch_demux_in(struct subch_demux *dmx, u_int8_t *data, int len)
+int subch_demux_in(struct subch_demux *dmx, uint8_t *data, int len)
{
int i, c;
@@ -92,12 +92,12 @@ int subch_demux_in(struct subch_demux *dmx, u_int8_t *data, int len)
return -EINVAL;
for (i = 0; i < len; i++) {
- u_int8_t inbyte = data[i];
+ uint8_t inbyte = data[i];
for (c = 0; c < NR_SUBCH; c++) {
struct demux_subch *sch = &dmx->subch[c];
- u_int8_t inbits;
- u_int8_t bit;
+ uint8_t inbits;
+ uint8_t bit;
/* ignore inactive subchannels */
if (!(dmx->chan_activ & (1 << c)))
@@ -171,7 +171,7 @@ static int alloc_add_idle_frame(struct subch_mux *mx, int sch_nr)
/* return the requested number of bits from the specified subchannel */
static int get_subch_bits(struct subch_mux *mx, int subch,
- u_int8_t *bits, int num_requested)
+ uint8_t *bits, int num_requested)
{
struct mux_subch *sch = &mx->subch[subch];
int num_bits = 0;
@@ -215,9 +215,9 @@ static int get_subch_bits(struct subch_mux *mx, int subch,
}
/* compact an array of 8 single-bit bytes into one byte of 8 bits */
-static u_int8_t compact_bits(const u_int8_t *bits)
+static uint8_t compact_bits(const uint8_t *bits)
{
- u_int8_t ret = 0;
+ uint8_t ret = 0;
int i;
for (i = 0; i < 8; i++)
@@ -227,9 +227,9 @@ static u_int8_t compact_bits(const u_int8_t *bits)
}
/* obtain a single output byte from the subchannel muxer */
-static int mux_output_byte(struct subch_mux *mx, u_int8_t *byte)
+static int mux_output_byte(struct subch_mux *mx, uint8_t *byte)
{
- u_int8_t bits[8];
+ uint8_t bits[8];
int rc;
/* combine two bits of every subchan */
@@ -244,7 +244,7 @@ static int mux_output_byte(struct subch_mux *mx, u_int8_t *byte)
}
/* Request the output of some muxed bytes from the subchan muxer */
-int subchan_mux_out(struct subch_mux *mx, u_int8_t *data, int len)
+int subchan_mux_out(struct subch_mux *mx, uint8_t *data, int len)
{
int i;
@@ -285,7 +285,7 @@ static void tx_queue_evict(struct mux_subch *sch, int num_evict)
}
/* enqueue some data into the tx_queue of a given subchannel */
-int subchan_mux_enqueue(struct subch_mux *mx, int s_nr, const u_int8_t *data,
+int subchan_mux_enqueue(struct subch_mux *mx, int s_nr, const uint8_t *data,
int len)
{
struct mux_subch *sch = &mx->subch[s_nr];
diff --git a/openbsc/src/libtrau/trau_frame.c b/openbsc/src/libtrau/trau_frame.c
index d4d6447cc..15cbe4ff9 100644
--- a/openbsc/src/libtrau/trau_frame.c
+++ b/openbsc/src/libtrau/trau_frame.c
@@ -28,10 +28,10 @@
#include <openbsc/subchan_demux.h>
#include <openbsc/debug.h>
-static u_int32_t get_bits(const u_int8_t *bitbuf, int offset, int num)
+static uint32_t get_bits(const uint8_t *bitbuf, int offset, int num)
{
int i;
- u_int32_t ret = 0;
+ uint32_t ret = 0;
for (i = offset; i < offset + num; i++) {
ret = ret << 1;
@@ -42,7 +42,7 @@ static u_int32_t get_bits(const u_int8_t *bitbuf, int offset, int num)
}
/* Decode according to 3.1.1 */
-static void decode_fr(struct decoded_trau_frame *fr, const u_int8_t *trau_bits)
+static void decode_fr(struct decoded_trau_frame *fr, const uint8_t *trau_bits)
{
int i;
int d_idx = 0;
@@ -63,7 +63,7 @@ static void decode_fr(struct decoded_trau_frame *fr, const u_int8_t *trau_bits)
}
/* Decode according to 3.1.2 */
-static void decode_amr(struct decoded_trau_frame *fr, const u_int8_t *trau_bits)
+static void decode_amr(struct decoded_trau_frame *fr, const uint8_t *trau_bits)
{
int i;
int d_idx = 0;
@@ -85,9 +85,9 @@ static void decode_amr(struct decoded_trau_frame *fr, const u_int8_t *trau_bits)
memcpy(fr->d_bits + d_idx, trau_bits + 305, 11);
}
-int decode_trau_frame(struct decoded_trau_frame *fr, const u_int8_t *trau_bits)
+int decode_trau_frame(struct decoded_trau_frame *fr, const uint8_t *trau_bits)
{
- u_int8_t cbits5 = get_bits(trau_bits, 17, 5);
+ uint8_t cbits5 = get_bits(trau_bits, 17, 5);
switch (cbits5) {
case TRAU_FT_FR_UP:
@@ -120,13 +120,13 @@ int decode_trau_frame(struct decoded_trau_frame *fr, const u_int8_t *trau_bits)
return 0;
}
-const u_int8_t ft_fr_down_bits[] = { 1, 1, 1, 0, 0 };
-const u_int8_t ft_idle_down_bits[] = { 0, 1, 1, 1, 0 };
+const uint8_t ft_fr_down_bits[] = { 1, 1, 1, 0, 0 };
+const uint8_t ft_idle_down_bits[] = { 0, 1, 1, 1, 0 };
/* modify an uplink TRAU frame so we can send it downlink */
int trau_frame_up2down(struct decoded_trau_frame *fr)
{
- u_int8_t cbits5 = get_bits(fr->c_bits, 0, 5);
+ uint8_t cbits5 = get_bits(fr->c_bits, 0, 5);
switch (cbits5) {
case TRAU_FT_FR_UP:
@@ -178,7 +178,7 @@ int trau_frame_up2down(struct decoded_trau_frame *fr)
}
-static void encode_fr(u_int8_t *trau_bits, const struct decoded_trau_frame *fr)
+static void encode_fr(uint8_t *trau_bits, const struct decoded_trau_frame *fr)
{
int i;
int d_idx = 0;
@@ -205,9 +205,9 @@ static void encode_fr(u_int8_t *trau_bits, const struct decoded_trau_frame *fr)
}
-int encode_trau_frame(u_int8_t *trau_bits, const struct decoded_trau_frame *fr)
+int encode_trau_frame(uint8_t *trau_bits, const struct decoded_trau_frame *fr)
{
- u_int8_t cbits5 = get_bits(fr->c_bits, 0, 5);
+ uint8_t cbits5 = get_bits(fr->c_bits, 0, 5);
/* 16 bits of sync header */
memset(trau_bits, 0, 16);
@@ -245,10 +245,10 @@ static struct decoded_trau_frame fr_idle_frame = {
.c_bits = { 0, 1, 1, 1, 0 }, /* IDLE DOWNLINK 3.5.5 */
.t_bits = { 1, 1, 1, 1 },
};
-static u_int8_t encoded_idle_frame[TRAU_FRAME_BITS];
+static uint8_t encoded_idle_frame[TRAU_FRAME_BITS];
static int dbits_initted;
-u_int8_t *trau_idle_frame(void)
+uint8_t *trau_idle_frame(void)
{
/* only initialize during the first call */
if (!dbits_initted) {
diff --git a/openbsc/src/libtrau/trau_mux.c b/openbsc/src/libtrau/trau_mux.c
index 645155422..82813b392 100644
--- a/openbsc/src/libtrau/trau_mux.c
+++ b/openbsc/src/libtrau/trau_mux.c
@@ -31,7 +31,7 @@
#include <openbsc/debug.h>
#include <osmocom/core/talloc.h>
-u_int8_t gsm_fr_map[] = {
+uint8_t gsm_fr_map[] = {
6, 6, 5, 5, 4, 4, 3, 3,
7, 2, 2, 6, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3,
@@ -53,7 +53,7 @@ struct upqueue_entry {
struct llist_head list;
struct gsm_network *net;
struct gsm_e1_subslot src;
- u_int32_t callref;
+ uint32_t callref;
};
static LLIST_HEAD(ss_map);
@@ -102,7 +102,7 @@ int trau_mux_map_lchan(const struct gsm_lchan *src,
/* unmap one particular subslot from another subslot */
-int trau_mux_unmap(const struct gsm_e1_subslot *ss, u_int32_t callref)
+int trau_mux_unmap(const struct gsm_e1_subslot *ss, uint32_t callref)
{
struct map_entry *me, *me2;
struct upqueue_entry *ue, *ue2;
@@ -156,14 +156,14 @@ lookup_trau_upqueue(const struct gsm_e1_subslot *src)
return NULL;
}
-static const u_int8_t c_bits_check[] = { 0, 0, 0, 1, 0 };
+static const uint8_t c_bits_check[] = { 0, 0, 0, 1, 0 };
/* we get called by subchan_demux */
int trau_mux_input(struct gsm_e1_subslot *src_e1_ss,
- const u_int8_t *trau_bits, int num_bits)
+ const uint8_t *trau_bits, int num_bits)
{
struct decoded_trau_frame tf;
- u_int8_t trau_bits_out[TRAU_FRAME_BITS];
+ uint8_t trau_bits_out[TRAU_FRAME_BITS];
struct gsm_e1_subslot *dst_e1_ss = lookup_trau_mux_map(src_e1_ss);
struct subch_mux *mx;
struct upqueue_entry *ue;
@@ -231,7 +231,7 @@ int trau_mux_input(struct gsm_e1_subslot *src_e1_ss,
}
/* add receiver instance for lchan and callref */
-int trau_recv_lchan(struct gsm_lchan *lchan, u_int32_t callref)
+int trau_recv_lchan(struct gsm_lchan *lchan, uint32_t callref)
{
struct gsm_e1_subslot *src_ss;
struct upqueue_entry *ue;
@@ -260,7 +260,7 @@ int trau_recv_lchan(struct gsm_lchan *lchan, u_int32_t callref)
int trau_send_frame(struct gsm_lchan *lchan, struct gsm_data_frame *frame)
{
- u_int8_t trau_bits_out[TRAU_FRAME_BITS];
+ uint8_t trau_bits_out[TRAU_FRAME_BITS];
struct gsm_e1_subslot *dst_e1_ss = &lchan->ts->e1_link;
struct subch_mux *mx;
int i, j, k, l, o;