aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-08-15 13:53:48 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2018-08-15 13:53:50 +0200
commit816a67d59dfebcb814e6390e52c9ec0f3e0678c0 (patch)
tree0268351b1ff68f6abe2c61753d990c3c5fb90196 /src
parentc503f0acd9668a50529f473492ce4c42de8b882a (diff)
Drop gprs_msgb_copy with libosmocore replacement
gprs_msgb_copy was introduced in libosmocore 0.94 (f78ec5ce0d0f6038147d9b9e14d81094309ba5d5) as bssgp_msgb_copy. Let's use that one to avoid code duplication. Change-Id: I42a65fd8e4045fafadf5694f2d8d0c5e7ab350a0
Diffstat (limited to 'src')
-rw-r--r--src/gprs/gb_proxy.c8
-rw-r--r--src/gprs/gprs_gmm.c2
-rw-r--r--src/gprs/gprs_utils.c49
3 files changed, 5 insertions, 54 deletions
diff --git a/src/gprs/gb_proxy.c b/src/gprs/gb_proxy.c
index 447772f12..dc3c81032 100644
--- a/src/gprs/gb_proxy.c
+++ b/src/gprs/gb_proxy.c
@@ -499,7 +499,7 @@ static int gbproxy_imsi_acquisition(struct gbproxy_peer *peer,
msgb_nsei(msg),
parse_ctx->llc_msg_name ? parse_ctx->llc_msg_name : "BSSGP");
- stored_msg = gprs_msgb_copy(msg, "process_bssgp_ul");
+ stored_msg = bssgp_msgb_copy(msg, "process_bssgp_ul");
msgb_enqueue(&link_info->stored_msgs, stored_msg);
if (!link_info->imsi_acq_pending) {
@@ -763,7 +763,7 @@ static int gbprox_relay2sgsn(struct gbproxy_config *cfg, struct msgb *old_msg,
{
/* create a copy of the message so the old one can
* be free()d safely when we return from gbprox_rcvmsg() */
- struct msgb *msg = gprs_msgb_copy(old_msg, "msgb_relay2sgsn");
+ struct msgb *msg = bssgp_msgb_copy(old_msg, "msgb_relay2sgsn");
int rc;
DEBUGP(DGPRS, "NSEI=%u proxying BTS->SGSN (NS_BVCI=%u, NSEI=%u)\n",
@@ -787,7 +787,7 @@ static int gbprox_relay2peer(struct msgb *old_msg, struct gbproxy_peer *peer,
{
/* create a copy of the message so the old one can
* be free()d safely when we return from gbprox_rcvmsg() */
- struct msgb *msg = gprs_msgb_copy(old_msg, "msgb_relay2peer");
+ struct msgb *msg = bssgp_msgb_copy(old_msg, "msgb_relay2peer");
int rc;
DEBUGP(DGPRS, "NSEI=%u proxying SGSN->BSS (NS_BVCI=%u, NSEI=%u)\n",
@@ -1179,7 +1179,7 @@ static int gbprox_rx_sig_from_sgsn(struct gbproxy_config *cfg,
return bssgp_tx_status(BSSGP_CAUSE_PROTO_ERR_UNSPEC, NULL, orig_msg);
}
- msg = gprs_msgb_copy(orig_msg, "rx_sig_from_sgsn");
+ msg = bssgp_msgb_copy(orig_msg, "rx_sig_from_sgsn");
gbprox_process_bssgp_dl(cfg, msg, NULL);
/* Update message info */
bgph = (struct bssgp_normal_hdr *) msgb_bssgph(msg);
diff --git a/src/gprs/gprs_gmm.c b/src/gprs/gprs_gmm.c
index 91f769d61..bea63dc53 100644
--- a/src/gprs/gprs_gmm.c
+++ b/src/gprs/gprs_gmm.c
@@ -2648,7 +2648,7 @@ static int gsm48_rx_gsm_act_pdp_req(struct sgsn_mm_ctx *mmctx,
* and the dynamic resolution will be the right thing
* in the long run.
*/
- msg = gprs_msgb_copy(_msg, __func__);
+ msg = bssgp_msgb_copy(_msg, __func__);
if (!msg) {
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(_msg);
uint8_t transaction_id = gsm48_hdr_trans_id(gh);
diff --git a/src/gprs/gprs_utils.c b/src/gprs/gprs_utils.c
index d7cef1cce..c4b66d65f 100644
--- a/src/gprs/gprs_utils.c
+++ b/src/gprs/gprs_utils.c
@@ -30,55 +30,6 @@
#include <string.h>
-/* FIXME: this needs to go to libosmocore/msgb.c */
-struct msgb *gprs_msgb_copy(const struct msgb *msg, const char *name)
-{
- struct libgb_msgb_cb *old_cb, *new_cb;
- struct msgb *new_msg;
-
- new_msg = msgb_alloc(msg->data_len, name);
- if (!new_msg)
- return NULL;
-
- /* copy data */
- memcpy(new_msg->_data, msg->_data, new_msg->data_len);
-
- /* copy header */
- new_msg->len = msg->len;
- new_msg->data += msg->data - msg->_data;
- new_msg->head += msg->head - msg->_data;
- new_msg->tail += msg->tail - msg->_data;
-
- if (msg->l1h)
- new_msg->l1h = new_msg->_data + (msg->l1h - msg->_data);
- if (msg->l2h)
- new_msg->l2h = new_msg->_data + (msg->l2h - msg->_data);
- if (msg->l3h)
- new_msg->l3h = new_msg->_data + (msg->l3h - msg->_data);
- if (msg->l4h)
- new_msg->l4h = new_msg->_data + (msg->l4h - msg->_data);
-
- /* copy GB specific data */
- old_cb = LIBGB_MSGB_CB(msg);
- new_cb = LIBGB_MSGB_CB(new_msg);
-
- if (old_cb->bssgph)
- new_cb->bssgph = new_msg->_data + (old_cb->bssgph - msg->_data);
- if (old_cb->llch)
- new_cb->llch = new_msg->_data + (old_cb->llch - msg->_data);
-
- /* bssgp_cell_id is a pointer into the old msgb, so we need to make
- * it a pointer into the new msgb */
- if (old_cb->bssgp_cell_id)
- new_cb->bssgp_cell_id = new_msg->_data +
- (old_cb->bssgp_cell_id - msg->_data);
- new_cb->nsei = old_cb->nsei;
- new_cb->bvci = old_cb->bvci;
- new_cb->tlli = old_cb->tlli;
-
- return new_msg;
-}
-
/* TODO: Move this to libosmocore/msgb.c */
int gprs_msgb_resize_area(struct msgb *msg, uint8_t *area,
size_t old_size, size_t new_size)