libosmo-sigtran 2.1.0.164-775d Osmocom SIGTRAN library

Functions | Variables
ss7_asp.c File Reference
`#include <string.h>`
`#include <errno.h>`
`#include <unistd.h>`
`#include <inttypes.h>`
`#include <netdb.h>`
`#include <netinet/in.h>`
`#include <netinet/sctp.h>`
`#include <osmocom/sigtran/osmo_ss7.h>`
`#include <osmocom/sigtran/mtp_sap.h>`
`#include <osmocom/sigtran/protocol/mtp.h>`
`#include <osmocom/sigtran/protocol/sua.h>`
`#include <osmocom/sigtran/protocol/m3ua.h>`
`#include <osmocom/core/linuxlist.h>`
`#include <osmocom/core/select.h>`
`#include <osmocom/core/utils.h>`
`#include <osmocom/core/talloc.h>`
`#include <osmocom/core/logging.h>`
`#include <osmocom/core/msgb.h>`
`#include <osmocom/core/socket.h>`
`#include <osmocom/core/sockaddr_str.h>`
`#include <osmocom/core/osmo_io.h>`
`#include <osmocom/netif/stream.h>`
`#include <osmocom/netif/ipa.h>`
`#include <osmocom/netif/sctp.h>`
`#include "sccp_internal.h"`
`#include "xua_internal.h"`
`#include "ss7_as.h"`
`#include "ss7_asp.h"`
`#include "ss7_internal.h"`
`#include "ss7_xua_srv.h"`
`#include "xua_asp_fsm.h"`
`#include "xua_as_fsm.h"`

## Functions
static int | _setsockopt_peer_primary_addr (int fd, const struct osmo_sockaddr *saddr)
static int | _setsockopt_primary_addr (int fd, const struct osmo_sockaddr *saddr)
| osmo_static_assert (ARRAY_SIZE(ss7_asp_xua_timer_defaults)==(SS7_ASP_XUA_TIMERS_LEN) &&ARRAY_SIZE(ss7_asp_xua_timer_names)==(SS7_ASP_XUA_TIMERS_LEN), assert_ss7_asp_xua_timer_count)
bool | ss7_asp_protocol_check_trans_proto (enum osmo_ss7_asp_protocol proto, int trans_proto)
int | ss7_default_trans_proto_for_asp_proto (enum osmo_ss7_asp_protocol proto)
int | osmo_ss7_asp_protocol_port (enum osmo_ss7_asp_protocol prot)
static int | ss7_asp_apply_tcp_keepalive (const struct osmo_ss7_asp *asp)
static int | ss7_asp_apply_tcp_user_timeout (const struct osmo_ss7_asp *asp)
int | ss7_asp_apply_tcp_pars (const struct osmo_ss7_asp *asp)
int | ss7_asp_apply_new_local_address (const struct osmo_ss7_asp *asp, unsigned int loc_idx)
int | ss7_asp_apply_drop_local_address (const struct osmo_ss7_asp *asp, unsigned int loc_idx)
int | ss7_asp_apply_peer_primary_address (const struct osmo_ss7_asp *asp)
int | ss7_asp_apply_primary_address (const struct osmo_ss7_asp *asp)
static bool | sctp_peer_addr_change_ev_addr_matches_our_primary (const struct osmo_ss7_asp *asp, const union sctp_notification *notif)
static void | asp_handle_sctp_notif_monitor_primary_address (const struct osmo_ss7_asp *asp, const union sctp_notification *notif)
static int | asp_client_apply_sctp_init_pars (struct osmo_ss7_asp *asp)
bool | ss7_asp_set_default_peer_hosts (struct osmo_ss7_asp *asp)
static uint16_t | get_in_port (struct sockaddr *sa)
static void | chop_v4_mapped_on_v6_prefix (char *buf)
struct osmo_ss7_asp * | ss7_asp_find_by_socket_addr (int fd, int trans_proto)
| Find an ASP definition matching the local+remote IP/PORT of given fd. More...
struct osmo_ss7_asp * | ss7_asp_alloc (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)
void | osmo_ss7_asp_destroy (struct osmo_ss7_asp *asp)
static int | xua_cli_read_cb (struct osmo_stream_cli *conn, int res, struct msgb *msg)
static int | ipa_cli_read_cb (struct osmo_stream_cli *conn, int res, struct msgb *msg)
static int | m3ua_tcp_cli_read_cb (struct osmo_stream_cli *conn, int res, struct msgb *msg)
static int | xua_cli_connect_cb (struct osmo_stream_cli *cli)
static int | xua_cli_disconnect_cb (struct osmo_stream_cli *cli)
static int | xua_cli_close_and_reconnect (struct osmo_stream_cli *cli)
static int | ss7_asp_start_client (struct osmo_ss7_asp *asp)
int | ss7_asp_disconnect_stream (struct osmo_ss7_asp *asp)
int | osmo_ss7_asp_restart (struct osmo_ss7_asp *asp)
bool | osmo_ss7_asp_active (const struct osmo_ss7_asp *asp)
bool | ss7_asp_is_started (const struct osmo_ss7_asp *asp)
static int | get_logevel_by_sn_type (int sn_type)
static void | log_sctp_notification (struct osmo_ss7_asp *asp, const char *pfx, union sctp_notification *notif)
int | ss7_asp_ipa_srv_conn_rx_cb (struct osmo_stream_srv *conn, int res, struct msgb *msg)
int | ss7_asp_xua_srv_conn_rx_cb (struct osmo_stream_srv *conn, int res, struct msgb *msg)
int | xua_tcp_segmentation_cb (struct msgb *msg)
int | ss7_asp_m3ua_tcp_srv_conn_rx_cb (struct osmo_stream_srv *conn, int res, struct msgb *msg)
static void | xua_cli_close (struct osmo_stream_cli *cli)
int | ss7_asp_xua_srv_conn_closed_cb (struct osmo_stream_srv *srv)
int | osmo_ss7_asp_send (struct osmo_ss7_asp *asp, struct msgb *msg)
| send a fully encoded msgb via a given ASP More...
void | osmo_ss7_asp_disconnect (struct osmo_ss7_asp *asp)
void | osmo_ss7_register_rx_unknown_cb (osmo_ss7_asp_rx_unknown_cb *cb)
| Register a call-back function for unknown SCTP PPID / IPA Stream ID. More...
int | ss7_asp_rx_unknown (struct osmo_ss7_asp *asp, int ppid_mux, struct msgb *msg)
int | osmo_ss7_asp_get_log_subsys (const struct osmo_ss7_asp *asp)
| Get the logging subsystem for a given ASP. More...
const char * | osmo_ss7_asp_get_name (const struct osmo_ss7_asp *asp)
| Get the name of a given ASP. More...
enum osmo_ss7_asp_protocol | osmo_ss7_asp_get_proto (const struct osmo_ss7_asp *asp)
| Get the proto of a given ASP. More...
int | osmo_ss7_asp_get_trans_proto (const struct osmo_ss7_asp *asp)
| Get the transport proto of a given ASP. More...
int | ss7_asp_get_fd (const struct osmo_ss7_asp *asp)
| Get the fd of a given ASP. More...
void | ss7_asp_restart_after_reconfigure (struct osmo_ss7_asp *asp)
static unsigned int | _ss7_asp_get_all_rctx (const struct osmo_ss7_asp *asp, uint32_t *rctx, unsigned int rctx_size, const struct osmo_ss7_as *excl_as, bool network_byte_order)
unsigned int | ss7_asp_get_all_rctx_be (const struct osmo_ss7_asp *asp, uint32_t *rctx, unsigned int rctx_size, const struct osmo_ss7_as *excl_as)
unsigned int | ss7_asp_get_all_rctx (const struct osmo_ss7_asp *asp, uint32_t *rctx, unsigned int rctx_size, const struct osmo_ss7_as *excl_as)
int | ss7_asp_determine_traf_mode (const struct osmo_ss7_asp *asp)

## Variables
const struct osmo_tdef | ss7_asp_xua_timer_defaults [SS7_ASP_XUA_TIMERS_LEN]
const struct value_string | ss7_asp_xua_timer_names []
struct value_string | osmo_ss7_asp_protocol_vals []
const struct value_string | osmo_ss7_asp_admin_state_names []
const struct value_string | osmo_ss7_asp_role_names []
static const uint16_t | prot2port []
static const struct rate_ctr_desc | ss7_asp_rcd []
static const struct rate_ctr_group_desc | ss7_asp_rcgd
static unsigned int | g_ss7_asp_rcg_idx
static osmo_ss7_asp_rx_unknown_cb * | g_osmo_ss7_asp_rx_unknown_cb

## Function Documentation

## ◆ _setsockopt_peer_primary_addr()

static int _setsockopt_peer_primary_addr | ( | int | fd,
|  | const struct osmo_sockaddr * | saddr
| ) |  |
| static

Referenced by ss7_asp_apply_peer_primary_address().

## ◆ _setsockopt_primary_addr()

static int _setsockopt_primary_addr | ( | int | fd,
|  | const struct osmo_sockaddr * | saddr
| ) |  |
| static

Referenced by ss7_asp_apply_primary_address().

## ◆ _ss7_asp_get_all_rctx()

static unsigned int _ss7_asp_get_all_rctx | ( | const struct osmo_ss7_asp * | asp,
|  | uint32_t * | rctx,
|  | unsigned int | rctx_size,
|  | const struct osmo_ss7_as * | excl_as,
|  | bool | network_byte_order
| ) |  |
| static

References osmo_ss7_instance::as_list, osmo_ss7_as::cfg, osmo_ss7_routing_key::context, osmo_ss7_asp::inst, osmo_ss7_as::list, osmo_ss7_as_has_asp(), and osmo_ss7_as::routing_key.

Referenced by ss7_asp_get_all_rctx(), and ss7_asp_get_all_rctx_be().

## ◆ asp_client_apply_sctp_init_pars()

static int asp_client_apply_sctp_init_pars | ( | struct osmo_ss7_asp * | asp | ) |
| static

References osmo_ss7_asp::cfg, osmo_ss7_asp::client, osmo_ss7_asp::max_attempts_present, osmo_ss7_asp::max_attempts_value, osmo_ss7_asp::max_init_timeo_present, osmo_ss7_asp::max_init_timeo_value, osmo_ss7_asp::max_instreams_present, osmo_ss7_asp::max_instreams_value, osmo_ss7_asp::num_ostreams_present, osmo_ss7_asp::num_ostreams_value, and osmo_ss7_asp::sctp_init.

Referenced by ss7_asp_start_client().

## ◆ asp_handle_sctp_notif_monitor_primary_address()

static void asp_handle_sctp_notif_monitor_primary_address | ( | const struct osmo_ss7_asp * | asp,
|  | const union sctp_notification * | notif
| ) |  |
| static

References osmo_ss7_asp::cfg, osmo_ss7_asp_peer::idx_primary, osmo_ss7_asp::remote, sctp_peer_addr_change_ev_addr_matches_our_primary(), and ss7_asp_apply_primary_address().

Referenced by ss7_asp_xua_srv_conn_rx_cb(), and xua_cli_read_cb().

## ◆ chop_v4_mapped_on_v6_prefix()

static void chop_v4_mapped_on_v6_prefix | ( | char * | buf | ) |
| static

References len.

Referenced by ss7_asp_find_by_socket_addr().

## ◆ get_in_port()

static uint16_t get_in_port | ( | struct sockaddr * | sa | ) |
| static

Referenced by ss7_asp_find_by_socket_addr().

## ◆ get_logevel_by_sn_type()

static int get_logevel_by_sn_type | ( | int | sn_type | ) |
| static

Referenced by log_sctp_notification().

## ◆ ipa_cli_read_cb()

static int ipa_cli_read_cb | ( | struct osmo_stream_cli * | conn,
|  | int | res,
|  | struct msgb * | msg
| ) |  |
| static

References osmo_ss7_asp::ctrg, osmo_ss7_asp::ipa, ipa_rx_msg(), osmo_ss7_asp::sls, SS7_ASP_CTR_PKT_RX_TOTAL, and xua_cli_close_and_reconnect().

Referenced by ss7_asp_start_client().

## ◆ log_sctp_notification()

static void log_sctp_notification | ( | struct osmo_ss7_asp * | asp,
|  | const char * | pfx,
|  | union sctp_notification * | notif
| ) |  |
| static

References get_logevel_by_sn_type(), and LOGPASP.

Referenced by ss7_asp_xua_srv_conn_rx_cb(), and xua_cli_read_cb().

## ◆ m3ua_tcp_cli_read_cb()

static int m3ua_tcp_cli_read_cb | ( | struct osmo_stream_cli * | conn,
|  | int | res,
|  | struct msgb * | msg
| ) |  |
| static

References xua_common_hdr::data, M3UA_MSGC_XFER, M3UA_PPID, xua_common_hdr::msg_class, and xua_cli_read_cb().

Referenced by ss7_asp_start_client().

## ◆ osmo_ss7_asp_active()

bool osmo_ss7_asp_active | ( | const struct osmo_ss7_asp * | asp | ) |

References osmo_ss7_asp::fi, and XUA_ASP_S_ACTIVE.

Referenced by current_asp(), DEFUN(), notify_any_other_active_asp_as_inactive(), ss7_as_select_asp_broadcast(), ss7_as_select_asp_loadshare(), ss7_as_select_asp_override(), ss7_as_select_asp_roundrobin(), sua_snm_ssn_available(), xua_as_transmit_msg_broadcast(), xua_snm_pc_available(), xua_snm_scon(), and xua_snm_upu().

## ◆ osmo_ss7_asp_destroy()

void osmo_ss7_asp_destroy | ( | struct osmo_ss7_asp * | asp | ) |

References osmo_ss7_instance::as_list, osmo_ss7_as::asps, osmo_ss7_as::cfg, osmo_ss7_asp::client, osmo_ss7_asp::ctrg, osmo_ss7_asp::fi, osmo_ss7_asp::inst, osmo_ss7_as::list, osmo_ss7_asp::list, LOGPASP, NULL, osmo_ss7_asp::server, osmo_ss7_asp::siblings, ss7_initialized, and osmo_ss7_asp::xua_server.

Referenced by DEFUN_ATTR(), osmo_sccp_simple_client_on_ss7_id(), osmo_sccp_simple_server_add_clnt(), osmo_ss7_instance_destroy(), ss7_asp_xua_srv_conn_closed_cb(), ss7_xua_server_destroy(), and xua_accept_cb().

## ◆ osmo_ss7_asp_disconnect()

void osmo_ss7_asp_disconnect | ( | struct osmo_ss7_asp * | asp | ) |

References osmo_ss7_asp::client, osmo_ss7_asp::server, and xua_cli_close_and_reconnect().

Referenced by DEFUN(), ipa_asp_fsm_timer_cb(), and ipa_asp_fsm_wait_id_resp().

## ◆ osmo_ss7_asp_get_log_subsys()

int osmo_ss7_asp_get_log_subsys | ( | const struct osmo_ss7_asp * | asp | ) |

Get the logging subsystem for a given ASP.

Used by generic code.

References osmo_ss7_asp::cfg, OSMO_SS7_ASP_PROT_M3UA, OSMO_SS7_ASP_PROT_SUA, and osmo_ss7_asp::proto.

Referenced by xua_find_as_for_asp(), xua_snm_rx_daud(), xua_snm_rx_dava(), xua_snm_rx_duna(), xua_snm_rx_dupu(), and xua_snm_rx_scon().

## ◆ osmo_ss7_asp_get_name()

const char * osmo_ss7_asp_get_name | ( | const struct osmo_ss7_asp * | asp | ) |

Get the name of a given ASP.

Parameters

  [in] | asp | The ASP for which the name is requested

Returns
  The name of the ASP, or NULL if not set

References osmo_ss7_asp::cfg, and osmo_ss7_asp::name.

## ◆ osmo_ss7_asp_get_proto()

enum osmo_ss7_asp_protocol osmo_ss7_asp_get_proto | ( | const struct osmo_ss7_asp * | asp | ) |

Get the proto of a given ASP.

Parameters

  [in] | asp | The ASP for which the proto is requested

Returns
  The proto of the ASP

References osmo_ss7_asp::cfg, and osmo_ss7_asp::proto.

## ◆ osmo_ss7_asp_get_trans_proto()

int osmo_ss7_asp_get_trans_proto | ( | const struct osmo_ss7_asp * | asp | ) |

Get the transport proto of a given ASP.

Parameters

  [in] | asp | The ASP for which the transport proto is requested

Returns
  The transport proto of the ASP (one of IPPROTO_*)

References osmo_ss7_asp::cfg, and osmo_ss7_asp::trans_proto.

## ◆ osmo_ss7_asp_protocol_port()

int osmo_ss7_asp_protocol_port | ( | enum osmo_ss7_asp_protocol | prot | ) |

References prot2port.

Referenced by osmo_sccp_simple_client_on_ss7_id(), osmo_sccp_simple_server_add_clnt(), and osmo_sccp_simple_server_on_ss7_id().

## ◆ osmo_ss7_asp_restart()

int osmo_ss7_asp_restart | ( | struct osmo_ss7_asp * | asp | ) |

References osmo_ss7_asp::adm_state, osmo_ss7_asp::cfg, osmo_ss7_asp::dyn_allocated, osmo_ss7_asp::fi, osmo_ss7_asp::is_server, osmo_ss7_asp::local, LOGPASP, osmo_ss7_asp::name, NULL, OSMO_SS7_ASP_ADM_S_SHUTDOWN, osmo_ss7_asp_admin_state_names, OSMO_SS7_ASP_PROT_IPA, osmo_ss7_asp_remove_default_lm(), OSMO_SS7_ASP_ROLE_ASP, osmo_ss7_asp_use_default_lm(), osmo_ss7_asp::proto, osmo_ss7_asp::remote, osmo_ss7_asp::role, ss7_asp_disconnect_stream(), ss7_asp_peer_snprintf(), ss7_asp_start_client(), ss7_initialized, and xua_asp_fsm_start().

Referenced by osmo_sccp_simple_server_add_clnt(), and ss7_asp_restart_after_reconfigure().

## ◆ osmo_ss7_asp_send()

int osmo_ss7_asp_send | ( | struct osmo_ss7_asp * | asp,
|  | struct msgb * | msg
| ) |  |

send a fully encoded msgb via a given ASP

Parameters

  [in] | asp | Application Server Process through which to send
  [in] | msg | message buffer to transmit. Ownership transferred.

Returns
  0 on success; negative in case of error

References osmo_ss7_asp::cfg, osmo_ss7_asp::client, osmo_ss7_asp::ctrg, osmo_ss7_asp::is_server, LOGPASP, M3UA_PPID, OSMO_SS7_ASP_PROT_IPA, OSMO_SS7_ASP_PROT_M3UA, OSMO_SS7_ASP_PROT_SUA, osmo_ss7_asp::proto, osmo_ss7_asp::server, SS7_ASP_CTR_PKT_TX_TOTAL, ss7_initialized, and SUA_PPID.

Referenced by as_notify_all_asp(), ipa_asp_fsm_wait_id_get(), ipa_t_beat_send(), m3ua_rx_rkm_dereg_req(), m3ua_rx_rkm_reg_req(), m3ua_tx_xua_asp(), notify_any_other_active_asp_as_inactive(), peer_send(), peer_send_error(), sua_tx_xua_asp(), tx_notify(), xua_as_transmit_msg(), xua_as_transmit_msg_broadcast(), xua_rkm_send_dereg_req(), and xua_rkm_send_reg_req().

## ◆ osmo_ss7_register_rx_unknown_cb()

void osmo_ss7_register_rx_unknown_cb | ( | osmo_ss7_asp_rx_unknown_cb * | cb | ) |

Register a call-back function for unknown SCTP PPID / IPA Stream ID.

References g_osmo_ss7_asp_rx_unknown_cb.

## ◆ osmo_static_assert()

osmo_static_assert | ( | ARRAY_SIZE(ss7_asp_xua_timer_defaults) | = `=(SS7_ASP_XUA_TIMERS_LEN) &&ARRAY_SIZE(ss7_asp_xua_timer_names)==(SS7_ASP_XUA_TIMERS_LEN)`,
|  | assert_ss7_asp_xua_timer_count |
| ) |  |

## ◆ sctp_peer_addr_change_ev_addr_matches_our_primary()

static bool sctp_peer_addr_change_ev_addr_matches_our_primary | ( | const struct osmo_ss7_asp * | asp,
|  | const union sctp_notification * | notif
| ) |  |
| static

References osmo_ss7_asp::cfg, osmo_ss7_asp_peer::host, osmo_ss7_asp_peer::idx_primary, and osmo_ss7_asp::remote.

Referenced by asp_handle_sctp_notif_monitor_primary_address().

## ◆ ss7_asp_alloc()

struct osmo_ss7_asp * ss7_asp_alloc | ( | 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::adm_state, osmo_ss7_instance::asp_list, osmo_ss7_asp::cfg, osmo_ss7_asp::ctrg, g_ss7_asp_rcg_idx, osmo_ss7_asp::inst, osmo_ss7_asp::list, osmo_ss7_asp::local, osmo_ss7_asp::name, NULL, OSMO_SS7_ASP_ADM_S_ENABLED, OSMO_SS7_ASP_PROT_SUA, osmo_ss7_asp_protocol_name(), osmo_ss7_ensure_sccp(), osmo_ss7_asp_peer::port, osmo_ss7_asp::proto, osmo_ss7_asp::remote, ss7_asp_lm_timer_defaults, ss7_asp_peer_init(), ss7_asp_protocol_check_trans_proto(), ss7_asp_rcgd, ss7_asp_xua_timer_defaults, osmo_ss7_asp::T_defs_lm, osmo_ss7_asp::T_defs_xua, and osmo_ss7_asp::trans_proto.

Referenced by osmo_ss7_asp_find_or_create2().

## ◆ ss7_asp_apply_drop_local_address()

int ss7_asp_apply_drop_local_address | ( | const struct osmo_ss7_asp * | asp,
|  | unsigned int | loc_idx
| ) |  |

References osmo_ss7_asp::cfg, osmo_ss7_asp::client, osmo_ss7_asp_peer::host, osmo_ss7_asp::is_server, osmo_ss7_asp::local, LOGPASP, and osmo_ss7_asp::server.

Referenced by DEFUN_ATTR().

## ◆ ss7_asp_apply_new_local_address()

int ss7_asp_apply_new_local_address | ( | const struct osmo_ss7_asp * | asp,
|  | unsigned int | loc_idx
| ) |  |

References osmo_ss7_asp::cfg, osmo_ss7_asp::client, osmo_ss7_asp_peer::host, osmo_ss7_asp::is_server, osmo_ss7_asp::local, LOGPASP, and osmo_ss7_asp::server.

Referenced by DEFUN_ATTR().

## ◆ ss7_asp_apply_peer_primary_address()

int ss7_asp_apply_peer_primary_address | ( | const struct osmo_ss7_asp * | asp | ) |

References _setsockopt_peer_primary_addr(), osmo_ss7_asp::cfg, osmo_ss7_asp::client, osmo_ss7_asp_peer::host, osmo_ss7_asp_peer::host_cnt, osmo_ss7_asp_peer::idx_primary, osmo_ss7_asp::is_server, osmo_ss7_asp::local, LOGPASP, osmo_ss7_asp_peer::port, and osmo_ss7_asp::server.

Referenced by DEFUN_ATTR(), xua_accept_cb(), and xua_cli_connect_cb().

## ◆ ss7_asp_apply_primary_address()

int ss7_asp_apply_primary_address | ( | const struct osmo_ss7_asp * | asp | ) |

References _setsockopt_primary_addr(), osmo_ss7_asp::cfg, osmo_ss7_asp::client, osmo_ss7_asp_peer::host, osmo_ss7_asp_peer::host_cnt, osmo_ss7_asp_peer::idx_primary, osmo_ss7_asp::is_server, LOGPASP, osmo_ss7_asp_peer::port, osmo_ss7_asp::remote, and osmo_ss7_asp::server.

Referenced by asp_handle_sctp_notif_monitor_primary_address(), DEFUN_ATTR(), xua_accept_cb(), and xua_cli_connect_cb().

## ◆ ss7_asp_apply_tcp_keepalive()

static int ss7_asp_apply_tcp_keepalive | ( | const struct osmo_ss7_asp * | asp | ) |
| static

References osmo_ss7_asp::cfg, osmo_ss7_asp::client, osmo_ss7_asp::keepalive_enable, osmo_ss7_asp::keepalive_intvl_present, osmo_ss7_asp::keepalive_intvl_value, osmo_ss7_asp::keepalive_probes_present, osmo_ss7_asp::keepalive_probes_value, osmo_ss7_asp::keepalive_time_present, osmo_ss7_asp::keepalive_time_value, LOGPASP, osmo_ss7_asp::server, and osmo_ss7_asp::tcp.

Referenced by ss7_asp_apply_tcp_pars().

## ◆ ss7_asp_apply_tcp_pars()

int ss7_asp_apply_tcp_pars | ( | const struct osmo_ss7_asp * | asp | ) |

References ss7_asp_apply_tcp_keepalive(), and ss7_asp_apply_tcp_user_timeout().

Referenced by ss7_asp_start_client(), and xua_accept_cb().

## ◆ ss7_asp_apply_tcp_user_timeout()

static int ss7_asp_apply_tcp_user_timeout | ( | const struct osmo_ss7_asp * | asp | ) |
| static

References osmo_ss7_asp::cfg, osmo_ss7_asp::client, LOGPASP, osmo_ss7_asp::server, osmo_ss7_asp::tcp, osmo_ss7_asp::user_timeout_present, and osmo_ss7_asp::user_timeout_value.

Referenced by ss7_asp_apply_tcp_pars().

## ◆ ss7_asp_determine_traf_mode()

int ss7_asp_determine_traf_mode | ( | const struct osmo_ss7_asp * | asp | ) |

References osmo_ss7_instance::as_list, osmo_ss7_as::cfg, osmo_ss7_asp::inst, osmo_ss7_as::list, osmo_ss7_as::mode, osmo_ss7_as::mode_set_by_vty, and osmo_ss7_as_has_asp().

Referenced by lm_wait_notify(), and peer_send().

## ◆ ss7_asp_disconnect_stream()

int ss7_asp_disconnect_stream | ( | struct osmo_ss7_asp * | asp | ) |

References osmo_ss7_asp::cfg, osmo_ss7_asp::client, osmo_ss7_asp::is_server, NULL, and osmo_ss7_asp::server.

Referenced by ipa_t_beat_cb(), lm_rkm_reg(), lm_timer_cb(), osmo_ss7_asp_restart(), and xua_t_beat_cb().

## ◆ ss7_asp_find_by_socket_addr()

struct osmo_ss7_asp * ss7_asp_find_by_socket_addr | ( | int | fd,
|  | int | trans_proto
| ) |  |

Find an ASP definition matching the local+remote IP/PORT of given fd.

Parameters

  [in] | fd | socket descriptor of given socket

Returns
  SS7 ASP in case a matching one is found; NULL otherwise

References osmo_ss7_instance::asp_list, osmo_ss7_asp::cfg, chop_v4_mapped_on_v6_prefix(), get_in_port(), osmo_ss7_asp_peer::host_cnt, osmo_ss7_asp::inst, osmo_ss7_asp::list, osmo_ss7_asp::local, NULL, osmo_ss7_instances, osmo_ss7_asp_peer::port, osmo_ss7_asp::remote, ss7_asp_peer_match_host(), ss7_initialized, and osmo_ss7_asp::trans_proto.

Referenced by xua_accept_cb().

## ◆ ss7_asp_get_all_rctx()

unsigned int ss7_asp_get_all_rctx | ( | const struct osmo_ss7_asp * | asp,
|  | uint32_t * | rctx,
|  | unsigned int | rctx_size,
|  | const struct osmo_ss7_as * | excl_as
| ) |  |

References _ss7_asp_get_all_rctx().

Referenced by fill_notify_route_ctx().

## ◆ ss7_asp_get_all_rctx_be()

unsigned int ss7_asp_get_all_rctx_be | ( | const struct osmo_ss7_asp * | asp,
|  | uint32_t * | rctx,
|  | unsigned int | rctx_size,
|  | const struct osmo_ss7_as * | excl_as
| ) |  |

References _ss7_asp_get_all_rctx().

Referenced by sua_snm_ssn_available(), tx_daud_pc(), xua_asp_tx_snm_daud_address_book(), xua_msg_add_asp_rctx(), xua_snm_pc_available(), xua_snm_rx_daud(), xua_snm_scon(), and xua_snm_upu().

## ◆ ss7_asp_get_fd()

int ss7_asp_get_fd | ( | const struct osmo_ss7_asp * | asp | ) |

Get the fd of a given ASP.

Parameters

  [in] | asp | The ASP for which the fd is requested

Returns
  The fd of the ASP if acailable, negative otherwise

References osmo_ss7_asp::cfg, osmo_ss7_asp::client, osmo_ss7_asp::is_server, and osmo_ss7_asp::server.

Referenced by show_one_asp(), show_one_asp_assoc_status_tcp(), and show_one_asp_remaddr_tcp().

## ◆ ss7_asp_ipa_srv_conn_rx_cb()

int ss7_asp_ipa_srv_conn_rx_cb | ( | struct osmo_stream_srv * | conn,
|  | int | res,
|  | struct msgb * | msg
| ) |  |

References osmo_ss7_asp::ctrg, osmo_ss7_asp::ipa, ipa_rx_msg(), osmo_ss7_asp::sls, and SS7_ASP_CTR_PKT_RX_TOTAL.

Referenced by xua_accept_cb().

## ◆ ss7_asp_is_started()

bool ss7_asp_is_started | ( | const struct osmo_ss7_asp * | asp | ) |

References osmo_ss7_asp::cfg, osmo_ss7_asp::client, osmo_ss7_asp::is_server, and osmo_ss7_asp::server.

Referenced by DEFUN_ATTR().

## ◆ ss7_asp_m3ua_tcp_srv_conn_rx_cb()

int ss7_asp_m3ua_tcp_srv_conn_rx_cb | ( | struct osmo_stream_srv * | conn,
|  | int | res,
|  | struct msgb * | msg
| ) |  |

References osmo_ss7_asp::ctrg, xua_common_hdr::data, M3UA_MSGC_XFER, m3ua_rx_msg(), xua_common_hdr::msg_class, and SS7_ASP_CTR_PKT_RX_TOTAL.

Referenced by xua_accept_cb().

## ◆ ss7_asp_protocol_check_trans_proto()

bool ss7_asp_protocol_check_trans_proto | ( | enum osmo_ss7_asp_protocol | proto,
|  | int | trans_proto
| ) |  |

References OSMO_SS7_ASP_PROT_IPA, OSMO_SS7_ASP_PROT_M3UA, OSMO_SS7_ASP_PROT_NONE, and OSMO_SS7_ASP_PROT_SUA.

Referenced by ss7_asp_alloc(), and ss7_xua_server_create2().

## ◆ ss7_asp_restart_after_reconfigure()

void ss7_asp_restart_after_reconfigure | ( | struct osmo_ss7_asp * | asp | ) |

References osmo_ss7_asp_restart(), and ss7_asp_set_default_peer_hosts().

Referenced by DEFUN_ATTR(), osmo_sccp_simple_client_on_ss7_id(), and ss7_vty_node_asp_go_parent().

## ◆ ss7_asp_rx_unknown()

int ss7_asp_rx_unknown | ( | struct osmo_ss7_asp * | asp,
|  | int | ppid_mux,
|  | struct msgb * | msg
| ) |  |

References osmo_ss7_asp::cfg, osmo_ss7_asp::ctrg, g_osmo_ss7_asp_rx_unknown_cb, LOGPASP, OSMO_SS7_ASP_PROT_IPA, osmo_ss7_asp::proto, and SS7_ASP_CTR_PKT_RX_UNKNOWN.

Referenced by ipa_rx_msg(), ss7_asp_xua_srv_conn_rx_cb(), and xua_cli_read_cb().

## ◆ ss7_asp_set_default_peer_hosts()

bool ss7_asp_set_default_peer_hosts | ( | struct osmo_ss7_asp * | asp | ) |

References osmo_ss7_asp::cfg, osmo_ss7_asp_peer::host, osmo_ss7_asp_peer::host_cnt, osmo_ss7_asp::local, osmo_ss7_asp::remote, ss7_asp_peer_add_host(), and ss7_ipv6_sctp_supported().

Referenced by ss7_asp_restart_after_reconfigure().

## ◆ ss7_asp_start_client()

static int ss7_asp_start_client | ( | struct osmo_ss7_asp * | asp | ) |
| static

References asp_client_apply_sctp_init_pars(), osmo_ss7_asp::cfg, osmo_ss7_asp::client, osmo_ss7_asp_peer::host, osmo_ss7_asp_peer::host_cnt, ipa_cli_read_cb(), osmo_ss7_asp::local, LOGPASP, m3ua_tcp_cli_read_cb(), osmo_ss7_asp::name, NULL, OSMO_SS7_ASP_PROT_IPA, OSMO_SS7_ASP_PROT_M3UA, osmo_ss7_asp_peer::port, osmo_ss7_asp::proto, osmo_ss7_asp::remote, ss7_asp_apply_tcp_pars(), osmo_ss7_asp::trans_proto, xua_cli_connect_cb(), xua_cli_disconnect_cb(), xua_cli_read_cb(), and xua_tcp_segmentation_cb().

Referenced by osmo_ss7_asp_restart().

## ◆ ss7_asp_xua_srv_conn_closed_cb()

int ss7_asp_xua_srv_conn_closed_cb | ( | struct osmo_stream_srv * | srv | ) |

References osmo_ss7_asp::cfg, osmo_ss7_asp::dyn_allocated, osmo_ss7_asp::fi, osmo_ss7_asp::name, NULL, osmo_ss7_asp_destroy(), OSMO_XLM_PRIM_M_SCTP_RELEASE, osmo_ss7_asp::server, XUA_ASP_E_SCTP_COMM_DOWN_IND, xua_asp_send_xlm_prim_simple(), and xua_rkm_cleanup_dyn_as_for_asp().

Referenced by xua_accept_cb().

## ◆ ss7_asp_xua_srv_conn_rx_cb()

int ss7_asp_xua_srv_conn_rx_cb | ( | struct osmo_stream_srv * | conn,
|  | int | res,
|  | struct msgb * | msg
| ) |  |

References asp_handle_sctp_notif_monitor_primary_address(), osmo_ss7_asp::cfg, osmo_ss7_asp::ctrg, log_sctp_notification(), LOGPASP, M3UA_PPID, m3ua_rx_msg(), OSMO_SS7_ASP_PROT_M3UA, OSMO_SS7_ASP_PROT_SUA, OSMO_XLM_PRIM_M_SCTP_RESTART, osmo_ss7_asp::proto, SS7_ASP_CTR_PKT_RX_TOTAL, ss7_asp_rx_unknown(), SUA_PPID, sua_rx_msg(), and xua_asp_send_xlm_prim_simple().

Referenced by xua_accept_cb().

## ◆ ss7_default_trans_proto_for_asp_proto()

int ss7_default_trans_proto_for_asp_proto | ( | enum osmo_ss7_asp_protocol | proto | ) |

References OSMO_SS7_ASP_PROT_IPA, OSMO_SS7_ASP_PROT_M3UA, and OSMO_SS7_ASP_PROT_SUA.

Referenced by DEFUN_ATTR(), osmo_sccp_simple_client_on_ss7_id(), osmo_sccp_simple_server_add_clnt(), osmo_sccp_simple_server_on_ss7_id(), osmo_ss7_asp_find(), osmo_ss7_asp_find_or_create(), ss7_vty_write_one_asp(), ss7_vty_write_one_oxs(), ss7_xua_server_create(), and ss7_xua_server_find().

## ◆ xua_cli_close()

static void xua_cli_close | ( | struct osmo_stream_cli * | cli | ) |
| static

References osmo_ss7_asp::fi, OSMO_XLM_PRIM_M_SCTP_RELEASE, XUA_ASP_E_SCTP_COMM_DOWN_IND, and xua_asp_send_xlm_prim_simple().

Referenced by xua_cli_close_and_reconnect().

## ◆ xua_cli_close_and_reconnect()

static int xua_cli_close_and_reconnect | ( | struct osmo_stream_cli * | cli | ) |
| static

References osmo_ss7_asp::adm_state, osmo_ss7_asp::cfg, LOGPASP, OSMO_SS7_ASP_ADM_S_SHUTDOWN, and xua_cli_close().

Referenced by ipa_cli_read_cb(), osmo_ss7_asp_disconnect(), xua_cli_disconnect_cb(), and xua_cli_read_cb().

## ◆ xua_cli_connect_cb()

static int xua_cli_connect_cb | ( | struct osmo_stream_cli * | cli | ) |
| static

References osmo_ss7_asp::cfg, osmo_ss7_asp::fi, osmo_ss7_asp::lm, LOGPASP, M3UA_MSG_HEADROOM, M3UA_MSG_SIZE, NULL, OSMO_XLM_PRIM_M_SCTP_ESTABLISH, osmo_xua_layer_manager::prim_cb, osmo_ss7_asp::sock_name, ss7_asp_apply_peer_primary_address(), ss7_asp_apply_primary_address(), osmo_ss7_asp::trans_proto, XUA_ASP_E_M_ASP_UP_REQ, and xua_asp_send_xlm_prim_simple().

Referenced by ss7_asp_start_client().

## ◆ xua_cli_disconnect_cb()

static int xua_cli_disconnect_cb | ( | struct osmo_stream_cli * | cli | ) |
| static

References LOGPASP, and xua_cli_close_and_reconnect().

Referenced by ss7_asp_start_client().

## ◆ xua_cli_read_cb()

static int xua_cli_read_cb | ( | struct osmo_stream_cli * | conn,
|  | int | res,
|  | struct msgb * | msg
| ) |  |
| static

References asp_handle_sctp_notif_monitor_primary_address(), osmo_ss7_asp::cfg, osmo_ss7_asp::ctrg, log_sctp_notification(), LOGPASP, M3UA_PPID, m3ua_rx_msg(), OSMO_SS7_ASP_PROT_M3UA, OSMO_SS7_ASP_PROT_SUA, OSMO_XLM_PRIM_M_SCTP_RESTART, osmo_ss7_asp::proto, SS7_ASP_CTR_PKT_RX_TOTAL, ss7_asp_rx_unknown(), SUA_PPID, sua_rx_msg(), xua_asp_send_xlm_prim_simple(), and xua_cli_close_and_reconnect().

Referenced by m3ua_tcp_cli_read_cb(), and ss7_asp_start_client().

## ◆ xua_tcp_segmentation_cb()

int xua_tcp_segmentation_cb | ( | struct msgb * | msg | ) |

References xua_common_hdr::data, msg_length, and xua_common_hdr::msg_length.

Referenced by ss7_asp_start_client(), and xua_accept_cb().

## Variable Documentation

## ◆ g_osmo_ss7_asp_rx_unknown_cb

osmo_ss7_asp_rx_unknown_cb* g_osmo_ss7_asp_rx_unknown_cb
| static

Referenced by osmo_ss7_register_rx_unknown_cb(), and ss7_asp_rx_unknown().

## ◆ g_ss7_asp_rcg_idx

unsigned int g_ss7_asp_rcg_idx
| static

Referenced by ss7_asp_alloc().

## ◆ osmo_ss7_asp_admin_state_names

const struct value_string osmo_ss7_asp_admin_state_names[]

Initial value:
= {
{ OSMO_SS7_ASP_ADM_S_SHUTDOWN, "SHUTDOWN" },
{ OSMO_SS7_ASP_ADM_S_BLOCKED, "BLOCKED" },
{ OSMO_SS7_ASP_ADM_S_ENABLED, "ENABLED" },
{ 0, NULL }
}
OSMO_SS7_ASP_ADM_S_SHUTDOWN
@ OSMO_SS7_ASP_ADM_S_SHUTDOWN
no SCTP association with peer
Definition: osmo_ss7.h:245
OSMO_SS7_ASP_ADM_S_BLOCKED
@ OSMO_SS7_ASP_ADM_S_BLOCKED
SCP association, but reject ASP-ACTIVE.
Definition: osmo_ss7.h:247
OSMO_SS7_ASP_ADM_S_ENABLED
@ OSMO_SS7_ASP_ADM_S_ENABLED
in normal operation
Definition: osmo_ss7.h:249
NULL
int and can be left NULL
Definition: osmo_ss7.h:364

Referenced by DEFUN_ATTR(), osmo_ss7_asp_restart(), and xua_accept_cb().

## ◆ osmo_ss7_asp_protocol_vals

struct value_string osmo_ss7_asp_protocol_vals[]

Initial value:
= {
{ OSMO_SS7_ASP_PROT_NONE, "none" },
{ OSMO_SS7_ASP_PROT_SUA, "sua" },
{ OSMO_SS7_ASP_PROT_M3UA, "m3ua" },
{ OSMO_SS7_ASP_PROT_IPA, "ipa" },
{ 0, NULL }
}
OSMO_SS7_ASP_PROT_SUA
@ OSMO_SS7_ASP_PROT_SUA
Definition: osmo_ss7.h:159
OSMO_SS7_ASP_PROT_NONE
@ OSMO_SS7_ASP_PROT_NONE
Definition: osmo_ss7.h:158
OSMO_SS7_ASP_PROT_IPA
@ OSMO_SS7_ASP_PROT_IPA
Definition: osmo_ss7.h:161
OSMO_SS7_ASP_PROT_M3UA
@ OSMO_SS7_ASP_PROT_M3UA
Definition: osmo_ss7.h:160

Referenced by osmo_ss7_asp_protocol_name(), parse_asp_proto(), show_one_asp(), ss7_vty_write_one_oxs(), ss7_xua_server_bind(), ss7_xua_server_create2(), vty_dump_xua_server(), and xua_accept_cb().

## ◆ osmo_ss7_asp_role_names

const struct value_string osmo_ss7_asp_role_names[]

Initial value:
= {
{ OSMO_SS7_ASP_ROLE_ASP, "ASP" },
{ OSMO_SS7_ASP_ROLE_SG, "SG" },
{ OSMO_SS7_ASP_ROLE_IPSP, "IPSP" },
{ 0, NULL }
}
OSMO_SS7_ASP_ROLE_SG
@ OSMO_SS7_ASP_ROLE_SG
Definition: osmo_ss7.h:255
OSMO_SS7_ASP_ROLE_ASP
@ OSMO_SS7_ASP_ROLE_ASP
Definition: osmo_ss7.h:254
OSMO_SS7_ASP_ROLE_IPSP
@ OSMO_SS7_ASP_ROLE_IPSP
Definition: osmo_ss7.h:256

Referenced by DEFUN_ATTR(), show_one_asp(), and ss7_vty_write_one_asp().

## ◆ prot2port

const uint16_t prot2port[]
| static

Initial value:
= {
[OSMO_SS7_ASP_PROT_NONE] = 0,
[OSMO_SS7_ASP_PROT_SUA] = SUA_PORT,
[OSMO_SS7_ASP_PROT_M3UA] = M3UA_PORT,
[OSMO_SS7_ASP_PROT_IPA] = 5000,
}
M3UA_PORT
#define M3UA_PORT
Definition: m3ua.h:26
SUA_PORT
#define SUA_PORT
Definition: sua.h:29

Referenced by osmo_ss7_asp_protocol_port().

## ◆ ss7_asp_rcd

const struct rate_ctr_desc ss7_asp_rcd[]
| static

Initial value:
= {
[SS7_ASP_CTR_PKT_RX_TOTAL] = { "rx:packets:total", "Total number of packets received" },
[SS7_ASP_CTR_PKT_RX_UNKNOWN] = { "rx:packets:unknown", "Number of packets received for unknown PPID" },
[SS7_ASP_CTR_PKT_TX_TOTAL] = { "tx:packets:total", "Total number of packets transmitted" },
}
SS7_ASP_CTR_PKT_TX_TOTAL
@ SS7_ASP_CTR_PKT_TX_TOTAL
Definition: ss7_asp.h:39
SS7_ASP_CTR_PKT_RX_UNKNOWN
@ SS7_ASP_CTR_PKT_RX_UNKNOWN
Definition: ss7_asp.h:38
SS7_ASP_CTR_PKT_RX_TOTAL
@ SS7_ASP_CTR_PKT_RX_TOTAL
Definition: ss7_asp.h:37

## ◆ ss7_asp_rcgd

const struct rate_ctr_group_desc ss7_asp_rcgd
| static

Initial value:
= {
.group_name_prefix = "sigtran_asp",
.group_description = "SIGTRAN Application Server Process",
.num_ctr = ARRAY_SIZE(ss7_asp_rcd),
.ctr_desc = ss7_asp_rcd,
}
ss7_asp_rcd
static const struct rate_ctr_desc ss7_asp_rcd[]
Definition: ss7_asp.c:216

Referenced by ss7_asp_alloc().

## ◆ ss7_asp_xua_timer_defaults

const struct osmo_tdef ss7_asp_xua_timer_defaults[SS7_ASP_XUA_TIMERS_LEN]

Initial value:
= {
{ .T = SS7_ASP_XUA_T_ACK, .default_val = SS7_ASP_XUA_DEFAULT_T_ACK_SEC, .unit = OSMO_TDEF_S,
.desc = "Resend ASP Up/Down/Active/Inactive after timeout waiting for ASP Up/Down/Active/Inactive ACK (ASP role)(s)" },
{ .T = SS7_ASP_XUA_T_BEAT, .default_val = SS7_ASP_XUA_DEFAULT_T_BEAT_SEC, .unit = OSMO_TDEF_S,
.desc = "Heartbeat Timer (0 = disabled) (s)" },
{}
}
SS7_ASP_XUA_T_ACK
@ SS7_ASP_XUA_T_ACK
Definition: ss7_asp.h:24
SS7_ASP_XUA_T_BEAT
@ SS7_ASP_XUA_T_BEAT
Definition: ss7_asp.h:25
SS7_ASP_XUA_DEFAULT_T_ACK_SEC
#define SS7_ASP_XUA_DEFAULT_T_ACK_SEC
Definition: ss7_asp.h:32
SS7_ASP_XUA_DEFAULT_T_BEAT_SEC
#define SS7_ASP_XUA_DEFAULT_T_BEAT_SEC
Definition: ss7_asp.h:34

Referenced by gen_asp_timer_xua_cmd_strs(), and ss7_asp_alloc().

## ◆ ss7_asp_xua_timer_names

const struct value_string ss7_asp_xua_timer_names[]

Initial value:
= {
{ SS7_ASP_XUA_T_ACK, "ack" },
{ SS7_ASP_XUA_T_BEAT, "beat" },
{}
}

Referenced by DEFUN_ATTR(), gen_asp_timer_xua_cmd_strs(), and write_asp_timers_xua().