libosmo-sigtran  2.1.0.148-c8e68.202507132026
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 
7 struct xua_msg;
8 
9 /* a logical connection within the SCCP instance */
11  /* entry in (struct sccp_instance)->connections */
12  struct rb_node node;
13  /* which instance are we part of? */
15  /* which user owns us? */
17 
18  /* remote point code */
19  uint32_t remote_pc;
20 
21  /* local/remote addresses and identities */
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 
65 struct sccp_connection *sccp_conn_alloc(struct osmo_sccp_user *user, uint32_t conn_id);
66 void sccp_conn_free(struct sccp_connection *conn);
67 
68 /* timer related: */
79 
80 void sccp_conn_opt_data_send_cache(struct sccp_connection *conn, int exp_type, uint8_t msg_class);
81 
82 int sccp_conn_xua_gen_encode_and_send(struct sccp_connection *conn, uint32_t event,
83  const struct osmo_scu_prim *prim, int msg_type);
84 int sccp_conn_xua_gen_relre_and_send(struct sccp_connection *conn, uint32_t cause,
85  struct osmo_scu_prim *prim);
86 void 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)
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:337
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
void sccp_conn_opt_data_send_cache(struct sccp_connection *conn, int exp_type, uint8_t msg_class)
Definition: sccp_connection.c:397
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:331
void sccp_conn_start_int_timer(struct sccp_connection *conn)
Definition: sccp_connection.c:363
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:383
void sccp_conn_stop_inact_timers(struct sccp_connection *conn)
Definition: sccp_connection.c:344
void sccp_conn_restart_tx_inact_timer(struct sccp_connection *conn)
Definition: sccp_connection.c:325
struct sccp_connection * sccp_conn_alloc(struct osmo_sccp_user *user, uint32_t conn_id)
Definition: sccp_connection.c:146
void sccp_conn_stop_release_timers(struct sccp_connection *conn)
Definition: sccp_connection.c:369
void sccp_conn_start_connect_timer(struct sccp_connection *conn)
Definition: sccp_connection.c:377
void sccp_conn_start_rel_timer(struct sccp_connection *conn)
Definition: sccp_connection.c:351
void sccp_conn_start_rep_rel_timer(struct sccp_connection *conn)
Definition: sccp_connection.c:357
uint8_t msg_type
Definition: sccp_scmg.h:0
Definition: sccp_sap.h:183
Definition: sccp_instance.h:47
Definition: sccp_user.h:12
Definition: sccp_sap.h:280
Definition: sccp_connection.h:10
struct osmo_sccp_user * user
Definition: sccp_connection.h:16
struct osmo_sccp_addr calling_addr
Definition: sccp_connection.h:22
struct osmo_timer_list t_conn
Definition: sccp_connection.h:53
uint32_t conn_id
Definition: sccp_connection.h:27
uint8_t tx_co_mtp_sls
Definition: sccp_connection.h:42
struct rb_node node
Definition: sccp_connection.h:12
struct osmo_timer_list t_ias
Definition: sccp_connection.h:56
struct osmo_timer_list t_rel
Definition: sccp_connection.h:60
struct osmo_timer_list t_iar
Definition: sccp_connection.h:57
struct osmo_sccp_instance * inst
Definition: sccp_connection.h:14
uint32_t release_cause
Definition: sccp_connection.h:37
struct msgb * opt_data_cache
Definition: sccp_connection.h:44
struct osmo_timer_list t_rep_rel
Definition: sccp_connection.h:62
struct osmo_sccp_addr called_addr
Definition: sccp_connection.h:23
uint32_t importance
Definition: sccp_connection.h:35
uint32_t remote_ref
Definition: sccp_connection.h:33
bool incoming
Definition: sccp_connection.h:47
struct osmo_fsm_inst * fi
Definition: sccp_connection.h:50
uint32_t remote_pc
Definition: sccp_connection.h:19
uint32_t sccp_class
Definition: sccp_connection.h:36
struct osmo_timer_list t_int
Definition: sccp_connection.h:61
Definition: xua_msg.h:31
uint8_t msg_class
Definition: xua_types.h:2