libosmo-sigtran  1.0.0
Osmocom SIGTRAN library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
sccp_internal.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <osmocom/core/fsm.h>
4 #include <osmocom/core/prim.h>
7 
8 #define SCCP_STR "Signalling Connection Control Part\n"
9 
10 /* Appendix C.4 of Q.714 */
21  /* This must remain the last item: */
23 };
24 
26  uint32_t s;
27  uint32_t us;
28 };
29 
30 extern const struct osmo_sccp_timer_val osmo_sccp_timer_defaults[];
31 
32 extern const struct value_string osmo_sccp_timer_names[];
33 static inline const char *osmo_sccp_timer_name(enum osmo_sccp_timer val)
34 { return get_value_string(osmo_sccp_timer_names, val); }
35 
36 extern const struct value_string osmo_sccp_timer_descriptions[];
37 static inline const char *osmo_sccp_timer_description(enum osmo_sccp_timer val)
38 { return get_value_string(osmo_sccp_timer_descriptions, val); }
39 
40 /* an instance of the SCCP stack */
42  /* entry in global list of ss7 instances */
43  struct llist_head list;
44  /* list of 'struct sccp_connection' in this instance */
45  struct llist_head connections;
46  /* list of SCCP users in this instance */
47  struct llist_head users;
48  /* routing context to be used in all outbound messages */
49  uint32_t route_ctx;
50  /* next local reference to allocate */
51  uint32_t next_id;
53  void *priv;
54 
56 
58 };
59 
62  struct llist_head list;
66  char *name;
67 
69  uint16_t ssn;
70  uint32_t pc;
71 
72  /* set if we are a server */
73  struct llist_head links;
74 
75  /* user call-back function in case of incoming primitives */
76  osmo_prim_cb prim_cb;
77  void *priv;
78 
79  /* Application Server FSM Instance */
80  struct osmo_fsm_inst *as_fi;
81 };
82 
83 extern int DSCCP;
84 
85 struct xua_msg;
86 
87 struct osmo_sccp_user *
88 sccp_user_find(struct osmo_sccp_instance *inst, uint16_t ssn, uint32_t pc);
89 
90 /* Message from SCOC -> SCRC */
92  struct xua_msg *xua);
93 
94 /* Message from SCLC -> SCRC */
95 int sccp_scrc_rx_sclc_msg(struct osmo_sccp_instance *inst, struct xua_msg *xua);
96 
97 /* Message from MTP (SUA) -> SCRC */
99  struct xua_msg *xua);
100 
101 /* Message from SCRC -> SCOC */
103  struct xua_msg *xua);
105  struct xua_msg *xua, uint32_t cause);
106 
108 
109 /* Message from SCRC -> SCLC */
111  struct xua_msg *xua);
113  struct xua_msg *xua, uint32_t cause);
114 
115 int sccp_user_prim_up(struct osmo_sccp_user *scut, struct osmo_scu_prim *prim);
116 
117 /* SCU -> SCLC */
118 int sccp_sclc_user_sap_down(struct osmo_sccp_user *scu, struct osmo_prim_hdr *oph);
119 
120 struct msgb *sccp_msgb_alloc(const char *name);
121 
122 struct osmo_fsm sccp_scoc_fsm;
123 
124 void sccp_scoc_show_connections(struct vty *vty, struct osmo_sccp_instance *inst);
125 
126 const struct osmo_sccp_timer_val *osmo_sccp_timer_get(const struct osmo_sccp_instance *inst,
127  enum osmo_sccp_timer timer,
128  bool default_if_unset);
129 
130 void osmo_sccp_vty_write_cs7_node(struct vty *vty, const char *indent, struct osmo_sccp_instance *inst);
void * priv
Definition: sccp_internal.h:77
struct osmo_sccp_timer_val timers[OSMO_SCCP_TIMERS_COUNT]
Definition: sccp_internal.h:57
Definition: sccp_internal.h:19
Definition: sccp_internal.h:13
char * name
human-readable name of this user
Definition: sccp_internal.h:66
struct msgb * sccp_msgb_alloc(const char *name)
Definition: sua.c:63
Definition: sccp_internal.h:12
uint32_t route_ctx
Definition: sccp_internal.h:49
Definition: sccp_internal.h:16
uint16_t ssn
SSN and/or point code to which we are bound.
Definition: sccp_internal.h:69
Definition: sccp_internal.h:41
struct osmo_fsm sccp_scoc_fsm
Definition: sccp_internal.h:122
Definition: sccp_sap.h:225
int sccp_user_prim_up(struct osmo_sccp_user *scut, struct osmo_scu_prim *prim)
Send a SCCP User SAP Primitive up to the User.
Definition: sccp_user.c:153
osmo_prim_cb prim_cb
Definition: sccp_internal.h:76
uint32_t s
Definition: sccp_internal.h:26
int DSCCP
void sccp_sclc_rx_scrc_rout_fail(struct osmo_sccp_instance *inst, struct xua_msg *xua, uint32_t cause)
SCRC -> SCLC (Routing Failure.
Definition: sccp_sclc.c:327
Definition: osmo_ss7.h:122
void * priv
Definition: sccp_internal.h:53
struct llist_head users
Definition: sccp_internal.h:47
Definition: sccp_internal.h:14
struct osmo_sccp_instance * inst
pointer back to SCCP instance
Definition: sccp_internal.h:64
struct osmo_ss7_user ss7_user
Definition: sccp_internal.h:55
void sccp_scoc_rx_from_scrc(struct osmo_sccp_instance *inst, struct xua_msg *xua)
Main entrance function for primitives from the SCRC (Routing Control)
Definition: sccp_scoc.c:1594
struct llist_head links
Definition: sccp_internal.h:73
const struct value_string osmo_sccp_timer_names[]
Definition: sccp_scoc.c:225
void sccp_scoc_flush_connections(struct osmo_sccp_instance *inst)
Definition: sccp_scoc.c:1754
void osmo_sccp_vty_write_cs7_node(struct vty *vty, const char *indent, struct osmo_sccp_instance *inst)
Definition: sccp_vty.c:227
Definition: sccp_internal.h:22
Definition: sccp_internal.h:60
static const char * osmo_sccp_timer_name(enum osmo_sccp_timer val)
Definition: sccp_internal.h:33
const struct osmo_sccp_timer_val * osmo_sccp_timer_get(const struct osmo_sccp_instance *inst, enum osmo_sccp_timer timer, bool default_if_unset)
Definition: sccp_scoc.c:289
Definition: sccp_internal.h:18
struct osmo_ss7_instance * ss7
Definition: sccp_internal.h:52
Definition: sccp_internal.h:17
int sccp_scrc_rx_sclc_msg(struct osmo_sccp_instance *inst, struct xua_msg *xua)
Definition: sccp_scrc.c:415
Definition: sccp_internal.h:15
int scrc_rx_mtp_xfer_ind_xua(struct osmo_sccp_instance *inst, struct xua_msg *xua)
Definition: sccp_scrc.c:442
uint32_t next_id
Definition: sccp_internal.h:51
int sccp_scrc_rx_scoc_conn_msg(struct osmo_sccp_instance *inst, struct xua_msg *xua)
Definition: sccp_scrc.c:393
void sccp_scoc_rx_scrc_rout_fail(struct osmo_sccp_instance *inst, struct xua_msg *xua, uint32_t cause)
SCOC: Receive SCRC Routing Failure.
Definition: sccp_scoc.c:1328
struct llist_head list
entry in list of sccp users of osmo_sccp_instance
Definition: sccp_internal.h:62
const struct osmo_sccp_timer_val osmo_sccp_timer_defaults[]
Definition: sccp_scoc.c:270
Definition: sccp_internal.h:25
Definition: xua_msg.h:31
struct llist_head connections
Definition: sccp_internal.h:45
struct osmo_sccp_user * sccp_user_find(struct osmo_sccp_instance *inst, uint16_t ssn, uint32_t pc)
Find a SCCP User registered for given PC+SSN or SSN only.
Definition: sccp_user.c:47
Definition: osmo_ss7.h:70
const struct value_string osmo_sccp_timer_descriptions[]
Definition: sccp_scoc.c:240
int sccp_sclc_rx_from_scrc(struct osmo_sccp_instance *inst, struct xua_msg *xua)
SCRC -> SCLC (connectionless message)
Definition: sccp_sclc.c:251
uint32_t us
Definition: sccp_internal.h:27
uint32_t pc
Definition: sccp_internal.h:70
struct osmo_fsm_inst * as_fi
Definition: sccp_internal.h:80
static const char * osmo_sccp_timer_description(enum osmo_sccp_timer val)
Definition: sccp_internal.h:37
struct llist_head list
Definition: sccp_internal.h:43
Definition: sccp_internal.h:20
osmo_sccp_timer
Definition: sccp_internal.h:11
void sccp_scoc_show_connections(struct vty *vty, struct osmo_sccp_instance *inst)
Definition: sccp_scoc.c:1789
int sccp_sclc_user_sap_down(struct osmo_sccp_user *scu, struct osmo_prim_hdr *oph)
Main entrance function for primitives from SCCP User.
Definition: sccp_sclc.c:122