libosmo-sigtran 2.2.1.63-bc8b Osmocom SIGTRAN library

sccp_instance.h
Go to the documentation of this file.
1#pragma once
2
3#include <inttypes.h>
4
5#include <osmocom/core/fsm.h>
6#include <osmocom/core/prim.h>
7#include <osmocom/core/linuxlist.h>
8#include <osmocom/core/linuxrbtree.h>
9#include <osmocom/core/tdef.h>
10#include <osmocom/sigtran/sccp_sap.h>
11#include <osmocom/sigtran/osmo_ss7.h>
12#include <osmocom/sigtran/protocol/mtp.h>
13
14 struct osmo_ss7_user;
15
16/* Appendix C.4 of Q.714 */
17 enum osmo_sccp_timer {
18 /* 0 kept unused on purpose since it's handled specially by osmo_fsm */
19 OSMO_SCCP_TIMER_CONN_EST = 1,
20 OSMO_SCCP_TIMER_IAS,
21 OSMO_SCCP_TIMER_IAR,
22 OSMO_SCCP_TIMER_REL,
23 OSMO_SCCP_TIMER_REPEAT_REL,
24 OSMO_SCCP_TIMER_INT,
25 OSMO_SCCP_TIMER_GUARD,
26 OSMO_SCCP_TIMER_RESET,
27 OSMO_SCCP_TIMER_REASSEMBLY,
28 /* This must remain the last item: */
29 OSMO_SCCP_TIMERS_LEN
30};
31
32 extern const struct osmo_tdef osmo_sccp_timer_defaults[OSMO_SCCP_TIMERS_LEN];
33
34 extern const struct value_string osmo_sccp_timer_names[];
35 static inline const char *osmo_sccp_timer_name(enum osmo_sccp_timer val)
36{ return get_value_string(osmo_sccp_timer_names, val); }
37
38 struct sccp_pending_rout_fail {
39 /* Item in inst->rout_fail_pending.queue: */
40 struct llist_head list;
41 struct xua_msg *xua;
42 uint32_t cause;
43 bool scoc; /* true if it's for SCOC, false if it's for SCLC. */
44};
45
46/* an instance of the SCCP stack */
47 struct osmo_sccp_instance {
48 /* entry in global list of ss7 instances */
49 struct llist_head list;
50 /* rbtree root of 'struct sccp_connection' in this instance */
51 struct rb_root connections;
52 /* list of SCCP users in this instance */
53 struct llist_head users;
54 /* routing context to be used in all outbound messages */
55 uint32_t route_ctx;
56 /* next connection ID to allocate */
57 uint32_t next_id;
58 struct osmo_ss7_instance *ss7;
59 void *priv;
60
61 struct osmo_ss7_user *ss7_user;
62
63 struct osmo_tdef *tdefs;
64
65 uint32_t max_optional_data;
66
67 /* Queued Routing Failures to transmit asynchronously up the stack: */
68 struct {
69 struct osmo_timer_list timer;
70 struct llist_head queue;
71 } rout_fail_pending;
72};
73
74 struct osmo_sccp_user *
75 sccp_user_find(struct osmo_sccp_instance *inst, uint16_t ssn, uint32_t pc);
76
77#define _LOGPSCI(sci, subsys, level, fmt, args ...) \
78 _LOGSS7((sci)->ss7, subsys, level, "SCCP(rctx=%" PRIu32 ") " fmt, (sci)->route_ctx, ## args)
79#define LOGPSCI(sci, level, fmt, args ...) \
80 _LOGPSCI(sci, DLSCCP, level, fmt, ## args)
81
mtp.h
osmo_ss7.h
osmo_sccp_timer
osmo_sccp_timer
Definition: sccp_instance.h:17
OSMO_SCCP_TIMER_REPEAT_REL
@ OSMO_SCCP_TIMER_REPEAT_REL
Definition: sccp_instance.h:23
OSMO_SCCP_TIMER_INT
@ OSMO_SCCP_TIMER_INT
Definition: sccp_instance.h:24
OSMO_SCCP_TIMER_GUARD
@ OSMO_SCCP_TIMER_GUARD
Definition: sccp_instance.h:25
OSMO_SCCP_TIMER_REASSEMBLY
@ OSMO_SCCP_TIMER_REASSEMBLY
Definition: sccp_instance.h:27
OSMO_SCCP_TIMERS_LEN
@ OSMO_SCCP_TIMERS_LEN
Definition: sccp_instance.h:29
OSMO_SCCP_TIMER_REL
@ OSMO_SCCP_TIMER_REL
Definition: sccp_instance.h:22
OSMO_SCCP_TIMER_IAS
@ OSMO_SCCP_TIMER_IAS
Definition: sccp_instance.h:20
OSMO_SCCP_TIMER_CONN_EST
@ OSMO_SCCP_TIMER_CONN_EST
Definition: sccp_instance.h:19
OSMO_SCCP_TIMER_RESET
@ OSMO_SCCP_TIMER_RESET
Definition: sccp_instance.h:26
OSMO_SCCP_TIMER_IAR
@ OSMO_SCCP_TIMER_IAR
Definition: sccp_instance.h:21
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_instance.c:107
osmo_sccp_timer_name
static const char * osmo_sccp_timer_name(enum osmo_sccp_timer val)
Definition: sccp_instance.h:35
osmo_sccp_timer_names
const struct value_string osmo_sccp_timer_names[]
Definition: sccp_instance.c:82
osmo_sccp_timer_defaults
const struct osmo_tdef osmo_sccp_timer_defaults[OSMO_SCCP_TIMERS_LEN]
Definition: sccp_instance.c:58
sccp_sap.h
osmo_sccp_instance
Definition: sccp_instance.h:47
osmo_sccp_instance::next_id
uint32_t next_id
Definition: sccp_instance.h:57
osmo_sccp_instance::ss7_user
struct osmo_ss7_user * ss7_user
Definition: sccp_instance.h:61
osmo_sccp_instance::route_ctx
uint32_t route_ctx
Definition: sccp_instance.h:55
osmo_sccp_instance::queue
struct llist_head queue
Definition: sccp_instance.h:70
osmo_sccp_instance::tdefs
struct osmo_tdef * tdefs
Definition: sccp_instance.h:63
osmo_sccp_instance::ss7
struct osmo_ss7_instance * ss7
Definition: sccp_instance.h:58
osmo_sccp_instance::list
struct llist_head list
Definition: sccp_instance.h:49
osmo_sccp_instance::priv
void * priv
Definition: sccp_instance.h:59
osmo_sccp_instance::max_optional_data
uint32_t max_optional_data
Definition: sccp_instance.h:65
osmo_sccp_instance::timer
struct osmo_timer_list timer
Definition: sccp_instance.h:69
osmo_sccp_instance::users
struct llist_head users
Definition: sccp_instance.h:53
osmo_sccp_instance::connections
struct rb_root connections
Definition: sccp_instance.h:51
osmo_sccp_instance::rout_fail_pending
struct osmo_sccp_instance::@22 rout_fail_pending
osmo_sccp_user
Definition: sccp_user.h:12
osmo_sccp_user::inst
struct osmo_sccp_instance * inst
pointer back to SCCP instance
Definition: sccp_user.h:16
osmo_ss7_instance
Definition: ss7_instance.h:45
osmo_ss7_user
Definition: ss7_user.h:15
sccp_pending_rout_fail
Definition: sccp_instance.h:38
sccp_pending_rout_fail::xua
struct xua_msg * xua
Definition: sccp_instance.h:41
sccp_pending_rout_fail::list
struct llist_head list
Definition: sccp_instance.h:40
sccp_pending_rout_fail::scoc
bool scoc
Definition: sccp_instance.h:43
sccp_pending_rout_fail::cause
uint32_t cause
Definition: sccp_instance.h:42
xua_msg
Definition: xua_msg.h:31
ssn
uint8_t ssn
Definition: tcap_as_loadshare.c:3
pc
uint32_t pc
Definition: tcap_as_loadshare.c:2