libosmo-sigtran 2.1.0.119-5f21
Osmocom SIGTRAN library
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
ss7_asp.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/msgb.h>
7#include <osmocom/core/tdef.h>
8#include <osmocom/netif/stream.h>
9
11
12#include "ss7_asp_peer.h"
13#include "ss7_internal.h"
14
15/***********************************************************************
16 * SS7 Application Server Processes
17 ***********************************************************************/
18
21
23 /* 0 kept unused on purpose since it's handled specially by osmo_fsm */
24 SS7_ASP_XUA_T_ACK = 1, /* RFC3868 & RFC4666 timer T(ack) */
25 SS7_ASP_XUA_T_BEAT, /* RFC3868 & RFC4666 timer T(beat) */
26 /* This must remain the last item: */
28};
29extern const struct value_string ss7_asp_xua_timer_names[];
30extern const struct osmo_tdef ss7_asp_xua_timer_defaults[SS7_ASP_XUA_TIMERS_LEN];
31/* According to SUA RFC3868 Section 8, M3UA RFC4666 Section 4.3.4.1 */
32#define SS7_ASP_XUA_DEFAULT_T_ACK_SEC 2
33/* According to SUA RFC3868 Section 8 */
34#define SS7_ASP_XUA_DEFAULT_T_BEAT_SEC 30
35
40};
41
44 struct llist_head list;
46
48 struct osmo_fsm_inst *fi;
49
52 struct llist_head siblings;
53
55 struct osmo_stream_cli *client;
56 struct osmo_stream_srv *server;
58 char *sock_name;
59
60 /* ASP Identifier for ASP-UP + NTFY, as received by the peer.
61 * (In IPA ASPs it's used internally to hold 4-bit SLS).
62 * FIXME: This should actually be stored in a AS-ASP relation, since it
63 * can be different per AS, see RFC4666 3.5.1
64 * "The optional ASP Identifier parameter contains a unique value that
65 * is locally significant among the ASPs that support an AS".
66 */
67 uint32_t remote_asp_id;
69
70 /* Layer Manager to which we talk */
72 void *lm_priv;
73
76
79
81 struct rate_ctr_group *ctrg;
82
84 struct msgb *pending_msg;
85
86 /* IPA proto ASP specific fields. */
87 struct {
88 /* Incoming IPA PDUs have no SLS field, hence a potentially
89 * unique one within AS is assigned to this ASP and applied
90 * manually when received. */
91 uint8_t sls:4;
93 } ipa;
94
95 struct {
96 char *name;
104 /* Used internally by "asp" node to figure out if "no shutdown"
105 * was done explicitly, in order to avoid automatic asp
106 * reconfiguring/restart at go_parent().
107 * Can be dropped in the future once we make sure everybody uses
108 * "[no] shutdown" explicitly in cfg files. */
110
113 uint8_t qos_class;
114 uint32_t quirks;
115
116 /* T_defs used by the default_lm: */
117 struct osmo_tdef *T_defs_xua;
118
119 /* T_defs used by the default_lm: */
120 struct osmo_tdef *T_defs_lm;
121
122 struct {
130 uint16_t max_init_timeo_value; /* ms */
132
133 struct {
139 int keepalive_time_value; /* seconds */
140 int keepalive_intvl_value; /* seconds */
142 unsigned int user_timeout_value; /* milliseconds */
144
148};
149
150struct osmo_ss7_asp *ss7_asp_alloc(struct osmo_ss7_instance *inst, const char *name,
151 uint16_t remote_port, uint16_t local_port,
154bool ss7_asp_is_started(const struct osmo_ss7_asp *asp);
155int ss7_asp_get_fd(const struct osmo_ss7_asp *asp);
157
158int ss7_asp_apply_tcp_pars(const struct osmo_ss7_asp *asp);
160int ss7_asp_apply_primary_address(const struct osmo_ss7_asp *asp);
161int ss7_asp_apply_new_local_address(const struct osmo_ss7_asp *asp, unsigned int loc_idx);
162int ss7_asp_apply_drop_local_address(const struct osmo_ss7_asp *asp, unsigned int loc_idx);
163
166
167unsigned int ss7_asp_get_all_rctx(const struct osmo_ss7_asp *asp, uint32_t *rctx, unsigned int rctx_size,
168 const struct osmo_ss7_as *excl_as);
169unsigned int ss7_asp_get_all_rctx_be(const struct osmo_ss7_asp *asp, uint32_t *rctx, unsigned int rctx_size,
170 const struct osmo_ss7_as *excl_as);
171
172#define LOGPASP(asp, subsys, level, fmt, args ...) \
173 _LOGSS7((asp)->inst, subsys, level, "ASP(%s) " fmt, (asp)->cfg.name, ## args)
osmo_ss7_asp_protocol
Definition: osmo_ss7.h:157
osmo_ss7_asp_role
Definition: osmo_ss7.h:253
osmo_ss7_asp_admin_state
Definition: osmo_ss7.h:243
bool ss7_asp_is_started(const struct osmo_ss7_asp *asp)
Definition: ss7_asp.c:958
void osmo_ss7_asp_remove_default_lm(struct osmo_ss7_asp *asp)
Definition: xua_default_lm_fsm.c:413
int ss7_asp_apply_primary_address(const struct osmo_ss7_asp *asp)
Definition: ss7_asp.c:422
ss7_asp_xua_timer
Definition: ss7_asp.h:22
@ SS7_ASP_XUA_TIMERS_LEN
Definition: ss7_asp.h:27
@ SS7_ASP_XUA_T_ACK
Definition: ss7_asp.h:24
@ SS7_ASP_XUA_T_BEAT
Definition: ss7_asp.h:25
ss7_asp_ctr
Definition: ss7_asp.h:36
@ SS7_ASP_CTR_PKT_TX_TOTAL
Definition: ss7_asp.h:39
@ SS7_ASP_CTR_PKT_RX_UNKNOWN
Definition: ss7_asp.h:38
@ SS7_ASP_CTR_PKT_RX_TOTAL
Definition: ss7_asp.h:37
void ss7_asp_restart_after_reconfigure(struct osmo_ss7_asp *asp)
Definition: ss7_asp.c:1505
int ss7_asp_apply_peer_primary_address(const struct osmo_ss7_asp *asp)
Definition: ss7_asp.c:380
int ss7_asp_get_fd(const struct osmo_ss7_asp *asp)
Get the fd of a given ASP.
Definition: ss7_asp.c:1492
int ss7_asp_disconnect_stream(struct osmo_ss7_asp *asp)
Definition: ss7_asp.c:847
const struct osmo_tdef ss7_asp_xua_timer_defaults[SS7_ASP_XUA_TIMERS_LEN]
Definition: ss7_asp.c:119
int ss7_asp_apply_new_local_address(const struct osmo_ss7_asp *asp, unsigned int loc_idx)
Definition: ss7_asp.c:336
int ss7_asp_apply_tcp_pars(const struct osmo_ss7_asp *asp)
Definition: ss7_asp.c:327
unsigned int ss7_asp_get_all_rctx(const struct osmo_ss7_asp *asp, uint32_t *rctx, unsigned int rctx_size, const struct osmo_ss7_as *excl_as)
Definition: ss7_asp.c:1547
int ss7_asp_apply_drop_local_address(const struct osmo_ss7_asp *asp, unsigned int loc_idx)
Definition: ss7_asp.c:358
struct osmo_ss7_asp * ss7_asp_alloc(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)
Definition: ss7_asp.c:699
const struct value_string ss7_asp_xua_timer_names[]
Definition: ss7_asp.c:128
unsigned int ss7_asp_get_all_rctx_be(const struct osmo_ss7_asp *asp, uint32_t *rctx, unsigned int rctx_size, const struct osmo_ss7_as *excl_as)
Definition: ss7_asp.c:1540
bool ss7_asp_set_default_peer_hosts(struct osmo_ss7_asp *asp)
Definition: ss7_asp.c:561
Definition: ss7_as.h:74
Definition: ss7_asp_peer.h:11
Definition: ss7_asp.h:42
enum osmo_ss7_asp_role role
Definition: ss7_asp.h:101
char * sock_name
pre-formatted human readable local/remote socket name
Definition: ss7_asp.h:58
struct osmo_ss7_asp::@25 ipa
bool role_set_by_vty
Definition: ss7_asp.h:102
int keepalive_time_value
Definition: ss7_asp.h:139
struct osmo_ss7_asp_peer remote
Definition: ss7_asp.h:112
bool max_attempts_present
Definition: ss7_asp.h:125
bool explicit_shutdown_state_by_vty_since_node_enter
Definition: ss7_asp.h:109
bool max_instreams_present
Definition: ss7_asp.h:124
struct osmo_tdef * T_defs_lm
Definition: ss7_asp.h:120
struct osmo_fsm_inst * fi
ASP FSM.
Definition: ss7_asp.h:48
uint16_t max_attempts_value
Definition: ss7_asp.h:129
struct osmo_tdef * T_defs_xua
Definition: ss7_asp.h:117
uint16_t max_instreams_value
Definition: ss7_asp.h:128
struct llist_head list
entry in osmo_ss7_instance::asp_list
Definition: ss7_asp.h:44
uint8_t sls
Definition: ss7_asp.h:91
enum osmo_ss7_asp_protocol proto
Definition: ss7_asp.h:98
void * lm_priv
Definition: ss7_asp.h:72
struct osmo_ss7_instance * inst
Definition: ss7_asp.h:45
const struct osmo_xua_layer_manager * lm
Definition: ss7_asp.h:71
bool num_ostreams_present
Definition: ss7_asp.h:123
uint32_t remote_asp_id
Definition: ss7_asp.h:67
struct osmo_stream_srv * server
Definition: ss7_asp.h:56
struct osmo_ss7_asp::@26 cfg
uint32_t quirks
Definition: ss7_asp.h:114
struct osmo_ss7_asp::@26::@28 tcp
bool simple_client_allocated
Were we allocated by "simple client" support?
Definition: ss7_asp.h:78
int keepalive_probes_value
Definition: ss7_asp.h:141
bool sls_assigned
Definition: ss7_asp.h:92
struct osmo_stream_cli * client
osmo_stream / libosmo-netif handles
Definition: ss7_asp.h:55
bool trans_role_set_by_vty
Definition: ss7_asp.h:103
enum osmo_ss7_asp_admin_state adm_state
Definition: ss7_asp.h:99
struct osmo_ss7_asp::@26::@27 sctp_init
struct osmo_xua_server * xua_server
osmo_xua_server over which we were established
Definition: ss7_asp.h:51
struct osmo_ss7_asp_peer local
Definition: ss7_asp.h:111
bool is_server
Definition: ss7_asp.h:100
int keepalive_intvl_value
Definition: ss7_asp.h:140
bool user_timeout_present
Definition: ss7_asp.h:138
unsigned int user_timeout_value
Definition: ss7_asp.h:142
bool dyn_allocated
Were we dynamically allocated.
Definition: ss7_asp.h:75
bool max_init_timeo_present
Definition: ss7_asp.h:126
char * name
Definition: ss7_asp.h:96
bool keepalive_probes_present
Definition: ss7_asp.h:137
bool keepalive_time_present
Definition: ss7_asp.h:135
bool keepalive_intvl_present
Definition: ss7_asp.h:136
uint8_t qos_class
Definition: ss7_asp.h:113
struct msgb * pending_msg
Pending message for non-blocking IPA read.
Definition: ss7_asp.h:84
uint16_t num_ostreams_value
Definition: ss7_asp.h:127
int trans_proto
The underlaying transport protocol (one of IPPROTO_*)
Definition: ss7_asp.h:146
char * description
Definition: ss7_asp.h:97
bool keepalive_enable
Definition: ss7_asp.h:134
bool remote_asp_id_present
Definition: ss7_asp.h:68
struct rate_ctr_group * ctrg
Rate Counter Group.
Definition: ss7_asp.h:81
struct llist_head siblings
Definition: ss7_asp.h:52
uint16_t max_init_timeo_value
Definition: ss7_asp.h:130
Definition: ss7_instance.h:21
Definition: ss7_xua_srv.h:18
Definition: ss7_xua_srv.h:22