blob: ee2444daa13893e4ea2e97b4999d4bfd452d6c01 [file] [log] [blame]
Harald Weltef1fd0162017-07-22 20:34:05 +02001module NS_Types {
2 import from General_Types all;
3 import from Osmocom_Types all;
4 import from GSM_Types all;
5 import from BSSGP_Types all;
6
7 /* TS 48.016 10.3.7 */
8 type enumerated NsPduType {
9 NS_PDUT_NS_UNITDATA ('00000000'B),
10 NS_PDUT_NS_RESET ('00000010'B),
11 NS_PDUT_NS_RESET_ACK ('00000011'B),
12 NS_PDUT_NS_BLOCK ('00000100'B),
13 NS_PDUT_NS_BLOCK_ACK ('00000101'B),
14 NS_PDUT_NS_UNBLOCK ('00000110'B),
15 NS_PDUT_NS_UNBLOCK_ACK ('00000111'B),
16 NS_PDUT_NS_STATUS ('00001000'B),
17 NS_PDUT_NS_ALIVE ('00001010'B),
18 NS_PDUT_NS_ALIVE_ACK ('00001011'B)
19 /* FIXME: SNS */
20 } with { variant "FIELDLENGTH(8)" };
21
22 /* TS 48.016 10.3 */
23 type enumerated NsIEI {
24 NS_IEI_CAUSE ('00000000'B),
25 NS_IEI_NSVCI ('00000001'B),
26 NS_IEI_NS_PDU ('00000010'B),
27 NS_IEI_BVCI ('00000011'B),
28 NS_IEI_NSEI ('00000100'B),
29 NS_IEI_LIST_IPv4 ('00000101'B),
30 NS_IEI_LIST_IPv6 ('00000110'B),
31 NS_IEI_MAX_NUM_NSVC ('00000111'B),
32 NS_IEI_NUM_IPv4_EP ('00001000'B),
33 NS_IEI_NUM_IPv6_EP ('00001001'B),
34 NS_IEI_RESET_FLAG ('00001010'B),
35 NS_IEI_IP_ADDRESS ('00001011'B)
36 } with { variant "FIELDLENGTH(8)" };
37
38 /* TS 48.016 10.3.2 */
39 type enumerated NsCause {
40 NS_CAUSE_TRANSIT_NETWORK_FAILURE ('00000000'B),
41 NS_CAUSE_OM_INTERVENTION ('00000001'B),
42 NS_CAUSE_EQUIPMENT_FAILURE ('00000010'B),
43 NS_CAUSE_NSVC_BLOCKED ('00000011'B),
44 NS_CAUSE_NSVC_UNKNOWN ('00000100'B),
45 NS_CAUSE_BVCI_UNKNOWN_AT_NSE ('00000101'B),
46 NS_CAUSE_SEMANTICALLY_INCORRECT_PDU ('00001000'B),
47 NS_CAUSE_PDU_NOT_COMPATIBLE_WITH_PROTOCOL_STATE ('00001010'B),
48 NS_CAUSE_PROTOCOL_ERROR_UNSPEIFIED ('00001011'B),
49 NS_CAUSE_INVALID_ESSENTIAL_IE ('00001100'B),
50 NS_CAUSE_MISSING_ESSENTIAL_IE ('00001101'B),
51 NS_CAUSE_INVALID_NR_OF_IPv4_ENDPOINTS ('00001110'B),
52 NS_CAUSE_INVALID_NR_OF_IPv6_ENDPOINTS ('00001111'B),
53 NS_CAUSE_INVALID_NR_OF_NSVCS ('00010000'B),
54 NS_CAUSE_INVALID_WEIGHTS ('00010001'B),
55 NS_CAUSE_UNKNOWN_IP_ENDPOINT ('00010010'B),
56 NS_CAUSE_UNKNOWN_IP_ADDRESS ('00010011'B),
57 NS_CAUSE_IP_TEST_FAILEDA ('00010100'B)
58 } with { variant "FIELDLENGTH(8)" };
59
60 type uint16_t Nsvci;
61 type uint16_t Nsei;
62
63 type union NsIeUnion {
64 BssgpBvci bvci, /* 10.3.1 */
65 NsCause cause, /* 10.3.2 */
66 uint16_t max_num_nsvc, /* 10.3.2e */
67 uint16_t num_ipv4_ep, /* 10.3.2f */
68 uint16_t num_ipv6_ep, /* 10.3.2g */
69 Nsvci nsvci, /* 10.3.5 */
70 Nsei nsei, /* 10.3.6 */
71 octetstring other
72 };
73
74 type record NsTLV {
75 NsIEI iei,
76 uint16_t len,
77 NsIeUnion u
78 } with {
79 variant (u) "CROSSTAG(
80 bvci, iei = NS_IEI_BVCI;
81 cause, iei = NS_IEI_CAUSE;
82 max_num_nsvc, iei = NS_IEI_MAX_NUM_NSVC;
83 num_ipv4_ep, iei = NS_IEI_NUM_IPv4_EP;
84 num_ipv6_ep, iei = NS_IEI_NUM_IPv6_EP;
85 nsvci, iei = NS_IEI_NSVCI;
86 nsei, iei = NS_IEI_NSEI;
87 other, OTHERWISE)"
88 variant (len) "LENGTHTO(u)"
89 };
90
91 type record of NsTLV NsTLVs;
92
93 type record NsPdu {
94 NsPduType pdu_type,
95 NsTLVs tlvs optional
96 } with { variant "" };
97
98 external function enc_NsPdu(in NsPdu pdu) return octetstring
99 with { extension "prototype(convert) encode(RAW)" };
100 external function dec_NsPdu(in octetstring stream) return NsPdu
101 with { extension "prototype(convert) decode(RAW)" };
102
103} with { encode "RAW" };