libosmo-sigtran 2.2.1.4-74d0 Osmocom SIGTRAN library

Functions | Variables
ss7_instance.c File Reference
`#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"`
`#include "sccp_internal.h"`

## Functions
| osmo_static_assert (ARRAY_SIZE(ss7_instance_xua_timer_defaults)==(SS7_INST_XUA_TIMERS_LEN) &&ARRAY_SIZE(ss7_instance_xua_timer_names)==(SS7_INST_XUA_TIMERS_LEN), assert_ss7_instance_xua_timer_count)
static void | t8_inaccessible_sp_timer_cb (void *_inst)
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)
uint8_t | osmo_ss7_instance_get_network_indicator (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_route * | ss7_instance_lookup_route (struct osmo_ss7_instance *inst, const struct osmo_ss7_route_label *rtlabel)
| Find a SS7 route for given destination point code in given SS7. More...
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)
| LLIST_HEAD (sccp_address_book_global)
static struct osmo_sccp_addr_entry * | addr_entry_alloc (struct osmo_ss7_instance *inst, const char *name, const struct osmo_sccp_addr *addr)
int | osmo_sccp_addr_create (struct osmo_ss7_instance *inst, const char *name, const struct osmo_sccp_addr *dest_addr)
| Add an SCCP address entry to the addressbook. More...
int | osmo_sccp_addr_update (struct osmo_ss7_instance *inst, const char *name, const struct osmo_sccp_addr *dest_addr)
| Update the value of an SCCP address entry already present in the addressbook. More...
struct osmo_sccp_addr_entry * | addr_entry_by_name_local (const char *name, const struct osmo_ss7_instance *inst)
struct osmo_sccp_addr_entry * | addr_entry_by_name_global (const char *name)
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...
bool | ss7_instance_t8_inaccessible_sp_running (const struct osmo_ss7_instance *inst, uint32_t dpc)
void | ss7_instance_t8_inaccessible_sp_start (struct osmo_ss7_instance *inst, uint32_t dpc)

## 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 const struct rate_ctr_desc | ss7_inst_rcd []
static const struct rate_ctr_group_desc | ss7_inst_rcgd
const struct osmo_tdef | ss7_instance_xua_timer_defaults [SS7_INST_XUA_TIMERS_LEN]
const struct value_string | ss7_instance_xua_timer_names []

## Function Documentation

## ◆ addr_entry_alloc()

static struct osmo_sccp_addr_entry * addr_entry_alloc | ( | struct osmo_ss7_instance * | inst,
|  | const char * | name,
|  | const struct osmo_sccp_addr * | addr
| ) |  |
| static

References osmo_sccp_addr_entry::addr, osmo_ss7_instance::cfg, osmo_sccp_addr_entry::inst, osmo_sccp_addr_entry::list, osmo_sccp_addr_entry::list_global, osmo_sccp_addr_entry::name, osmo_ss7_instance::sccp_address_book, and sccp_address_book_global.

Referenced by osmo_sccp_addr_create().

## ◆ addr_entry_by_name_global()

struct osmo_sccp_addr_entry * addr_entry_by_name_global | ( | const char * | name | ) |

References osmo_sccp_addr_entry::list_global, osmo_sccp_addr_entry::name, NULL, and sccp_address_book_global.

Referenced by osmo_sccp_addr_by_name(), and osmo_sccp_addr_create().

## ◆ addr_entry_by_name_local()

struct osmo_sccp_addr_entry * addr_entry_by_name_local | ( | const char * | name,
|  | const struct osmo_ss7_instance * | inst
| ) |  |

References osmo_ss7_instance::cfg, osmo_sccp_addr_entry::inst, osmo_sccp_addr_entry::list, osmo_sccp_addr_entry::name, NULL, and osmo_ss7_instance::sccp_address_book.

Referenced by DEFUN_ATTR(), osmo_sccp_addr_by_name_local(), and osmo_sccp_addr_update().

## ◆ gen_pc_fmtstr()

static const char * gen_pc_fmtstr | ( | const struct osmo_ss7_pc_fmt * | pc_fmt,
|  | unsigned int * | num_comp_exp
| ) |  |
| 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().

## ◆ get_pc_comp_shift()

static unsigned int get_pc_comp_shift | ( | const struct osmo_ss7_pc_fmt * | pc_fmt,
|  | unsigned int | comp_num
| ) |  |
| 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().

## ◆ LLIST_HEAD()

LLIST_HEAD | ( | sccp_address_book_global |  | ) |

## ◆ num_pc_comp_exp()

static unsigned int num_pc_comp_exp | ( | const struct osmo_ss7_pc_fmt * | pc_fmt | ) |
| static

References osmo_ss7_pc_fmt::component_len.

Referenced by osmo_ss7_pointcode_parse(), and osmo_ss7_pointcode_print_buf().

## ◆ osmo_sccp_addr_by_name()

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.

Parameters

  [out] | dest_addr | pointer to output the resulting sccp-address; (set to NULL if not interested)
  [in] | name | of the address to lookup

Returns
  SS7 instance; NULL on error

References osmo_sccp_addr_entry::addr, addr_entry_by_name_global(), osmo_sccp_addr_entry::inst, osmo_sccp_addr_entry::name, and NULL.

## ◆ osmo_sccp_addr_by_name_local()

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.

Parameters

  [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

Returns
  0 on success; <0 on error

References osmo_sccp_addr_entry::addr, addr_entry_by_name_local(), osmo_sccp_addr_entry::inst, and osmo_sccp_addr_entry::name.

## ◆ osmo_sccp_addr_create()

int osmo_sccp_addr_create | ( | struct osmo_ss7_instance * | inst,
|  | const char * | name,
|  | const struct osmo_sccp_addr * | dest_addr
| ) |  |

Add an SCCP address entry to the addressbook.

Parameters

  | [int] | inst cs7 instance where this address belongs
  [in] | name | of the address to create
  [in] | dest_addr | address value to add to the addressbook.

Returns
  0 on success, negative error code on error.

Validates that the name is unique among all cs7 instances of the process, and that no such entry already exists.

References addr_entry_alloc(), addr_entry_by_name_global(), osmo_ss7_instance::cfg, osmo_ss7_instance::id, osmo_sccp_addr_entry::inst, LOGSS7, and osmo_sccp_addr_entry::name.

Referenced by DEFUN_ATTR().

## ◆ osmo_sccp_addr_update()

int osmo_sccp_addr_update | ( | struct osmo_ss7_instance * | inst,
|  | const char * | name,
|  | const struct osmo_sccp_addr * | dest_addr
| ) |  |

Update the value of an SCCP address entry already present in the addressbook.

Parameters

  | [int] | inst cs7 instance where this address belongs
  [in] | name | of the address to update
  [in] | dest_addr | address value to store in the addressbook.

Returns
  0 on success, negative error code on error.

References osmo_sccp_addr_entry::addr, addr_entry_by_name_local(), osmo_ss7_instance::cfg, osmo_ss7_instance::id, osmo_sccp_addr_entry::inst, LOGSS7, and osmo_sccp_addr_entry::name.

## ◆ osmo_sccp_name_by_addr()

const char * osmo_sccp_name_by_addr | ( | const struct osmo_sccp_addr * | addr | ) |

Reverse lookup the lookup-name of a specified SCCP address.

Parameters

  [in] | name | of the address to lookup

Returns
  char pointer to the lookup-name; NULL on error

References osmo_sccp_addr_entry::addr, osmo_sccp_addr_entry::list_global, osmo_sccp_addr_entry::name, NULL, and sccp_address_book_global.

## ◆ osmo_ss7_as_find_by_l_rk_id()

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.

Parameters

  [in] | inst | SS7 Instance on which we operate
  [in] | l_rk_id | Local Routing Key ID

Returns
  pointer to Application Server on success; NULL otherwise

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, NULL, osmo_ss7_as::routing_key, and ss7_initialized.

Referenced by handle_reg_conf(), and ss7_find_free_l_rk_id().

## ◆ osmo_ss7_as_find_by_name()

struct osmo_ss7_as * osmo_ss7_as_find_by_name | ( | struct osmo_ss7_instance * | inst,
|  | const char * | name
| ) |  |

Find Application Server by given name.

Parameters

  [in] | inst | SS7 Instance on which we operate
  [in] | name | Name of AS

Returns
  pointer to Application Server on success; NULL otherwise

References osmo_ss7_instance::as_list, osmo_ss7_as::cfg, osmo_ss7_as::inst, osmo_ss7_as::list, osmo_ss7_as::name, NULL, and ss7_initialized.

Referenced by DEFUN(), DEFUN_ATTR(), ipa_asp_fsm_wait_id_resp(), osmo_ss7_as_find_or_create(), show_as(), and ss7_route_set_linkset().

## ◆ osmo_ss7_as_find_by_proto()

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.

Parameters

  [in] | inst | SS7 Instance on which we operate
  [in] | proto | Protocol identifier that must match

Returns
  pointer to AS on success; NULL otherwise If an AS has an ASP also matching the given protocol, that AS is preferred. If there are multiple matches, return the first matching AS.

References osmo_ss7_instance::as_list, osmo_ss7_as::cfg, osmo_ss7_as::inst, osmo_ss7_as::list, NULL, osmo_ss7_asp_find_by_proto(), osmo_ss7_as::proto, and ss7_initialized.

Referenced by osmo_sccp_simple_client_on_ss7_id().

## ◆ osmo_ss7_as_find_by_rctx()

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.

Parameters

  [in] | inst | SS7 Instance on which we operate
  [in] | rctx | Routing Context

Returns
  pointer to Application Server on success; NULL otherwise

References osmo_ss7_instance::as_list, osmo_ss7_as::cfg, osmo_ss7_routing_key::context, osmo_ss7_as::inst, osmo_ss7_as::list, NULL, 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().

## ◆ osmo_ss7_as_find_or_create()

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.

Parameters

  [in] | inst | SS7 Instance on which we operate
  [in] | name | Name of Application Server
  [in] | proto | Protocol of Application Server

Returns
  pointer to Application Server on success; NULL otherwise

References osmo_ss7_as::cfg, osmo_ss7_as::inst, LOGPAS, osmo_ss7_as::name, NULL, 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().

## ◆ osmo_ss7_asp_find()

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

References osmo_ss7_asp::inst, osmo_ss7_asp::name, osmo_ss7_asp_find2(), osmo_ss7_asp::proto, ss7_default_trans_proto_for_asp_proto(), and osmo_ss7_asp::trans_proto.

## ◆ osmo_ss7_asp_find2()

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

References osmo_ss7_asp::cfg, osmo_ss7_asp::inst, osmo_ss7_asp::local, osmo_ss7_asp::name, NULL, osmo_ss7_asp_find_by_name(), osmo_ss7_asp_peer::port, osmo_ss7_asp::proto, osmo_ss7_asp::remote, ss7_initialized, and osmo_ss7_asp::trans_proto.

Referenced by DEFUN_ATTR(), and osmo_ss7_asp_find().

## ◆ osmo_ss7_asp_find_by_name()

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

## ◆ osmo_ss7_asp_find_by_proto()

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

Parameters

  [in] | as | Application Server in which to look for asp
  [in] | proto | ASP protocol (xUA variant) to match

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

References osmo_ss7_as::asps, osmo_ss7_as::cfg, osmo_ss7_asp::cfg, NULL, and osmo_ss7_asp::proto.

Referenced by osmo_sccp_simple_client_on_ss7_id(), and osmo_ss7_as_find_by_proto().

## ◆ osmo_ss7_asp_find_or_create()

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

References osmo_ss7_asp::inst, osmo_ss7_asp::name, osmo_ss7_asp_find_or_create2(), osmo_ss7_asp::proto, ss7_default_trans_proto_for_asp_proto(), and osmo_ss7_asp::trans_proto.

## ◆ osmo_ss7_asp_find_or_create2()

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

## ◆ osmo_ss7_ensure_sccp()

struct osmo_sccp_instance * osmo_ss7_ensure_sccp | ( | struct osmo_ss7_instance * | inst | ) |

Allocate an SCCP instance, if not present yet.

Returns
  inst->sccp.

References LOGSS7, NULL, 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().

## ◆ osmo_ss7_find_free_rctx()

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

## ◆ osmo_ss7_get_sccp()

struct osmo_sccp_instance * osmo_ss7_get_sccp | ( | const struct osmo_ss7_instance * | inst | ) |

Get the SCCP instance, if present.

Parameters

  [in] | inst | SS7 Instance on which we operate

Returns
  inst->sccp, may be NULL if no SCCP instance was created yet (see osmo_ss7_ensure_sccp()).

References osmo_ss7_instance::sccp.

## ◆ osmo_ss7_instance_destroy()

void osmo_ss7_instance_destroy | ( | struct osmo_ss7_instance * | inst | ) |

Destroy a SS7 Instance.

Parameters

  [in] | inst | SS7 Instance to be destroyed

References osmo_ss7_instance::as_list, osmo_ss7_instance::asp_list, osmo_ss7_instance::ctrg, 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, ss7_linkset_destroy(), osmo_ss7_instance::t8_inaccessible_sp, and osmo_ss7_instance::timer.

Referenced by osmo_sccp_simple_client_on_ss7_id(), and osmo_sccp_simple_server_on_ss7_id().

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

## ◆ osmo_ss7_instance_get_name()

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.

## ◆ osmo_ss7_instance_get_network_indicator()

uint8_t osmo_ss7_instance_get_network_indicator | ( | const struct osmo_ss7_instance * | inst | ) |

References osmo_ss7_instance::cfg, osmo_ss7_asp::inst, and osmo_ss7_instance::network_indicator.

## ◆ osmo_ss7_instance_get_pc_fmt()

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.

## ◆ osmo_ss7_instance_get_primary_pc()

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.

## ◆ osmo_ss7_instance_set_pc_fmt()

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.

## ◆ osmo_ss7_pc_is_local()

bool osmo_ss7_pc_is_local | ( | const struct osmo_ss7_instance * | inst,
|  | uint32_t | pc
| ) |  |

References osmo_ss7_instance::cfg, osmo_ss7_pc_is_valid(), pc, osmo_ss7_instance::primary_pc, osmo_ss7_instance::secondary_pc, and ss7_initialized.

Referenced by as_snm_pc_available(), as_snm_pc_unavailable(), dpc_accessible(), mtp3_hmdc_rx_from_l2(), mtp3_rtpc_rx_msg_for_inaccessible_sp(), sccp_sclc_rx_scrc_rout_fail(), scrc_local_out_common(), scrc_translate_node_9(), ss7_vty_node_as_go_parent(), and xua_asp_tx_snm_daud_address_book().

## ◆ osmo_ss7_pointcode_parse()

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, err, gen_pc_fmtstr(), get_pc_comp_shift(), LOGSS7, num_pc_comp_exp(), and osmo_ss7_instance::pc_fmt.

Referenced by _rout_key(), DEFUN(), DEFUN_ATTR(), and osmo_ss7_pointcode_parse_mask_or_len().

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

## ◆ osmo_ss7_pointcode_print()

const char * osmo_ss7_pointcode_print | ( | const struct osmo_ss7_instance * | inst,
|  | uint32_t | pc
| ) |  |

References MAX_PC_STR_LEN, osmo_ss7_pointcode_print_buf(), and pc.

Referenced by as_snm_pc_available(), as_snm_pc_unavailable(), DEFUN(), format_affected_pcs_c(), handle_rkey_dereg(), handle_rkey_reg(), m3ua_rx_xfer(), mtp3_hmdc_rx_from_l2(), mtp3_hmrt_message_for_routing(), osmo_sccp_simple_client_on_ss7_id(), sccp_user_bind_pc(), scrc_node_6(), show_one_as(), show_one_tcap_range(), show_user(), ss7_as_select_asp_loadshare(), ss7_vty_write_one_as(), vty_show_connection(), write_one_cs7(), write_one_rtable(), write_sccp_addressbook(), xua_snm_rx_dupu(), and xua_snm_srm_pc_available_single().

## ◆ osmo_ss7_pointcode_print2()

const char * osmo_ss7_pointcode_print2 | ( | const struct osmo_ss7_instance * | inst,
|  | uint32_t | pc
| ) |  |

References MAX_PC_STR_LEN, osmo_ss7_pointcode_print_buf(), and pc.

Referenced by DEFUN(), m3ua_rx_xfer(), write_one_rtable(), and xua_asp_tx_snm_daud_address_book().

## ◆ osmo_ss7_pointcode_print_buf()

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, pc_comp_shift_and_mask(), and osmo_ss7_instance::pc_fmt.

Referenced by dpc_accessible(), mtp3_rtpc_rx_msg_for_inaccessible_sp(), osmo_ss7_pointcode_print(), osmo_ss7_pointcode_print2(), osmo_ss7_route_name(), osmo_ss7_route_print(), sccp_addr_to_str_buf(), sccp_scoc_rx_inval_opc(), ss7_instance_t8_inaccessible_sp_start(), ss7_route_label_to_str(), t8_inaccessible_sp_timer_cb(), tcap_trans_track_entry_create(), and tx_daud_pc().

## ◆ osmo_static_assert()

osmo_static_assert | ( | ARRAY_SIZE(ss7_instance_xua_timer_defaults) | = `=(SS7_INST_XUA_TIMERS_LEN) &&ARRAY_SIZE(ss7_instance_xua_timer_names)==(SS7_INST_XUA_TIMERS_LEN)`,
|  | assert_ss7_instance_xua_timer_count |
| ) |  |

## ◆ pc_comp_shift_and_mask()

static uint32_t pc_comp_shift_and_mask | ( | const struct osmo_ss7_pc_fmt * | pc_fmt,
|  | unsigned int | comp_num,
|  | uint32_t | pc
| ) |  |
| static

References osmo_ss7_pc_fmt::component_len, get_pc_comp_shift(), and pc.

Referenced by osmo_ss7_pointcode_print_buf().

## ◆ ss7_find_free_l_rk_id()

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

## ◆ ss7_instance_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_instance::ctrg, osmo_ss7_pc_fmt::delimiter, osmo_ss7_instance::id, osmo_ss7_instance::linksets, osmo_ss7_instance::list, LOGSS7, NULL, 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_inst_rcgd, ss7_instance_xua_timer_defaults, ss7_route_table_find_or_create(), osmo_ss7_instance::t8_inaccessible_sp, t8_inaccessible_sp_timer_cb(), osmo_ss7_instance::T_defs_xua, osmo_ss7_instance::timer, and osmo_ss7_instance::xua_servers.

Referenced by osmo_ss7_instance_find_or_create().

## ◆ ss7_instance_lookup_route()

struct osmo_ss7_route * ss7_instance_lookup_route | ( | struct osmo_ss7_instance * | inst,
|  | const struct osmo_ss7_route_label * | rtlabel
| ) |  |

Find a SS7 route for given destination point code in given SS7.

References osmo_ss7_instance::rtable_system, ss7_initialized, and ss7_route_table_lookup_route().

Referenced by DEFUN(), gen_mtp_transfer_req_xua(), mtp3_hmrt_message_for_routing(), mtp3_rtpc_rx_msg_for_inaccessible_sp(), and osmo_ss7_route_lookup().

## ◆ ss7_instance_t8_inaccessible_sp_running()

bool ss7_instance_t8_inaccessible_sp_running | ( | const struct osmo_ss7_instance * | inst,
|  | uint32_t | dpc
| ) |  |

References dpc, t8_inaccessible_sp_entry::dpc, t8_inaccessible_sp_entry::entry, osmo_ss7_instance::list, and osmo_ss7_instance::t8_inaccessible_sp.

Referenced by mtp3_rtpc_rx_msg_for_inaccessible_sp(), and ss7_instance_t8_inaccessible_sp_start().

## ◆ ss7_instance_t8_inaccessible_sp_start()

void ss7_instance_t8_inaccessible_sp_start | ( | struct osmo_ss7_instance * | inst,
|  | uint32_t | dpc
| ) |  |

References osmo_ss7_instance::cfg, dpc, t8_inaccessible_sp_entry::dpc, t8_inaccessible_sp_entry::entry, osmo_ss7_instance::list, LOGSS7, MAX_PC_STR_LEN, osmo_ss7_pointcode_print_buf(), SS7_INST_XUA_T8, ss7_instance_t8_inaccessible_sp_running(), osmo_ss7_instance::t8_inaccessible_sp, osmo_ss7_instance::T_defs_xua, osmo_ss7_instance::timer, and t8_inaccessible_sp_entry::ts_started.

Referenced by mtp3_rtpc_rx_msg_for_inaccessible_sp().

## ◆ strnappendchar()

static int strnappendchar | ( | char * | str,
|  | char | c,
|  | size_t | n
| ) |  |
| static

Referenced by gen_pc_fmtstr().

## ◆ t8_inaccessible_sp_timer_cb()

static void t8_inaccessible_sp_timer_cb | ( | void * | _inst | ) |
| static

References osmo_ss7_instance::cfg, t8_inaccessible_sp_entry::dpc, t8_inaccessible_sp_entry::entry, osmo_ss7_instance::list, LOGSS7, MAX_PC_STR_LEN, osmo_ss7_pointcode_print_buf(), SS7_INST_XUA_T8, osmo_ss7_instance::t8_inaccessible_sp, osmo_ss7_instance::T_defs_xua, osmo_ss7_instance::timer, and t8_inaccessible_sp_entry::ts_started.

Referenced by ss7_instance_alloc().

## Variable Documentation

## ◆ default_pc_fmt

const struct osmo_ss7_pc_fmt default_pc_fmt
| static

Initial value:
= {
.delimiter = '.',
.component_len = { 3, 8, 3},
}

Referenced by osmo_ss7_pointcode_parse(), osmo_ss7_pointcode_parse_mask_or_len(), and osmo_ss7_pointcode_print_buf().

## ◆ next_l_rk_id

int32_t next_l_rk_id = 1
| static

Referenced by ss7_find_free_l_rk_id().

## ◆ next_rctx

int32_t next_rctx = 1
| static

Referenced by osmo_ss7_find_free_rctx().

## ◆ ss7_inst_rcd

const struct rate_ctr_desc ss7_inst_rcd[]
| static

Initial value:
= {
[SS7_INST_CTR_PKT_RX_TOTAL] = { "rx:packets:total", "Total number of packets received" },
[SS7_INST_CTR_PKT_RX_UNKNOWN] = { "rx:packets:unknown", "Number of packets received for unknown PPID" },
[SS7_INST_CTR_PKT_RX_NI_MISMATCH] = { "rx:packets:ni_mismatch", "Number of packets received and dropped due to Network Indicator mismatch" },
[SS7_INST_CTR_PKT_TX_TOTAL] = { "tx:packets:total", "Total number of packets transmitted" },
}
SS7_INST_CTR_PKT_RX_NI_MISMATCH
@ SS7_INST_CTR_PKT_RX_NI_MISMATCH
Definition: ss7_instance.h:36
SS7_INST_CTR_PKT_RX_TOTAL
@ SS7_INST_CTR_PKT_RX_TOTAL
Definition: ss7_instance.h:34
SS7_INST_CTR_PKT_RX_UNKNOWN
@ SS7_INST_CTR_PKT_RX_UNKNOWN
Definition: ss7_instance.h:35
SS7_INST_CTR_PKT_TX_TOTAL
@ SS7_INST_CTR_PKT_TX_TOTAL
Definition: ss7_instance.h:37

## ◆ ss7_inst_rcgd

const struct rate_ctr_group_desc ss7_inst_rcgd
| static

Initial value:
= {
.group_name_prefix = "s7i",
.group_description = "SS7 Instance",
.num_ctr = ARRAY_SIZE(ss7_inst_rcd),
.ctr_desc = ss7_inst_rcd,
}
ss7_inst_rcd
static const struct rate_ctr_desc ss7_inst_rcd[]
Definition: ss7_instance.c:52

Referenced by ss7_instance_alloc().

## ◆ ss7_instance_xua_timer_defaults

const struct osmo_tdef ss7_instance_xua_timer_defaults[SS7_INST_XUA_TIMERS_LEN]

Initial value:
= {
{ .T = SS7_INST_XUA_T8, .default_val = SS7_INST_XUA_DEFAULT_T8_MSEC, .unit = OSMO_TDEF_MS,
.desc = "T8 - Transfer prohibited inhibition timer (transient solution) (ms)",
.min_val = 800, .max_val = 1200},
{}
}
SS7_INST_XUA_DEFAULT_T8_MSEC
#define SS7_INST_XUA_DEFAULT_T8_MSEC
Definition: ss7_instance.h:31
SS7_INST_XUA_T8
@ SS7_INST_XUA_T8
Definition: ss7_instance.h:24

Referenced by gen_cs7_timer_xua_cmd_strs(), and ss7_instance_alloc().

## ◆ ss7_instance_xua_timer_names

const struct value_string ss7_instance_xua_timer_names[]

Initial value:
= {
{ SS7_INST_XUA_T8, "T8" },
{}
}

Referenced by DEFUN_ATTR(), gen_cs7_timer_xua_cmd_strs(), and write_cs7_timers_xua().