blob: 95efcb6dfcf0910c8a33333141907d9ff251d84d [file] [log] [blame]
Neels Hofmeyr17518fe2017-06-20 04:35:06 +02001/*! \file gsm_08_16.h
2 * GPRS Networks Service (NS) messages on the Gb interface.
Harald Welte8648e492012-06-17 13:12:51 +08003 * 3GPP TS 08.16 version 8.0.1 Release 1999 / ETSI TS 101 299 V8.0.1 (2002-05)
4 * 3GPP TS 48.016 version 6.5.0 Release 6 / ETSI TS 148 016 V6.5.0 (2005-11) */
5
Neels Hofmeyr17518fe2017-06-20 04:35:06 +02006#pragma once
7
Harald Welte8648e492012-06-17 13:12:51 +08008#include <stdint.h>
9
10/*! \addtogroup libgb
11 * @{
Neels Hofmeyr17518fe2017-06-20 04:35:06 +020012 * \file gprs_ns.h */
Harald Welte8648e492012-06-17 13:12:51 +080013
Neels Hofmeyr87e45502017-06-20 00:17:59 +020014/*! Common header of GPRS NS */
Harald Welte8648e492012-06-17 13:12:51 +080015struct gprs_ns_hdr {
16 uint8_t pdu_type; /*!< NS PDU type */
17 uint8_t data[0]; /*!< variable-length payload */
18} __attribute__((packed));
19
Harald Welte17a642d2018-07-01 19:09:52 +020020
21/*! Section 10.3.2c List of IP4 Elements */
22struct gprs_ns_ie_ip4_elem {
23 uint32_t ip_addr;
24 uint16_t udp_port;
25 uint8_t sig_weight;
26 uint8_t data_weight;
27} __attribute__ ((packed));
28
Max584f4b62017-05-04 11:59:52 +020029extern const struct value_string gprs_ns_pdu_strings[];
30
Neels Hofmeyr87e45502017-06-20 00:17:59 +020031/*! NS PDU Type (TS 08.16, Section 10.3.7, Table 14) */
Harald Welte8648e492012-06-17 13:12:51 +080032enum ns_pdu_type {
33 NS_PDUT_UNITDATA = 0x00,
34 NS_PDUT_RESET = 0x02,
35 NS_PDUT_RESET_ACK = 0x03,
36 NS_PDUT_BLOCK = 0x04,
37 NS_PDUT_BLOCK_ACK = 0x05,
38 NS_PDUT_UNBLOCK = 0x06,
39 NS_PDUT_UNBLOCK_ACK = 0x07,
40 NS_PDUT_STATUS = 0x08,
41 NS_PDUT_ALIVE = 0x0a,
42 NS_PDUT_ALIVE_ACK = 0x0b,
43 /* TS 48.016 Section 10.3.7, Table 10.3.7.1 */
44 SNS_PDUT_ACK = 0x0c,
45 SNS_PDUT_ADD = 0x0d,
46 SNS_PDUT_CHANGE_WEIGHT = 0x0e,
47 SNS_PDUT_CONFIG = 0x0f,
48 SNS_PDUT_CONFIG_ACK = 0x10,
49 SNS_PDUT_DELETE = 0x11,
50 SNS_PDUT_SIZE = 0x12,
51 SNS_PDUT_SIZE_ACK = 0x13,
52};
53
Neels Hofmeyr87e45502017-06-20 00:17:59 +020054/*! NS Control IE (TS 08.16, Section 10.3, Table 12) */
Harald Welte8648e492012-06-17 13:12:51 +080055enum ns_ctrl_ie {
56 NS_IE_CAUSE = 0x00,
57 NS_IE_VCI = 0x01,
58 NS_IE_PDU = 0x02,
59 NS_IE_BVCI = 0x03,
60 NS_IE_NSEI = 0x04,
61 /* TS 48.016 Section 10.3, Table 10.3.1 */
62 NS_IE_IPv4_LIST = 0x05,
63 NS_IE_IPv6_LIST = 0x06,
64 NS_IE_MAX_NR_NSVC = 0x07,
65 NS_IE_IPv4_EP_NR = 0x08,
66 NS_IE_IPv6_EP_NR = 0x09,
67 NS_IE_RESET_FLAG = 0x0a,
68 NS_IE_IP_ADDR = 0x0b,
Harald Welte047f3872018-07-01 21:04:45 +020069 NS_IE_TRANS_ID = 0xff, /* osmocom. Spec has this IE but without IEI! */
Harald Welte8648e492012-06-17 13:12:51 +080070};
71
Neels Hofmeyr87e45502017-06-20 00:17:59 +020072/*! NS Cause (TS 08.16, Section 10.3.2, Table 13) */
Harald Welte8648e492012-06-17 13:12:51 +080073enum ns_cause {
74 NS_CAUSE_TRANSIT_FAIL = 0x00,
75 NS_CAUSE_OM_INTERVENTION = 0x01,
76 NS_CAUSE_EQUIP_FAIL = 0x02,
77 NS_CAUSE_NSVC_BLOCKED = 0x03,
78 NS_CAUSE_NSVC_UNKNOWN = 0x04,
79 NS_CAUSE_BVCI_UNKNOWN = 0x05,
80 NS_CAUSE_SEM_INCORR_PDU = 0x08,
81 NS_CAUSE_PDU_INCOMP_PSTATE = 0x0a,
82 NS_CAUSE_PROTO_ERR_UNSPEC = 0x0b,
83 NS_CAUSE_INVAL_ESSENT_IE = 0x0c,
84 NS_CAUSE_MISSING_ESSENT_IE = 0x0d,
85 /* TS 48.016 Section 10.3.2, Table 10.3.2.1 */
86 NS_CAUSE_INVAL_NR_IPv4_EP = 0x0e,
87 NS_CAUSE_INVAL_NR_IPv6_EP = 0x0f,
88 NS_CAUSE_INVAL_NR_NS_VC = 0x10,
89 NS_CAUSE_INVAL_WEIGH = 0x11,
90 NS_CAUSE_UNKN_IP_EP = 0x12,
91 NS_CAUSE_UNKN_IP_ADDR = 0x13,
92 NS_CAUSE_UNKN_IP_TEST_FAILED = 0x14,
93};