libosmogsm
0.6.3
Osmocom GSM library
Main Page
Modules
Data Structures
Files
File List
Globals
lapd_core.h
Go to the documentation of this file.
1
#ifndef _OSMOCOM_LAPD_H
2
#define _OSMOCOM_LAPD_H
3
4
#include <stdint.h>
5
6
#include <osmocom/core/timer.h>
7
#include <osmocom/core/msgb.h>
8
#include <osmocom/gsm/prim.h>
9
19
enum
osmo_dl_prim
{
20
PRIM_DL_UNIT_DATA
,
21
PRIM_DL_DATA
,
22
PRIM_DL_EST
,
23
PRIM_DL_REL
,
24
PRIM_DL_SUSP
,
25
PRIM_DL_RES
,
26
PRIM_DL_RECON
,
27
PRIM_MDL_ERROR
,
28
};
29
30
/* Uses the same values as RLL, so no conversion for GSM is required. */
31
#define MDL_CAUSE_T200_EXPIRED 0x01
32
#define MDL_CAUSE_REEST_REQ 0x02
33
#define MDL_CAUSE_UNSOL_UA_RESP 0x03
34
#define MDL_CAUSE_UNSOL_DM_RESP 0x04
35
#define MDL_CAUSE_UNSOL_DM_RESP_MF 0x05
36
#define MDL_CAUSE_UNSOL_SPRV_RESP 0x06
37
#define MDL_CAUSE_SEQ_ERR 0x07
38
#define MDL_CAUSE_UFRM_INC_PARAM 0x08
39
#define MDL_CAUSE_SFRM_INC_PARAM 0x09
40
#define MDL_CAUSE_IFRM_INC_MBITS 0x0a
41
#define MDL_CAUSE_IFRM_INC_LEN 0x0b
42
#define MDL_CAUSE_FRM_UNIMPL 0x0c
43
#define MDL_CAUSE_SABM_MF 0x0d
44
#define MDL_CAUSE_SABM_INFO_NOTALL 0x0e
45
#define MDL_CAUSE_FRMR 0x0f
46
48
struct
mdl_error_ind_param
{
49
uint8_t
cause
;
50
};
51
53
struct
dl_rel_req_param
{
54
uint8_t
mode
;
55
};
56
58
struct
osmo_dlsap_prim
{
59
struct
osmo_prim_hdr
oph
;
60
union
{
61
struct
mdl_error_ind_param
error_ind;
62
struct
dl_rel_req_param
rel_req;
63
}
u
;
64
};
65
67
enum
lapd_mode
{
68
LAPD_MODE_USER
,
69
LAPD_MODE_NETWORK
,
70
};
71
73
enum
lapd_state
{
74
LAPD_STATE_NULL = 0,
75
LAPD_STATE_TEI_UNASS,
76
LAPD_STATE_ASS_TEI_WAIT,
77
LAPD_STATE_EST_TEI_WAIT,
78
LAPD_STATE_IDLE,
79
LAPD_STATE_SABM_SENT,
80
LAPD_STATE_DISC_SENT,
81
LAPD_STATE_MF_EST,
82
LAPD_STATE_TIMER_RECOV,
83
};
84
86
enum
lapd_format
{
87
LAPD_FORM_UKN = 0,
88
LAPD_FORM_I,
89
LAPD_FORM_S,
90
LAPD_FORM_U,
91
};
92
94
struct
lapd_msg_ctx
{
95
struct
lapd_datalink
*dl;
96
int
n201;
97
/* address */
98
uint8_t cr;
99
uint8_t sapi;
100
uint8_t tei;
101
uint8_t lpd;
102
/* control */
103
uint8_t format;
104
uint8_t p_f;
/* poll / final bit */
105
uint8_t n_send;
106
uint8_t n_recv;
107
uint8_t s_u;
/* S or repectivly U function bits */
108
/* length */
109
int
length
;
110
uint8_t more;
111
};
112
113
struct
lapd_cr_ent
{
114
uint8_t cmd;
115
uint8_t resp;
116
};
117
118
struct
lapd_history
{
119
struct
msgb *msg;
/* message to be sent / NULL, if histoy is empty */
120
int
more;
/* if message is fragmented */
121
};
122
124
struct
lapd_datalink
{
125
int (*send_dlsap)(
struct
osmo_dlsap_prim
*dp,
126
struct
lapd_msg_ctx
*
lctx
);
127
int (*send_ph_data_req)(
struct
lapd_msg_ctx
*
lctx
,
struct
msgb *msg);
128
struct
{
130
struct
lapd_cr_ent
loc2rem
;
131
struct
lapd_cr_ent
rem2loc;
132
} cr;
133
enum
lapd_mode
mode
;
134
int
use_sabme
;
135
int
reestablish
;
136
int
n200,
n200_est_rel
;
137
struct
lapd_msg_ctx
lctx
;
138
int
maxf
;
139
uint8_t
k
;
140
uint8_t
v_range
;
141
uint8_t
v_send
;
142
uint8_t
v_ack
;
143
uint8_t
v_recv
;
144
uint32_t
state
;
145
int
seq_err_cond
;
146
uint8_t
own_busy
;
147
uint8_t
peer_busy
;
148
int
t200_sec,
t200_usec
;
149
int
t203_sec,
t203_usec
;
150
struct
osmo_timer_list
t200
;
151
struct
osmo_timer_list
t203
;
152
uint8_t
retrans_ctr
;
153
struct
llist_head
tx_queue
;
154
struct
llist_head
send_queue
;
155
struct
msgb *
send_buffer
;
156
int
send_out
;
157
struct
lapd_history
*
tx_hist
;
158
uint8_t
range_hist
;
159
struct
msgb *
rcv_buffer
;
160
struct
msgb *
cont_res
;
161
};
162
163
void
lapd_dl_init(
struct
lapd_datalink
*dl, uint8_t k, uint8_t v_range,
164
int
maxf);
165
void
lapd_dl_exit(
struct
lapd_datalink
*dl);
166
void
lapd_dl_reset(
struct
lapd_datalink
*dl);
167
int
lapd_set_mode
(
struct
lapd_datalink
*dl,
enum
lapd_mode
mode);
168
int
lapd_ph_data_ind(
struct
msgb *msg,
struct
lapd_msg_ctx
*lctx);
169
int
lapd_recv_dlsap(
struct
osmo_dlsap_prim
*dp,
struct
lapd_msg_ctx
*lctx);
170
173
#endif
/* _OSMOCOM_LAPD_H */
include
osmocom
gsm
lapd_core.h
Generated on Fri Aug 23 2013 20:51:43 for libosmogsm by
1.8.1.2