summaryrefslogtreecommitdiffstats
path: root/src/gb
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2018-01-05 14:30:22 +0100
committerMax <msuraev@sysmocom.de>2018-01-08 14:07:47 +0100
commite29ec85375f004e63c650e69a9fe5910b15a00eb (patch)
treea5d2485f29fa92fe5db21413594bbd07be413a1e /src/gb
parentf1ad60e4d861d5ff462a8d7ab481ad082360f346 (diff)
Use existing function for TLLI encoding
Use bssgp_msgb_tlli_put() instead of copy-pasted code. Change-Id: I06d60566a19dcae701f8648c19fbd8db6d586f77
Diffstat (limited to 'src/gb')
-rw-r--r--src/gb/gprs_bssgp.c16
-rw-r--r--src/gb/gprs_bssgp_bss.c4
2 files changed, 5 insertions, 15 deletions
diff --git a/src/gb/gprs_bssgp.c b/src/gb/gprs_bssgp.c
index 72282636..4c0bb8a9 100644
--- a/src/gb/gprs_bssgp.c
+++ b/src/gb/gprs_bssgp.c
@@ -160,14 +160,12 @@ int bssgp_tx_suspend_ack(uint16_t nsei, uint32_t tlli,
struct msgb *msg = bssgp_msgb_alloc();
struct bssgp_normal_hdr *bgph =
(struct bssgp_normal_hdr *) msgb_put(msg, sizeof(*bgph));
- uint32_t _tlli;
msgb_nsei(msg) = nsei;
msgb_bvci(msg) = 0; /* Signalling */
bgph->pdu_type = BSSGP_PDUT_SUSPEND_ACK;
- _tlli = osmo_htonl(tlli);
- msgb_tvlv_put(msg, BSSGP_IE_TLLI, 4, (uint8_t *) &_tlli);
+ bssgp_msgb_tlli_put(msg, tlli);
bssgp_msgb_ra_put(msg, ra_id);
msgb_tvlv_put(msg, BSSGP_IE_SUSPEND_REF_NR, 1, &suspend_ref);
@@ -182,14 +180,12 @@ int bssgp_tx_suspend_nack(uint16_t nsei, uint32_t tlli,
struct msgb *msg = bssgp_msgb_alloc();
struct bssgp_normal_hdr *bgph =
(struct bssgp_normal_hdr *) msgb_put(msg, sizeof(*bgph));
- uint32_t _tlli;
msgb_nsei(msg) = nsei;
msgb_bvci(msg) = 0; /* Signalling */
bgph->pdu_type = BSSGP_PDUT_SUSPEND_NACK;
- _tlli = osmo_htonl(tlli);
- msgb_tvlv_put(msg, BSSGP_IE_TLLI, 4, (uint8_t *) &_tlli);
+ bssgp_msgb_tlli_put(msg, tlli);
bssgp_msgb_ra_put(msg, ra_id);
if (cause)
@@ -205,14 +201,12 @@ int bssgp_tx_resume_ack(uint16_t nsei, uint32_t tlli,
struct msgb *msg = bssgp_msgb_alloc();
struct bssgp_normal_hdr *bgph =
(struct bssgp_normal_hdr *) msgb_put(msg, sizeof(*bgph));
- uint32_t _tlli;
msgb_nsei(msg) = nsei;
msgb_bvci(msg) = 0; /* Signalling */
bgph->pdu_type = BSSGP_PDUT_RESUME_ACK;
- _tlli = osmo_htonl(tlli);
- msgb_tvlv_put(msg, BSSGP_IE_TLLI, 4, (uint8_t *) &_tlli);
+ bssgp_msgb_tlli_put(msg, tlli);
bssgp_msgb_ra_put(msg, ra_id);
return gprs_ns_sendmsg(bssgp_nsi, msg);
@@ -225,14 +219,12 @@ int bssgp_tx_resume_nack(uint16_t nsei, uint32_t tlli,
struct msgb *msg = bssgp_msgb_alloc();
struct bssgp_normal_hdr *bgph =
(struct bssgp_normal_hdr *) msgb_put(msg, sizeof(*bgph));
- uint32_t _tlli;
msgb_nsei(msg) = nsei;
msgb_bvci(msg) = 0; /* Signalling */
bgph->pdu_type = BSSGP_PDUT_SUSPEND_NACK;
- _tlli = osmo_htonl(tlli);
- msgb_tvlv_put(msg, BSSGP_IE_TLLI, 4, (uint8_t *) &_tlli);
+ bssgp_msgb_tlli_put(msg, tlli);
bssgp_msgb_ra_put(msg, ra_id);
if (cause)
diff --git a/src/gb/gprs_bssgp_bss.c b/src/gb/gprs_bssgp_bss.c
index c7e5e4d6..487286c4 100644
--- a/src/gb/gprs_bssgp_bss.c
+++ b/src/gb/gprs_bssgp_bss.c
@@ -396,7 +396,6 @@ int bssgp_tx_fc_ms(struct bssgp_bvc_ctx *bctx, uint32_t tlli, uint8_t tag,
struct msgb *msg;
struct bssgp_normal_hdr *bgph;
uint16_t e_bucket_size, e_leak_rate;
- uint32_t e_tlli;
if ((ms_bucket_size / 100) > 0xffff)
return -EINVAL;
@@ -412,8 +411,7 @@ int bssgp_tx_fc_ms(struct bssgp_bvc_ctx *bctx, uint32_t tlli, uint8_t tag,
msgb_bvci(msg) = bctx->bvci;
bgph->pdu_type = BSSGP_PDUT_FLOW_CONTROL_MS;
- e_tlli = osmo_htonl(tlli);
- msgb_tvlv_put(msg, BSSGP_IE_TLLI, sizeof(e_tlli), (uint8_t *)&e_tlli);
+ bssgp_msgb_tlli_put(msg, tlli);
msgb_tvlv_put(msg, BSSGP_IE_TAG, sizeof(tag), (uint8_t *)&tag);
msgb_tvlv_put(msg, BSSGP_IE_MS_BUCKET_SIZE,
sizeof(e_bucket_size), (uint8_t *) &e_bucket_size);