libosmo-sigtran 2.0.0.17-24bf.202410242026
Osmocom SIGTRAN library
ss7_internal.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <osmocom/sigtran/osmo_ss7.h>

Go to the source code of this file.

Macros

#define OSMO_SS7_ROUTE_PRIO_DEFAULT   5
 

Enumerations

enum  ss7_as_ctr { SS7_AS_CTR_RX_MSU_TOTAL , SS7_AS_CTR_TX_MSU_TOTAL }
 
enum  ss7_asp_ctr { SS7_ASP_CTR_PKT_RX_TOTAL , SS7_ASP_CTR_PKT_RX_UNKNOWN , SS7_ASP_CTR_PKT_TX_TOTAL }
 

Functions

uint32_t ss7_find_free_l_rk_id (struct osmo_ss7_instance *inst)
 
bool ss7_ipv6_sctp_supported (const char *host, bool bind)
 
struct osmo_ss7_asss7_as_alloc (struct osmo_ss7_instance *inst, const char *name, enum osmo_ss7_asp_protocol proto)
 Allocate an Application Server. More...
 
struct osmo_ss7_aspss7_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)
 
bool ss7_asp_set_default_peer_hosts (struct osmo_ss7_asp *asp)
 
bool ss7_asp_is_started (const struct osmo_ss7_asp *asp)
 
int ss7_asp_get_fd (const struct osmo_ss7_asp *asp)
 Get the fd of a given ASP. More...
 
struct osmo_ss7_aspss7_asp_find_by_socket_addr (int fd, int trans_proto)
 Find an ASP definition matching the local+remote IP/PORT of given fd. More...
 
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 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 ss7_asp_m3ua_tcp_srv_conn_rx_cb (struct osmo_stream_srv *conn, int res, struct msgb *msg)
 
int ss7_asp_xua_srv_conn_closed_cb (struct osmo_stream_srv *srv)
 
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)
 
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)
 
bool ss7_asp_peer_match_host (const struct osmo_ss7_asp_peer *peer, const char *host, bool host_is_v6)
 
int ss7_asp_peer_find_host (const struct osmo_ss7_asp_peer *peer, const char *host)
 Find the exact IP address match and return its index in the array. More...
 
bool ss7_xua_server_set_default_local_hosts (struct osmo_xua_server *oxs)
 
int xua_tcp_segmentation_cb (struct msgb *msg)
 
struct osmo_ss7_routess7_route_alloc (struct osmo_ss7_route_table *rtbl, uint32_t pc, uint32_t mask)
 Allocate a route entry. More...
 
int ss7_route_set_linkset (struct osmo_ss7_route *rt, const char *linkset_name)
 Set linkset on route entry. More...
 
int ss7_route_insert (struct osmo_ss7_route *rt)
 Insert route into its routing table. More...
 

Variables

bool ss7_initialized
 

Macro Definition Documentation

◆ OSMO_SS7_ROUTE_PRIO_DEFAULT

#define OSMO_SS7_ROUTE_PRIO_DEFAULT   5

Enumeration Type Documentation

◆ ss7_as_ctr

enum ss7_as_ctr
Enumerator
SS7_AS_CTR_RX_MSU_TOTAL 
SS7_AS_CTR_TX_MSU_TOTAL 

◆ ss7_asp_ctr

Enumerator
SS7_ASP_CTR_PKT_RX_TOTAL 
SS7_ASP_CTR_PKT_RX_UNKNOWN 
SS7_ASP_CTR_PKT_TX_TOTAL 

Function Documentation

◆ ss7_as_alloc()

struct osmo_ss7_as * ss7_as_alloc ( struct osmo_ss7_instance inst,
const char *  name,
enum osmo_ss7_asp_protocol  proto 
)

Allocate an Application Server.

Parameters
[in]instSS7 Instance on which we operate
[in]nameName of Application Server
[in]protoProtocol of Application Server
Returns
pointer to Application Server on success; NULL otherwise

References osmo_ss7_instance::as_list, osmo_ss7_as::cfg, osmo_ss7_as::ctrg, osmo_ss7_as::fi, g_ss7_as_rcg_idx, osmo_ss7_as::inst, osmo_ss7_routing_key::l_rk_id, osmo_ss7_as::list, osmo_ss7_as::mode, osmo_ss7_as::name, OSMO_SS7_AS_TMOD_OVERRIDE, osmo_ss7_as::proto, osmo_ss7_as::recovery_timeout_msec, osmo_ss7_as::routing_key, ss7_as_rcgd, ss7_find_free_l_rk_id(), and xua_as_fsm_start().

Referenced by osmo_ss7_as_find_or_create().

◆ ss7_asp_alloc()

◆ ss7_asp_apply_drop_local_address()

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

◆ ss7_asp_apply_new_local_address()

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

◆ ss7_asp_apply_peer_primary_address()

◆ ss7_asp_apply_primary_address()

◆ 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]fdsocket 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, 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_fd()

int ss7_asp_get_fd ( const struct osmo_ss7_asp asp)

Get the fd of a given ASP.

Parameters
[in]aspThe 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 
)

◆ ss7_asp_is_started()

bool ss7_asp_is_started ( const struct osmo_ss7_asp asp)

◆ 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 
)

◆ ss7_asp_peer_find_host()

int ss7_asp_peer_find_host ( const struct osmo_ss7_asp_peer peer,
const char *  host 
)

Find the exact IP address match and return its index in the array.

Parameters
[in]peerApplication Server Process peer where the address is looked up.
[in]hoststring containing an IP address.
Returns
>=0 on success containing the index of the host; negative otherwise

References osmo_ss7_asp_peer::host, and osmo_ss7_asp_peer::host_cnt.

Referenced by DEFUN_ATTR().

◆ ss7_asp_peer_match_host()

bool ss7_asp_peer_match_host ( const struct osmo_ss7_asp_peer peer,
const char *  host,
bool  host_is_v6 
)

◆ ss7_asp_protocol_check_trans_proto()

bool ss7_asp_protocol_check_trans_proto ( enum osmo_ss7_asp_protocol  proto,
int  trans_proto 
)

◆ ss7_asp_set_default_peer_hosts()

◆ ss7_asp_xua_srv_conn_closed_cb()

◆ ss7_asp_xua_srv_conn_rx_cb()

◆ ss7_default_trans_proto_for_asp_proto()

◆ ss7_find_free_l_rk_id()

uint32_t ss7_find_free_l_rk_id ( struct osmo_ss7_instance inst)

◆ ss7_ipv6_sctp_supported()

bool ss7_ipv6_sctp_supported ( const char *  host,
bool  bind 
)

◆ ss7_route_alloc()

struct osmo_ss7_route * ss7_route_alloc ( struct osmo_ss7_route_table rtbl,
uint32_t  pc,
uint32_t  mask 
)

Allocate a route entry.

Parameters
[in]rtblRouting Table where the route belongs
[in]pcPoint Code of the destination of the route
[in]maskMask of the destination Point Code pc
Returns
Allocated route (not yet inserted into its rtbl), NULL on error

The returned route has no linkset associated yet, user must associate it using API ss7_route_set_linkset() before inserting the route into its routing table.

Fields priority and qos_class may be set before inserting the route into its routing table:

  • A default priority of 0 is configured on the route.
  • A default qos-class of 0 is configured on the route.

Use API ss7_route_insert() to insert the route into its routing table.

The route entry allocated with this API can be destroyed/freed at any point using API osmo_ss7_route_destroy(), regardless of it being already inserted or not in its routing table.

References osmo_ss7_instance::cfg, osmo_ss7_route::cfg, osmo_ss7_route_table::inst, osmo_ss7_route::list, osmo_ss7_route::mask, osmo_ss7_pc_normalize(), OSMO_SS7_ROUTE_PRIO_DEFAULT, osmo_ss7_route::pc, osmo_ss7_instance::pc_fmt, osmo_ss7_route::priority, osmo_ss7_route::rtable, and ss7_initialized.

Referenced by DEFUN_ATTR(), and osmo_ss7_route_create().

◆ ss7_route_insert()

int ss7_route_insert ( struct osmo_ss7_route rt)

Insert route into its routing table.

Parameters
[in]rtRoute to be inserted into its routing table
Returns
0 on success, negative on error

A route is only really used once it has been inserted into its routing table.

References osmo_ss7_route::cfg, osmo_ss7_route_table::inst, osmo_ss7_route::linkset_name, LOGSS7, osmo_ss7_route::mask, osmo_ss7_pointcode_print(), osmo_ss7_route_find_dpc_mask(), osmo_ss7_route::pc, route_insert_sorted(), osmo_ss7_route::rtable, and ss7_route_inserted().

Referenced by DEFUN_ATTR(), and osmo_ss7_route_create().

◆ ss7_route_set_linkset()

int ss7_route_set_linkset ( struct osmo_ss7_route rt,
const char *  linkset_name 
)

◆ ss7_xua_server_set_default_local_hosts()

◆ xua_tcp_segmentation_cb()

int xua_tcp_segmentation_cb ( struct msgb *  msg)

Variable Documentation

◆ ss7_initialized