libosmo-sigtran 2.0.0.52-6412
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>
5#include <osmocom/core/linuxlist.h>
6#include <osmocom/core/linuxrbtree.h>
7#include <osmocom/core/tdef.h>
11
12#define SCCP_STR "Signalling Connection Control Part\n"
13
14#include "ss7_user.h"
15
16/* Appendix C.4 of Q.714 */
18 /* 0 kept unused on purpose since it's handled specially by osmo_fsm */
28 /* This must remain the last item: */
30};
31
32extern const struct osmo_tdef osmo_sccp_timer_defaults[OSMO_SCCP_TIMERS_LEN];
33
34extern const struct value_string osmo_sccp_timer_names[];
35static inline const char *osmo_sccp_timer_name(enum osmo_sccp_timer val)
36{ return get_value_string(osmo_sccp_timer_names, val); }
37
38/* an instance of the SCCP stack */
40 /* entry in global list of ss7 instances */
41 struct llist_head list;
42 /* rbtree root of 'struct sccp_connection' in this instance */
43 struct rb_root connections;
44 /* list of SCCP users in this instance */
45 struct llist_head users;
46 /* routing context to be used in all outbound messages */
47 uint32_t route_ctx;
48 /* next connection ID to allocate */
49 uint32_t next_id;
51 void *priv;
52
54
55 struct osmo_tdef *tdefs;
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
83extern int DSCCP;
84
85struct xua_msg;
86
87struct osmo_sccp_user *
88sccp_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 */
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
115int sccp_user_prim_up(struct osmo_sccp_user *scut, struct osmo_scu_prim *prim);
116
117/* SCU -> SCLC */
118int sccp_sclc_user_sap_down(struct osmo_sccp_user *scu, struct osmo_prim_hdr *oph);
119int sccp_sclc_user_sap_down_nofree(struct osmo_sccp_user *scu, struct osmo_prim_hdr *oph);
120
121struct msgb *sccp_msgb_alloc(const char *name);
122
123extern struct osmo_fsm sccp_scoc_fsm;
124
125void sccp_scoc_show_connections(struct vty *vty, struct osmo_sccp_instance *inst);
126
127void osmo_sccp_vty_write_cs7_node(struct vty *vty, const char *indent, struct osmo_sccp_instance *inst);
128
129/* Local Broadcast (LBCS) */
131 const struct osmo_scu_pcstate_param *pcstate);
133 const struct osmo_scu_state_param *state);
134
135/* SCCP Management (SCMG) */
136void sccp_scmg_rx_ssn_allowed(struct osmo_sccp_instance *inst, uint32_t dpc, uint32_t ssn, uint32_t smi);
137void sccp_scmg_rx_ssn_prohibited(struct osmo_sccp_instance *inst, uint32_t dpc, uint32_t ssn, uint32_t smi);
138void sccp_scmg_rx_mtp_pause(struct osmo_sccp_instance *inst, uint32_t dpc);
139void sccp_scmg_rx_mtp_resume(struct osmo_sccp_instance *inst, uint32_t dpc);
140void sccp_scmg_rx_mtp_status(struct osmo_sccp_instance *inst, uint32_t dpc, enum mtp_unavail_cause cause);
141int sccp_scmg_init(struct osmo_sccp_instance *inst);
uint32_t dpc
Definition: m3ua.h:1
mtp_unavail_cause
Definition: mtp.h:28
void osmo_sccp_vty_write_cs7_node(struct vty *vty, const char *indent, struct osmo_sccp_instance *inst)
Definition: sccp_vty.c:254
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
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
int sccp_scrc_rx_scoc_conn_msg(struct osmo_sccp_instance *inst, struct xua_msg *xua)
Definition: sccp_scrc.c:401
struct msgb * sccp_msgb_alloc(const char *name)
Definition: sua.c:67
osmo_sccp_timer
Definition: sccp_internal.h:17
@ OSMO_SCCP_TIMER_REPEAT_REL
Definition: sccp_internal.h:23
@ OSMO_SCCP_TIMER_INT
Definition: sccp_internal.h:24
@ OSMO_SCCP_TIMER_GUARD
Definition: sccp_internal.h:25
@ OSMO_SCCP_TIMER_REASSEMBLY
Definition: sccp_internal.h:27
@ OSMO_SCCP_TIMERS_LEN
Definition: sccp_internal.h:29
@ OSMO_SCCP_TIMER_REL
Definition: sccp_internal.h:22
@ OSMO_SCCP_TIMER_IAS
Definition: sccp_internal.h:20
@ OSMO_SCCP_TIMER_CONN_EST
Definition: sccp_internal.h:19
@ OSMO_SCCP_TIMER_RESET
Definition: sccp_internal.h:26
@ OSMO_SCCP_TIMER_IAR
Definition: sccp_internal.h:21
int scrc_rx_mtp_xfer_ind_xua(struct osmo_sccp_instance *inst, struct xua_msg *xua)
Definition: sccp_scrc.c:470
void sccp_scmg_rx_mtp_status(struct osmo_sccp_instance *inst, uint32_t dpc, enum mtp_unavail_cause cause)
Definition: sccp_scmg.c:125
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
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:57
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_prohibited(struct osmo_sccp_instance *inst, uint32_t dpc, uint32_t ssn, uint32_t smi)
Definition: sccp_scmg.c:58
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
int DSCCP
int sccp_scmg_init(struct osmo_sccp_instance *inst)
Definition: sccp_scmg.c:311
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:1783
int sccp_sclc_rx_from_scrc(struct osmo_sccp_instance *inst, struct xua_msg *xua)
SCRC -> SCLC (connectionless message)
Definition: sccp_sclc.c:256
int sccp_scrc_rx_sclc_msg(struct osmo_sccp_instance *inst, struct xua_msg *xua)
Definition: sccp_scrc.c:423
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:1538
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....
Definition: sccp_scmg.c:102
void sccp_scoc_show_connections(struct vty *vty, struct osmo_sccp_instance *inst)
Definition: sccp_scoc.c:1986
void sccp_lbcs_local_bcast_state(struct osmo_sccp_instance *inst, const struct osmo_scu_state_param *state)
Definition: sccp_lbcs.c:55
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_scoc_flush_connections(struct osmo_sccp_instance *inst)
Definition: sccp_scoc.c:1949
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:179
struct osmo_fsm sccp_scoc_fsm
Definition: sccp_scoc.c:1451
static const char * osmo_sccp_timer_name(enum osmo_sccp_timer val)
Definition: sccp_internal.h:35
const struct value_string osmo_sccp_timer_names[]
Definition: sccp_scoc.c:264
const struct osmo_tdef osmo_sccp_timer_defaults[OSMO_SCCP_TIMERS_LEN]
Definition: sccp_scoc.c:240
uint8_t smi
Definition: sccp_scmg.h:3
Definition: sccp_internal.h:39
uint32_t next_id
Definition: sccp_internal.h:49
struct osmo_ss7_user * ss7_user
Definition: sccp_internal.h:53
uint32_t route_ctx
Definition: sccp_internal.h:47
struct osmo_tdef * tdefs
Definition: sccp_internal.h:55
struct osmo_ss7_instance * ss7
Definition: sccp_internal.h:50
struct llist_head list
Definition: sccp_internal.h:41
void * priv
Definition: sccp_internal.h:51
uint32_t max_optional_data
Definition: sccp_internal.h:57
struct llist_head users
Definition: sccp_internal.h:45
struct rb_root connections
Definition: sccp_internal.h:43
Definition: sccp_internal.h:60
struct osmo_fsm_inst * as_fi
Definition: sccp_internal.h:80
struct osmo_sccp_instance * inst
pointer back to SCCP instance
Definition: sccp_internal.h:64
uint32_t pc
Definition: sccp_internal.h:70
struct llist_head links
Definition: sccp_internal.h:73
void * priv
Definition: sccp_internal.h:77
uint16_t ssn
SSN and/or point code to which we are bound.
Definition: sccp_internal.h:69
char * name
human-readable name of this user
Definition: sccp_internal.h:66
osmo_prim_cb prim_cb
Definition: sccp_internal.h:76
struct llist_head list
entry in list of sccp users of osmo_sccp_instance
Definition: sccp_internal.h:62
Definition: sccp_sap.h:266
Definition: sccp_sap.h:273
Definition: sccp_sap.h:258
Definition: ss7_instance.h:20
Definition: ss7_user.h:13
Definition: xua_msg.h:31