aboutsummaryrefslogtreecommitdiffstats
path: root/library/CBSP_Types.ttcn
blob: c4c6cf25d9730752dcae2330dc094e87d9126c98 (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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
module CBSP_Types {

/* CBSP_Types, defining abstract TTCN-3 data types for the CBSP protocol.
 *
 * CBSP is a ETSI/3GPP standard protocol used between CBC (Cell Broadcast Centre) 
 * and BSC (Base Station Controller) in 2G/GSM/GERAN networks. It is specified
 * in 3GPP TS 48.049.
 *
 * (C) 2019 by Harald Welte <laforge@gnumonks.org>
 * All rights reserved.
 *
 * Released under the terms of GNU General Public License, Version 2 or
 * (at your option) any later version.
 */

import from General_Types all;
import from Osmocom_Types all;
import from BSSAP_Types all;


/* 8.2.2 Message Type */
type enumerated CBSP_MessageType {
	CBSP_MSGT_WRITE_REPLACE			('01'O),
	CBSP_MSGT_WRITE_REPLACE_COMPL		('02'O),
	CBSP_MSGT_WRITE_REPLACE_FAIL		('03'O),
	CBSP_MSGT_KILL				('04'O),
	CBSP_MSGT_KILL_COMPL			('05'O),
	CBSP_MSGT_KILL_FAIL			('06'O),
	CBSP_MSGT_LOAD_QUERY			('07'O),
	CBSP_MSGT_LOAD_QUERY_COMPL		('08'O),
	CBSP_MSGT_LOAD_QUERY_FAIL		('09'O),
	CBSP_MSGT_MSG_STATUS_QUERY		('0a'O),
	CBSP_MSGT_MSG_STATUS_QUERY_COMPL	('0b'O),
	CBSP_MSGT_MSG_STATUS_QUERY_FAIL		('0c'O),
	CBSP_MSGT_SET_DRX			('0d'O),
	CBSP_MSGT_SET_DRX_COMPL			('0e'O),
	CBSP_MSGT_SET_DRX_FAIL			('0f'O),
	CBSP_MSGT_RESET				('10'O),
	CBSP_MSGT_RESET_COMPL			('11'O),
	CBSP_MSGT_RESET_FAIL			('12'O),
	CBSP_MSGT_RESTART			('13'O),
	CBSP_MSGT_FAILURE			('14'O),
	CBSP_MSGT_ERROR_IND			('15'O),
	CBSP_MSGT_KEEP_ALIVE			('16'O),
	CBSP_MSGT_KEEP_ALIVE_COMPL		('17'O)
} with { variant "FIELDLENGTH(8)" };

/* 8.2.1 Information Element Identifier */
type enumerated CBSP_IEI {
	CBSP_IEI_MSG_CONTENT			('01'O),
	CBSP_IEI_OLD_SERIAL_NR			('02'O),
	CBSP_IEI_NEW_SERIAL_NR			('03'O),
	CBSP_IEI_CELL_LIST			('04'O),
	CBSP_IEI_CATEGORY			('05'O),
	CBSP_IEI_REP_PERIOD			('06'O),
	CBSP_IEI_NUM_BCAST_REQ			('07'O),
	CBSP_IEI_NUM_BCAST_COMPL_LIST		('08'O),
	CBSP_IEI_FAILURE_LIST			('09'O),
	CBSP_IEI_RR_LOADING_LIST		('0a'O),
	CBSP_IEI_CAUSE				('0b'O),
	CBSP_IEI_DCS				('0c'O),
	CBSP_IEI_RECOVERY_IND			('0d'O),
	CBSP_IEI_MSG_ID				('0e'O),
	CBSP_IEI_EMERG_IND			('0f'O),
	CBSP_IEI_WARN_TYPE			('10'O),
	CBSP_IEI_WARN_SEC_INFO			('11'O),
	CBSP_IEI_CHANNEL_IND			('12'O),
	CBSP_IEI_NUM_OF_PAGES			('13'O),
	CBSP_IEI_SCHEDULE_PERIOD		('14'O),
	CBSP_IEI_NUM_OF_RES_SLOTS		('15'O),
	CBSP_IEI_BCAST_MSG_TYPE			('16'O),
	CBSP_IEI_WARNING_PERIOD			('17'O),
	CBSP_IEI_KEEP_ALIVE_REP_PERIOD		('18'O)
} with { variant "FIELDLENGTH(8)" };

/* 8.2.7 Category */
type enumerated CBSP_Category {
	CBSP_CATEG_HIGH_PRIO			('00'O),
	CBSP_CATEG_BACKGROUND			('01'O),
	CBSP_CATEG_NORMAL			('02'O)
} with { variant "FIELDLENGTH(8)" };

/* Cell ID Discriminator (8.2.11, ...) */
type enumerated CBSP_CellIdDisc {
	CBSP_CIDD_WHOLE_CGI		(0),
	CBSP_CIDD_LAC_CI		(1),
	CBSP_CIDD_CI			(2),
	CBSP_CIDD_LAI			(4),
	CBSP_CIDD_LAC			(5),
	CBSP_CIDD_ALL_IN_BSC		(6)
} with { variant "FIELDLENGTH(4)" };

/* 8.2.13 Cause */
type enumerated CBSP_Cause {
	CBSP_CAUSE_PARAM_NOT_RECOGNISED		('00'O),
	CBSP_CAUSE_PARAM_VAL_INVALID		('01'O),
	CBSP_CAUSE_MSG_REF_NOT_IDENTIFIED	('02'O),
	CBSP_CAUSE_CELL_ID_NOT_VALID		('03'O),
	CBSP_CAUSE_UNRECOGNISED_MSG		('04'O),
	CBSP_CAUSE_MISSING_MAND_IE		('05'O),
	CBSP_CAUSE_BSC_CAPACITY_EXCEEDED	('06'O),
	CBSP_CAUSE_CELL_MEMORY_EXCEEDED		('07'O),
	CBSP_CAUSE_BSC_MEMORY_EXCEEDED		('08'O),
	CBSP_CAUSE_CB_NOT_SUPPORTED		('09'O),
	CBSP_CAUSE_CB_NOT_OPERATIONAL		('0a'O),
	CBSP_CAUSE_INCOMPATIBLE_DRX_PARAM	('0b'O),
	CBSP_CAUSE_EXT_CHAN_NOT_SUPPORTED	('0c'O),
	CBSP_CAUSE_MSG_REF_ALREADY_USED		('0d'O),
	CBSP_CAUSE_UNSPECIFIED_ERROR		('0e'O),
	CBSP_CAUSE_LAI_OR_LAC_NPT_VALID		('0f'O)
} with { variant "FIELDLENGTH(8)" };

type record CBSP_IE_MessageContent {
	uint8_t		user_len,
	octetstring	val
} with { variant (val) "FIELDLENGTH(82)"
         variant (val) "ALIGN(left)" };

/* 8.2.6 Cell List */
type record CBSP_IE_CellList {
	uint16_t	len,
	BIT4		spare1_4,
	BIT4		cell_id_discr,
	BSSMAP_FIELD_CellIdentificationList cell_id
} with {
	variant (len) "LENGTHTO(cell_id_discr,spare1_4,cell_id)"
	variant (cell_id) "CROSSTAG(
		cIl_CGI,		cell_id_discr = '0000'B;
		cIl_LAC_CI,		cell_id_discr = '0001'B;
		cIl_CI,			cell_id_discr = '0010'B;
		cIl_LAI,		cell_id_discr = '0100'B;
		cIl_LAC,		cell_id_discr = '0101'B;
		cIl_allInBSS,		cell_id_discr = '0110'B;
			)"
};

/* 8.2.10 Number of Broadcasts Completed List */
type record CBSP_IE_NumBcastComplList {
	uint16_t	len,
	BIT4		spare1_4,
	BIT4		cell_id_discr,
	CBSP_FIELD_NumBcastCompl list
} with {
	variant (len) "LENGTHTO(cell_id_discr,spare1_4,list)"
	variant (list) "CROSSTAG(
		cI_CGI,		cell_id_discr = '0000'B;
		cI_LAC_CI,	cell_id_discr = '0001'B;
		cI_CI,		cell_id_discr = '0010'B;
		cI_LAI,		cell_id_discr = '0100'B;
		cI_LAC,		cell_id_discr = '0101'B;
		cI_allInBSS,	cell_id_discr = '0110'B;
			)"
};
type union CBSP_FIELD_NumBcastCompl {
	CBSP_FIELD_NumBcastCompl_CGI		cI_CGI,
	CBSP_FIELD_NumBcastCompl_LAC_CI		cI_LAC_CI,
	OCT0					cI_allInBSS,
	CBSP_FIELD_NumBcastCompl_CI		cI_CI,
	CBSP_FIELD_NumBcastCompl_LAC		cI_LAC,
	CBSP_FIELD_NumBcastCompl_LAI		cI_LAI
};
type record CBSP_FIELD_NumBcastCompl_CGI {
	BSSMAP_FIELD_CellIdentification_CGI	ci,
	uint16_t				num_bcats_compl,
	CBSP_NumBcastInfo			num_bcast_info,
	BIT4					spare1_4
};
type record CBSP_FIELD_NumBcastCompl_LAC_CI {
	BSSMAP_FIELD_CellIdentification_LAC_CI	ci,
	uint16_t				num_bcats_compl,
	CBSP_NumBcastInfo			num_bcast_info,
	BIT4					spare1_4
};
type record CBSP_FIELD_NumBcastCompl_LAI {
	BSSMAP_FIELD_CellIdentification_LAI	ci,
	uint16_t				num_bcats_compl,
	CBSP_NumBcastInfo			num_bcast_info,
	BIT4					spare1_4
};
type record CBSP_FIELD_NumBcastCompl_CI {
	OCT2					ci,
	uint16_t				num_bcats_compl,
	CBSP_NumBcastInfo			num_bcast_info,
	BIT4					spare1_4
};
type record CBSP_FIELD_NumBcastCompl_LAC {
	OCT2					lac,
	uint16_t				num_bcats_compl,
	CBSP_NumBcastInfo			num_bcast_info,
	BIT4					spare1_4
};
type enumerated CBSP_NumBcastInfo {
	CBSP_NUM_BCAST_INFO_VALID	(0),
	CBSP_NUM_BCAST_INFO_OVERFLOW	(1),
	CBSP_NUM_BCAST_INFO_UNKNOWN	(2)
} with { variant "FIELDLENGTH(4)" };


/* 8.2.11 Failure List */
type record CBSP_FailureListItem {
	BIT4		spare1_4,
	BIT4		cell_id_discr,
	CBSP_FIELD_CellIdentification cell_id,
	CBSP_Cause	cause
} with {
	variant (cell_id) "CROSSTAG(
		cI_CGI,		cell_id_discr = '0000'B;
		cI_LAC_CI,	cell_id_discr = '0001'B;
		cI_CI,		cell_id_discr = '0010'B;
		cI_LAI,		cell_id_discr = '0100'B;
		cI_LAC,		cell_id_discr = '0101'B;
		cI_allInBSS,	cell_id_discr = '0110'B;
			)"
};
type union CBSP_FIELD_CellIdentification
{
	BSSMAP_FIELD_CellIdentification_CGI    cI_CGI,
	BSSMAP_FIELD_CellIdentification_LAC_CI cI_LAC_CI,
	OCT2                                   cI_CI,
	BSSMAP_FIELD_CellIdentification_LAI    cI_LAI,
	OCT2                                   cI_LAC,
	OCT2                                   cI_allInBSS
};

type record of CBSP_FailureListItem CBSP_FailureListItems;
type record CBSP_IE_FailureList {
	uint16_t	len,
	CBSP_FailureListItems list
} with {
	variant (len) "LENGTHTO(list)"
};

/* 8.2.12 RR Loading List */
type record CBSP_IE_RrLoadingList {
	uint16_t	len,
	BIT4		spare1_4,
	BIT4		cell_id_discr,
	CBSP_FIELD_RrLoadingList list
} with {
	variant (len) "LENGTHTO(cell_id_discr,spare1_4,list)"
	variant (list) "CROSSTAG(
		cI_CGI,		cell_id_discr = '0000'B;
		cI_LAC_CI,	cell_id_discr = '0001'B;
		cI_CI,		cell_id_discr = '0010'B;
		cI_LAI,		cell_id_discr = '0100'B;
		cI_LAC,		cell_id_discr = '0101'B;
		cI_allInBSS,	cell_id_discr = '0110'B;
			)"
};
type union CBSP_FIELD_RrLoadingList {
	CBSP_FIELD_RrLoadingList_CGI		cI_CGI,
	CBSP_FIELD_RrLoadingList_LAC_CI		cI_LAC_CI,
	OCT0					cI_allInBSS,
	CBSP_FIELD_RrLoadingList_CI		cI_CI,
	CBSP_FIELD_RrLoadingList_LAC		cI_LAC,
	CBSP_FIELD_RrLoadingList_LAI		cI_LAI
};
type record CBSP_FIELD_RrLoadingList_CGI {
	BSSMAP_FIELD_CellIdentification_CGI	ci,
	uint8_t					load1,
	uint8_t					load2
};
type record CBSP_FIELD_RrLoadingList_LAC_CI {
	BSSMAP_FIELD_CellIdentification_LAC_CI	ci,
	uint8_t					load1,
	uint8_t					load2
};
type record CBSP_FIELD_RrLoadingList_LAI {
	BSSMAP_FIELD_CellIdentification_LAI	ci,
	uint8_t					load1,
	uint8_t					load2
};
type record CBSP_FIELD_RrLoadingList_CI {
	OCT2					ci,
	uint8_t					load1,
	uint8_t					load2
};
type record CBSP_FIELD_RrLoadingList_LAC {
	OCT2					lac,
	uint8_t					load1,
	uint8_t					load2
};

/* 8.2.15 Recovery Indication */
type record CBSP_IE_RecoveryInd {
	BIT4			spare1_4,
	CBSP_RecoveryInd	recovery
};
type enumerated CBSP_RecoveryInd {
	CBSP_RI_DATA_AVAILABLE	(0),
	CBSP_RI_DATA_LOST	(1)
} with { variant "FIELDLENGTH(4)" };

/* 8.2.24 Broadcast Message Type */
type record CBSP_IE_BcastMsgType {
	BIT4			spare1_4,
	CBSP_BcastMsgType	msg_type
};
type enumerated CBSP_BcastMsgType {
	CBSP_BC_MSGT_CBS	(0),
	CBSP_BC_MSGT_EMERG	(1)
} with { variant "FIELDLENGTH(4)" };


type union CBSP_IE_Body {
	CBSP_IE_MessageContent	msg_content,
	uint16_t		old_ser_nr,
	uint16_t		new_ser_nr,
	CBSP_IE_CellList	cell_list,
	CBSP_Category		category,
	uint16_t		rep_period,
	uint16_t		num_bcast_req,
	CBSP_IE_NumBcastComplList num_bcast_compl_list,
	CBSP_IE_FailureList	failure_list,
	CBSP_IE_RrLoadingList	rr_loading_list,
	CBSP_Cause		cause,
	uint8_t 		dcs,
	CBSP_IE_RecoveryInd	recovery_ind,
	uint16_t		msg_id,
	uint8_t			emerg_ind,
	uint16_t		warn_type,
	octetstring		warn_sec_info,
	uint8_t			channel_ind,
	uint8_t			num_of_pages,
	uint8_t			schedule_period,
	uint8_t			num_of_res_slots,
	CBSP_IE_BcastMsgType	bcast_msg_type,
	uint8_t			warning_period,
	uint8_t			keep_alive_rep_period
} with {
	variant (warn_sec_info) "FIELDLENGTH(50)"
};

type record CBSP_IE {
	CBSP_IEI		iei,
	CBSP_IE_Body		body
} with {
	variant (body)	"CROSSTAG(	msg_content, iei = CBSP_IEI_MSG_CONTENT;
					old_ser_nr, iei = CBSP_IEI_OLD_SERIAL_NR;
					new_ser_nr, iei = CBSP_IEI_NEW_SERIAL_NR;
					cell_list, iei = CBSP_IEI_CELL_LIST;
					category, iei = CBSP_IEI_CATEGORY;
					rep_period, iei = CBSP_IEI_REP_PERIOD;
					num_bcast_req, iei = CBSP_IEI_NUM_BCAST_REQ;
					num_bcast_compl_list, iei = CBSP_IEI_NUM_BCAST_COMPL_LIST;
					failure_list, iei = CBSP_IEI_FAILURE_LIST;
					rr_loading_list, iei = CBSP_IEI_RR_LOADING_LIST;
					cause, iei = CBSP_IEI_CAUSE;
					dcs, iei = CBSP_IEI_DCS;
					recovery_ind, iei = CBSP_IEI_RECOVERY_IND;
					msg_id, iei = CBSP_IEI_MSG_ID;
					emerg_ind, iei = CBSP_IEI_EMERG_IND;
					warn_type, iei = CBSP_IEI_WARN_TYPE;
					warn_sec_info, iei = CBSP_IEI_WARN_SEC_INFO;
					channel_ind, iei = CBSP_IEI_CHANNEL_IND;
					num_of_pages, iei = CBSP_IEI_NUM_OF_PAGES;
					schedule_period, iei = CBSP_IEI_SCHEDULE_PERIOD;
					num_of_res_slots, iei = CBSP_IEI_NUM_OF_RES_SLOTS;
					bcast_msg_type, iei = CBSP_IEI_BCAST_MSG_TYPE;
					warning_period, iei = CBSP_IEI_WARNING_PERIOD;
					keep_alive_rep_period, iei = CBSP_IEI_KEEP_ALIVE_REP_PERIOD
		)"
};

type set of CBSP_IE CBSP_IEs;

type record CBSP_PDU {
	CBSP_MessageType	msg_type,
	uint24_t		len,
	CBSP_IEs		ies
} with {
	variant (len) "LENGTHTO(ies)"
};

external function enc_CBSP_PDU(in CBSP_PDU msg) return octetstring
	with { extension "prototype(convert) encode(RAW)" };

external function dec_CBSP_PDU(in octetstring msg) return CBSP_PDU
	with { extension "prototype(convert) decode(RAW)" };


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