libosmo-sigtran: src/sccp_instance.c File Reference

libosmo-sigtran 2.2.1.95-893c Osmocom SIGTRAN library

Functions | Variables
sccp_instance.c File Reference
`#include <stdbool.h>`
`#include <string.h>`
`#include <limits.h>`
`#include <osmocom/core/linuxlist.h>`
`#include <osmocom/core/logging.h>`
`#include <osmocom/sigtran/osmo_ss7.h>`
`#include <osmocom/sigtran/sccp_sap.h>`
`#include <osmocom/sigtran/mtp_sap.h>`
`#include <osmocom/sigtran/protocol/mtp.h>`
`#include <osmocom/sigtran/sccp_helpers.h>`
`#include <osmocom/sccp/sccp_types.h>`
`#include "sccp_connection.h"`
`#include "sccp_internal.h"`
`#include "sccp_instance.h"`
`#include "sccp_user.h"`
`#include "xua_internal.h"`
`#include "ss7_as.h"`
`#include "ss7_asp.h"`
`#include "ss7_route.h"`
`#include "ss7_route_table.h"`
`#include "ss7_internal.h"`
`#include "ss7_xua_srv.h"`

## Functions
| osmo_static_assert (ARRAY_SIZE(osmo_sccp_timer_defaults)==(OSMO_SCCP_TIMERS_LEN) &&ARRAY_SIZE(osmo_sccp_timer_names)==(OSMO_SCCP_TIMERS_LEN), assert_osmo_sccp_timers_count)
struct osmo_sccp_user * | 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. 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...
static struct osmo_sccp_user * | 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 SCCP User to a given Point Code. More...
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...
static void | rout_fail_pending_cb (void *_inst)
void | sccp_rout_fail_enqueue (struct osmo_sccp_instance *inst, const struct xua_msg *xua, uint32_t cause, bool scoc)
static int | mtp_user_prim_cb (struct osmo_prim_hdr *oph, void *ctx)
static | LLIST_HEAD (sccp_instances)
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)
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_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_gt_cmp (const struct osmo_sccp_gt *a, const struct osmo_sccp_gt *b)
| Compare two SCCP Global Titles. 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...
struct osmo_sccp_instance * | osmo_sccp_simple_client_on_ss7_id (void *ctx, uint32_t ss7_id, const char *name, uint32_t default_pc, enum osmo_ss7_asp_protocol prot, int default_local_port, const char *default_local_ip, int default_remote_port, const char *default_remote_ip)
| request an sccp client instance More...
struct osmo_sccp_instance * | osmo_sccp_simple_client (void *ctx, const char *name, uint32_t default_pc, enum osmo_ss7_asp_protocol prot, int default_local_port, const char *default_local_ip, int default_remote_port, const char *default_remote_ip)
| request an sccp client instance More...
struct osmo_sccp_instance * | osmo_sccp_simple_server_on_ss7_id (void *ctx, uint32_t ss7_id, uint32_t pc, enum osmo_ss7_asp_protocol prot, int local_port, const char *local_ip)
struct osmo_sccp_instance * | osmo_sccp_simple_server (void *ctx, uint32_t pc, enum osmo_ss7_asp_protocol prot, int local_port, const char *local_ip)
struct osmo_sccp_instance * | osmo_sccp_simple_server_add_clnt (struct osmo_sccp_instance *inst, enum osmo_ss7_asp_protocol prot, const char *name, uint32_t pc, int local_port, int remote_port, const char *remote_ip)
void | osmo_sccp_set_max_optional_data (struct osmo_sccp_instance *inst, int val)
| Adjust the upper bound for the optional data length (the payload) for CR, CC, CREF and RLSD messages. More...
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...

## Variables
const struct osmo_tdef | osmo_sccp_timer_defaults [OSMO_SCCP_TIMERS_LEN]
const struct value_string | osmo_sccp_timer_names []

## Function Documentation

## ◆ LLIST_HEAD()

static LLIST_HEAD | ( | sccp_instances |  | ) |
| static

## ◆ mtp_user_prim_cb()

static int mtp_user_prim_cb | ( | struct osmo_prim_hdr * | oph,
|  | void * | ctx
| ) |  |
| static

References osmo_mtp_pause_param::affected_dpc, osmo_mtp_resume_param::affected_dpc, osmo_mtp_status_param::affected_dpc, osmo_mtp_status_param::cause, osmo_mtp_status_param::congestion_level, LOGPSCI, xua_msg::mtp, MTP_SAP_USER, osmo_mtp_prim::oph, OSMO_MTP_PRIM_PAUSE, OSMO_MTP_PRIM_RESUME, OSMO_MTP_PRIM_STATUS, OSMO_MTP_PRIM_TRANSFER, osmo_sccp_to_xua(), osmo_mtp_prim::pause, osmo_mtp_prim::resume, sccp_scmg_rx_mtp_pause(), sccp_scmg_rx_mtp_resume(), sccp_scmg_rx_mtp_status(), scrc_rx_mtp_xfer_ind_xua(), osmo_mtp_prim::status, osmo_mtp_prim::transfer, osmo_mtp_prim::u, and xua_msg_free().

Referenced by osmo_sccp_instance_create().

## ◆ osmo_sccp_addr_cmp()

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().

Parameters

  [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.

Returns
  -1 if a < b, 1 if a > b, and 0 if all checked values match.

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(), and tcap_trans_track_entry_find().

## ◆ 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.

Parameters

  [in] | a | left side.
  [in] | b | right side.

Returns
  -1 if a < b, 1 if a > b, and 0 if a == b.

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.

## ◆ osmo_sccp_check_addr()

bool osmo_sccp_check_addr | ( | struct osmo_sccp_addr * | addr,
|  | uint32_t | presence
| ) |  |

check whether a given SCCP-Address is consistent.

Parameters

  [in] | addr | SCCP address to check
  [in] | presence | mask with minimum required address components

Returns
  true when address data seems plausible

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.

## ◆ osmo_sccp_get_priv()

void * osmo_sccp_get_priv | ( | struct osmo_sccp_instance * | sccp | ) |

References osmo_sccp_instance::priv.

## ◆ osmo_sccp_get_ss7()

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

Parameters

  [in] | sccp | SCCP instance

Returns
  SS7 instance; NULL if sccp was NULL

References NULL, osmo_ss7_instance::sccp, and osmo_sccp_instance::ss7.

## ◆ osmo_sccp_gt_cmp()

int osmo_sccp_gt_cmp | ( | const struct osmo_sccp_gt * | a,
|  | const struct osmo_sccp_gt * | b
| ) |  |

Compare two SCCP Global Titles.

Parameters

  [in] | a | left side.
  [in] | b | right side.

Returns
  -1 if a < b, 1 if a > b, and 0 if a == b.

Referenced by osmo_sccp_addr_cmp().

## ◆ osmo_sccp_instance_create()

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

Parameters

  [in] | ss7 | SS7 instance to which this SCCP instance belongs
  [in] | priv | private data to be stored within SCCP instance

Returns
  callee-allocated SCCP instance on success; NULL on error

References osmo_sccp_instance::list, osmo_sccp_instance::max_optional_data, MTP_SI_SCCP, mtp_user_prim_cb(), NULL, 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, osmo_sccp_instance::queue, osmo_sccp_instance::rout_fail_pending, rout_fail_pending_cb(), sccp_scmg_init(), osmo_sccp_instance::ss7, osmo_sccp_instance::ss7_user, osmo_sccp_instance::tdefs, osmo_sccp_instance::timer, and osmo_sccp_instance::users.

Referenced by osmo_ss7_ensure_sccp().

## ◆ osmo_sccp_instance_destroy()

void osmo_sccp_instance_destroy | ( | struct osmo_sccp_instance * | inst | ) |

References osmo_sccp_instance::connections, osmo_sccp_user::inst, osmo_sccp_instance::list, osmo_sccp_user::list, MTP_SI_SCCP, NULL, osmo_sccp_user_unbind(), osmo_ss7_user_destroy(), osmo_ss7_user_unregister(), osmo_sccp_instance::rout_fail_pending, osmo_ss7_instance::sccp, osmo_sccp_instance::ss7, osmo_sccp_instance::ss7_user, osmo_sccp_instance::timer, and osmo_sccp_instance::users.

## ◆ osmo_sccp_local_addr_by_instance()

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.

Parameters

  [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, osmo_sccp_instance::ss7, and ssn.

## ◆ osmo_sccp_set_max_optional_data()

void osmo_sccp_set_max_optional_data | ( | struct osmo_sccp_instance * | inst,
|  | int | val
| ) |  |

Adjust the upper bound for the optional data length (the payload) for CR, CC, CREF and RLSD messages.

For any Optional Data part larger than this value in octets, send CR, CC, CREF and RLSD messages without any payload, and send the data payload in a separate Data Form 1 message. ITU-T Q.713 sections 4.2 thru 4.5 define a limit of 130 bytes for the 'Data' parameter. This limit can be adjusted here. May be useful for interop with nonstandard SCCP peers.

Parameters

  [in] | sccp | SCCP instance to reconfigure.
  [in] | val | Number of bytes to set as upper bound for the optional data length, or pass a negative value to set the standard value of SCCP_MAX_OPTIONAL_DATA == 130, which conforms to ITU-T Q.713.

References osmo_xua_server::inst.

Referenced by DEFUN_ATTR().

## ◆ osmo_sccp_set_priv()

void osmo_sccp_set_priv | ( | struct osmo_sccp_instance * | sccp,
|  | void * | priv
| ) |  |

References osmo_sccp_instance::priv, and osmo_sccp_user::priv.

## ◆ osmo_sccp_simple_client()

struct osmo_sccp_instance * osmo_sccp_simple_client | ( | void * | ctx,
|  | const char * | name,
|  | uint32_t | default_pc,
|  | enum osmo_ss7_asp_protocol | prot,
|  | int | default_local_port,
|  | const char * | default_local_ip,
|  | int | default_remote_port,
|  | const char * | default_remote_ip
| ) |  |

request an sccp client instance

Parameters

  [in] | ctx | talloc context
  [in] | name | human readable name
  [in] | default_pc | pointcode to be used on missing VTY setting
  [in] | prot | protocol to be used (e.g OSMO_SS7_ASP_PROT_M3UA)
  [in] | default_local_port | local port to be used on missing VTY setting
  [in] | default_local_ip | local IP-address to be used on missing VTY setting
  [in] | default_remote_port | remote port to be used on missing VTY setting
  [in] | default_remote_ip | remote IP-address to be used on missing VTY setting

Returns
  callee-allocated SCCP instance on success; NULL on error

This is simplified version of osmo_sccp_simple_client_on_ss7_id(). the only difference is that the ID of the CS7 instance will be set to 0 statically

References osmo_sccp_simple_client_on_ss7_id().

## ◆ osmo_sccp_simple_client_on_ss7_id()

struct osmo_sccp_instance * osmo_sccp_simple_client_on_ss7_id | ( | void * | ctx,
|  | uint32_t | ss7_id,
|  | const char * | name,
|  | uint32_t | default_pc,
|  | enum osmo_ss7_asp_protocol | prot,
|  | int | default_local_port,
|  | const char * | default_local_ip,
|  | int | default_remote_port,
|  | const char * | default_remote_ip
| ) |  |

request an sccp client instance

Parameters

  [in] | ctx | talloc context
  [in] | ss7_id | of the SS7/CS7 instance
  [in] | name | human readable name
  [in] | default_pc | pointcode to be used on missing VTY setting
  [in] | prot | protocol to be used (e.g OSMO_SS7_ASP_PROT_M3UA)
  [in] | default_local_port | local port to be used on missing VTY setting
  [in] | default_local_ip | local IP-address to be used on missing VTY setting (NULL: use library own defaults)
  [in] | default_remote_port | remote port to be used on missing VTY setting
  [in] | default_remote_ip | remote IP-address to be used on missing VTY setting (NULL: use library own defaults)

Returns
  callee-allocated SCCP instance on success; NULL on error

The function will examine the given CS7 instance and its sub components (as, asp, etc.). If necessary it will allocate the missing components. If no CS7 instance can be detected under the caller supplied ID, a new instance will be created beforehand.

References osmo_ss7_instance::asp_list, osmo_ss7_as::cfg, osmo_ss7_asp::cfg, osmo_ss7_instance::cfg, osmo_ss7_instance::id, osmo_ss7_asp::is_server, osmo_ss7_asp::list, osmo_ss7_asp::local, osmo_ss7_as::name, osmo_ss7_asp::name, NULL, osmo_ss7_asp::num_assoc_as, osmo_ss7_as_destroy(), osmo_ss7_as_find_by_proto(), osmo_ss7_as_find_or_create(), osmo_ss7_asp_destroy(), osmo_ss7_asp_find_by_proto(), osmo_ss7_asp_find_or_create2(), osmo_ss7_asp_protocol_name(), osmo_ss7_asp_protocol_port(), OSMO_SS7_ASP_ROLE_ASP, osmo_ss7_ensure_sccp(), osmo_ss7_instance_destroy(), osmo_ss7_instance_find(), osmo_ss7_instance_find_or_create(), osmo_ss7_pc_is_valid(), osmo_ss7_pointcode_print(), osmo_ss7_routing_key::pc, osmo_ss7_asp_peer::port, osmo_ss7_instance::primary_pc, osmo_ss7_asp::proto, osmo_ss7_asp::remote, osmo_ss7_asp::role, osmo_ss7_asp::role_set_by_vty, osmo_ss7_as::routing_key, osmo_ss7_instance::rtable_system, osmo_ss7_instance::sccp, osmo_ss7_as::simple_client_allocated, osmo_ss7_asp::simple_client_allocated, ss7_as_add_asp(), ss7_asp_peer_set_hosts(), ss7_asp_restart_after_reconfigure(), ss7_default_trans_proto_for_asp_proto(), ss7_route_create(), ss7_route_destroy(), ss7_route_table_find_route_by_dpc_mask(), ss7_xua_server_find2(), osmo_ss7_asp::trans_proto, and osmo_ss7_asp::trans_role_set_by_vty.

Referenced by osmo_sccp_simple_client().

## ◆ osmo_sccp_simple_server()

struct osmo_sccp_instance * osmo_sccp_simple_server | ( | void * | ctx,
|  | uint32_t | pc,
|  | enum osmo_ss7_asp_protocol | prot,
|  | int | local_port,
|  | const char * | local_ip
| ) |  |

References osmo_sccp_simple_server_on_ss7_id(), and pc.

## ◆ osmo_sccp_simple_server_add_clnt()

struct osmo_sccp_instance * osmo_sccp_simple_server_add_clnt | ( | struct osmo_sccp_instance * | inst,
|  | enum osmo_ss7_asp_protocol | prot,
|  | const char * | name,
|  | uint32_t | pc,
|  | int | local_port,
|  | int | remote_port,
|  | const char * | remote_ip
| ) |  |

References osmo_ss7_asp::cfg, osmo_xua_server::cfg, osmo_ss7_asp_peer::host, osmo_ss7_asp_peer::host_cnt, osmo_ss7_asp::is_server, osmo_ss7_asp::local, osmo_xua_server::local, NULL, osmo_ss7_as_destroy(), osmo_ss7_as_find_or_create(), osmo_ss7_asp_destroy(), osmo_ss7_asp_find_or_create2(), osmo_ss7_asp_protocol_port(), osmo_ss7_asp_restart(), OSMO_SS7_ASP_ROLE_SG, pc, osmo_ss7_asp::remote, osmo_ss7_asp::role, osmo_ss7_instance::rtable_system, osmo_ss7_instance::sccp, osmo_sccp_instance::ss7, ss7_as_add_asp(), ss7_asp_peer_add_host(), ss7_asp_peer_set_hosts(), ss7_default_trans_proto_for_asp_proto(), ss7_route_create(), ss7_route_destroy(), ss7_xua_server_find2(), osmo_ss7_asp::trans_proto, and osmo_xua_server::trans_proto.

## ◆ osmo_sccp_simple_server_on_ss7_id()

struct osmo_sccp_instance * osmo_sccp_simple_server_on_ss7_id | ( | void * | ctx,
|  | uint32_t | ss7_id,
|  | uint32_t | pc,
|  | enum osmo_ss7_asp_protocol | prot,
|  | int | local_port,
|  | const char * | local_ip
| ) |  |

References osmo_ss7_instance::cfg, NULL, osmo_ss7_asp_protocol_port(), osmo_ss7_ensure_sccp(), osmo_ss7_instance_destroy(), osmo_ss7_instance_find_or_create(), pc, osmo_ss7_instance::primary_pc, osmo_ss7_instance::sccp, ss7_default_trans_proto_for_asp_proto(), ss7_xua_server_bind(), ss7_xua_server_create2(), ss7_xua_server_destroy(), and osmo_xua_server::trans_proto.

Referenced by osmo_sccp_simple_server().

## ◆ osmo_sccp_user_bind()

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)

Parameters

  [in] | inst | SCCP Instance
  [in] | name | human-readable name
  [in] | prim_cb | User provided callback to pass a primitive/msg up the stack
  [in] | ssn | Sub-System Number to bind to

Returns
  Callee-allocated SCCP User on success; negative otherwise

Ownership of oph->msg in prim_cb is transferred to the user of the registered callback when called.

References osmo_sccp_user::inst, osmo_sccp_user::name, OSMO_SS7_PC_INVALID, osmo_sccp_user::prim_cb, sccp_user_bind_pc(), and ssn.

Referenced by sccp_scmg_init().

## ◆ osmo_sccp_user_bind_pc()

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.

Parameters

  [in] | inst | SCCP Instance
  [in] | name | human-readable name
  [in] | prim_cb | User provided callback to pass a primitive/msg up the stack
  [in] | ssn | Sub-System Number to bind to
  [in] | pc | Point Code to bind to

Returns
  Callee-allocated SCCP User on success; negative otherwise

Ownership of oph->msg in prim_cb is transferred to the user of the registered callback when called.

References osmo_sccp_user::inst, osmo_sccp_user::name, pc, osmo_sccp_user::prim_cb, sccp_user_bind_pc(), and ssn.

## ◆ osmo_sccp_user_find()

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.

Parameters

  [in] | inst | SCCP Instance in which to search.
  [in] | ssn | Sub-System Number to search for.
  [in] | pc | Point Code to search for.

Returns
  Matching SCCP User; NULL if none found.

References osmo_sccp_user::inst, pc, sccp_user_find(), and ssn.

## ◆ osmo_static_assert()

osmo_static_assert | ( | ARRAY_SIZE(osmo_sccp_timer_defaults) | = `=(OSMO_SCCP_TIMERS_LEN) &&ARRAY_SIZE(osmo_sccp_timer_names)==(OSMO_SCCP_TIMERS_LEN)`,
|  | assert_osmo_sccp_timers_count |
| ) |  |

## ◆ rout_fail_pending_cb()

static void rout_fail_pending_cb | ( | void * | _inst | ) |
| static

References sccp_pending_rout_fail::cause, sccp_pending_rout_fail::list, osmo_sccp_instance::queue, osmo_sccp_instance::rout_fail_pending, sccp_sclc_rx_scrc_rout_fail(), sccp_scoc_rx_scrc_rout_fail(), sccp_pending_rout_fail::scoc, sccp_pending_rout_fail::xua, and xua_msg_free().

Referenced by osmo_sccp_instance_create().

## ◆ sccp_rout_fail_enqueue()

void sccp_rout_fail_enqueue | ( | struct osmo_sccp_instance * | inst,
|  | const struct xua_msg * | xua,
|  | uint32_t | cause,
|  | bool | scoc
| ) |  |

References sccp_pending_rout_fail::cause, sccp_pending_rout_fail::list, LOGPSCI, osmo_sccp_instance::queue, osmo_sccp_instance::rout_fail_pending, sccp_pending_rout_fail::scoc, osmo_sccp_instance::timer, sccp_pending_rout_fail::xua, xua_dialect_sua, xua_hdr_dump(), and xua_msg_copy().

Referenced by gen_mtp_transfer_req_xua(), scrc_node_2(), scrc_node_4(), scrc_node_6(), and scrc_translate_node_9().

## ◆ sccp_user_bind_pc()

static struct osmo_sccp_user * sccp_user_bind_pc | ( | struct osmo_sccp_instance * | inst,
|  | const char * | name,
|  | osmo_prim_cb | prim_cb,
|  | uint16_t | ssn,
|  | uint32_t | pc
| ) |  |
| static

Bind a SCCP User to a given Point Code.

Parameters

  [in] | inst | SCCP Instance
  [in] | name | human-readable name
  [in] | prim_cb | User provided callback to pass a primitive/msg up the stack
  [in] | ssn | Sub-System Number to bind to
  [in] | pc | Point Code to bind to, or OSMO_SS7_PC_INVALID if none.

Returns
  Callee-allocated SCCP User on success; negative otherwise

Ownership of oph->msg in prim_cb is transferred to the user of the registered callback when called.

References osmo_sccp_user::inst, LOGPSCI, osmo_sccp_user::name, NULL, osmo_ss7_pointcode_print(), pc, osmo_sccp_user::prim_cb, sccp_user_alloc(), sccp_user_find(), osmo_sccp_instance::ss7, and ssn.

Referenced by osmo_sccp_user_bind(), and osmo_sccp_user_bind_pc().

## ◆ sccp_user_find()

struct osmo_sccp_user * 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 such match was found, search all users with an invalid PC for an SSN-only match.

Parameters

  [in] | inst | SCCP Instance in which to search
  [in] | ssn | Sub-System Number to search for
  [in] | pc | Point Code to search for

Returns
  Matching SCCP User; NULL if none found

References osmo_sccp_user::inst, osmo_sccp_user::list, NULL, osmo_ss7_pc_is_valid(), osmo_sccp_user::pc, pc, osmo_sccp_user::ssn, ssn, and osmo_sccp_instance::users.

Referenced by DEFUN(), osmo_sccp_user_find(), sccp_find_user(), sccp_user_bind_pc(), sclc_rx_cldr(), sclc_rx_cldt(), scmg_rx_sst(), and scrc_node_6().

## Variable Documentation

## ◆ osmo_sccp_timer_defaults

const struct osmo_tdef osmo_sccp_timer_defaults[OSMO_SCCP_TIMERS_LEN]

Initial value:
= {
{ .T = OSMO_SCCP_TIMER_CONN_EST, .default_val = 1*60, .unit = OSMO_TDEF_S,
.desc = "Waiting for connection confirm message, 1 to 2 minutes" },
{ .T = OSMO_SCCP_TIMER_IAS, .default_val = 7*60, .unit = OSMO_TDEF_S,
.desc = "Send keep-alive: on an idle connection, delay before sending an Idle Timer message, 5 to 10 minutes" },
{ .T = OSMO_SCCP_TIMER_IAR, .default_val = 15*60, .unit = OSMO_TDEF_S,
.desc = "Receive keep-alive: on an idle connection, delay until considering a connection as stale, 11 to 21 minutes" },
{ .T = OSMO_SCCP_TIMER_REL, .default_val = 10, .unit = OSMO_TDEF_S,
.desc = "Waiting for release complete message, 10 to 20 seconds" },
{ .T = OSMO_SCCP_TIMER_REPEAT_REL, .default_val = 10, .unit = OSMO_TDEF_S,
.desc = "Waiting for release complete message; or to repeat sending released message after the initial expiry, 10 to 20 seconds" },
{ .T = OSMO_SCCP_TIMER_INT, .default_val = 1*60, .unit = OSMO_TDEF_S,
.desc = "Waiting for release complete message; or to release connection resources, freeze the LRN and "
"alert a maintenance function after the initial expiry, extending to 1 minute" },
{ .T = OSMO_SCCP_TIMER_GUARD, .default_val = 23*60, .unit = OSMO_TDEF_S,
.desc = "Waiting to resume normal procedure for temporary connection sections during the restart procedure, 23 to 25 minutes" },
{ .T = OSMO_SCCP_TIMER_RESET, .default_val = 10, .unit = OSMO_TDEF_S,
.desc = "Waiting to release temporary connection section or alert maintenance function after reset request message is sent, 10 to 20 seconds" },
{ .T = OSMO_SCCP_TIMER_REASSEMBLY, .default_val = 10, .unit = OSMO_TDEF_S,
.desc = "Waiting to receive all the segments of the remaining segments, single segmented message after receiving the first segment, 10 to 20 seconds" },
{}
}
OSMO_SCCP_TIMER_REPEAT_REL
@ OSMO_SCCP_TIMER_REPEAT_REL
Definition: sccp_instance.h:23
OSMO_SCCP_TIMER_INT
@ OSMO_SCCP_TIMER_INT
Definition: sccp_instance.h:24
OSMO_SCCP_TIMER_GUARD
@ OSMO_SCCP_TIMER_GUARD
Definition: sccp_instance.h:25
OSMO_SCCP_TIMER_REASSEMBLY
@ OSMO_SCCP_TIMER_REASSEMBLY
Definition: sccp_instance.h:27
OSMO_SCCP_TIMER_REL
@ OSMO_SCCP_TIMER_REL
Definition: sccp_instance.h:22
OSMO_SCCP_TIMER_IAS
@ OSMO_SCCP_TIMER_IAS
Definition: sccp_instance.h:20
OSMO_SCCP_TIMER_CONN_EST
@ OSMO_SCCP_TIMER_CONN_EST
Definition: sccp_instance.h:19
OSMO_SCCP_TIMER_RESET
@ OSMO_SCCP_TIMER_RESET
Definition: sccp_instance.h:26
OSMO_SCCP_TIMER_IAR
@ OSMO_SCCP_TIMER_IAR
Definition: sccp_instance.h:21

Referenced by gen_sccp_timer_cmd_strs(), and osmo_sccp_instance_create().

## ◆ osmo_sccp_timer_names

const struct value_string osmo_sccp_timer_names[]

Initial value:
= {
{ OSMO_SCCP_TIMER_CONN_EST, "conn_est" },
{ OSMO_SCCP_TIMER_IAS, "ias" },
{ OSMO_SCCP_TIMER_IAR, "iar" },
{ OSMO_SCCP_TIMER_REL, "rel" },
{ OSMO_SCCP_TIMER_REPEAT_REL, "repeat_rel" },
{ OSMO_SCCP_TIMER_INT, "int" },
{ OSMO_SCCP_TIMER_GUARD, "guard" },
{ OSMO_SCCP_TIMER_RESET, "reset" },
{ OSMO_SCCP_TIMER_REASSEMBLY, "reassembly" },
{}
}

Referenced by DEFUN_ATTR(), gen_sccp_timer_cmd_strs(), osmo_sccp_timer_name(), and write_sccp_timers().