libosmogsm 1.10.0.64-ff3d
Osmocom GSM library
|
#include <errno.h>
#include <inttypes.h>
#include <osmocom/core/crc8gen.h>
#include <osmocom/core/crc16gen.h>
#include <osmocom/core/fsm.h>
#include <osmocom/core/prim.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/logging.h>
#include <osmocom/gsm/prim.h>
#include <osmocom/gsm/protocol/gsm_25_415.h>
#include <osmocom/gsm/iuup.h>
Data Structures | |
struct | osmo_timer_nt |
struct | osmo_iuup_instance |
Macros | |
#define | S(x) (1 << (x)) |
#define | IUUP_TIMER_INIT 1 |
#define | IUUP_TIMER_TA 2 |
#define | IUUP_TIMER_RC 3 |
#define | IUUP_MSGB_SIZE 4096 |
#define | PTR_ALIGNMENT_BYTES 8 |
#define | IUUP_MSGB_HEADROOM_MIN_REQUIRED (OSMO_MAX(sizeof(struct osmo_iuup_tnl_prim), sizeof(struct osmo_iuup_rnl_prim)) + (PTR_ALIGNMENT_BYTES - 1)) |
Functions | |
static int | iuup_get_payload_offset (const uint8_t *iuup_pdu) |
int | osmo_iuup_compute_payload_crc (const uint8_t *iuup_pdu, unsigned int pdu_len) |
int | osmo_iuup_compute_header_crc (const uint8_t *iuup_pdu, unsigned int pdu_len) |
static uint8_t | iuup_get_pdu_type (const uint8_t *data) |
static uint8_t | iuup_get_hdr_crc (const uint8_t *data) |
static struct msgb * | osmo_iuup_msgb_alloc_c (void *ctx, size_t size) |
static | __attribute__ ((assume_aligned(PTR_ALIGNMENT_BYTES))) |
struct osmo_iuup_rnl_prim * | osmo_iuup_rnl_prim_alloc (void *ctx, unsigned int primitive, unsigned int operation, unsigned int size) |
struct osmo_iuup_tnl_prim * | osmo_iuup_tnl_prim_alloc (void *ctx, unsigned int primitive, unsigned int operation, unsigned int size) |
static struct osmo_iuup_tnl_prim * | itp_ctrl_ack_alloc (struct osmo_iuup_instance *iui, enum iuup_procedure proc_ind, uint8_t fn) |
static struct osmo_iuup_tnl_prim * | tnp_ctrl_nack_alloc (struct osmo_iuup_instance *iui, enum iuup_procedure proc_ind, enum iuup_error_cause error_cause, uint8_t fn) |
static struct osmo_iuup_tnl_prim * | tnp_ctrl_init_alloc (struct osmo_iuup_instance *iui) |
static struct osmo_iuup_rnl_prim * | irp_init_ind_alloc (struct osmo_iuup_instance *iui) |
static struct osmo_iuup_tnl_prim * | rnl_to_tnl_data (struct osmo_iuup_instance *iui, struct osmo_iuup_rnl_prim *irp) |
static struct osmo_iuup_rnl_prim * | tnl_to_rnl_data (struct osmo_iuup_tnl_prim *itp) |
static struct osmo_iuup_rnl_prim * | irp_error_event_alloc_c (void *ctx, enum iuup_error_cause cause, enum iuup_error_distance distance) |
static struct osmo_iuup_tnl_prim * | itp_copy_c (void *ctx, const struct osmo_iuup_tnl_prim *src_itp) |
static void | retransmit_initialization (struct osmo_iuup_instance *iui) |
static bool | iuup_rx_initialization (struct osmo_iuup_instance *iui, struct osmo_iuup_tnl_prim *itp) |
static void | iuup_fsm_null (struct osmo_fsm_inst *fi, uint32_t event, void *data) |
static void | iuup_fsm_trm_data (struct osmo_fsm_inst *fi, uint32_t event, void *data) |
static void | iuup_fsm_init_on_enter (struct osmo_fsm_inst *fi, uint32_t prev_state) |
static void | iuup_fsm_init (struct osmo_fsm_inst *fi, uint32_t event, void *data) |
static void | iuup_fsm_smpsdu_data (struct osmo_fsm_inst *fi, uint32_t event, void *data) |
static int | iuup_fsm_timer_cb (struct osmo_fsm_inst *fi) |
static int | iuup_verify_pdu (const uint8_t *data, unsigned int len) |
int | osmo_iuup_tnl_prim_up (struct osmo_iuup_instance *inst, struct osmo_iuup_tnl_prim *itp) |
int | osmo_iuup_rnl_prim_down (struct osmo_iuup_instance *inst, struct osmo_iuup_rnl_prim *irp) |
struct osmo_iuup_instance * | osmo_iuup_instance_alloc (void *ctx, const char *id) |
void | osmo_iuup_instance_free (struct osmo_iuup_instance *iui) |
void | osmo_iuup_instance_set_user_prim_cb (struct osmo_iuup_instance *iui, osmo_prim_cb func, void *priv) |
void | osmo_iuup_instance_set_transport_prim_cb (struct osmo_iuup_instance *iui, osmo_prim_cb func, void *priv) |
static | __attribute__ ((constructor)) |
Variables | |
const struct osmo_crc8gen_code | iuup_hdr_crc_code |
const struct osmo_crc16gen_code | iuup_data_crc_code |
static const struct value_string | iuup_fsm_event_names [] |
static const struct osmo_fsm_state | iuup_fsm_states [] |
static struct osmo_fsm | iuup_fsm |
#define IUUP_MSGB_HEADROOM_MIN_REQUIRED (OSMO_MAX(sizeof(struct osmo_iuup_tnl_prim), sizeof(struct osmo_iuup_rnl_prim)) + (PTR_ALIGNMENT_BYTES - 1)) |
#define IUUP_MSGB_SIZE 4096 |
#define IUUP_TIMER_INIT 1 |
#define IUUP_TIMER_RC 3 |
#define IUUP_TIMER_TA 2 |
#define PTR_ALIGNMENT_BYTES 8 |
enum iuup_fsm_event |
enum iuup_fsm_state |
|
inlinestatic |
References len, msg, msgb_data(), msgb_push(), and PTR_ALIGNMENT_BYTES.
|
static |
References iuup_fsm, OSMO_ASSERT, and osmo_fsm_register().
|
static |
References osmo_iuup_rnl_status::cause, cause, osmo_iuup_rnl_status::distance, osmo_iuup_rnl_status::error_event, IUUP_PROC_ERR_EVENT, msg, msgb_alloc_c(), msgb_put(), osmo_iuup_rnl_prim::oph, OSMO_IUUP_RNL_STATUS, osmo_prim_init(), PRIM_OP_INDICATION, osmo_iuup_rnl_status::procedure, SAP_IUUP_RNL, osmo_iuup_rnl_prim::status, osmo_iuup_rnl_status::u, and osmo_iuup_rnl_prim::u.
Referenced by iuup_fsm_init(), and iuup_fsm_timer_cb().
|
static |
References osmo_iuup_instance::config, osmo_iuup_rnl_config::data_pdu_type, osmo_iuup_rnl_status::data_pdu_type, osmo_iuup_rnl_status::initialization, osmo_iuup_rnl_config::IPTIs_present, osmo_iuup_rnl_status::IPTIs_present, IUUP_MSGB_SIZE, IUUP_PROC_INIT, osmo_iuup_rnl_status::mode_version, osmo_iuup_instance::mode_version, osmo_iuup_rnl_config::num_rfci, osmo_iuup_rnl_status::num_rfci, osmo_iuup_rnl_config::num_subflows, osmo_iuup_rnl_status::num_subflows, osmo_iuup_rnl_prim_alloc(), OSMO_IUUP_RNL_STATUS, PRIM_OP_INDICATION, osmo_iuup_rnl_status::procedure, osmo_iuup_rnl_config::rfci, osmo_iuup_rnl_status::rfci, osmo_iuup_rnl_prim::status, osmo_iuup_rnl_status::u, and osmo_iuup_rnl_prim::u.
|
static |
References osmo_prim_hdr::msg, msg, msgb_copy_c(), msgb_data(), and osmo_iuup_tnl_prim::oph.
Referenced by retransmit_initialization().
|
static |
References iuup_ctrl_ack::hdr, IUUP_AN_ACK, IUUP_MSGB_SIZE, IUUP_PDU_T_CONTROL, msgb::l2h, osmo_iuup_instance::mode_version, osmo_prim_hdr::msg, msgb_l2, msgb_l2len(), msgb_put(), osmo_iuup_tnl_prim::oph, osmo_iuup_compute_header_crc(), osmo_iuup_tnl_prim_alloc(), OSMO_IUUP_TNL_UNITDATA, and PRIM_OP_REQUEST.
|
static |
References osmo_iuup_instance::config, data, osmo_iuup_instance::fi, osmo_iuup_instance::init, irp_error_event_alloc_c(), IUUP_ERR_CAUSE_INIT_FAILURE_REP_NACK, IUUP_ERR_DIST_SECOND_FWD, IUUP_FSM_EVT_INIT, IUUP_FSM_EVT_INIT_NACK, IUUP_FSM_EVT_IUUP_CONFIG_REQ, IUUP_FSM_EVT_LAST_INIT_ACK, IUUP_FSM_ST_NULL, IUUP_FSM_ST_SMpSDU_DATA_XFER_READY, iuup_rx_initialization(), LOGL_NOTICE, LOGPFSML, osmo_timer_nt::n, osmo_iuup_rnl_config_timer::n_max, osmo_iuup_rnl_prim::oph, OSMO_ASSERT, osmo_fsm_inst_state_chg, osmo_timer_del(), osmo_fsm_inst::priv, retransmit_initialization(), osmo_iuup_rnl_config::t_init, osmo_fsm_inst::timer, osmo_iuup_instance::timer, osmo_iuup_instance::user_prim_cb, and osmo_iuup_instance::user_prim_priv.
|
static |
|
static |
References osmo_iuup_rnl_prim::config, osmo_iuup_instance::config, data, osmo_iuup_instance::fi, IUUP_FSM_EVT_IUUP_CONFIG_REQ, IUUP_FSM_ST_INIT, IUUP_FSM_ST_TrM_DATA_XFER_READY, osmo_fsm_inst_state_chg, osmo_fsm_inst::priv, osmo_iuup_rnl_config::supported_versions_mask, osmo_iuup_rnl_config::transparent, and osmo_iuup_rnl_prim::u.
|
static |
References data, osmo_iuup_instance::fi, IUUP_FSM_EVT_INIT, IUUP_FSM_EVT_IUUP_CONFIG_REQ, IUUP_FSM_EVT_IUUP_DATA_IND, IUUP_FSM_EVT_IUUP_DATA_REQ, IUUP_FSM_ST_INIT, IUUP_FSM_ST_NULL, iuup_rx_initialization(), osmo_iuup_tnl_prim::oph, osmo_iuup_rnl_prim::oph, osmo_fsm_inst_state_chg, osmo_fsm_inst::priv, rnl_to_tnl_data(), tnl_to_rnl_data(), osmo_iuup_instance::transport_prim_cb, osmo_iuup_instance::transport_prim_priv, osmo_iuup_instance::user_prim_cb, and osmo_iuup_instance::user_prim_priv.
|
static |
References osmo_iuup_instance::config, osmo_iuup_instance::fi, osmo_iuup_instance::init, irp_error_event_alloc_c(), IUUP_ERR_CAUSE_INIT_FAILURE_NET_TMR, IUUP_ERR_DIST_LOCAL, IUUP_FSM_ST_INIT, IUUP_TIMER_INIT, IUUP_TIMER_RC, IUUP_TIMER_TA, osmo_timer_nt::n, osmo_iuup_rnl_config_timer::n_max, osmo_iuup_rnl_prim::oph, OSMO_ASSERT, osmo_fsm_inst::priv, retransmit_initialization(), osmo_fsm_inst::state, osmo_fsm_inst::T, osmo_iuup_rnl_config::t_init, osmo_iuup_instance::timer, osmo_iuup_instance::user_prim_cb, and osmo_iuup_instance::user_prim_priv.
|
static |
|
inlinestatic |
References data.
Referenced by iuup_verify_pdu().
|
static |
References pdu_type.
Referenced by osmo_iuup_compute_payload_crc().
|
inlinestatic |
References data.
Referenced by iuup_verify_pdu(), osmo_iuup_tnl_prim_up(), and tnl_to_rnl_data().
|
static |
References osmo_iuup_instance::config, osmo_iuup_instance::fi, for(), hdr, if(), IUUP_ERR_CAUSE_UNEXPECTED_RFCI, IUUP_ERR_CAUSE_UNEXPECTED_VALUE, IUUP_MAX_RFCIS, LOGL_NOTICE, LOGPFSML, osmo_prim_hdr::msg, msgb_l2, osmo_iuup_tnl_prim::oph, and osmo_iuup_rnl_config::rfci.
Referenced by iuup_fsm_init(), and iuup_fsm_smpsdu_data().
|
static |
References data, DLIUUP, IUUP_AN_PROCEDURE, iuup_get_hdr_crc(), iuup_get_pdu_type(), IUUP_PDU_T_CONTROL, IUUP_PDU_T_DATA_CRC, IUUP_PDU_T_DATA_NOCRC, len, LOGL_NOTICE, LOGP, osmo_iuup_compute_header_crc(), osmo_iuup_compute_payload_crc(), and pdu_type.
Referenced by osmo_iuup_tnl_prim_up().
int osmo_iuup_compute_header_crc | ( | const uint8_t * | iuup_pdu, |
unsigned int | pdu_len | ||
) |
References iuup_hdr_crc_code, osmo_crc8gen_compute_bits(), and osmo_pbit2ubit().
Referenced by itp_ctrl_ack_alloc(), iuup_verify_pdu(), rnl_to_tnl_data(), tnp_ctrl_init_alloc(), and tnp_ctrl_nack_alloc().
int osmo_iuup_compute_payload_crc | ( | const uint8_t * | iuup_pdu, |
unsigned int | pdu_len | ||
) |
References iuup_data_crc_code, iuup_get_payload_offset(), osmo_crc16gen_compute_bits(), osmo_pbit2ubit(), and pdu_type.
Referenced by iuup_verify_pdu(), rnl_to_tnl_data(), and tnp_ctrl_init_alloc().
struct osmo_iuup_instance * osmo_iuup_instance_alloc | ( | void * | ctx, |
const char * | id | ||
) |
References osmo_iuup_instance::fi, iuup_fsm, LOGL_DEBUG, and osmo_fsm_inst_alloc().
void osmo_iuup_instance_free | ( | struct osmo_iuup_instance * | iui | ) |
References osmo_iuup_instance::fi, and osmo_fsm_inst_free().
void osmo_iuup_instance_set_transport_prim_cb | ( | struct osmo_iuup_instance * | iui, |
osmo_prim_cb | func, | ||
void * | priv | ||
) |
void osmo_iuup_instance_set_user_prim_cb | ( | struct osmo_iuup_instance * | iui, |
osmo_prim_cb | func, | ||
void * | priv | ||
) |
References osmo_iuup_instance::user_prim_cb, and osmo_iuup_instance::user_prim_priv.
|
inlinestatic |
References IUUP_MSGB_HEADROOM_MIN_REQUIRED, msgb_alloc_headroom_c(), and OSMO_ASSERT.
Referenced by osmo_iuup_rnl_prim_alloc(), and osmo_iuup_tnl_prim_alloc().
struct osmo_iuup_rnl_prim * osmo_iuup_rnl_prim_alloc | ( | void * | ctx, |
unsigned int | primitive, | ||
unsigned int | operation, | ||
unsigned int | size | ||
) |
References msg, osmo_iuup_rnl_prim::oph, osmo_iuup_msgb_alloc_c(), osmo_prim_init(), and SAP_IUUP_RNL.
Referenced by irp_init_ind_alloc().
int osmo_iuup_rnl_prim_down | ( | struct osmo_iuup_instance * | inst, |
struct osmo_iuup_rnl_prim * | irp | ||
) |
References osmo_iuup_instance::fi, IUUP_FSM_EVT_IUUP_CONFIG_REQ, IUUP_FSM_EVT_IUUP_DATA_REQ, IUUP_FSM_EVT_IUUP_STATUS_REQ, osmo_prim_hdr::msg, msgb_free(), osmo_iuup_rnl_prim::oph, OSMO_ASSERT, osmo_fsm_inst_dispatch, OSMO_IUUP_RNL_CONFIG, OSMO_IUUP_RNL_DATA, OSMO_IUUP_RNL_STATUS, OSMO_PRIM, OSMO_PRIM_HDR, PRIM_OP_REQUEST, osmo_prim_hdr::sap, and SAP_IUUP_RNL.
struct osmo_iuup_tnl_prim * osmo_iuup_tnl_prim_alloc | ( | void * | ctx, |
unsigned int | primitive, | ||
unsigned int | operation, | ||
unsigned int | size | ||
) |
References msg, osmo_iuup_tnl_prim::oph, osmo_iuup_msgb_alloc_c(), osmo_prim_init(), and SAP_IUUP_TNL.
Referenced by itp_ctrl_ack_alloc(), tnp_ctrl_init_alloc(), and tnp_ctrl_nack_alloc().
int osmo_iuup_tnl_prim_up | ( | struct osmo_iuup_instance * | inst, |
struct osmo_iuup_tnl_prim * | itp | ||
) |
References osmo_iuup_instance::fi, IUUP_AN_ACK, IUUP_AN_NACK, IUUP_AN_PROCEDURE, IUUP_FSM_EVT_INIT, IUUP_FSM_EVT_INIT_NACK, IUUP_FSM_EVT_IUUP_DATA_IND, IUUP_FSM_EVT_LAST_INIT_ACK, iuup_get_pdu_type(), IUUP_PDU_T_CONTROL, IUUP_PDU_T_DATA_CRC, IUUP_PDU_T_DATA_NOCRC, IUUP_PROC_ERR_EVENT, IUUP_PROC_INIT, IUUP_PROC_RATE_CTRL, IUUP_PROC_TIME_ALIGN, iuup_verify_pdu(), msgb::l3h, LOGL_ERROR, LOGL_NOTICE, LOGPFSML, osmo_prim_hdr::msg, msgb_l2, msgb_l2len(), osmo_iuup_tnl_prim::oph, OSMO_ASSERT, osmo_fsm_inst_dispatch, osmo_hexdump(), OSMO_IUUP_TNL_UNITDATA, OSMO_PRIM, OSMO_PRIM_HDR, PRIM_OP_INDICATION, osmo_prim_hdr::sap, and SAP_IUUP_TNL.
|
static |
References osmo_iuup_instance::config, osmo_iuup_instance::fi, osmo_iuup_instance::init, itp_copy_c(), IUUP_TIMER_INIT, osmo_iuup_tnl_prim::oph, osmo_timer_schedule(), osmo_timer_nt::retrans_itp, osmo_fsm_inst::T, osmo_iuup_rnl_config::t_init, osmo_iuup_rnl_config_timer::t_ms, osmo_fsm_inst::timer, osmo_iuup_instance::timer, osmo_iuup_instance::transport_prim_cb, and osmo_iuup_instance::transport_prim_priv.
Referenced by iuup_fsm_init(), iuup_fsm_init_on_enter(), and iuup_fsm_timer_cb().
|
static |
References osmo_iuup_instance::config, osmo_iuup_rnl_prim::data, osmo_iuup_rnl_config::data_pdu_type, osmo_iuup_rnl_data::fqc, osmo_iuup_rnl_data::frame_nr, IUUP_PDU_T_DATA_CRC, IUUP_PDU_T_DATA_NOCRC, osmo_prim_hdr::msg, msg, msgb_l2, msgb_l2len(), msgb_pull_to_l3(), msgb_push(), osmo_iuup_tnl_prim::oph, osmo_iuup_rnl_prim::oph, OSMO_ASSERT, osmo_iuup_compute_header_crc(), osmo_iuup_compute_payload_crc(), OSMO_IUUP_RNL_DATA, OSMO_IUUP_TNL_UNITDATA, OSMO_PRIM, OSMO_PRIM_HDR, osmo_prim_init(), PRIM_OP_REQUEST, osmo_iuup_rnl_data::rfci, SAP_IUUP_TNL, and osmo_iuup_rnl_prim::u.
Referenced by iuup_fsm_smpsdu_data().
|
static |
References osmo_iuup_rnl_prim::data, osmo_iuup_rnl_data::fqc, osmo_iuup_rnl_data::frame_nr, iuup_get_pdu_type(), IUUP_PDU_T_DATA_CRC, IUUP_PDU_T_DATA_NOCRC, osmo_prim_hdr::msg, msg, msgb_l2, msgb_pull_to_l3(), osmo_iuup_tnl_prim::oph, osmo_iuup_rnl_prim::oph, OSMO_ASSERT, OSMO_IUUP_RNL_DATA, OSMO_IUUP_TNL_UNITDATA, OSMO_PRIM, OSMO_PRIM_HDR, osmo_prim_init(), PRIM_OP_INDICATION, osmo_iuup_rnl_data::rfci, SAP_IUUP_RNL, and osmo_iuup_rnl_prim::u.
Referenced by iuup_fsm_smpsdu_data().
|
static |
References ARRAY_SIZE, osmo_iuup_instance::config, osmo_iuup_rnl_config::data_pdu_type, DLIUUP, for(), hdr, osmo_iuup_rfci::id, osmo_iuup_rfci::IPTI, osmo_iuup_rnl_config::IPTIs_present, IUUP_AN_PROCEDURE, IUUP_MSGB_SIZE, IUUP_PDU_T_CONTROL, IUUP_PROC_INIT, LOGL_ERROR, LOGP, osmo_prim_hdr::msg, msg, msgb_free(), msgb_l2, msgb_l2len(), msgb_put(), osmo_iuup_rnl_config::num_rfci, osmo_iuup_rnl_config::num_subflows, osmo_iuup_tnl_prim::oph, osmo_iuup_compute_header_crc(), osmo_iuup_compute_payload_crc(), osmo_iuup_tnl_prim_alloc(), OSMO_IUUP_TNL_UNITDATA, PRIM_OP_REQUEST, osmo_iuup_rnl_config::rfci, osmo_iuup_rfci::subflow_sizes, osmo_iuup_rnl_config::supported_versions_mask, osmo_iuup_instance::type14_fn, and osmo_iuup_rfci::used.
Referenced by iuup_fsm_init_on_enter().
|
static |
const struct osmo_crc16gen_code iuup_data_crc_code |
Referenced by osmo_iuup_compute_payload_crc().
|
static |
Referenced by __attribute__(), and osmo_iuup_instance_alloc().
|
static |
|
static |
const struct osmo_crc8gen_code iuup_hdr_crc_code |
Referenced by osmo_iuup_compute_header_crc().