From f1ad60e4d861d5ff462a8d7ab481ad082360f346 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 5 Jan 2018 14:19:33 +0100 Subject: Add function to properly encode RAI Add gsm48_encode_ra() which takes appropriate struct as [out] parameter instead of generic buffer. Using uint8_t buffer instead of proper struct type prooved to be error-prone - see Coverity CID57877, CID57876. Old gsm48_construct_ra() is made into tiny wrapper around new function. The test output is adjusted because of the change in function return value which was constant and hence ignored anyway. Related: OS#1640 Change-Id: I31f9605277f4945f207c2c44ff82e62399f8db74 --- include/osmocom/gprs/gprs_bssgp_bss.h | 1 + include/osmocom/gsm/gsm48.h | 1 + 2 files changed, 2 insertions(+) (limited to 'include') diff --git a/include/osmocom/gprs/gprs_bssgp_bss.h b/include/osmocom/gprs/gprs_bssgp_bss.h index 74211fd1..f07ab526 100644 --- a/include/osmocom/gprs/gprs_bssgp_bss.h +++ b/include/osmocom/gprs/gprs_bssgp_bss.h @@ -26,6 +26,7 @@ #include uint8_t *bssgp_msgb_tlli_put(struct msgb *msg, uint32_t tlli); +uint8_t *bssgp_msgb_ra_put(struct msgb *msg, const struct gprs_ra_id *ra_id); int bssgp_tx_bvc_ptp_reset(uint16_t nsei, enum gprs_bssgp_cause cause); int bssgp_tx_suspend(uint16_t nsei, uint32_t tlli, const struct gprs_ra_id *ra_id); diff --git a/include/osmocom/gsm/gsm48.h b/include/osmocom/gsm/gsm48.h index 424748ee..3ebca189 100644 --- a/include/osmocom/gsm/gsm48.h +++ b/include/osmocom/gsm/gsm48.h @@ -39,6 +39,7 @@ const char *gsm48_mi_type_name(uint8_t mi); /* Parse Routeing Area Identifier */ void gsm48_parse_ra(struct gprs_ra_id *raid, const uint8_t *buf); +void gsm48_encode_ra(struct gsm48_ra_id *out, const struct gprs_ra_id *raid); int gsm48_construct_ra(uint8_t *buf, const struct gprs_ra_id *raid); int gsm48_number_of_paging_subchannels(struct gsm48_control_channel_descr *chan_desc); -- cgit v1.2.3