Loading...
Searching...
No Matches
sccp_internal.h
Go to the documentation of this file.
#pragma once
#include <osmocom/core/fsm.h>
#include <osmocom/core/prim.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/linuxrbtree.h>
#include <osmocom/core/tdef.h>
#include <osmocom/sigtran/sccp_sap.h>
#include <osmocom/sigtran/osmo_ss7.h>
#include <osmocom/sigtran/protocol/mtp.h>
#define SCCP_STR "Signalling Connection Control Part\n"
#include "ss7_user.h"
/* Appendix C.4 of Q.714 */
enum osmo_sccp_timer {
/* 0 kept unused on purpose since it's handled specially by osmo_fsm */
OSMO_SCCP_TIMER_CONN_EST = 1,
OSMO_SCCP_TIMER_IAS,
OSMO_SCCP_TIMER_IAR,
OSMO_SCCP_TIMER_REL,
OSMO_SCCP_TIMER_REPEAT_REL,
OSMO_SCCP_TIMER_INT,
OSMO_SCCP_TIMER_GUARD,
OSMO_SCCP_TIMER_RESET,
OSMO_SCCP_TIMER_REASSEMBLY,
/* This must remain the last item: */
OSMO_SCCP_TIMERS_LEN
};
extern const struct osmo_tdef osmo_sccp_timer_defaults[OSMO_SCCP_TIMERS_LEN];
extern const struct value_string osmo_sccp_timer_names[];
static inline const char *osmo_sccp_timer_name(enum osmo_sccp_timer val)
{ return get_value_string(osmo_sccp_timer_names, val); }
/* an instance of the SCCP stack */
struct osmo_sccp_instance {
/* entry in global list of ss7 instances */
struct llist_head list;
/* rbtree root of 'struct sccp_connection' in this instance */
struct rb_root connections;
/* list of SCCP users in this instance */
struct llist_head users;
/* routing context to be used in all outbound messages */
uint32_t route_ctx;
/* next connection ID to allocate */
uint32_t next_id;
struct osmo_ss7_instance *ss7;
void *priv;
struct osmo_ss7_user *ss7_user;
struct osmo_tdef *tdefs;
uint32_t max_optional_data;
};
struct osmo_sccp_user {
struct llist_head list;
struct osmo_sccp_instance *inst;
char *name;
uint16_t ssn;
uint32_t pc;
/* set if we are a server */
struct llist_head links;
/* user call-back function in case of incoming primitives */
osmo_prim_cb prim_cb;
void *priv;
/* Application Server FSM Instance */
struct osmo_fsm_inst *as_fi;
};
extern int DSCCP;
struct xua_msg;
struct osmo_sccp_user *
sccp_user_find(struct osmo_sccp_instance *inst, uint16_t ssn, uint32_t pc);
/* Message from SCOC -> SCRC */
int sccp_scrc_rx_scoc_conn_msg(struct osmo_sccp_instance *inst,
struct xua_msg *xua);
/* Message from SCLC -> SCRC */
int sccp_scrc_rx_sclc_msg(struct osmo_sccp_instance *inst, struct xua_msg *xua);
/* Message from MTP (SUA) -> SCRC */
int scrc_rx_mtp_xfer_ind_xua(struct osmo_sccp_instance *inst,
struct xua_msg *xua);
/* Message from SCRC -> SCOC */
void sccp_scoc_rx_from_scrc(struct osmo_sccp_instance *inst,
struct xua_msg *xua);
void sccp_scoc_rx_scrc_rout_fail(struct osmo_sccp_instance *inst,
struct xua_msg *xua, uint32_t cause);
void sccp_scoc_flush_connections(struct osmo_sccp_instance *inst);
/* Message from SCRC -> SCLC */
int sccp_sclc_rx_from_scrc(struct osmo_sccp_instance *inst,
struct xua_msg *xua);
void sccp_sclc_rx_scrc_rout_fail(struct osmo_sccp_instance *inst,
struct xua_msg *xua, uint32_t cause);
int sccp_user_prim_up(struct osmo_sccp_user *scut, struct osmo_scu_prim *prim);
/* SCU -> SCLC */
int sccp_sclc_user_sap_down(struct osmo_sccp_user *scu, struct osmo_prim_hdr *oph);
int sccp_sclc_user_sap_down_nofree(struct osmo_sccp_user *scu, struct osmo_prim_hdr *oph);
struct msgb *sccp_msgb_alloc(const char *name);
extern struct osmo_fsm sccp_scoc_fsm;
void sccp_scoc_show_connections(struct vty *vty, struct osmo_sccp_instance *inst);
void osmo_sccp_vty_write_cs7_node(struct vty *vty, const char *indent, struct osmo_sccp_instance *inst);
/* Local Broadcast (LBCS) */
void sccp_lbcs_local_bcast_pcstate(struct osmo_sccp_instance *inst,
const struct osmo_scu_pcstate_param *pcstate);
void sccp_lbcs_local_bcast_state(struct osmo_sccp_instance *inst,
const struct osmo_scu_state_param *state);
/* SCCP Management (SCMG) */
void sccp_scmg_rx_ssn_allowed(struct osmo_sccp_instance *inst, uint32_t dpc, uint32_t ssn, uint32_t smi);
void sccp_scmg_rx_ssn_prohibited(struct osmo_sccp_instance *inst, uint32_t dpc, uint32_t ssn, uint32_t smi);
void sccp_scmg_rx_mtp_pause(struct osmo_sccp_instance *inst, uint32_t dpc);
void sccp_scmg_rx_mtp_resume(struct osmo_sccp_instance *inst, uint32_t dpc);
void sccp_scmg_rx_mtp_status(struct osmo_sccp_instance *inst, uint32_t dpc, enum mtp_unavail_cause cause);
int sccp_scmg_init(struct osmo_sccp_instance *inst);
dpc
uint32_t dpc
Definition m3ua.h:1
mtp.h
mtp_unavail_cause
mtp_unavail_cause
Definition mtp.h:28
osmo_ss7.h
osmo_sccp_vty_write_cs7_node
void osmo_sccp_vty_write_cs7_node(struct vty *vty, const char *indent, struct osmo_sccp_instance *inst)
Definition sccp_vty.c:254
sccp_sclc_rx_scrc_rout_fail
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
sccp_scmg_rx_ssn_allowed
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
sccp_scrc_rx_scoc_conn_msg
int sccp_scrc_rx_scoc_conn_msg(struct osmo_sccp_instance *inst, struct xua_msg *xua)
Definition sccp_scrc.c:401
sccp_msgb_alloc
struct msgb * sccp_msgb_alloc(const char *name)
Definition sua.c:67
osmo_sccp_timer
osmo_sccp_timer
Definition sccp_internal.h:17
OSMO_SCCP_TIMER_REPEAT_REL
@ OSMO_SCCP_TIMER_REPEAT_REL
Definition sccp_internal.h:23
OSMO_SCCP_TIMER_INT
@ OSMO_SCCP_TIMER_INT
Definition sccp_internal.h:24
OSMO_SCCP_TIMER_GUARD
@ OSMO_SCCP_TIMER_GUARD
Definition sccp_internal.h:25
OSMO_SCCP_TIMER_REASSEMBLY
@ OSMO_SCCP_TIMER_REASSEMBLY
Definition sccp_internal.h:27
OSMO_SCCP_TIMERS_LEN
@ OSMO_SCCP_TIMERS_LEN
Definition sccp_internal.h:29
OSMO_SCCP_TIMER_REL
@ OSMO_SCCP_TIMER_REL
Definition sccp_internal.h:22
OSMO_SCCP_TIMER_IAS
@ OSMO_SCCP_TIMER_IAS
Definition sccp_internal.h:20
OSMO_SCCP_TIMER_CONN_EST
@ OSMO_SCCP_TIMER_CONN_EST
Definition sccp_internal.h:19
OSMO_SCCP_TIMER_RESET
@ OSMO_SCCP_TIMER_RESET
Definition sccp_internal.h:26
OSMO_SCCP_TIMER_IAR
@ OSMO_SCCP_TIMER_IAR
Definition sccp_internal.h:21
scrc_rx_mtp_xfer_ind_xua
int scrc_rx_mtp_xfer_ind_xua(struct osmo_sccp_instance *inst, struct xua_msg *xua)
Definition sccp_scrc.c:470
sccp_scmg_rx_mtp_status
void sccp_scmg_rx_mtp_status(struct osmo_sccp_instance *inst, uint32_t dpc, enum mtp_unavail_cause cause)
Definition sccp_scmg.c:125
sccp_sclc_user_sap_down
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
sccp_user_find
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
sccp_sclc_user_sap_down_nofree
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
sccp_scmg_rx_ssn_prohibited
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
sccp_scmg_rx_mtp_pause
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
DSCCP
int DSCCP
sccp_scmg_init
int sccp_scmg_init(struct osmo_sccp_instance *inst)
Definition sccp_scmg.c:311
sccp_scoc_rx_from_scrc
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
sccp_sclc_rx_from_scrc
int sccp_sclc_rx_from_scrc(struct osmo_sccp_instance *inst, struct xua_msg *xua)
SCRC -> SCLC (connectionless message)
Definition sccp_sclc.c:256
sccp_scrc_rx_sclc_msg
int sccp_scrc_rx_sclc_msg(struct osmo_sccp_instance *inst, struct xua_msg *xua)
Definition sccp_scrc.c:423
sccp_scoc_rx_scrc_rout_fail
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
sccp_scmg_rx_mtp_resume
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
sccp_scoc_show_connections
void sccp_scoc_show_connections(struct vty *vty, struct osmo_sccp_instance *inst)
Definition sccp_scoc.c:1986
sccp_lbcs_local_bcast_state
void sccp_lbcs_local_bcast_state(struct osmo_sccp_instance *inst, const struct osmo_scu_state_param *state)
Definition sccp_lbcs.c:55
sccp_lbcs_local_bcast_pcstate
void sccp_lbcs_local_bcast_pcstate(struct osmo_sccp_instance *inst, const struct osmo_scu_pcstate_param *pcstate)
Definition sccp_lbcs.c:39
sccp_scoc_flush_connections
void sccp_scoc_flush_connections(struct osmo_sccp_instance *inst)
Definition sccp_scoc.c:1949
sccp_user_prim_up
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
sccp_scoc_fsm
struct osmo_fsm sccp_scoc_fsm
Definition sccp_scoc.c:1451
osmo_sccp_timer_name
static const char * osmo_sccp_timer_name(enum osmo_sccp_timer val)
Definition sccp_internal.h:35
osmo_sccp_timer_names
const struct value_string osmo_sccp_timer_names[]
Definition sccp_scoc.c:264
osmo_sccp_timer_defaults
const struct osmo_tdef osmo_sccp_timer_defaults[OSMO_SCCP_TIMERS_LEN]
Definition sccp_scoc.c:240
sccp_sap.h
smi
uint8_t smi
Definition sccp_scmg.h:3
ss7_user.h
osmo_sccp_instance
Definition sccp_internal.h:39
osmo_sccp_instance::next_id
uint32_t next_id
Definition sccp_internal.h:49
osmo_sccp_instance::ss7_user
struct osmo_ss7_user * ss7_user
Definition sccp_internal.h:53
osmo_sccp_instance::route_ctx
uint32_t route_ctx
Definition sccp_internal.h:47
osmo_sccp_instance::tdefs
struct osmo_tdef * tdefs
Definition sccp_internal.h:55
osmo_sccp_instance::ss7
struct osmo_ss7_instance * ss7
Definition sccp_internal.h:50
osmo_sccp_instance::list
struct llist_head list
Definition sccp_internal.h:41
osmo_sccp_instance::priv
void * priv
Definition sccp_internal.h:51
osmo_sccp_instance::max_optional_data
uint32_t max_optional_data
Definition sccp_internal.h:57
osmo_sccp_instance::users
struct llist_head users
Definition sccp_internal.h:45
osmo_sccp_instance::connections
struct rb_root connections
Definition sccp_internal.h:43
osmo_sccp_user
Definition sccp_internal.h:60
osmo_sccp_user::as_fi
struct osmo_fsm_inst * as_fi
Definition sccp_internal.h:80
osmo_sccp_user::inst
struct osmo_sccp_instance * inst
pointer back to SCCP instance
Definition sccp_internal.h:64
osmo_sccp_user::pc
uint32_t pc
Definition sccp_internal.h:70
osmo_sccp_user::links
struct llist_head links
Definition sccp_internal.h:73
osmo_sccp_user::priv
void * priv
Definition sccp_internal.h:77
osmo_sccp_user::ssn
uint16_t ssn
SSN and/or point code to which we are bound.
Definition sccp_internal.h:69
osmo_sccp_user::name
char * name
human-readable name of this user
Definition sccp_internal.h:66
osmo_sccp_user::prim_cb
osmo_prim_cb prim_cb
Definition sccp_internal.h:76
osmo_sccp_user::list
struct llist_head list
entry in list of sccp users of osmo_sccp_instance
Definition sccp_internal.h:62
osmo_scu_pcstate_param
Definition sccp_sap.h:266
osmo_scu_prim
Definition sccp_sap.h:273
osmo_scu_state_param
Definition sccp_sap.h:258
osmo_ss7_instance
Definition ss7_instance.h:20
osmo_ss7_user
Definition ss7_user.h:13
xua_msg
Definition xua_msg.h:31