libosmo-sigtran  2.1.0.93-5cebd.202505202026
Osmocom SIGTRAN library
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 
19 struct osmo_ss7_instance;
21 
26 };
27 
28 struct osmo_ss7_asp {
30  struct llist_head list;
32 
34  struct osmo_fsm_inst *fi;
35 
38  struct llist_head siblings;
39 
41  struct osmo_stream_cli *client;
42  struct osmo_stream_srv *server;
44  char *sock_name;
45 
46  /* ASP Identifier for ASP-UP + NTFY, as received by the peer.
47  * (In IPA ASPs it's used internally to hold 4-bit SLS).
48  * FIXME: This should actually be stored in a AS-ASP relation, since it
49  * can be different per AS, see RFC4666 3.5.1
50  * "The optional ASP Identifier parameter contains a unique value that
51  * is locally significant among the ASPs that support an AS".
52  */
53  uint32_t remote_asp_id;
55 
56  /* Layer Manager to which we talk */
57  const struct osmo_xua_layer_manager *lm;
58  void *lm_priv;
59 
62 
65 
67  struct rate_ctr_group *ctrg;
68 
70  struct msgb *pending_msg;
71 
72  /* IPA proto ASP specific fields. */
73  struct {
74  /* Incoming IPA PDUs have no SLS field, hence a potentially
75  * unique one within AS is assigned to this ASP and applied
76  * manually when received. */
77  uint8_t sls:4;
79  } ipa;
80 
81  struct {
82  char *name;
83  char *description;
86  bool is_server;
90  /* Used internally by "asp" node to figure out if "no shutdown"
91  * was done explicitly, in order to avoid automatic asp
92  * reconfiguring/restart at go_parent().
93  * Can be dropped in the future once we make sure everybody uses
94  * "[no] shutdown" explicitly in cfg files. */
96 
97  struct osmo_ss7_asp_peer local;
99  uint8_t qos_class;
100  uint32_t quirks;
101 
102  /* T_defs used by the default_lm: */
103  struct osmo_tdef *T_defs_lm;
104 
105  struct {
113  uint16_t max_init_timeo_value; /* ms */
115 
118  } cfg;
119 };
120 
121 struct osmo_ss7_asp *ss7_asp_alloc(struct osmo_ss7_instance *inst, const char *name,
122  uint16_t remote_port, uint16_t local_port,
125 bool ss7_asp_is_started(const struct osmo_ss7_asp *asp);
126 int ss7_asp_get_fd(const struct osmo_ss7_asp *asp);
127 int ss7_asp_disconnect_stream(struct osmo_ss7_asp *asp);
128 
129 int ss7_asp_apply_peer_primary_address(const struct osmo_ss7_asp *asp);
130 int ss7_asp_apply_primary_address(const struct osmo_ss7_asp *asp);
131 int ss7_asp_apply_new_local_address(const struct osmo_ss7_asp *asp, unsigned int loc_idx);
132 int ss7_asp_apply_drop_local_address(const struct osmo_ss7_asp *asp, unsigned int loc_idx);
133 
136 
137 unsigned int ss7_asp_get_all_rctx(const struct osmo_ss7_asp *asp, uint32_t *rctx, unsigned int rctx_size,
138  const struct osmo_ss7_as *excl_as);
139 unsigned int ss7_asp_get_all_rctx_be(const struct osmo_ss7_asp *asp, uint32_t *rctx, unsigned int rctx_size,
140  const struct osmo_ss7_as *excl_as);
141 
142 #define LOGPASP(asp, subsys, level, fmt, args ...) \
143  _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:807
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:293
ss7_asp_ctr
Definition: ss7_asp.h:22
@ SS7_ASP_CTR_PKT_TX_TOTAL
Definition: ss7_asp.h:25
@ SS7_ASP_CTR_PKT_RX_UNKNOWN
Definition: ss7_asp.h:24
@ SS7_ASP_CTR_PKT_RX_TOTAL
Definition: ss7_asp.h:23
void ss7_asp_restart_after_reconfigure(struct osmo_ss7_asp *asp)
Definition: ss7_asp.c:1330
int ss7_asp_apply_peer_primary_address(const struct osmo_ss7_asp *asp)
Definition: ss7_asp.c:251
int ss7_asp_get_fd(const struct osmo_ss7_asp *asp)
Get the fd of a given ASP.
Definition: ss7_asp.c:1317
int ss7_asp_disconnect_stream(struct osmo_ss7_asp *asp)
Definition: ss7_asp.c:696
int ss7_asp_apply_new_local_address(const struct osmo_ss7_asp *asp, unsigned int loc_idx)
Definition: ss7_asp.c:207
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:1372
int ss7_asp_apply_drop_local_address(const struct osmo_ss7_asp *asp, unsigned int loc_idx)
Definition: ss7_asp.c:229
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:1365
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:542
bool ss7_asp_set_default_peer_hosts(struct osmo_ss7_asp *asp)
Definition: ss7_asp.c:404
Definition: ss7_as.h:74
Definition: ss7_asp_peer.h:11
Definition: ss7_asp.h:28
enum osmo_ss7_asp_role role
Definition: ss7_asp.h:87
char * sock_name
pre-formatted human readable local/remote socket name
Definition: ss7_asp.h:44
struct osmo_ss7_asp::@25 ipa
bool role_set_by_vty
Definition: ss7_asp.h:88
struct osmo_ss7_asp_peer remote
Definition: ss7_asp.h:98
bool max_attempts_present
Definition: ss7_asp.h:108
bool explicit_shutdown_state_by_vty_since_node_enter
Definition: ss7_asp.h:95
bool max_instreams_present
Definition: ss7_asp.h:107
struct osmo_tdef * T_defs_lm
Definition: ss7_asp.h:103
struct osmo_fsm_inst * fi
ASP FSM.
Definition: ss7_asp.h:34
uint16_t max_attempts_value
Definition: ss7_asp.h:112
uint16_t max_instreams_value
Definition: ss7_asp.h:111
struct llist_head list
entry in osmo_ss7_instance::asp_list
Definition: ss7_asp.h:30
uint8_t sls
Definition: ss7_asp.h:77
enum osmo_ss7_asp_protocol proto
Definition: ss7_asp.h:84
void * lm_priv
Definition: ss7_asp.h:58
struct osmo_ss7_instance * inst
Definition: ss7_asp.h:31
const struct osmo_xua_layer_manager * lm
Definition: ss7_asp.h:57
bool num_ostreams_present
Definition: ss7_asp.h:106
uint32_t remote_asp_id
Definition: ss7_asp.h:53
struct osmo_stream_srv * server
Definition: ss7_asp.h:42
struct osmo_ss7_asp::@26 cfg
uint32_t quirks
Definition: ss7_asp.h:100
bool simple_client_allocated
Were we allocated by "simple client" support?
Definition: ss7_asp.h:64
bool sls_assigned
Definition: ss7_asp.h:78
struct osmo_stream_cli * client
osmo_stream / libosmo-netif handles
Definition: ss7_asp.h:41
bool trans_role_set_by_vty
Definition: ss7_asp.h:89
enum osmo_ss7_asp_admin_state adm_state
Definition: ss7_asp.h:85
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:37
struct osmo_ss7_asp_peer local
Definition: ss7_asp.h:97
bool is_server
Definition: ss7_asp.h:86
bool dyn_allocated
Were we dynamically allocated.
Definition: ss7_asp.h:61
bool max_init_timeo_present
Definition: ss7_asp.h:109
char * name
Definition: ss7_asp.h:82
uint8_t qos_class
Definition: ss7_asp.h:99
struct msgb * pending_msg
Pending message for non-blocking IPA read.
Definition: ss7_asp.h:70
uint16_t num_ostreams_value
Definition: ss7_asp.h:110
int trans_proto
The underlaying transport protocol (one of IPPROTO_*)
Definition: ss7_asp.h:117
char * description
Definition: ss7_asp.h:83
bool remote_asp_id_present
Definition: ss7_asp.h:54
struct rate_ctr_group * ctrg
Rate Counter Group.
Definition: ss7_asp.h:67
struct llist_head siblings
Definition: ss7_asp.h:38
uint16_t max_init_timeo_value
Definition: ss7_asp.h:113
Definition: ss7_instance.h:21
Definition: ss7_xua_srv.h:18
Definition: ss7_xua_srv.h:22