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