The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Typedefs | Enumerations | Functions | Variables
sigtran.h File Reference

Declarations for various sigtran functions. More...

#include <osmocom/core/linuxlist.h>
#include <osmocom/core/timer.h>
#include <osmocom/sccp/sccp.h>
#include <osmocom/core/select.h>
+ Include dependency graph for sigtran.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  rlm_sigtran
 
struct  rlm_sigtran_thread
 
struct  sigtran_conn
 Represents a connection to a remote SS7 entity. More...
 
struct  sigtran_conn_conf
 Configures a M3UA/MTP3/SCCP stack. More...
 
struct  sigtran_m3ua_route
 
struct  sigtran_map_send_auth_info_req
 MAP send auth info request. More...
 
struct  sigtran_map_send_auth_info_res
 MAP send auth info response. More...
 
struct  sigtran_sccp_address
 Structure representing a complete Q.173 SCCP address. More...
 
struct  sigtran_sccp_global_title
 
struct  sigtran_transaction
 Request and response from the event loop. More...
 
struct  sigtran_transaction.ctx
 
struct  sigtran_transaction.request
 
struct  sigtran_transaction.response
 
struct  sigtran_vector
 Authentication vector returned by HLR. More...
 
union  sigtran_vector.__unnamed176__
 
struct  sigtran_vector.__unnamed176__.sim
 
struct  sigtran_vector.__unnamed176__.umts
 

Typedefs

typedef struct rlm_sigtran rlm_sigtran_t
 
typedef struct rlm_sigtran_thread rlm_sigtran_thread_t
 
typedef struct sigtran_conn_conf sigtran_conn_conf_t
 Configures a M3UA/MTP3/SCCP stack. More...
 
typedef struct sigtran_conn sigtran_conn_t
 Represents a connection to a remote SS7 entity. More...
 
typedef struct sigtran_m3ua_route sigtran_m3ua_route_t
 
typedef struct sigtran_map_send_auth_info_req sigtran_map_send_auth_info_req_t
 MAP send auth info request. More...
 
typedef struct sigtran_map_send_auth_info_res sigtran_map_send_auth_info_res_t
 MAP send auth info response. More...
 
typedef struct sigtran_sccp_address sigtran_sccp_address_t
 Structure representing a complete Q.173 SCCP address. More...
 
typedef struct sigtran_sccp_global_title sigtran_sccp_global_title_t
 
typedef struct sigtran_transaction sigtran_transaction_t
 Request and response from the event loop. More...
 
typedef struct sigtran_vector sigtran_vector_t
 

Enumerations

enum  sigtran_request_type_t {
  SIGTRAN_REQUEST_THREAD_REGISTER ,
  SIGTRAN_REQUEST_THREAD_UNREGISTER ,
  SIGTRAN_REQUEST_LINK_UP ,
  SIGTRAN_REQUEST_LINK_DOWN ,
  SIGTRAN_REQUEST_MAP_SEND_AUTH_INFO ,
  SIGTRAN_REQUEST_EXIT ,
  SIGTRAN_REQUEST_TEST
}
 
enum  sigtran_response_type_t {
  SIGTRAN_RESPONSE_OK ,
  SIGTRAN_RESPONSE_NOOP ,
  SIGTRAN_RESPONSE_NOTFOUND ,
  SIGTRAN_RESPONSE_FAIL
}
 
enum  sigtran_vector_type_t {
  SIGTRAN_VECTOR_TYPE_SIM_TRIPLETS ,
  SIGTRAN_VECTOR_TYPE_UMTS_QUINTUPLETS
}
 Vector types. More...
 

Functions

int sigtran_ascii_to_tbcd (TALLOC_CTX *ctx, uint8_t **out, char const *ascii)
 
int sigtran_client_do_transaction (int fd, sigtran_transaction_t *txn)
 
int sigtran_client_link_down (sigtran_conn_t const **conn)
 Destroy a connection. More...
 
int sigtran_client_link_up (sigtran_conn_t const **out, sigtran_conn_conf_t const *conf)
 Create a new connection. More...
 
unlang_action_t sigtran_client_map_send_auth_info (rlm_rcode_t *p_result, rlm_sigtran_t const *inst, request_t *request, sigtran_conn_t const *conn, int fd)
 Create a MAP_SEND_AUTH_INFO request. More...
 
int sigtran_client_thread_register (fr_event_list_t *el)
 Called by a new thread to register a new req_pipe. More...
 
int sigtran_client_thread_unregister (fr_event_list_t *el, int req_pipe_fd)
 Signal that libosmo should unregister the other side of the pipe. More...
 
int sigtran_event_exit (void)
 Signal that libosmo should exit. More...
 
int sigtran_event_start (void)
 Start the libosmo event loop. More...
 
int sigtran_event_submit (struct osmo_fd *ofd, sigtran_transaction_t *txn)
 Send response. More...
 
void sigtran_log_init (TALLOC_CTX *ctx)
 Patch our logging system into libosmo's. More...
 
void sigtran_sccp_global_free (void)
 
int sigtran_sccp_global_init (void)
 
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...
 
void sigtran_sccp_incoming (struct mtp_link_set *set, struct msgb *msg, int sls)
 
int sigtran_sscp_init (sigtran_conn_t *conn)
 Initialise libscctp. More...
 
int sigtran_tcap_outgoing (UNUSED struct msgb *msg_in, void *ctx, sigtran_transaction_t *txn, struct osmo_fd *ofd)
 

Variables

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

Detailed Description

Declarations for various sigtran functions.

Id
c8deb64a8427b16d00790913ba1ecd115511c204
Author
Arran Cudbard-Bell

Definition in file sigtran.h.


Data Structure Documentation

◆ rlm_sigtran

struct rlm_sigtran

Definition at line 231 of file sigtran.h.

+ Collaboration diagram for rlm_sigtran:
Data Fields
sigtran_conn_t const * conn Linkset associated with this instance.
sigtran_conn_conf_t conn_conf Connection configuration.
tmpl_t * imsi Subscriber identifier.

◆ rlm_sigtran_thread

struct rlm_sigtran_thread

Definition at line 239 of file sigtran.h.

Data Fields
int fd File descriptor.

◆ sigtran_conn

struct sigtran_conn

Represents a connection to a remote SS7 entity.

Holds data necessary for M3UA/MTP3/SCCP.

Definition at line 180 of file sigtran.h.

+ Collaboration diagram for sigtran_conn:
Data Fields
struct bsc_data * bsc_data
sigtran_conn_conf_t * conf
struct mtp_link * mtp3_link
struct mtp_link_set * mtp3_link_set

◆ sigtran_conn_conf

struct sigtran_conn_conf

Configures a M3UA/MTP3/SCCP stack.

Definition at line 143 of file sigtran.h.

+ Collaboration diagram for sigtran_conn_conf:
Data Fields
uint32_t m3ua_ack_timeout
uint32_t m3ua_beat_interval
uint16_t m3ua_link_index
sigtran_m3ua_route_t m3ua_routes Routes to register with SG.
bool m3ua_routes_is_set Routes section was provided.
uint16_t m3ua_routing_context
int m3ua_traffic_mode
char const * m3ua_traffic_mode_str
tmpl_t * map_version Application context version.
uint32_t mtp3_dpc
uint32_t mtp3_opc MTP3 point codes (24bit!).
bool sccp_ai8 Address indicator bit 8.
sigtran_sccp_address_t sccp_called The calling SCCP address.
struct sockaddr_sccp sccp_called_sockaddr Parsed version of the above.
sigtran_sccp_address_t sccp_calling The called SCCP address.
struct sockaddr_sccp sccp_calling_sockaddr Parsed version of the above.
bool sccp_route_on_ssn Whether we should route on subsystem number.
fr_ipaddr_t sctp_dst_ipaddr IP of the Service Gateway.
uint16_t sctp_dst_port SCTP port of the service gateway.
fr_ipaddr_t sctp_src_ipaddr Local IP to originate traffic from.
uint16_t sctp_src_port Local port to originate traffic from.
uint32_t sctp_timeout

◆ sigtran_m3ua_route

struct sigtran_m3ua_route

Definition at line 131 of file sigtran.h.

Data Fields
uint32_t dpc Destination point code.
bool dpc_is_set Whether the DPC was set.
uint32_t * opc Origin point code.
uint32_t * si Service indicator.

◆ sigtran_map_send_auth_info_req

struct sigtran_map_send_auth_info_req

MAP send auth info request.

Definition at line 191 of file sigtran.h.

+ Collaboration diagram for sigtran_map_send_auth_info_req:
Data Fields
sigtran_conn_t const * conn Connection to send request on.
uint8_t * imsi BCD encoded IMSI.
unsigned int num_vectors Number of vectors requested.
uint8_t version Application context version.

◆ sigtran_map_send_auth_info_res

struct sigtran_map_send_auth_info_res

MAP send auth info response.

Definition at line 226 of file sigtran.h.

+ Collaboration diagram for sigtran_map_send_auth_info_res:
Data Fields
int error
sigtran_vector_t * vector Linked list of vectors.

◆ sigtran_sccp_address

struct sigtran_sccp_address

Structure representing a complete Q.173 SCCP address.

Definition at line 120 of file sigtran.h.

+ Collaboration diagram for sigtran_sccp_address:
Data Fields
sigtran_sccp_global_title_t gt
bool gt_is_set Whether a global title was specified.
uint32_t pc 14bit point code.
bool pc_is_set Point code is set.
uint8_t ssn Subsystem number.
bool ssn_is_set Subsystem number is set.

◆ sigtran_sccp_global_title

struct sigtran_sccp_global_title

Definition at line 101 of file sigtran.h.

Data Fields
char const * address Address digits.
uint8_t es Encoding scheme.
bool es_is_set Encoding scheme is set.
uint8_t nai Nature of address indicator.
bool nai_is_set Nature of address indicator is set.
uint8_t np Numbering plan.
bool np_is_set Numbering plan is set.
uint8_t tt Translation type.
bool tt_is_set Translation_type was provided.

◆ sigtran_transaction

struct sigtran_transaction

Request and response from the event loop.

We allocate the whole thing on the client side, as the client will be blocked waiting on the response from the event loop, and won't mind extra memory being allocated from this ctx.

Definition at line 75 of file sigtran.h.

+ Collaboration diagram for sigtran_transaction:
Data Fields
struct sigtran_transaction ctx
fr_rb_node_t node Entry in the tree of transactions.
struct sigtran_transaction request
struct sigtran_transaction response

◆ sigtran_transaction.ctx

struct sigtran_transaction.ctx

Definition at line 87 of file sigtran.h.

Data Fields
bool defunct Response should be deleted and not processed.
uint8_t invoke_id Sequence number (within transaction).
struct osmo_fd * ofd The FD the txn was received on.
uint32_t otid Transaction ID.
request_t * request
struct osmo_timer_list timer Timer data.

◆ sigtran_transaction.request

struct sigtran_transaction.request

Definition at line 78 of file sigtran.h.

Data Fields
void * data Data for the request.
sigtran_request_type_t type Type of request.

◆ sigtran_transaction.response

struct sigtran_transaction.response

Definition at line 82 of file sigtran.h.

Data Fields
void * data Data for the response.
sigtran_response_type_t type Type of response.

◆ sigtran_vector

struct sigtran_vector

Authentication vector returned by HLR.

Definition at line 203 of file sigtran.h.

+ Collaboration diagram for sigtran_vector:
Data Fields
union sigtran_vector __unnamed__
sigtran_vector_t * next Next vector in list.
sigtran_vector_type_t type Type of vector returned.

◆ sigtran_vector.__unnamed176__

union sigtran_vector.__unnamed176__

Definition at line 204 of file sigtran.h.

Data Fields
__unnamed176__ sim
__unnamed176__ umts

◆ sigtran_vector.__unnamed176__.sim

struct sigtran_vector.__unnamed176__.sim

Definition at line 212 of file sigtran.h.

Data Fields
uint8_t * kc Encryption key.
uint8_t * rand Random challenge.
uint8_t * sres Signing response.

◆ sigtran_vector.__unnamed176__.umts

struct sigtran_vector.__unnamed176__.umts

Definition at line 205 of file sigtran.h.

Data Fields
uint8_t * authn Authentication response.
uint8_t * ck Encryption key.
uint8_t * ik Integrity key.
uint8_t * rand Random challenge.
uint8_t * xres

Typedef Documentation

◆ rlm_sigtran_t

typedef struct rlm_sigtran rlm_sigtran_t

◆ rlm_sigtran_thread_t

◆ sigtran_conn_conf_t

Configures a M3UA/MTP3/SCCP stack.

◆ sigtran_conn_t

typedef struct sigtran_conn sigtran_conn_t

Represents a connection to a remote SS7 entity.

Holds data necessary for M3UA/MTP3/SCCP.

◆ sigtran_m3ua_route_t

◆ sigtran_map_send_auth_info_req_t

MAP send auth info request.

◆ sigtran_map_send_auth_info_res_t

MAP send auth info response.

◆ sigtran_sccp_address_t

Structure representing a complete Q.173 SCCP address.

◆ sigtran_sccp_global_title_t

◆ sigtran_transaction_t

Request and response from the event loop.

We allocate the whole thing on the client side, as the client will be blocked waiting on the response from the event loop, and won't mind extra memory being allocated from this ctx.

◆ sigtran_vector_t

Definition at line 1 of file sigtran.h.

Enumeration Type Documentation

◆ sigtran_request_type_t

Enumerator
SIGTRAN_REQUEST_THREAD_REGISTER 

New worker thread to register.

SIGTRAN_REQUEST_THREAD_UNREGISTER 

Worker thread to unregister.

SIGTRAN_REQUEST_LINK_UP 

Bring up a link.

SIGTRAN_REQUEST_LINK_DOWN 

Take down a link.

SIGTRAN_REQUEST_MAP_SEND_AUTH_INFO 

Request auth info.

SIGTRAN_REQUEST_EXIT 

Causes the event loop to exit.

SIGTRAN_REQUEST_TEST 

Definition at line 42 of file sigtran.h.

◆ sigtran_response_type_t

Enumerator
SIGTRAN_RESPONSE_OK 

Request succeeded.

SIGTRAN_RESPONSE_NOOP 

Request did nothing.

SIGTRAN_RESPONSE_NOTFOUND 

User or device Not found.

SIGTRAN_RESPONSE_FAIL 

Request failed.

Definition at line 54 of file sigtran.h.

◆ sigtran_vector_type_t

Vector types.

Enumerator
SIGTRAN_VECTOR_TYPE_SIM_TRIPLETS 

RAND, SRES, Kc.

SIGTRAN_VECTOR_TYPE_UMTS_QUINTUPLETS 

RAND, XRES, CK, IK, AUTN.

Definition at line 64 of file sigtran.h.

Function Documentation

◆ sigtran_ascii_to_tbcd()

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

Definition at line 93 of file sigtran.c.

+ Here is the caller graph for this function:

◆ sigtran_client_do_transaction()

int sigtran_client_do_transaction ( int  fd,
sigtran_transaction_t txn 
)

Definition at line 45 of file client.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sigtran_client_link_down()

int sigtran_client_link_down ( sigtran_conn_t const **  conn)

Destroy a connection.

Gracefully shutdown the links for a connection and free it.

Definition at line 250 of file client.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sigtran_client_link_up()

int sigtran_client_link_up ( sigtran_conn_t const **  out,
sigtran_conn_conf_t const *  conn_conf 
)

Create a new connection.

Register the required links for a connection.

Todo:
Return struct representing the connection

Definition at line 225 of file client.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sigtran_client_map_send_auth_info()

unlang_action_t sigtran_client_map_send_auth_info ( rlm_rcode_t p_result,
rlm_sigtran_t const *  inst,
request_t request,
sigtran_conn_t const *  conn,
int  fd 
)

Create a MAP_SEND_AUTH_INFO request.

Parameters
p_resultWhere to write the result.
instof rlm_sigtran.
requestThe current request.
conncurrent connection.
fdfile descriptor on which the transaction is done

Definition at line 406 of file client.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sigtran_client_thread_register()

int sigtran_client_thread_register ( fr_event_list_t el)

Called by a new thread to register a new req_pipe.

Returns
  • The client side of the req_pipe on success.
  • -1 on error.

Definition at line 144 of file client.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sigtran_client_thread_unregister()

int sigtran_client_thread_unregister ( fr_event_list_t el,
int  req_pipe_fd 
)

Signal that libosmo should unregister the other side of the pipe.

Parameters
[in]elthe request pipe was registered to.
[in]req_pipe_fdThe rlm_sigtran side of the req_pipe.

Definition at line 193 of file client.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sigtran_event_exit()

int sigtran_event_exit ( void  )

Signal that libosmo should exit.

Definition at line 581 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sigtran_event_start()

int sigtran_event_start ( void  )

Start the libosmo event loop.

Definition at line 525 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sigtran_event_submit()

int sigtran_event_submit ( struct osmo_fd *  ofd,
sigtran_transaction_t txn 
)

Send response.

Note
Works for both blocking and non-blocking sockets
Parameters
[in]ofdto write response notification to.
[in]txnwe're confirming.

Definition at line 283 of file event.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sigtran_log_init()

void sigtran_log_init ( TALLOC_CTX *  ctx)

Patch our logging system into libosmo's.

Definition at line 62 of file log.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sigtran_sccp_global_free()

void sigtran_sccp_global_free ( void  )

Definition at line 385 of file sccp.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sigtran_sccp_global_init()

int sigtran_sccp_global_init ( void  )

Definition at line 371 of file sccp.c.

+ Here is the call graph for this function:
+ 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:

◆ sigtran_sccp_incoming()

void sigtran_sccp_incoming ( struct mtp_link_set *  set,
struct msgb *  msg,
int  sls 
)

◆ sigtran_sscp_init()

int sigtran_sscp_init ( sigtran_conn_t conn)

Initialise libscctp.

Definition at line 360 of file sccp.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sigtran_tcap_outgoing()

int sigtran_tcap_outgoing ( UNUSED struct msgb *  msg_in,
void *  ctx,
sigtran_transaction_t txn,
struct osmo_fd *  ofd 
)

Variable Documentation

◆ ascii_to_tbcd

uint8_t const ascii_to_tbcd[]
extern

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.

◆ ctrl_pipe

int ctrl_pipe[2]
extern

Definition at line 78 of file event.c.

◆ is_char_tbcd

uint8_t const is_char_tbcd[]
extern

Check is a char is valid Telephony Binary Coded Decimal.

Definition at line 73 of file sigtran.c.