diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-02-05 03:58:24 +0100 |
---|---|---|
committer | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-02-05 20:10:16 +0100 |
commit | 1c4fc227d93cafedc9663794e27dc2c1721148a9 (patch) | |
tree | 702b2ee95ca9fe232f74892410a952493df54c7a /src | |
parent | f3dc0f94c3c0d20ea1949ec358de954c6fc1da1d (diff) |
gsm0808: use msgb_tv16_put() and osmo_store32be()
This API makes the code simpler and easier to read.
Change-Id: Ibe9eaaa2a9344ba798631b8f115ad248f0a2f76b
Diffstat (limited to 'src')
-rw-r--r-- | src/gsm/gsm0808.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index 971d9625..6070ef3c 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -494,8 +494,6 @@ struct msgb *gsm0808_create_ass2(const struct gsm0808_channel_type *ct, { /* See also: 3GPP TS 48.008 3.2.1.1 ASSIGNMENT REQUEST */ struct msgb *msg; - uint16_t cic_sw; - uint32_t ci_sw; /* Mandatory emelent! */ OSMO_ASSERT(ct); @@ -513,11 +511,8 @@ struct msgb *gsm0808_create_ass2(const struct gsm0808_channel_type *ct, gsm0808_enc_channel_type(msg, ct); /* Circuit Identity Code 3.2.2.2 */ - if (cic) { - cic_sw = osmo_htons(*cic); - msgb_tv_fixed_put(msg, GSM0808_IE_CIRCUIT_IDENTITY_CODE, - sizeof(cic_sw), (uint8_t *) & cic_sw); - } + if (cic) + msgb_tv16_put(msg, GSM0808_IE_CIRCUIT_IDENTITY_CODE, *cic); /* AoIP: AoIP Transport Layer Address (MGW) 3.2.2.102 */ if (ss) { @@ -531,17 +526,9 @@ struct msgb *gsm0808_create_ass2(const struct gsm0808_channel_type *ct, /* AoIP: Call Identifier 3.2.2.105 */ if (ci) { /* NOTE: 3GPP TS 48.008, section 3.2.2.105 specifies that - the least significant byte should be transmitted first. - On x86, this would mean that the endieness is already - correct, however a platform independed implementation - is required: */ -#ifndef OSMO_IS_LITTLE_ENDIAN - ci_sw = osmo_swab32(*ci); -#else - ci_sw = *ci; -#endif - msgb_tv_fixed_put(msg, GSM0808_IE_CALL_ID, sizeof(ci_sw), - (uint8_t *) & ci_sw); + * the least significant byte shall be transmitted first. */ + msgb_v_put(msg, GSM0808_IE_CALL_ID); + osmo_store32le(*ci, msgb_put(msg, sizeof(*ci))); } if (kc) |