libosmo-sigtran 2.1.0.172-a2b0
Osmocom SIGTRAN library
Loading...
Searching...
No Matches
ss7_as.h
Go to the documentation of this file.
1#pragma once
2
3#include <stdint.h>
4#include <osmocom/core/linuxlist.h>
5#include <osmocom/core/fsm.h>
6#include <osmocom/core/hashtable.h>
7#include <osmocom/core/msgb.h>
8#include <osmocom/core/tdef.h>
9#include <osmocom/netif/stream.h>
10
12
13#include "ss7_internal.h"
14
15/***********************************************************************
16 * SS7 Application Server
17 ***********************************************************************/
18
20struct osmo_ss7_asp;
22struct xua_msg;
23
25 OSMO_SS7_PATCH_NONE, /* no patching of SCCP */
26 OSMO_SS7_PATCH_BOTH, /* patch both OPC and DPC into SCCP addresses */
27};
28
66
67#define NUM_AS_EXT_SLS 128
68typedef uint8_t as_ext_sls_t; /* range: 0-127, 7 bit */
70 /* ITU Q.704 4.2.1: "normal signallink link" */
72 /* ITU Q.704 4.2.1: "alternative signallink link" */
74};
75
78 struct llist_head list;
80
82 struct osmo_fsm_inst *fi;
83
86
89
91 struct rate_ctr_group *ctrg;
92
93 /* ASP loadshare: */
95
96 struct {
97 /* optimisation: true if tid_ranges contains PCs (not only wildcards) */
99 /* optimisation: true if tid_ranges contains SSNs (not only wildcards (0)) */
101 DECLARE_HASHTABLE(tid_ranges, 10);
102 /* gargabe collector timer */
103 struct osmo_timer_list gc_timer;
104 /* TODO: the hash tables size might not be optimal */
105 DECLARE_HASHTABLE(trxn_track_own, 10);
106 DECLARE_HASHTABLE(trxn_track_peer, 10);
108
109 struct {
110 char *name;
113 struct osmo_ss7_routing_key routing_key;
115 /* traffic mode was configured by VTY / config file */
117 /* traffic mode was configured by RKM (routing key management) or first ASPAC */
120 uint8_t qos_class;
121 struct {
124 uint32_t opc;
125 uint32_t dpc;
127 } pc_override;
128
129 struct osmo_ss7_asp *asps[16];
130 /* used for load-sharing traffic mode (round robin implementation) */
133
134 struct {
135 /* How many bits from ITU SLS field (starting from least-significant-bit)
136 * to skip for routing decisions.
137 * range 0-3, defaults to 0, which means take all 4 bits. */
138 uint8_t sls_shift;
139 /* Whether to generate a extended-SLS with OPC information, see opc_shift below. */
141 /* How many bits from ITU OPC field (starting from least-significant-bit)
142 * to skip for routing decisions (always takes 12 bits).
143 * range 0-2, defaults to 0, which means take least significant 12 bits. */
144 uint8_t opc_shift;
145 /* Should we do load-sharing based on tcap ids? */
146 struct {
148 unsigned int timeout_s;
149 } tcap;
150 } loadshare;
152};
153struct osmo_ss7_as *ss7_as_alloc(struct osmo_ss7_instance *inst, const char *name,
155struct osmo_ss7_asp *ss7_as_select_asp(struct osmo_ss7_as *as, struct xua_msg *xua);
156
157unsigned int osmo_ss7_as_count_asp(const struct osmo_ss7_as *as);
158int ss7_as_add_asp(struct osmo_ss7_as *as, struct osmo_ss7_asp *asp);
159int ss7_as_get_local_role(const struct osmo_ss7_as *as);
161
162#define LOGPAS(as, subsys, level, fmt, args ...) \
163 _LOGSS7((as)->inst, subsys, level, "AS(%s) " fmt, (as)->cfg.name, ## args)
osmo_ss7_asp_protocol
Definition osmo_ss7.h:157
osmo_ss7_as_traffic_mode
Definition osmo_ss7.h:183
osmo_ss7_as_patch_sccp_mode
Definition ss7_as.h:24
@ OSMO_SS7_PATCH_BOTH
Definition ss7_as.h:26
@ OSMO_SS7_PATCH_NONE
Definition ss7_as.h:25
void ss7_as_loadshare_binding_table_reset(struct osmo_ss7_as *as)
Definition ss7_as.c:398
struct osmo_ss7_asp * ss7_as_select_asp(struct osmo_ss7_as *as, struct xua_msg *xua)
Select an AS to transmit a message, according to AS configuration and ASP availability.
Definition ss7_as.c:535
uint8_t as_ext_sls_t
Definition ss7_as.h:68
int ss7_as_get_local_role(const struct osmo_ss7_as *as)
Definition ss7_as.c:294
#define NUM_AS_EXT_SLS
Definition ss7_as.h:67
int ss7_as_add_asp(struct osmo_ss7_as *as, struct osmo_ss7_asp *asp)
Add given ASP to given AS.
Definition ss7_as.c:164
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.
Definition ss7_as.c:114
ss7_as_ctr
Definition ss7_as.h:29
@ SS7_AS_CTR_TX_MSU_SLS_8
Definition ss7_as.h:57
@ SS7_AS_CTR_TX_MSU_SLS_15
Definition ss7_as.h:64
@ SS7_AS_CTR_RX_MSU_SLS_10
Definition ss7_as.h:42
@ SS7_AS_CTR_RX_MSU_TOTAL
Definition ss7_as.h:31
@ SS7_AS_CTR_TX_MSU_SLS_14
Definition ss7_as.h:63
@ SS7_AS_CTR_TX_MSU_SLS_7
Definition ss7_as.h:56
@ SS7_AS_CTR_RX_MSU_SLS_15
Definition ss7_as.h:47
@ SS7_AS_CTR_RX_MSU_SLS_1
Definition ss7_as.h:33
@ SS7_AS_CTR_TX_MSU_SLS_5
Definition ss7_as.h:54
@ SS7_AS_CTR_RX_MSU_SLS_2
Definition ss7_as.h:34
@ SS7_AS_CTR_TX_MSU_SLS_3
Definition ss7_as.h:52
@ SS7_AS_CTR_RX_MSU_SLS_5
Definition ss7_as.h:37
@ SS7_AS_CTR_TX_MSU_SLS_10
Definition ss7_as.h:59
@ SS7_AS_CTR_RX_MSU_SLS_8
Definition ss7_as.h:40
@ SS7_AS_CTR_TX_MSU_SLS_12
Definition ss7_as.h:61
@ SS7_AS_CTR_RX_MSU_SLS_4
Definition ss7_as.h:36
@ SS7_AS_CTR_TX_MSU_SLS_9
Definition ss7_as.h:58
@ SS7_AS_CTR_TX_MSU_SLS_2
Definition ss7_as.h:51
@ SS7_AS_CTR_TX_MSU_SLS_0
Definition ss7_as.h:49
@ SS7_AS_CTR_TX_MSU_TOTAL
Definition ss7_as.h:48
@ SS7_AS_CTR_RX_MSU_SLS_7
Definition ss7_as.h:39
@ SS7_AS_CTR_RX_MSU_DISCARD
Definition ss7_as.h:30
@ SS7_AS_CTR_TX_MSU_SLS_11
Definition ss7_as.h:60
@ SS7_AS_CTR_TX_MSU_SLS_6
Definition ss7_as.h:55
@ SS7_AS_CTR_RX_MSU_SLS_6
Definition ss7_as.h:38
@ SS7_AS_CTR_RX_MSU_SLS_14
Definition ss7_as.h:46
@ SS7_AS_CTR_RX_MSU_SLS_9
Definition ss7_as.h:41
@ SS7_AS_CTR_TX_MSU_SLS_13
Definition ss7_as.h:62
@ SS7_AS_CTR_RX_MSU_SLS_13
Definition ss7_as.h:45
@ SS7_AS_CTR_RX_MSU_SLS_12
Definition ss7_as.h:44
@ SS7_AS_CTR_TX_MSU_SLS_1
Definition ss7_as.h:50
@ SS7_AS_CTR_RX_MSU_SLS_3
Definition ss7_as.h:35
@ SS7_AS_CTR_RX_MSU_SLS_11
Definition ss7_as.h:43
@ SS7_AS_CTR_RX_MSU_SLS_0
Definition ss7_as.h:32
@ SS7_AS_CTR_TX_MSU_SLS_4
Definition ss7_as.h:53
unsigned int osmo_ss7_as_count_asp(const struct osmo_ss7_as *as)
Determine amount of ASPs associated to an AS.
Definition ss7_as.c:280
Definition mtp_sap.h:36
Definition ss7_as.h:69
struct osmo_ss7_asp * normal_asp
Definition ss7_as.h:71
struct osmo_ss7_asp * alt_asp
Definition ss7_as.h:73
Definition ss7_as.h:76
bool contains_ssn
Definition ss7_as.h:100
uint8_t opc_shift
Definition ss7_as.h:144
uint8_t sls_shift
Definition ss7_as.h:138
uint32_t recovery_timeout_msec
Definition ss7_as.h:119
struct osmo_ss7_as_esls_entry aesls_table[NUM_AS_EXT_SLS]
Definition ss7_as.h:94
bool enabled
Definition ss7_as.h:147
bool opc_enabled
Definition ss7_as.h:122
unsigned int timeout_s
Definition ss7_as.h:148
struct llist_head list
entry in 'ref osmo_ss7_instance.as_list
Definition ss7_as.h:78
uint8_t last_asp_idx_assigned
Definition ss7_as.h:131
char * description
Definition ss7_as.h:111
bool rkm_dyn_allocated
Were we dynamically allocated by RKM?
Definition ss7_as.h:85
struct rate_ctr_group * ctrg
Rate Counter Group.
Definition ss7_as.h:91
uint8_t last_asp_idx_sent
Definition ss7_as.h:132
char * name
Definition ss7_as.h:110
uint32_t opc
Definition ss7_as.h:124
bool contains_pc
Definition ss7_as.h:98
bool mode_set_by_vty
Definition ss7_as.h:116
struct osmo_ss7_as::@23 tcap
struct osmo_fsm_inst * fi
AS FSM.
Definition ss7_as.h:82
struct osmo_ss7_as::@24 cfg
bool simple_client_allocated
Were we allocated by "simple client" support?
Definition ss7_as.h:88
uint32_t dpc
Definition ss7_as.h:125
bool opc_sls
Definition ss7_as.h:140
enum osmo_ss7_as_traffic_mode mode
Definition ss7_as.h:114
enum osmo_ss7_asp_protocol proto
Definition ss7_as.h:112
enum osmo_ss7_as_patch_sccp_mode sccp_mode
Definition ss7_as.h:126
struct osmo_ss7_instance * inst
Definition ss7_as.h:79
bool mode_set_by_peer
Definition ss7_as.h:118
uint8_t qos_class
Definition ss7_as.h:120
bool dpc_enabled
Definition ss7_as.h:123
Definition ss7_asp.h:42
Definition ss7_instance.h:21
Definition osmo_ss7.h:142
Definition xua_msg.h:31