libosmo-sigtran  1.6.0.17-bd92
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>
8 
9 #define SCCP_STR "Signalling Connection Control Part\n"
10 
11 /* Appendix C.4 of Q.714 */
22  /* This must remain the last item: */
24 };
25 
27  uint32_t s;
28  uint32_t us;
29 };
30 
31 extern const struct osmo_sccp_timer_val osmo_sccp_timer_defaults[];
32 
33 extern const struct value_string osmo_sccp_timer_names[];
34 static inline const char *osmo_sccp_timer_name(enum osmo_sccp_timer val)
35 { return get_value_string(osmo_sccp_timer_names, val); }
36 
37 extern const struct value_string osmo_sccp_timer_descriptions[];
38 static inline const char *osmo_sccp_timer_description(enum osmo_sccp_timer val)
39 { return get_value_string(osmo_sccp_timer_descriptions, val); }
40 
41 /* an instance of the SCCP stack */
43  /* entry in global list of ss7 instances */
44  struct llist_head list;
45  /* list of 'struct sccp_connection' in this instance */
46  struct llist_head connections;
47  /* list of SCCP users in this instance */
48  struct llist_head users;
49  /* routing context to be used in all outbound messages */
50  uint32_t route_ctx;
51  /* next connection ID to allocate */
52  uint32_t next_id;
54  void *priv;
55 
56  struct osmo_ss7_user ss7_user;
57 
59 };
60 
63  struct llist_head list;
67  char *name;
68 
70  uint16_t ssn;
71  uint32_t pc;
72 
73  /* set if we are a server */
74  struct llist_head links;
75 
76  /* user call-back function in case of incoming primitives */
77  osmo_prim_cb prim_cb;
78  void *priv;
79 
80  /* Application Server FSM Instance */
81  struct osmo_fsm_inst *as_fi;
82 };
83 
84 extern int DSCCP;
85 
86 struct xua_msg;
87 
88 struct osmo_sccp_user *
89 sccp_user_find(struct osmo_sccp_instance *inst, uint16_t ssn, uint32_t pc);
90 
91 /* Message from SCOC -> SCRC */
93  struct xua_msg *xua);
94 
95 /* Message from SCLC -> SCRC */
96 int sccp_scrc_rx_sclc_msg(struct osmo_sccp_instance *inst, struct xua_msg *xua);
97 
98 /* Message from MTP (SUA) -> SCRC */
100  struct xua_msg *xua);
101 
102 /* Message from SCRC -> SCOC */
104  struct xua_msg *xua);
106  struct xua_msg *xua, uint32_t cause);
107 
109 
110 /* Message from SCRC -> SCLC */
112  struct xua_msg *xua);
114  struct xua_msg *xua, uint32_t cause);
115 
116 int sccp_user_prim_up(struct osmo_sccp_user *scut, struct osmo_scu_prim *prim);
117 
118 /* SCU -> SCLC */
119 int sccp_sclc_user_sap_down(struct osmo_sccp_user *scu, struct osmo_prim_hdr *oph);
120 int sccp_sclc_user_sap_down_nofree(struct osmo_sccp_user *scu, struct osmo_prim_hdr *oph);
121 
122 struct msgb *sccp_msgb_alloc(const char *name);
123 
124 extern struct osmo_fsm sccp_scoc_fsm;
125 
126 void sccp_scoc_show_connections(struct vty *vty, struct osmo_sccp_instance *inst);
127 
128 const struct osmo_sccp_timer_val *osmo_sccp_timer_get(const struct osmo_sccp_instance *inst,
129  enum osmo_sccp_timer timer,
130  bool default_if_unset);
131 
132 void osmo_sccp_vty_write_cs7_node(struct vty *vty, const char *indent, struct osmo_sccp_instance *inst);
133 
134 /* Local Broadcast (LBCS) */
136  const struct osmo_scu_pcstate_param *pcstate);
138  const struct osmo_scu_state_param *state);
139 
140 /* SCCP Management (SCMG) */
141 void sccp_scmg_rx_ssn_allowed(struct osmo_sccp_instance *inst, uint32_t dpc, uint32_t ssn, uint32_t smi);
142 void sccp_scmg_rx_ssn_prohibited(struct osmo_sccp_instance *inst, uint32_t dpc, uint32_t ssn, uint32_t smi);
143 void sccp_scmg_rx_mtp_pause(struct osmo_sccp_instance *inst, uint32_t dpc);
144 void sccp_scmg_rx_mtp_resume(struct osmo_sccp_instance *inst, uint32_t dpc);
145 void sccp_scmg_rx_mtp_status(struct osmo_sccp_instance *inst, uint32_t dpc, enum mtp_unavail_cause cause);
146 int sccp_scmg_init(struct osmo_sccp_instance *inst);
uint32_t dpc
Definition: m3ua.h:513
void * priv
Definition: sccp_internal.h:78
Definition: sccp_internal.h:20
void sccp_lbcs_local_bcast_pcstate(struct osmo_sccp_instance *inst, const struct osmo_scu_pcstate_param *pcstate)
Definition: sccp_lbcs.c:39
void sccp_scmg_rx_ssn_prohibited(struct osmo_sccp_instance *inst, uint32_t dpc, uint32_t ssn, uint32_t smi)
Definition: sccp_scmg.c:58
Definition: sccp_internal.h:14
char * name
human-readable name of this user
Definition: sccp_internal.h:67
struct msgb * sccp_msgb_alloc(const char *name)
Definition: sua.c:64
Definition: sccp_internal.h:13
uint32_t route_ctx
Definition: sccp_internal.h:50
Definition: sccp_internal.h:17
uint16_t ssn
SSN and/or point code to which we are bound.
Definition: sccp_internal.h:70
Definition: sccp_internal.h:42
struct osmo_fsm sccp_scoc_fsm
Definition: sccp_scoc.c:1426
Definition: sccp_sap.h:260
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:173
osmo_prim_cb prim_cb
Definition: sccp_internal.h:77
uint32_t s
Definition: sccp_internal.h:27
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:332
Definition: osmo_ss7.h:124
void * priv
Definition: sccp_internal.h:54
uint8_t smi
Definition: sccp_scmg.h:41
void sccp_scmg_rx_mtp_status(struct osmo_sccp_instance *inst, uint32_t dpc, enum mtp_unavail_cause cause)
Definition: sccp_scmg.c:125
Definition: sccp_internal.h:15
struct osmo_sccp_instance * inst
pointer back to SCCP instance
Definition: sccp_internal.h:65
mtp_unavail_cause
Definition: mtp.h:28
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:1757
const struct value_string osmo_sccp_timer_names[]
Definition: sccp_scoc.c:237
void sccp_scoc_flush_connections(struct osmo_sccp_instance *inst)
Definition: sccp_scoc.c:1923
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_sap.h:253
Definition: sccp_internal.h:23
Definition: sccp_internal.h:61
static const char * osmo_sccp_timer_name(enum osmo_sccp_timer val)
Definition: sccp_internal.h:34
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:301
Definition: sccp_internal.h:19
struct osmo_ss7_instance * ss7
Definition: sccp_internal.h:53
Definition: sccp_internal.h:18
int sccp_scrc_rx_sclc_msg(struct osmo_sccp_instance *inst, struct xua_msg *xua)
Definition: sccp_scrc.c:418
int sccp_sclc_user_sap_down_nofree(struct osmo_sccp_user *scu, struct osmo_prim_hdr *oph)
Main entrance function for primitives from SCCP User.
Definition: sccp_sclc.c:123
void sccp_scmg_rx_ssn_allowed(struct osmo_sccp_instance *inst, uint32_t dpc, uint32_t ssn, uint32_t smi)
Definition: sccp_scmg.c:40
void sccp_scmg_rx_mtp_resume(struct osmo_sccp_instance *inst, uint32_t dpc)
brief MTP -> SNM (MTP-RESUME.ind) - ability of providing the MTP service Q.714 5.2.3
Definition: sccp_scmg.c:102
Definition: sccp_internal.h:16
int scrc_rx_mtp_xfer_ind_xua(struct osmo_sccp_instance *inst, struct xua_msg *xua)
Definition: sccp_scrc.c:465
uint32_t next_id
Definition: sccp_internal.h:52
int sccp_scrc_rx_scoc_conn_msg(struct osmo_sccp_instance *inst, struct xua_msg *xua)
Definition: sccp_scrc.c:396
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:1513
Definition: sccp_sap.h:245
const struct osmo_sccp_timer_val osmo_sccp_timer_defaults[]
Definition: sccp_scoc.c:282
Definition: sccp_internal.h:26
void sccp_lbcs_local_bcast_state(struct osmo_sccp_instance *inst, const struct osmo_scu_state_param *state)
Definition: sccp_lbcs.c:55
Definition: xua_msg.h:31
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 First search all users with a valid PC for a...
Definition: sccp_user.c:51
Definition: osmo_ss7.h:73
const struct value_string osmo_sccp_timer_descriptions[]
Definition: sccp_scoc.c:252
int sccp_sclc_rx_from_scrc(struct osmo_sccp_instance *inst, struct xua_msg *xua)
SCRC -> SCLC (connectionless message)
Definition: sccp_sclc.c:256
void sccp_scmg_rx_mtp_pause(struct osmo_sccp_instance *inst, uint32_t dpc)
brief MTP -> SNM (MTP-PAUSE.ind) - inability to providing MTP service Q.714 5.2.2 ...
Definition: sccp_scmg.c:79
uint32_t us
Definition: sccp_internal.h:28
uint32_t pc
Definition: sccp_internal.h:71
struct osmo_fsm_inst * as_fi
Definition: sccp_internal.h:81
static const char * osmo_sccp_timer_description(enum osmo_sccp_timer val)
Definition: sccp_internal.h:38
Definition: sccp_internal.h:21
osmo_sccp_timer
Definition: sccp_internal.h:12
void sccp_scoc_show_connections(struct vty *vty, struct osmo_sccp_instance *inst)
Definition: sccp_scoc.c:1958
int sccp_scmg_init(struct osmo_sccp_instance *inst)
Definition: sccp_scmg.c:308
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:147