libosmoisdn 1.10.0.57-8972
Osmocom ISDN library
|
Osmocom LAPD core, used for Q.921, LAPDm and others. More...
Files | |
file | lapd_core.h |
primitive related stuff | |
file | lapd_core.c |
LAPD core implementation. | |
Data Structures | |
struct | mdl_error_ind_param |
for MDL-ERROR.ind More... | |
struct | dl_rel_req_param |
for DL-REL.req More... | |
struct | osmo_dlsap_prim |
primitive header for LAPD DL-SAP primitives More... | |
struct | lapd_msg_ctx |
LAPD message context. More... | |
struct | lapd_cr_ent |
struct | lapd_history |
struct | lapd_datalink |
LAPD datalink. More... | |
struct | l2downstate |
Enumerations | |
enum | osmo_dl_prim { PRIM_DL_UNIT_DATA , PRIM_DL_DATA , PRIM_DL_EST , PRIM_DL_REL , PRIM_DL_SUSP , PRIM_DL_RES , PRIM_DL_RECON , PRIM_MDL_ERROR } |
LAPD related primitives (L2<->L3 SAP) More... | |
enum | lapd_mode { LAPD_MODE_USER , LAPD_MODE_NETWORK } |
LAPD mode/role. More... | |
enum | lapd_state { LAPD_STATE_NULL = 0 , LAPD_STATE_TEI_UNASS , LAPD_STATE_ASS_TEI_WAIT , LAPD_STATE_EST_TEI_WAIT , LAPD_STATE_IDLE , LAPD_STATE_SABM_SENT , LAPD_STATE_DISC_SENT , LAPD_STATE_MF_EST , LAPD_STATE_TIMER_RECOV } |
LAPD state (Figure B.2/Q.921) More... | |
enum | lapd_t200_rts { LAPD_T200_RTS_OFF = 0 , LAPD_T200_RTS_PENDING , LAPD_T200_RTS_RUNNING } |
LAPD T200 state in RTS mode. More... | |
enum | lapd_format { LAPD_FORM_UKN = 0 , LAPD_FORM_I , LAPD_FORM_S , LAPD_FORM_U } |
LAPD message format (I / S / U) More... | |
Functions | |
void | lapd_dl_init (struct lapd_datalink *dl, uint8_t k, uint8_t v_range, int maxf) |
Initialize LAPD datalink instance and allocate history. More... | |
void | lapd_dl_init2 (struct lapd_datalink *dl, uint8_t k, uint8_t v_range, int maxf, const char *name) |
Initialize LAPD datalink instance and allocate history. More... | |
void | lapd_dl_set_name (struct lapd_datalink *dl, const char *name) |
void | lapd_dl_exit (struct lapd_datalink *dl) |
void | lapd_dl_reset (struct lapd_datalink *dl) |
int | lapd_dl_set_flags (struct lapd_datalink *dl, unsigned int flags) |
Set lapd_flags to change behaviour. More... | |
int | lapd_set_mode (struct lapd_datalink *dl, enum lapd_mode mode) |
Set the lapdm_mode of a LAPDm entity. More... | |
int | lapd_ph_data_ind (struct msgb *msg, struct lapd_msg_ctx *lctx) |
int | lapd_ph_rts_ind (struct lapd_msg_ctx *lctx) |
Enqueue next LAPD frame and run pending T200. More... | |
int | lapd_recv_dlsap (struct osmo_dlsap_prim *dp, struct lapd_msg_ctx *lctx) |
int | lapd_t200_timeout (struct lapd_datalink *dl) |
Handle timeout condition of T200 in RTS mode. More... | |
static void | lapd_t200_cb (void *data) |
static void | lapd_t203_cb (void *data) |
static int | lapd_send_i (struct lapd_datalink *dl, int line, bool rts) |
static int | lapd_est_req (struct osmo_dlsap_prim *dp, struct lapd_msg_ctx *lctx) |
struct msgb * | lapd_msgb_alloc (int length, const char *name) |
static uint8_t | do_mod (uint8_t x, uint8_t m) |
static uint8_t | inc_mod (uint8_t x, uint8_t m) |
static uint8_t | add_mod (uint8_t x, uint8_t y, uint8_t m) |
static uint8_t | sub_mod (uint8_t x, uint8_t y, uint8_t m) |
static void | lapd_dl_flush_send (struct lapd_datalink *dl) |
static void | lapd_dl_flush_hist (struct lapd_datalink *dl) |
static void | lapd_dl_flush_tx_queue (struct lapd_datalink *dl) |
static void | lapd_dl_flush_tx (struct lapd_datalink *dl) |
static const char * | lapd_state_name (enum lapd_state state) |
static void | lapd_start_t200 (struct lapd_datalink *dl) |
static void | lapd_start_t203 (struct lapd_datalink *dl) |
static void | lapd_stop_t200 (struct lapd_datalink *dl) |
static bool | lapd_is_t200_started (struct lapd_datalink *dl) |
static void | lapd_stop_t203 (struct lapd_datalink *dl) |
static void | lapd_dl_newstate (struct lapd_datalink *dl, uint32_t state) |
static int | send_dl_l3 (uint8_t prim, uint8_t op, struct lapd_msg_ctx *lctx, struct msgb *msg) |
static int | send_dl_simple (uint8_t prim, uint8_t op, struct lapd_msg_ctx *lctx) |
static int | mdl_error (uint8_t cause, struct lapd_msg_ctx *lctx) |
static int | lapd_send_ua (struct lapd_msg_ctx *lctx, uint8_t len, uint8_t *data) |
static int | lapd_send_dm (struct lapd_msg_ctx *lctx) |
static int | lapd_send_rr (struct lapd_msg_ctx *lctx, uint8_t f_bit, uint8_t cmd) |
static int | lapd_send_rnr (struct lapd_msg_ctx *lctx, uint8_t f_bit, uint8_t cmd) |
static int | lapd_send_rej (struct lapd_msg_ctx *lctx, uint8_t f_bit) |
static int | lapd_send_resend (struct lapd_datalink *dl) |
static int | lapd_reestablish (struct lapd_datalink *dl) |
static int | lapd_acknowledge (struct lapd_msg_ctx *lctx) |
static int | lapd_rx_u_sabm (struct msgb *msg, struct lapd_msg_ctx *lctx) |
static int | lapd_rx_u_dm (struct msgb *msg, struct lapd_msg_ctx *lctx) |
static int | lapd_rx_u_ui (struct msgb *msg, struct lapd_msg_ctx *lctx) |
static int | lapd_rx_u_disc (struct msgb *msg, struct lapd_msg_ctx *lctx) |
static int | lapd_rx_u_ua (struct msgb *msg, struct lapd_msg_ctx *lctx) |
static int | lapd_rx_u_frmr (struct msgb *msg, struct lapd_msg_ctx *lctx) |
static int | lapd_rx_u (struct msgb *msg, struct lapd_msg_ctx *lctx) |
static int | lapd_rx_s (struct msgb *msg, struct lapd_msg_ctx *lctx) |
static int | lapd_rx_i (struct msgb *msg, struct lapd_msg_ctx *lctx) |
static int | lapd_udata_req (struct osmo_dlsap_prim *dp, struct lapd_msg_ctx *lctx) |
static void | msg_to_tx_hist (struct lapd_history *tx_hist, const struct msgb *msg, int length, int more) |
static void | msg_to_tx_hist0 (struct lapd_datalink *dl, const struct msgb *msg) |
static int | lapd_data_req (struct osmo_dlsap_prim *dp, struct lapd_msg_ctx *lctx) |
static int | lapd_susp_req (struct osmo_dlsap_prim *dp, struct lapd_msg_ctx *lctx) |
static int | lapd_res_req (struct osmo_dlsap_prim *dp, struct lapd_msg_ctx *lctx) |
static int | lapd_rel_req (struct osmo_dlsap_prim *dp, struct lapd_msg_ctx *lctx) |
static int | lapd_rel_req_idle (struct osmo_dlsap_prim *dp, struct lapd_msg_ctx *lctx) |
Variables | |
const struct value_string | lapd_state_names [] |
void * | tall_lapd_ctx = NULL |
static const struct l2downstate | l2downstatelist [] |
Osmocom LAPD core, used for Q.921, LAPDm and others.
Notes on Buffering: rcv_buffer, tx_queue, tx_hist, send_buffer, send_queue
RX data is stored in the rcv_buffer (pointer). If the message is complete, it is removed from rcv_buffer pointer and forwarded to L3. If the RX data is received while there is an incomplete rcv_buffer, it is appended to it.
TX data is stored in the send_queue first. When transmitting a frame, the first message in the send_queue is moved to the send_buffer. There it resides until all fragments are acknowledged. Fragments to be sent by I frames are stored in the tx_hist buffer for resend, if required. Also the current fragment is copied into the tx_queue. There it resides until it is forwarded to layer 1.
In case we have SAPI 0, we only have a window size of 1, so the unack- nowledged message resides always in the send_buffer. In case of a suspend, it can be written back to the first position of the send_queue.
The layer 1 normally sends a PH-READY-TO-SEND. But because we use asynchronous transfer between layer 1 and layer 2 (serial link), we must send a frame before layer 1 reaches the right timeslot to send it. So we move the tx_queue to layer 1 when there is not already a pending frame, and wait until acknowledge after the frame has been sent. If we receive an acknowledge, we can send the next frame from the buffer, if any.
The moving of tx_queue to layer 1 may also trigger T200, if desired. Also it will trigger next I frame, if possible.
T203 is optional. It will be stated when entering MF EST state. It will also be started when I or S frame is received in that state . It will be restarted in the lapd_acknowledge() function, in case outstanding frames will not trigger T200. It will be stoped, when T200 is started in MF EST state. It will also be stoped when leaving MF EST state.
#define ALL_STATES 0xffffffff |
#define CR_NET2USER_CMD 1 |
#define CR_NET2USER_RESP 0 |
#define CR_USER2NET_CMD 0 |
#define CR_USER2NET_RESP 1 |
#define L2DOWNSLLEN (sizeof(l2downstatelist) / sizeof(struct l2downstate)) |
#define LAPD_F_DROP_2ND_REJ 0x0002 |
#define LAPD_F_RTS 0x0001 |
lapd_flags
#define LAPD_HEADROOM 56 |
#define LAPD_S_REJ 0x2 |
#define LAPD_S_RNR 0x1 |
#define LAPD_S_RR 0x0 |
#define LAPD_TAILROOM 16 |
#define LAPD_U_DISC 0x8 |
#define LAPD_U_DM 0x3 |
#define LAPD_U_FRMR 0x11 |
#define LAPD_U_SABM 0x7 |
#define LAPD_U_SABME 0xf |
#define LAPD_U_UA 0xC |
#define LAPD_U_UI 0x0 |
#define MDL_CAUSE_FRM_UNIMPL 0x0c |
#define MDL_CAUSE_FRMR 0x0f |
#define MDL_CAUSE_IFRM_INC_LEN 0x0b |
#define MDL_CAUSE_IFRM_INC_MBITS 0x0a |
#define MDL_CAUSE_REEST_REQ 0x02 |
#define MDL_CAUSE_SABM_INFO_NOTALL 0x0e |
#define MDL_CAUSE_SABM_MF 0x0d |
#define MDL_CAUSE_SEQ_ERR 0x07 |
#define MDL_CAUSE_SFRM_INC_PARAM 0x09 |
#define MDL_CAUSE_T200_EXPIRED 0x01 |
#define MDL_CAUSE_UFRM_INC_PARAM 0x08 |
#define MDL_CAUSE_UNSOL_DM_RESP 0x04 |
#define MDL_CAUSE_UNSOL_DM_RESP_MF 0x05 |
#define MDL_CAUSE_UNSOL_SPRV_RESP 0x06 |
#define MDL_CAUSE_UNSOL_UA_RESP 0x03 |
#define SBIT | ( | a | ) | (1 << a) |
enum lapd_format |
enum lapd_mode |
enum lapd_state |
enum lapd_t200_rts |
enum osmo_dl_prim |
|
inlinestatic |
References x.
Referenced by lapd_send_i().
|
inlinestatic |
References x.
Referenced by lapd_acknowledge(), lapd_send_i(), lapd_send_resend(), and lapd_t200_cb().
|
inlinestatic |
References x.
Referenced by lapd_acknowledge(), lapd_rx_i(), and lapd_send_i().
|
static |
References lapd_msg_ctx::dl, do_mod(), lapd_msg_ctx::format, inc_mod(), LAPD_FORM_S, lapd_is_t200_started(), LAPD_S_REJ, lapd_start_t200(), lapd_start_t203(), LAPD_STATE_MF_EST, LAPD_STATE_TIMER_RECOV, lapd_stop_t200(), lapd_stop_t203(), lapd_datalink::lctx, LOGDL, LOGL_INFO, LOGL_NOTICE, MDL_CAUSE_SEQ_ERR, lapd_history::msg, msgb_free(), lapd_msg_ctx::n_recv, lapd_datalink::range_hist, lapd_msg_ctx::s_u, lapd_datalink::state, sub_mod(), lapd_datalink::t203_sec, lapd_datalink::t203_usec, lapd_datalink::tx_hist, lapd_datalink::v_ack, lapd_datalink::v_range, and lapd_datalink::v_send.
Referenced by lapd_rx_i(), and lapd_rx_s().
|
static |
void lapd_dl_exit | ( | struct lapd_datalink * | dl | ) |
References lapd_dl_newstate(), lapd_dl_reset(), LAPD_STATE_NULL, lapd_datalink::name, and lapd_datalink::tx_hist.
|
static |
References lapd_history::msg, msgb_free(), lapd_datalink::range_hist, and lapd_datalink::tx_hist.
Referenced by lapd_dl_flush_tx(), lapd_est_req(), lapd_rel_req(), lapd_res_req(), lapd_rx_u_sabm(), and lapd_rx_u_ua().
|
static |
References msgb_dequeue(), msgb_free(), lapd_datalink::send_buffer, and lapd_datalink::send_queue.
Referenced by lapd_dl_reset(), lapd_est_req(), lapd_rel_req(), lapd_rx_u_disc(), lapd_rx_u_dm(), lapd_rx_u_ua(), and lapd_t200_cb().
|
static |
References lapd_dl_flush_hist(), and lapd_dl_flush_tx_queue().
Referenced by lapd_dl_reset(), lapd_rel_req(), lapd_rx_u_disc(), lapd_rx_u_dm(), lapd_rx_u_ua(), lapd_susp_req(), and lapd_t200_cb().
|
static |
References msgb_dequeue(), msgb_free(), and lapd_datalink::tx_queue.
Referenced by lapd_dl_flush_tx(), and lapd_rx_s().
void lapd_dl_init | ( | struct lapd_datalink * | dl, |
uint8_t | k, | ||
uint8_t | v_range, | ||
int | maxf | ||
) |
Initialize LAPD datalink instance and allocate history.
[in] | dl | caller-allocated datalink structure |
[in] | k | maximum number of unacknowledged frames |
[in] | v_range | range of sequence numbers |
[in] | maxf | maximum frame size (after defragmentation) |
References lapd_dl_init2().
void lapd_dl_init2 | ( | struct lapd_datalink * | dl, |
uint8_t | k, | ||
uint8_t | v_range, | ||
int | maxf, | ||
const char * | name | ||
) |
Initialize LAPD datalink instance and allocate history.
[in] | dl | caller-allocated datalink structure |
[in] | k | maximum number of unacknowledged frames |
[in] | v_range | range of sequence numbers |
[in] | maxf | maximum frame size (after defragmentation) |
[in] | name | human-readable name for this LAPD datalink |
References INIT_LLIST_HEAD, lapd_datalink::k, lapd_dl_newstate(), LAPD_STATE_IDLE, lapd_t200_cb(), lapd_t203_cb(), LOGDL, LOGL_INFO, lapd_datalink::maxf, lapd_datalink::n200, lapd_datalink::n200_est_rel, name, lapd_datalink::name, OSMO_ASSERT, osmo_timer_setup(), lapd_datalink::range_hist, lapd_datalink::reestablish, lapd_datalink::send_queue, lapd_datalink::t200, lapd_datalink::t200_sec, lapd_datalink::t200_usec, lapd_datalink::t203, lapd_datalink::t203_sec, lapd_datalink::t203_usec, tall_lapd_ctx, lapd_datalink::tx_hist, lapd_datalink::tx_queue, and lapd_datalink::v_range.
Referenced by lapd_dl_init().
|
static |
References lapd_datalink::cont_res, lapd_start_t203(), LAPD_STATE_MF_EST, lapd_state_name(), lapd_stop_t203(), LOGDL, LOGL_INFO, msgb_free(), lapd_datalink::state, lapd_datalink::t203_sec, and lapd_datalink::t203_usec.
Referenced by lapd_dl_exit(), lapd_dl_init2(), lapd_dl_reset(), lapd_est_req(), lapd_rel_req(), lapd_res_req(), lapd_rx_s(), lapd_rx_u_disc(), lapd_rx_u_dm(), lapd_rx_u_sabm(), lapd_rx_u_ua(), lapd_t200_cb(), and lapd_t203_cb().
void lapd_dl_reset | ( | struct lapd_datalink * | dl | ) |
References lapd_dl_flush_send(), lapd_dl_flush_tx(), lapd_dl_newstate(), LAPD_STATE_IDLE, lapd_stop_t200(), lapd_stop_t203(), LOGDL, LOGL_INFO, msgb_free(), lapd_datalink::rcv_buffer, and lapd_datalink::state.
Referenced by lapd_dl_exit().
int lapd_dl_set_flags | ( | struct lapd_datalink * | dl, |
unsigned int | flags | ||
) |
Set lapd_flags to change behaviour.
[in] | dl | lapd_datalink instance |
[in] | flags | lapd_flags |
References flags, LAPD_F_RTS, lapd_datalink::lapd_flags, lapd_is_t200_started(), LOGDL, and LOGL_ERROR.
void lapd_dl_set_name | ( | struct lapd_datalink * | dl, |
const char * | name | ||
) |
References name, lapd_datalink::name, osmo_talloc_replace_string(), and tall_lapd_ctx.
|
static |
References lapd_cr_ent::cmd, lapd_msg_ctx::cr, lapd_datalink::cr, lapd_msg_ctx::dl, lapd_msg_ctx::format, lapd_dl_flush_hist(), lapd_dl_flush_send(), lapd_dl_newstate(), LAPD_FORM_U, lapd_start_t200(), LAPD_STATE_SABM_SENT, LAPD_U_SABM, LAPD_U_SABME, lapd_datalink::lctx, msgb::len, lapd_msg_ctx::length, lapd_datalink::loc2rem, LOGDL, LOGL_INFO, lapd_msg_ctx::more, osmo_prim_hdr::msg, msg_to_tx_hist0(), msgb_free(), osmo_dlsap_prim::oph, lapd_datalink::own_busy, lapd_msg_ctx::p_f, lapd_datalink::peer_busy, lapd_datalink::rcv_buffer, lapd_datalink::retrans_ctr, lapd_msg_ctx::s_u, lapd_datalink::send_ph_data_req, lapd_datalink::use_sabme, and lapd_datalink::v_send.
Referenced by lapd_reestablish().
|
static |
References LAPD_F_RTS, lapd_datalink::lapd_flags, LAPD_T200_RTS_OFF, osmo_timer_pending(), lapd_datalink::t200, and lapd_datalink::t200_rts.
Referenced by lapd_acknowledge(), lapd_dl_set_flags(), and lapd_send_i().
struct msgb * lapd_msgb_alloc | ( | int | length, |
const char * | name | ||
) |
References LAPD_HEADROOM, LAPD_TAILROOM, msgb_alloc_headroom(), and name.
Referenced by lapd_reestablish(), lapd_res_req(), lapd_rx_i(), lapd_rx_u_sabm(), lapd_send_dm(), lapd_send_i(), lapd_send_rej(), lapd_send_resend(), lapd_send_rnr(), lapd_send_rr(), lapd_send_ua(), lapd_t200_cb(), and msg_to_tx_hist().
int lapd_ph_data_ind | ( | struct msgb * | msg, |
struct lapd_msg_ctx * | lctx | ||
) |
References lapd_msg_ctx::dl, lapd_msg_ctx::format, LAPD_FORM_I, LAPD_FORM_S, LAPD_FORM_U, lapd_rx_i(), lapd_rx_s(), lapd_rx_u(), lapd_datalink::lctx, LOGDL, LOGL_NOTICE, and msgb_free().
int lapd_ph_rts_ind | ( | struct lapd_msg_ctx * | lctx | ) |
Enqueue next LAPD frame and run pending T200.
(Must be called when frame is ready to send.) The caller (LAPDm code) calls this function before it sends the next frame. If there is no frame in the TX queue, LAPD will enqueue next I-frame, if possible. If the T200 is pending, it is changed to running state.
[in] | lctx | LAPD context |
[out] | rc | set to 1, if timer T200 state changed to running, set to 0, if not. |
References lapd_msg_ctx::dl, lapd_send_i(), LAPD_STATE_MF_EST, LAPD_STATE_TIMER_RECOV, LAPD_T200_RTS_PENDING, LAPD_T200_RTS_RUNNING, lapd_datalink::lctx, llist_empty(), lapd_datalink::state, lapd_datalink::t200_rts, and lapd_datalink::tx_queue.
int lapd_recv_dlsap | ( | struct osmo_dlsap_prim * | dp, |
struct lapd_msg_ctx * | lctx | ||
) |
References lapd_msg_ctx::dl, L2DOWNSLLEN, l2downstatelist, lapd_state_name(), lapd_datalink::lctx, LOGDL, LOGL_INFO, LOGL_NOTICE, osmo_prim_hdr::msg, msgb_free(), name, l2downstate::op, osmo_prim_hdr::operation, osmo_dlsap_prim::oph, l2downstate::prim, osmo_prim_hdr::primitive, l2downstate::rout, SBIT, lapd_datalink::state, and l2downstate::states.
|
static |
References lapd_est_req(), lapd_msgb_alloc(), lapd_datalink::lctx, LOGDL, LOGL_DEBUG, osmo_dlsap_prim::oph, osmo_prim_init(), PRIM_DL_EST, and PRIM_OP_REQUEST.
Referenced by lapd_rx_u_dm(), lapd_rx_u_frmr(), and lapd_t200_cb().
|
static |
References lapd_cr_ent::cmd, lapd_msg_ctx::cr, lapd_datalink::cr, lapd_msg_ctx::dl, lapd_msg_ctx::format, lapd_dl_flush_hist(), lapd_dl_flush_send(), lapd_dl_flush_tx(), lapd_dl_newstate(), LAPD_FORM_U, lapd_start_t200(), LAPD_STATE_DISC_SENT, LAPD_STATE_IDLE, lapd_stop_t200(), LAPD_U_DISC, lapd_datalink::lctx, lapd_msg_ctx::length, lapd_datalink::loc2rem, LOGDL, LOGL_INFO, dl_rel_req_param::mode, lapd_msg_ctx::more, osmo_prim_hdr::msg, msg_to_tx_hist0(), msgb_free(), osmo_dlsap_prim::oph, lapd_datalink::own_busy, lapd_msg_ctx::p_f, lapd_datalink::peer_busy, PRIM_DL_REL, PRIM_OP_CONFIRM, osmo_dlsap_prim::rel_req, lapd_datalink::retrans_ctr, lapd_msg_ctx::s_u, send_dl_simple(), lapd_datalink::send_ph_data_req, lapd_datalink::state, osmo_dlsap_prim::u, and lapd_datalink::v_send.
|
static |
|
static |
References lapd_cr_ent::cmd, lapd_msg_ctx::cr, lapd_datalink::cr, msgb::data, lapd_msg_ctx::dl, lapd_msg_ctx::format, msgb::l3h, lapd_dl_flush_hist(), lapd_dl_newstate(), LAPD_FORM_U, lapd_msgb_alloc(), lapd_start_t200(), LAPD_STATE_SABM_SENT, LAPD_U_SABM, LAPD_U_SABME, lapd_datalink::lctx, msgb::len, lapd_msg_ctx::length, lapd_datalink::loc2rem, LOGDL, LOGL_INFO, lapd_msg_ctx::more, osmo_prim_hdr::msg, msg_to_tx_hist0(), msgb_free(), osmo_dlsap_prim::oph, lapd_datalink::own_busy, lapd_msg_ctx::p_f, lapd_datalink::peer_busy, lapd_datalink::rcv_buffer, lapd_datalink::retrans_ctr, lapd_msg_ctx::s_u, lapd_datalink::send_buffer, lapd_datalink::send_out, lapd_datalink::send_ph_data_req, lapd_datalink::use_sabme, and lapd_datalink::v_send.
|
static |
References lapd_msg_ctx::cr, lapd_datalink::cr, msgb::data, lapd_msg_ctx::dl, inc_mod(), msgb::l3h, lapd_acknowledge(), LAPD_F_DROP_2ND_REJ, lapd_datalink::lapd_flags, lapd_msgb_alloc(), lapd_send_dm(), lapd_send_i(), lapd_send_rej(), lapd_send_rnr(), lapd_send_rr(), LAPD_STATE_DISC_SENT, LAPD_STATE_IDLE, lapd_state_name(), LAPD_STATE_NULL, LAPD_STATE_SABM_SENT, lapd_datalink::lctx, lapd_msg_ctx::length, LOGDL, LOGL_ERROR, LOGL_INFO, LOGL_NOTICE, lapd_datalink::maxf, MDL_CAUSE_FRM_UNIMPL, MDL_CAUSE_IFRM_INC_LEN, MDL_CAUSE_IFRM_INC_MBITS, mdl_error(), lapd_msg_ctx::more, msgb_free(), msgb_l3len(), msgb_put(), msgb_trim(), lapd_msg_ctx::n201, lapd_msg_ctx::n_send, lapd_datalink::own_busy, lapd_msg_ctx::p_f, PRIM_DL_DATA, PRIM_OP_INDICATION, lapd_datalink::rcv_buffer, lapd_datalink::rem2loc, lapd_cr_ent::resp, lapd_msg_ctx::sapi, send_dl_l3(), lapd_datalink::seq_err_cond, lapd_datalink::state, lapd_datalink::update_pending_frames, lapd_datalink::v_range, and lapd_datalink::v_recv.
Referenced by lapd_ph_data_ind().
|
static |
References lapd_cr_ent::cmd, lapd_msg_ctx::cr, lapd_datalink::cr, lapd_msg_ctx::dl, lapd_acknowledge(), lapd_dl_flush_tx_queue(), lapd_dl_newstate(), LAPD_S_REJ, LAPD_S_RNR, LAPD_S_RR, lapd_send_dm(), lapd_send_i(), lapd_send_rnr(), lapd_send_rr(), LAPD_STATE_DISC_SENT, LAPD_STATE_IDLE, LAPD_STATE_MF_EST, lapd_state_name(), LAPD_STATE_SABM_SENT, LAPD_STATE_TIMER_RECOV, lapd_stop_t200(), lapd_datalink::lctx, lapd_msg_ctx::length, LOGDL, LOGL_ERROR, LOGL_INFO, LOGL_NOTICE, MDL_CAUSE_FRM_UNIMPL, MDL_CAUSE_SFRM_INC_PARAM, MDL_CAUSE_UNSOL_SPRV_RESP, mdl_error(), lapd_msg_ctx::more, msgb_free(), lapd_msg_ctx::n_recv, lapd_datalink::own_busy, lapd_msg_ctx::p_f, lapd_datalink::peer_busy, lapd_datalink::rem2loc, lapd_cr_ent::resp, lapd_msg_ctx::s_u, lapd_datalink::seq_err_cond, lapd_datalink::state, lapd_datalink::v_ack, and lapd_datalink::v_send.
Referenced by lapd_ph_data_ind().
|
static |
References lapd_msg_ctx::dl, lapd_rx_u_disc(), lapd_rx_u_dm(), lapd_rx_u_frmr(), lapd_rx_u_sabm(), lapd_rx_u_ua(), lapd_rx_u_ui(), LAPD_U_DISC, LAPD_U_DM, LAPD_U_FRMR, LAPD_U_SABM, LAPD_U_SABME, LAPD_U_UA, LAPD_U_UI, lapd_datalink::lctx, LOGDL, LOGL_NOTICE, MDL_CAUSE_FRM_UNIMPL, mdl_error(), msgb_free(), and lapd_msg_ctx::s_u.
Referenced by lapd_ph_data_ind().
|
static |
References lapd_msg_ctx::cr, lapd_datalink::cr, lapd_msg_ctx::dl, msgb::l3h, lapd_dl_flush_send(), lapd_dl_flush_tx(), lapd_dl_newstate(), lapd_send_dm(), lapd_send_ua(), LAPD_STATE_DISC_SENT, LAPD_STATE_IDLE, LAPD_STATE_MF_EST, lapd_state_name(), LAPD_STATE_SABM_SENT, LAPD_STATE_TIMER_RECOV, lapd_stop_t200(), lapd_datalink::lctx, lapd_msg_ctx::length, LOGDL, LOGL_ERROR, LOGL_INFO, MDL_CAUSE_FRM_UNIMPL, MDL_CAUSE_UFRM_INC_PARAM, mdl_error(), lapd_msg_ctx::more, msgb_free(), PRIM_DL_REL, PRIM_OP_CONFIRM, PRIM_OP_INDICATION, lapd_datalink::rem2loc, lapd_cr_ent::resp, send_dl_simple(), lapd_datalink::seq_err_cond, and lapd_datalink::state.
Referenced by lapd_rx_u().
|
static |
References lapd_cr_ent::cmd, lapd_msg_ctx::cr, lapd_datalink::cr, lapd_msg_ctx::dl, lapd_dl_flush_send(), lapd_dl_flush_tx(), lapd_dl_newstate(), lapd_reestablish(), LAPD_STATE_DISC_SENT, LAPD_STATE_IDLE, LAPD_STATE_MF_EST, lapd_state_name(), LAPD_STATE_SABM_SENT, LAPD_STATE_TIMER_RECOV, lapd_stop_t200(), lapd_datalink::lctx, LOGDL, LOGL_ERROR, LOGL_INFO, LOGL_NOTICE, MDL_CAUSE_FRM_UNIMPL, MDL_CAUSE_UNSOL_DM_RESP, MDL_CAUSE_UNSOL_DM_RESP_MF, mdl_error(), msgb_free(), lapd_msg_ctx::p_f, PRIM_DL_REL, PRIM_OP_CONFIRM, PRIM_OP_INDICATION, lapd_datalink::reestablish, lapd_datalink::rem2loc, send_dl_simple(), and lapd_datalink::state.
Referenced by lapd_rx_u().
|
static |
References lapd_msg_ctx::dl, lapd_reestablish(), lapd_datalink::lctx, LOGDL, LOGL_NOTICE, MDL_CAUSE_FRMR, mdl_error(), msgb_free(), and lapd_datalink::reestablish.
Referenced by lapd_rx_u().
|
static |
References lapd_datalink::cont_res, lapd_msg_ctx::cr, lapd_datalink::cr, msgb::data, lapd_msg_ctx::dl, msgb::l3h, lapd_dl_flush_hist(), lapd_dl_newstate(), LAPD_MODE_NETWORK, lapd_msgb_alloc(), lapd_send_dm(), lapd_send_ua(), LAPD_STATE_DISC_SENT, LAPD_STATE_IDLE, LAPD_STATE_MF_EST, lapd_state_name(), LAPD_STATE_TIMER_RECOV, lapd_stop_t200(), lapd_datalink::lctx, msgb::len, lapd_msg_ctx::length, LOGDL, LOGL_ERROR, LOGL_INFO, LOGL_NOTICE, MDL_CAUSE_FRM_UNIMPL, MDL_CAUSE_SABM_INFO_NOTALL, MDL_CAUSE_SABM_MF, MDL_CAUSE_UFRM_INC_PARAM, mdl_error(), lapd_datalink::mode, lapd_msg_ctx::more, lapd_history::msg, msgb_free(), msgb_put(), msgb_trim(), lapd_msg_ctx::n201, PRIM_DL_EST, PRIM_OP_INDICATION, lapd_datalink::rem2loc, lapd_cr_ent::resp, send_dl_l3(), send_dl_simple(), lapd_datalink::seq_err_cond, lapd_datalink::state, lapd_datalink::tx_hist, lapd_datalink::v_ack, lapd_datalink::v_recv, and lapd_datalink::v_send.
Referenced by lapd_rx_u().
|
static |
References lapd_cr_ent::cmd, lapd_msg_ctx::cr, lapd_datalink::cr, msgb::data, lapd_msg_ctx::dl, msgb::l3h, lapd_dl_flush_hist(), lapd_dl_flush_send(), lapd_dl_flush_tx(), lapd_dl_newstate(), lapd_send_i(), LAPD_STATE_DISC_SENT, LAPD_STATE_IDLE, LAPD_STATE_MF_EST, lapd_state_name(), LAPD_STATE_SABM_SENT, LAPD_STATE_TIMER_RECOV, lapd_stop_t200(), lapd_datalink::lctx, msgb::len, lapd_msg_ctx::length, LOGDL, LOGL_ERROR, LOGL_INFO, MDL_CAUSE_FRM_UNIMPL, MDL_CAUSE_UFRM_INC_PARAM, MDL_CAUSE_UNSOL_UA_RESP, mdl_error(), lapd_msg_ctx::more, lapd_history::msg, msgb_free(), lapd_msg_ctx::n201, lapd_msg_ctx::p_f, PRIM_DL_EST, PRIM_DL_REL, PRIM_OP_CONFIRM, PRIM_OP_INDICATION, lapd_datalink::rem2loc, send_dl_simple(), lapd_datalink::state, lapd_datalink::tx_hist, lapd_datalink::v_ack, lapd_datalink::v_recv, and lapd_datalink::v_send.
Referenced by lapd_rx_u().
|
static |
References lapd_msg_ctx::cr, lapd_datalink::cr, lapd_msg_ctx::dl, lapd_datalink::lctx, lapd_msg_ctx::length, LOGDL, LOGL_ERROR, LOGL_INFO, MDL_CAUSE_FRM_UNIMPL, MDL_CAUSE_UFRM_INC_PARAM, mdl_error(), lapd_msg_ctx::more, msgb_free(), msgb_trim(), lapd_msg_ctx::n201, PRIM_DL_UNIT_DATA, PRIM_OP_INDICATION, lapd_datalink::rem2loc, lapd_cr_ent::resp, and send_dl_l3().
Referenced by lapd_rx_u().
|
static |
References lapd_msg_ctx::cr, lapd_datalink::cr, lapd_msg_ctx::dl, lapd_msg_ctx::format, LAPD_FORM_U, lapd_msgb_alloc(), LAPD_U_DM, lapd_datalink::lctx, lapd_msg_ctx::length, lapd_datalink::loc2rem, lapd_msg_ctx::more, lapd_cr_ent::resp, lapd_msg_ctx::s_u, and lapd_datalink::send_ph_data_req.
Referenced by lapd_rx_i(), lapd_rx_s(), lapd_rx_u_disc(), and lapd_rx_u_sabm().
|
static |
References add_mod(), lapd_cr_ent::cmd, lapd_msg_ctx::cr, lapd_datalink::cr, msgb::data, lapd_msg_ctx::dl, do_mod(), lapd_msg_ctx::format, inc_mod(), lapd_datalink::k, msgb::l3h, LAPD_F_RTS, lapd_datalink::lapd_flags, LAPD_FORM_I, lapd_is_t200_started(), lapd_msgb_alloc(), lapd_start_t200(), LAPD_STATE_TIMER_RECOV, lapd_stop_t203(), lapd_datalink::lctx, msgb::len, lapd_msg_ctx::length, llist_empty(), lapd_datalink::loc2rem, LOGDL, LOGL_INFO, lapd_msg_ctx::more, lapd_history::more, lapd_history::msg, msg_to_tx_hist(), msgb_dequeue(), msgb_free(), msgb_l3len(), msgb_put(), lapd_msg_ctx::n201, lapd_msg_ctx::n_recv, lapd_msg_ctx::n_send, lapd_msg_ctx::p_f, lapd_datalink::peer_busy, lapd_datalink::range_hist, lapd_datalink::send_buffer, lapd_datalink::send_out, lapd_datalink::send_ph_data_req, lapd_datalink::send_queue, lapd_datalink::state, lapd_datalink::tx_hist, lapd_datalink::tx_queue, lapd_datalink::v_ack, lapd_datalink::v_range, lapd_datalink::v_recv, and lapd_datalink::v_send.
Referenced by lapd_data_req(), lapd_ph_rts_ind(), lapd_rx_i(), lapd_rx_s(), and lapd_rx_u_ua().
|
static |
References lapd_msg_ctx::cr, lapd_datalink::cr, lapd_msg_ctx::dl, lapd_msg_ctx::format, LAPD_FORM_S, lapd_msgb_alloc(), LAPD_S_REJ, lapd_datalink::lctx, lapd_msg_ctx::length, lapd_datalink::loc2rem, lapd_msg_ctx::more, lapd_msg_ctx::n_recv, lapd_msg_ctx::p_f, lapd_cr_ent::resp, lapd_msg_ctx::s_u, lapd_datalink::send_ph_data_req, and lapd_datalink::v_recv.
Referenced by lapd_rx_i().
|
static |
References lapd_cr_ent::cmd, lapd_msg_ctx::cr, lapd_datalink::cr, msgb::data, lapd_msg_ctx::dl, do_mod(), lapd_msg_ctx::format, msgb::l3h, LAPD_FORM_U, lapd_msgb_alloc(), LAPD_STATE_SABM_SENT, LAPD_U_DISC, LAPD_U_SABM, LAPD_U_SABME, lapd_datalink::lctx, msgb::len, lapd_msg_ctx::length, lapd_datalink::loc2rem, lapd_msg_ctx::more, lapd_history::msg, msgb_put(), lapd_msg_ctx::p_f, lapd_datalink::range_hist, lapd_msg_ctx::s_u, lapd_datalink::send_ph_data_req, lapd_datalink::state, lapd_datalink::tx_hist, lapd_datalink::use_sabme, and lapd_datalink::v_send.
Referenced by lapd_t200_cb().
|
static |
References lapd_cr_ent::cmd, lapd_msg_ctx::cr, lapd_datalink::cr, lapd_msg_ctx::dl, lapd_msg_ctx::format, LAPD_FORM_S, lapd_msgb_alloc(), LAPD_S_RNR, lapd_datalink::lctx, lapd_msg_ctx::length, lapd_datalink::loc2rem, lapd_msg_ctx::more, lapd_msg_ctx::n_recv, lapd_msg_ctx::p_f, lapd_cr_ent::resp, lapd_msg_ctx::s_u, lapd_datalink::send_ph_data_req, and lapd_datalink::v_recv.
Referenced by lapd_rx_i(), lapd_rx_s(), lapd_t200_cb(), and lapd_t203_cb().
|
static |
References lapd_cr_ent::cmd, lapd_msg_ctx::cr, lapd_datalink::cr, lapd_msg_ctx::dl, lapd_msg_ctx::format, LAPD_FORM_S, lapd_msgb_alloc(), LAPD_S_RR, lapd_datalink::lctx, lapd_msg_ctx::length, lapd_datalink::loc2rem, lapd_msg_ctx::more, lapd_msg_ctx::n_recv, lapd_msg_ctx::p_f, lapd_cr_ent::resp, lapd_msg_ctx::s_u, lapd_datalink::send_ph_data_req, and lapd_datalink::v_recv.
Referenced by lapd_rx_i(), lapd_rx_s(), lapd_t200_cb(), and lapd_t203_cb().
|
static |
References lapd_msg_ctx::cr, lapd_datalink::cr, data, lapd_msg_ctx::dl, lapd_msg_ctx::format, msgb::l3h, LAPD_FORM_U, lapd_msgb_alloc(), LAPD_U_UA, lapd_datalink::lctx, len(), lapd_msg_ctx::length, lapd_datalink::loc2rem, lapd_msg_ctx::more, msgb_put(), lapd_cr_ent::resp, lapd_msg_ctx::s_u, and lapd_datalink::send_ph_data_req.
Referenced by lapd_rx_u_disc(), and lapd_rx_u_sabm().
int lapd_set_mode | ( | struct lapd_datalink * | dl, |
enum lapd_mode | mode | ||
) |
Set the lapdm_mode of a LAPDm entity.
References lapd_cr_ent::cmd, lapd_datalink::cr, CR_NET2USER_CMD, CR_NET2USER_RESP, CR_USER2NET_CMD, CR_USER2NET_RESP, LAPD_MODE_NETWORK, LAPD_MODE_USER, lapd_datalink::loc2rem, lapd_datalink::mode, lapd_datalink::rem2loc, and lapd_cr_ent::resp.
|
static |
References LAPD_F_RTS, lapd_datalink::lapd_flags, LAPD_T200_RTS_OFF, LAPD_T200_RTS_PENDING, LOGDL, LOGL_INFO, osmo_timer_pending(), osmo_timer_schedule(), lapd_datalink::t200, lapd_datalink::t200_rts, lapd_datalink::t200_sec, and lapd_datalink::t200_usec.
Referenced by lapd_acknowledge(), lapd_est_req(), lapd_rel_req(), lapd_res_req(), lapd_send_i(), lapd_t200_cb(), and lapd_t203_cb().
|
static |
References LOGDL, LOGL_INFO, osmo_timer_pending(), osmo_timer_schedule(), lapd_datalink::t203, lapd_datalink::t203_sec, and lapd_datalink::t203_usec.
Referenced by lapd_acknowledge(), and lapd_dl_newstate().
|
inlinestatic |
References get_value_string(), and lapd_state_names.
Referenced by lapd_dl_newstate(), lapd_recv_dlsap(), lapd_rx_i(), lapd_rx_s(), lapd_rx_u_disc(), lapd_rx_u_dm(), lapd_rx_u_sabm(), lapd_rx_u_ua(), lapd_t200_cb(), lapd_t203_cb(), and mdl_error().
|
static |
References LAPD_F_RTS, lapd_datalink::lapd_flags, LAPD_T200_RTS_OFF, LOGDL, LOGL_INFO, osmo_timer_del(), osmo_timer_pending(), lapd_datalink::t200, and lapd_datalink::t200_rts.
Referenced by lapd_acknowledge(), lapd_dl_reset(), lapd_rel_req(), lapd_rx_s(), lapd_rx_u_disc(), lapd_rx_u_dm(), lapd_rx_u_sabm(), lapd_rx_u_ua(), and lapd_susp_req().
|
static |
References LOGDL, LOGL_INFO, osmo_timer_del(), osmo_timer_pending(), and lapd_datalink::t203.
Referenced by lapd_acknowledge(), lapd_dl_newstate(), lapd_dl_reset(), lapd_send_i(), and lapd_susp_req().
|
static |
References lapd_msg_ctx::dl, lapd_dl_flush_tx(), lapd_stop_t200(), lapd_stop_t203(), lapd_datalink::lctx, msgb::list, llist_add(), LOGDL, LOGL_INFO, osmo_prim_hdr::msg, msgb_free(), osmo_dlsap_prim::oph, PRIM_DL_SUSP, PRIM_OP_CONFIRM, lapd_datalink::send_buffer, send_dl_simple(), and lapd_datalink::send_queue.
|
static |
References lapd_cr_ent::cmd, lapd_msg_ctx::cr, lapd_datalink::cr, msgb::data, data, lapd_msg_ctx::dl, do_mod(), lapd_msg_ctx::format, msgb::l3h, lapd_dl_flush_send(), lapd_dl_flush_tx(), lapd_dl_newstate(), LAPD_FORM_I, lapd_msgb_alloc(), lapd_reestablish(), lapd_send_resend(), lapd_send_rnr(), lapd_send_rr(), lapd_start_t200(), LAPD_STATE_DISC_SENT, LAPD_STATE_IDLE, LAPD_STATE_MF_EST, lapd_state_name(), LAPD_STATE_SABM_SENT, LAPD_STATE_TIMER_RECOV, lapd_datalink::lctx, msgb::len, lapd_msg_ctx::length, lapd_datalink::loc2rem, LOGDL, LOGL_INFO, LOGL_NOTICE, MDL_CAUSE_T200_EXPIRED, mdl_error(), lapd_msg_ctx::more, lapd_history::more, lapd_history::msg, msgb_put(), lapd_datalink::n200, lapd_datalink::n200_est_rel, lapd_msg_ctx::n_recv, lapd_msg_ctx::n_send, lapd_datalink::own_busy, lapd_msg_ctx::p_f, PRIM_DL_REL, PRIM_OP_CONFIRM, PRIM_OP_INDICATION, lapd_datalink::range_hist, lapd_datalink::reestablish, lapd_datalink::retrans_ctr, send_dl_simple(), lapd_datalink::send_ph_data_req, lapd_datalink::seq_err_cond, lapd_datalink::state, sub_mod(), lapd_datalink::tx_hist, lapd_datalink::v_range, lapd_datalink::v_recv, and lapd_datalink::v_send.
Referenced by lapd_dl_init2(), and lapd_t200_timeout().
int lapd_t200_timeout | ( | struct lapd_datalink * | dl | ) |
Handle timeout condition of T200 in RTS mode.
The caller (LAPDm code) implements the T200 timer and must detect timeout condition. The function gets called by LAPDm code when it detects a timeout of T200.
[in] | dl | caller-allocated datalink structure |
References LAPD_F_RTS, lapd_datalink::lapd_flags, lapd_t200_cb(), LAPD_T200_RTS_OFF, LAPD_T200_RTS_RUNNING, OSMO_ASSERT, and lapd_datalink::t200_rts.
|
static |
References data, lapd_dl_newstate(), lapd_send_rnr(), lapd_send_rr(), lapd_start_t200(), LAPD_STATE_MF_EST, lapd_state_name(), LAPD_STATE_TIMER_RECOV, lapd_datalink::lctx, LOGDL, LOGL_ERROR, LOGL_INFO, lapd_datalink::own_busy, lapd_datalink::retrans_ctr, and lapd_datalink::state.
Referenced by lapd_dl_init2().
|
static |
References lapd_cr_ent::cmd, lapd_msg_ctx::cr, lapd_datalink::cr, lapd_msg_ctx::dl, lapd_msg_ctx::format, LAPD_FORM_U, LAPD_U_UI, lapd_datalink::lctx, msgb::len, lapd_msg_ctx::length, lapd_datalink::loc2rem, lapd_msg_ctx::more, osmo_prim_hdr::msg, osmo_dlsap_prim::oph, lapd_msg_ctx::s_u, and lapd_datalink::send_ph_data_req.
|
static |
References mdl_error_ind_param::cause, lapd_msg_ctx::dl, osmo_dlsap_prim::error_ind, lapd_state_name(), lapd_datalink::lctx, LOGDL, LOGL_NOTICE, osmo_dlsap_prim::oph, osmo_prim_init(), PRIM_MDL_ERROR, PRIM_OP_INDICATION, lapd_datalink::send_dlsap, lapd_datalink::state, and osmo_dlsap_prim::u.
Referenced by lapd_rx_i(), lapd_rx_s(), lapd_rx_u(), lapd_rx_u_disc(), lapd_rx_u_dm(), lapd_rx_u_frmr(), lapd_rx_u_sabm(), lapd_rx_u_ua(), lapd_rx_u_ui(), and lapd_t200_cb().
|
static |
References msgb::data, msgb::l3h, lapd_msgb_alloc(), msgb::len, lapd_msg_ctx::length, lapd_msg_ctx::more, lapd_history::more, lapd_history::msg, and msgb_put().
Referenced by lapd_send_i(), and msg_to_tx_hist0().
|
static |
References lapd_msg_ctx::dl, msgb::len, msg_to_tx_hist(), and lapd_datalink::tx_hist.
Referenced by lapd_est_req(), lapd_rel_req(), and lapd_res_req().
|
static |
References lapd_msg_ctx::dl, lapd_datalink::lctx, osmo_dlsap_prim::oph, osmo_prim_init(), and lapd_datalink::send_dlsap.
Referenced by lapd_rx_i(), lapd_rx_u_sabm(), lapd_rx_u_ui(), and send_dl_simple().
|
inlinestatic |
References send_dl_l3().
Referenced by lapd_rel_req(), lapd_rel_req_idle(), lapd_rx_u_disc(), lapd_rx_u_dm(), lapd_rx_u_sabm(), lapd_rx_u_ua(), lapd_susp_req(), and lapd_t200_cb().
|
inlinestatic |
References x.
Referenced by lapd_acknowledge(), and lapd_t200_cb().
|
static |
Referenced by lapd_recv_dlsap().
const struct value_string lapd_state_names[] |
Referenced by lapd_state_name().
void* tall_lapd_ctx = NULL |
Referenced by lapd_dl_init2(), and lapd_dl_set_name().