libosmo-sigtran  2.0.0.24-f2ff.202411052026
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 extern struct llist_head osmo_ss7_instances;
15 
16 struct osmo_ss7_instance;
17 struct osmo_ss7_user;
18 struct osmo_sccp_instance;
19 struct osmo_mtp_prim;
22 
23 int osmo_ss7_init(void);
25 
26 bool osmo_ss7_pc_is_local(struct osmo_ss7_instance *inst, uint32_t pc);
27 int osmo_ss7_pointcode_parse(struct osmo_ss7_instance *inst, const char *str);
29 const char *osmo_ss7_pointcode_print_buf(char *buf, size_t buf_len, const struct osmo_ss7_instance *inst, uint32_t pc);
30 const char *osmo_ss7_pointcode_print(const struct osmo_ss7_instance *inst, uint32_t pc);
31 const char *osmo_ss7_pointcode_print2(const struct osmo_ss7_instance *inst, uint32_t pc);
32 
33 /* All known point-code formats have a length of or below 24 bit.
34  * A point-code value exceeding that is used to indicate an unset PC. */
35 #define OSMO_SS7_PC_INVALID 0xffffffff
36 static inline bool osmo_ss7_pc_is_valid(uint32_t pc)
37 {
38  return pc <= 0x00ffffff;
39 }
40 
41 /***********************************************************************
42  * SS7 Instances
43  ***********************************************************************/
44 
46  char delimiter;
47  uint8_t component_len[3];
48 };
49 
52  struct llist_head list;
54  struct llist_head linksets;
56  struct llist_head as_list;
58  struct llist_head asp_list;
60  struct llist_head rtable_list;
62  struct llist_head xua_servers;
63  /* array for faster lookup of user (indexed by service
64  * indicator) */
65  const struct osmo_ss7_user *user[16];
66 
68 
70 
71  struct {
72  uint32_t id;
73  char *name;
74  char *description;
75  uint32_t primary_pc;
76  /* capability PCs */
78  struct osmo_ss7_pc_fmt pc_fmt;
80  struct llist_head sccp_address_book;
81  uint32_t secondary_pc;
82  } cfg;
83 };
84 
85 struct osmo_ss7_instance *osmo_ss7_instance_find(uint32_t id);
86 struct osmo_ss7_instance *
87 osmo_ss7_instance_find_or_create(void *ctx, uint32_t id);
90  uint8_t c0, uint8_t c1, uint8_t c2);
91 
93 
94 uint8_t osmo_ss7_pc_width(const struct osmo_ss7_pc_fmt *pc_fmt);
95 uint32_t osmo_ss7_pc_normalize(const struct osmo_ss7_pc_fmt *pc_fmt, uint32_t pc);
96 
97 /***********************************************************************
98  * MTP Users (Users of MTP, such as SCCP or ISUP)
99  ***********************************************************************/
100 
102  /* pointer back to SS7 instance */
104  /* name of the user */
105  const char *name;
106  /* primitive call-back for incoming MTP primitives */
107  osmo_prim_cb prim_cb;
108  /* private data */
109  void *priv;
110 };
111 
112 int osmo_ss7_user_register(struct osmo_ss7_instance *inst, uint8_t service_ind,
113  struct osmo_ss7_user *user);
114 
115 int osmo_ss7_user_unregister(struct osmo_ss7_instance *inst, uint8_t service_ind,
116  struct osmo_ss7_user *user);
117 
118 int osmo_ss7_mtp_to_user(struct osmo_ss7_instance *inst, struct osmo_mtp_prim *omp);
119 
120 /* SS7 User wants to issue MTP-TRANSFER.req */
122  struct osmo_mtp_prim *omp);
123 
124 /***********************************************************************
125  * SS7 Links
126  ***********************************************************************/
127 
133 };
134 
135 struct osmo_ss7_linkset;
136 struct osmo_ss7_link;
137 
141  struct {
142  char *name;
143  char *description;
144  uint32_t id;
145 
147  } cfg;
148 };
149 
150 void osmo_ss7_link_destroy(struct osmo_ss7_link *link);
151 struct osmo_ss7_link *
152 osmo_ss7_link_find_or_create(struct osmo_ss7_linkset *lset, uint32_t id);
153 
154 /***********************************************************************
155  * SS7 Linksets
156  ***********************************************************************/
157 
159  struct llist_head list;
163  struct osmo_ss7_link *links[16];
164 
165  struct {
166  char *name;
167  char *description;
168  uint32_t adjacent_pc;
169  uint32_t local_pc;
170  } cfg;
171 };
172 
173 void osmo_ss7_linkset_destroy(struct osmo_ss7_linkset *lset);
174 struct osmo_ss7_linkset *
176 struct osmo_ss7_linkset *
177 osmo_ss7_linkset_find_or_create(struct osmo_ss7_instance *inst, const char *name, uint32_t pc);
178 
179 
180 /***********************************************************************
181  * SS7 Routes
182  ***********************************************************************/
183 
186  struct llist_head list;
189 
190  struct {
194  struct osmo_ss7_as *as;
195  } dest;
196 
197  struct {
198  /* FIXME: presence? */
199  uint32_t pc;
200  uint32_t mask;
204  uint32_t priority;
205  uint8_t qos_class;
206  } cfg;
207 };
208 
209 struct osmo_ss7_route *
210 osmo_ss7_route_lookup(struct osmo_ss7_instance *inst, uint32_t dpc);
211 struct osmo_ss7_route *
212 osmo_ss7_route_create(struct osmo_ss7_route_table *rtbl, uint32_t dpc,
213  uint32_t mask, const char *linkset_name);
214 void osmo_ss7_route_destroy(struct osmo_ss7_route *rt);
215 const char *osmo_ss7_route_print(const struct osmo_ss7_route *rt);
216 const char *osmo_ss7_route_name(struct osmo_ss7_route *rt, bool list_asps);
217 struct osmo_ss7_as *
219 
220 /***********************************************************************
221  * SS7 Application Servers
222  ***********************************************************************/
223 
225  uint32_t context;
226  uint32_t l_rk_id;
227 
228  uint32_t pc;
229  uint8_t si;
230  uint32_t ssn;
231  /* FIXME: more complex routing keys */
232 };
233 
235  OSMO_SS7_AS_TMOD_OVERRIDE = 0, /* default */
240 };
241 
242 extern struct value_string osmo_ss7_as_traffic_mode_vals[];
243 
244 static inline const char *
246 {
247  return get_value_string(osmo_ss7_as_traffic_mode_vals, mode);
248 }
249 
256 };
257 
258 extern struct value_string osmo_ss7_asp_protocol_vals[];
259 
260 static inline const char *
262 {
263  return get_value_string(osmo_ss7_asp_protocol_vals, mode);
264 }
265 
267 
269  OSMO_SS7_PATCH_NONE, /* no patching of SCCP */
270  OSMO_SS7_PATCH_BOTH, /* patch both OPC and DPC into SCCP addresses */
271 };
272 
273 struct osmo_ss7_as {
275  struct llist_head list;
277 
279  struct osmo_fsm_inst *fi;
280 
283 
286 
288  struct rate_ctr_group *ctrg;
289 
290  struct {
291  char *name;
292  char *description;
296  /* traffic mode was configured by VTY / config file */
298  /* traffic mode was configured by RKM (routing key management) or first ASPAC */
301  uint8_t qos_class;
302  struct {
303  uint32_t dpc;
306 
307  struct osmo_ss7_asp *asps[16];
308  uint8_t last_asp_idx_sent; /* used for load-sharing traffic mode (round robin implementation) */
309  } cfg;
310 };
311 
312 struct osmo_ss7_as *
314 struct osmo_ss7_as *
315 osmo_ss7_as_find_by_rctx(struct osmo_ss7_instance *inst, uint32_t rctx);
316 struct osmo_ss7_as *
317 osmo_ss7_as_find_by_l_rk_id(struct osmo_ss7_instance *inst, uint32_t l_rk_id);
320 struct osmo_ss7_as *
323 int osmo_ss7_as_add_asp(struct osmo_ss7_as *as, const char *asp_name);
324 int osmo_ss7_as_del_asp(struct osmo_ss7_as *as, const char *asp_name);
325 void osmo_ss7_as_destroy(struct osmo_ss7_as *as);
326 bool osmo_ss7_as_has_asp(const struct osmo_ss7_as *as,
327  const struct osmo_ss7_asp *asp);
328 bool osmo_ss7_as_down(const struct osmo_ss7_as *as);
329 bool osmo_ss7_as_active(const struct osmo_ss7_as *as);
330 bool osmo_ss7_as_tmode_compatible_xua(struct osmo_ss7_as *as, uint32_t m3ua_tmt);
331 void osmo_ss7_asp_disconnect(struct osmo_ss7_asp *asp);
332 
333 
334 /***********************************************************************
335  * SS7 Application Server Processes
336  ***********************************************************************/
337 
339  char *host[OSMO_SOCK_MAX_ADDRS];
340  size_t host_cnt;
341  uint16_t port;
342  /* index in "hosts" array marking the SCTP Primary Address, -1 if no explicit Primary Address set */
344 };
345 
353 };
354 
359 };
360 
361 extern const struct value_string osmo_ss7_asp_role_names[];
362 
363 struct osmo_ss7_asp {
365  struct llist_head list;
367 
369  struct osmo_fsm_inst *fi;
370 
373  struct llist_head siblings;
374 
376  struct osmo_stream_cli *client;
377  struct osmo_stream_srv *server;
379  char *sock_name;
380 
381  /* ASP Identifier for ASP-UP + NTFY */
382  uint32_t asp_id;
384 
385  /* Layer Manager to which we talk */
386  const struct osmo_xua_layer_manager *lm;
387  void *lm_priv;
388 
391 
394 
396  struct rate_ctr_group *ctrg;
397 
399  struct msgb *pending_msg;
400 
401  struct {
402  char *name;
403  char *description;
406  bool is_server;
407  enum osmo_ss7_asp_role role;
410 
411  struct osmo_ss7_asp_peer local;
412  struct osmo_ss7_asp_peer remote;
413  uint8_t qos_class;
414  uint32_t quirks;
415 
416  /* T_defs used by the default_lm: */
417  struct osmo_tdef *T_defs_lm;
418 
419  struct {
427  uint16_t max_init_timeo_value; /* ms */
429 
432  } cfg;
433 };
434 
436 #define OSMO_SS7_ASP_QUIRK_NO_NOTIFY 0x00000001
438 #define OSMO_SS7_ASP_QUIRK_DAUD_IN_ASP 0x00000002
440 #define OSMO_SS7_ASP_QUIRK_SNM_INACTIVE 0x00000004
441 
442 int osmo_ss7_asp_peer_snprintf(char* buf, size_t buf_len, struct osmo_ss7_asp_peer *peer);
443 void osmo_ss7_asp_peer_init(struct osmo_ss7_asp_peer *peer);
444 int osmo_ss7_asp_peer_set_hosts(struct osmo_ss7_asp_peer *peer, void *talloc_ctx,
445  const char *const*hosts, size_t host_cnt);
446 int osmo_ss7_asp_peer_set_hosts2(struct osmo_ss7_asp_peer *peer, void *talloc_ctx,
447  const char *const*hosts, size_t host_cnt, int idx_primary);
448 int osmo_ss7_asp_peer_add_host(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *host);
449 int osmo_ss7_asp_peer_add_host2(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *host, bool is_primary_addr);
450 int osmo_ss7_asp_peer_del_host(struct osmo_ss7_asp_peer *peer, const char *host);
451 
452 
453 struct osmo_ss7_asp *
455 struct osmo_ss7_asp *
458 struct osmo_ss7_asp *
459 osmo_ss7_asp_find(struct osmo_ss7_instance *inst, const char *name,
460  uint16_t remote_port, uint16_t local_port,
462  OSMO_DEPRECATED("Use osmo_ss7_asp_find2() instead");
463 struct osmo_ss7_asp *
464 osmo_ss7_asp_find2(struct osmo_ss7_instance *inst, const char *name,
465  uint16_t remote_port, uint16_t local_port,
467 struct osmo_ss7_asp *
469  uint16_t remote_port, uint16_t local_port,
471  OSMO_DEPRECATED("Use osmo_ss7_asp_find_or_create2() instead");
472 struct osmo_ss7_asp *
474  uint16_t remote_port, uint16_t local_port,
476 void osmo_ss7_asp_destroy(struct osmo_ss7_asp *asp);
477 int osmo_ss7_asp_send(struct osmo_ss7_asp *asp, struct msgb *msg);
478 int osmo_ss7_asp_restart(struct osmo_ss7_asp *asp);
479 int osmo_ss7_asp_use_default_lm(struct osmo_ss7_asp *asp, int log_level);
480 bool osmo_ss7_asp_active(const struct osmo_ss7_asp *asp);
481 int osmo_ss7_asp_get_log_subsys(const struct osmo_ss7_asp *asp);
482 const char *osmo_ss7_asp_get_name(const struct osmo_ss7_asp *asp);
484 int osmo_ss7_asp_get_trans_proto(const struct osmo_ss7_asp *asp);
485 
493 typedef int osmo_ss7_asp_rx_unknown_cb(struct osmo_ss7_asp *asp, int ppid_mux, struct msgb *msg);
494 
496 
497 #define _LOGSS7(inst, subsys, level, fmt, args ...) \
498  LOGP(subsys, level, "%u: " fmt, inst ? (inst)->cfg.id : 0, ## args)
499 #define LOGSS7(inst, level, fmt, args ...) _LOGSS7(inst, DLSS7, level, fmt, ## args)
500 
501 #define LOGPASP(asp, subsys, level, fmt, args ...) \
502  _LOGSS7((asp)->inst, subsys, level, "asp-%s: " fmt, (asp)->cfg.name, ## args)
503 #define LOGPAS(as, subsys, level, fmt, args ...) \
504  _LOGSS7((as)->inst, subsys, level, "as-%s: " fmt, (as)->cfg.name, ## args)
505 
506 /***********************************************************************
507  * xUA Servers
508  ***********************************************************************/
509 
511  osmo_prim_cb prim_cb;
512 };
513 
515  struct llist_head list;
517 
518  /* list of ASPs established via this server */
519  struct llist_head asp_list;
520 
521  struct osmo_stream_srv_link *server;
522 
523  struct {
525  struct osmo_ss7_asp_peer local;
527  struct {
533 
536  } cfg;
537 };
538 
539 struct osmo_xua_server *
542  uint16_t local_port)
543  OSMO_DEPRECATED("Use osmo_ss7_xua_server_find2() instead");
544 struct osmo_xua_server *
546  int trans_proto,
548  uint16_t local_port);
549 
550 struct osmo_xua_server *
553  uint16_t local_port, const char *local_host)
554  OSMO_DEPRECATED("Use osmo_ss7_xua_server_create2() instead");
555 struct osmo_xua_server *
558  uint16_t local_port, const char *local_host);
559 
560 int
562 
563 int
564 osmo_ss7_xua_server_set_local_host(struct osmo_xua_server *xs, const char *local_host);
565 int
566 osmo_ss7_xua_server_set_local_hosts(struct osmo_xua_server *xs, const char **local_hosts, size_t local_host_cnt);
567 int osmo_ss7_xua_server_add_local_host(struct osmo_xua_server *xs, const char *local_host);
568 int osmo_ss7_xua_server_del_local_host(struct osmo_xua_server *xs, const char *local_host);
570 
571 struct osmo_sccp_instance *
572 osmo_sccp_simple_client(void *ctx, const char *name, uint32_t default_pc,
573  enum osmo_ss7_asp_protocol prot, int default_local_port,
574  const char *default_local_ip, int default_remote_port,
575  const char *default_remote_ip);
576 
577 struct osmo_sccp_instance *
578 osmo_sccp_simple_client_on_ss7_id(void *ctx, uint32_t ss7_id, const char *name,
579  uint32_t default_pc,
580  enum osmo_ss7_asp_protocol prot,
581  int default_local_port,
582  const char *default_local_ip,
583  int default_remote_port,
584  const char *default_remote_ip);
585 
586 struct osmo_sccp_instance *
587 osmo_sccp_simple_server(void *ctx, uint32_t pc,
588  enum osmo_ss7_asp_protocol prot, int local_port,
589  const char *local_ip);
590 
591 struct osmo_sccp_instance *
592 osmo_sccp_simple_server_on_ss7_id(void *ctx, uint32_t ss7_id, uint32_t pc,
593  enum osmo_ss7_asp_protocol prot,
594  int local_port, const char *local_ip);
595 
596 struct osmo_sccp_instance *
598  enum osmo_ss7_asp_protocol prot,
599  const char *name, uint32_t pc,
600  int local_port, int remote_port,
601  const char *remote_ip);
602 
603 void osmo_sccp_set_max_optional_data(struct osmo_sccp_instance *inst, int val);
604 
607 
608 /* VTY related */
609 struct vty;
610 void osmo_ss7_vty_init_asp(void *ctx);
611 void osmo_ss7_vty_init_sg(void *ctx);
612 int osmo_ss7_vty_go_parent(struct vty *vty);
613 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:101
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:890
osmo_ss7_as_patch_sccp_mode
Definition: osmo_ss7.h:268
@ OSMO_SS7_PATCH_BOTH
Definition: osmo_ss7.h:270
@ OSMO_SS7_PATCH_NONE
Definition: osmo_ss7.h:269
struct osmo_ss7_as * osmo_ss7_route_get_dest_as(struct osmo_ss7_route *rt)
Get destination AS of route.
Definition: osmo_ss7.c:890
const char * osmo_ss7_pointcode_print2(const struct osmo_ss7_instance *inst, uint32_t pc)
Definition: osmo_ss7.c:272
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:1227
void osmo_ss7_vty_init_sg(void *ctx)
Definition: osmo_ss7_vty.c:3112
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
int osmo_ss7_pointcode_parse_mask_or_len(struct osmo_ss7_instance *inst, const char *in)
Definition: osmo_ss7.c:278
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:424
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:1125
static bool osmo_ss7_pc_is_valid(uint32_t pc)
Definition: osmo_ss7.h:36
void osmo_ss7_xua_server_destroy(struct osmo_xua_server *xs)
Definition: osmo_ss7_xua_srv.c:359
void osmo_ss7_route_destroy(struct osmo_ss7_route *rt)
Destroy a given SS7 route.
Definition: osmo_ss7.c:826
struct osmo_xua_server * osmo_ss7_xua_server_find(struct osmo_ss7_instance *inst, enum osmo_ss7_asp_protocol proto, uint16_t local_port) OSMO_DEPRECATED("Use osmo_ss7_xua_server_find2() instead")
find an xUA server with the given parameters
Definition: osmo_ss7.c:1172
int osmo_ss7_xua_server_add_local_host(struct osmo_xua_server *xs, const char *local_host)
Definition: osmo_ss7_xua_srv.c:324
struct osmo_xua_server * osmo_ss7_xua_server_find2(struct osmo_ss7_instance *inst, int trans_proto, enum osmo_ss7_asp_protocol proto, uint16_t local_port)
find an xUA server with the given parameters
Definition: osmo_ss7.c:1144
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:1055
osmo_ss7_asp_protocol
Definition: osmo_ss7.h:250
@ OSMO_SS7_ASP_PROT_SUA
Definition: osmo_ss7.h:252
@ OSMO_SS7_ASP_PROT_NONE
Definition: osmo_ss7.h:251
@ OSMO_SS7_ASP_PROT_IPA
Definition: osmo_ss7.h:254
@ OSMO_SS7_ASP_PROT_M3UA
Definition: osmo_ss7.h:253
@ _NUM_OSMO_SS7_ASP_PROT
Definition: osmo_ss7.h:255
struct value_string osmo_ss7_asp_protocol_vals[]
Definition: osmo_ss7_asp.c:116
struct value_string osmo_ss7_as_traffic_mode_vals[]
Definition: osmo_ss7_as.c:45
int osmo_ss7_tmode_to_xua(enum osmo_ss7_as_traffic_mode tmod)
Definition: osmo_ss7.c:1218
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:1218
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:448
osmo_ss7_asp_role
Definition: osmo_ss7.h:355
@ OSMO_SS7_ASP_ROLE_SG
Definition: osmo_ss7.h:357
@ OSMO_SS7_ASP_ROLE_ASP
Definition: osmo_ss7.h:356
@ OSMO_SS7_ASP_ROLE_IPSP
Definition: osmo_ss7.h:358
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:1110
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:468
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:502
struct osmo_xua_server * osmo_ss7_xua_server_create2(struct osmo_ss7_instance *inst, int trans_proto, enum osmo_ss7_asp_protocol proto, uint16_t local_port, const char *local_host)
create a new xUA server configured with given ip/port
Definition: osmo_ss7_xua_srv.c:199
void osmo_ss7_instance_destroy(struct osmo_ss7_instance *inst)
Destroy a SS7 Instance.
Definition: osmo_ss7.c:363
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:938
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:1103
int osmo_ss7_pointcode_parse(struct osmo_ss7_instance *inst, const char *str)
Definition: osmo_ss7.c:206
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:493
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:124
osmo_ss7_asp_admin_state
Definition: osmo_ss7.h:346
@ OSMO_SS7_ASP_ADM_S_SHUTDOWN
no SCTP association with peer
Definition: osmo_ss7.h:348
@ OSMO_SS7_ASP_ADM_S_BLOCKED
SCP association, but reject ASP-ACTIVE.
Definition: osmo_ss7.h:350
@ OSMO_SS7_ASP_ADM_S_ENABLED
in normal operation
Definition: osmo_ss7.h:352
uint32_t osmo_ss7_pc_normalize(const struct osmo_ss7_pc_fmt *pc_fmt, uint32_t pc)
Definition: osmo_ss7.c:170
int osmo_ss7_xua_server_set_local_hosts(struct osmo_xua_server *xs, const char **local_hosts, size_t local_host_cnt)
Definition: osmo_ss7_xua_srv.c:312
osmo_ss7_link_adm_state
Definition: osmo_ss7.h:128
@ OSMO_SS7_LS_ENABLED
Definition: osmo_ss7.h:131
@ OSMO_SS7_LS_INHIBITED
Definition: osmo_ss7.h:130
@ OSMO_SS7_LS_SHUTDOWN
Definition: osmo_ss7.h:129
@ _NUM_OSMO_SS7_LS
Definition: osmo_ss7.h:132
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:175
int osmo_ss7_user_mtp_xfer_req(struct osmo_ss7_instance *inst, struct osmo_mtp_prim *omp)
Definition: osmo_ss7_hmrt.c:294
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:198
void osmo_ss7_asp_destroy(struct osmo_ss7_asp *asp)
Definition: osmo_ss7_asp.c:573
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:208
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:405
osmo_ss7_as_traffic_mode
Definition: osmo_ss7.h:234
@ OSMO_SS7_AS_TMOD_OVERRIDE
Definition: osmo_ss7.h:235
@ _NUM_OSMO_SS7_ASP_TMOD
Definition: osmo_ss7.h:239
@ OSMO_SS7_AS_TMOD_ROUNDROBIN
Definition: osmo_ss7.h:238
@ OSMO_SS7_AS_TMOD_BCAST
Definition: osmo_ss7.h:236
@ OSMO_SS7_AS_TMOD_LOADSHARE
Definition: osmo_ss7.h:237
struct osmo_ss7_route * osmo_ss7_route_create(struct osmo_ss7_route_table *rtbl, uint32_t dpc, uint32_t mask, const char *linkset_name)
Create a new route in the given routing table.
Definition: osmo_ss7.c:800
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:321
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:1091
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:1069
bool osmo_ss7_asp_active(const struct osmo_ss7_asp *asp)
Definition: osmo_ss7_asp.c:720
void osmo_ss7_link_destroy(struct osmo_ss7_link *link)
Destroy SS7 Link.
Definition: osmo_ss7.c:573
struct osmo_ss7_link * osmo_ss7_link_find_or_create(struct osmo_ss7_linkset *lset, uint32_t id)
Find or create SS7 Link with given ID in given Linkset.
Definition: osmo_ss7.c:590
struct llist_head osmo_ss7_instances
int osmo_ss7_asp_restart(struct osmo_ss7_asp *asp)
Definition: osmo_ss7_asp.c:611
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:1209
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:757
uint8_t osmo_ss7_pc_width(const struct osmo_ss7_pc_fmt *pc_fmt)
Definition: osmo_ss7.c:162
int osmo_ss7_xua_server_del_local_host(struct osmo_xua_server *xs, const char *local_host)
Definition: osmo_ss7_xua_srv.c:335
struct osmo_ss7_linkset * osmo_ss7_linkset_find_or_create(struct osmo_ss7_instance *inst, const char *name, uint32_t pc)
Find or allocate SS7 Linkset.
Definition: osmo_ss7.c:546
int osmo_ss7_init(void)
Definition: osmo_ss7.c:1192
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:1167
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:990
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:736
struct osmo_ss7_asp * osmo_ss7_asp_find_by_name(struct osmo_ss7_instance *inst, const char *name)
Definition: osmo_ss7.c:1038
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:921
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:904
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_xua_server * osmo_ss7_xua_server_create(struct osmo_ss7_instance *inst, enum osmo_ss7_asp_protocol proto, uint16_t local_port, const char *local_host) OSMO_DEPRECATED("Use osmo_ss7_xua_server_create2() instead")
create a new xUA server configured with given ip/port
Definition: osmo_ss7_xua_srv.c:258
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:801
static const char * osmo_ss7_asp_protocol_name(enum osmo_ss7_asp_protocol mode)
Definition: osmo_ss7.h:261
int osmo_ss7_vty_go_parent(struct vty *vty)
Definition: osmo_ss7_vty.c:2918
int osmo_ss7_xua_server_bind(struct osmo_xua_server *xs)
Set the xUA server to bind/listen to the currently configured ip/port.
Definition: osmo_ss7_xua_srv.c:273
void osmo_ss7_linkset_destroy(struct osmo_ss7_linkset *lset)
Destroy a SS7 Linkset.
Definition: osmo_ss7.c:499
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:182
int osmo_ss7_is_config_node(struct vty *vty, int node)
Definition: osmo_ss7_vty.c:2972
const char * osmo_ss7_route_print(const struct osmo_ss7_route *rt)
Definition: osmo_ss7.c:870
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:151
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:132
struct osmo_ss7_instance * osmo_ss7_instance_find(uint32_t id)
Find a SS7 Instance with given ID.
Definition: osmo_ss7.c:304
const char * osmo_ss7_pointcode_print(const struct osmo_ss7_instance *inst, uint32_t pc)
Definition: osmo_ss7.c:264
int osmo_ss7_find_free_rctx(struct osmo_ss7_instance *inst)
Definition: osmo_ss7.c:73
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:386
static const char * osmo_ss7_as_traffic_mode_name(enum osmo_ss7_as_traffic_mode mode)
Definition: osmo_ss7.h:245
bool osmo_ss7_as_tmode_compatible_xua(struct osmo_ss7_as *as, uint32_t m3ua_tmt)
Definition: osmo_ss7.c:1246
bool osmo_ss7_pc_is_local(struct osmo_ss7_instance *inst, uint32_t pc)
Definition: osmo_ss7.c:1181
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:956
int osmo_ss7_xua_server_set_local_host(struct osmo_xua_server *xs, const char *local_host)
Definition: osmo_ss7_xua_srv.c:306
struct osmo_ss7_linkset * osmo_ss7_linkset_find_by_name(struct osmo_ss7_instance *inst, const char *name)
Find SS7 Linkset by given name.
Definition: osmo_ss7.c:529
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:1193
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:240
void osmo_ss7_asp_disconnect(struct osmo_ss7_asp *asp)
Definition: osmo_ss7_asp.c:1155
enum osmo_ss7_as_traffic_mode osmo_ss7_tmode_from_xua(uint32_t in)
Definition: osmo_ss7.c:1232
int osmo_ss7_asp_use_default_lm(struct osmo_ss7_asp *asp, int log_level)
Definition: xua_default_lm_fsm.c:413
void osmo_ss7_vty_init_asp(void *ctx)
Definition: osmo_ss7_vty.c:3106
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:810
void osmo_ss7_as_destroy(struct osmo_ss7_as *as)
Destroy given Application Server.
Definition: osmo_ss7_as.c:156
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.c:715
Definition: mtp_sap.h:56
Definition: sccp_internal.h:37
Definition: osmo_ss7.h:273
struct osmo_ss7_routing_key routing_key
Definition: osmo_ss7.h:294
uint32_t recovery_timeout_msec
Definition: osmo_ss7.h:300
struct llist_head list
entry in 'ref osmo_ss7_instance.as_list
Definition: osmo_ss7.h:275
char * description
Definition: osmo_ss7.h:292
bool rkm_dyn_allocated
Were we dynamically allocated by RKM?
Definition: osmo_ss7.h:282
struct rate_ctr_group * ctrg
Rate Counter Group.
Definition: osmo_ss7.h:288
struct osmo_ss7_asp * asps[16]
Definition: osmo_ss7.h:307
uint8_t last_asp_idx_sent
Definition: osmo_ss7.h:308
char * name
Definition: osmo_ss7.h:291
struct osmo_ss7_as::@6 cfg
bool mode_set_by_vty
Definition: osmo_ss7.h:297
struct osmo_fsm_inst * fi
AS FSM.
Definition: osmo_ss7.h:279
bool simple_client_allocated
Were we allocated by "simple client" support?
Definition: osmo_ss7.h:285
uint32_t dpc
Definition: osmo_ss7.h:303
enum osmo_ss7_as_traffic_mode mode
Definition: osmo_ss7.h:295
enum osmo_ss7_asp_protocol proto
Definition: osmo_ss7.h:293
enum osmo_ss7_as_patch_sccp_mode sccp_mode
Definition: osmo_ss7.h:304
struct osmo_ss7_instance * inst
Definition: osmo_ss7.h:276
struct osmo_ss7_as::@6::@7 pc_override
bool mode_set_by_peer
Definition: osmo_ss7.h:299
uint8_t qos_class
Definition: osmo_ss7.h:301
Definition: osmo_ss7.h:338
size_t host_cnt
Definition: osmo_ss7.h:340
uint16_t port
Definition: osmo_ss7.h:341
char * host[OSMO_SOCK_MAX_ADDRS]
Definition: osmo_ss7.h:339
int idx_primary
Definition: osmo_ss7.h:343
Definition: osmo_ss7.h:363
enum osmo_ss7_asp_role role
Definition: osmo_ss7.h:407
char * sock_name
pre-formatted human readable local/remote socket name
Definition: osmo_ss7.h:379
bool role_set_by_vty
Definition: osmo_ss7.h:408
struct osmo_ss7_asp_peer remote
Definition: osmo_ss7.h:412
bool max_attempts_present
Definition: osmo_ss7.h:422
bool max_instreams_present
Definition: osmo_ss7.h:421
struct osmo_tdef * T_defs_lm
Definition: osmo_ss7.h:417
struct osmo_fsm_inst * fi
ASP FSM.
Definition: osmo_ss7.h:369
uint16_t max_attempts_value
Definition: osmo_ss7.h:426
uint16_t max_instreams_value
Definition: osmo_ss7.h:425
struct llist_head list
entry in osmo_ss7_instance::asp_list
Definition: osmo_ss7.h:365
enum osmo_ss7_asp_protocol proto
Definition: osmo_ss7.h:404
void * lm_priv
Definition: osmo_ss7.h:387
struct osmo_ss7_instance * inst
Definition: osmo_ss7.h:366
const struct osmo_xua_layer_manager * lm
Definition: osmo_ss7.h:386
bool num_ostreams_present
Definition: osmo_ss7.h:420
struct osmo_stream_srv * server
Definition: osmo_ss7.h:377
uint32_t quirks
Definition: osmo_ss7.h:414
bool simple_client_allocated
Were we allocated by "simple client" support?
Definition: osmo_ss7.h:393
struct osmo_stream_cli * client
osmo_stream / libosmo-netif handles
Definition: osmo_ss7.h:376
bool trans_role_set_by_vty
Definition: osmo_ss7.h:409
enum osmo_ss7_asp_admin_state adm_state
Definition: osmo_ss7.h:405
struct osmo_xua_server * xua_server
osmo_xua_server over which we were established
Definition: osmo_ss7.h:372
struct osmo_ss7_asp_peer local
Definition: osmo_ss7.h:411
bool is_server
Definition: osmo_ss7.h:406
struct osmo_ss7_asp::@8::@9 sctp_init
bool dyn_allocated
Were we dynamically allocated.
Definition: osmo_ss7.h:390
bool max_init_timeo_present
Definition: osmo_ss7.h:423
char * name
Definition: osmo_ss7.h:402
uint8_t qos_class
Definition: osmo_ss7.h:413
struct msgb * pending_msg
Pending message for non-blocking IPA read.
Definition: osmo_ss7.h:399
uint32_t asp_id
Definition: osmo_ss7.h:382
uint16_t num_ostreams_value
Definition: osmo_ss7.h:424
int trans_proto
The underlaying transport protocol (one of IPPROTO_*)
Definition: osmo_ss7.h:431
char * description
Definition: osmo_ss7.h:403
bool asp_id_present
Definition: osmo_ss7.h:383
struct rate_ctr_group * ctrg
Rate Counter Group.
Definition: osmo_ss7.h:396
struct llist_head siblings
Definition: osmo_ss7.h:373
uint16_t max_init_timeo_value
Definition: osmo_ss7.h:427
struct osmo_ss7_asp::@8 cfg
Definition: osmo_ss7.h:50
struct osmo_sccp_instance * sccp
Definition: osmo_ss7.h:69
uint32_t secondary_pc
Definition: osmo_ss7.h:81
struct osmo_ss7_route_table * rtable_system
Definition: osmo_ss7.h:67
struct llist_head linksets
list of osmo_ss7_linkset
Definition: osmo_ss7.h:54
char * name
Definition: osmo_ss7.h:73
struct osmo_ss7_instance::@1 cfg
uint32_t primary_pc
Definition: osmo_ss7.h:75
struct osmo_ss7_pc_fmt pc_fmt
Definition: osmo_ss7.h:78
struct llist_head as_list
list of osmo_ss7_as
Definition: osmo_ss7.h:56
struct llist_head rtable_list
list of osmo_ss7_route_table
Definition: osmo_ss7.h:60
uint8_t network_indicator
Definition: osmo_ss7.h:77
char * description
Definition: osmo_ss7.h:74
uint32_t id
Definition: osmo_ss7.h:72
struct llist_head asp_list
list of osmo_ss7_asp
Definition: osmo_ss7.h:58
const struct osmo_ss7_user * user[16]
Definition: osmo_ss7.h:65
bool permit_dyn_rkm_alloc
Definition: osmo_ss7.h:79
struct llist_head sccp_address_book
Definition: osmo_ss7.h:80
struct llist_head list
member of global list of instances
Definition: osmo_ss7.h:52
struct llist_head xua_servers
list of osmo_xua_servers
Definition: osmo_ss7.h:62
Definition: osmo_ss7.h:158
struct osmo_ss7_link * links[16]
array of osmo_ss7_link
Definition: osmo_ss7.h:163
struct osmo_ss7_instance * inst
osmo_ss7_instance to which we belong
Definition: osmo_ss7.h:161
uint32_t adjacent_pc
Definition: osmo_ss7.h:168
uint32_t local_pc
Definition: osmo_ss7.h:169
struct osmo_ss7_linkset::@3 cfg
char * name
Definition: osmo_ss7.h:166
struct llist_head list
Definition: osmo_ss7.h:159
char * description
Definition: osmo_ss7.h:167
Definition: osmo_ss7.h:45
char delimiter
Definition: osmo_ss7.h:46
uint8_t component_len[3]
Definition: osmo_ss7.h:47
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: osmo_ss7.h:184
struct osmo_ss7_as * as
pointer to Application Server
Definition: osmo_ss7.h:194
struct osmo_ss7_route::@4 dest
uint8_t qos_class
Definition: osmo_ss7.h:205
uint32_t pc
Definition: osmo_ss7.h:199
struct osmo_ss7_route::@5 cfg
uint32_t mask
Definition: osmo_ss7.h:200
struct osmo_ss7_route_table * rtable
osmo_ss7_route_table to which we belong
Definition: osmo_ss7.h:188
struct llist_head list
member in osmo_ss7_route_table::routes
Definition: osmo_ss7.h:186
struct osmo_ss7_linkset * linkset
pointer to linkset (destination) of route
Definition: osmo_ss7.h:192
uint32_t priority
lower priority is higher
Definition: osmo_ss7.h:204
char * linkset_name
human-specified linkset name
Definition: osmo_ss7.h:202
Definition: osmo_ss7.h:224
uint8_t si
Definition: osmo_ss7.h:229
uint32_t context
Definition: osmo_ss7.h:225
uint32_t l_rk_id
Definition: osmo_ss7.h:226
uint32_t ssn
Definition: osmo_ss7.h:230
uint32_t pc
Definition: osmo_ss7.h:228
Definition: osmo_ss7.h:101
const char * name
Definition: osmo_ss7.h:105
osmo_prim_cb prim_cb
Definition: osmo_ss7.h:107
void * priv
Definition: osmo_ss7.h:109
struct osmo_ss7_instance * inst
Definition: osmo_ss7.h:103
Definition: osmo_ss7.h:510
osmo_prim_cb prim_cb
Definition: osmo_ss7.h:511
Definition: osmo_ss7.h:514
struct osmo_stream_srv_link * server
Definition: osmo_ss7.h:521
uint16_t max_instreams_value
Definition: osmo_ss7.h:531
enum osmo_ss7_asp_protocol proto
Definition: osmo_ss7.h:526
bool num_ostreams_present
Definition: osmo_ss7.h:528
struct osmo_ss7_instance * inst
Definition: osmo_ss7.h:516
struct llist_head asp_list
Definition: osmo_ss7.h:519
struct osmo_xua_server::@10 cfg
bool accept_dyn_reg
Definition: osmo_ss7.h:524
uint16_t num_ostreams_value
Definition: osmo_ss7.h:530
struct osmo_xua_server::@10::@11 sctp_init
struct llist_head list
Definition: osmo_ss7.h:515
struct osmo_ss7_asp_peer local
Definition: osmo_ss7.h:525
bool max_instreams_present
Definition: osmo_ss7.h:529
int trans_proto
The underlaying transport protocol (one of IPPROTO_*)
Definition: osmo_ss7.h:535