libosmo-sigtran 2.0.0.50-b59d
Osmocom SIGTRAN library
|
#include <stdint.h>
#include <osmocom/core/prim.h>
#include <osmocom/sigtran/sigtran_sap.h>
#include <netinet/in.h>
Go to the source code of this file.
Data Structures | |
struct | osmo_sccp_gt |
struct | osmo_sccp_addr |
struct | osmo_scu_connect_param |
struct | osmo_scu_data_param |
struct | osmo_scu_disconn_param |
struct | osmo_scu_reset_param |
struct | osmo_scu_unitdata_param |
struct | osmo_scu_notice_param |
struct | osmo_scu_state_param |
struct | osmo_scu_pcstate_param |
struct | osmo_scu_prim |
Macros | |
#define | OSMO_SCCP_ADDR_T_GT 0x0001 /* global title */ |
#define | OSMO_SCCP_ADDR_T_PC 0x0002 /* signalling point code */ |
#define | OSMO_SCCP_ADDR_T_SSN 0x0004 /* subsystem number */ |
#define | OSMO_SCCP_ADDR_T_IPv4 0x0008 |
#define | OSMO_SCCP_ADDR_T_IPv6 0x0010 |
#define | OSMO_SCCP_ADDR_T_MASK 0x001f |
#define | OSMO_SCCP_SSN_SMLC_BSSAP OSMO_SCCP_SSN_SMLC_BSSAP_LE |
#define | msgb_scu_prim(msg) ((struct osmo_scu_prim *)(msg)->l1h) |
Functions | |
static const char * | osmo_sccp_routing_ind_name (enum osmo_sccp_routing_ind val) |
static const char * | osmo_sccp_gti_name (enum osmo_sccp_gti val) |
static const char * | osmo_sccp_sp_status_name (enum osmo_sccp_sp_status val) |
static const char * | osmo_sccp_rem_sccp_status_name (enum osmo_sccp_rem_sccp_status val) |
static const char * | osmo_sccp_ssn_name (enum osmo_sccp_ssn val) |
static const char * | osmo_scu_prim_type_name (enum osmo_scu_prim_type val) |
int | osmo_scu_prim_hdr_name_buf (char *buf, size_t buflen, const struct osmo_prim_hdr *oph) |
char * | osmo_scu_prim_hdr_name_c (void *ctx, const struct osmo_prim_hdr *oph) |
char * | osmo_scu_prim_name (const struct osmo_prim_hdr *oph) |
void | osmo_sccp_vty_init (void) |
struct osmo_sccp_instance * | osmo_sccp_instance_create (struct osmo_ss7_instance *ss7, void *priv) |
create a SCCP Instance and register it as user with SS7 inst More... | |
void | osmo_sccp_instance_destroy (struct osmo_sccp_instance *inst) |
struct osmo_ss7_instance * | osmo_sccp_get_ss7 (const struct osmo_sccp_instance *sccp) |
get the SS7 instance that is related to the given SCCP instance More... | |
struct osmo_sccp_instance * | osmo_sccp_get_sccp (const struct osmo_sccp_user *scu) |
get the SCCP instance that is related to the given sccp user More... | |
void | osmo_sccp_set_priv (struct osmo_sccp_instance *sccp, void *priv) |
void * | osmo_sccp_get_priv (struct osmo_sccp_instance *sccp) |
void | osmo_sccp_user_unbind (struct osmo_sccp_user *scu) |
Unbind a given SCCP user. More... | |
void | osmo_sccp_user_set_priv (struct osmo_sccp_user *scu, void *priv) |
void * | osmo_sccp_user_get_priv (struct osmo_sccp_user *scu) |
struct osmo_sccp_user * | osmo_sccp_user_bind_pc (struct osmo_sccp_instance *inst, const char *name, osmo_prim_cb prim_cb, uint16_t ssn, uint32_t pc) |
Bind a given SCCP User to a given SSN+PC. More... | |
struct osmo_sccp_user * | osmo_sccp_user_bind (struct osmo_sccp_instance *inst, const char *name, osmo_prim_cb prim_cb, uint16_t ssn) |
Bind a given SCCP User to a given SSN (at any PC) More... | |
struct osmo_sccp_user * | osmo_sccp_user_find (struct osmo_sccp_instance *inst, uint16_t ssn, uint32_t pc) |
Find a SCCP User registered for given PC+SSN or SSN only. More... | |
int | osmo_sccp_user_sap_down (struct osmo_sccp_user *scu, struct osmo_prim_hdr *oph) |
Main entrance function for primitives from SCCP User. More... | |
int | osmo_sccp_user_sap_down_nofree (struct osmo_sccp_user *scu, struct osmo_prim_hdr *oph) |
Main entrance function for primitives from SCCP User. More... | |
struct osmo_ss7_instance * | osmo_sccp_addr_by_name (struct osmo_sccp_addr *dest_addr, const char *name) |
Lookup an SCCP address from the addressbook by its name. More... | |
int | osmo_sccp_addr_by_name_local (struct osmo_sccp_addr *dest_addr, const char *name, const struct osmo_ss7_instance *inst) |
Lookup an SCCP address from the addressbook of a specific instance by its name. More... | |
const char * | osmo_sccp_name_by_addr (const struct osmo_sccp_addr *addr) |
Reverse lookup the lookup-name of a specified SCCP address. More... | |
void | osmo_sccp_local_addr_by_instance (struct osmo_sccp_addr *dest_addr, const struct osmo_sccp_instance *inst, uint32_t ssn) |
derive a basic local SCCP-Address from a given SCCP instance. More... | |
bool | osmo_sccp_check_addr (struct osmo_sccp_addr *addr, uint32_t presence) |
check whether a given SCCP-Address is consistent. More... | |
int | osmo_sccp_addr_cmp (const struct osmo_sccp_addr *a, const struct osmo_sccp_addr *b, uint32_t presence_criteria) |
Compare two SCCP addresses by given presence criteria. More... | |
int | osmo_sccp_addr_ri_cmp (const struct osmo_sccp_addr *a, const struct osmo_sccp_addr *b) |
Compare the routing information of two SCCP addresses. More... | |
int | osmo_sccp_gt_cmp (const struct osmo_sccp_gt *a, const struct osmo_sccp_gt *b) |
Compare two SCCP Global Titles. More... | |
const char * | osmo_sccp_user_name (struct osmo_sccp_user *scu) |
Compose a human readable string to describe the SCCP user's connection. More... | |
int | osmo_sccp_instance_next_conn_id (struct osmo_sccp_instance *sccp) |
Variables | |
const struct value_string | osmo_sccp_routing_ind_names [] |
const struct value_string | osmo_sccp_gti_names [] |
const struct value_string | osmo_sccp_sp_status_names [] |
const struct value_string | osmo_sccp_rem_sccp_status_names [] |
const struct value_string | osmo_sccp_ssn_names [] |
const struct value_string | osmo_scu_prim_type_names [] |
#define msgb_scu_prim | ( | msg | ) | ((struct osmo_scu_prim *)(msg)->l1h) |
#define OSMO_SCCP_ADDR_T_GT 0x0001 /* global title */ |
#define OSMO_SCCP_ADDR_T_IPv4 0x0008 |
#define OSMO_SCCP_ADDR_T_IPv6 0x0010 |
#define OSMO_SCCP_ADDR_T_MASK 0x001f |
#define OSMO_SCCP_ADDR_T_PC 0x0002 /* signalling point code */ |
#define OSMO_SCCP_ADDR_T_SSN 0x0004 /* subsystem number */ |
#define OSMO_SCCP_SSN_SMLC_BSSAP OSMO_SCCP_SSN_SMLC_BSSAP_LE |
enum osmo_sccp_gti |
enum osmo_sccp_nai |
enum osmo_sccp_npi |
enum osmo_sccp_originator |
enum osmo_sccp_sp_status |
enum osmo_sccp_ssn |
enum osmo_scu_prim_type |
SCCP-User primitives as per Q.711.
struct osmo_ss7_instance * osmo_sccp_addr_by_name | ( | struct osmo_sccp_addr * | dest_addr, |
const char * | name | ||
) |
Lookup an SCCP address from the addressbook by its name.
[out] | dest_addr | pointer to output the resulting sccp-address; (set to NULL if not interested) |
[in] | name | of the address to lookup |
References osmo_sccp_addr_entry::addr, addr_entry_by_name_global(), osmo_sccp_addr_entry::inst, and osmo_sccp_addr_entry::name.
int osmo_sccp_addr_by_name_local | ( | struct osmo_sccp_addr * | dest_addr, |
const char * | name, | ||
const struct osmo_ss7_instance * | inst | ||
) |
Lookup an SCCP address from the addressbook of a specific instance by its name.
[out] | dest_addr | pointer to output the resulting sccp-address; (set to NULL if not interested) |
[in] | name | of the address to lookup |
[in] | inst | ss7 instance of which the address book will be searched |
References osmo_sccp_addr_entry::addr, addr_entry_by_name_local(), osmo_sccp_addr_entry::inst, and osmo_sccp_addr_entry::name.
int osmo_sccp_addr_cmp | ( | const struct osmo_sccp_addr * | a, |
const struct osmo_sccp_addr * | b, | ||
uint32_t | presence_criteria | ||
) |
Compare two SCCP addresses by given presence criteria.
Any OSMO_SCCP_ADDR_T_* type not set in presence_criteria is ignored. In case all bits are set in presence_criteria, the comparison is in the order of: OSMO_SCCP_ADDR_T_GT, OSMO_SCCP_ADDR_T_PC, OSMO_SCCP_ADDR_T_IPv4, OSMO_SCCP_ADDR_T_IPv6, OSMO_SCCP_ADDR_T_SSN. The SCCP addresses' Routing Indicator is not compared, see osmo_sccp_addr_ri_cmp().
[in] | a | left side. |
[in] | b | right side. |
[in] | presence_criteria | A bitmask of OSMO_SCCP_ADDR_T_* values, or OSMO_SCCP_ADDR_T_MASK to compare all parts, except the routing indicator. |
References osmo_sccp_addr::gt, osmo_sccp_addr::ip, OSMO_SCCP_ADDR_T_GT, OSMO_SCCP_ADDR_T_IPv4, OSMO_SCCP_ADDR_T_IPv6, OSMO_SCCP_ADDR_T_PC, OSMO_SCCP_ADDR_T_SSN, osmo_sccp_gt_cmp(), osmo_sccp_addr::pc, osmo_sccp_addr::presence, osmo_sccp_addr::ssn, osmo_sccp_addr::v4, and osmo_sccp_addr::v6.
Referenced by osmo_sccp_addr_ri_cmp().
int osmo_sccp_addr_ri_cmp | ( | const struct osmo_sccp_addr * | a, |
const struct osmo_sccp_addr * | b | ||
) |
Compare the routing information of two SCCP addresses.
Compare the ri of a and b, and, if equal, return osmo_sccp_addr_cmp() with presence criteria selected according to ri.
[in] | a | left side. |
[in] | b | right side. |
References osmo_sccp_addr_cmp(), OSMO_SCCP_ADDR_T_GT, OSMO_SCCP_ADDR_T_IPv4, OSMO_SCCP_ADDR_T_IPv6, OSMO_SCCP_ADDR_T_PC, OSMO_SCCP_ADDR_T_SSN, OSMO_SCCP_RI_GT, OSMO_SCCP_RI_NONE, OSMO_SCCP_RI_SSN_IP, OSMO_SCCP_RI_SSN_PC, osmo_sccp_addr::presence, and osmo_sccp_addr::ri.
bool osmo_sccp_check_addr | ( | struct osmo_sccp_addr * | addr, |
uint32_t | presence | ||
) |
check whether a given SCCP-Address is consistent.
[in] | addr | SCCP address to check |
[in] | presence | mask with minimum required address components |
References osmo_sccp_addr::gt, osmo_sccp_gt::gti, osmo_sccp_gt::nai, osmo_sccp_gt::npi, OSMO_SCCP_ADDR_T_GT, OSMO_SCCP_ADDR_T_IPv4, OSMO_SCCP_ADDR_T_IPv6, OSMO_SCCP_ADDR_T_PC, OSMO_SCCP_ADDR_T_SSN, OSMO_SCCP_RI_GT, OSMO_SCCP_RI_SSN_IP, OSMO_SCCP_RI_SSN_PC, osmo_sccp_addr::presence, and osmo_sccp_addr::ri.
void * osmo_sccp_get_priv | ( | struct osmo_sccp_instance * | sccp | ) |
References osmo_sccp_instance::priv.
struct osmo_sccp_instance * osmo_sccp_get_sccp | ( | const struct osmo_sccp_user * | scu | ) |
get the SCCP instance that is related to the given sccp user
[in] | scu | SCCP user |
References osmo_sccp_user::inst.
struct osmo_ss7_instance * osmo_sccp_get_ss7 | ( | const struct osmo_sccp_instance * | sccp | ) |
get the SS7 instance that is related to the given SCCP instance
[in] | sccp | SCCP instance |
References osmo_ss7_instance::sccp, and osmo_sccp_instance::ss7.
int osmo_sccp_gt_cmp | ( | const struct osmo_sccp_gt * | a, |
const struct osmo_sccp_gt * | b | ||
) |
Compare two SCCP Global Titles.
[in] | a | left side. |
[in] | b | right side. |
Referenced by osmo_sccp_addr_cmp().
|
inlinestatic |
References osmo_sccp_gti_names.
Referenced by sccp_addr_to_str_buf().
struct osmo_sccp_instance * osmo_sccp_instance_create | ( | struct osmo_ss7_instance * | ss7, |
void * | priv | ||
) |
create a SCCP Instance and register it as user with SS7 inst
[in] | ss7 | SS7 instance to which this SCCP instance belongs |
[in] | priv | private data to be stored within SCCP instance |
References osmo_sccp_instance::list, osmo_sccp_instance::max_optional_data, MTP_SI_SCCP, mtp_user_prim_cb(), osmo_sccp_timer_defaults, osmo_ss7_user_create(), osmo_ss7_user_register(), osmo_ss7_user_set_prim_cb(), osmo_ss7_user_set_priv(), osmo_sccp_instance::priv, sccp_scmg_init(), osmo_sccp_instance::ss7, osmo_sccp_instance::ss7_user, osmo_sccp_instance::tdefs, and osmo_sccp_instance::users.
Referenced by osmo_ss7_ensure_sccp().
void osmo_sccp_instance_destroy | ( | struct osmo_sccp_instance * | inst | ) |
References osmo_sccp_user::inst, osmo_sccp_instance::list, osmo_sccp_user::list, MTP_SI_SCCP, osmo_sccp_user_unbind(), osmo_ss7_user_destroy(), osmo_ss7_user_unregister(), osmo_ss7_instance::sccp, sccp_scoc_flush_connections(), osmo_sccp_instance::ss7, osmo_sccp_instance::ss7_user, and osmo_sccp_instance::users.
int osmo_sccp_instance_next_conn_id | ( | struct osmo_sccp_instance * | sccp | ) |
References conn_find_by_id(), and osmo_sccp_instance::next_id.
Referenced by conn_create().
void osmo_sccp_local_addr_by_instance | ( | struct osmo_sccp_addr * | dest_addr, |
const struct osmo_sccp_instance * | inst, | ||
uint32_t | ssn | ||
) |
derive a basic local SCCP-Address from a given SCCP instance.
[out] | dest_addr | pointer to output address memory |
[in] | inst | SCCP instance |
[in] | ssn | Subsystem Number |
References osmo_ss7_instance::cfg, osmo_sccp_make_addr_pc_ssn(), osmo_ss7_instance::primary_pc, and osmo_sccp_instance::ss7.
const char * osmo_sccp_name_by_addr | ( | const struct osmo_sccp_addr * | addr | ) |
Reverse lookup the lookup-name of a specified SCCP address.
[in] | name | of the address to lookup |
References osmo_sccp_addr_entry::addr, osmo_sccp_addr_entry::list_global, and osmo_sccp_addr_entry::name.
|
inlinestatic |
References osmo_sccp_rem_sccp_status_names.
|
inlinestatic |
References osmo_sccp_routing_ind_names.
Referenced by sccp_addr_to_str_buf().
void osmo_sccp_set_priv | ( | struct osmo_sccp_instance * | sccp, |
void * | priv | ||
) |
References osmo_sccp_instance::priv, and osmo_sccp_user::priv.
|
inlinestatic |
References osmo_sccp_sp_status_names.
|
inlinestatic |
References osmo_sccp_ssn_names.
Referenced by sccp_addr_to_str_buf().
struct osmo_sccp_user * osmo_sccp_user_bind | ( | struct osmo_sccp_instance * | inst, |
const char * | name, | ||
osmo_prim_cb | prim_cb, | ||
uint16_t | ssn | ||
) |
Bind a given SCCP User to a given SSN (at any PC)
[in] | inst | SCCP Instance |
[in] | name | human-readable name |
[in] | ssn | Sub-System Number to bind to |
References osmo_sccp_user::inst, osmo_sccp_user::name, OSMO_SS7_PC_INVALID, osmo_sccp_user::prim_cb, sccp_user_bind_pc(), and osmo_sccp_user::ssn.
Referenced by sccp_scmg_init().
struct osmo_sccp_user * osmo_sccp_user_bind_pc | ( | struct osmo_sccp_instance * | inst, |
const char * | name, | ||
osmo_prim_cb | prim_cb, | ||
uint16_t | ssn, | ||
uint32_t | pc | ||
) |
Bind a given SCCP User to a given SSN+PC.
[in] | inst | SCCP Instance |
[in] | name | human-readable name |
[in] | ssn | Sub-System Number to bind to |
[in] | pc | Point Code to bind to |
References osmo_sccp_user::inst, osmo_sccp_user::name, osmo_sccp_user::pc, osmo_sccp_user::prim_cb, sccp_user_bind_pc(), and osmo_sccp_user::ssn.
struct osmo_sccp_user * osmo_sccp_user_find | ( | struct osmo_sccp_instance * | inst, |
uint16_t | ssn, | ||
uint32_t | pc | ||
) |
Find a SCCP User registered for given PC+SSN or SSN only.
First search all users with a valid PC for a full PC+SSN match. If no match was found, search all users with an invalid PC for an SSN-only match.
[in] | inst | SCCP Instance in which to search. |
[in] | ssn | Sub-System Number to search for. |
[in] | pc | Point Code to search for. |
References osmo_sccp_user::inst, osmo_sccp_user::pc, sccp_user_find(), and osmo_sccp_user::ssn.
void * osmo_sccp_user_get_priv | ( | struct osmo_sccp_user * | scu | ) |
References osmo_sccp_user::priv.
const char * osmo_sccp_user_name | ( | struct osmo_sccp_user * | scu | ) |
Compose a human readable string to describe the SCCP user's connection.
The output follows ['<scu.name>':]<local-sccp-addr>, e.g. "'OsmoHNBW':RI=SSN_PC,PC=0.23.5,SSN=RANAP", or just "RI=SSN_PC,PC=0.23.5,SSN=RANAP" if no scu->name is set. This calls osmo_sccp_addr_name(), which returns a static buffer; hence calling this function and osmo_sccp_addr_name() in the same printf statement is likely to conflict.
References osmo_sccp_user::inst, osmo_sccp_user::name, osmo_sccp_addr_name(), osmo_sccp_make_addr_pc_ssn(), osmo_sccp_user::pc, osmo_sccp_instance::ss7, and osmo_sccp_user::ssn.
int osmo_sccp_user_sap_down | ( | struct osmo_sccp_user * | scu, |
struct osmo_prim_hdr * | oph | ||
) |
Main entrance function for primitives from SCCP User.
Implies a msgb_free(oph->msg), otherwise the same as osmo_sccp_user_sap().
[in] | scu | SCCP User sending us the primitive |
[in] | oph | Osmocom primitive sent by the user |
References osmo_scu_prim::oph, and osmo_sccp_user_sap_down_nofree().
Referenced by osmo_sccp_tx_conn_req(), osmo_sccp_tx_conn_resp_msg(), osmo_sccp_tx_data(), osmo_sccp_tx_disconn_data(), osmo_sccp_tx_unitdata(), and sccp_scmg_tx().
int osmo_sccp_user_sap_down_nofree | ( | struct osmo_sccp_user * | scu, |
struct osmo_prim_hdr * | oph | ||
) |
Main entrance function for primitives from SCCP User.
The caller is required to free oph->msg, otherwise the same as osmo_sccp_user_sap_down().
[in] | scu | SCCP User sending us the primitive |
[in] | oph | Osmocom primitive sent by the user |
References conn_create_id(), conn_find_by_id(), osmo_scu_connect_param::conn_id, osmo_scu_prim::connect, sccp_connection::fi, osmo_sccp_user::inst, sccp_connection::inst, osmo_scu_prim::oph, OSMO_SCU_PRIM_N_CONNECT, OSMO_SCU_PRIM_N_DATA, OSMO_SCU_PRIM_N_DISCONNECT, OSMO_SCU_PRIM_N_RESET, OSMO_SCU_PRIM_N_UNITDATA, osmo_scu_prim_name(), sccp_sclc_user_sap_down_nofree(), scu_prim_conn_id(), scu_scoc_event_map, and osmo_scu_prim::u.
Referenced by osmo_sccp_user_sap_down().
void osmo_sccp_user_set_priv | ( | struct osmo_sccp_user * | scu, |
void * | priv | ||
) |
References osmo_sccp_user::priv.
void osmo_sccp_user_unbind | ( | struct osmo_sccp_user * | scu | ) |
Unbind a given SCCP user.
[in] | scu | SCCP User which is to be un-bound. Will be destroyed at the time this function returns. |
References osmo_sccp_user::inst, osmo_sccp_user::list, osmo_sccp_user::name, osmo_ss7_pointcode_print(), osmo_sccp_user::pc, osmo_sccp_instance::ss7, and osmo_sccp_user::ssn.
Referenced by osmo_sccp_instance_destroy().
void osmo_sccp_vty_init | ( | void | ) |
References gen_sccp_timer_cmd_strs().
int osmo_scu_prim_hdr_name_buf | ( | char * | buf, |
size_t | buflen, | ||
const struct osmo_prim_hdr * | oph | ||
) |
References osmo_scu_prim_type_name().
Referenced by osmo_scu_prim_hdr_name_c(), and osmo_scu_prim_name().
char * osmo_scu_prim_hdr_name_c | ( | void * | ctx, |
const struct osmo_prim_hdr * | oph | ||
) |
References osmo_scu_prim_hdr_name_buf().
char * osmo_scu_prim_name | ( | const struct osmo_prim_hdr * | oph | ) |
References osmo_scu_prim_hdr_name_buf(), and prim_name_buf.
Referenced by osmo_sccp_user_sap_down_nofree(), sccp_sclc_user_sap_down_nofree(), sccp_user_prim_up(), scmg_prim_cb(), xua_drop_data_check_drop(), and xua_opt_data_cache_keep().
|
inlinestatic |
References osmo_scu_prim_type_names.
Referenced by osmo_scu_prim_hdr_name_buf().
|
extern |
Referenced by osmo_sccp_gti_name().
|
extern |
Referenced by osmo_sccp_rem_sccp_status_name().
|
extern |
Referenced by osmo_sccp_routing_ind_name().
|
extern |
Referenced by osmo_sccp_sp_status_name().
|
extern |
Referenced by osmo_sccp_ssn_name().
|
extern |
Referenced by osmo_scu_prim_type_name().