libosmo-sigtran  1.3.0.24-e7c8
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(const struct osmo_ss7_instance *inst, uint32_t pc);
28 const char *osmo_ss7_pointcode_print2(const struct osmo_ss7_instance *inst, uint32_t pc);
29 
30 /* All known point-code formats have a length of or below 24 bit.
31  * A point-code value exceeding that is used to indicate an unset PC. */
32 #define OSMO_SS7_PC_INVALID 0xffffffff
33 static inline bool osmo_ss7_pc_is_valid(uint32_t pc)
34 {
35  return pc <= 0x00ffffff;
36 }
37 
38 /***********************************************************************
39  * SS7 Routing Tables
40  ***********************************************************************/
41 
44  struct llist_head list;
48  struct llist_head routes;
49 
50  struct {
51  char *name;
52  char *description;
53  } cfg;
54 };
55 
56 struct osmo_ss7_route_table *
58 struct osmo_ss7_route_table *
61 
62 /***********************************************************************
63  * SS7 Instances
64  ***********************************************************************/
65 
67  char delimiter;
68  uint8_t component_len[3];
69 };
70 
73  struct llist_head list;
75  struct llist_head linksets;
77  struct llist_head as_list;
79  struct llist_head asp_list;
81  struct llist_head rtable_list;
83  struct llist_head xua_servers;
84  /* array for faster lookup of user (indexed by service
85  * indicator) */
86  const struct osmo_ss7_user *user[16];
87 
89 
91 
92  struct {
93  uint32_t id;
94  char *name;
95  char *description;
96  uint32_t primary_pc;
97  /* secondary PCs */
98  /* capability PCs */
100  struct osmo_ss7_pc_fmt pc_fmt;
102  struct llist_head sccp_address_book;
103  } cfg;
104 };
105 
106 struct osmo_ss7_instance *osmo_ss7_instance_find(uint32_t id);
107 struct osmo_ss7_instance *
108 osmo_ss7_instance_find_or_create(void *ctx, uint32_t id);
111  uint8_t c0, uint8_t c1, uint8_t c2);
112 
114 
115 uint8_t osmo_ss7_pc_width(const struct osmo_ss7_pc_fmt *pc_fmt);
116 
117 /***********************************************************************
118  * MTP Users (Users of MTP, such as SCCP or ISUP)
119  ***********************************************************************/
120 
122  /* pointer back to SS7 instance */
124  /* name of the user */
125  const char *name;
126  /* primitive call-back for incoming MTP primitives */
127  osmo_prim_cb prim_cb;
128  /* private data */
129  void *priv;
130 };
131 
132 int osmo_ss7_user_register(struct osmo_ss7_instance *inst, uint8_t service_ind,
133  struct osmo_ss7_user *user);
134 
135 int osmo_ss7_user_unregister(struct osmo_ss7_instance *inst, uint8_t service_ind,
136  struct osmo_ss7_user *user);
137 
138 int osmo_ss7_mtp_to_user(struct osmo_ss7_instance *inst, struct osmo_mtp_prim *omp);
139 
140 /* SS7 User wants to issue MTP-TRANSFER.req */
142  struct osmo_mtp_prim *omp);
143 
144 /***********************************************************************
145  * SS7 Links
146  ***********************************************************************/
147 
153 };
154 
155 struct osmo_ss7_linkset;
156 struct osmo_ss7_link;
157 
161  struct {
162  char *name;
163  char *description;
164  uint32_t id;
165 
166  enum osmo_ss7_link_adm_state adm_state;
167  } cfg;
168 };
169 
170 void osmo_ss7_link_destroy(struct osmo_ss7_link *link);
171 struct osmo_ss7_link *
172 osmo_ss7_link_find_or_create(struct osmo_ss7_linkset *lset, uint32_t id);
173 
174 /***********************************************************************
175  * SS7 Linksets
176  ***********************************************************************/
177 
179  struct llist_head list;
183  struct osmo_ss7_link *links[16];
184 
185  struct {
186  char *name;
187  char *description;
188  uint32_t adjacent_pc;
189  uint32_t local_pc;
190  } cfg;
191 };
192 
193 void osmo_ss7_linkset_destroy(struct osmo_ss7_linkset *lset);
194 struct osmo_ss7_linkset *
196 struct osmo_ss7_linkset *
197 osmo_ss7_linkset_find_or_create(struct osmo_ss7_instance *inst, const char *name, uint32_t pc);
198 
199 
200 /***********************************************************************
201  * SS7 Routes
202  ***********************************************************************/
203 
206  struct llist_head list;
209 
210  struct {
214  struct osmo_ss7_as *as;
215  } dest;
216 
217  struct {
218  /* FIXME: presence? */
219  uint32_t pc;
220  uint32_t mask;
224  uint32_t priority;
225  uint8_t qos_class;
226  } cfg;
227 };
228 
229 struct osmo_ss7_route *
230 osmo_ss7_route_find_dpc(struct osmo_ss7_route_table *rtbl, uint32_t dpc);
231 struct osmo_ss7_route *
233  uint32_t mask);
234 struct osmo_ss7_route *
236 struct osmo_ss7_route *
237 osmo_ss7_route_create(struct osmo_ss7_route_table *rtbl, uint32_t dpc,
238  uint32_t mask, const char *linkset_name);
239 void osmo_ss7_route_destroy(struct osmo_ss7_route *rt);
240 const char *osmo_ss7_route_print(const struct osmo_ss7_route *rt);
241 const char *osmo_ss7_route_name(struct osmo_ss7_route *rt, bool list_asps);
242 
243 
244 /***********************************************************************
245  * SS7 Application Servers
246  ***********************************************************************/
247 
249  uint32_t context;
250  uint32_t l_rk_id;
251 
252  uint32_t pc;
253  uint8_t si;
254  uint32_t ssn;
255  /* FIXME: more complex routing keys */
256 };
257 
259  OSMO_SS7_AS_TMOD_OVERRIDE = 0, /* default */
264 };
265 
266 extern struct value_string osmo_ss7_as_traffic_mode_vals[];
267 
268 static inline const char *
270 {
271  return get_value_string(osmo_ss7_as_traffic_mode_vals, mode);
272 }
273 
280 };
281 
282 extern struct value_string osmo_ss7_asp_protocol_vals[];
283 
284 static inline const char *
286 {
287  return get_value_string(osmo_ss7_asp_protocol_vals, mode);
288 }
289 
291 
293  OSMO_SS7_PATCH_NONE, /* no patching of SCCP */
294  OSMO_SS7_PATCH_BOTH, /* patch both OPC and DPC into SCCP addresses */
295 };
296 
297 struct osmo_ss7_as {
299  struct llist_head list;
301 
303  struct osmo_fsm_inst *fi;
304 
307 
310 
311  struct {
312  char *name;
313  char *description;
315  struct osmo_ss7_routing_key routing_key;
317  /* traffic mode was configured by VTY / config file */
319  /* traffic mode was configured by RKM (routing key management) or first ASPAC */
322  uint8_t qos_class;
323  struct {
324  uint32_t dpc;
326  } pc_override;
327 
328  struct osmo_ss7_asp *asps[16];
329  uint8_t last_asp_idx_sent; /* used for load-sharing traffic mode (round robin implementation) */
330  } cfg;
331 };
332 
333 struct osmo_ss7_as *
335 struct osmo_ss7_as *
336 osmo_ss7_as_find_by_rctx(struct osmo_ss7_instance *inst, uint32_t rctx);
337 struct osmo_ss7_as *
338 osmo_ss7_as_find_by_l_rk_id(struct osmo_ss7_instance *inst, uint32_t l_rk_id);
341 struct osmo_ss7_as *
344 int osmo_ss7_as_add_asp(struct osmo_ss7_as *as, const char *asp_name);
345 int osmo_ss7_as_del_asp(struct osmo_ss7_as *as, const char *asp_name);
346 void osmo_ss7_as_destroy(struct osmo_ss7_as *as);
347 bool osmo_ss7_as_has_asp(struct osmo_ss7_as *as,
348  struct osmo_ss7_asp *asp);
349 bool osmo_ss7_as_active(const struct osmo_ss7_as *as);
350 bool osmo_ss7_as_tmode_compatible_xua(struct osmo_ss7_as *as, uint32_t m3ua_tmt);
351 void osmo_ss7_asp_disconnect(struct osmo_ss7_asp *asp);
352 
353 
354 /***********************************************************************
355  * SS7 Application Server Processes
356  ***********************************************************************/
357 
359  char *host[OSMO_SOCK_MAX_ADDRS];
360  size_t host_cnt;
361  uint16_t port;
362 };
363 
371 };
372 
377 };
378 
379 extern const struct value_string osmo_ss7_asp_role_names[];
380 
381 struct osmo_ss7_asp {
383  struct llist_head list;
385 
387  struct osmo_fsm_inst *fi;
388 
391  struct llist_head siblings;
392 
394  struct osmo_stream_cli *client;
395  struct osmo_stream_srv *server;
397  char *sock_name;
398 
399  /* ASP Identifier for ASP-UP + NTFY */
400  uint32_t asp_id;
402 
403  /* Layer Manager to which we talk */
404  const struct osmo_xua_layer_manager *lm;
405  void *lm_priv;
406 
409 
412 
414  struct msgb *pending_msg;
415 
416  struct {
417  char *name;
418  char *description;
420  enum osmo_ss7_asp_admin_state adm_state;
421  bool is_server;
422  enum osmo_ss7_asp_role role;
424 
425  struct osmo_ss7_asp_peer local;
426  struct osmo_ss7_asp_peer remote;
427  uint8_t qos_class;
428  } cfg;
429 };
430 
431 int osmo_ss7_asp_peer_snprintf(char* buf, size_t buf_len, struct osmo_ss7_asp_peer *peer);
432 int osmo_ss7_asp_peer_set_hosts(struct osmo_ss7_asp_peer *peer, void *talloc_ctx,
433  const char* const* hosts, size_t host_cnt);
434 int osmo_ss7_asp_peer_add_host(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *host);
435 
436 struct osmo_ss7_asp *
438 struct osmo_ss7_asp
441 struct osmo_ss7_asp *
442 osmo_ss7_asp_find(struct osmo_ss7_instance *inst, const char *name,
443  uint16_t remote_port, uint16_t local_port,
445 struct osmo_ss7_asp *
447  uint16_t remote_port, uint16_t local_port,
449 void osmo_ss7_asp_destroy(struct osmo_ss7_asp *asp);
450 int osmo_ss7_asp_send(struct osmo_ss7_asp *asp, struct msgb *msg);
451 int osmo_ss7_asp_restart(struct osmo_ss7_asp *asp);
452 int osmo_ss7_asp_use_default_lm(struct osmo_ss7_asp *asp, int log_level);
453 bool osmo_ss7_asp_active(const struct osmo_ss7_asp *asp);
454 
462 typedef int osmo_ss7_asp_rx_unknown_cb(struct osmo_ss7_asp *asp, int ppid_mux, struct msgb *msg);
463 
465 
466 #define _LOGSS7(inst, subsys, level, fmt, args ...) \
467  LOGP(subsys, level, "%u: " fmt, inst ? (inst)->cfg.id : 0, ## args)
468 #define LOGSS7(inst, level, fmt, args ...) _LOGSS7(inst, DLSS7, level, fmt, ## args)
469 
470 #define LOGPASP(asp, subsys, level, fmt, args ...) \
471  _LOGSS7((asp)->inst, subsys, level, "asp-%s: " fmt, (asp)->cfg.name, ## args)
472 #define LOGPAS(as, subsys, level, fmt, args ...) \
473  _LOGSS7((as)->inst, subsys, level, "as-%s: " fmt, (as)->cfg.name, ## args)
474 
475 /***********************************************************************
476  * xUA Servers
477  ***********************************************************************/
478 
480  osmo_prim_cb prim_cb;
481 };
482 
484  struct llist_head list;
486 
487  /* list of ASPs established via this server */
488  struct llist_head asp_list;
489 
490  struct osmo_stream_srv_link *server;
491 
492  struct {
494  struct osmo_ss7_asp_peer local;
496  } cfg;
497 };
498 
499 struct osmo_xua_server *
501  uint16_t local_port);
502 
503 struct osmo_xua_server *
505  uint16_t local_port, const char *local_host);
506 
507 int
509 
510 int
511 osmo_ss7_xua_server_set_local_host(struct osmo_xua_server *xs, const char *local_host);
512 int
513 osmo_ss7_xua_server_set_local_hosts(struct osmo_xua_server *xs, const char **local_hosts, size_t local_host_cnt);
514 int osmo_ss7_xua_server_add_local_host(struct osmo_xua_server *xs, const char *local_host);
516 
517 struct osmo_sccp_instance *
518 osmo_sccp_simple_client(void *ctx, const char *name, uint32_t default_pc,
519  enum osmo_ss7_asp_protocol prot, int default_local_port,
520  const char *default_local_ip, int default_remote_port,
521  const char *default_remote_ip);
522 
523 struct osmo_sccp_instance *
524 osmo_sccp_simple_client_on_ss7_id(void *ctx, uint32_t ss7_id, const char *name,
525  uint32_t default_pc,
526  enum osmo_ss7_asp_protocol prot,
527  int default_local_port,
528  const char *default_local_ip,
529  int default_remote_port,
530  const char *default_remote_ip);
531 
532 struct osmo_sccp_instance *
533 osmo_sccp_simple_server(void *ctx, uint32_t pc,
534  enum osmo_ss7_asp_protocol prot, int local_port,
535  const char *local_ip);
536 
537 struct osmo_sccp_instance *
538 osmo_sccp_simple_server_on_ss7_id(void *ctx, uint32_t ss7_id, uint32_t pc,
539  enum osmo_ss7_asp_protocol prot,
540  int local_port, const char *local_ip);
541 
542 struct osmo_sccp_instance *
544  enum osmo_ss7_asp_protocol prot,
545  const char *name, uint32_t pc,
546  int local_port, int remote_port,
547  const char *remote_ip);
548 
551 
552 /* VTY related */
553 struct vty;
554 void osmo_ss7_vty_init_asp(void *ctx);
555 void osmo_ss7_vty_init_sg(void *ctx);
556 int osmo_ss7_vty_go_parent(struct vty *vty);
557 int osmo_ss7_is_config_node(struct vty *vty, int node);
uint32_t dpc
Definition: m3ua.h:495
int osmo_ss7_init(void)
Definition: osmo_ss7.c:2162
struct osmo_stream_cli * client
osmo_stream / libosmo-netif handles
Definition: osmo_ss7.h:394
void osmo_ss7_linkset_destroy(struct osmo_ss7_linkset *lset)
Destroy a SS7 Linkset.
Definition: osmo_ss7.c:529
uint32_t id
Definition: osmo_ss7.h:93
struct osmo_stream_srv_link * server
Definition: osmo_ss7.h:490
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:2024
uint32_t primary_pc
Definition: osmo_ss7.h:96
uint8_t si
Definition: osmo_ss7.h:253
uint8_t network_indicator
Definition: osmo_ss7.h:99
char * linkset_name
human-specified linkset name
Definition: osmo_ss7.h:222
bool simple_client_allocated
Were we allocated by "simple client" support?
Definition: osmo_ss7.h:309
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:416
bool osmo_ss7_asp_active(const struct osmo_ss7_asp *asp)
Definition: osmo_ss7.c:1499
void osmo_ss7_route_table_destroy(struct osmo_ss7_route_table *rtbl)
Definition: osmo_ss7.c:679
Definition: osmo_ss7.h:149
int osmo_ss7_mtp_to_user(struct osmo_ss7_instance *inst, struct osmo_mtp_prim *omp)
Definition: osmo_ss7.c:498
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:693
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:559
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:318
osmo_ss7_asp_role
Definition: osmo_ss7.h:373
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:435
uint32_t local_pc
Definition: osmo_ss7.h:189
char * description
Definition: osmo_ss7.h:313
uint8_t osmo_ss7_pc_width(const struct osmo_ss7_pc_fmt *pc_fmt)
Definition: osmo_ss7.c:187
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:728
struct osmo_stream_srv * server
Definition: osmo_ss7.h:395
uint32_t context
Definition: osmo_ss7.h:249
Definition: sccp_internal.h:41
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:352
const char * osmo_ss7_pointcode_print2(const struct osmo_ss7_instance *inst, uint32_t pc)
Definition: osmo_ss7.c:288
bool rkm_dyn_allocated
Were we dynamically allocated by RKM?
Definition: osmo_ss7.h:306
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:478
Definition: osmo_ss7.h:204
bool permit_dyn_rkm_alloc
Definition: osmo_ss7.h:101
void * priv
Definition: osmo_ss7.h:129
Definition: osmo_ss7.h:483
struct osmo_ss7_instance * inst
osmo_ss7_instance to which we belong
Definition: osmo_ss7.h:46
int osmo_ss7_asp_use_default_lm(struct osmo_ss7_asp *asp, int log_level)
Definition: xua_default_lm_fsm.c:367
uint32_t l_rk_id
Definition: osmo_ss7.h:250
struct osmo_fsm_inst * fi
ASP FSM.
Definition: osmo_ss7.h:387
bool accept_dyn_reg
Definition: osmo_ss7.h:493
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:1331
void osmo_ss7_asp_destroy(struct osmo_ss7_asp *asp)
Definition: osmo_ss7.c:1395
struct value_string osmo_ss7_as_traffic_mode_vals[]
Definition: osmo_ss7.c:62
Definition: osmo_ss7.h:278
int osmo_ss7_xua_server_add_local_host(struct osmo_xua_server *xs, const char *local_host)
Definition: osmo_ss7.c:2126
uint8_t qos_class
Definition: osmo_ss7.h:427
Definition: osmo_ss7.h:358
const struct osmo_xua_layer_manager * lm
Definition: osmo_ss7.h:404
uint32_t asp_id
Definition: osmo_ss7.h:400
struct osmo_ss7_instance * inst
osmo_ss7_instance to which we belong
Definition: osmo_ss7.h:181
uint32_t priority
lower priority is higher
Definition: osmo_ss7.h:224
Definition: osmo_ss7.h:121
Definition: osmo_ss7.h:42
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:737
Definition: osmo_ss7.h:248
const char * osmo_ss7_route_print(const struct osmo_ss7_route *rt)
Definition: osmo_ss7.c:836
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:620
uint32_t pc
Definition: osmo_ss7.h:252
int osmo_ss7_asp_protocol_port(enum osmo_ss7_asp_protocol prot)
Definition: osmo_ss7.c:319
Definition: osmo_ss7.h:375
enum osmo_ss7_as_traffic_mode osmo_ss7_tmode_from_xua(uint32_t in)
Definition: osmo_ss7.c:2202
static const char * osmo_ss7_asp_protocol_name(enum osmo_ss7_asp_protocol mode)
Definition: osmo_ss7.h:285
Definition: osmo_ss7.h:277
osmo_ss7_as_patch_sccp_mode
Definition: osmo_ss7.h:292
const struct osmo_ss7_user * user[16]
Definition: osmo_ss7.h:86
int osmo_ss7_asp_restart(struct osmo_ss7_asp *asp)
Definition: osmo_ss7.c:1431
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:1010
struct osmo_ss7_route_table * rtable_system
Definition: osmo_ss7.h:88
int osmo_ss7_is_config_node(struct vty *vty, int node)
Definition: osmo_ss7_vty.c:1969
osmo_ss7_link_adm_state
Definition: osmo_ss7.h:148
enum osmo_ss7_asp_protocol proto
Definition: osmo_ss7.h:495
int osmo_ss7_tmode_to_xua(enum osmo_ss7_as_traffic_mode tmod)
Definition: osmo_ss7.c:2188
void osmo_ss7_link_destroy(struct osmo_ss7_link *link)
Destryo SS7 Link.
Definition: osmo_ss7.c:603
struct osmo_ss7_instance * inst
Definition: osmo_ss7.h:123
bool dyn_allocated
Were we dynamically allocated.
Definition: osmo_ss7.h:408
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:948
struct osmo_ss7_instance * osmo_ss7_instance_find(uint32_t id)
Find a SS7 Instance with given ID.
Definition: osmo_ss7.c:335
struct osmo_ss7_instance * inst
Definition: osmo_ss7.h:485
struct llist_head osmo_ss7_instances
Definition: osmo_ss7.h:279
uint32_t dpc
Definition: osmo_ss7.h:324
bool simple_client_allocated
Were we allocated by "simple client" support?
Definition: osmo_ss7.h:411
uint32_t mask
Definition: osmo_ss7.h:220
struct osmo_ss7_route_table * osmo_ss7_route_table_find_or_create(struct osmo_ss7_instance *inst, const char *name)
Definition: osmo_ss7.c:662
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:895
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:861
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:2091
enum osmo_ss7_asp_protocol proto
Definition: osmo_ss7.h:314
Definition: osmo_ss7.h:293
struct value_string osmo_ss7_asp_protocol_vals[]
Definition: osmo_ss7.c:70
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:2262
Definition: osmo_ss7.h:276
bool asp_id_present
Definition: osmo_ss7.h:401
static bool osmo_ss7_pc_is_valid(uint32_t pc)
Definition: osmo_ss7.h:33
Definition: osmo_ss7.h:479
Definition: osmo_ss7.h:294
int osmo_ss7_xua_server_set_local_host(struct osmo_xua_server *xs, const char *local_host)
Definition: osmo_ss7.c:2108
bool osmo_ss7_as_active(const struct osmo_ss7_as *as)
Determine if given AS is in the active state.
Definition: osmo_ss7.c:1075
void osmo_ss7_asp_disconnect(struct osmo_ss7_asp *asp)
Definition: osmo_ss7.c:2010
Definition: osmo_ss7.h:260
struct llist_head list
member in list of routing tables
Definition: osmo_ss7.h:44
no SCTP association with peer
Definition: osmo_ss7.h:366
void osmo_ss7_vty_init_asp(void *ctx)
Definition: osmo_ss7_vty.c:2072
bool role_set_by_vty
Definition: osmo_ss7.h:423
osmo_ss7_asp_admin_state
Definition: osmo_ss7.h:364
Definition: osmo_ss7.h:263
char * name
Definition: osmo_ss7.h:186
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:462
void osmo_ss7_route_destroy(struct osmo_ss7_route *rt)
Destroy a given SS7 route.
Definition: osmo_ss7.c:803
osmo_prim_cb prim_cb
Definition: osmo_ss7.h:480
void osmo_ss7_instance_destroy(struct osmo_ss7_instance *inst)
Destroy a SS7 Instance.
Definition: osmo_ss7.c:393
const char * osmo_ss7_pointcode_print(const struct osmo_ss7_instance *inst, uint32_t pc)
Definition: osmo_ss7.c:280
char * description
Definition: osmo_ss7.h:95
void osmo_ss7_vty_init_sg(void *ctx)
Definition: osmo_ss7_vty.c:2078
Definition: osmo_ss7.h:66
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:687
int osmo_ss7_vty_go_parent(struct vty *vty)
Definition: osmo_ss7_vty.c:1887
osmo_ss7_as_traffic_mode
Definition: osmo_ss7.h:258
char * name
Definition: osmo_ss7.h:94
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:728
int osmo_ss7_find_free_rctx(struct osmo_ss7_instance *inst)
Definition: osmo_ss7.c:97
char * description
Definition: osmo_ss7.h:187
struct osmo_ss7_instance * inst
Definition: osmo_ss7.h:384
osmo_ss7_asp_protocol
Definition: osmo_ss7.h:274
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:1967
const char * name
Definition: osmo_ss7.h:125
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:259
Definition: osmo_ss7.h:381
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:1363
struct osmo_ss7_instance * inst
Definition: osmo_ss7.h:300
struct osmo_fsm_inst * fi
AS FSM.
Definition: osmo_ss7.h:303
Definition: osmo_ss7.h:152
uint32_t ssn
Definition: osmo_ss7.h:254
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:2046
struct llist_head routes
list of osmo_ss7_route
Definition: osmo_ss7.h:48
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:981
uint32_t adjacent_pc
Definition: osmo_ss7.h:188
SCP association, but reject ASP-ACTIVE.
Definition: osmo_ss7.h:368
struct osmo_ss7_asp * osmo_ss7_asp_find_by_name(struct osmo_ss7_instance *inst, const char *name)
Definition: osmo_ss7.c:1188
static const char * osmo_ss7_as_traffic_mode_name(enum osmo_ss7_as_traffic_mode mode)
Definition: osmo_ss7.h:269
struct osmo_sccp_instance * sccp
Definition: osmo_ss7.h:90
char * sock_name
pre-formatted human readable local/remote socket name
Definition: osmo_ss7.h:397
in normal operation
Definition: osmo_ss7.h:370
Definition: osmo_ss7.h:261
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:878
const struct value_string osmo_ss7_asp_role_names[]
Definition: osmo_ss7.c:78
Definition: osmo_ss7.h:262
size_t host_cnt
Definition: osmo_ss7.h:360
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:478
void osmo_ss7_as_destroy(struct osmo_ss7_as *as)
Destroy given Application Server.
Definition: osmo_ss7.c:1034
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:710
uint8_t qos_class
Definition: osmo_ss7.h:225
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:576
struct msgb * pending_msg
Pending message for non-blocking IPA read.
Definition: osmo_ss7.h:414
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:1345
char * description
Definition: osmo_ss7.h:418
struct osmo_xua_server * xua_server
osmo_xua_server over which we were established
Definition: osmo_ss7.h:390
Definition: osmo_ss7.h:151
Definition: osmo_ss7.h:71
Definition: osmo_ss7.h:275
bool is_server
Definition: osmo_ss7.h:421
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:2114
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:913
Definition: osmo_ss7.h:178
Definition: osmo_ss7.h:150
bool osmo_ss7_pc_is_local(struct osmo_ss7_instance *inst, uint32_t pc)
Definition: osmo_ss7.c:2153
enum osmo_ss7_asp_protocol proto
Definition: osmo_ss7.h:419
char * name
Definition: osmo_ss7.h:312
osmo_prim_cb prim_cb
Definition: osmo_ss7.h:127
struct osmo_ss7_linkset * linkset
pointer to linkset (destination) of route
Definition: osmo_ss7.h:212
bool mode_set_by_peer
Definition: osmo_ss7.h:320
void * lm_priv
Definition: osmo_ss7.h:405
bool osmo_ss7_as_tmode_compatible_xua(struct osmo_ss7_as *as, uint32_t m3ua_tmt)
Definition: osmo_ss7.c:2216
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:1156
int osmo_ss7_asp_peer_snprintf(char *buf, size_t buf_len, struct osmo_ss7_asp_peer *peer)
Definition: osmo_ss7.c:1086
struct osmo_ss7_route_table * rtable
osmo_ss7_route_table to which we belong
Definition: osmo_ss7.h:208
char delimiter
Definition: osmo_ss7.h:67
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:1123
struct osmo_ss7_route_table::@19 cfg
struct osmo_ss7_as * as
pointer to Application Server
Definition: osmo_ss7.h:214
int osmo_ss7_pointcode_parse(struct osmo_ss7_instance *inst, const char *str)
Definition: osmo_ss7.c:222
Definition: osmo_ss7.h:297
int osmo_ss7_pointcode_parse_mask_or_len(struct osmo_ss7_instance *inst, const char *in)
Definition: osmo_ss7.c:294
uint8_t last_asp_idx_sent
Definition: osmo_ss7.h:329
uint32_t pc
Definition: osmo_ss7.h:219
uint16_t port
Definition: osmo_ss7.h:361
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:454
Definition: osmo_ss7.h:374
bool osmo_ss7_as_has_asp(struct osmo_ss7_as *as, struct osmo_ss7_asp *asp)
Determine if given AS contains ASP.
Definition: osmo_ss7.c:1059
char * name
Definition: osmo_ss7.h:417
Definition: osmo_ss7.h:376
char * host[OSMO_SOCK_MAX_ADDRS]
Definition: osmo_ss7.h:359
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:764
Definition: mtp_sap.h:56
char * description
Definition: osmo_ss7.h:52
void osmo_ss7_xua_server_destroy(struct osmo_xua_server *xs)
Definition: osmo_ss7.c:2136
uint32_t recovery_timeout_msec
Definition: osmo_ss7.h:321
uint8_t qos_class
Definition: osmo_ss7.h:322
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:666
char * name
Definition: osmo_ss7.h:51
struct osmo_ss7_route_table * osmo_ss7_route_table_find(struct osmo_ss7_instance *inst, const char *name)
Definition: osmo_ss7.c:650