Loading...
Searching...
No Matches
osmo_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 "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"`

## 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.
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.
int | osmo_ss7_as_add_asp (struct osmo_ss7_as *as, const char *asp_name)
| Add given ASP to given AS.
int | osmo_ss7_as_del_asp (struct osmo_ss7_as *as, const char *asp_name)
| Delete given ASP from given AS.
void | osmo_ss7_as_destroy (struct osmo_ss7_as *as)
| Destroy given Application Server.
bool | osmo_ss7_as_has_asp (const struct osmo_ss7_as *as, const struct osmo_ss7_asp *asp)
| Determine if given AS contains ASP.
bool | osmo_ss7_as_active (const struct osmo_ss7_as *as)
| Determine if given AS is in the active state.
bool | osmo_ss7_as_down (const struct osmo_ss7_as *as)
| Determine if given AS is in the down state.
static struct osmo_ss7_asp * | ss7_as_select_asp_override (struct osmo_ss7_as *as)
static struct osmo_ss7_asp * | ss7_as_select_asp_roundrobin (struct osmo_ss7_as *as)
static struct osmo_ss7_asp * | ss7_as_select_asp_broadcast (struct osmo_ss7_as *as)
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.
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

## Function Documentation

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

## 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 | 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, osmo_ss7_as::inst, LOGPAS, osmo_ss7_asp::name, osmo_ss7_as_has_asp(), osmo_ss7_asp_find_by_name(), ss7_initialized, and XUA_ASP_E_AS_ASSIGNED.

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

## 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::asps, osmo_ss7_as::cfg, osmo_ss7_asp::cfg, osmo_ss7_as::inst, LOGPAS, osmo_ss7_asp::name, 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, 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.

Referenced by hmrt_message_for_routing().

## 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 as_list_for_asp(), determine_traf_mode(), dispatch_to_all_as(), find_single_as_for_asp(), get_all_rctx_for_asp(), handle_rkey_dereg(), ipa_find_as_for_asp(), osmo_sccp_simple_client_on_ss7_id(), osmo_ss7_as_add_asp(), xua_asp_fsm_inactive(), xua_find_as_for_asp(), xua_msg_add_asp_rctx(), and xua_rkm_cleanup_dyn_as_for_asp().

## 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, 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_override(), and ss7_as_select_asp_roundrobin().

Referenced by xua_as_transmit_msg().

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

## 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::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_as_select_asp_broadcast()

struct osmo_ss7_asp * ss7_as_select_asp_broadcast | ( | 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().

## ss7_as_select_asp_override()

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

## ss7_as_select_asp_roundrobin()

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

## 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, "round-robin" },
{ OSMO_SS7_AS_TMOD_OVERRIDE, "override" },
{ 0, NULL }
}
OSMO_SS7_AS_TMOD_OVERRIDE
@ OSMO_SS7_AS_TMOD_OVERRIDE
Definition osmo_ss7.h:176
OSMO_SS7_AS_TMOD_ROUNDROBIN
@ OSMO_SS7_AS_TMOD_ROUNDROBIN
Definition osmo_ss7.h:179
OSMO_SS7_AS_TMOD_BCAST
@ OSMO_SS7_AS_TMOD_BCAST
Definition osmo_ss7.h:177
OSMO_SS7_AS_TMOD_LOADSHARE
@ OSMO_SS7_AS_TMOD_LOADSHARE
Definition osmo_ss7.h:178

Referenced by DEFUN_USRATTR(), and osmo_ss7_as_traffic_mode_name().

## ss7_as_rcd

const struct rate_ctr_desc ss7_as_rcd[]

static

Initial value:
= {
[SS7_AS_CTR_RX_MSU_TOTAL] = { "rx:msu:total", "Total number of MSU received" },
[SS7_AS_CTR_TX_MSU_TOTAL] = { "tx:msu:total", "Total number of MSU transmitted" },
}
SS7_AS_CTR_RX_MSU_TOTAL
@ SS7_AS_CTR_RX_MSU_TOTAL
Definition ss7_as.h:27
SS7_AS_CTR_TX_MSU_TOTAL
@ SS7_AS_CTR_TX_MSU_TOTAL
Definition ss7_as.h:28

## 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 osmo_ss7_as.c:57

Referenced by ss7_as_alloc().