libosmo-sigtran 1.9.0.3-fc4c
Osmocom SIGTRAN library
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
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
14extern struct llist_head osmo_ss7_instances;
15
17struct osmo_ss7_user;
19struct osmo_mtp_prim;
21
22int osmo_ss7_init(void);
24
25bool osmo_ss7_pc_is_local(struct osmo_ss7_instance *inst, uint32_t pc);
26int osmo_ss7_pointcode_parse(struct osmo_ss7_instance *inst, const char *str);
27int osmo_ss7_pointcode_parse_mask_or_len(struct osmo_ss7_instance *inst, const char *in);
28const char *osmo_ss7_pointcode_print_buf(char *buf, size_t buf_len, const struct osmo_ss7_instance *inst, uint32_t pc);
29const char *osmo_ss7_pointcode_print(const struct osmo_ss7_instance *inst, uint32_t pc);
30const char *osmo_ss7_pointcode_print2(const struct osmo_ss7_instance *inst, uint32_t pc);
31
32/* All known point-code formats have a length of or below 24 bit.
33 * A point-code value exceeding that is used to indicate an unset PC. */
34#define OSMO_SS7_PC_INVALID 0xffffffff
35static inline bool osmo_ss7_pc_is_valid(uint32_t pc)
36{
37 return pc <= 0x00ffffff;
38}
39
40/***********************************************************************
41 * SS7 Routing Tables
42 ***********************************************************************/
43
46 struct llist_head list;
50 struct llist_head routes;
51
52 struct {
53 char *name;
55 } cfg;
56};
57
63
64/***********************************************************************
65 * SS7 Instances
66 ***********************************************************************/
67
70 uint8_t component_len[3];
71};
72
75 struct llist_head list;
77 struct llist_head linksets;
79 struct llist_head as_list;
81 struct llist_head asp_list;
83 struct llist_head rtable_list;
85 struct llist_head xua_servers;
86 /* array for faster lookup of user (indexed by service
87 * indicator) */
88 const struct osmo_ss7_user *user[16];
89
91
93
94 struct {
95 uint32_t id;
96 char *name;
98 uint32_t primary_pc;
99 /* secondary PCs */
100 /* capability PCs */
104 struct llist_head sccp_address_book;
106};
107
108struct osmo_ss7_instance *osmo_ss7_instance_find(uint32_t id);
109struct osmo_ss7_instance *
110osmo_ss7_instance_find_or_create(void *ctx, uint32_t id);
113 uint8_t c0, uint8_t c1, uint8_t c2);
114
116
117uint8_t osmo_ss7_pc_width(const struct osmo_ss7_pc_fmt *pc_fmt);
118uint32_t osmo_ss7_pc_normalize(const struct osmo_ss7_pc_fmt *pc_fmt, uint32_t pc);
119
120/***********************************************************************
121 * MTP Users (Users of MTP, such as SCCP or ISUP)
122 ***********************************************************************/
123
125 /* pointer back to SS7 instance */
127 /* name of the user */
128 const char *name;
129 /* primitive call-back for incoming MTP primitives */
130 osmo_prim_cb prim_cb;
131 /* private data */
132 void *priv;
133};
134
135int osmo_ss7_user_register(struct osmo_ss7_instance *inst, uint8_t service_ind,
136 struct osmo_ss7_user *user);
137
138int osmo_ss7_user_unregister(struct osmo_ss7_instance *inst, uint8_t service_ind,
139 struct osmo_ss7_user *user);
140
141int osmo_ss7_mtp_to_user(struct osmo_ss7_instance *inst, struct osmo_mtp_prim *omp);
142
143/* SS7 User wants to issue MTP-TRANSFER.req */
145 struct osmo_mtp_prim *omp);
146
147/***********************************************************************
148 * SS7 Links
149 ***********************************************************************/
150
157
158struct osmo_ss7_linkset;
159struct osmo_ss7_link;
160
164 struct {
165 char *name;
167 uint32_t id;
168
171};
172
173void osmo_ss7_link_destroy(struct osmo_ss7_link *link);
174struct osmo_ss7_link *
175osmo_ss7_link_find_or_create(struct osmo_ss7_linkset *lset, uint32_t id);
176
177/***********************************************************************
178 * SS7 Linksets
179 ***********************************************************************/
180
182 struct llist_head list;
186 struct osmo_ss7_link *links[16];
187
188 struct {
189 char *name;
191 uint32_t adjacent_pc;
192 uint32_t local_pc;
194};
195
197struct osmo_ss7_linkset *
199struct osmo_ss7_linkset *
200osmo_ss7_linkset_find_or_create(struct osmo_ss7_instance *inst, const char *name, uint32_t pc);
201
202
203/***********************************************************************
204 * SS7 Routes
205 ***********************************************************************/
206
209 struct llist_head list;
212
213 struct {
219
220 struct {
221 /* FIXME: presence? */
222 uint32_t pc;
223 uint32_t mask;
227 uint32_t priority;
228 uint8_t qos_class;
230};
231
232struct osmo_ss7_route *
233osmo_ss7_route_find_dpc(struct osmo_ss7_route_table *rtbl, uint32_t dpc);
234struct osmo_ss7_route *
236 uint32_t mask);
237struct osmo_ss7_route *
238osmo_ss7_route_lookup(struct osmo_ss7_instance *inst, uint32_t dpc);
239struct osmo_ss7_route *
240osmo_ss7_route_create(struct osmo_ss7_route_table *rtbl, uint32_t dpc,
241 uint32_t mask, const char *linkset_name);
243const char *osmo_ss7_route_print(const struct osmo_ss7_route *rt);
244const char *osmo_ss7_route_name(struct osmo_ss7_route *rt, bool list_asps);
245
246
247/***********************************************************************
248 * SS7 Application Servers
249 ***********************************************************************/
250
252 uint32_t context;
253 uint32_t l_rk_id;
254
255 uint32_t pc;
256 uint8_t si;
257 uint32_t ssn;
258 /* FIXME: more complex routing keys */
259};
260
262 OSMO_SS7_AS_TMOD_OVERRIDE = 0, /* default */
268
269extern struct value_string osmo_ss7_as_traffic_mode_vals[];
270
271static inline const char *
273{
274 return get_value_string(osmo_ss7_as_traffic_mode_vals, mode);
275}
276
284
285extern struct value_string osmo_ss7_asp_protocol_vals[];
286
287static inline const char *
289{
290 return get_value_string(osmo_ss7_asp_protocol_vals, mode);
291}
292
294
296 OSMO_SS7_PATCH_NONE, /* no patching of SCCP */
297 OSMO_SS7_PATCH_BOTH, /* patch both OPC and DPC into SCCP addresses */
298};
299
302 struct llist_head list;
304
306 struct osmo_fsm_inst *fi;
307
310
313
315 struct rate_ctr_group *ctrg;
316
317 struct {
318 char *name;
323 /* traffic mode was configured by VTY / config file */
325 /* traffic mode was configured by RKM (routing key management) or first ASPAC */
328 uint8_t qos_class;
329 struct {
330 uint32_t dpc;
333
334 struct osmo_ss7_asp *asps[16];
335 uint8_t last_asp_idx_sent; /* used for load-sharing traffic mode (round robin implementation) */
337};
338
339struct osmo_ss7_as *
341struct osmo_ss7_as *
342osmo_ss7_as_find_by_rctx(struct osmo_ss7_instance *inst, uint32_t rctx);
343struct osmo_ss7_as *
344osmo_ss7_as_find_by_l_rk_id(struct osmo_ss7_instance *inst, uint32_t l_rk_id);
347struct osmo_ss7_as *
350int osmo_ss7_as_add_asp(struct osmo_ss7_as *as, const char *asp_name);
351int osmo_ss7_as_del_asp(struct osmo_ss7_as *as, const char *asp_name);
352void osmo_ss7_as_destroy(struct osmo_ss7_as *as);
353bool osmo_ss7_as_has_asp(const struct osmo_ss7_as *as,
354 const struct osmo_ss7_asp *asp);
355bool osmo_ss7_as_down(const struct osmo_ss7_as *as);
356bool osmo_ss7_as_active(const struct osmo_ss7_as *as);
357bool osmo_ss7_as_tmode_compatible_xua(struct osmo_ss7_as *as, uint32_t m3ua_tmt);
358void osmo_ss7_asp_disconnect(struct osmo_ss7_asp *asp);
359
360
361/***********************************************************************
362 * SS7 Application Server Processes
363 ***********************************************************************/
364
366 char *host[OSMO_SOCK_MAX_ADDRS];
367 size_t host_cnt;
368 uint16_t port;
369 /* index in "hosts" array marking the SCTP Primary Address, -1 if no explicit Primary Address set */
371};
372
380};
381
386};
387
388extern const struct value_string osmo_ss7_asp_role_names[];
389
392 struct llist_head list;
394
396 struct osmo_fsm_inst *fi;
397
400 struct llist_head siblings;
401
403 struct osmo_stream_cli *client;
404 struct osmo_stream_srv *server;
407
408 /* ASP Identifier for ASP-UP + NTFY */
409 uint32_t asp_id;
411
412 /* Layer Manager to which we talk */
414 void *lm_priv;
415
418
421
423 struct rate_ctr_group *ctrg;
424
426 struct msgb *pending_msg;
427
428 struct {
429 char *name;
437
440 uint8_t qos_class;
441 uint32_t quirks;
442
443 /* T_defs used by the default_lm: */
444 struct osmo_tdef *T_defs_lm;
445
446 struct {
454 uint16_t max_init_timeo_value; /* ms */
456
460};
461
463#define OSMO_SS7_ASP_QUIRK_NO_NOTIFY 0x00000001
465#define OSMO_SS7_ASP_QUIRK_DAUD_IN_ASP 0x00000002
467#define OSMO_SS7_ASP_QUIRK_SNM_INACTIVE 0x00000004
468
469int osmo_ss7_asp_peer_snprintf(char* buf, size_t buf_len, struct osmo_ss7_asp_peer *peer);
471int osmo_ss7_asp_peer_set_hosts(struct osmo_ss7_asp_peer *peer, void *talloc_ctx,
472 const char *const*hosts, size_t host_cnt);
473int osmo_ss7_asp_peer_set_hosts2(struct osmo_ss7_asp_peer *peer, void *talloc_ctx,
474 const char *const*hosts, size_t host_cnt, int idx_primary);
475int osmo_ss7_asp_peer_add_host(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *host);
476int osmo_ss7_asp_peer_add_host2(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *host, bool is_primary_addr);
477int osmo_ss7_asp_peer_del_host(struct osmo_ss7_asp_peer *peer, const char *host);
478
479
480struct osmo_ss7_asp *
482struct osmo_ss7_asp *
485struct osmo_ss7_asp *
486osmo_ss7_asp_find(struct osmo_ss7_instance *inst, const char *name,
487 uint16_t remote_port, uint16_t local_port,
489 OSMO_DEPRECATED("Use osmo_ss7_asp_find2() instead");
490struct osmo_ss7_asp *
491osmo_ss7_asp_find2(struct osmo_ss7_instance *inst, const char *name,
492 uint16_t remote_port, uint16_t local_port,
494struct osmo_ss7_asp *
496 uint16_t remote_port, uint16_t local_port,
498 OSMO_DEPRECATED("Use osmo_ss7_asp_find_or_create2() instead");
499struct osmo_ss7_asp *
501 uint16_t remote_port, uint16_t local_port,
503void osmo_ss7_asp_destroy(struct osmo_ss7_asp *asp);
504int osmo_ss7_asp_send(struct osmo_ss7_asp *asp, struct msgb *msg);
505int osmo_ss7_asp_restart(struct osmo_ss7_asp *asp);
506int osmo_ss7_asp_use_default_lm(struct osmo_ss7_asp *asp, int log_level);
507bool osmo_ss7_asp_active(const struct osmo_ss7_asp *asp);
508int osmo_ss7_asp_get_log_subsys(const struct osmo_ss7_asp *asp);
509const char *osmo_ss7_asp_get_name(const struct osmo_ss7_asp *asp);
511int osmo_ss7_asp_get_trans_proto(const struct osmo_ss7_asp *asp);
512
520typedef int osmo_ss7_asp_rx_unknown_cb(struct osmo_ss7_asp *asp, int ppid_mux, struct msgb *msg);
521
523
524#define _LOGSS7(inst, subsys, level, fmt, args ...) \
525 LOGP(subsys, level, "%u: " fmt, inst ? (inst)->cfg.id : 0, ## args)
526#define LOGSS7(inst, level, fmt, args ...) _LOGSS7(inst, DLSS7, level, fmt, ## args)
527
528#define LOGPASP(asp, subsys, level, fmt, args ...) \
529 _LOGSS7((asp)->inst, subsys, level, "asp-%s: " fmt, (asp)->cfg.name, ## args)
530#define LOGPAS(as, subsys, level, fmt, args ...) \
531 _LOGSS7((as)->inst, subsys, level, "as-%s: " fmt, (as)->cfg.name, ## args)
532
533/***********************************************************************
534 * xUA Servers
535 ***********************************************************************/
536
538 osmo_prim_cb prim_cb;
539};
540
542 struct llist_head list;
544
545 /* list of ASPs established via this server */
546 struct llist_head asp_list;
547
548 struct osmo_stream_srv_link *server;
549
550 struct {
554 struct {
560
564};
565
566struct osmo_xua_server *
569 uint16_t local_port)
570 OSMO_DEPRECATED("Use osmo_ss7_xua_server_find2() instead");
571struct osmo_xua_server *
573 int trans_proto,
575 uint16_t local_port);
576
577struct osmo_xua_server *
580 uint16_t local_port, const char *local_host)
581 OSMO_DEPRECATED("Use osmo_ss7_xua_server_create2() instead");
582struct osmo_xua_server *
585 uint16_t local_port, const char *local_host);
586
587int
589
590int
591osmo_ss7_xua_server_set_local_host(struct osmo_xua_server *xs, const char *local_host);
592int
593osmo_ss7_xua_server_set_local_hosts(struct osmo_xua_server *xs, const char **local_hosts, size_t local_host_cnt);
594int osmo_ss7_xua_server_add_local_host(struct osmo_xua_server *xs, const char *local_host);
595int osmo_ss7_xua_server_del_local_host(struct osmo_xua_server *xs, const char *local_host);
597
598struct osmo_sccp_instance *
599osmo_sccp_simple_client(void *ctx, const char *name, uint32_t default_pc,
600 enum osmo_ss7_asp_protocol prot, int default_local_port,
601 const char *default_local_ip, int default_remote_port,
602 const char *default_remote_ip);
603
604struct osmo_sccp_instance *
605osmo_sccp_simple_client_on_ss7_id(void *ctx, uint32_t ss7_id, const char *name,
606 uint32_t default_pc,
607 enum osmo_ss7_asp_protocol prot,
608 int default_local_port,
609 const char *default_local_ip,
610 int default_remote_port,
611 const char *default_remote_ip);
612
613struct osmo_sccp_instance *
614osmo_sccp_simple_server(void *ctx, uint32_t pc,
615 enum osmo_ss7_asp_protocol prot, int local_port,
616 const char *local_ip);
617
618struct osmo_sccp_instance *
619osmo_sccp_simple_server_on_ss7_id(void *ctx, uint32_t ss7_id, uint32_t pc,
620 enum osmo_ss7_asp_protocol prot,
621 int local_port, const char *local_ip);
622
623struct osmo_sccp_instance *
625 enum osmo_ss7_asp_protocol prot,
626 const char *name, uint32_t pc,
627 int local_port, int remote_port,
628 const char *remote_ip);
629
630void osmo_sccp_set_max_optional_data(struct osmo_sccp_instance *inst, int val);
631
634
635/* VTY related */
636struct vty;
637void osmo_ss7_vty_init_asp(void *ctx);
638void osmo_ss7_vty_init_sg(void *ctx);
639int osmo_ss7_vty_go_parent(struct vty *vty);
640int 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:100
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:855
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:889
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
osmo_ss7_as_patch_sccp_mode
Definition: osmo_ss7.h:295
@ OSMO_SS7_PATCH_BOTH
Definition: osmo_ss7.h:297
@ OSMO_SS7_PATCH_NONE
Definition: osmo_ss7.h:296
struct osmo_ss7_route * osmo_ss7_route_find_dpc(struct osmo_ss7_route_table *rtbl, uint32_t dpc)
Find a SS7 route for given destination point code in given table.
Definition: osmo_ss7.c:661
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:3037
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:277
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:422
static bool osmo_ss7_pc_is_valid(uint32_t pc)
Definition: osmo_ss7.h:35
void osmo_ss7_xua_server_destroy(struct osmo_xua_server *xs)
Definition: osmo_ss7_xua_srv.c:359
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:150
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:1123
void osmo_ss7_route_destroy(struct osmo_ss7_route *rt)
Destroy a given SS7 route.
Definition: osmo_ss7.c:791
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_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:501
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:907
struct osmo_ss7_asp * osmo_ss7_asp_find_by_name(struct osmo_ss7_instance *inst, const char *name)
Definition: osmo_ss7.c:989
osmo_ss7_asp_protocol
Definition: osmo_ss7.h:277
@ OSMO_SS7_ASP_PROT_SUA
Definition: osmo_ss7.h:279
@ OSMO_SS7_ASP_PROT_NONE
Definition: osmo_ss7.h:278
@ OSMO_SS7_ASP_PROT_IPA
Definition: osmo_ss7.h:281
@ OSMO_SS7_ASP_PROT_M3UA
Definition: osmo_ss7.h:280
@ _NUM_OSMO_SS7_ASP_PROT
Definition: osmo_ss7.h:282
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:44
int osmo_ss7_tmode_to_xua(enum osmo_ss7_as_traffic_mode tmod)
Definition: osmo_ss7.c:1167
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
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:889
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:446
osmo_ss7_asp_role
Definition: osmo_ss7.h:382
@ OSMO_SS7_ASP_ROLE_SG
Definition: osmo_ss7.h:384
@ OSMO_SS7_ASP_ROLE_ASP
Definition: osmo_ss7.h:383
@ OSMO_SS7_ASP_ROLE_IPSP
Definition: osmo_ss7.h:385
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:466
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:1095
void osmo_ss7_instance_destroy(struct osmo_ss7_instance *inst)
Destroy a SS7 Instance.
Definition: osmo_ss7.c:361
const char * osmo_ss7_route_print(const struct osmo_ss7_route *rt)
Definition: osmo_ss7.c:830
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:756
int osmo_ss7_pointcode_parse(struct osmo_ss7_instance *inst, const char *str)
Definition: osmo_ss7.c:205
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:520
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
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:872
osmo_ss7_asp_admin_state
Definition: osmo_ss7.h:373
@ OSMO_SS7_ASP_ADM_S_SHUTDOWN
no SCTP association with peer
Definition: osmo_ss7.h:375
@ OSMO_SS7_ASP_ADM_S_BLOCKED
SCP association, but reject ASP-ACTIVE.
Definition: osmo_ss7.h:377
@ OSMO_SS7_ASP_ADM_S_ENABLED
in normal operation
Definition: osmo_ss7.h:379
uint32_t osmo_ss7_pc_normalize(const struct osmo_ss7_pc_fmt *pc_fmt, uint32_t pc)
Definition: osmo_ss7.c:169
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:151
@ OSMO_SS7_LS_ENABLED
Definition: osmo_ss7.h:154
@ OSMO_SS7_LS_INHIBITED
Definition: osmo_ss7.h:153
@ OSMO_SS7_LS_SHUTDOWN
Definition: osmo_ss7.h:152
@ _NUM_OSMO_SS7_LS
Definition: osmo_ss7.h:155
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
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:1020
int osmo_ss7_user_mtp_xfer_req(struct osmo_ss7_instance *inst, struct osmo_mtp_prim *omp)
Definition: osmo_ss7_hmrt.c:293
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:197
void osmo_ss7_asp_destroy(struct osmo_ss7_asp *asp)
Definition: osmo_ss7_asp.c:573
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:403
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:207
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:702
osmo_ss7_as_traffic_mode
Definition: osmo_ss7.h:261
@ OSMO_SS7_AS_TMOD_OVERRIDE
Definition: osmo_ss7.h:262
@ _NUM_OSMO_SS7_ASP_TMOD
Definition: osmo_ss7.h:266
@ OSMO_SS7_AS_TMOD_ROUNDROBIN
Definition: osmo_ss7.h:265
@ OSMO_SS7_AS_TMOD_BCAST
Definition: osmo_ss7.h:263
@ OSMO_SS7_AS_TMOD_LOADSHARE
Definition: osmo_ss7.h:264
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:1076
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:809
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:571
struct llist_head osmo_ss7_instances
int osmo_ss7_asp_restart(struct osmo_ss7_asp *asp)
Definition: osmo_ss7_asp.c:611
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:320
const char * osmo_ss7_pointcode_print2(const struct osmo_ss7_instance *inst, uint32_t pc)
Definition: osmo_ss7.c:271
uint8_t osmo_ss7_pc_width(const struct osmo_ss7_pc_fmt *pc_fmt)
Definition: osmo_ss7.c:161
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:239
int osmo_ss7_xua_server_del_local_host(struct osmo_xua_server *xs, const char *local_host)
Definition: osmo_ss7_xua_srv.c:335
int osmo_ss7_init(void)
Definition: osmo_ss7.c:1141
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
void osmo_ss7_route_table_destroy(struct osmo_ss7_route_table *rtbl)
Definition: osmo_ss7.c:647
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_ss7_route_table * osmo_ss7_route_table_find_or_create(struct osmo_ss7_instance *inst, const char *name)
Definition: osmo_ss7.c:630
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:1054
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:800
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:735
int osmo_ss7_vty_go_parent(struct vty *vty)
Definition: osmo_ss7_vty.c:2844
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:497
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:181
int osmo_ss7_is_config_node(struct vty *vty, int node)
Definition: osmo_ss7_vty.c:2898
static const char * osmo_ss7_asp_protocol_name(enum osmo_ss7_asp_protocol mode)
Definition: osmo_ss7.h:288
struct osmo_ss7_instance * osmo_ss7_instance_find(uint32_t id)
Find a SS7 Instance with given ID.
Definition: osmo_ss7.c:303
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:131
const char * osmo_ss7_pointcode_print(const struct osmo_ss7_instance *inst, uint32_t pc)
Definition: osmo_ss7.c:263
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:1006
int osmo_ss7_find_free_rctx(struct osmo_ss7_instance *inst)
Definition: osmo_ss7.c:72
static const char * osmo_ss7_as_traffic_mode_name(enum osmo_ss7_as_traffic_mode mode)
Definition: osmo_ss7.h:272
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
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:384
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:588
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:941
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:544
bool osmo_ss7_as_tmode_compatible_xua(struct osmo_ss7_as *as, uint32_t m3ua_tmt)
Definition: osmo_ss7.c:1195
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:1042
struct osmo_ss7_route * osmo_ss7_route_find_dpc_mask(struct osmo_ss7_route_table *rtbl, uint32_t dpc, uint32_t mask)
Find a SS7 route for given destination point code + mask in given table.
Definition: osmo_ss7.c:681
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:527
bool osmo_ss7_pc_is_local(struct osmo_ss7_instance *inst, uint32_t pc)
Definition: osmo_ss7.c:1132
int osmo_ss7_xua_server_set_local_host(struct osmo_xua_server *xs, const char *local_host)
Definition: osmo_ss7_xua_srv.c:306
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
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:1181
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:3031
struct osmo_ss7_route_table * osmo_ss7_route_table_find(struct osmo_ss7_instance *inst, const char *name)
Definition: osmo_ss7.c:618
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:738
void osmo_ss7_as_destroy(struct osmo_ss7_as *as)
Destroy given Application Server.
Definition: osmo_ss7_as.c:155
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
Definition: mtp_sap.h:56
Definition: sccp_internal.h:37
Definition: osmo_ss7.h:300
struct osmo_ss7_routing_key routing_key
Definition: osmo_ss7.h:321
uint32_t recovery_timeout_msec
Definition: osmo_ss7.h:327
struct osmo_ss7_as::@25::@26 pc_override
struct llist_head list
entry in 'ref osmo_ss7_instance.as_list
Definition: osmo_ss7.h:302
char * description
Definition: osmo_ss7.h:319
bool rkm_dyn_allocated
Were we dynamically allocated by RKM?
Definition: osmo_ss7.h:309
struct rate_ctr_group * ctrg
Rate Counter Group.
Definition: osmo_ss7.h:315
struct osmo_ss7_asp * asps[16]
Definition: osmo_ss7.h:334
uint8_t last_asp_idx_sent
Definition: osmo_ss7.h:335
char * name
Definition: osmo_ss7.h:318
bool mode_set_by_vty
Definition: osmo_ss7.h:324
struct osmo_fsm_inst * fi
AS FSM.
Definition: osmo_ss7.h:306
bool simple_client_allocated
Were we allocated by "simple client" support?
Definition: osmo_ss7.h:312
uint32_t dpc
Definition: osmo_ss7.h:330
enum osmo_ss7_as_traffic_mode mode
Definition: osmo_ss7.h:322
struct osmo_ss7_as::@25 cfg
enum osmo_ss7_asp_protocol proto
Definition: osmo_ss7.h:320
enum osmo_ss7_as_patch_sccp_mode sccp_mode
Definition: osmo_ss7.h:331
struct osmo_ss7_instance * inst
Definition: osmo_ss7.h:303
bool mode_set_by_peer
Definition: osmo_ss7.h:326
uint8_t qos_class
Definition: osmo_ss7.h:328
Definition: osmo_ss7.h:365
size_t host_cnt
Definition: osmo_ss7.h:367
uint16_t port
Definition: osmo_ss7.h:368
char * host[OSMO_SOCK_MAX_ADDRS]
Definition: osmo_ss7.h:366
int idx_primary
Definition: osmo_ss7.h:370
Definition: osmo_ss7.h:390
enum osmo_ss7_asp_role role
Definition: osmo_ss7.h:434
char * sock_name
pre-formatted human readable local/remote socket name
Definition: osmo_ss7.h:406
struct osmo_ss7_asp::@27::@28 sctp_init
bool role_set_by_vty
Definition: osmo_ss7.h:435
struct osmo_ss7_asp::@27 cfg
struct osmo_ss7_asp_peer remote
Definition: osmo_ss7.h:439
bool max_attempts_present
Definition: osmo_ss7.h:449
bool max_instreams_present
Definition: osmo_ss7.h:448
struct osmo_tdef * T_defs_lm
Definition: osmo_ss7.h:444
struct osmo_fsm_inst * fi
ASP FSM.
Definition: osmo_ss7.h:396
uint16_t max_attempts_value
Definition: osmo_ss7.h:453
uint16_t max_instreams_value
Definition: osmo_ss7.h:452
struct llist_head list
entry in osmo_ss7_instance::asp_list
Definition: osmo_ss7.h:392
enum osmo_ss7_asp_protocol proto
Definition: osmo_ss7.h:431
void * lm_priv
Definition: osmo_ss7.h:414
struct osmo_ss7_instance * inst
Definition: osmo_ss7.h:393
const struct osmo_xua_layer_manager * lm
Definition: osmo_ss7.h:413
bool num_ostreams_present
Definition: osmo_ss7.h:447
struct osmo_stream_srv * server
Definition: osmo_ss7.h:404
uint32_t quirks
Definition: osmo_ss7.h:441
bool simple_client_allocated
Were we allocated by "simple client" support?
Definition: osmo_ss7.h:420
struct osmo_stream_cli * client
osmo_stream / libosmo-netif handles
Definition: osmo_ss7.h:403
bool trans_role_set_by_vty
Definition: osmo_ss7.h:436
enum osmo_ss7_asp_admin_state adm_state
Definition: osmo_ss7.h:432
struct osmo_xua_server * xua_server
osmo_xua_server over which we were established
Definition: osmo_ss7.h:399
struct osmo_ss7_asp_peer local
Definition: osmo_ss7.h:438
bool is_server
Definition: osmo_ss7.h:433
bool dyn_allocated
Were we dynamically allocated.
Definition: osmo_ss7.h:417
bool max_init_timeo_present
Definition: osmo_ss7.h:450
char * name
Definition: osmo_ss7.h:429
uint8_t qos_class
Definition: osmo_ss7.h:440
struct msgb * pending_msg
Pending message for non-blocking IPA read.
Definition: osmo_ss7.h:426
uint32_t asp_id
Definition: osmo_ss7.h:409
uint16_t num_ostreams_value
Definition: osmo_ss7.h:451
int trans_proto
The underlaying transport protocol (one of IPPROTO_*)
Definition: osmo_ss7.h:458
char * description
Definition: osmo_ss7.h:430
bool asp_id_present
Definition: osmo_ss7.h:410
struct rate_ctr_group * ctrg
Rate Counter Group.
Definition: osmo_ss7.h:423
struct llist_head siblings
Definition: osmo_ss7.h:400
uint16_t max_init_timeo_value
Definition: osmo_ss7.h:454
Definition: osmo_ss7.h:73
struct osmo_sccp_instance * sccp
Definition: osmo_ss7.h:92
struct osmo_ss7_route_table * rtable_system
Definition: osmo_ss7.h:90
struct llist_head linksets
list of osmo_ss7_linkset
Definition: osmo_ss7.h:77
char * name
Definition: osmo_ss7.h:96
uint32_t primary_pc
Definition: osmo_ss7.h:98
struct osmo_ss7_pc_fmt pc_fmt
Definition: osmo_ss7.h:102
struct llist_head as_list
list of osmo_ss7_as
Definition: osmo_ss7.h:79
struct llist_head rtable_list
list of osmo_ss7_route_table
Definition: osmo_ss7.h:83
uint8_t network_indicator
Definition: osmo_ss7.h:101
char * description
Definition: osmo_ss7.h:97
uint32_t id
Definition: osmo_ss7.h:95
struct llist_head asp_list
list of osmo_ss7_asp
Definition: osmo_ss7.h:81
const struct osmo_ss7_user * user[16]
Definition: osmo_ss7.h:88
bool permit_dyn_rkm_alloc
Definition: osmo_ss7.h:103
struct osmo_ss7_instance::@20 cfg
struct llist_head sccp_address_book
Definition: osmo_ss7.h:104
struct llist_head list
member of global list of instances
Definition: osmo_ss7.h:75
struct llist_head xua_servers
list of osmo_xua_servers
Definition: osmo_ss7.h:85
Definition: osmo_ss7.h:181
struct osmo_ss7_link * links[16]
array of osmo_ss7_link
Definition: osmo_ss7.h:186
struct osmo_ss7_instance * inst
osmo_ss7_instance to which we belong
Definition: osmo_ss7.h:184
uint32_t adjacent_pc
Definition: osmo_ss7.h:191
uint32_t local_pc
Definition: osmo_ss7.h:192
char * name
Definition: osmo_ss7.h:189
struct osmo_ss7_linkset::@22 cfg
struct llist_head list
Definition: osmo_ss7.h:182
char * description
Definition: osmo_ss7.h:190
Definition: osmo_ss7.h:68
char delimiter
Definition: osmo_ss7.h:69
uint8_t component_len[3]
Definition: osmo_ss7.h:70
Definition: osmo_ss7.h:44
struct osmo_ss7_route_table::@19 cfg
struct llist_head routes
list of osmo_ss7_route
Definition: osmo_ss7.h:50
struct llist_head list
member in list of routing tables
Definition: osmo_ss7.h:46
struct osmo_ss7_instance * inst
osmo_ss7_instance to which we belong
Definition: osmo_ss7.h:48
char * description
Definition: osmo_ss7.h:54
char * name
Definition: osmo_ss7.h:53
Definition: osmo_ss7.h:207
struct osmo_ss7_as * as
pointer to Application Server
Definition: osmo_ss7.h:217
uint8_t qos_class
Definition: osmo_ss7.h:228
uint32_t pc
Definition: osmo_ss7.h:222
struct osmo_ss7_route::@24 cfg
uint32_t mask
Definition: osmo_ss7.h:223
struct osmo_ss7_route::@23 dest
struct osmo_ss7_route_table * rtable
osmo_ss7_route_table to which we belong
Definition: osmo_ss7.h:211
struct llist_head list
member in osmo_ss7_route_table::routes
Definition: osmo_ss7.h:209
struct osmo_ss7_linkset * linkset
pointer to linkset (destination) of route
Definition: osmo_ss7.h:215
uint32_t priority
lower priority is higher
Definition: osmo_ss7.h:227
char * linkset_name
human-specified linkset name
Definition: osmo_ss7.h:225
Definition: osmo_ss7.h:251
uint8_t si
Definition: osmo_ss7.h:256
uint32_t context
Definition: osmo_ss7.h:252
uint32_t l_rk_id
Definition: osmo_ss7.h:253
uint32_t ssn
Definition: osmo_ss7.h:257
uint32_t pc
Definition: osmo_ss7.h:255
Definition: osmo_ss7.h:124
const char * name
Definition: osmo_ss7.h:128
osmo_prim_cb prim_cb
Definition: osmo_ss7.h:130
void * priv
Definition: osmo_ss7.h:132
struct osmo_ss7_instance * inst
Definition: osmo_ss7.h:126
Definition: osmo_ss7.h:537
osmo_prim_cb prim_cb
Definition: osmo_ss7.h:538
Definition: osmo_ss7.h:541
struct osmo_stream_srv_link * server
Definition: osmo_ss7.h:548
uint16_t max_instreams_value
Definition: osmo_ss7.h:558
enum osmo_ss7_asp_protocol proto
Definition: osmo_ss7.h:553
bool num_ostreams_present
Definition: osmo_ss7.h:555
struct osmo_ss7_instance * inst
Definition: osmo_ss7.h:543
struct llist_head asp_list
Definition: osmo_ss7.h:546
bool accept_dyn_reg
Definition: osmo_ss7.h:551
uint16_t num_ostreams_value
Definition: osmo_ss7.h:557
struct osmo_xua_server::@29::@30 sctp_init
struct osmo_xua_server::@29 cfg
struct llist_head list
Definition: osmo_ss7.h:542
struct osmo_ss7_asp_peer local
Definition: osmo_ss7.h:552
bool max_instreams_present
Definition: osmo_ss7.h:556
int trans_proto
The underlaying transport protocol (one of IPPROTO_*)
Definition: osmo_ss7.h:562