libosmo-sigtran  1.4.0.21-2f8b
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 
13 extern struct llist_head osmo_ss7_instances;
14 
15 struct osmo_ss7_instance;
16 struct osmo_ss7_user;
17 struct osmo_sccp_instance;
18 struct osmo_mtp_prim;
20 
21 int osmo_ss7_init(void);
23 
24 bool osmo_ss7_pc_is_local(struct osmo_ss7_instance *inst, uint32_t pc);
25 int osmo_ss7_pointcode_parse(struct osmo_ss7_instance *inst, const char *str);
26 int osmo_ss7_pointcode_parse_mask_or_len(struct osmo_ss7_instance *inst, const char *in);
27 const char *osmo_ss7_pointcode_print_buf(char *buf, size_t buf_len, const struct osmo_ss7_instance *inst, uint32_t pc);
28 const char *osmo_ss7_pointcode_print(const struct osmo_ss7_instance *inst, uint32_t pc);
29 const char *osmo_ss7_pointcode_print2(const struct osmo_ss7_instance *inst, uint32_t pc);
30 
31 /* All known point-code formats have a length of or below 24 bit.
32  * A point-code value exceeding that is used to indicate an unset PC. */
33 #define OSMO_SS7_PC_INVALID 0xffffffff
34 static inline bool osmo_ss7_pc_is_valid(uint32_t pc)
35 {
36  return pc <= 0x00ffffff;
37 }
38 
39 /***********************************************************************
40  * SS7 Routing Tables
41  ***********************************************************************/
42 
45  struct llist_head list;
49  struct llist_head routes;
50 
51  struct {
52  char *name;
53  char *description;
54  } cfg;
55 };
56 
57 struct osmo_ss7_route_table *
59 struct osmo_ss7_route_table *
62 
63 /***********************************************************************
64  * SS7 Instances
65  ***********************************************************************/
66 
68  char delimiter;
69  uint8_t component_len[3];
70 };
71 
74  struct llist_head list;
76  struct llist_head linksets;
78  struct llist_head as_list;
80  struct llist_head asp_list;
82  struct llist_head rtable_list;
84  struct llist_head xua_servers;
85  /* array for faster lookup of user (indexed by service
86  * indicator) */
87  const struct osmo_ss7_user *user[16];
88 
90 
92 
93  struct {
94  uint32_t id;
95  char *name;
96  char *description;
97  uint32_t primary_pc;
98  /* secondary PCs */
99  /* capability PCs */
101  struct osmo_ss7_pc_fmt pc_fmt;
103  struct llist_head sccp_address_book;
104  } cfg;
105 };
106 
107 struct osmo_ss7_instance *osmo_ss7_instance_find(uint32_t id);
108 struct osmo_ss7_instance *
109 osmo_ss7_instance_find_or_create(void *ctx, uint32_t id);
112  uint8_t c0, uint8_t c1, uint8_t c2);
113 
115 
116 uint8_t osmo_ss7_pc_width(const struct osmo_ss7_pc_fmt *pc_fmt);
117 uint32_t osmo_ss7_pc_normalize(const struct osmo_ss7_pc_fmt *pc_fmt, uint32_t pc);
118 
119 /***********************************************************************
120  * MTP Users (Users of MTP, such as SCCP or ISUP)
121  ***********************************************************************/
122 
124  /* pointer back to SS7 instance */
126  /* name of the user */
127  const char *name;
128  /* primitive call-back for incoming MTP primitives */
129  osmo_prim_cb prim_cb;
130  /* private data */
131  void *priv;
132 };
133 
134 int osmo_ss7_user_register(struct osmo_ss7_instance *inst, uint8_t service_ind,
135  struct osmo_ss7_user *user);
136 
137 int osmo_ss7_user_unregister(struct osmo_ss7_instance *inst, uint8_t service_ind,
138  struct osmo_ss7_user *user);
139 
140 int osmo_ss7_mtp_to_user(struct osmo_ss7_instance *inst, struct osmo_mtp_prim *omp);
141 
142 /* SS7 User wants to issue MTP-TRANSFER.req */
144  struct osmo_mtp_prim *omp);
145 
146 /***********************************************************************
147  * SS7 Links
148  ***********************************************************************/
149 
155 };
156 
157 struct osmo_ss7_linkset;
158 struct osmo_ss7_link;
159 
163  struct {
164  char *name;
165  char *description;
166  uint32_t id;
167 
168  enum osmo_ss7_link_adm_state adm_state;
169  } cfg;
170 };
171 
172 void osmo_ss7_link_destroy(struct osmo_ss7_link *link);
173 struct osmo_ss7_link *
174 osmo_ss7_link_find_or_create(struct osmo_ss7_linkset *lset, uint32_t id);
175 
176 /***********************************************************************
177  * SS7 Linksets
178  ***********************************************************************/
179 
181  struct llist_head list;
185  struct osmo_ss7_link *links[16];
186 
187  struct {
188  char *name;
189  char *description;
190  uint32_t adjacent_pc;
191  uint32_t local_pc;
192  } cfg;
193 };
194 
195 void osmo_ss7_linkset_destroy(struct osmo_ss7_linkset *lset);
196 struct osmo_ss7_linkset *
198 struct osmo_ss7_linkset *
199 osmo_ss7_linkset_find_or_create(struct osmo_ss7_instance *inst, const char *name, uint32_t pc);
200 
201 
202 /***********************************************************************
203  * SS7 Routes
204  ***********************************************************************/
205 
208  struct llist_head list;
211 
212  struct {
216  struct osmo_ss7_as *as;
217  } dest;
218 
219  struct {
220  /* FIXME: presence? */
221  uint32_t pc;
222  uint32_t mask;
226  uint32_t priority;
227  uint8_t qos_class;
228  } cfg;
229 };
230 
231 struct osmo_ss7_route *
232 osmo_ss7_route_find_dpc(struct osmo_ss7_route_table *rtbl, uint32_t dpc);
233 struct osmo_ss7_route *
235  uint32_t mask);
236 struct osmo_ss7_route *
238 struct osmo_ss7_route *
239 osmo_ss7_route_create(struct osmo_ss7_route_table *rtbl, uint32_t dpc,
240  uint32_t mask, const char *linkset_name);
241 void osmo_ss7_route_destroy(struct osmo_ss7_route *rt);
242 const char *osmo_ss7_route_print(const struct osmo_ss7_route *rt);
243 const char *osmo_ss7_route_name(struct osmo_ss7_route *rt, bool list_asps);
244 
245 
246 /***********************************************************************
247  * SS7 Application Servers
248  ***********************************************************************/
249 
251  uint32_t context;
252  uint32_t l_rk_id;
253 
254  uint32_t pc;
255  uint8_t si;
256  uint32_t ssn;
257  /* FIXME: more complex routing keys */
258 };
259 
261  OSMO_SS7_AS_TMOD_OVERRIDE = 0, /* default */
266 };
267 
268 extern struct value_string osmo_ss7_as_traffic_mode_vals[];
269 
270 static inline const char *
272 {
273  return get_value_string(osmo_ss7_as_traffic_mode_vals, mode);
274 }
275 
282 };
283 
284 extern struct value_string osmo_ss7_asp_protocol_vals[];
285 
286 static inline const char *
288 {
289  return get_value_string(osmo_ss7_asp_protocol_vals, mode);
290 }
291 
293 
295  OSMO_SS7_PATCH_NONE, /* no patching of SCCP */
296  OSMO_SS7_PATCH_BOTH, /* patch both OPC and DPC into SCCP addresses */
297 };
298 
299 struct osmo_ss7_as {
301  struct llist_head list;
303 
305  struct osmo_fsm_inst *fi;
306 
309 
312 
313  struct {
314  char *name;
315  char *description;
317  struct osmo_ss7_routing_key routing_key;
319  /* traffic mode was configured by VTY / config file */
321  /* traffic mode was configured by RKM (routing key management) or first ASPAC */
324  uint8_t qos_class;
325  struct {
326  uint32_t dpc;
328  } pc_override;
329 
330  struct osmo_ss7_asp *asps[16];
331  uint8_t last_asp_idx_sent; /* used for load-sharing traffic mode (round robin implementation) */
332  } cfg;
333 };
334 
335 struct osmo_ss7_as *
337 struct osmo_ss7_as *
338 osmo_ss7_as_find_by_rctx(struct osmo_ss7_instance *inst, uint32_t rctx);
339 struct osmo_ss7_as *
340 osmo_ss7_as_find_by_l_rk_id(struct osmo_ss7_instance *inst, uint32_t l_rk_id);
343 struct osmo_ss7_as *
346 int osmo_ss7_as_add_asp(struct osmo_ss7_as *as, const char *asp_name);
347 int osmo_ss7_as_del_asp(struct osmo_ss7_as *as, const char *asp_name);
348 void osmo_ss7_as_destroy(struct osmo_ss7_as *as);
349 bool osmo_ss7_as_has_asp(const struct osmo_ss7_as *as,
350  const struct osmo_ss7_asp *asp);
351 bool osmo_ss7_as_active(const struct osmo_ss7_as *as);
352 bool osmo_ss7_as_tmode_compatible_xua(struct osmo_ss7_as *as, uint32_t m3ua_tmt);
353 void osmo_ss7_asp_disconnect(struct osmo_ss7_asp *asp);
354 
355 
356 /***********************************************************************
357  * SS7 Application Server Processes
358  ***********************************************************************/
359 
361  char *host[OSMO_SOCK_MAX_ADDRS];
362  size_t host_cnt;
363  uint16_t port;
364 };
365 
373 };
374 
379 };
380 
381 extern const struct value_string osmo_ss7_asp_role_names[];
382 
383 struct osmo_ss7_asp {
385  struct llist_head list;
387 
389  struct osmo_fsm_inst *fi;
390 
393  struct llist_head siblings;
394 
396  struct osmo_stream_cli *client;
397  struct osmo_stream_srv *server;
399  char *sock_name;
400 
401  /* ASP Identifier for ASP-UP + NTFY */
402  uint32_t asp_id;
404 
405  /* Layer Manager to which we talk */
406  const struct osmo_xua_layer_manager *lm;
407  void *lm_priv;
408 
411 
414 
416  struct msgb *pending_msg;
417 
418  struct {
419  char *name;
420  char *description;
422  enum osmo_ss7_asp_admin_state adm_state;
423  bool is_server;
424  enum osmo_ss7_asp_role role;
426 
427  struct osmo_ss7_asp_peer local;
428  struct osmo_ss7_asp_peer remote;
429  uint8_t qos_class;
430  uint32_t quirks;
431  } cfg;
432 };
433 
435 #define OSMO_SS7_ASP_QUIRK_NO_NOTIFY 0x00000001
436 
437 #define OSMO_SS7_ASP_QUIRK_DAUD_IN_ASP 0x00000002
438 
439 #define OSMO_SS7_ASP_QUIRK_SNM_INACTIVE 0x00000004
440 
441 int osmo_ss7_asp_peer_snprintf(char* buf, size_t buf_len, struct osmo_ss7_asp_peer *peer);
442 int osmo_ss7_asp_peer_set_hosts(struct osmo_ss7_asp_peer *peer, void *talloc_ctx,
443  const char* const* hosts, size_t host_cnt);
444 int osmo_ss7_asp_peer_add_host(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *host);
445 
446 struct osmo_ss7_asp *
448 struct osmo_ss7_asp
451 struct osmo_ss7_asp *
452 osmo_ss7_asp_find(struct osmo_ss7_instance *inst, const char *name,
453  uint16_t remote_port, uint16_t local_port,
455 struct osmo_ss7_asp *
457  uint16_t remote_port, uint16_t local_port,
459 void osmo_ss7_asp_destroy(struct osmo_ss7_asp *asp);
460 int osmo_ss7_asp_send(struct osmo_ss7_asp *asp, struct msgb *msg);
461 int osmo_ss7_asp_restart(struct osmo_ss7_asp *asp);
462 int osmo_ss7_asp_use_default_lm(struct osmo_ss7_asp *asp, int log_level);
463 bool osmo_ss7_asp_active(const struct osmo_ss7_asp *asp);
464 int osmo_ss7_asp_get_log_subsys(const struct osmo_ss7_asp *asp);
465 
473 typedef int osmo_ss7_asp_rx_unknown_cb(struct osmo_ss7_asp *asp, int ppid_mux, struct msgb *msg);
474 
476 
477 #define _LOGSS7(inst, subsys, level, fmt, args ...) \
478  LOGP(subsys, level, "%u: " fmt, inst ? (inst)->cfg.id : 0, ## args)
479 #define LOGSS7(inst, level, fmt, args ...) _LOGSS7(inst, DLSS7, level, fmt, ## args)
480 
481 #define LOGPASP(asp, subsys, level, fmt, args ...) \
482  _LOGSS7((asp)->inst, subsys, level, "asp-%s: " fmt, (asp)->cfg.name, ## args)
483 #define LOGPAS(as, subsys, level, fmt, args ...) \
484  _LOGSS7((as)->inst, subsys, level, "as-%s: " fmt, (as)->cfg.name, ## args)
485 
486 /***********************************************************************
487  * xUA Servers
488  ***********************************************************************/
489 
491  osmo_prim_cb prim_cb;
492 };
493 
495  struct llist_head list;
497 
498  /* list of ASPs established via this server */
499  struct llist_head asp_list;
500 
501  struct osmo_stream_srv_link *server;
502 
503  struct {
505  struct osmo_ss7_asp_peer local;
507  } cfg;
508 };
509 
510 struct osmo_xua_server *
512  uint16_t local_port);
513 
514 struct osmo_xua_server *
516  uint16_t local_port, const char *local_host);
517 
518 int
520 
521 int
522 osmo_ss7_xua_server_set_local_host(struct osmo_xua_server *xs, const char *local_host);
523 int
524 osmo_ss7_xua_server_set_local_hosts(struct osmo_xua_server *xs, const char **local_hosts, size_t local_host_cnt);
525 int osmo_ss7_xua_server_add_local_host(struct osmo_xua_server *xs, const char *local_host);
527 
528 struct osmo_sccp_instance *
529 osmo_sccp_simple_client(void *ctx, const char *name, uint32_t default_pc,
530  enum osmo_ss7_asp_protocol prot, int default_local_port,
531  const char *default_local_ip, int default_remote_port,
532  const char *default_remote_ip);
533 
534 struct osmo_sccp_instance *
535 osmo_sccp_simple_client_on_ss7_id(void *ctx, uint32_t ss7_id, const char *name,
536  uint32_t default_pc,
537  enum osmo_ss7_asp_protocol prot,
538  int default_local_port,
539  const char *default_local_ip,
540  int default_remote_port,
541  const char *default_remote_ip);
542 
543 struct osmo_sccp_instance *
544 osmo_sccp_simple_server(void *ctx, uint32_t pc,
545  enum osmo_ss7_asp_protocol prot, int local_port,
546  const char *local_ip);
547 
548 struct osmo_sccp_instance *
549 osmo_sccp_simple_server_on_ss7_id(void *ctx, uint32_t ss7_id, uint32_t pc,
550  enum osmo_ss7_asp_protocol prot,
551  int local_port, const char *local_ip);
552 
553 struct osmo_sccp_instance *
555  enum osmo_ss7_asp_protocol prot,
556  const char *name, uint32_t pc,
557  int local_port, int remote_port,
558  const char *remote_ip);
559 
562 
563 /* VTY related */
564 struct vty;
565 void osmo_ss7_vty_init_asp(void *ctx);
566 void osmo_ss7_vty_init_sg(void *ctx);
567 int osmo_ss7_vty_go_parent(struct vty *vty);
568 int osmo_ss7_is_config_node(struct vty *vty, int node);
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.c:1101
uint32_t dpc
Definition: m3ua.h:506
int osmo_ss7_init(void)
Definition: osmo_ss7.c:2201
struct osmo_stream_cli * client
osmo_stream / libosmo-netif handles
Definition: osmo_ss7.h:396
void osmo_ss7_linkset_destroy(struct osmo_ss7_linkset *lset)
Destroy a SS7 Linkset.
Definition: osmo_ss7.c:545
uint32_t id
Definition: osmo_ss7.h:94
struct osmo_stream_srv_link * server
Definition: osmo_ss7.h:501
uint32_t quirks
Definition: osmo_ss7.h:430
struct osmo_xua_server * osmo_ss7_xua_server_find(struct osmo_ss7_instance *inst, enum osmo_ss7_asp_protocol proto, uint16_t local_port)
Definition: osmo_ss7.c:2063
uint32_t primary_pc
Definition: osmo_ss7.h:97
uint8_t si
Definition: osmo_ss7.h:255
uint8_t network_indicator
Definition: osmo_ss7.h:100
char * linkset_name
human-specified linkset name
Definition: osmo_ss7.h:224
bool simple_client_allocated
Were we allocated by "simple client" support?
Definition: osmo_ss7.h:311
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:432
bool osmo_ss7_asp_active(const struct osmo_ss7_asp *asp)
Definition: osmo_ss7.c:1541
void osmo_ss7_route_table_destroy(struct osmo_ss7_route_table *rtbl)
Definition: osmo_ss7.c:695
Definition: osmo_ss7.h:151
int osmo_ss7_mtp_to_user(struct osmo_ss7_instance *inst, struct osmo_mtp_prim *omp)
Definition: osmo_ss7.c:514
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:709
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:575
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:149
bool mode_set_by_vty
Definition: osmo_ss7.h:320
osmo_ss7_asp_role
Definition: osmo_ss7.h:375
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:451
uint32_t local_pc
Definition: osmo_ss7.h:191
char * description
Definition: osmo_ss7.h:315
uint8_t osmo_ss7_pc_width(const struct osmo_ss7_pc_fmt *pc_fmt)
Definition: osmo_ss7.c:194
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:735
struct osmo_stream_srv * server
Definition: osmo_ss7.h:397
uint32_t context
Definition: osmo_ss7.h:251
Definition: sccp_internal.h:42
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
const char * osmo_ss7_pointcode_print2(const struct osmo_ss7_instance *inst, uint32_t pc)
Definition: osmo_ss7.c:304
bool rkm_dyn_allocated
Were we dynamically allocated by RKM?
Definition: osmo_ss7.h:308
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:494
Definition: osmo_ss7.h:206
bool permit_dyn_rkm_alloc
Definition: osmo_ss7.h:102
void * priv
Definition: osmo_ss7.h:131
Definition: osmo_ss7.h:494
struct osmo_ss7_instance * inst
osmo_ss7_instance to which we belong
Definition: osmo_ss7.h:47
int osmo_ss7_asp_use_default_lm(struct osmo_ss7_asp *asp, int log_level)
Definition: xua_default_lm_fsm.c:374
uint32_t l_rk_id
Definition: osmo_ss7.h:252
struct osmo_fsm_inst * fi
ASP FSM.
Definition: osmo_ss7.h:389
bool accept_dyn_reg
Definition: osmo_ss7.h:504
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 protocol.
Definition: osmo_ss7.c:1373
void osmo_ss7_asp_destroy(struct osmo_ss7_asp *asp)
Definition: osmo_ss7.c:1437
struct value_string osmo_ss7_as_traffic_mode_vals[]
Definition: osmo_ss7.c:69
Definition: osmo_ss7.h:280
int osmo_ss7_xua_server_add_local_host(struct osmo_xua_server *xs, const char *local_host)
Definition: osmo_ss7.c:2165
uint8_t qos_class
Definition: osmo_ss7.h:429
Definition: osmo_ss7.h:360
const struct osmo_xua_layer_manager * lm
Definition: osmo_ss7.h:406
uint32_t osmo_ss7_pc_normalize(const struct osmo_ss7_pc_fmt *pc_fmt, uint32_t pc)
Definition: osmo_ss7.c:202
uint32_t asp_id
Definition: osmo_ss7.h:402
struct osmo_ss7_instance * inst
osmo_ss7_instance to which we belong
Definition: osmo_ss7.h:183
uint32_t priority
lower priority is higher
Definition: osmo_ss7.h:226
Definition: osmo_ss7.h:123
Definition: osmo_ss7.h:43
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:744
Definition: osmo_ss7.h:250
const char * osmo_ss7_route_print(const struct osmo_ss7_route *rt)
Definition: osmo_ss7.c:878
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:636
uint32_t pc
Definition: osmo_ss7.h:254
int osmo_ss7_asp_protocol_port(enum osmo_ss7_asp_protocol prot)
Definition: osmo_ss7.c:335
Definition: osmo_ss7.h:377
enum osmo_ss7_as_traffic_mode osmo_ss7_tmode_from_xua(uint32_t in)
Definition: osmo_ss7.c:2241
static const char * osmo_ss7_asp_protocol_name(enum osmo_ss7_asp_protocol mode)
Definition: osmo_ss7.h:287
Definition: osmo_ss7.h:279
osmo_ss7_as_patch_sccp_mode
Definition: osmo_ss7.h:294
const struct osmo_ss7_user * user[16]
Definition: osmo_ss7.h:87
int osmo_ss7_asp_restart(struct osmo_ss7_asp *asp)
Definition: osmo_ss7.c:1473
int osmo_ss7_as_del_asp(struct osmo_ss7_as *as, const char *asp_name)
Delete given ASP from given AS.
Definition: osmo_ss7.c:1052
struct osmo_ss7_route_table * rtable_system
Definition: osmo_ss7.h:89
int osmo_ss7_is_config_node(struct vty *vty, int node)
Definition: osmo_ss7_vty.c:2027
osmo_ss7_link_adm_state
Definition: osmo_ss7.h:150
enum osmo_ss7_asp_protocol proto
Definition: osmo_ss7.h:506
int osmo_ss7_tmode_to_xua(enum osmo_ss7_as_traffic_mode tmod)
Definition: osmo_ss7.c:2227
void osmo_ss7_link_destroy(struct osmo_ss7_link *link)
Destryo SS7 Link.
Definition: osmo_ss7.c:619
struct osmo_ss7_instance * inst
Definition: osmo_ss7.h:125
bool dyn_allocated
Were we dynamically allocated.
Definition: osmo_ss7.h:410
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_ss7_instance * osmo_ss7_instance_find(uint32_t id)
Find a SS7 Instance with given ID.
Definition: osmo_ss7.c:351
struct osmo_ss7_instance * inst
Definition: osmo_ss7.h:496
struct llist_head osmo_ss7_instances
Definition: osmo_ss7.h:281
uint32_t dpc
Definition: osmo_ss7.h:326
bool simple_client_allocated
Were we allocated by "simple client" support?
Definition: osmo_ss7.h:413
uint32_t mask
Definition: osmo_ss7.h:222
struct osmo_ss7_route_table * osmo_ss7_route_table_find_or_create(struct osmo_ss7_instance *inst, const char *name)
Definition: osmo_ss7.c:678
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:937
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:903
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.c:2130
enum osmo_ss7_asp_protocol proto
Definition: osmo_ss7.h:316
Definition: osmo_ss7.h:295
struct value_string osmo_ss7_asp_protocol_vals[]
Definition: osmo_ss7.c:77
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.c:2314
Definition: osmo_ss7.h:278
bool asp_id_present
Definition: osmo_ss7.h:403
static bool osmo_ss7_pc_is_valid(uint32_t pc)
Definition: osmo_ss7.h:34
Definition: osmo_ss7.h:490
Definition: osmo_ss7.h:296
int osmo_ss7_xua_server_set_local_host(struct osmo_xua_server *xs, const char *local_host)
Definition: osmo_ss7.c:2147
bool osmo_ss7_as_active(const struct osmo_ss7_as *as)
Determine if given AS is in the active state.
Definition: osmo_ss7.c:1117
void osmo_ss7_asp_disconnect(struct osmo_ss7_asp *asp)
Definition: osmo_ss7.c:2049
Definition: osmo_ss7.h:262
struct llist_head list
member in list of routing tables
Definition: osmo_ss7.h:45
no SCTP association with peer
Definition: osmo_ss7.h:368
void osmo_ss7_vty_init_asp(void *ctx)
Definition: osmo_ss7_vty.c:2143
bool role_set_by_vty
Definition: osmo_ss7.h:425
osmo_ss7_asp_admin_state
Definition: osmo_ss7.h:366
Definition: osmo_ss7.h:265
char * name
Definition: osmo_ss7.h:188
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:473
void osmo_ss7_route_destroy(struct osmo_ss7_route *rt)
Destroy a given SS7 route.
Definition: osmo_ss7.c:839
osmo_prim_cb prim_cb
Definition: osmo_ss7.h:491
void osmo_ss7_instance_destroy(struct osmo_ss7_instance *inst)
Destroy a SS7 Instance.
Definition: osmo_ss7.c:409
const char * osmo_ss7_pointcode_print(const struct osmo_ss7_instance *inst, uint32_t pc)
Definition: osmo_ss7.c:296
int osmo_ss7_asp_get_log_subsys(const struct osmo_ss7_asp *asp)
Get the logging subsystem for a given ASP.
Definition: osmo_ss7.c:2301
char * description
Definition: osmo_ss7.h:96
void osmo_ss7_vty_init_sg(void *ctx)
Definition: osmo_ss7_vty.c:2149
Definition: osmo_ss7.h:67
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:694
int osmo_ss7_vty_go_parent(struct vty *vty)
Definition: osmo_ss7_vty.c:1945
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:272
osmo_ss7_as_traffic_mode
Definition: osmo_ss7.h:260
char * name
Definition: osmo_ss7.h:95
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:750
int osmo_ss7_find_free_rctx(struct osmo_ss7_instance *inst)
Definition: osmo_ss7.c:104
char * description
Definition: osmo_ss7.h:189
struct osmo_ss7_instance * inst
Definition: osmo_ss7.h:386
osmo_ss7_asp_protocol
Definition: osmo_ss7.h:276
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.c:2006
const char * name
Definition: osmo_ss7.h:127
int osmo_ss7_user_mtp_xfer_req(struct osmo_ss7_instance *inst, struct osmo_mtp_prim *omp)
Definition: osmo_ss7_hmrt.c:284
Definition: osmo_ss7.h:261
Definition: osmo_ss7.h:383
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)
Definition: osmo_ss7.c:1405
struct osmo_ss7_instance * inst
Definition: osmo_ss7.h:302
struct osmo_fsm_inst * fi
AS FSM.
Definition: osmo_ss7.h:305
Definition: osmo_ss7.h:154
uint32_t ssn
Definition: osmo_ss7.h:256
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)
create a new xUA server configured with given ip/port
Definition: osmo_ss7.c:2085
struct llist_head routes
list of osmo_ss7_route
Definition: osmo_ss7.h:49
int osmo_ss7_as_add_asp(struct osmo_ss7_as *as, const char *asp_name)
Add given ASP to given AS.
Definition: osmo_ss7.c:1023
uint32_t adjacent_pc
Definition: osmo_ss7.h:190
SCP association, but reject ASP-ACTIVE.
Definition: osmo_ss7.h:370
struct osmo_ss7_asp * osmo_ss7_asp_find_by_name(struct osmo_ss7_instance *inst, const char *name)
Definition: osmo_ss7.c:1230
static const char * osmo_ss7_as_traffic_mode_name(enum osmo_ss7_as_traffic_mode mode)
Definition: osmo_ss7.h:271
struct osmo_sccp_instance * sccp
Definition: osmo_ss7.h:91
char * sock_name
pre-formatted human readable local/remote socket name
Definition: osmo_ss7.h:399
in normal operation
Definition: osmo_ss7.h:372
Definition: osmo_ss7.h:263
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:920
const struct value_string osmo_ss7_asp_role_names[]
Definition: osmo_ss7.c:85
Definition: osmo_ss7.h:264
size_t host_cnt
Definition: osmo_ss7.h:362
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:485
void osmo_ss7_as_destroy(struct osmo_ss7_as *as)
Destroy given Application Server.
Definition: osmo_ss7.c:1076
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:729
uint8_t qos_class
Definition: osmo_ss7.h:227
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:592
struct msgb * pending_msg
Pending message for non-blocking IPA read.
Definition: osmo_ss7.h:416
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)
Definition: osmo_ss7.c:1387
char * description
Definition: osmo_ss7.h:420
struct osmo_xua_server * xua_server
osmo_xua_server over which we were established
Definition: osmo_ss7.h:392
Definition: osmo_ss7.h:153
Definition: osmo_ss7.h:72
Definition: osmo_ss7.h:277
bool is_server
Definition: osmo_ss7.h:423
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.c:2153
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:955
Definition: osmo_ss7.h:180
Definition: osmo_ss7.h:152
bool osmo_ss7_pc_is_local(struct osmo_ss7_instance *inst, uint32_t pc)
Definition: osmo_ss7.c:2192
enum osmo_ss7_asp_protocol proto
Definition: osmo_ss7.h:421
char * name
Definition: osmo_ss7.h:314
osmo_prim_cb prim_cb
Definition: osmo_ss7.h:129
struct osmo_ss7_linkset * linkset
pointer to linkset (destination) of route
Definition: osmo_ss7.h:214
bool mode_set_by_peer
Definition: osmo_ss7.h:322
void * lm_priv
Definition: osmo_ss7.h:407
bool osmo_ss7_as_tmode_compatible_xua(struct osmo_ss7_as *as, uint32_t m3ua_tmt)
Definition: osmo_ss7.c:2255
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.c:1198
int osmo_ss7_asp_peer_snprintf(char *buf, size_t buf_len, struct osmo_ss7_asp_peer *peer)
Definition: osmo_ss7.c:1128
struct osmo_ss7_route_table * rtable
osmo_ss7_route_table to which we belong
Definition: osmo_ss7.h:210
char delimiter
Definition: osmo_ss7.h:68
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.c:1165
struct osmo_ss7_route_table::@19 cfg
struct osmo_ss7_as * as
pointer to Application Server
Definition: osmo_ss7.h:216
int osmo_ss7_pointcode_parse(struct osmo_ss7_instance *inst, const char *str)
Definition: osmo_ss7.c:238
Definition: osmo_ss7.h:299
int osmo_ss7_pointcode_parse_mask_or_len(struct osmo_ss7_instance *inst, const char *in)
Definition: osmo_ss7.c:310
uint8_t last_asp_idx_sent
Definition: osmo_ss7.h:331
uint32_t pc
Definition: osmo_ss7.h:221
uint16_t port
Definition: osmo_ss7.h:363
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:470
Definition: osmo_ss7.h:376
char * name
Definition: osmo_ss7.h:419
Definition: osmo_ss7.h:378
char * host[OSMO_SOCK_MAX_ADDRS]
Definition: osmo_ss7.h:361
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:786
Definition: mtp_sap.h:56
char * description
Definition: osmo_ss7.h:53
void osmo_ss7_xua_server_destroy(struct osmo_xua_server *xs)
Definition: osmo_ss7.c:2175
uint32_t recovery_timeout_msec
Definition: osmo_ss7.h:323
uint8_t qos_class
Definition: osmo_ss7.h:324
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:673
char * name
Definition: osmo_ss7.h:52
struct osmo_ss7_route_table * osmo_ss7_route_table_find(struct osmo_ss7_instance *inst, const char *name)
Definition: osmo_ss7.c:666