summaryrefslogtreecommitdiffstats
path: root/sysinfo/GSM_SystemInformation.ttcn
blob: 74852d4339a16b953d369ecb65bec19b8b344073 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/* Encoding/Decoding routines for GSM System Information messages
 * according to 3GPP TS 44.018 Version 12.3.0 Release 12 */

/* (C) 2017 by Harald Welte <laforge@gnumonks.org> */

module GSM_SystemInformation {

	import from General_Types all;
	import from GSM_Types all;
	import from Osmocom_Types all;

	type union ArfcnOrMaio {
		uint12_t	arfcn,
		MaioHsn		maio_hsn
	} with { variant "" };

	/* 24.008 10.5.1.1 */
	type uint16_t CellIdentity;

	/* 44.018 10.5.2.1b */
	type octetstring CellChannelDescription with { variant "FIELDLENGTH(16)" };

	/* 44.018 10.5.2.3 */
	type record CellOptions {
		boolean		dn_ind,
		boolean		pwrc,
		BIT2		dtx,
		BIT4		radio_link_timeout
	} with { variant "" };

	/* 44.018 10.5.2.3a */
	type record CellOptionsSacch {
		BIT1		dtx_ext,
		boolean		pwrc,
		BIT2		dtx,
		BIT4		radio_link_timeout
	} with { variant "" };

	/* 44.018 10.5.2.4 */
	type record CellSelectionParameters {
		uint3_t		cell_resel_hyst,
		uint5_t		ms_txpwr_max_cch,
		boolean		acs,
		boolean		neci,
		uint6_t		rxlev_access_min
	} with { variant "" };

	/* 44.018 10.5.2.11 */
	type record ControlChannelDescription {
		boolean		mscrr,
		boolean		att,
		uint3_t		bs_ag_blks_res,
		uint3_t		ccch_conf,
		boolean		si22ind,
		uint2_t		cbq3,
		BIT2		spare,
		uint3_t		bs_pa_mfrms,
		uint8_t		t3212
	} with { variant "" };

	template ControlChannelDescription t_ControlChannelDescription := { ?, ?, ?, ?, ?, ?, '00'B, ?, ? };

	/* 44.018 10.5.2.21 */
	type record MobileAllocationT {
		OCT1		iei,
		uint8_t		len,
		bitstring	ma
	} with { variant "" };

	/* 44.018 10.5.2.22 */
	type octetstring NeighbourCellDescription with { variant "FIELDLENGTH(16)" };

	/* 44.018 10.5.2.22a */
	type octetstring NeighbourCellDescription2 with { variant "FIELDLENGTH(16)" };

	type bitstring AccessControlClass with { variant "FIELDLENGTH(16), BYTEORDER(last)" };

	/* 44.018 10.5.2.29 */
	type record RachControlParameters {
		BIT2		max_retrans,
		BIT4		tx_integer,
		boolean		cell_barr_access,
		boolean		re,
		AccessControlClass ac
	} with { variant (ac) "FIELDLENGTH(16)" };

	/* 44.018 10.5.2.32 */
	type RestOctets Si1RestOctets with { variant "FIELDLENGTH(1)" };
	type RestOctets Si3RestOctets with { variant "FIELDLENGTH(4)" };

	/* 44.018 9.1.31 */
	type record SystemInformationType1 {
		CellChannelDescription	cell_chan_desc,
		RachControlParameters	rach_control,
		Si1RestOctets		rest_octets
	} with { variant "" };

	/* 44.018 9.1.32 */
	type record SystemInformationType2 {
		NeighbourCellDescription bcch_freq_list,
		BIT8			ncc_permitted,
		RachControlParameters	rach_control
	} with { variant "" };

	/* 44.018 9.1.33 */
	type record SystemInformationType2bis {
		NeighbourCellDescription	extd_bcch_freq_list,
		RachControlParameters		rach_control,
		OCT1				rest_octets
	} with { variant "" };

	/* 44.018 9.1.34 */
	type record SystemInformationType2ter {
		NeighbourCellDescription2	extd_bcch_freq_list,
		OCT4				rest_octets
	} with { variant "" };

	/* 44.018 9.1.35 */
	type record SystemInformationType3 {
		CellIdentity			cell_id,
		LocationAreaIdentification	lai,
		ControlChannelDescription	ctrl_chan_desc,
		CellOptions			cell_options,
		CellSelectionParameters		cell_sel_par,
		RachControlParameters		rach_control,
		Si3RestOctets			rest_octets
	} with { variant "" };

	template SystemInformationType3 t_SI3 := {
		cell_id := ?,
		lai := ?,
		ctrl_chan_desc := t_ControlChannelDescription,
		cell_options := ?,
		cell_sel_par := ?,
		rach_control := ?,
		rest_octets := ?
	};
		

	/* 44.018 9.1.36 */
	type record SystemInformationType4 {
		LocationAreaIdentification	lai,
		CellSelectionParameters		cell_sel_par,
		RachControlParameters		rach_control,
		ChannelDescriptionTV		cbch_chan_desc optional,
		MobileAllocationT		cbch_mobile_alloc optional,
		RestOctets			rest_octets
	} with { variant "TAG(cbch_chan_desc, iei = '64'O; cbch_mobile_alloc, iei = '72'O)" };

	/* 44.018 9.1.37 */
	type record SystemInformationType5 {
		NeighbourCellDescription	bcch_freq_list
	} with { variant "" };

	/* 44.018 9.1.38 */
	type record SystemInformationType5bis {
		NeighbourCellDescription	extd_bcch_freq_list
	} with { variant "" };

	/* 44.018 9.1.39 */
	type record SystemInformationType5ter {
		NeighbourCellDescription2	extd_bcch_freq_list
	} with { variant "" };

	/* 44.018 9.1.40 */
	type record SystemInformationType6 {
		CellIdentity			cell_id,
		LocationAreaIdentification	lai,
		CellOptionsSacch		cell_options,
		BIT8				ncc_permitted,
		OCT7				rest_octets
	} with { variant "" };

	type union SystemInformationUnion {
		SystemInformationType1		si1,
		SystemInformationType2		si2,
		SystemInformationType2bis	si2bis,
		SystemInformationType2ter	si2ter,
		SystemInformationType3		si3,
		SystemInformationType4		si4,
		SystemInformationType5		si5,
		SystemInformationType5bis	si5bis,
		SystemInformationType5ter	si5ter,
		SystemInformationType6		si6,
		octetstring			other
	} with { variant "" };

	type record SystemInformation {
		RrHeader			header,
		SystemInformationUnion		payload
	} with { variant (payload) "CROSSTAG(si1, header.message_type = SYSTEM_INFORMATION_TYPE_1;
			      si2, header.message_type = SYSTEM_INFORMATION_TYPE_2;
			      si2bis, header.message_type = SYSTEM_INFORMATION_TYPE_2bis;
			      si2ter, header.message_type = SYSTEM_INFORMATION_TYPE_2ter;
			      si3, header.message_type = SYSTEM_INFORMATION_TYPE_3;
			      si4, header.message_type = SYSTEM_INFORMATION_TYPE_4;
			      si5, header.message_type = SYSTEM_INFORMATION_TYPE_5;
			      si5bis, header.message_type = SYSTEM_INFORMATION_TYPE_5bis;
			      si5ter, header.message_type = SYSTEM_INFORMATION_TYPE_5ter;
			      si6, header.message_type = SYSTEM_INFORMATION_TYPE_6;
			      other, OTHERWISE;
			)" };

	external function enc_SystemInformation(in SystemInformation si) return octetstring
		with { extension "prototype(convert) encode(RAW)" };
	external function dec_SystemInformation(in octetstring stream) return SystemInformation
		with { extension "prototype(convert) decode(RAW)" };

} with { encode "RAW"; variant "FIELDORDER(msb)" }