10 #include <osmocom/gsm/prim.h> 17 #define LOGDL(dl, level, fmt, args...) \ 18 LOGP(DLLAPD, level, "(%s) " fmt, (dl)->name, ## args) 33 #define MDL_CAUSE_T200_EXPIRED 0x01 34 #define MDL_CAUSE_REEST_REQ 0x02 35 #define MDL_CAUSE_UNSOL_UA_RESP 0x03 36 #define MDL_CAUSE_UNSOL_DM_RESP 0x04 37 #define MDL_CAUSE_UNSOL_DM_RESP_MF 0x05 38 #define MDL_CAUSE_UNSOL_SPRV_RESP 0x06 39 #define MDL_CAUSE_SEQ_ERR 0x07 40 #define MDL_CAUSE_UFRM_INC_PARAM 0x08 41 #define MDL_CAUSE_SFRM_INC_PARAM 0x09 42 #define MDL_CAUSE_IFRM_INC_MBITS 0x0a 43 #define MDL_CAUSE_IFRM_INC_LEN 0x0b 44 #define MDL_CAUSE_FRM_UNIMPL 0x0c 45 #define MDL_CAUSE_SABM_MF 0x0d 46 #define MDL_CAUSE_SABM_INFO_NOTALL 0x0e 47 #define MDL_CAUSE_FRMR 0x0f 88 #define LAPD_F_RTS 0x0001 89 #define LAPD_F_DROP_2ND_REJ 0x0002 uint8_t v_recv
seq nr of next I frame expected to be received
Definition: lapd_core.h:157
primitive header for LAPD DL-SAP primitives
Definition: lapd_core.h:60
int t200_sec
Definition: lapd_core.h:162
int n200_est_rel
number of retranmissions
Definition: lapd_core.h:150
struct osmo_timer_list t200
T200 timer.
Definition: lapd_core.h:165
struct msgb * send_buffer
current frame transmitting
Definition: lapd_core.h:170
char * name
user-provided name
Definition: lapd_core.h:176
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.
Definition: lapd_core.c:305
DL-RESUME.
Definition: lapd_core.h:27
MDL-ERROR.
Definition: lapd_core.h:29
#define OSMO_DEPRECATED(text)
uint8_t n_recv
Definition: lapd_core.h:119
Definition: lapd_core.h:95
lapd_mode
LAPD mode/role.
Definition: lapd_core.h:69
uint8_t more
Definition: lapd_core.h:123
int t200_usec
retry timer (default 1 sec)
Definition: lapd_core.h:162
Definition: lapd_core.h:80
DL-ESTABLISH.
Definition: lapd_core.h:24
Definition: lapd_core.h:84
uint8_t lpd
Definition: lapd_core.h:114
Definition: lapd_core.h:76
struct llist_head send_queue
frames from L3
Definition: lapd_core.h:169
DL-UNIT-DATA.
Definition: lapd_core.h:22
Definition: lapd_core.h:78
int lapd_recv_dlsap(struct osmo_dlsap_prim *dp, struct lapd_msg_ctx *lctx)
Definition: lapd_core.c:2314
int lapd_t200_timeout(struct lapd_datalink *dl)
Handle timeout condition of T200 in RTS mode.
Definition: lapd_core.c:224
int lapd_ph_data_ind(struct msgb *msg, struct lapd_msg_ctx *lctx)
Definition: lapd_core.c:1772
for DL-REL.req
Definition: lapd_core.h:55
int seq_err_cond
condition of sequence error
Definition: lapd_core.h:159
struct llist_head tx_queue
frames to L1
Definition: lapd_core.h:168
struct lapd_history * tx_hist
tx history structure array
Definition: lapd_core.h:172
uint8_t own_busy
receiver busy on our side
Definition: lapd_core.h:160
uint8_t k
maximum number of unacknowledged frames
Definition: lapd_core.h:153
void lapd_dl_reset(struct lapd_datalink *dl)
Definition: lapd_core.c:380
int maxf
maximum frame size (after defragmentation)
Definition: lapd_core.h:152
DL-RECONNECT.
Definition: lapd_core.h:28
Definition: lapd_core.h:131
for MDL-ERROR.ind
Definition: lapd_core.h:50
struct lapd_cr_ent loc2rem
filled-in once we set the lapd_mode above
Definition: lapd_core.h:143
int lapd_dl_set_flags(struct lapd_datalink *dl, unsigned int flags)
Set lapd_flags to change behaviour.
Definition: lapd_core.c:403
struct mdl_error_ind_param error_ind
Definition: lapd_core.h:63
struct osmo_prim_hdr oph
generic primitive header
Definition: lapd_core.h:61
uint8_t cmd
Definition: lapd_core.h:127
struct osmo_timer_list t203
T203 timer.
Definition: lapd_core.h:166
uint8_t cr
Definition: lapd_core.h:111
uint8_t tei
Definition: lapd_core.h:113
int(* send_dlsap)(struct osmo_dlsap_prim *dp, struct lapd_msg_ctx *lctx)
Definition: lapd_core.h:138
uint8_t mode
release mode
Definition: lapd_core.h:56
Definition: lapd_core.h:93
Definition: lapd_core.h:100
struct msgb * cont_res
buffer to store content resolution data on network side, to detect multiple phones on same channel ...
Definition: lapd_core.h:175
lapd_t200_rts
LAPD T200 state in RTS mode.
Definition: lapd_core.h:92
struct lapd_datalink::@3 cr
void lapd_dl_exit(struct lapd_datalink *dl)
Definition: lapd_core.c:416
uint8_t p_f
Definition: lapd_core.h:117
uint8_t range_hist
range of history buffer 2..2^n
Definition: lapd_core.h:173
Definition: lapd_core.h:102
struct lapd_datalink * dl
Definition: lapd_core.h:108
LAPD datalink.
Definition: lapd_core.h:137
osmo_dl_prim
LAPD related primitives (L2<->L3 SAP)
Definition: lapd_core.h:21
LAPD message context.
Definition: lapd_core.h:107
DL-RLEEASE.
Definition: lapd_core.h:25
uint8_t peer_busy
receiver busy on remote side
Definition: lapd_core.h:161
Definition: lapd_core.h:77
Definition: lapd_core.h:94
Definition: lapd_core.h:126
behave like network
Definition: lapd_core.h:71
int lapd_set_mode(struct lapd_datalink *dl, enum lapd_mode mode)
Set the lapdm_mode of a LAPDm entity.
Definition: lapd_core.c:432
int n200
Definition: lapd_core.h:150
behave like user
Definition: lapd_core.h:70
void lapd_dl_init(struct lapd_datalink *dl, uint8_t k, uint8_t v_range, int maxf) OSMO_DEPRECATED("Use lapd_dl_init2() instead")
Initialize LAPD datalink instance and allocate history.
Definition: lapd_core.c:367
unsigned int lapd_flags
lapd_flags to change processing
Definition: lapd_core.h:147
int length
Definition: lapd_core.h:122
uint32_t state
LAPD state (lapd_state)
Definition: lapd_core.h:158
Definition: lapd_core.h:83
DL-DATA.
Definition: lapd_core.h:23
Definition: lapd_core.h:101
uint8_t retrans_ctr
re-transmission counter
Definition: lapd_core.h:167
Definition: lapd_core.h:103
int n201
Definition: lapd_core.h:109
int send_out
how much was sent from send_buffer
Definition: lapd_core.h:171
int t203_usec
retry timer (default 10 secs)
Definition: lapd_core.h:163
enum lapd_mode mode
current mode of link
Definition: lapd_core.h:146
uint8_t format
Definition: lapd_core.h:116
int(* send_ph_data_req)(struct lapd_msg_ctx *lctx, struct msgb *msg)
Definition: lapd_core.h:139
enum lapd_t200_rts t200_rts
state of T200 in RTS mode
Definition: lapd_core.h:164
struct msgb * msg
Definition: lapd_core.h:132
uint8_t v_ack
last frame ACKed by peer
Definition: lapd_core.h:156
uint8_t s_u
Definition: lapd_core.h:120
Definition: lapd_core.h:82
uint8_t v_send
seq nr of next I frame to be transmitted
Definition: lapd_core.h:155
int t203_sec
Definition: lapd_core.h:163
int reestablish
enable reestablish support
Definition: lapd_core.h:149
uint8_t cause
generic cause value
Definition: lapd_core.h:51
uint8_t n_send
Definition: lapd_core.h:118
int use_sabme
use SABME instead of SABM
Definition: lapd_core.h:148
struct msgb * rcv_buffer
buffer to assemble the received message
Definition: lapd_core.h:174
lapd_format
LAPD message format (I / S / U)
Definition: lapd_core.h:99
lapd_state
LAPD state (Figure B.2/Q.921)
Definition: lapd_core.h:75
struct lapd_msg_ctx lctx
LAPD context.
Definition: lapd_core.h:151
int more
Definition: lapd_core.h:133
struct dl_rel_req_param rel_req
Definition: lapd_core.h:64
union osmo_dlsap_prim::@2 u
request-specific data
uint8_t resp
Definition: lapd_core.h:128
int lapd_ph_rts_ind(struct lapd_msg_ctx *lctx)
Enqueue next LAPD frame and run pending T200.
Definition: lapd_core.c:1800
Definition: lapd_core.h:81
DL-SUSPEND.
Definition: lapd_core.h:26
int(* update_pending_frames)(struct lapd_msg_ctx *lctx)
Definition: lapd_core.h:140
void lapd_dl_set_name(struct lapd_datalink *dl, const char *name)
Definition: lapd_core.c:372
struct lapd_cr_ent rem2loc
Definition: lapd_core.h:144
Definition: lapd_core.h:79
uint8_t v_range
range of sequence numbers
Definition: lapd_core.h:154
uint8_t sapi
Definition: lapd_core.h:112