[PATCH] Replace ad-hoc function with generic one from libosmocore

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Max max.suraev at fairwaves.co
Wed Oct 22 14:21:20 UTC 2014


Signed-off-by: Max <max.suraev at fairwaves.co>
---
 openbsc/src/osmo-bsc/osmo_bsc_bssap.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/openbsc/src/osmo-bsc/osmo_bsc_bssap.c b/openbsc/src/osmo-bsc/osmo_bsc_bssap.c
index dda3157..c2bbbd3 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_bssap.c
@@ -29,16 +29,6 @@
 #include <osmocom/gsm/protocol/gsm_08_08.h>
 #include <osmocom/gsm/gsm0808.h>
 
-#include <arpa/inet.h>
-
-static uint16_t read_data16(const uint8_t *data)
-{
-	uint16_t res;
-
-	memcpy(&res, data, sizeof(res));
-	return res;
-}
-
 /*
  * helpers for the assignment command
  */
@@ -154,7 +144,7 @@ static int bssmap_handle_paging(struct osmo_msc_data *msc,
 	 * Support paging to all network or one BTS at one LAC
 	 */
 	if (data_length == 3 && data[0] == CELL_IDENT_LAC) {
-		lac = ntohs(read_data16(&data[1]));
+		lac = osmo_load16be(&data[1]);
 	} else if (data_length > 1 || (data[0] & 0x0f) != CELL_IDENT_BSS) {
 		LOGP(DMSC, LOGL_ERROR, "Unsupported Cell Identifier List: %s\n", osmo_hexdump(data, data_length));
 		return -1;
@@ -321,7 +311,7 @@ static int bssmap_handle_assignm_req(struct osmo_bsc_sccp_con *conn,
 		goto reject;
 	}
 
-	conn->cic = ntohs(read_data16(TLVP_VAL(&tp, GSM0808_IE_CIRCUIT_IDENTITY_CODE)));
+	conn->cic = osmo_load16be(TLVP_VAL(&tp, GSM0808_IE_CIRCUIT_IDENTITY_CODE));
 	timeslot = conn->cic & 0x1f;
 	multiplex = (conn->cic & ~0x1f) >> 5;
 
-- 
1.9.1





More information about the OpenBSC mailing list