33 #define LOG_PREFIX "sigtran"
35 #include <osmocom/core/linuxlist.h>
36 #include <osmocom/core/talloc.h>
37 #include <osmocom/core/utils.h>
38 #include <osmocom/sccp/sccp.h>
40 #include <freeradius-devel/server/base.h>
41 #include <freeradius-devel/util/debug.h>
95 size_t len = talloc_array_length(digits) - 1;
96 size_t outlen = (len / 2) + (len & 0x01);
100 if (len == 0)
return -1;
102 *
out = p = talloc_array(ctx,
uint8_t, outlen);
111 for (i = 0; i < (len - 1); i += 2) {
173 size_t len = talloc_array_length(digits) - 1;
174 size_t outlen = (len / 2) + (len & 0x01);
178 if (len == 0)
return -1;
184 if (len & 0x01) nai |= 0xf0;
188 case SCCP_TITLE_IND_NONE:
189 *
out = p = talloc_array(ctx,
uint8_t, outlen);
192 case SCCP_TITLE_IND_NATURE_ONLY:
193 *
out = p = talloc_array(ctx,
uint8_t, (outlen + 1));
197 case SCCP_TITLE_IND_TRANSLATION_ONLY:
198 *
out = p = talloc_array(ctx,
uint8_t, (outlen + 1));
202 case SCCP_TITLE_IND_TRANS_NUM_ENC:
203 *
out = p = talloc_array(ctx,
uint8_t, (outlen + 3));
205 (*p++) = ((np & 0x0f) << 4) | (es & 0x0f);
208 case SCCP_TITLE_IND_TRANS_NUM_ENC_NATURE:
209 *
out = p = talloc_array(ctx,
uint8_t, (outlen + 4));
211 (*p++) = ((np & 0x0f) << 4) | (es & 0x0f);
223 for (i = 0; i < (len - 1); i += 2) {
int sigtran_sccp_global_title(TALLOC_CTX *ctx, uint8_t **out, int gt_ind, char const *digits, uint8_t tt, uint8_t np, uint8_t es, uint8_t nai)
Convert a global title to wire format for SCCP.
uint8_t const is_char_tbcd[]
Check is a char is valid Telephony Binary Coded Decimal.
int sigtran_ascii_to_tbcd(TALLOC_CTX *ctx, uint8_t **out, char const *digits)
uint8_t const ascii_to_tbcd[]
Conversion table to transform ASCII to Telephony Binary Coded Decimal.
Declarations for various sigtran functions.
static size_t char ** out