The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Macros | Functions | Variables
sigtran.c File Reference

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"
+ Include dependency graph for sigtran.c:

Go to the source code of this file.

Macros

#define LOG_PREFIX   "sigtran"
 

Functions

int sigtran_ascii_to_tbcd (TALLOC_CTX *ctx, uint8_t **out, char const *digits)
 
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. More...
 

Variables

uint8_t const ascii_to_tbcd []
 Conversion table to transform ASCII to Telephony Binary Coded Decimal. More...
 
uint8_t const is_char_tbcd []
 Check is a char is valid Telephony Binary Coded Decimal. More...
 

Detailed Description

Miscellaneous functions.

Id
cafc8afafc248b905f541381f8f3d8f34df54597

Definition in file sigtran.c.

Macro Definition Documentation

◆ LOG_PREFIX

#define LOG_PREFIX   "sigtran"

Definition at line 33 of file sigtran.c.

Function Documentation

◆ sigtran_ascii_to_tbcd()

int sigtran_ascii_to_tbcd ( TALLOC_CTX *  ctx,
uint8_t **  out,
char const *  digits 
)

Definition at line 93 of file sigtran.c.

+ Here is the caller graph for this function:

◆ sigtran_sccp_global_title()

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.

Parameters
[in]ctxTo allocate the buffer in.
[out]outWhere to write the SCCP global title value.
[in]gt_indOne 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]digitsTo convert to BCD (with nibbles reversed).
[in]ttTitle translation.
[in]esEncoding 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]npNumbering 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]naiNature 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.

+ Here is the caller graph for this function:

Variable Documentation

◆ ascii_to_tbcd

uint8_t const 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

uint8_t const 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.