libosmogsm
0.9.3
Osmocom GSM library
Main Page
Modules
Data Structures
Files
File List
Globals
lapdm.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <osmocom/gsm/l1sap.h>
4
#include <
osmocom/gsm/lapd_core.h
>
5
13
enum
lapdm_mode
{
14
LAPDM_MODE_MS
,
15
LAPDM_MODE_BTS
,
16
};
17
18
struct
lapdm_entity
;
19
21
struct
lapdm_msg_ctx
{
22
struct
lapdm_datalink
*dl;
23
int
lapdm_fmt;
24
uint8_t
chan_nr
;
25
uint8_t
link_id
;
26
uint8_t ta_ind;
/* TA indicated by network */
27
uint8_t tx_power_ind;
/* MS power indicated by network */
28
};
29
31
struct
lapdm_datalink
{
32
struct
lapd_datalink
dl;
/* \brief common LAPD */
33
struct
lapdm_msg_ctx
mctx
;
35
struct
lapdm_entity
*
entity
;
36
};
37
39
enum
lapdm_dl_sapi
{
40
DL_SAPI0
= 0,
41
DL_SAPI3
= 1,
42
_NR_DL_SAPI
43
};
44
45
typedef
int (*lapdm_cb_t)(
struct
msgb *msg,
struct
lapdm_entity
*le,
void
*ctx);
46
47
#define LAPDM_ENT_F_EMPTY_FRAME 0x0001
48
#define LAPDM_ENT_F_POLLING_ONLY 0x0002
49
51
struct
lapdm_entity
{
53
struct
lapdm_datalink
datalink
[_NR_DL_SAPI];
54
int
last_tx_dequeue
;
55
int
tx_pending
;
56
enum
lapdm_mode
mode
;
57
unsigned
int
flags;
58
59
void
*
l1_ctx
;
60
void
*
l3_ctx
;
62
osmo_prim_cb
l1_prim_cb
;
63
lapdm_cb_t
l3_cb
;
66
struct
lapdm_channel
*
lapdm_ch
;
67
68
uint8_t ta;
/* TA used and indicated to network */
69
uint8_t tx_power;
/* MS power used and indicated to network */
70
};
71
73
struct
lapdm_channel
{
74
struct
llist_head
list
;
75
char
*
name
;
76
struct
lapdm_entity
lapdm_acch
;
77
struct
lapdm_entity
lapdm_dcch
;
78
};
79
80
const
char
*get_rsl_name(
int
value);
81
extern
const
char
*lapdm_state_names[];
82
83
struct
lapdm_datalink
*lapdm_datalink_for_sapi(
struct
lapdm_entity
*le, uint8_t sapi);
84
85
/* initialize a LAPDm entity */
86
void
lapdm_entity_init
(
struct
lapdm_entity
*le,
enum
lapdm_mode
mode,
int
t200);
87
void
lapdm_channel_init
(
struct
lapdm_channel
*lc,
enum
lapdm_mode
mode);
88
89
/* deinitialize a LAPDm entity */
90
void
lapdm_entity_exit
(
struct
lapdm_entity
*le);
91
void
lapdm_channel_exit(
struct
lapdm_channel
*lc);
92
93
/* input into layer2 (from layer 1) */
94
int
lapdm_phsap_up
(
struct
osmo_prim_hdr *oph,
struct
lapdm_entity
*le);
95
96
/* input into layer2 (from layer 3) */
97
int
lapdm_rslms_recvmsg
(
struct
msgb *msg,
struct
lapdm_channel
*lc);
98
99
void
lapdm_channel_set_l3
(
struct
lapdm_channel
*lc, lapdm_cb_t cb,
void
*ctx);
100
void
lapdm_channel_set_l1
(
struct
lapdm_channel
*lc, osmo_prim_cb cb,
void
*ctx);
101
102
int
lapdm_entity_set_mode
(
struct
lapdm_entity
*le,
enum
lapdm_mode
mode);
103
int
lapdm_channel_set_mode
(
struct
lapdm_channel
*lc,
enum
lapdm_mode
mode);
104
105
void
lapdm_entity_reset
(
struct
lapdm_entity
*le);
106
void
lapdm_channel_reset
(
struct
lapdm_channel
*lc);
107
108
void
lapdm_entity_set_flags
(
struct
lapdm_entity
*le,
unsigned
int
flags);
109
void
lapdm_channel_set_flags
(
struct
lapdm_channel
*lc,
unsigned
int
flags);
110
111
int
lapdm_phsap_dequeue_prim
(
struct
lapdm_entity
*le,
struct
osmo_phsap_prim
*pp);
112
include
osmocom
gsm
lapdm.h
Generated on Mon Jan 18 2016 13:17:41 for libosmogsm by
1.8.1.2