blob: fb980d10487abd9393172936f6be0f4f7f5bc674 [file] [log] [blame]
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +02001#ifndef OPENBSC_LAPD_H
2#define OPENBSC_LAPD_H
3
4#include <stdint.h>
5
6#include <osmocom/core/linuxlist.h>
7
8typedef enum {
9 LAPD_MPH_NONE = 0,
10
11 LAPD_MPH_ACTIVATE_IND,
12 LAPD_MPH_DEACTIVATE_IND,
13
14 LAPD_DL_DATA_IND,
15 LAPD_DL_UNITDATA_IND,
16
17} lapd_mph_type;
18
19struct lapd_instance {
20 struct llist_head list; /* list of LAPD instances */
21 int network_side;
22
23 void (*transmit_cb)(uint8_t *data, int len, void *cbdata);
24 void *cbdata;
25
26 struct llist_head tei_list; /* list of TEI in this LAPD instance */
27};
28
29extern uint8_t *lapd_receive(struct lapd_instance *li, uint8_t *data, unsigned int len,
30 int *ilen, lapd_mph_type *prim);
31
32extern void lapd_transmit(struct lapd_instance *li, uint8_t tei, uint8_t sapi,
33 uint8_t *data, unsigned int len);
34
35struct lapd_instance *lapd_instance_alloc(int network_side,
36 void (*tx_cb)(uint8_t *data, int len,
37 void *cbdata), void *cbdata);
38
39
40/* Start a (user-side) SAP for the specified TEI/SAPI on the LAPD instance */
41int lapd_sap_start(struct lapd_instance *li, uint8_t tei, uint8_t sapi);
42
43/* Stop a (user-side) SAP for the specified TEI/SAPI on the LAPD instance */
44int lapd_sap_stop(struct lapd_instance *li, uint8_t tei, uint8_t sapi);
45
46#endif /* OPENBSC_LAPD_H */