libosmo-sigtran  1.3.0
Osmocom SIGTRAN library
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 connection ID to allocate */
51  uint32_t next_id;
53  void *priv;
54 
55  struct osmo_ss7_user ss7_user;
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 int sccp_sclc_user_sap_down_nofree(struct osmo_sccp_user *scu, struct osmo_prim_hdr *oph);
120 
121 struct msgb *sccp_msgb_alloc(const char *name);
122 
123 extern struct osmo_fsm sccp_scoc_fsm;
124 
125 void sccp_scoc_show_connections(struct vty *vty, struct osmo_sccp_instance *inst);
126 
127 const struct osmo_sccp_timer_val *osmo_sccp_timer_get(const struct osmo_sccp_instance *inst,
128  enum osmo_sccp_timer timer,
129  bool default_if_unset);
130 
131 void osmo_sccp_vty_write_cs7_node(struct vty *vty, const char *indent, struct osmo_sccp_instance *inst);
osmo_scu_prim::data
struct osmo_scu_data_param data
Definition: sccp_sap.h:229
osmo_ss7_user::prim_cb
osmo_prim_cb prim_cb
Definition: osmo_ss7.h:127
M3UA_MSGC_SNM
#define M3UA_MSGC_SNM
Definition: m3ua.h:31
osmo_sccp_instance::ss7
struct osmo_ss7_instance * ss7
Definition: sccp_internal.h:52
osmo_ss7_instance_find
struct osmo_ss7_instance * osmo_ss7_instance_find(uint32_t id)
Find a SS7 Instance with given ID.
Definition: osmo_ss7.c:334
APPEND
#define APPEND(fmt, args ...)
osmo_sccp_instance
Definition: sccp_internal.h:41
osmo_ss7_instance_find_or_create
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:351
osmo_mtp_transfer_param::dpc
uint32_t dpc
Definition: mtp_sap.h:38
_sccp_parse_xudt
static int _sccp_parse_xudt(struct msgb *msgb, struct sccp_parse_result *result)
Definition: sccp.c:485
_sccp_parse_connection_release_complete
int _sccp_parse_connection_release_complete(struct msgb *msgb, struct sccp_parse_result *result)
Definition: sccp.c:350
osmo_ss7_instance::network_indicator
uint8_t network_indicator
Definition: osmo_ss7.h:99
OSMO_SCCP_TIMER_IAS
@ OSMO_SCCP_TIMER_IAS
Definition: sccp_internal.h:13
sccp_scoc_fsm
struct osmo_fsm sccp_scoc_fsm
Definition: sccp_scoc.c:1289
xua_cli_connect_cb
static int xua_cli_connect_cb(struct osmo_stream_cli *cli)
Definition: osmo_ss7.c:1633
mtp_si_vals
const struct value_string mtp_si_vals[]
Definition: osmo_ss7_vty.c:912
sua_to_sccp_udt
static int sua_to_sccp_udt(struct msgb *msg, struct xua_msg *xua)
Definition: sccp2sua.c:1203
osmo_ss7_instances
struct llist_head osmo_ss7_instances
MAND_IES
#define MAND_IES(msgt, ies)
Definition: m3ua.c:129
vty_init_addr
static void vty_init_addr(void)
Definition: osmo_ss7_vty.c:1872
osmo_ss7_instance::list
struct llist_head list
member of global list of instances
Definition: osmo_ss7.h:73
osmo_sccp_tx_conn_req_msg
int osmo_sccp_tx_conn_req_msg(struct osmo_sccp_user *scu, uint32_t conn_id, const struct osmo_sccp_addr *calling_addr, const struct osmo_sccp_addr *called_addr, struct msgb *msg)
Definition: sccp_helpers.c:138
osmo_ss7_linkset::links
struct osmo_ss7_link * links[16]
array of osmo_ss7_link
Definition: osmo_ss7.h:183
sccp_create_cr
struct msgb * sccp_create_cr(const struct sccp_source_reference *src_ref, const struct sockaddr_sccp *called, const uint8_t *l3_data, size_t l3_length)
Definition: sccp.c:815
osmo_ss7_as_del_asp
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:1009
osmo_xlm_prim::u
union osmo_xlm_prim::@31 u
SUA_CO_COAK
#define SUA_CO_COAK
Definition: sua.h:71
osmo_ss7_asp::proto
enum osmo_ss7_asp_protocol proto
Definition: osmo_ss7.h:419
CS7_STR
#define CS7_STR
Definition: xua_internal.h:66
osmo_ss7_asp_send
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:1911