libosmo-sigtran 2.1.0.165-6ea6 Osmocom SIGTRAN library

Macros | Functions | Variables
ss7_as.c File Reference
`#include <string.h>`
`#include <errno.h>`
`#include <unistd.h>`
`#include <inttypes.h>`
`#include <osmocom/core/linuxlist.h>`
`#include <osmocom/core/utils.h>`
`#include <osmocom/core/talloc.h>`
`#include <osmocom/core/logging.h>`
`#include <osmocom/sigtran/osmo_ss7.h>`
`#include <osmocom/sigtran/protocol/m3ua.h>`
`#include <osmocom/sigtran/mtp_sap.h>`
`#include "ss7_as.h"`
`#include "ss7_asp.h"`
`#include "ss7_route.h"`
`#include "ss7_route_table.h"`
`#include "ss7_internal.h"`
`#include "xua_as_fsm.h"`
`#include "xua_asp_fsm.h"`

## Macros
#define | SS7_AS_CTR_RX_MSU_SLS_STR "Number of MSU received on SLS "
#define | SS7_AS_CTR_TX_MSU_SLS_STR "Number of MSU transmitted on SLS "

## Functions
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. More...
enum osmo_ss7_asp_protocol | osmo_ss7_as_get_asp_protocol (const struct osmo_ss7_as *as)
| Get asp_protocol configuration of a given AS. More...
int | ss7_as_add_asp (struct osmo_ss7_as *as, struct osmo_ss7_asp *asp)
| Add given ASP to given AS. More...
int | osmo_ss7_as_add_asp (struct osmo_ss7_as *as, const char *asp_name)
| Add given ASP to given AS. More...
int | osmo_ss7_as_del_asp (struct osmo_ss7_as *as, const char *asp_name)
| Delete given ASP from given AS. More...
void | osmo_ss7_as_destroy (struct osmo_ss7_as *as)
| Destroy given Application Server. More...
bool | osmo_ss7_as_has_asp (const struct osmo_ss7_as *as, const struct osmo_ss7_asp *asp)
| Determine if given AS contains ASP. More...
unsigned int | osmo_ss7_as_count_asp (const struct osmo_ss7_as *as)
| Determine amount of ASPs associated to an AS. More...
int | ss7_as_get_local_role (const struct osmo_ss7_as *as)
bool | osmo_ss7_as_active (const struct osmo_ss7_as *as)
| Determine if given AS is in the active state. More...
bool | osmo_ss7_as_down (const struct osmo_ss7_as *as)
| Determine if given AS is in the down state. More...
static struct osmo_ss7_asp * | ss7_as_select_asp_override (struct osmo_ss7_as *as)
static struct osmo_ss7_asp * | ss7_as_assign_asp_roundrobin (struct osmo_ss7_as *as)
static struct osmo_ss7_asp * | ss7_as_select_asp_roundrobin (struct osmo_ss7_as *as)
void | ss7_as_loadshare_binding_table_reset (struct osmo_ss7_as *as)
static as_ext_sls_t | osmo_ss7_instance_calc_itu_as_ext_sls (const struct osmo_ss7_as *as, uint32_t opc, uint8_t sls)
static struct osmo_ss7_asp * | current_asp (const struct osmo_ss7_as *as, const struct osmo_ss7_as_esls_entry *aeslse)
static struct osmo_ss7_asp * | ss7_as_select_asp_loadshare (struct osmo_ss7_as *as, const struct osmo_mtp_transfer_param *mtp)
static struct osmo_ss7_asp * | ss7_as_select_asp_broadcast (struct osmo_ss7_as *as)
struct osmo_ss7_asp * | ss7_as_select_asp (struct osmo_ss7_as *as, const struct osmo_mtp_transfer_param *mtp)
| Select an AS to transmit a message, according to AS configuration and ASP availability. More...
struct osmo_ss7_asp * | osmo_ss7_as_select_asp (struct osmo_ss7_as *as)
| Select an AS to transmit a message, according to AS configuration and ASP availability. More...
bool | osmo_ss7_as_tmode_compatible_xua (struct osmo_ss7_as *as, uint32_t m3ua_tmt)

## Variables
struct value_string | osmo_ss7_as_traffic_mode_vals []
static const struct rate_ctr_desc | ss7_as_rcd []
static const struct rate_ctr_group_desc | ss7_as_rcgd
static unsigned int | g_ss7_as_rcg_idx

## Macro Definition Documentation

## ◆ SS7_AS_CTR_RX_MSU_SLS_STR

#define SS7_AS_CTR_RX_MSU_SLS_STR "Number of MSU received on SLS "

## ◆ SS7_AS_CTR_TX_MSU_SLS_STR

#define SS7_AS_CTR_TX_MSU_SLS_STR "Number of MSU transmitted on SLS "

## Function Documentation

## ◆ current_asp()

static struct osmo_ss7_asp * current_asp | ( | const struct osmo_ss7_as * | as,
|  | const struct osmo_ss7_as_esls_entry * | aeslse
| ) |  |
| static

References osmo_ss7_as_esls_entry::alt_asp, osmo_ss7_as_esls_entry::normal_asp, NULL, and osmo_ss7_asp_active().

Referenced by ss7_as_select_asp_loadshare().

## ◆ osmo_ss7_as_active()

bool osmo_ss7_as_active | ( | const struct osmo_ss7_as * | as | ) |

Determine if given AS is in the active state.

Parameters

  [in] | as | Application Server.

Returns
  true in case as is active; false otherwise.

References osmo_ss7_as::fi, and XUA_AS_S_ACTIVE.

Referenced by m3ua_rx_xfer(), show_as(), and ss7_route_dest_is_available().

## ◆ osmo_ss7_as_add_asp()

int osmo_ss7_as_add_asp | ( | struct osmo_ss7_as * | as,
|  | const char * | asp_name
| ) |  |

Add given ASP to given AS.

Parameters

  [in] | as | Application Server to which asp is added
  [in] | asp_name | Name of Application Server Process to be added to as

Returns
  0 on success; negative in case of error

References osmo_ss7_as::inst, osmo_ss7_asp_find_by_name(), ss7_as_add_asp(), and ss7_initialized.

Referenced by DEFUN_ATTR().

## ◆ osmo_ss7_as_count_asp()

unsigned int osmo_ss7_as_count_asp | ( | const struct osmo_ss7_as * | as | ) |

Determine amount of ASPs associated to an AS.

Parameters

  [in] | as | Application Server.

Returns
  number of ASPs associated to as

References osmo_ss7_as::asps, and osmo_ss7_as::cfg.

Referenced by xua_rkm_cleanup_dyn_as_for_asp().

## ◆ osmo_ss7_as_del_asp()

int osmo_ss7_as_del_asp | ( | struct osmo_ss7_as * | as,
|  | const char * | asp_name
| ) |  |

Delete given ASP from given AS.

Parameters

  [in] | as | Application Server from which asp is deleted
  [in] | asp | Application Server Process to delete from as

Returns
  0 on success; negative in case of error

References osmo_ss7_as::aesls_table, osmo_ss7_as_esls_entry::alt_asp, osmo_ss7_as::asps, osmo_ss7_as::cfg, osmo_ss7_asp::cfg, osmo_ss7_as::inst, LOGPAS, osmo_ss7_asp::name, osmo_ss7_as_esls_entry::normal_asp, NULL, osmo_ss7_asp_find_by_name(), and ss7_initialized.

Referenced by DEFUN_ATTR(), and handle_rkey_dereg().

## ◆ osmo_ss7_as_destroy()

void osmo_ss7_as_destroy | ( | struct osmo_ss7_as * | as | ) |

Destroy given Application Server.

Parameters

  [in] | as | Application Server to destroy

References osmo_ss7_as::ctrg, osmo_ss7_as::fi, osmo_ss7_as::inst, osmo_ss7_as::list, LOGPAS, NULL, osmo_ss7_instance::rtable_system, ss7_initialized, and ss7_route_table_del_routes_by_as().

Referenced by DEFUN_ATTR(), handle_rkey_dereg(), handle_rkey_reg(), osmo_sccp_simple_client_on_ss7_id(), osmo_sccp_simple_server_add_clnt(), osmo_ss7_instance_destroy(), and xua_rkm_cleanup_dyn_as_for_asp().

## ◆ osmo_ss7_as_down()

bool osmo_ss7_as_down | ( | const struct osmo_ss7_as * | as | ) |

Determine if given AS is in the down state.

Parameters

  [in] | as | Application Server.

Returns
  true in case as is down; false otherwise.

References osmo_ss7_as::fi, and XUA_AS_S_DOWN.

## ◆ osmo_ss7_as_get_asp_protocol()

enum osmo_ss7_asp_protocol osmo_ss7_as_get_asp_protocol | ( | const struct osmo_ss7_as * | as | ) |

Get asp_protocol configuration of a given AS.

Parameters

  [in] | as | Application Server in which to look for asp_protocol

Returns
  The asp_protocol this AS is configured with

References osmo_ss7_as::cfg, and osmo_ss7_as::proto.

## ◆ osmo_ss7_as_has_asp()

bool osmo_ss7_as_has_asp | ( | const struct osmo_ss7_as * | as,
|  | const struct osmo_ss7_asp * | asp
| ) |  |

Determine if given AS contains ASP.

Parameters

  [in] | as | Application Server in which to look for asp
  [in] | asp | Application Server Process to look for in as

Returns
  true in case asp is part of as; false otherwise

References osmo_ss7_as::asps, osmo_ss7_as::cfg, and ss7_initialized.

Referenced by _ss7_asp_get_all_rctx(), as_list_for_asp(), asp_serves_some_as(), dispatch_to_all_as(), find_single_as_for_asp(), handle_rkey_dereg(), ipa_find_as_for_asp(), ss7_as_add_asp(), ss7_asp_determine_traf_mode(), xua_asp_fsm_inactive(), xua_find_as_for_asp(), xua_rkm_cleanup_dyn_as_for_asp(), and xua_snm_pc_available().

## ◆ osmo_ss7_as_select_asp()

struct osmo_ss7_asp * osmo_ss7_as_select_asp | ( | struct osmo_ss7_as * | as | ) |

Select an AS to transmit a message, according to AS configuration and ASP availability.

Parameters

  [in] | as | Application Server.

Returns
  asp to send the message to, NULL if no possible asp found

This function returns NULL too if multiple ASPs would be selected, ie. AS is configured in broadcast mode and more than one ASP is configured.

References _NUM_OSMO_SS7_ASP_TMOD, osmo_ss7_as::cfg, osmo_ss7_as::fi, osmo_ss7_as::mode, NULL, OSMO_SS7_AS_TMOD_BCAST, OSMO_SS7_AS_TMOD_LOADSHARE, OSMO_SS7_AS_TMOD_OVERRIDE, OSMO_SS7_AS_TMOD_ROUNDROBIN, ss7_as_select_asp_broadcast(), ss7_as_select_asp_loadshare(), ss7_as_select_asp_override(), and ss7_as_select_asp_roundrobin().

## ◆ osmo_ss7_as_tmode_compatible_xua()

bool osmo_ss7_as_tmode_compatible_xua | ( | struct osmo_ss7_as * | as,
|  | uint32_t | m3ua_tmt
| ) |  |

References osmo_ss7_as::cfg, M3UA_TMOD_BCAST, M3UA_TMOD_LOADSHARE, M3UA_TMOD_OVERRIDE, osmo_ss7_as::mode, osmo_ss7_as::mode_set_by_peer, osmo_ss7_as::mode_set_by_vty, OSMO_SS7_AS_TMOD_BCAST, OSMO_SS7_AS_TMOD_LOADSHARE, OSMO_SS7_AS_TMOD_OVERRIDE, and OSMO_SS7_AS_TMOD_ROUNDROBIN.

Referenced by handle_rkey_reg(), and xua_asp_fsm_inactive().

## ◆ osmo_ss7_instance_calc_itu_as_ext_sls()

static as_ext_sls_t osmo_ss7_instance_calc_itu_as_ext_sls | ( | const struct osmo_ss7_as * | as,
|  | uint32_t | opc,
|  | uint8_t | sls
| ) |  |
| static

References osmo_ss7_as::cfg, osmo_ss7_as::loadshare, NUM_AS_EXT_SLS, opc, osmo_ss7_as::opc_shift, osmo_ss7_as::opc_sls, sls, and osmo_ss7_as::sls_shift.

Referenced by ss7_as_select_asp_loadshare().

## ◆ ss7_as_add_asp()

int ss7_as_add_asp | ( | struct osmo_ss7_as * | as,
|  | struct osmo_ss7_asp * | asp
| ) |  |

Add given ASP to given AS.

Parameters

  [in] | as | Application Server to which asp is added
  [in] | asp | Application Server Process to be added to as

Returns
  0 on success; negative in case of error

References osmo_ss7_as::asps, osmo_ss7_as::cfg, osmo_ss7_asp::cfg, osmo_ss7_asp::fi, LOGPAS, osmo_ss7_asp::name, osmo_ss7_as_has_asp(), and XUA_ASP_E_AS_ASSIGNED.

Referenced by handle_rkey_reg(), ipa_asp_fsm_wait_id_resp(), osmo_sccp_simple_client_on_ss7_id(), osmo_sccp_simple_server_add_clnt(), and osmo_ss7_as_add_asp().

## ◆ 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] | 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_instance::as_list, osmo_ss7_as::asps, 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::last_asp_idx_assigned, osmo_ss7_as::list, osmo_ss7_as::mode, osmo_ss7_as::name, NULL, 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_as_assign_asp_roundrobin()

static struct osmo_ss7_asp * ss7_as_assign_asp_roundrobin | ( | struct osmo_ss7_as * | as | ) |
| static

References osmo_ss7_as::asps, osmo_ss7_as::cfg, and osmo_ss7_as::last_asp_idx_assigned.

Referenced by ss7_as_select_asp_loadshare().

## ◆ ss7_as_get_local_role()

int ss7_as_get_local_role | ( | const struct osmo_ss7_as * | as | ) |

References osmo_ss7_as::asps, osmo_ss7_as::cfg, osmo_ss7_asp::cfg, and osmo_ss7_asp::role.

Referenced by ss7_vty_node_as_go_parent(), and xua_as_fsm_onenter().

## ◆ ss7_as_loadshare_binding_table_reset()

void ss7_as_loadshare_binding_table_reset | ( | struct osmo_ss7_as * | as | ) |

References osmo_ss7_as::aesls_table, osmo_ss7_as::asps, osmo_ss7_as::cfg, and osmo_ss7_as::last_asp_idx_assigned.

Referenced by DEFUN_ATTR().

## ◆ ss7_as_select_asp()

struct osmo_ss7_asp * ss7_as_select_asp | ( | struct osmo_ss7_as * | as,
|  | const struct osmo_mtp_transfer_param * | mtp
| ) |  |

Select an AS to transmit a message, according to AS configuration and ASP availability.

Parameters

  [in] | as | Application Server.

Returns
  asp to send the message to, NULL if no possible asp found

This function returns NULL too if multiple ASPs would be selected, ie. AS is configured in broadcast mode and more than one ASP is configured.

References _NUM_OSMO_SS7_ASP_TMOD, osmo_ss7_as::cfg, osmo_ss7_as::fi, osmo_ss7_as::mode, NULL, OSMO_SS7_AS_TMOD_BCAST, OSMO_SS7_AS_TMOD_LOADSHARE, OSMO_SS7_AS_TMOD_OVERRIDE, OSMO_SS7_AS_TMOD_ROUNDROBIN, ss7_as_select_asp_broadcast(), ss7_as_select_asp_loadshare(), ss7_as_select_asp_override(), and ss7_as_select_asp_roundrobin().

Referenced by xua_as_transmit_msg().

## ◆ ss7_as_select_asp_broadcast()

static struct osmo_ss7_asp * ss7_as_select_asp_broadcast | ( | struct osmo_ss7_as * | as | ) |
| static

References osmo_ss7_as::asps, osmo_ss7_as::cfg, NULL, and osmo_ss7_asp_active().

Referenced by osmo_ss7_as_select_asp(), and ss7_as_select_asp().

## ◆ ss7_as_select_asp_loadshare()

static struct osmo_ss7_asp * ss7_as_select_asp_loadshare | ( | struct osmo_ss7_as * | as,
|  | const struct osmo_mtp_transfer_param * | mtp
| ) |  |
| static

References osmo_ss7_as::aesls_table, osmo_ss7_as_esls_entry::alt_asp, osmo_ss7_asp::cfg, current_asp(), osmo_ss7_as::inst, LOGPAS, osmo_ss7_asp::name, osmo_ss7_as_esls_entry::normal_asp, NULL, osmo_mtp_transfer_param::opc, osmo_ss7_asp_active(), osmo_ss7_instance_calc_itu_as_ext_sls(), osmo_ss7_pointcode_print(), osmo_mtp_transfer_param::sls, ss7_as_assign_asp_roundrobin(), and ss7_as_select_asp_roundrobin().

Referenced by osmo_ss7_as_select_asp(), and ss7_as_select_asp().

## ◆ ss7_as_select_asp_override()

static struct osmo_ss7_asp * ss7_as_select_asp_override | ( | struct osmo_ss7_as * | as | ) |
| static

References osmo_ss7_as::asps, osmo_ss7_as::cfg, and osmo_ss7_asp_active().

Referenced by osmo_ss7_as_select_asp(), and ss7_as_select_asp().

## ◆ ss7_as_select_asp_roundrobin()

static struct osmo_ss7_asp * ss7_as_select_asp_roundrobin | ( | struct osmo_ss7_as * | as | ) |
| static

References osmo_ss7_as::asps, osmo_ss7_as::cfg, osmo_ss7_as::last_asp_idx_sent, and osmo_ss7_asp_active().

Referenced by osmo_ss7_as_select_asp(), ss7_as_select_asp(), and ss7_as_select_asp_loadshare().

## Variable Documentation

## ◆ g_ss7_as_rcg_idx

unsigned int g_ss7_as_rcg_idx
| static

Referenced by ss7_as_alloc().

## ◆ osmo_ss7_as_traffic_mode_vals

struct value_string osmo_ss7_as_traffic_mode_vals[]

Initial value:
= {
{ OSMO_SS7_AS_TMOD_BCAST, "broadcast" },
{ OSMO_SS7_AS_TMOD_LOADSHARE, "loadshare" },
{ OSMO_SS7_AS_TMOD_ROUNDROBIN, "roundrobin" },
{ OSMO_SS7_AS_TMOD_OVERRIDE, "override" },
{ 0, NULL }
}
OSMO_SS7_AS_TMOD_OVERRIDE
@ OSMO_SS7_AS_TMOD_OVERRIDE
Definition: osmo_ss7.h:185
OSMO_SS7_AS_TMOD_ROUNDROBIN
@ OSMO_SS7_AS_TMOD_ROUNDROBIN
Definition: osmo_ss7.h:193
OSMO_SS7_AS_TMOD_BCAST
@ OSMO_SS7_AS_TMOD_BCAST
Definition: osmo_ss7.h:187
OSMO_SS7_AS_TMOD_LOADSHARE
@ OSMO_SS7_AS_TMOD_LOADSHARE
Definition: osmo_ss7.h:190
NULL
int and can be left NULL
Definition: osmo_ss7.h:364

Referenced by DEFUN_USRATTR(), and osmo_ss7_as_traffic_mode_name().

## ◆ ss7_as_rcd

const struct rate_ctr_desc ss7_as_rcd[]
| static

## ◆ ss7_as_rcgd

const struct rate_ctr_group_desc ss7_as_rcgd
| static

Initial value:
= {
.group_name_prefix = "sigtran_as",
.group_description = "SIGTRAN Application Server",
.num_ctr = ARRAY_SIZE(ss7_as_rcd),
.ctr_desc = ss7_as_rcd,
}
ss7_as_rcd
static const struct rate_ctr_desc ss7_as_rcd[]
Definition: ss7_as.c:60

Referenced by ss7_as_alloc().