libosmo-sigtran  2.0.0.38-8f15.202411092026
Osmocom SIGTRAN library
osmo_ss7.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <stdint.h>
4 #include <stdbool.h>
5 
6 #include <osmocom/core/linuxlist.h>
7 #include <osmocom/core/utils.h>
8 #include <osmocom/core/fsm.h>
9 #include <osmocom/core/msgb.h>
10 #include <osmocom/core/prim.h>
11 #include <osmocom/core/socket.h>
12 #include <osmocom/core/rate_ctr.h>
13 
14 struct osmo_ss7_instance;
15 
16 extern struct llist_head osmo_ss7_instances;
17 /* Get an entry pointer from a list item in osmo_ss7_instances: */
18 struct osmo_ss7_instance *osmo_ss7_instances_llist_entry(struct llist_head *list);
19 
20 struct osmo_ss7_user;
21 struct osmo_sccp_instance;
22 struct osmo_mtp_prim;
24 
25 int osmo_ss7_init(void);
27 
28 bool osmo_ss7_pc_is_local(const struct osmo_ss7_instance *inst, uint32_t pc);
29 int osmo_ss7_pointcode_parse(const struct osmo_ss7_instance *inst, const char *str);
30 int osmo_ss7_pointcode_parse_mask_or_len(const struct osmo_ss7_instance *inst, const char *in);
31 const char *osmo_ss7_pointcode_print_buf(char *buf, size_t buf_len, const struct osmo_ss7_instance *inst, uint32_t pc);
32 const char *osmo_ss7_pointcode_print(const struct osmo_ss7_instance *inst, uint32_t pc);
33 const char *osmo_ss7_pointcode_print2(const struct osmo_ss7_instance *inst, uint32_t pc);
34 
35 /* All known point-code formats have a length of or below 24 bit.
36  * A point-code value exceeding that is used to indicate an unset PC. */
37 #define OSMO_SS7_PC_INVALID 0xffffffff
38 static inline bool osmo_ss7_pc_is_valid(uint32_t pc)
39 {
40  return pc <= 0x00ffffff;
41 }
42 
43 /***********************************************************************
44  * xUA Servers
45  ***********************************************************************/
46 
48 
49 struct osmo_xua_server;
50 
51 /***********************************************************************
52  * SS7 Instances
53  ***********************************************************************/
54 
56  char delimiter;
57  uint8_t component_len[3];
58 };
59 
62  struct llist_head list;
64  struct llist_head linksets;
66  struct llist_head as_list;
68  struct llist_head asp_list;
70  struct llist_head rtable_list;
72  struct llist_head xua_servers;
73  /* array for faster lookup of user (indexed by service
74  * indicator) */
75  const struct osmo_ss7_user *user[16];
76 
78 
80 
81  struct {
82  uint32_t id;
83  char *name;
84  char *description;
85  uint32_t primary_pc;
86  /* capability PCs */
88  struct osmo_ss7_pc_fmt pc_fmt;
90  struct llist_head sccp_address_book;
91  uint32_t secondary_pc;
92  } cfg;
93 };
94 
95 struct osmo_ss7_instance *osmo_ss7_instance_find(uint32_t id);
96 struct osmo_ss7_instance *
97 osmo_ss7_instance_find_or_create(void *ctx, uint32_t id);
99 
100 uint32_t osmo_ss7_instance_get_id(const struct osmo_ss7_instance *inst);
101 const char *osmo_ss7_instance_get_name(const struct osmo_ss7_instance *inst);
102 
104  uint8_t c0, uint8_t c1, uint8_t c2);
105 const struct osmo_ss7_pc_fmt *
107 
108 uint32_t osmo_ss7_instance_get_primary_pc(const struct osmo_ss7_instance *inst);
109 
111 struct osmo_sccp_instance *osmo_ss7_get_sccp(const struct osmo_ss7_instance *inst);
112 
113 uint8_t osmo_ss7_pc_width(const struct osmo_ss7_pc_fmt *pc_fmt);
114 uint32_t osmo_ss7_pc_normalize(const struct osmo_ss7_pc_fmt *pc_fmt, uint32_t pc);
115 
116 /***********************************************************************
117  * MTP Users (Users of MTP, such as SCCP or ISUP)
118  ***********************************************************************/
119 
121  /* pointer back to SS7 instance */
123  /* name of the user */
124  const char *name;
125  /* primitive call-back for incoming MTP primitives */
126  osmo_prim_cb prim_cb;
127  /* private data */
128  void *priv;
129 };
130 
131 int osmo_ss7_user_register(struct osmo_ss7_instance *inst, uint8_t service_ind,
132  struct osmo_ss7_user *user);
133 
134 int osmo_ss7_user_unregister(struct osmo_ss7_instance *inst, uint8_t service_ind,
135  struct osmo_ss7_user *user);
136 
137 int osmo_ss7_mtp_to_user(struct osmo_ss7_instance *inst, struct osmo_mtp_prim *omp);
138 
139 /* SS7 User wants to issue MTP-TRANSFER.req */
141  struct osmo_mtp_prim *omp);
142 
143 /***********************************************************************
144  * SS7 Links
145  ***********************************************************************/
146 
147 struct osmo_ss7_link;
148 
149 /***********************************************************************
150  * SS7 Linksets
151  ***********************************************************************/
152 
153 struct osmo_ss7_linkset;
154 
155 /***********************************************************************
156  * SS7 Routes
157  ***********************************************************************/
158 
159 struct osmo_ss7_route;
160 
161 struct osmo_ss7_route *
162 osmo_ss7_route_lookup(struct osmo_ss7_instance *inst, uint32_t dpc);
163 const char *osmo_ss7_route_print(const struct osmo_ss7_route *rt);
164 const char *osmo_ss7_route_name(struct osmo_ss7_route *rt, bool list_asps);
165 struct osmo_ss7_as *
167 
168 /***********************************************************************
169  * SS7 Application Servers
170  ***********************************************************************/
171 
173  uint32_t context;
174  uint32_t l_rk_id;
175 
176  uint32_t pc;
177  uint8_t si;
178  uint32_t ssn;
179  /* FIXME: more complex routing keys */
180 };
181 
183  OSMO_SS7_AS_TMOD_OVERRIDE = 0, /* default */
188 };
189 
190 extern struct value_string osmo_ss7_as_traffic_mode_vals[];
191 
192 static inline const char *
194 {
195  return get_value_string(osmo_ss7_as_traffic_mode_vals, mode);
196 }
197 
204 };
205 
206 extern struct value_string osmo_ss7_asp_protocol_vals[];
207 
208 static inline const char *
210 {
211  return get_value_string(osmo_ss7_asp_protocol_vals, mode);
212 }
213 
215 
217  OSMO_SS7_PATCH_NONE, /* no patching of SCCP */
218  OSMO_SS7_PATCH_BOTH, /* patch both OPC and DPC into SCCP addresses */
219 };
220 
221 struct osmo_ss7_as {
223  struct llist_head list;
225 
227  struct osmo_fsm_inst *fi;
228 
231 
234 
236  struct rate_ctr_group *ctrg;
237 
238  struct {
239  char *name;
240  char *description;
244  /* traffic mode was configured by VTY / config file */
246  /* traffic mode was configured by RKM (routing key management) or first ASPAC */
249  uint8_t qos_class;
250  struct {
251  uint32_t dpc;
254 
255  struct osmo_ss7_asp *asps[16];
256  uint8_t last_asp_idx_sent; /* used for load-sharing traffic mode (round robin implementation) */
257  } cfg;
258 };
259 
260 struct osmo_ss7_as *
262 struct osmo_ss7_as *
263 osmo_ss7_as_find_by_rctx(struct osmo_ss7_instance *inst, uint32_t rctx);
264 struct osmo_ss7_as *
265 osmo_ss7_as_find_by_l_rk_id(struct osmo_ss7_instance *inst, uint32_t l_rk_id);
268 struct osmo_ss7_as *
271 int osmo_ss7_as_add_asp(struct osmo_ss7_as *as, const char *asp_name);
272 int osmo_ss7_as_del_asp(struct osmo_ss7_as *as, const char *asp_name);
273 void osmo_ss7_as_destroy(struct osmo_ss7_as *as);
274 bool osmo_ss7_as_has_asp(const struct osmo_ss7_as *as,
275  const struct osmo_ss7_asp *asp);
276 bool osmo_ss7_as_down(const struct osmo_ss7_as *as);
277 bool osmo_ss7_as_active(const struct osmo_ss7_as *as);
278 bool osmo_ss7_as_tmode_compatible_xua(struct osmo_ss7_as *as, uint32_t m3ua_tmt);
279 void osmo_ss7_asp_disconnect(struct osmo_ss7_asp *asp);
280 
281 
282 /***********************************************************************
283  * SS7 Application Server Processes
284  ***********************************************************************/
285 
287  char *host[OSMO_SOCK_MAX_ADDRS];
288  size_t host_cnt;
289  uint16_t port;
290  /* index in "hosts" array marking the SCTP Primary Address, -1 if no explicit Primary Address set */
292 };
293 
301 };
302 
307 };
308 
309 extern const struct value_string osmo_ss7_asp_role_names[];
310 
311 struct osmo_ss7_asp {
313  struct llist_head list;
315 
317  struct osmo_fsm_inst *fi;
318 
321  struct llist_head siblings;
322 
324  struct osmo_stream_cli *client;
325  struct osmo_stream_srv *server;
327  char *sock_name;
328 
329  /* ASP Identifier for ASP-UP + NTFY */
330  uint32_t asp_id;
332 
333  /* Layer Manager to which we talk */
334  const struct osmo_xua_layer_manager *lm;
335  void *lm_priv;
336 
339 
342 
344  struct rate_ctr_group *ctrg;
345 
347  struct msgb *pending_msg;
348 
349  struct {
350  char *name;
351  char *description;
354  bool is_server;
355  enum osmo_ss7_asp_role role;
358 
359  struct osmo_ss7_asp_peer local;
360  struct osmo_ss7_asp_peer remote;
361  uint8_t qos_class;
362  uint32_t quirks;
363 
364  /* T_defs used by the default_lm: */
365  struct osmo_tdef *T_defs_lm;
366 
367  struct {
375  uint16_t max_init_timeo_value; /* ms */
377 
380  } cfg;
381 };
382 
384 #define OSMO_SS7_ASP_QUIRK_NO_NOTIFY 0x00000001
386 #define OSMO_SS7_ASP_QUIRK_DAUD_IN_ASP 0x00000002
388 #define OSMO_SS7_ASP_QUIRK_SNM_INACTIVE 0x00000004
389 
390 int osmo_ss7_asp_peer_snprintf(char* buf, size_t buf_len, struct osmo_ss7_asp_peer *peer);
391 void osmo_ss7_asp_peer_init(struct osmo_ss7_asp_peer *peer);
392 int osmo_ss7_asp_peer_set_hosts(struct osmo_ss7_asp_peer *peer, void *talloc_ctx,
393  const char *const*hosts, size_t host_cnt);
394 int osmo_ss7_asp_peer_set_hosts2(struct osmo_ss7_asp_peer *peer, void *talloc_ctx,
395  const char *const*hosts, size_t host_cnt, int idx_primary);
396 int osmo_ss7_asp_peer_add_host(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *host);
397 int osmo_ss7_asp_peer_add_host2(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *host, bool is_primary_addr);
398 int osmo_ss7_asp_peer_del_host(struct osmo_ss7_asp_peer *peer, const char *host);
399 
400 
401 struct osmo_ss7_asp *
403 struct osmo_ss7_asp *
406 struct osmo_ss7_asp *
407 osmo_ss7_asp_find(struct osmo_ss7_instance *inst, const char *name,
408  uint16_t remote_port, uint16_t local_port,
410  OSMO_DEPRECATED("Use osmo_ss7_asp_find2() instead");
411 struct osmo_ss7_asp *
412 osmo_ss7_asp_find2(struct osmo_ss7_instance *inst, const char *name,
413  uint16_t remote_port, uint16_t local_port,
415 struct osmo_ss7_asp *
417  uint16_t remote_port, uint16_t local_port,
419  OSMO_DEPRECATED("Use osmo_ss7_asp_find_or_create2() instead");
420 struct osmo_ss7_asp *
422  uint16_t remote_port, uint16_t local_port,
424 void osmo_ss7_asp_destroy(struct osmo_ss7_asp *asp);
425 int osmo_ss7_asp_send(struct osmo_ss7_asp *asp, struct msgb *msg);
426 int osmo_ss7_asp_restart(struct osmo_ss7_asp *asp);
427 int osmo_ss7_asp_use_default_lm(struct osmo_ss7_asp *asp, int log_level);
428 bool osmo_ss7_asp_active(const struct osmo_ss7_asp *asp);
429 int osmo_ss7_asp_get_log_subsys(const struct osmo_ss7_asp *asp);
430 const char *osmo_ss7_asp_get_name(const struct osmo_ss7_asp *asp);
432 int osmo_ss7_asp_get_trans_proto(const struct osmo_ss7_asp *asp);
433 
441 typedef int osmo_ss7_asp_rx_unknown_cb(struct osmo_ss7_asp *asp, int ppid_mux, struct msgb *msg);
442 
444 
445 
446 struct osmo_sccp_instance *
447 osmo_sccp_simple_client(void *ctx, const char *name, uint32_t default_pc,
448  enum osmo_ss7_asp_protocol prot, int default_local_port,
449  const char *default_local_ip, int default_remote_port,
450  const char *default_remote_ip);
451 
452 struct osmo_sccp_instance *
453 osmo_sccp_simple_client_on_ss7_id(void *ctx, uint32_t ss7_id, const char *name,
454  uint32_t default_pc,
455  enum osmo_ss7_asp_protocol prot,
456  int default_local_port,
457  const char *default_local_ip,
458  int default_remote_port,
459  const char *default_remote_ip);
460 
461 struct osmo_sccp_instance *
462 osmo_sccp_simple_server(void *ctx, uint32_t pc,
463  enum osmo_ss7_asp_protocol prot, int local_port,
464  const char *local_ip);
465 
466 struct osmo_sccp_instance *
467 osmo_sccp_simple_server_on_ss7_id(void *ctx, uint32_t ss7_id, uint32_t pc,
468  enum osmo_ss7_asp_protocol prot,
469  int local_port, const char *local_ip);
470 
471 struct osmo_sccp_instance *
473  enum osmo_ss7_asp_protocol prot,
474  const char *name, uint32_t pc,
475  int local_port, int remote_port,
476  const char *remote_ip);
477 
478 void osmo_sccp_set_max_optional_data(struct osmo_sccp_instance *inst, int val);
479 
482 
483 /* VTY related */
484 struct vty;
485 void osmo_ss7_vty_init_asp(void *ctx);
486 void osmo_ss7_vty_init_sg(void *ctx);
487 int osmo_ss7_vty_go_parent(struct vty *vty);
488 int osmo_ss7_is_config_node(struct vty *vty, int node);
uint32_t dpc
Definition: m3ua.h:1
int osmo_ss7_as_add_asp(struct osmo_ss7_as *as, const char *asp_name)
Add given ASP to given AS.
Definition: osmo_ss7_as.c:102
const struct osmo_ss7_pc_fmt * osmo_ss7_instance_get_pc_fmt(const struct osmo_ss7_instance *inst)
Definition: osmo_ss7.c:438
int osmo_ss7_pointcode_parse_mask_or_len(const struct osmo_ss7_instance *inst, const char *in)
Definition: osmo_ss7.c:290
void osmo_sccp_set_max_optional_data(struct osmo_sccp_instance *inst, int val)
Adjust the upper bound for the optional data length (the payload) for CR, CC, CREF and RLSD messages.
Definition: sccp_user.c:892
osmo_ss7_as_patch_sccp_mode
Definition: osmo_ss7.h:216
@ OSMO_SS7_PATCH_BOTH
Definition: osmo_ss7.h:218
@ OSMO_SS7_PATCH_NONE
Definition: osmo_ss7.h:217
struct osmo_ss7_as * osmo_ss7_route_get_dest_as(struct osmo_ss7_route *rt)
Get destination AS of route.
Definition: osmo_ss7_route.c:310
const char * osmo_ss7_pointcode_print2(const struct osmo_ss7_instance *inst, uint32_t pc)
Definition: osmo_ss7.c:284
bool osmo_ss7_pc_is_local(const struct osmo_ss7_instance *inst, uint32_t pc)
Definition: osmo_ss7.c:783
int osmo_ss7_asp_get_trans_proto(const struct osmo_ss7_asp *asp)
Get the transport proto of a given ASP.
Definition: osmo_ss7_asp.c:1228
void osmo_ss7_vty_init_sg(void *ctx)
Definition: osmo_ss7_vty.c:3114
int osmo_ss7_asp_peer_add_host2(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *host, bool is_primary_addr)
Append (copy) address to a given ASP peer.
Definition: osmo_ss7_asp_peer.c:142
uint32_t osmo_ss7_instance_get_primary_pc(const struct osmo_ss7_instance *inst)
Definition: osmo_ss7.c:414
int osmo_ss7_user_register(struct osmo_ss7_instance *inst, uint8_t service_ind, struct osmo_ss7_user *user)
Register a MTP user for a given service indicator.
Definition: osmo_ss7.c:473
struct osmo_ss7_asp * osmo_ss7_asp_find_or_create(struct osmo_ss7_instance *inst, const char *name, uint16_t remote_port, uint16_t local_port, enum osmo_ss7_asp_protocol proto) OSMO_DEPRECATED("Use osmo_ss7_asp_find_or_create2() instead")
Definition: osmo_ss7.c:772
static bool osmo_ss7_pc_is_valid(uint32_t pc)
Definition: osmo_ss7.h:38
int osmo_ss7_pointcode_parse(const struct osmo_ss7_instance *inst, const char *str)
Definition: osmo_ss7.c:218
uint32_t osmo_ss7_instance_get_id(const struct osmo_ss7_instance *inst)
Definition: osmo_ss7.c:404
struct osmo_ss7_asp * osmo_ss7_asp_find_by_proto(struct osmo_ss7_as *as, enum osmo_ss7_asp_protocol proto)
Find an ASP that matches the given ASP protocol (xUA variant).
Definition: osmo_ss7.c:702
osmo_ss7_asp_protocol
Definition: osmo_ss7.h:198
@ OSMO_SS7_ASP_PROT_SUA
Definition: osmo_ss7.h:200
@ OSMO_SS7_ASP_PROT_NONE
Definition: osmo_ss7.h:199
@ OSMO_SS7_ASP_PROT_IPA
Definition: osmo_ss7.h:202
@ OSMO_SS7_ASP_PROT_M3UA
Definition: osmo_ss7.h:201
@ _NUM_OSMO_SS7_ASP_PROT
Definition: osmo_ss7.h:203
struct value_string osmo_ss7_asp_protocol_vals[]
Definition: osmo_ss7_asp.c:117
struct value_string osmo_ss7_as_traffic_mode_vals[]
Definition: osmo_ss7_as.c:46
int osmo_ss7_tmode_to_xua(enum osmo_ss7_as_traffic_mode tmod)
Definition: osmo_ss7.c:820
enum osmo_ss7_asp_protocol osmo_ss7_asp_get_proto(const struct osmo_ss7_asp *asp)
Get the proto of a given ASP.
Definition: osmo_ss7_asp.c:1219
int osmo_ss7_user_unregister(struct osmo_ss7_instance *inst, uint8_t service_ind, struct osmo_ss7_user *user)
Unregister a MTP user for a given service indicator.
Definition: osmo_ss7.c:497
osmo_ss7_asp_role
Definition: osmo_ss7.h:303
@ OSMO_SS7_ASP_ROLE_SG
Definition: osmo_ss7.h:305
@ OSMO_SS7_ASP_ROLE_ASP
Definition: osmo_ss7.h:304
@ OSMO_SS7_ASP_ROLE_IPSP
Definition: osmo_ss7.h:306
int osmo_ss7_asp_send(struct osmo_ss7_asp *asp, struct msgb *msg)
send a fully encoded msgb via a given ASP
Definition: osmo_ss7_asp.c:1111
int osmo_ss7_asp_peer_del_host(struct osmo_ss7_asp_peer *peer, const char *host)
Remove address from a given ASP peer.
Definition: osmo_ss7_asp_peer.c:215
int osmo_ss7_mtp_to_user(struct osmo_ss7_instance *inst, struct osmo_mtp_prim *omp)
Definition: osmo_ss7.c:517
struct osmo_sccp_instance * osmo_sccp_simple_client_on_ss7_id(void *ctx, uint32_t ss7_id, const char *name, uint32_t default_pc, enum osmo_ss7_asp_protocol prot, int default_local_port, const char *default_local_ip, int default_remote_port, const char *default_remote_ip)
request an sccp client instance
Definition: sccp_user.c:504
void osmo_ss7_instance_destroy(struct osmo_ss7_instance *inst)
Destroy a SS7 Instance.
Definition: osmo_ss7.c:382
struct osmo_ss7_as * osmo_ss7_as_find_by_l_rk_id(struct osmo_ss7_instance *inst, uint32_t l_rk_id)
Find Application Server by given local routing key ID.
Definition: osmo_ss7.c:585
struct osmo_ss7_asp * osmo_ss7_asp_find_or_create2(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: osmo_ss7.c:750
int osmo_ss7_asp_rx_unknown_cb(struct osmo_ss7_asp *asp, int ppid_mux, struct msgb *msg)
Weak function to handle payload for unknown/unsupported PPID or IPA StreamID.
Definition: osmo_ss7.h:441
int osmo_ss7_asp_peer_snprintf(char *buf, size_t buf_len, struct osmo_ss7_asp_peer *peer)
Definition: osmo_ss7_asp_peer.c:53
const struct value_string osmo_ss7_asp_role_names[]
Definition: osmo_ss7_asp.c:125
osmo_ss7_asp_admin_state
Definition: osmo_ss7.h:294
@ OSMO_SS7_ASP_ADM_S_SHUTDOWN
no SCTP association with peer
Definition: osmo_ss7.h:296
@ OSMO_SS7_ASP_ADM_S_BLOCKED
SCP association, but reject ASP-ACTIVE.
Definition: osmo_ss7.h:298
@ OSMO_SS7_ASP_ADM_S_ENABLED
in normal operation
Definition: osmo_ss7.h:300
uint32_t osmo_ss7_pc_normalize(const struct osmo_ss7_pc_fmt *pc_fmt, uint32_t pc)
Definition: osmo_ss7.c:182
struct osmo_sccp_instance * osmo_ss7_get_sccp(const struct osmo_ss7_instance *inst)
Get the SCCP instance, if present.
Definition: osmo_ss7.c:459
int osmo_ss7_asp_peer_add_host(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *host)
Append (copy) address to a given ASP peer.
Definition: osmo_ss7_asp_peer.c:260
int osmo_ss7_asp_protocol_port(enum osmo_ss7_asp_protocol prot)
Definition: osmo_ss7_asp.c:176
int osmo_ss7_user_mtp_xfer_req(struct osmo_ss7_instance *inst, struct osmo_mtp_prim *omp)
Definition: osmo_ss7_hmrt.c:296
bool osmo_ss7_as_active(const struct osmo_ss7_as *as)
Determine if given AS is in the active state.
Definition: osmo_ss7_as.c:199
void osmo_ss7_asp_destroy(struct osmo_ss7_asp *asp)
Definition: osmo_ss7_asp.c:574
bool osmo_ss7_as_down(const struct osmo_ss7_as *as)
Determine if given AS is in the down state.
Definition: osmo_ss7_as.c:209
struct osmo_sccp_instance * osmo_ss7_ensure_sccp(struct osmo_ss7_instance *inst)
Allocate an SCCP instance, if not present yet.
Definition: osmo_ss7.c:445
osmo_ss7_as_traffic_mode
Definition: osmo_ss7.h:182
@ OSMO_SS7_AS_TMOD_OVERRIDE
Definition: osmo_ss7.h:183
@ _NUM_OSMO_SS7_ASP_TMOD
Definition: osmo_ss7.h:187
@ OSMO_SS7_AS_TMOD_ROUNDROBIN
Definition: osmo_ss7.h:186
@ OSMO_SS7_AS_TMOD_BCAST
Definition: osmo_ss7.h:184
@ OSMO_SS7_AS_TMOD_LOADSHARE
Definition: osmo_ss7.h:185
struct osmo_ss7_instance * osmo_ss7_instance_find_or_create(void *ctx, uint32_t id)
Find or create a SS7 Instance.
Definition: osmo_ss7.c:368
struct osmo_ss7_asp * osmo_ss7_asp_find(struct osmo_ss7_instance *inst, const char *name, uint16_t remote_port, uint16_t local_port, enum osmo_ss7_asp_protocol proto) OSMO_DEPRECATED("Use osmo_ss7_asp_find2() instead")
Definition: osmo_ss7.c:738
struct osmo_ss7_asp * osmo_ss7_asp_find2(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: osmo_ss7.c:716
bool osmo_ss7_asp_active(const struct osmo_ss7_asp *asp)
Definition: osmo_ss7_asp.c:721
struct llist_head osmo_ss7_instances
int osmo_ss7_asp_restart(struct osmo_ss7_asp *asp)
Definition: osmo_ss7_asp.c:612
const char * osmo_ss7_asp_get_name(const struct osmo_ss7_asp *asp)
Get the name of a given ASP.
Definition: osmo_ss7_asp.c:1210
struct osmo_sccp_instance * osmo_sccp_simple_server_on_ss7_id(void *ctx, uint32_t ss7_id, uint32_t pc, enum osmo_ss7_asp_protocol prot, int local_port, const char *local_ip)
Definition: sccp_user.c:759
uint8_t osmo_ss7_pc_width(const struct osmo_ss7_pc_fmt *pc_fmt)
Definition: osmo_ss7.c:174
int osmo_ss7_init(void)
Definition: osmo_ss7.c:794
void osmo_ss7_register_rx_unknown_cb(osmo_ss7_asp_rx_unknown_cb *cb)
Register a call-back function for unknown SCTP PPID / IPA Stream ID.
Definition: osmo_ss7_asp.c:1168
struct osmo_ss7_as * osmo_ss7_as_find_or_create(struct osmo_ss7_instance *inst, const char *name, enum osmo_ss7_asp_protocol proto)
Find or Create Application Server.
Definition: osmo_ss7.c:637
struct osmo_sccp_instance * osmo_sccp_simple_client(void *ctx, const char *name, uint32_t default_pc, enum osmo_ss7_asp_protocol prot, int default_local_port, const char *default_local_ip, int default_remote_port, const char *default_remote_ip)
request an sccp client instance
Definition: sccp_user.c:738
struct osmo_ss7_asp * osmo_ss7_asp_find_by_name(struct osmo_ss7_instance *inst, const char *name)
Definition: osmo_ss7.c:685
struct osmo_ss7_as * osmo_ss7_as_find_by_rctx(struct osmo_ss7_instance *inst, uint32_t rctx)
Find Application Server by given routing context.
Definition: osmo_ss7.c:568
struct osmo_ss7_as * osmo_ss7_as_find_by_name(struct osmo_ss7_instance *inst, const char *name)
Find Application Server by given name.
Definition: osmo_ss7.c:551
int osmo_ss7_asp_peer_set_hosts2(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *const *hosts, size_t host_cnt, int idx_primary)
Set (copy) addresses for a given ASP peer.
Definition: osmo_ss7_asp_peer.c:93
struct osmo_sccp_instance * osmo_sccp_simple_server(void *ctx, uint32_t pc, enum osmo_ss7_asp_protocol prot, int local_port, const char *local_ip)
Definition: sccp_user.c:803
static const char * osmo_ss7_asp_protocol_name(enum osmo_ss7_asp_protocol mode)
Definition: osmo_ss7.h:209
int osmo_ss7_vty_go_parent(struct vty *vty)
Definition: osmo_ss7_vty.c:2920
bool osmo_ss7_as_has_asp(const struct osmo_ss7_as *as, const struct osmo_ss7_asp *asp)
Determine if given AS contains ASP.
Definition: osmo_ss7_as.c:183
const char * osmo_ss7_instance_get_name(const struct osmo_ss7_instance *inst)
Definition: osmo_ss7.c:409
int osmo_ss7_is_config_node(struct vty *vty, int node)
Definition: osmo_ss7_vty.c:2974
const char * osmo_ss7_route_print(const struct osmo_ss7_route *rt)
Definition: osmo_ss7_route.c:282
const char * osmo_ss7_route_name(struct osmo_ss7_route *rt, bool list_asps)
Return human readable representation of the route, in a static buffer.
Definition: osmo_ss7_hmrt.c:153
int osmo_ss7_as_del_asp(struct osmo_ss7_as *as, const char *asp_name)
Delete given ASP from given AS.
Definition: osmo_ss7_as.c:133
struct osmo_ss7_instance * osmo_ss7_instance_find(uint32_t id)
Find a SS7 Instance with given ID.
Definition: osmo_ss7.c:316
const char * osmo_ss7_pointcode_print(const struct osmo_ss7_instance *inst, uint32_t pc)
Definition: osmo_ss7.c:276
int osmo_ss7_find_free_rctx(struct osmo_ss7_instance *inst)
Definition: osmo_ss7.c:85
int osmo_ss7_instance_set_pc_fmt(struct osmo_ss7_instance *inst, uint8_t c0, uint8_t c1, uint8_t c2)
Set the point code format used in given SS7 instance.
Definition: osmo_ss7.c:420
static const char * osmo_ss7_as_traffic_mode_name(enum osmo_ss7_as_traffic_mode mode)
Definition: osmo_ss7.h:193
bool osmo_ss7_as_tmode_compatible_xua(struct osmo_ss7_as *as, uint32_t m3ua_tmt)
Definition: osmo_ss7.c:848
struct osmo_ss7_as * osmo_ss7_as_find_by_proto(struct osmo_ss7_instance *inst, enum osmo_ss7_asp_protocol proto)
Find Application Server (AS) by given protocol.
Definition: osmo_ss7.c:603
int osmo_ss7_asp_get_log_subsys(const struct osmo_ss7_asp *asp)
Get the logging subsystem for a given ASP.
Definition: osmo_ss7_asp.c:1194
void osmo_ss7_asp_peer_init(struct osmo_ss7_asp_peer *peer)
Definition: osmo_ss7_asp_peer.c:47
const char * osmo_ss7_pointcode_print_buf(char *buf, size_t buf_len, const struct osmo_ss7_instance *inst, uint32_t pc)
Definition: osmo_ss7.c:252
void osmo_ss7_asp_disconnect(struct osmo_ss7_asp *asp)
Definition: osmo_ss7_asp.c:1156
enum osmo_ss7_as_traffic_mode osmo_ss7_tmode_from_xua(uint32_t in)
Definition: osmo_ss7.c:834
int osmo_ss7_asp_use_default_lm(struct osmo_ss7_asp *asp, int log_level)
Definition: xua_default_lm_fsm.c:414
void osmo_ss7_vty_init_asp(void *ctx)
Definition: osmo_ss7_vty.c:3108
struct osmo_ss7_instance * osmo_ss7_instances_llist_entry(struct llist_head *list)
Definition: osmo_ss7.c:68
struct osmo_sccp_instance * osmo_sccp_simple_server_add_clnt(struct osmo_sccp_instance *inst, enum osmo_ss7_asp_protocol prot, const char *name, uint32_t pc, int local_port, int remote_port, const char *remote_ip)
Definition: sccp_user.c:812
void osmo_ss7_as_destroy(struct osmo_ss7_as *as)
Destroy given Application Server.
Definition: osmo_ss7_as.c:157
int osmo_ss7_asp_peer_set_hosts(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *const *hosts, size_t host_cnt)
Set (copy) addresses for a given ASP peer.
Definition: osmo_ss7_asp_peer.c:121
struct osmo_ss7_route * osmo_ss7_route_lookup(struct osmo_ss7_instance *inst, uint32_t dpc)
Find a SS7 route for given destination point code in given SS7.
Definition: osmo_ss7_route.c:299
Definition: mtp_sap.h:56
Definition: sccp_internal.h:37
Definition: osmo_ss7.h:221
struct osmo_ss7_as::@2 cfg
struct osmo_ss7_routing_key routing_key
Definition: osmo_ss7.h:242
uint32_t recovery_timeout_msec
Definition: osmo_ss7.h:248
struct osmo_ss7_as::@2::@3 pc_override
struct llist_head list
entry in 'ref osmo_ss7_instance.as_list
Definition: osmo_ss7.h:223
char * description
Definition: osmo_ss7.h:240
bool rkm_dyn_allocated
Were we dynamically allocated by RKM?
Definition: osmo_ss7.h:230
struct rate_ctr_group * ctrg
Rate Counter Group.
Definition: osmo_ss7.h:236
struct osmo_ss7_asp * asps[16]
Definition: osmo_ss7.h:255
uint8_t last_asp_idx_sent
Definition: osmo_ss7.h:256
char * name
Definition: osmo_ss7.h:239
bool mode_set_by_vty
Definition: osmo_ss7.h:245
struct osmo_fsm_inst * fi
AS FSM.
Definition: osmo_ss7.h:227
bool simple_client_allocated
Were we allocated by "simple client" support?
Definition: osmo_ss7.h:233
uint32_t dpc
Definition: osmo_ss7.h:251
enum osmo_ss7_as_traffic_mode mode
Definition: osmo_ss7.h:243
enum osmo_ss7_asp_protocol proto
Definition: osmo_ss7.h:241
enum osmo_ss7_as_patch_sccp_mode sccp_mode
Definition: osmo_ss7.h:252
struct osmo_ss7_instance * inst
Definition: osmo_ss7.h:224
bool mode_set_by_peer
Definition: osmo_ss7.h:247
uint8_t qos_class
Definition: osmo_ss7.h:249
Definition: osmo_ss7.h:286
size_t host_cnt
Definition: osmo_ss7.h:288
uint16_t port
Definition: osmo_ss7.h:289
char * host[OSMO_SOCK_MAX_ADDRS]
Definition: osmo_ss7.h:287
int idx_primary
Definition: osmo_ss7.h:291
Definition: osmo_ss7.h:311
enum osmo_ss7_asp_role role
Definition: osmo_ss7.h:355
char * sock_name
pre-formatted human readable local/remote socket name
Definition: osmo_ss7.h:327
bool role_set_by_vty
Definition: osmo_ss7.h:356
struct osmo_ss7_asp_peer remote
Definition: osmo_ss7.h:360
bool max_attempts_present
Definition: osmo_ss7.h:370
bool max_instreams_present
Definition: osmo_ss7.h:369
struct osmo_tdef * T_defs_lm
Definition: osmo_ss7.h:365
struct osmo_fsm_inst * fi
ASP FSM.
Definition: osmo_ss7.h:317
uint16_t max_attempts_value
Definition: osmo_ss7.h:374
uint16_t max_instreams_value
Definition: osmo_ss7.h:373
struct llist_head list
entry in osmo_ss7_instance::asp_list
Definition: osmo_ss7.h:313
enum osmo_ss7_asp_protocol proto
Definition: osmo_ss7.h:352
void * lm_priv
Definition: osmo_ss7.h:335
struct osmo_ss7_instance * inst
Definition: osmo_ss7.h:314
const struct osmo_xua_layer_manager * lm
Definition: osmo_ss7.h:334
bool num_ostreams_present
Definition: osmo_ss7.h:368
struct osmo_stream_srv * server
Definition: osmo_ss7.h:325
uint32_t quirks
Definition: osmo_ss7.h:362
bool simple_client_allocated
Were we allocated by "simple client" support?
Definition: osmo_ss7.h:341
struct osmo_stream_cli * client
osmo_stream / libosmo-netif handles
Definition: osmo_ss7.h:324
bool trans_role_set_by_vty
Definition: osmo_ss7.h:357
enum osmo_ss7_asp_admin_state adm_state
Definition: osmo_ss7.h:353
struct osmo_xua_server * xua_server
osmo_xua_server over which we were established
Definition: osmo_ss7.h:320
struct osmo_ss7_asp_peer local
Definition: osmo_ss7.h:359
struct osmo_ss7_asp::@4 cfg
bool is_server
Definition: osmo_ss7.h:354
bool dyn_allocated
Were we dynamically allocated.
Definition: osmo_ss7.h:338
bool max_init_timeo_present
Definition: osmo_ss7.h:371
char * name
Definition: osmo_ss7.h:350
uint8_t qos_class
Definition: osmo_ss7.h:361
struct msgb * pending_msg
Pending message for non-blocking IPA read.
Definition: osmo_ss7.h:347
uint32_t asp_id
Definition: osmo_ss7.h:330
uint16_t num_ostreams_value
Definition: osmo_ss7.h:372
struct osmo_ss7_asp::@4::@5 sctp_init
int trans_proto
The underlaying transport protocol (one of IPPROTO_*)
Definition: osmo_ss7.h:379
char * description
Definition: osmo_ss7.h:351
bool asp_id_present
Definition: osmo_ss7.h:331
struct rate_ctr_group * ctrg
Rate Counter Group.
Definition: osmo_ss7.h:344
struct llist_head siblings
Definition: osmo_ss7.h:321
uint16_t max_init_timeo_value
Definition: osmo_ss7.h:375
Definition: osmo_ss7.h:60
struct osmo_sccp_instance * sccp
Definition: osmo_ss7.h:79
uint32_t secondary_pc
Definition: osmo_ss7.h:91
struct osmo_ss7_route_table * rtable_system
Definition: osmo_ss7.h:77
struct llist_head linksets
list of osmo_ss7_linkset
Definition: osmo_ss7.h:64
char * name
Definition: osmo_ss7.h:83
struct osmo_ss7_instance::@1 cfg
uint32_t primary_pc
Definition: osmo_ss7.h:85
struct osmo_ss7_pc_fmt pc_fmt
Definition: osmo_ss7.h:88
struct llist_head as_list
list of osmo_ss7_as
Definition: osmo_ss7.h:66
struct llist_head rtable_list
list of osmo_ss7_route_table
Definition: osmo_ss7.h:70
uint8_t network_indicator
Definition: osmo_ss7.h:87
char * description
Definition: osmo_ss7.h:84
uint32_t id
Definition: osmo_ss7.h:82
struct llist_head asp_list
list of osmo_ss7_asp
Definition: osmo_ss7.h:68
const struct osmo_ss7_user * user[16]
Definition: osmo_ss7.h:75
bool permit_dyn_rkm_alloc
Definition: osmo_ss7.h:89
struct llist_head sccp_address_book
Definition: osmo_ss7.h:90
struct llist_head list
member of global list of instances
Definition: osmo_ss7.h:62
struct llist_head xua_servers
list of osmo_xua_servers
Definition: osmo_ss7.h:72
Definition: ss7_linkset.h:13
Definition: osmo_ss7.h:55
char delimiter
Definition: osmo_ss7.h:56
uint8_t component_len[3]
Definition: osmo_ss7.h:57
Definition: ss7_route_table.h:12
struct osmo_ss7_instance * inst
osmo_ss7_instance to which we belong
Definition: ss7_route_table.h:16
Definition: ss7_route.h:17
Definition: osmo_ss7.h:172
uint8_t si
Definition: osmo_ss7.h:177
uint32_t context
Definition: osmo_ss7.h:173
uint32_t l_rk_id
Definition: osmo_ss7.h:174
uint32_t ssn
Definition: osmo_ss7.h:178
uint32_t pc
Definition: osmo_ss7.h:176
Definition: osmo_ss7.h:120
const char * name
Definition: osmo_ss7.h:124
osmo_prim_cb prim_cb
Definition: osmo_ss7.h:126
void * priv
Definition: osmo_ss7.h:128
struct osmo_ss7_instance * inst
Definition: osmo_ss7.h:122
Definition: ss7_xua_srv.h:18
Definition: ss7_xua_srv.h:22