libosmo-sigtran: src/sccp_connection.c File Reference

libosmo-sigtran 2.2.1.99-1c6a Osmocom SIGTRAN library

Macros | Functions
sccp_connection.c File Reference
`#include <errno.h>`
`#include <stdbool.h>`
`#include <string.h>`
`#include <limits.h>`
`#include <osmocom/core/linuxlist.h>`
`#include <osmocom/core/logging.h>`
`#include <osmocom/sigtran/osmo_ss7.h>`
`#include <osmocom/sigtran/sccp_sap.h>`
`#include <osmocom/sigtran/mtp_sap.h>`
`#include <osmocom/sigtran/protocol/mtp.h>`
`#include <osmocom/sigtran/protocol/sua.h>`
`#include <osmocom/sigtran/sccp_helpers.h>`
`#include <osmocom/sccp/sccp_types.h>`
`#include "sccp_instance.h"`
`#include "sccp_internal.h"`
`#include "sccp_connection.h"`
`#include "sccp_scoc_fsm.h"`
`#include "sccp_user.h"`
`#include "ss7_instance.h"`
`#include "xua_msg.h"`
`#include "xua_internal.h"`

## Macros
#define | INIT_TIMER(x, fn, priv) do { (x)->cb = fn; (x)->data = priv; } while (0)
#define | SCU_MSGB_SIZE 1024

## Functions
static void | sccp_conn_opt_data_clear_cache (struct sccp_connection *conn)
static void | tx_inact_tmr_cb (void *data)
static void | rx_inact_tmr_cb (void *data)
static void | rel_tmr_cb (void *data)
static void | int_tmr_cb (void *data)
static void | rep_rel_tmr_cb (void *data)
static void | conn_tmr_cb (void *data)
static uint8_t | sccp_conn_gen_tx_co_mtp_sls (const struct sccp_connection *conn)
static int | conn_add_node (struct osmo_sccp_instance *inst, struct sccp_connection *conn)
struct sccp_connection * | sccp_conn_alloc (struct osmo_sccp_user *user, uint32_t conn_id)
void | sccp_conn_free (struct sccp_connection *conn)
static struct msgb * | scu_msgb_alloc (void)
static struct osmo_scu_prim * | scu_prim_alloc (unsigned int primitive, enum osmo_prim_operation operation)
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)
static void | sccp_timer_schedule (const struct sccp_connection *conn, struct osmo_timer_list *timer, enum osmo_sccp_timer timer_name)
void | sccp_conn_restart_tx_inact_timer (struct sccp_connection *conn)
void | sccp_conn_restart_rx_inact_timer (struct sccp_connection *conn)
void | sccp_conn_start_inact_timers (struct sccp_connection *conn)
void | sccp_conn_stop_inact_timers (struct sccp_connection *conn)
void | sccp_conn_start_rel_timer (struct sccp_connection *conn)
void | sccp_conn_start_rep_rel_timer (struct sccp_connection *conn)
void | sccp_conn_start_int_timer (struct sccp_connection *conn)
void | sccp_conn_stop_release_timers (struct sccp_connection *conn)
void | sccp_conn_start_connect_timer (struct sccp_connection *conn)
void | sccp_conn_stop_connect_timer (struct sccp_connection *conn)
void | sccp_conn_opt_data_send_cache (struct sccp_connection *conn, int exp_type, uint8_t msg_class)

## Macro Definition Documentation

## ◆ INIT_TIMER

#define INIT_TIMER | ( |  | x,
|  |  | fn,
|  |  | priv
| ) |  | do { (x)->cb = fn; (x)->data = priv; } while (0)

## ◆ SCU_MSGB_SIZE

#define SCU_MSGB_SIZE 1024

## Function Documentation

## ◆ conn_add_node()

static int conn_add_node | ( | struct osmo_sccp_instance * | inst,
|  | struct sccp_connection * | conn
| ) |  |
| static

References sccp_connection::conn_id, osmo_sccp_instance::connections, sccp_connection::inst, LOGPSCI, sccp_connection::node, and NULL.

Referenced by sccp_conn_alloc().

## ◆ conn_tmr_cb()

static void conn_tmr_cb | ( | void * | data | ) |
| static

References data, sccp_connection::fi, NULL, and SCOC_E_CONN_TMR_EXP.

Referenced by sccp_conn_alloc().

## ◆ int_tmr_cb()

static void int_tmr_cb | ( | void * | data | ) |
| static

References data, sccp_connection::fi, NULL, and SCOC_E_T_INT_EXP.

Referenced by sccp_conn_alloc().

## ◆ rel_tmr_cb()

static void rel_tmr_cb | ( | void * | data | ) |
| static

References data, sccp_connection::fi, NULL, and SCOC_E_T_REL_EXP.

Referenced by sccp_conn_alloc().

## ◆ rep_rel_tmr_cb()

static void rep_rel_tmr_cb | ( | void * | data | ) |
| static

References data, sccp_connection::fi, NULL, and SCOC_E_T_REP_REL_EXP.

Referenced by sccp_conn_alloc().

## ◆ rx_inact_tmr_cb()

static void rx_inact_tmr_cb | ( | void * | data | ) |
| static

References data, sccp_connection::fi, NULL, and SCOC_E_T_IAR_EXP.

Referenced by sccp_conn_alloc().

## ◆ sccp_conn_alloc()

struct sccp_connection * sccp_conn_alloc | ( | struct osmo_sccp_user * | user,
|  | uint32_t | conn_id
| ) |  |

References conn_add_node(), sccp_connection::conn_id, conn_tmr_cb(), osmo_sccp_instance::connections, sccp_connection::fi, INIT_TIMER, sccp_connection::inst, osmo_sccp_user::inst, int_tmr_cb(), sccp_connection::node, NULL, rel_tmr_cb(), rep_rel_tmr_cb(), rx_inact_tmr_cb(), sccp_conn_gen_tx_co_mtp_sls(), sccp_scoc_fsm, sccp_connection::t_conn, sccp_connection::t_iar, sccp_connection::t_ias, sccp_connection::t_int, sccp_connection::t_rel, sccp_connection::t_rep_rel, sccp_connection::tx_co_mtp_sls, tx_inact_tmr_cb(), and sccp_connection::user.

Referenced by conn_create(), and osmo_sccp_user_sap_down_nofree().

## ◆ sccp_conn_free()

void sccp_conn_free | ( | struct sccp_connection * | conn | ) |

References osmo_sccp_instance::connections, sccp_connection::fi, sccp_connection::inst, sccp_connection::node, NULL, sccp_conn_opt_data_clear_cache(), sccp_conn_stop_connect_timer(), sccp_conn_stop_inact_timers(), and sccp_conn_stop_release_timers().

Referenced by sccp_user_flush_connections(), and scoc_fsm_idle_onenter().

## ◆ sccp_conn_gen_tx_co_mtp_sls()

static uint8_t sccp_conn_gen_tx_co_mtp_sls | ( | const struct sccp_connection * | conn | ) |
| static

References sccp_connection::conn_id, and sls.

Referenced by sccp_conn_alloc().

## ◆ sccp_conn_opt_data_clear_cache()

static void sccp_conn_opt_data_clear_cache | ( | struct sccp_connection * | conn | ) |
| static

References NULL, and sccp_connection::opt_data_cache.

Referenced by sccp_conn_free(), and sccp_conn_opt_data_send_cache().

## ◆ sccp_conn_opt_data_send_cache()

void sccp_conn_opt_data_send_cache | ( | struct sccp_connection * | conn,
|  | int | exp_type,
|  | uint8_t | msg_class
| ) |  |

References xua_dialect::class, sccp_connection::conn_id, LOGPSCC, msg_class, sccp_connection::opt_data_cache, osmo_sccp_tx_data(), sccp_conn_opt_data_clear_cache(), sccp_connection::user, xua_class_msg_name(), and xua_dialect_sua.

Referenced by scoc_fsm_conn_pend_in(), and scoc_fsm_conn_pend_out().

## ◆ sccp_conn_restart_rx_inact_timer()

void sccp_conn_restart_rx_inact_timer | ( | struct sccp_connection * | conn | ) |

References OSMO_SCCP_TIMER_IAR, sccp_timer_schedule(), and sccp_connection::t_iar.

Referenced by sccp_conn_start_inact_timers(), and scoc_fsm_active().

## ◆ sccp_conn_restart_tx_inact_timer()

void sccp_conn_restart_tx_inact_timer | ( | struct sccp_connection * | conn | ) |

References OSMO_SCCP_TIMER_IAS, sccp_timer_schedule(), and sccp_connection::t_ias.

Referenced by sccp_conn_start_inact_timers(), and scoc_fsm_active().

## ◆ 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
| ) |  |

References osmo_scu_connect_param::called_addr, sccp_connection::called_addr, osmo_scu_connect_param::calling_addr, sccp_connection::calling_addr, osmo_scu_disconn_param::cause, osmo_scu_connect_param::conn_id, osmo_scu_data_param::conn_id, osmo_scu_disconn_param::conn_id, sccp_connection::conn_id, osmo_scu_prim::connect, xua_msg_part::dat, osmo_scu_prim::data, osmo_scu_prim::disconnect, sccp_connection::fi, osmo_scu_connect_param::importance, osmo_scu_data_param::importance, osmo_scu_disconn_param::importance, sccp_connection::importance, xua_msg_part::len, LOGPSCC, osmo_scu_prim::oph, osmo_scu_disconn_param::originator, OSMO_SCCP_ORIG_UNDEFINED, OSMO_SCU_PRIM_N_CONNECT, OSMO_SCU_PRIM_N_DATA, OSMO_SCU_PRIM_N_DISCONNECT, osmo_scu_disconn_param::responding_addr, osmo_scu_connect_param::sccp_class, sccp_connection::sccp_class, sccp_user_prim_up(), scu_prim_alloc(), sua_addr_parse(), SUA_IEI_CAUSE, SUA_IEI_DATA, SUA_IEI_IMPORTANCE, SUA_IEI_PROTO_CLASS, SUA_IEI_SRC_ADDR, osmo_scu_prim::u, sccp_connection::user, xua_dialect_sua, xua_hdr_dump(), xua_msg_find_tag(), and xua_msg_get_u32().

Referenced by scoc_fsm_active(), scoc_fsm_conn_pend_out(), and scoc_fsm_idle().

## ◆ sccp_conn_start_connect_timer()

void sccp_conn_start_connect_timer | ( | struct sccp_connection * | conn | ) |

References OSMO_SCCP_TIMER_CONN_EST, sccp_timer_schedule(), and sccp_connection::t_conn.

Referenced by scoc_fsm_conn_pend_out(), and scoc_fsm_idle().

## ◆ sccp_conn_start_inact_timers()

void sccp_conn_start_inact_timers | ( | struct sccp_connection * | conn | ) |

References sccp_conn_restart_rx_inact_timer(), and sccp_conn_restart_tx_inact_timer().

Referenced by scoc_fsm_conn_pend_in(), and scoc_fsm_conn_pend_out().

## ◆ sccp_conn_start_int_timer()

void sccp_conn_start_int_timer | ( | struct sccp_connection * | conn | ) |

References OSMO_SCCP_TIMER_INT, sccp_timer_schedule(), and sccp_connection::t_int.

Referenced by scoc_fsm_disconn_pend().

## ◆ sccp_conn_start_rel_timer()

void sccp_conn_start_rel_timer | ( | struct sccp_connection * | conn | ) |

References OSMO_SCCP_TIMER_REL, sccp_timer_schedule(), and sccp_connection::t_rel.

Referenced by scoc_fsm_active(), and scoc_fsm_wait_conn_conf().

## ◆ sccp_conn_start_rep_rel_timer()

void sccp_conn_start_rep_rel_timer | ( | struct sccp_connection * | conn | ) |

References OSMO_SCCP_TIMER_REPEAT_REL, sccp_timer_schedule(), and sccp_connection::t_rep_rel.

Referenced by scoc_fsm_disconn_pend().

## ◆ sccp_conn_stop_connect_timer()

void sccp_conn_stop_connect_timer | ( | struct sccp_connection * | conn | ) |

References sccp_connection::t_conn.

Referenced by sccp_conn_free(), scoc_fsm_conn_pend_out(), and scoc_fsm_wait_conn_conf().

## ◆ sccp_conn_stop_inact_timers()

void sccp_conn_stop_inact_timers | ( | struct sccp_connection * | conn | ) |

References sccp_connection::t_iar, and sccp_connection::t_ias.

Referenced by sccp_conn_free(), and scoc_fsm_active().

## ◆ sccp_conn_stop_release_timers()

void sccp_conn_stop_release_timers | ( | struct sccp_connection * | conn | ) |

References sccp_connection::t_int, sccp_connection::t_rel, and sccp_connection::t_rep_rel.

Referenced by sccp_conn_free(), and scoc_fsm_disconn_pend().

## ◆ sccp_timer_schedule()

static void sccp_timer_schedule | ( | const struct sccp_connection * | conn,
|  | struct osmo_timer_list * | timer,
|  | enum osmo_sccp_timer | timer_name
| ) |  |
| static

References sccp_connection::inst, and osmo_sccp_instance::tdefs.

Referenced by sccp_conn_restart_rx_inact_timer(), sccp_conn_restart_tx_inact_timer(), sccp_conn_start_connect_timer(), sccp_conn_start_int_timer(), sccp_conn_start_rel_timer(), and sccp_conn_start_rep_rel_timer().

## ◆ scu_msgb_alloc()

static struct msgb * scu_msgb_alloc | ( | void |  | ) |
| static

References SCU_MSGB_SIZE.

Referenced by scu_prim_alloc().

## ◆ scu_prim_alloc()

static struct osmo_scu_prim * scu_prim_alloc | ( | unsigned int | primitive,
|  | enum osmo_prim_operation | operation
| ) |  |
| static

References osmo_scu_prim::oph, SCCP_SAP_USER, and scu_msgb_alloc().

Referenced by sccp_conn_scu_gen_encode_and_send().

## ◆ tx_inact_tmr_cb()

static void tx_inact_tmr_cb | ( | void * | data | ) |
| static

References data, sccp_connection::fi, NULL, and SCOC_E_T_IAS_EXP.

Referenced by sccp_conn_alloc().