Harald Welte | 9ba5005 | 2010-03-14 15:45:01 +0800 | [diff] [blame^] | 1 | #ifndef _GPRS_NS_H |
| 2 | #define _GPRS_NS_H |
| 3 | |
| 4 | struct gprs_ns_hdr { |
| 5 | u_int8_t pdu_type; |
| 6 | u_int8_t data[0]; |
| 7 | } __attribute__((packed)); |
| 8 | |
| 9 | /* TS 08.16, Section 10.3.7, Table 14 */ |
| 10 | enum ns_pdu_type { |
| 11 | NS_PDUT_UNITDATA = 0x00, |
| 12 | NS_PDUT_RESET = 0x02, |
| 13 | NS_PDUT_RESET_ACK = 0x03, |
| 14 | NS_PDUT_BLOCK = 0x04, |
| 15 | NS_PDUT_BLOCK_ACK = 0x05, |
| 16 | NS_PDUT_UNBLOCK = 0x06, |
| 17 | NS_PDUT_UNBLOCK_ACK = 0x07, |
| 18 | NS_PDUT_STATUS = 0x08, |
| 19 | NS_PDUT_ALIVE = 0x0a, |
| 20 | NS_PDUT_ALIVE_ACK = 0x0b, |
| 21 | }; |
| 22 | |
| 23 | /* TS 08.16, Section 10.3, Table 12 */ |
| 24 | enum ns_ctrl_ie { |
| 25 | NS_IE_CAUSE = 0x00, |
| 26 | NS_IE_VCI = 0x01, |
| 27 | NS_IE_PDU = 0x02, |
| 28 | NS_IE_BVCI = 0x03, |
| 29 | NS_IE_NSEI = 0x04, |
| 30 | }; |
| 31 | |
| 32 | /* TS 08.16, Section 10.3.2, Table 13 */ |
| 33 | enum ns_cause { |
| 34 | NS_CAUSE_TRANSIT_FAIL = 0x00, |
| 35 | NS_CAUSE_OM_INTERVENTION = 0x01, |
| 36 | NS_CAUSE_EQUIP_FAIL = 0x02, |
| 37 | NS_CAUSE_NSVC_BLOCKED = 0x03, |
| 38 | NS_CAUSE_NSVC_UNKNOWN = 0x04, |
| 39 | NS_CAUSE_BVCI_UNKNOWN = 0x05, |
| 40 | NS_CAUSE_SEM_INCORR_PDU = 0x08, |
| 41 | NS_CAUSE_PDU_INCOMP_PSTATE = 0x0a, |
| 42 | NS_CAUSE_PROTO_ERR_UNSPEC = 0x0b, |
| 43 | NS_CAUSE_INVAL_ESSENT_IE = 0x0c, |
| 44 | NS_CAUSE_MISSING_ESSENT_IE = 0x0d, |
| 45 | }; |
| 46 | |
| 47 | /* a layer 1 entity transporting NS frames */ |
| 48 | struct gprs_ns_link { |
| 49 | union { |
| 50 | struct { |
| 51 | int fd; |
| 52 | } ip; |
| 53 | }; |
| 54 | }; |
| 55 | |
| 56 | |
| 57 | int gprs_ns_rcvmsg(struct msgb *msg); |
| 58 | |
| 59 | int gprs_ns_sendmsg(struct gprs_ns_link *link, u_int16_t bvci, |
| 60 | struct msgb *msg); |
| 61 | #endif |