diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 9e808fc1d..78832538e 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -12,31 +12,6 @@ struct mncc_sock_state; -/* the data structure stored in msgb->cb for openbsc apps */ -struct openbsc_msgb_cb { - unsigned char *bssgph; - unsigned char *llch; - - /* Cell Identifier */ - unsigned char *bssgp_cell_id; - - /* Identifiers of a BTS, equal to 'struct bssgp_bts_ctx' */ - uint16_t nsei; - uint16_t bvci; - - /* Identifier of a MS (inside BTS), equal to 'struct sgsn_mm_ctx' */ - uint32_t tlli; -} __attribute__((packed)); -#define OBSC_MSGB_CB(__msgb) ((struct openbsc_msgb_cb *)&((__msgb)->cb[0])) -#define msgb_tlli(__x) OBSC_MSGB_CB(__x)->tlli -#define msgb_nsei(__x) OBSC_MSGB_CB(__x)->nsei -#define msgb_bvci(__x) OBSC_MSGB_CB(__x)->bvci -#define msgb_gmmh(__x) (__x)->l3h -#define msgb_bssgph(__x) OBSC_MSGB_CB(__x)->bssgph -#define msgb_bssgp_len(__x) ((__x)->tail - (uint8_t *)msgb_bssgph(__x)) -#define msgb_bcid(__x) OBSC_MSGB_CB(__x)->bssgp_cell_id -#define msgb_llch(__x) OBSC_MSGB_CB(__x)->llch - #define OBSC_LINKID_CB(__msgb) (__msgb)->cb[3] enum gsm_security_event { diff --git a/openbsc/include/osmocom/gprs/Makefile.am b/openbsc/include/osmocom/gprs/Makefile.am index fe5714ea8..66b414f32 100644 --- a/openbsc/include/osmocom/gprs/Makefile.am +++ b/openbsc/include/osmocom/gprs/Makefile.am @@ -1,3 +1,3 @@ -libgb_HEADERS = gprs_bssgp.h gprs_ns.h gprs_ns_frgre.h +libgb_HEADERS = gprs_bssgp.h gprs_ns.h gprs_ns_frgre.h gprs_msgb.h libgbdir = $(includedir)/osmocom/gprs diff --git a/openbsc/include/osmocom/gprs/gprs_bssgp.h b/openbsc/include/osmocom/gprs/gprs_bssgp.h index bfc7d331d..9970a513d 100644 --- a/openbsc/include/osmocom/gprs/gprs_bssgp.h +++ b/openbsc/include/osmocom/gprs/gprs_bssgp.h @@ -198,6 +198,7 @@ enum bssgp_ctr { #include +#include /* BSSGP-UL-UNITDATA.ind */ int gprs_bssgp_rcvmsg(struct msgb *msg); diff --git a/openbsc/include/osmocom/gprs/gprs_msgb.h b/openbsc/include/osmocom/gprs/gprs_msgb.h new file mode 100644 index 000000000..eddd888f5 --- /dev/null +++ b/openbsc/include/osmocom/gprs/gprs_msgb.h @@ -0,0 +1,30 @@ +#ifndef _LIBGB_MSGB_H +#define _LIBGB_MSGB_H + +#include +/* the data structure stored in msgb->cb for libgb apps */ +struct libgb_msgb_cb { + unsigned char *bssgph; + unsigned char *llch; + + /* Cell Identifier */ + unsigned char *bssgp_cell_id; + + /* Identifiers of a BTS, equal to 'struct bssgp_bts_ctx' */ + uint16_t nsei; + uint16_t bvci; + + /* Identifier of a MS (inside BTS), equal to 'struct sgsn_mm_ctx' */ + uint32_t tlli; +} __attribute__((packed)); +#define LIBGB_MSGB_CB(__msgb) ((struct libgb_msgb_cb *)&((__msgb)->cb[0])) +#define msgb_tlli(__x) LIBGB_MSGB_CB(__x)->tlli +#define msgb_nsei(__x) LIBGB_MSGB_CB(__x)->nsei +#define msgb_bvci(__x) LIBGB_MSGB_CB(__x)->bvci +#define msgb_gmmh(__x) (__x)->l3h +#define msgb_bssgph(__x) LIBGB_MSGB_CB(__x)->bssgph +#define msgb_bssgp_len(__x) ((__x)->tail - (uint8_t *)msgb_bssgph(__x)) +#define msgb_bcid(__x) LIBGB_MSGB_CB(__x)->bssgp_cell_id +#define msgb_llch(__x) LIBGB_MSGB_CB(__x)->llch + +#endif diff --git a/openbsc/include/osmocom/gprs/gprs_ns.h b/openbsc/include/osmocom/gprs/gprs_ns.h index 7045d84d1..cfc2e9050 100644 --- a/openbsc/include/osmocom/gprs/gprs_ns.h +++ b/openbsc/include/osmocom/gprs/gprs_ns.h @@ -88,6 +88,7 @@ enum ns_cause { #include #include #include +#include #define NS_TIMERS_COUNT 7 #define NS_TIMERS "(tns-block|tns-block-retries|tns-reset|tns-reset-retries|tns-test|tns-alive|tns-alive-retries)" diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c index afe793d49..518382d8e 100644 --- a/openbsc/src/gprs/gb_proxy.c +++ b/openbsc/src/gprs/gb_proxy.c @@ -122,7 +122,7 @@ static void peer_free(struct gbprox_peer *peer) /* FIXME: this needs to go to libosmocore/msgb.c */ static struct msgb *msgb_copy(const struct msgb *msg, const char *name) { - struct openbsc_msgb_cb *old_cb, *new_cb; + struct libgb_msgb_cb *old_cb, *new_cb; struct msgb *new_msg; new_msg = msgb_alloc(msg->data_len, name); @@ -144,8 +144,8 @@ static struct msgb *msgb_copy(const struct msgb *msg, const char *name) new_msg->l4h = new_msg->_data + (msg->l4h - msg->_data); /* copy GB specific data */ - old_cb = OBSC_MSGB_CB(msg); - new_cb = OBSC_MSGB_CB(new_msg); + old_cb = LIBGB_MSGB_CB(msg); + new_cb = LIBGB_MSGB_CB(new_msg); new_cb->bssgph = new_msg->_data + (old_cb->bssgph - msg->_data); new_cb->llch = new_msg->_data + (old_cb->llch - msg->_data); diff --git a/openbsc/src/libgb/gprs_bssgp.c b/openbsc/src/libgb/gprs_bssgp.c index e93b3de9a..7615299a9 100644 --- a/openbsc/src/libgb/gprs_bssgp.c +++ b/openbsc/src/libgb/gprs_bssgp.c @@ -1,6 +1,6 @@ /* GPRS BSSGP protocol implementation as per 3GPP TS 08.18 */ -/* (C) 2009-2010 by Harald Welte +/* (C) 2009-2012 by Harald Welte * * All Rights Reserved * @@ -33,7 +33,6 @@ #include #include -#include #include #include diff --git a/openbsc/src/libgb/gprs_bssgp_bss.c b/openbsc/src/libgb/gprs_bssgp_bss.c index a53423ca1..a681b9dab 100644 --- a/openbsc/src/libgb/gprs_bssgp_bss.c +++ b/openbsc/src/libgb/gprs_bssgp_bss.c @@ -1,6 +1,6 @@ /* GPRS BSSGP protocol implementation as per 3GPP TS 08.18 */ -/* (C) 2009-2011 by Harald Welte +/* (C) 2009-2012 by Harald Welte * * All Rights Reserved * @@ -32,7 +32,6 @@ #include #include -#include uint8_t *bssgp_msgb_tlli_put(struct msgb *msg, uint32_t tlli) { diff --git a/openbsc/src/libgb/gprs_bssgp_util.c b/openbsc/src/libgb/gprs_bssgp_util.c index c794a590e..6ab97a79c 100644 --- a/openbsc/src/libgb/gprs_bssgp_util.c +++ b/openbsc/src/libgb/gprs_bssgp_util.c @@ -1,6 +1,6 @@ /* GPRS BSSGP protocol implementation as per 3GPP TS 08.18 */ -/* (C) 2009-2010 by Harald Welte +/* (C) 2009-2012 by Harald Welte * * All Rights Reserved * @@ -31,7 +31,6 @@ #include #include -#include struct gprs_ns_inst *bssgp_nsi; diff --git a/openbsc/src/libgb/gprs_ns.c b/openbsc/src/libgb/gprs_ns.c index c1efa4318..8bed1b7bb 100644 --- a/openbsc/src/libgb/gprs_ns.c +++ b/openbsc/src/libgb/gprs_ns.c @@ -1,7 +1,7 @@ /* GPRS Networks Service (NS) messages on the Gb interface * 3GPP TS 08.16 version 8.0.1 Release 1999 / ETSI TS 101 299 V8.0.1 (2002-05) */ -/* (C) 2009-2010 by Harald Welte +/* (C) 2009-2012 by Harald Welte * * All Rights Reserved *