aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include/openbsc/gprs_ns.h
blob: 9ea4d675292a70226e1699b9818ea637dbc4b840 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef _GPRS_NS_H
#define _GPRS_NS_H

struct gprs_ns_hdr {
	u_int8_t pdu_type;
	u_int8_t data[0];
} __attribute__((packed));

/* TS 08.16, Section 10.3.7, Table 14 */
enum ns_pdu_type {
	NS_PDUT_UNITDATA	= 0x00,
	NS_PDUT_RESET		= 0x02,
	NS_PDUT_RESET_ACK	= 0x03,
	NS_PDUT_BLOCK		= 0x04,
	NS_PDUT_BLOCK_ACK	= 0x05,
	NS_PDUT_UNBLOCK		= 0x06,
	NS_PDUT_UNBLOCK_ACK	= 0x07,
	NS_PDUT_STATUS		= 0x08,
	NS_PDUT_ALIVE		= 0x0a,
	NS_PDUT_ALIVE_ACK	= 0x0b,
};

/* TS 08.16, Section 10.3, Table 12 */
enum ns_ctrl_ie {
	NS_IE_CAUSE		= 0x00,
	NS_IE_VCI		= 0x01,
	NS_IE_PDU		= 0x02,
	NS_IE_BVCI		= 0x03,
	NS_IE_NSEI		= 0x04,
};

/* TS 08.16, Section 10.3.2, Table 13 */
enum ns_cause {
	NS_CAUSE_TRANSIT_FAIL		= 0x00,
	NS_CAUSE_OM_INTERVENTION	= 0x01,
	NS_CAUSE_EQUIP_FAIL		= 0x02,
	NS_CAUSE_NSVC_BLOCKED		= 0x03,
	NS_CAUSE_NSVC_UNKNOWN		= 0x04,
	NS_CAUSE_BVCI_UNKNOWN		= 0x05,
	NS_CAUSE_SEM_INCORR_PDU		= 0x08,
	NS_CAUSE_PDU_INCOMP_PSTATE	= 0x0a,
	NS_CAUSE_PROTO_ERR_UNSPEC	= 0x0b,
	NS_CAUSE_INVAL_ESSENT_IE	= 0x0c,
	NS_CAUSE_MISSING_ESSENT_IE	= 0x0d,
};

/* a layer 1 entity transporting NS frames */
struct gprs_ns_link {
	union {
		struct {
			int fd;
		} ip;
	};
};


int gprs_ns_rcvmsg(struct msgb *msg, struct sockaddr_in *saddr);

int gprs_ns_sendmsg(struct gprs_ns_link *link, u_int16_t bvci,
		    struct msgb *msg);
#endif