libosmo-sigtran 2.0.0.52-6412
Osmocom SIGTRAN library
|
#include <errno.h>
#include <stdint.h>
#include <unistd.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/talloc.h>
#include <osmocom/sigtran/osmo_ss7.h>
#include <osmocom/sigtran/sccp_sap.h>
#include "ss7_as.h"
#include "ss7_asp.h"
#include "ss7_internal.h"
#include "ss7_instance.h"
#include "ss7_linkset.h"
#include "ss7_route_table.h"
Functions | |
struct osmo_ss7_instance * | ss7_instance_alloc (void *ctx, uint32_t id) |
void | osmo_ss7_instance_destroy (struct osmo_ss7_instance *inst) |
Destroy a SS7 Instance. More... | |
uint32_t | osmo_ss7_instance_get_id (const struct osmo_ss7_instance *inst) |
const char * | osmo_ss7_instance_get_name (const struct osmo_ss7_instance *inst) |
uint32_t | osmo_ss7_instance_get_primary_pc (const struct osmo_ss7_instance *inst) |
int | osmo_ss7_instance_set_pc_fmt (struct osmo_ss7_instance *inst, uint8_t c0, uint8_t c1, uint8_t c2) |
Set the point code format used in given SS7 instance. More... | |
const struct osmo_ss7_pc_fmt * | osmo_ss7_instance_get_pc_fmt (const struct osmo_ss7_instance *inst) |
struct osmo_sccp_instance * | osmo_ss7_ensure_sccp (struct osmo_ss7_instance *inst) |
Allocate an SCCP instance, if not present yet. More... | |
struct osmo_sccp_instance * | osmo_ss7_get_sccp (const struct osmo_ss7_instance *inst) |
Get the SCCP instance, if present. More... | |
bool | osmo_ss7_pc_is_local (const struct osmo_ss7_instance *inst, uint32_t pc) |
int | osmo_ss7_find_free_rctx (struct osmo_ss7_instance *inst) |
uint32_t | ss7_find_free_l_rk_id (struct osmo_ss7_instance *inst) |
struct osmo_ss7_as * | osmo_ss7_as_find_by_name (struct osmo_ss7_instance *inst, const char *name) |
Find Application Server by given name. More... | |
struct osmo_ss7_as * | osmo_ss7_as_find_by_rctx (struct osmo_ss7_instance *inst, uint32_t rctx) |
Find Application Server by given routing context. More... | |
struct osmo_ss7_as * | osmo_ss7_as_find_by_l_rk_id (struct osmo_ss7_instance *inst, uint32_t l_rk_id) |
Find Application Server by given local routing key ID. More... | |
struct osmo_ss7_as * | osmo_ss7_as_find_by_proto (struct osmo_ss7_instance *inst, enum osmo_ss7_asp_protocol proto) |
Find Application Server (AS) by given protocol. More... | |
struct osmo_ss7_as * | osmo_ss7_as_find_or_create (struct osmo_ss7_instance *inst, const char *name, enum osmo_ss7_asp_protocol proto) |
Find or Create Application Server. More... | |
struct osmo_ss7_asp * | osmo_ss7_asp_find_by_name (struct osmo_ss7_instance *inst, const char *name) |
struct osmo_ss7_asp * | osmo_ss7_asp_find_by_proto (struct osmo_ss7_as *as, enum osmo_ss7_asp_protocol proto) |
Find an ASP that matches the given ASP protocol (xUA variant). More... | |
struct osmo_ss7_asp * | osmo_ss7_asp_find2 (struct osmo_ss7_instance *inst, const char *name, uint16_t remote_port, uint16_t local_port, int trans_proto, enum osmo_ss7_asp_protocol proto) |
struct osmo_ss7_asp * | osmo_ss7_asp_find (struct osmo_ss7_instance *inst, const char *name, uint16_t remote_port, uint16_t local_port, enum osmo_ss7_asp_protocol proto) |
struct osmo_ss7_asp * | osmo_ss7_asp_find_or_create2 (struct osmo_ss7_instance *inst, const char *name, uint16_t remote_port, uint16_t local_port, int trans_proto, enum osmo_ss7_asp_protocol proto) |
struct osmo_ss7_asp * | osmo_ss7_asp_find_or_create (struct osmo_ss7_instance *inst, const char *name, uint16_t remote_port, uint16_t local_port, enum osmo_ss7_asp_protocol proto) |
static int | strnappendchar (char *str, char c, size_t n) |
static const char * | gen_pc_fmtstr (const struct osmo_ss7_pc_fmt *pc_fmt, unsigned int *num_comp_exp) |
static unsigned int | num_pc_comp_exp (const struct osmo_ss7_pc_fmt *pc_fmt) |
static unsigned int | get_pc_comp_shift (const struct osmo_ss7_pc_fmt *pc_fmt, unsigned int comp_num) |
static uint32_t | pc_comp_shift_and_mask (const struct osmo_ss7_pc_fmt *pc_fmt, unsigned int comp_num, uint32_t pc) |
int | osmo_ss7_pointcode_parse (const struct osmo_ss7_instance *inst, const char *str) |
const char * | osmo_ss7_pointcode_print_buf (char *buf, size_t len, const struct osmo_ss7_instance *inst, uint32_t pc) |
const char * | osmo_ss7_pointcode_print (const struct osmo_ss7_instance *inst, uint32_t pc) |
const char * | osmo_ss7_pointcode_print2 (const struct osmo_ss7_instance *inst, uint32_t pc) |
int | osmo_ss7_pointcode_parse_mask_or_len (const struct osmo_ss7_instance *inst, const char *in) |
Variables | |
static int32_t | next_rctx = 1 |
static int32_t | next_l_rk_id = 1 |
static const struct osmo_ss7_pc_fmt | default_pc_fmt |
|
static |
References osmo_ss7_pc_fmt::component_len, osmo_ss7_pc_fmt::delimiter, MAX_PC_STR_LEN, and strnappendchar().
Referenced by osmo_ss7_pointcode_parse(), and osmo_ss7_pointcode_print_buf().
|
static |
References osmo_ss7_pc_fmt::component_len, and osmo_ss7_pc_width().
Referenced by osmo_ss7_pointcode_parse(), and pc_comp_shift_and_mask().
|
static |
References osmo_ss7_pc_fmt::component_len.
Referenced by osmo_ss7_pointcode_parse(), and osmo_ss7_pointcode_print_buf().
struct osmo_ss7_as * osmo_ss7_as_find_by_l_rk_id | ( | struct osmo_ss7_instance * | inst, |
uint32_t | l_rk_id | ||
) |
Find Application Server by given local routing key ID.
[in] | inst | SS7 Instance on which we operate |
[in] | l_rk_id | Local Routing Key ID |
References osmo_ss7_instance::as_list, osmo_ss7_as::cfg, osmo_ss7_as::inst, osmo_ss7_routing_key::l_rk_id, osmo_ss7_as::list, osmo_ss7_as::routing_key, and ss7_initialized.
Referenced by handle_reg_conf(), and ss7_find_free_l_rk_id().
struct osmo_ss7_as * osmo_ss7_as_find_by_name | ( | struct osmo_ss7_instance * | inst, |
const char * | name | ||
) |
Find Application Server by given name.
[in] | inst | SS7 Instance on which we operate |
[in] | name | Name of AS |
References osmo_ss7_instance::as_list, osmo_ss7_as::cfg, osmo_ss7_as::inst, osmo_ss7_as::list, osmo_ss7_as::name, and ss7_initialized.
Referenced by DEFUN_ATTR(), ipa_asp_fsm_wait_id_resp(), osmo_ss7_as_find_or_create(), and ss7_route_set_linkset().
struct osmo_ss7_as * osmo_ss7_as_find_by_proto | ( | struct osmo_ss7_instance * | inst, |
enum osmo_ss7_asp_protocol | proto | ||
) |
Find Application Server (AS) by given protocol.
[in] | inst | SS7 Instance on which we operate |
[in] | proto | Protocol identifier that must match |
References osmo_ss7_instance::as_list, osmo_ss7_as::cfg, osmo_ss7_as::inst, osmo_ss7_as::list, osmo_ss7_asp_find_by_proto(), osmo_ss7_as::proto, and ss7_initialized.
Referenced by osmo_sccp_simple_client_on_ss7_id().
struct osmo_ss7_as * osmo_ss7_as_find_by_rctx | ( | struct osmo_ss7_instance * | inst, |
uint32_t | rctx | ||
) |
Find Application Server by given routing context.
[in] | inst | SS7 Instance on which we operate |
[in] | rctx | Routing Context |
References osmo_ss7_instance::as_list, osmo_ss7_as::cfg, osmo_ss7_routing_key::context, osmo_ss7_as::inst, osmo_ss7_as::list, osmo_ss7_as::routing_key, and ss7_initialized.
Referenced by handle_rkey_dereg(), handle_rkey_reg(), osmo_ss7_find_free_rctx(), xua_asp_fsm_inactive(), and xua_find_as_for_asp().
struct osmo_ss7_as * osmo_ss7_as_find_or_create | ( | struct osmo_ss7_instance * | inst, |
const char * | name, | ||
enum osmo_ss7_asp_protocol | proto | ||
) |
Find or Create Application Server.
[in] | inst | SS7 Instance on which we operate |
[in] | name | Name of Application Server |
[in] | proto | Protocol of Application Server |
References osmo_ss7_as::cfg, osmo_ss7_as::inst, LOGPAS, osmo_ss7_as::name, osmo_ss7_as_find_by_name(), osmo_ss7_as::proto, ss7_as_alloc(), and ss7_initialized.
Referenced by DEFUN_ATTR(), handle_rkey_reg(), osmo_sccp_simple_client_on_ss7_id(), and osmo_sccp_simple_server_add_clnt().
struct osmo_ss7_asp * osmo_ss7_asp_find | ( | struct osmo_ss7_instance * | inst, |
const char * | name, | ||
uint16_t | remote_port, | ||
uint16_t | local_port, | ||
enum osmo_ss7_asp_protocol | proto | ||
) |
struct osmo_ss7_asp * osmo_ss7_asp_find2 | ( | struct osmo_ss7_instance * | inst, |
const char * | name, | ||
uint16_t | remote_port, | ||
uint16_t | local_port, | ||
int | trans_proto, | ||
enum osmo_ss7_asp_protocol | proto | ||
) |
struct osmo_ss7_asp * osmo_ss7_asp_find_by_name | ( | struct osmo_ss7_instance * | inst, |
const char * | name | ||
) |
References osmo_ss7_instance::asp_list, osmo_ss7_asp::cfg, osmo_ss7_asp::inst, osmo_ss7_asp::list, osmo_ss7_asp::name, and ss7_initialized.
Referenced by DEFUN(), DEFUN_ATTR(), osmo_ss7_as_add_asp(), osmo_ss7_as_del_asp(), osmo_ss7_asp_find2(), osmo_ss7_asp_find_or_create2(), show_asp(), show_asp_assoc_status(), and show_asp_remaddr().
struct osmo_ss7_asp * osmo_ss7_asp_find_by_proto | ( | struct osmo_ss7_as * | as, |
enum osmo_ss7_asp_protocol | proto | ||
) |
Find an ASP that matches the given ASP protocol (xUA variant).
[in] | as | Application Server in which to look for asp |
[in] | proto | ASP protocol (xUA variant) to match |
References osmo_ss7_as::asps, osmo_ss7_as::cfg, osmo_ss7_asp::cfg, and osmo_ss7_asp::proto.
Referenced by osmo_sccp_simple_client_on_ss7_id(), and osmo_ss7_as_find_by_proto().
struct osmo_ss7_asp * osmo_ss7_asp_find_or_create | ( | struct osmo_ss7_instance * | inst, |
const char * | name, | ||
uint16_t | remote_port, | ||
uint16_t | local_port, | ||
enum osmo_ss7_asp_protocol | proto | ||
) |
struct osmo_ss7_asp * osmo_ss7_asp_find_or_create2 | ( | struct osmo_ss7_instance * | inst, |
const char * | name, | ||
uint16_t | remote_port, | ||
uint16_t | local_port, | ||
int | trans_proto, | ||
enum osmo_ss7_asp_protocol | proto | ||
) |
References osmo_ss7_asp::cfg, osmo_ss7_asp::inst, osmo_ss7_asp::local, osmo_ss7_asp::name, osmo_ss7_asp_find_by_name(), osmo_ss7_asp_peer::port, osmo_ss7_asp::proto, osmo_ss7_asp::remote, ss7_asp_alloc(), ss7_initialized, and osmo_ss7_asp::trans_proto.
Referenced by DEFUN_ATTR(), osmo_sccp_simple_client_on_ss7_id(), osmo_sccp_simple_server_add_clnt(), osmo_ss7_asp_find_or_create(), and xua_accept_cb().
struct osmo_sccp_instance * osmo_ss7_ensure_sccp | ( | struct osmo_ss7_instance * | inst | ) |
Allocate an SCCP instance, if not present yet.
References LOGSS7, osmo_sccp_instance_create(), and osmo_ss7_instance::sccp.
Referenced by DEFUN_ATTR(), osmo_sccp_simple_client_on_ss7_id(), osmo_sccp_simple_server_on_ss7_id(), ss7_asp_alloc(), and ss7_xua_server_create2().
int osmo_ss7_find_free_rctx | ( | struct osmo_ss7_instance * | inst | ) |
References next_rctx, and osmo_ss7_as_find_by_rctx().
Referenced by handle_rkey_reg().
struct osmo_sccp_instance * osmo_ss7_get_sccp | ( | const struct osmo_ss7_instance * | inst | ) |
Get the SCCP instance, if present.
[in] | inst | SS7 Instance on which we operate |
References osmo_ss7_instance::sccp.
void osmo_ss7_instance_destroy | ( | struct osmo_ss7_instance * | inst | ) |
Destroy a SS7 Instance.
[in] | inst | SS7 Instance to be destroyed |
References osmo_ss7_instance::as_list, osmo_ss7_instance::asp_list, osmo_ss7_asp::inst, osmo_ss7_instance::linksets, osmo_ss7_asp::list, osmo_ss7_instance::list, LOGSS7, osmo_ss7_as_destroy(), osmo_ss7_asp_destroy(), ss7_initialized, and ss7_linkset_destroy().
Referenced by osmo_sccp_simple_client_on_ss7_id(), and osmo_sccp_simple_server_on_ss7_id().
uint32_t osmo_ss7_instance_get_id | ( | const struct osmo_ss7_instance * | inst | ) |
References osmo_ss7_instance::cfg, osmo_ss7_instance::id, and osmo_ss7_asp::inst.
const char * osmo_ss7_instance_get_name | ( | const struct osmo_ss7_instance * | inst | ) |
References osmo_ss7_instance::cfg, osmo_ss7_asp::inst, and osmo_ss7_instance::name.
const struct osmo_ss7_pc_fmt * osmo_ss7_instance_get_pc_fmt | ( | const struct osmo_ss7_instance * | inst | ) |
References osmo_ss7_instance::cfg, and osmo_ss7_instance::pc_fmt.
uint32_t osmo_ss7_instance_get_primary_pc | ( | const struct osmo_ss7_instance * | inst | ) |
References osmo_ss7_instance::cfg, osmo_ss7_asp::inst, and osmo_ss7_instance::primary_pc.
int osmo_ss7_instance_set_pc_fmt | ( | struct osmo_ss7_instance * | inst, |
uint8_t | c0, | ||
uint8_t | c1, | ||
uint8_t | c2 | ||
) |
Set the point code format used in given SS7 instance.
References osmo_ss7_instance::cfg, osmo_ss7_pc_fmt::component_len, osmo_ss7_asp::inst, LOGSS7, and osmo_ss7_instance::pc_fmt.
bool osmo_ss7_pc_is_local | ( | const struct osmo_ss7_instance * | inst, |
uint32_t | pc | ||
) |
int osmo_ss7_pointcode_parse | ( | const struct osmo_ss7_instance * | inst, |
const char * | str | ||
) |
References osmo_ss7_instance::cfg, osmo_ss7_pc_fmt::component_len, default_pc_fmt, gen_pc_fmtstr(), get_pc_comp_shift(), LOGSS7, num_pc_comp_exp(), and osmo_ss7_instance::pc_fmt.
Referenced by _rout_key(), DEFUN_ATTR(), and osmo_ss7_pointcode_parse_mask_or_len().
int osmo_ss7_pointcode_parse_mask_or_len | ( | const struct osmo_ss7_instance * | inst, |
const char * | in | ||
) |
References osmo_ss7_instance::cfg, default_pc_fmt, osmo_ss7_pc_width(), osmo_ss7_pointcode_parse(), and osmo_ss7_instance::pc_fmt.
Referenced by DEFUN_ATTR().
const char * osmo_ss7_pointcode_print | ( | const struct osmo_ss7_instance * | inst, |
uint32_t | pc | ||
) |
References MAX_PC_STR_LEN, and osmo_ss7_pointcode_print_buf().
Referenced by DEFUN(), format_affected_pcs_c(), handle_rkey_dereg(), handle_rkey_reg(), hmrt_message_for_routing(), ipa_del_route(), m3ua_hmdc_rx_from_l2(), m3ua_rx_xfer(), osmo_sccp_simple_client_on_ss7_id(), osmo_sccp_user_unbind(), osmo_ss7_route_name(), osmo_ss7_route_print(), sccp_addr_to_str_buf(), sccp_scoc_rx_inval_opc(), sccp_user_bind_pc(), scrc_node_6(), show_user(), ss7_route_destroy(), ss7_route_insert(), ss7_route_set_linkset(), vty_show_connection(), write_one_as(), write_one_cs7(), write_one_rtable(), write_sccp_addressbook(), and xua_snm_rx_dupu().
const char * osmo_ss7_pointcode_print2 | ( | const struct osmo_ss7_instance * | inst, |
uint32_t | pc | ||
) |
References MAX_PC_STR_LEN, and osmo_ss7_pointcode_print_buf().
Referenced by m3ua_rx_xfer(), osmo_ss7_route_name(), osmo_ss7_route_print(), sccp_scoc_rx_inval_opc(), and write_one_rtable().
const char * osmo_ss7_pointcode_print_buf | ( | char * | buf, |
size_t | len, | ||
const struct osmo_ss7_instance * | inst, | ||
uint32_t | pc | ||
) |
References osmo_ss7_instance::cfg, default_pc_fmt, gen_pc_fmtstr(), len, num_pc_comp_exp(), osmo_ss7_pc_is_valid(), pc_comp_shift_and_mask(), and osmo_ss7_instance::pc_fmt.
Referenced by osmo_ss7_pointcode_print(), and osmo_ss7_pointcode_print2().
|
static |
References osmo_ss7_pc_fmt::component_len, and get_pc_comp_shift().
Referenced by osmo_ss7_pointcode_print_buf().
uint32_t ss7_find_free_l_rk_id | ( | struct osmo_ss7_instance * | inst | ) |
References next_l_rk_id, and osmo_ss7_as_find_by_l_rk_id().
Referenced by ss7_as_alloc().
struct osmo_ss7_instance * ss7_instance_alloc | ( | void * | ctx, |
uint32_t | id | ||
) |
References osmo_ss7_instance::as_list, osmo_ss7_instance::asp_list, osmo_ss7_instance::cfg, osmo_ss7_pc_fmt::component_len, osmo_ss7_pc_fmt::delimiter, osmo_ss7_instance::id, osmo_ss7_instance::linksets, osmo_ss7_instance::list, LOGSS7, osmo_ss7_instances, OSMO_SS7_PC_INVALID, osmo_ss7_instance::pc_fmt, osmo_ss7_instance::primary_pc, osmo_ss7_instance::rtable_list, osmo_ss7_instance::rtable_system, osmo_ss7_instance::sccp_address_book, osmo_ss7_instance::secondary_pc, ss7_route_table_find_or_create(), and osmo_ss7_instance::xua_servers.
Referenced by osmo_ss7_instance_find_or_create().
|
static |
Referenced by gen_pc_fmtstr().
|
static |
Referenced by osmo_ss7_pointcode_parse(), osmo_ss7_pointcode_parse_mask_or_len(), and osmo_ss7_pointcode_print_buf().
|
static |
Referenced by ss7_find_free_l_rk_id().
|
static |
Referenced by osmo_ss7_find_free_rctx().