libosmo-sigtran 2.2.1.6-907ee Osmocom SIGTRAN library

sccp_connection.h
Go to the documentation of this file.
1#pragma once
2#include <inttypes.h>
3
4#include <osmocom/core/fsm.h>
5#include <osmocom/sigtran/sccp_sap.h>
6
7struct xua_msg;
8
9/* a logical connection within the SCCP instance */
10 struct sccp_connection {
11 /* entry in (struct sccp_instance)->connections */
12 struct rb_node node;
13 /* which instance are we part of? */
14 struct osmo_sccp_instance *inst;
15 /* which user owns us? */
16 struct osmo_sccp_user *user;
17
18 /* remote point code */
19 uint32_t remote_pc;
20
21 /* local/remote addresses and identities */
22 struct osmo_sccp_addr calling_addr;
23 struct osmo_sccp_addr called_addr;
24 /* SCCP connection identifier. Only relevant across the SCCP User SAP,
25 * i.e. between the local application using the SCCP stack provided by
26 * libosmo-sccp. Never transmitted over the wire! */
27 uint32_t conn_id;
28 /* SCCP Remote Connection Reference. Allocated by the remote
29 * SCCP stack to uniquely identify a SCCP connection on its end.
30 * We don't interpret it, but simply cache it here so we can use
31 * it whenever sending data to the peer. Only relevant over the
32 * wire, not to be used across the SCCP user SAP */
33 uint32_t remote_ref;
34
35 uint32_t importance;
36 uint32_t sccp_class;
37 uint32_t release_cause; /* WAIT_CONN_CONF */
38
39 /* SLS to be used to transmit all Connection-oriented messages
40 * (ITU-T Q.714 1.1.2.3 Protocol class 2).
41 * SLS is 4 bits, as described in ITU Q.704 Figure 3 */
42 uint8_t tx_co_mtp_sls;
43
44 struct msgb *opt_data_cache;
45
46 /* incoming (true) or outgoing (false) */
47 bool incoming;
48
49 /* Osmo FSM Instance of sccp_scoc_fsm */
50 struct osmo_fsm_inst *fi;
51
52 /* Connect timer */
53 struct osmo_timer_list t_conn;
54
55 /* inactivity timers */
56 struct osmo_timer_list t_ias;
57 struct osmo_timer_list t_iar;
58
59 /* release timers */
60 struct osmo_timer_list t_rel;
61 struct osmo_timer_list t_int;
62 struct osmo_timer_list t_rep_rel;
63};
64
65struct sccp_connection *sccp_conn_alloc(struct osmo_sccp_user *user, uint32_t conn_id);
66void sccp_conn_free(struct sccp_connection *conn);
67
68/* timer related: */
69void sccp_conn_restart_tx_inact_timer(struct sccp_connection *conn);
70void sccp_conn_restart_rx_inact_timer(struct sccp_connection *conn);
71void sccp_conn_start_inact_timers(struct sccp_connection *conn);
72void sccp_conn_stop_inact_timers(struct sccp_connection *conn);
73void sccp_conn_start_rel_timer(struct sccp_connection *conn);
74void sccp_conn_start_rep_rel_timer(struct sccp_connection *conn);
75void sccp_conn_start_int_timer(struct sccp_connection *conn);
76void sccp_conn_stop_release_timers(struct sccp_connection *conn);
77void sccp_conn_start_connect_timer(struct sccp_connection *conn);
78void sccp_conn_stop_connect_timer(struct sccp_connection *conn);
79
80void sccp_conn_opt_data_send_cache(struct sccp_connection *conn, int exp_type, uint8_t msg_class);
81
82int sccp_conn_xua_gen_encode_and_send(struct sccp_connection *conn, uint32_t event,
83 const struct osmo_scu_prim *prim, int msg_type);
84int sccp_conn_xua_gen_relre_and_send(struct sccp_connection *conn, uint32_t cause,
85 struct osmo_scu_prim *prim);
86void sccp_conn_scu_gen_encode_and_send(struct sccp_connection *conn, uint32_t event,
87 struct xua_msg *xua, unsigned int primitive,
88 enum osmo_prim_operation operation);
89
90
91#define _LOGPSCC(scc, subsys, level, fmt, args ...) \
92 _LOGPSCU((scc)->user, subsys, level, "CONN(%d,remPC=%u=%s) " fmt, \
93 (conn)->conn_id, (conn)->remote_pc, osmo_ss7_pointcode_print((conn)->inst->ss7, (conn)->remote_pc), ## args)
94#define LOGPSCC(scc, level, fmt, args ...) \
95 _LOGPSCC(scc, DLSCCP, level, fmt, ## args)
sccp_conn_xua_gen_relre_and_send
int sccp_conn_xua_gen_relre_and_send(struct sccp_connection *conn, uint32_t cause, struct osmo_scu_prim *prim)
Definition: sccp_scoc.c:181
sccp_conn_start_inact_timers
void sccp_conn_start_inact_timers(struct sccp_connection *conn)
Definition: sccp_connection.c:337
sccp_conn_xua_gen_encode_and_send
int sccp_conn_xua_gen_encode_and_send(struct sccp_connection *conn, uint32_t event, const struct osmo_scu_prim *prim, int msg_type)
Definition: sccp_scoc.c:407
sccp_conn_opt_data_send_cache
void sccp_conn_opt_data_send_cache(struct sccp_connection *conn, int exp_type, uint8_t msg_class)
Definition: sccp_connection.c:397
sccp_conn_scu_gen_encode_and_send
void sccp_conn_scu_gen_encode_and_send(struct sccp_connection *conn, uint32_t event, struct xua_msg *xua, unsigned int primitive, enum osmo_prim_operation operation)
Definition: sccp_connection.c:225
sccp_conn_restart_rx_inact_timer
void sccp_conn_restart_rx_inact_timer(struct sccp_connection *conn)
Definition: sccp_connection.c:331
sccp_conn_start_int_timer
void sccp_conn_start_int_timer(struct sccp_connection *conn)
Definition: sccp_connection.c:363
sccp_conn_free
void sccp_conn_free(struct sccp_connection *conn)
Definition: sccp_connection.c:187
sccp_conn_stop_connect_timer
void sccp_conn_stop_connect_timer(struct sccp_connection *conn)
Definition: sccp_connection.c:383
sccp_conn_stop_inact_timers
void sccp_conn_stop_inact_timers(struct sccp_connection *conn)
Definition: sccp_connection.c:344
sccp_conn_restart_tx_inact_timer
void sccp_conn_restart_tx_inact_timer(struct sccp_connection *conn)
Definition: sccp_connection.c:325
sccp_conn_stop_release_timers
void sccp_conn_stop_release_timers(struct sccp_connection *conn)
Definition: sccp_connection.c:369
sccp_conn_start_connect_timer
void sccp_conn_start_connect_timer(struct sccp_connection *conn)
Definition: sccp_connection.c:377
sccp_conn_start_rel_timer
void sccp_conn_start_rel_timer(struct sccp_connection *conn)
Definition: sccp_connection.c:351
sccp_conn_start_rep_rel_timer
void sccp_conn_start_rep_rel_timer(struct sccp_connection *conn)
Definition: sccp_connection.c:357
sccp_conn_alloc
struct sccp_connection * sccp_conn_alloc(struct osmo_sccp_user *user, uint32_t conn_id)
Definition: sccp_connection.c:146
sccp_sap.h
msg_type
uint8_t msg_type
Definition: sccp_scmg.h:0
osmo_sccp_addr
Definition: sccp_sap.h:183
osmo_sccp_instance
Definition: sccp_instance.h:47
osmo_sccp_user
Definition: sccp_user.h:12
osmo_scu_prim
Definition: sccp_sap.h:282
sccp_connection
Definition: sccp_connection.h:10
sccp_connection::user
struct osmo_sccp_user * user
Definition: sccp_connection.h:16
sccp_connection::calling_addr
struct osmo_sccp_addr calling_addr
Definition: sccp_connection.h:22
sccp_connection::t_conn
struct osmo_timer_list t_conn
Definition: sccp_connection.h:53
sccp_connection::conn_id
uint32_t conn_id
Definition: sccp_connection.h:27
sccp_connection::tx_co_mtp_sls
uint8_t tx_co_mtp_sls
Definition: sccp_connection.h:42
sccp_connection::node
struct rb_node node
Definition: sccp_connection.h:12
sccp_connection::t_ias
struct osmo_timer_list t_ias
Definition: sccp_connection.h:56
sccp_connection::t_rel
struct osmo_timer_list t_rel
Definition: sccp_connection.h:60
sccp_connection::t_iar
struct osmo_timer_list t_iar
Definition: sccp_connection.h:57
sccp_connection::inst
struct osmo_sccp_instance * inst
Definition: sccp_connection.h:14
sccp_connection::release_cause
uint32_t release_cause
Definition: sccp_connection.h:37
sccp_connection::opt_data_cache
struct msgb * opt_data_cache
Definition: sccp_connection.h:44
sccp_connection::t_rep_rel
struct osmo_timer_list t_rep_rel
Definition: sccp_connection.h:62
sccp_connection::called_addr
struct osmo_sccp_addr called_addr
Definition: sccp_connection.h:23
sccp_connection::importance
uint32_t importance
Definition: sccp_connection.h:35
sccp_connection::remote_ref
uint32_t remote_ref
Definition: sccp_connection.h:33
sccp_connection::incoming
bool incoming
Definition: sccp_connection.h:47
sccp_connection::fi
struct osmo_fsm_inst * fi
Definition: sccp_connection.h:50
sccp_connection::remote_pc
uint32_t remote_pc
Definition: sccp_connection.h:19
sccp_connection::sccp_class
uint32_t sccp_class
Definition: sccp_connection.h:36
sccp_connection::t_int
struct osmo_timer_list t_int
Definition: sccp_connection.h:61
xua_msg
Definition: xua_msg.h:31
msg_class
uint8_t msg_class
Definition: xua_types.h:2