Miscellaneous functions.
More...
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/utils.h>
#include <osmocom/sccp/sccp.h>
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/util/debug.h>
#include "sigtran.h"
Go to the source code of this file.
Miscellaneous functions.
- Id
- cafc8afafc248b905f541381f8f3d8f34df54597
Definition in file sigtran.c.
◆ LOG_PREFIX
◆ sigtran_ascii_to_tbcd()
int sigtran_ascii_to_tbcd |
( |
TALLOC_CTX * |
ctx, |
|
|
uint8_t ** |
out, |
|
|
char const * |
digits |
|
) |
| |
◆ sigtran_sccp_global_title()
Convert a global title to wire format for SCCP.
- Parameters
-
[in] | ctx | To allocate the buffer in. |
[out] | out | Where to write the SCCP global title value. |
[in] | gt_ind | One of the SCCP_TITLE_IND_* macros.
- SCCP_TITLE_IND_NONE - Don't call this function...
- SCCP_TITLE_IND_NATURE_ONLY - Nature of address indicator only.
- SCCP_TITLE_IND_TRANSLATION_ONLY - Translation type indicator only.
- SCCP_TITLE_IND_TRANS_NUM_ENC - Translation type, numbering plan, encoding scheme.
- SCCP_TITLE_IND_TRANS_NUM_ENC_NATURE - Translation type, numbering plan, encoding scheme, nature of address indicator.
|
[in] | digits | To convert to BCD (with nibbles reversed). |
[in] | tt | Title translation. |
[in] | es | Encoding scheme (specify in lower nibble).
- 0x00 - Unknown
- 0x01 - BCD odd number of digits.
- 0x02 - BCD even number of digits.
- 0x04 - National specific.
- 0x05 to 0x0e - Spare.
- 0x0f - Reserved.
|
[in] | np | Numbering plan (specify in lower nibble, will shift).
- 0x00 - Unknown.
- 0x01 - ISDN.
- 0x02 - Generic numbering plan.
- 0x03 - Data number plan.
- 0x04 - Telex number plan.
- 0x05 - Maritime mobile number plan.
- 0x06 - Land mobile numbering plan.
- 0x07 - ISDN/mobile numbering plan.
- 0x08 to 0x0d - spare.
- 0x0e - Private or network specific numbering plan.
- 0x0f - Reserved.
|
[in] | nai | Nature of address indicator.
- 0x00 - Unknown
- 0x01 - Subscriber number.
- 0x02 - Reserved for national use.
- 0x03 - National significant number.
- 0x04 - International number.
- Bit 8 (0xf0) 0 - even number of address signals, 1 - odd number of address signals.
|
- Returns
- 0 on success.
- -1 on failure.
Definition at line 170 of file sigtran.c.
◆ ascii_to_tbcd
Initial value:= {
[0] = 0,
['0'] = 0x00,
['1'] = 0x01,
['2'] = 0x02,
['3'] = 0x03,
['4'] = 0x04,
['5'] = 0x05,
['6'] = 0x06,
['7'] = 0x07,
['8'] = 0x08,
['9'] = 0x09,
['*'] = 0x0a,
['#'] = 0x0b,
['a'] = 0x0c,
['b'] = 0x0d,
['c'] = 0x0e,
[255] = 0
}
Conversion table to transform ASCII to Telephony Binary Coded Decimal.
Should be safe to use without validation, invalid digits will be replaced with zeroes.
Definition at line 50 of file sigtran.c.
◆ is_char_tbcd
Initial value:= {
[0] = 0,
['0'] = 1,
['1'] = 1,
['2'] = 1,
['3'] = 1,
['4'] = 1,
['5'] = 1,
['6'] = 1,
['7'] = 1,
['8'] = 1,
['9'] = 1,
['*'] = 1,
['#'] = 1,
['a'] = 1,
['b'] = 1,
['c'] = 1,
[255] = 0
}
Check is a char is valid Telephony Binary Coded Decimal.
Definition at line 73 of file sigtran.c.