aboutsummaryrefslogtreecommitdiffstats
path: root/src/hnbgw_hnbap.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2015-09-11 17:13:51 +0200
committerHarald Welte <laforge@gnumonks.org>2015-09-11 17:13:51 +0200
commit393f2bd9fbc9cfe1f48ac6aeabfcda204c7e3d4b (patch)
treebc085de35f68f9f02d466712035459fa1391afe7 /src/hnbgw_hnbap.c
parent3af1db87edfa3c91efa9911d2f786f4b931750d6 (diff)
move BCD string encoding/decoding functions to iu_helpers.[ch]
Diffstat (limited to 'src/hnbgw_hnbap.c')
-rw-r--r--src/hnbgw_hnbap.c46
1 files changed, 0 insertions, 46 deletions
diff --git a/src/hnbgw_hnbap.c b/src/hnbgw_hnbap.c
index 8b1527e..1915ad6 100644
--- a/src/hnbgw_hnbap.c
+++ b/src/hnbgw_hnbap.c
@@ -24,52 +24,6 @@ static int hnbgw_hnbap_tx(struct hnb_context *ctx, struct msgb *msg)
return osmo_wqueue_enqueue(&ctx->wqueue, msg);
}
-int decode_iu_bcd(char *out, size_t out_len, const uint8_t *in, size_t in_len)
-{
- const uint8_t *ch;
- char *outch = out;
-
- for (ch = in; ch < in + in_len; ch++) {
- char c = osmo_bcd2char(*ch & 0xF);
- *outch++ = c;
- if (outch + 1 >= out + out_len)
- break;
- c = osmo_bcd2char(*ch >> 4);
- /* skip padding nibble at end */
- if (c == 'F')
- break;
- *outch++ = c;
- }
- *outch++ = '\0';
- return outch - out;
-}
-
-int encode_iu_imsi(uint8_t *out, size_t out_len,
- const char *in)
-{
- unsigned int len = strlen(in);
- uint8_t odd = (len & 0x01) == 1;
- unsigned int off = 0;
- unsigned int i;
-
- len /= 2;
- if (odd)
- len++;
-
- for (i = 0; i < len; i++) {
- uint8_t lower, upper;
-
- lower = osmo_char2bcd(in[++off]) & 0x0f;
- if (!odd && off + 1 == len)
- upper = 0x0f;
- else
- upper = osmo_char2bcd(in[++off]) & 0x0f;
-
- out[i] = (upper << 4) | lower;
- }
- return i;
-}
-
static int hnbgw_tx_hnb_register_acc(struct hnb_context *ctx)
{
HNBRegisterAccept_t accept_out;