diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2015-10-12 11:57:33 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2015-11-02 12:56:40 +0100 |
commit | d48f057328cfb82b192d935325eb5af1162c0ecc (patch) | |
tree | e8e91969b6b2c5186b77572973fc222e35275c54 /openbsc/src/gprs/gprs_gsup_messages.c | |
parent | fe60cfb1d63d1c3b61c12eee78308f7985c66c1d (diff) |
libcommon: soak up three static functions.
Add new kitchen sink openbsc/utils.h and libcommon/utils.c to make three so far
static functions public (so I can use them in the upcoming OAP code).
A place to put them could have been the gprs_utils.h, but all general functions
in there have a gprs_ prefix, and todo markings to move them away. All other
libcommon headers are too specific, so I opened up this kitchen sink header.
Replace the implementation of encode_big_endian() with a call to
osmo_store64be_ext(). See comments.
Apply the change in Makefiles and C files.
Diffstat (limited to 'openbsc/src/gprs/gprs_gsup_messages.c')
-rw-r--r-- | openbsc/src/gprs/gprs_gsup_messages.c | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/openbsc/src/gprs/gprs_gsup_messages.c b/openbsc/src/gprs/gprs_gsup_messages.c index bdcff5f69..07485f7f9 100644 --- a/openbsc/src/gprs/gprs_gsup_messages.c +++ b/openbsc/src/gprs/gprs_gsup_messages.c @@ -26,41 +26,13 @@ #include <openbsc/debug.h> #include <openbsc/gprs_utils.h> +#include <openbsc/utils.h> #include <osmocom/gsm/tlv.h> #include <osmocom/core/msgb.h> #include <stdint.h> - -static uint64_t decode_big_endian(const uint8_t *data, size_t data_len) -{ - uint64_t value = 0; - - while (data_len > 0) { - value = (value << 8) + *data; - data += 1; - data_len -= 1; - } - - return value; -} - -static uint8_t *encode_big_endian(uint64_t value, size_t data_len) -{ - static uint8_t buf[sizeof(uint64_t)]; - int idx; - - OSMO_ASSERT(data_len <= ARRAY_SIZE(buf)); - - for (idx = data_len - 1; idx >= 0; idx--) { - buf[idx] = (uint8_t)value; - value = value >> 8; - } - - return buf; -} - static int decode_pdp_info(uint8_t *data, size_t data_len, struct gprs_gsup_pdp_info *pdp_info) { |