lapd_core.c File Reference
LAPD implementation common part
`#include <stdio.h>`
`#include <stdint.h>`
`#include <string.h>`
`#include <errno.h>`
`#include <osmocom/core/logging.h>`
`#include <osmocom/core/timer.h>`
`#include <osmocom/core/msgb.h>`
`#include <osmocom/core/utils.h>`
`#include <osmocom/core/talloc.h>`
`#include <osmocom/gsm/lapd_core.h>`
`#include <osmocom/gsm/rsl.h>`

## Data Structures

struct | l2downstate

## Macros

#define | LAPD_U_SABM 0x7
#define | LAPD_U_SABME 0xf
#define | LAPD_U_DM 0x3
#define | LAPD_U_UI 0x0
#define | LAPD_U_DISC 0x8
#define | LAPD_U_UA 0xC
#define | LAPD_U_FRMR 0x11
#define | LAPD_S_RR 0x0
#define | LAPD_S_RNR 0x1
#define | LAPD_S_REJ 0x2
#define | CR_USER2NET_CMD 0
#define | CR_USER2NET_RESP 1
#define | CR_NET2USER_CMD 1
#define | CR_NET2USER_RESP 0
#define | LAPD_HEADROOM 56
#define | SBIT(a) (1 << a)
#define | ALL_STATES 0xffffffff
#define | L2DOWNSLLEN (sizeof(l2downstatelist) / sizeof(struct l2downstate))

## Functions

static void | lapd_t200_cb (void *data)
static void | lapd_t203_cb (void *data)
static int | lapd_send_i (struct lapd_msg_ctx *lctx, int line)
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 (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 void | lapd_stop_t203 (struct lapd_datalink *dl)
static void | lapd_dl_newstate (struct lapd_datalink *dl, uint32_t state)
void | lapd_dl_init (struct lapd_datalink *dl, uint8_t k, uint8_t v_range, int maxf)
void | lapd_dl_reset (struct lapd_datalink *dl)
void | lapd_dl_exit (struct lapd_datalink *dl)
int | lapd_set_mode (struct lapd_datalink *dl, enum lapd_mode mode)
| Set the lapdm_mode of a LAPDm entity. More...
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 void | lapd_acknowledge (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)
int | lapd_ph_data_ind (struct msgb *msg, struct lapd_msg_ctx *lctx)
static int | lapd_udata_req (struct osmo_dlsap_prim *dp, struct lapd_msg_ctx *lctx)
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)
int | lapd_recv_dlsap (struct osmo_dlsap_prim *dp, struct lapd_msg_ctx *lctx)

## Variables

const struct value_string | lapd_state_names []
static void * | tall_lapd_ctx = NULL
static const struct l2downstate | l2downstatelist []

## Detailed Description

LAPD core implementation