blob: f98f68ddd87d11ca07c8a7aafd07b5677afe1f9a [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>
Alexander Couzens6a161492020-07-12 13:45:50 +02009#include <arpa/inet.h>
Daniel Willmann4692a1c2020-09-10 16:42:00 +020010#include <osmocom/core/utils.h>
Harald Welte8648e492012-06-17 13:12:51 +080011
12/*! \addtogroup libgb
13 * @{
Neels Hofmeyr17518fe2017-06-20 04:35:06 +020014 * \file gprs_ns.h */
Harald Welte8648e492012-06-17 13:12:51 +080015
Neels Hofmeyr87e45502017-06-20 00:17:59 +020016/*! Common header of GPRS NS */
Harald Welte8648e492012-06-17 13:12:51 +080017struct gprs_ns_hdr {
18 uint8_t pdu_type; /*!< NS PDU type */
19 uint8_t data[0]; /*!< variable-length payload */
20} __attribute__((packed));
21
Harald Welte17a642d2018-07-01 19:09:52 +020022
23/*! Section 10.3.2c List of IP4 Elements */
24struct gprs_ns_ie_ip4_elem {
25 uint32_t ip_addr;
26 uint16_t udp_port;
27 uint8_t sig_weight;
28 uint8_t data_weight;
29} __attribute__ ((packed));
30
Alexander Couzens6a161492020-07-12 13:45:50 +020031/*! Section 10.3.2d List of IP6 Elements */
32struct gprs_ns_ie_ip6_elem {
33 struct in6_addr ip_addr;
34 uint16_t udp_port;
35 uint8_t sig_weight;
36 uint8_t data_weight;
37} __attribute__ ((packed));
38
Max584f4b62017-05-04 11:59:52 +020039extern const struct value_string gprs_ns_pdu_strings[];
40
Neels Hofmeyr87e45502017-06-20 00:17:59 +020041/*! NS PDU Type (TS 08.16, Section 10.3.7, Table 14) */
Harald Welte8648e492012-06-17 13:12:51 +080042enum ns_pdu_type {
43 NS_PDUT_UNITDATA = 0x00,
44 NS_PDUT_RESET = 0x02,
45 NS_PDUT_RESET_ACK = 0x03,
46 NS_PDUT_BLOCK = 0x04,
47 NS_PDUT_BLOCK_ACK = 0x05,
48 NS_PDUT_UNBLOCK = 0x06,
49 NS_PDUT_UNBLOCK_ACK = 0x07,
50 NS_PDUT_STATUS = 0x08,
51 NS_PDUT_ALIVE = 0x0a,
52 NS_PDUT_ALIVE_ACK = 0x0b,
53 /* TS 48.016 Section 10.3.7, Table 10.3.7.1 */
54 SNS_PDUT_ACK = 0x0c,
55 SNS_PDUT_ADD = 0x0d,
56 SNS_PDUT_CHANGE_WEIGHT = 0x0e,
57 SNS_PDUT_CONFIG = 0x0f,
58 SNS_PDUT_CONFIG_ACK = 0x10,
59 SNS_PDUT_DELETE = 0x11,
60 SNS_PDUT_SIZE = 0x12,
61 SNS_PDUT_SIZE_ACK = 0x13,
62};
63
Neels Hofmeyr87e45502017-06-20 00:17:59 +020064/*! NS Control IE (TS 08.16, Section 10.3, Table 12) */
Harald Welte8648e492012-06-17 13:12:51 +080065enum ns_ctrl_ie {
66 NS_IE_CAUSE = 0x00,
67 NS_IE_VCI = 0x01,
68 NS_IE_PDU = 0x02,
69 NS_IE_BVCI = 0x03,
70 NS_IE_NSEI = 0x04,
71 /* TS 48.016 Section 10.3, Table 10.3.1 */
72 NS_IE_IPv4_LIST = 0x05,
73 NS_IE_IPv6_LIST = 0x06,
74 NS_IE_MAX_NR_NSVC = 0x07,
75 NS_IE_IPv4_EP_NR = 0x08,
76 NS_IE_IPv6_EP_NR = 0x09,
77 NS_IE_RESET_FLAG = 0x0a,
78 NS_IE_IP_ADDR = 0x0b,
Harald Welte047f3872018-07-01 21:04:45 +020079 NS_IE_TRANS_ID = 0xff, /* osmocom. Spec has this IE but without IEI! */
Harald Welte8648e492012-06-17 13:12:51 +080080};
81
Neels Hofmeyr87e45502017-06-20 00:17:59 +020082/*! NS Cause (TS 08.16, Section 10.3.2, Table 13) */
Harald Welte8648e492012-06-17 13:12:51 +080083enum ns_cause {
84 NS_CAUSE_TRANSIT_FAIL = 0x00,
85 NS_CAUSE_OM_INTERVENTION = 0x01,
86 NS_CAUSE_EQUIP_FAIL = 0x02,
87 NS_CAUSE_NSVC_BLOCKED = 0x03,
88 NS_CAUSE_NSVC_UNKNOWN = 0x04,
89 NS_CAUSE_BVCI_UNKNOWN = 0x05,
90 NS_CAUSE_SEM_INCORR_PDU = 0x08,
91 NS_CAUSE_PDU_INCOMP_PSTATE = 0x0a,
92 NS_CAUSE_PROTO_ERR_UNSPEC = 0x0b,
93 NS_CAUSE_INVAL_ESSENT_IE = 0x0c,
94 NS_CAUSE_MISSING_ESSENT_IE = 0x0d,
95 /* TS 48.016 Section 10.3.2, Table 10.3.2.1 */
96 NS_CAUSE_INVAL_NR_IPv4_EP = 0x0e,
97 NS_CAUSE_INVAL_NR_IPv6_EP = 0x0f,
98 NS_CAUSE_INVAL_NR_NS_VC = 0x10,
99 NS_CAUSE_INVAL_WEIGH = 0x11,
100 NS_CAUSE_UNKN_IP_EP = 0x12,
101 NS_CAUSE_UNKN_IP_ADDR = 0x13,
102 NS_CAUSE_UNKN_IP_TEST_FAILED = 0x14,
103};