blob: 42fda96ae955531a87de4e6a741ce045dccc7f4a [file] [log] [blame]
Holger Hans Peter Freytherac967702009-07-29 07:37:48 +02001/*
2 * ITU Q.713 defined types for SCCP
3 *
4 * (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
5 *
6 * All Rights Reserved
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 */
23
24#ifndef SCCP_TYPES_H
25#define SCCP_TYPES_H
26
Holger Hans Peter Freytherb2abbe82010-02-14 17:17:28 +010027#include <endian.h>
28
Holger Hans Peter Freytherac967702009-07-29 07:37:48 +020029/* Table 1/Q.713 - SCCP message types */
30enum sccp_message_types {
31 SCCP_MSG_TYPE_CR = 1,
32 SCCP_MSG_TYPE_CC = 2,
33 SCCP_MSG_TYPE_CREF = 3,
34 SCCP_MSG_TYPE_RLSD = 4,
35 SCCP_MSG_TYPE_RLC = 5,
36 SCCP_MSG_TYPE_DT1 = 6,
37 SCCP_MSG_TYPE_DT2 = 7,
38 SCCP_MSG_TYPE_AK = 8,
39 SCCP_MSG_TYPE_UDT = 9,
40 SCCP_MSG_TYPE_UDTS = 10,
41 SCCP_MSG_TYPE_ED = 11,
42 SCCP_MSG_TYPE_EA = 12,
43 SCCP_MSG_TYPE_RSR = 13,
44 SCCP_MSG_TYPE_RSC = 14,
45 SCCP_MSG_TYPE_ERR = 15,
46 SCCP_MSG_TYPE_IT = 16,
47 SCCP_MSG_TYPE_XUDT = 17,
48 SCCP_MSG_TYPE_XUDTS = 18,
49 SCCP_MSG_TYPE_LUDT = 19,
50 SCCP_MSG_TYPE_LUDTS = 20
51};
52
53/* Table 2/Q.713 - SCCP parameter name codes */
54enum sccp_parameter_name_codes {
55 SCCP_PNC_END_OF_OPTIONAL = 0,
56 SCCP_PNC_DESTINATION_LOCAL_REFERENCE = 1,
57 SCCP_PNC_SOURCE_LOCAL_REFERENCE = 2,
58 SCCP_PNC_CALLED_PARTY_ADDRESS = 3,
59 SCCP_PNC_CALLING_PARTY_ADDRESS = 4,
60 SCCP_PNC_PROTOCOL_CLASS = 5,
61 SCCP_PNC_SEGMENTING = 6,
62 SCCP_PNC_RECEIVE_SEQ_NUMBER = 7,
63 SCCP_PNC_SEQUENCING = 8,
64 SCCP_PNC_CREDIT = 9,
65 SCCP_PNC_RELEASE_CAUSE = 10,
66 SCCP_PNC_RETURN_CAUSE = 11,
67 SCCP_PNC_RESET_CAUSE = 12,
68 SCCP_PNC_ERROR_CAUSE = 13,
69 SCCP_PNC_REFUSAL_CAUSE = 14,
70 SCCP_PNC_DATA = 15,
71 SCCP_PNC_SEGMENTATION = 16,
72 SCCP_PNC_HOP_COUNTER = 17,
73 SCCP_PNC_IMPORTANCE = 18,
74 SCCP_PNC_LONG_DATA = 19,
75};
76
77/* Figure 3/Q.713 Called/calling party address */
78enum {
79 SCCP_TITLE_IND_NONE = 0,
80 SCCP_TITLE_IND_NATURE_ONLY = 1,
81 SCCP_TITLE_IND_TRANSLATION_ONLY = 2,
82 SCCP_TITLE_IND_TRANS_NUM_ENC = 3,
83 SCCP_TITLE_IND_TRANS_NUM_ENC_NATURE = 4,
84};
85
86enum {
87 SCCP_CALL_ROUTE_ON_SSN = 1,
88 SCCP_CALL_ROUTE_ON_GT = 0,
89};
90
91struct sccp_called_party_address {
Holger Hans Peter Freytherb2abbe82010-02-14 17:17:28 +010092#if __BYTE_ORDER == __LITTLE_ENDIAN
Holger Hans Peter Freytherac967702009-07-29 07:37:48 +020093 u_int8_t point_code_indicator : 1,
94 ssn_indicator : 1,
95 global_title_indicator : 4,
96 routing_indicator : 1,
97 reserved : 1;
Holger Hans Peter Freytherb2abbe82010-02-14 17:17:28 +010098#elif __BYTE_ORDER == __BIG_ENDIAN
99 u_int8_t reserved : 1,
100 routing_indicator : 1,
101 global_title_indicator : 4,
102 ssn_indicator : 1,
103 point_code_indicator : 1;
104#endif
Holger Hans Peter Freytherac967702009-07-29 07:37:48 +0200105 u_int8_t data[0];
106} __attribute__((packed));
107
108/* indicator indicates presence in the above order */
109
110/* Figure 6/Q.713 */
111struct sccp_signalling_point_code {
112 u_int8_t lsb;
Holger Hans Peter Freytherb2abbe82010-02-14 17:17:28 +0100113#if __BYTE_ORDER == __LITTLE_ENDIAN
Holger Hans Peter Freytherac967702009-07-29 07:37:48 +0200114 u_int8_t msb : 6,
115 reserved : 2;
Holger Hans Peter Freytherb2abbe82010-02-14 17:17:28 +0100116#elif __BYTE_ORDER == __BIG_ENDIAN
117 u_int8_t reserved : 2,
118 msb : 6;
119#endif
Holger Hans Peter Freytherac967702009-07-29 07:37:48 +0200120} __attribute__((packed));
121
122/* SSN == subsystem number */
123enum sccp_subsystem_number {
124 SCCP_SSN_NOT_KNOWN_OR_USED = 0,
125 SCCP_SSN_MANAGEMENT = 1,
126 SCCP_SSN_RESERVED_ITU = 2,
127 SCCP_SSN_ISDN_USER_PART = 3,
128 SCCP_SSN_OMAP = 4, /* operation, maint and administration part */
129 SCCP_SSN_MAP = 5, /* mobile application part */
130 SCCP_SSN_HLR = 6,
131 SCCP_SSN_VLR = 7,
132 SCCP_SSN_MSC = 8,
133 SCCP_SSN_EIC = 9, /* equipent identifier centre */
134 SCCP_SSN_AUC = 10, /* authentication centre */
135 SCCP_SSN_ISDN_SUPPL_SERVICES = 11,
136 SCCP_SSN_RESERVED_INTL = 12,
137 SCCP_SSN_ISDN_EDGE_TO_EDGE = 13,
138 SCCP_SSN_TC_TEST_RESPONDER = 14,
139
140 /* From GSM 03.03 8.2 */
141 SCCP_SSN_BSSAP = 254,
142 SCCP_SSN_BSSOM = 253,
143};
144
145/* Q.713, 3.4.2.3 */
146enum {
147 SCCP_NAI_UNKNOWN = 0,
148 SCCP_NAI_SUBSCRIBER_NUMBER = 1,
149 SCCP_NAI_RESERVED_NATIONAL = 2,
150 SCCP_NAI_NATIONAL_SIGNIFICANT = 3,
151 SCCP_NAI_INTERNATIONAL = 4,
152};
153
154struct sccp_global_title {
Holger Hans Peter Freytherb2abbe82010-02-14 17:17:28 +0100155#if __BYTE_ORDER == __LITTLE_ENDIAN
Holger Hans Peter Freytherac967702009-07-29 07:37:48 +0200156 u_int8_t nature_of_addr_ind : 7,
157 odd_even : 1;
Holger Hans Peter Freytherb2abbe82010-02-14 17:17:28 +0100158#elif __BYTE_ORDER == __BIG_ENDIAN
159 u_int8_t odd_even : 1,
160 nature_of_addr_ind : 7;
161#endif
Holger Hans Peter Freytherac967702009-07-29 07:37:48 +0200162 u_int8_t data[0];
163} __attribute__((packed));
164
165/* Q.713, 3.3 */
166struct sccp_source_reference {
167 u_int8_t octet1;
168 u_int8_t octet2;
169 u_int8_t octet3;
170} __attribute__((packed));
171
172/* Q.714, 3.6 */
173enum sccp_protocol_class {
174 SCCP_PROTOCOL_CLASS_0 = 0,
175 SCCP_PROTOCOL_CLASS_1 = 1,
176 SCCP_PROTOCOL_CLASS_2 = 2,
177 SCCP_PROTOCOL_CLASS_3 = 3,
178};
179
180/* bits 5-8 when class0, class1 is used */
181enum sccp_protocol_options {
182 SCCP_PROTOCOL_NO_SPECIAL = 0,
183 SCCP_PROTOCOL_RETURN_MESSAGE = 8,
184};
185
186enum sccp_release_cause {
187 SCCP_RELEASE_CAUSE_END_USER_ORIGINATED = 0,
188 SCCP_RELEASE_CAUSE_END_USER_CONGESTION = 1,
189 SCCP_RELEASE_CAUSE_END_USER_FAILURE = 2,
190 SCCP_RELEASE_CAUSE_SCCP_USER_ORIGINATED = 3,
191 SCCP_RELEASE_CAUSE_REMOTE_PROCEDURE_ERROR = 4,
192 SCCP_RELEASE_CAUSE_INCONSISTENT_CONN_DATA = 5,
193 SCCP_RELEASE_CAUSE_ACCESS_FAILURE = 6,
194 SCCP_RELEASE_CAUSE_ACCESS_CONGESTION = 7,
195 SCCP_RELEASE_CAUSE_SUBSYSTEM_FAILURE = 8,
196 SCCP_RELEASE_CAUSE_SUBSYSTEM_CONGESTION = 9,
197 SCCP_RELEASE_CAUSE_MTP_FAILURE = 10,
198 SCCP_RELEASE_CAUSE_NETWORK_CONGESTION = 11,
199 SCCP_RELEASE_CAUSE_EXPIRATION_RESET = 12,
200 SCCP_RELEASE_CAUSE_EXPIRATION_INACTIVE = 13,
201 SCCP_RELEASE_CAUSE_RESERVED = 14,
202 SCCP_RELEASE_CAUSE_UNQUALIFIED = 15,
203 SCCP_RELEASE_CAUSE_SCCP_FAILURE = 16,
204};
205
206enum sccp_return_cause {
207 SCCP_RETURN_CAUSE_NO_TRANSLATION_NATURE = 0,
208 SCCP_RETURN_CAUSE_NO_TRANSLATION = 1,
209 SCCP_RETURN_CAUSE_SUBSYSTEM_CONGESTION = 2,
210 SCCP_RETURN_CAUSE_SUBSYSTEM_FAILURE = 3,
211 SCCP_RETURN_CAUSE_UNEQUIPPED_USER = 4,
212 SCCP_RETURN_CAUSE_MTP_FAILURE = 5,
213 SCCP_RETURN_CAUSE_NETWORK_CONGESTION = 6,
214 SCCP_RETURN_CAUSE_UNQUALIFIED = 7,
215 SCCP_RETURN_CAUSE_ERROR_IN_MSG_TRANSPORT = 8,
216 SCCP_RETURN_CAUSE_ERROR_IN_LOCAL_PROCESSING = 9,
217 SCCP_RETURN_CAUSE_DEST_CANNOT_PERFORM_REASSEMBLY = 10,
218 SCCP_RETURN_CAUSE_SCCP_FAILURE = 11,
219 SCCP_RETURN_CAUSE_HOP_COUNTER_VIOLATION = 12,
220 SCCP_RETURN_CAUSE_SEGMENTATION_NOT_SUPPORTED= 13,
221 SCCP_RETURN_CAUSE_SEGMENTATION_FAOLURE = 14
222};
223
224enum sccp_reset_cause {
225 SCCP_RESET_CAUSE_END_USER_ORIGINATED = 0,
226 SCCP_RESET_CAUSE_SCCP_USER_ORIGINATED = 1,
227 SCCP_RESET_CAUSE_MSG_OUT_OF_ORDER_PS = 2,
228 SCCP_RESET_CAUSE_MSG_OUT_OF_ORDER_PR = 3,
229 SCCP_RESET_CAUSE_RPC_OUT_OF_WINDOW = 4,
230 SCCP_RESET_CAUSE_RPC_INCORRECT_PS = 5,
231 SCCP_RESET_CAUSE_RPC_GENERAL = 6,
232 SCCP_RESET_CAUSE_REMOTE_END_USER_OPERATIONAL= 7,
233 SCCP_RESET_CAUSE_NETWORK_OPERATIONAL = 8,
234 SCCP_RESET_CAUSE_ACCESS_OPERATIONAL = 9,
235 SCCP_RESET_CAUSE_NETWORK_CONGESTION = 10,
236 SCCP_RESET_CAUSE_RESERVED = 11,
237};
238
239enum sccp_error_cause {
240 SCCP_ERROR_LRN_MISMATCH_UNASSIGNED = 0, /* local reference number */
241 SCCP_ERROR_LRN_MISMATCH_INCONSISTENT = 1,
242 SCCP_ERROR_POINT_CODE_MISMATCH = 2,
243 SCCP_ERROR_SERVICE_CLASS_MISMATCH = 3,
244 SCCP_ERROR_UNQUALIFIED = 4,
245};
246
247enum sccp_refusal_cause {
248 SCCP_REFUSAL_END_USER_ORIGINATED = 0,
249 SCCP_REFUSAL_END_USER_CONGESTION = 1,
250 SCCP_REFUSAL_END_USER_FAILURE = 2,
251 SCCP_REFUSAL_SCCP_USER_ORIGINATED = 3,
252 SCCP_REFUSAL_DESTINATION_ADDRESS_UKNOWN = 4,
253 SCCP_REFUSAL_DESTINATION_INACCESSIBLE = 5,
254 SCCP_REFUSAL_NET_QOS_NON_TRANSIENT = 6,
255 SCCP_REFUSAL_NET_QOS_TRANSIENT = 7,
256 SCCP_REFUSAL_ACCESS_FAILURE = 8,
257 SCCP_REFUSAL_ACCESS_CONGESTION = 9,
258 SCCP_REFUSAL_SUBSYSTEM_FAILURE = 10,
259 SCCP_REFUSAL_SUBSYTEM_CONGESTION = 11,
260 SCCP_REFUSAL_EXPIRATION = 12,
261 SCCP_REFUSAL_INCOMPATIBLE_USER_DATA = 13,
262 SCCP_REFUSAL_RESERVED = 14,
263 SCCP_REFUSAL_UNQUALIFIED = 15,
264 SCCP_REFUSAL_HOP_COUNTER_VIOLATION = 16,
265 SCCP_REFUSAL_SCCP_FAILURE = 17,
266 SCCP_REFUSAL_UNEQUIPPED_USER = 18,
267};
268
269/*
270 * messages... as of Q.713 Chapter 4
271 */
272struct sccp_connection_request {
273 /* mandantory */
274 u_int8_t type;
275 struct sccp_source_reference source_local_reference;
276 u_int8_t proto_class;
277
278
279 /* variable */
280 u_int8_t variable_called;
281#if VARIABLE
282 called_party_address
283#endif
284
285 /* optional */
286 u_int8_t optional_start;
287
288#if OPTIONAL
289 credit 3
290 callingparty var 4-n
291 data 3-130
292 hop_counter 3
293 importance 3
294 end_of_optional 1
295#endif
296
297 u_int8_t data[0];
298} __attribute__((packed));
299
300struct sccp_connection_confirm {
301 /* mandantory */
302 u_int8_t type;
303 struct sccp_source_reference destination_local_reference;
304 struct sccp_source_reference source_local_reference;
305 u_int8_t proto_class;
306
307 /* optional */
308 u_int8_t optional_start;
309
310 /* optional */
311#if OPTIONAL
312 credit 3
313 called party 4
314 data 3-130
315 importance 3
316 end_of_optional 1
317#endif
318
319 u_int8_t data[0];
320} __attribute__((packed));
321
322struct sccp_connection_refused {
323 /* mandantory */
324 u_int8_t type;
325 struct sccp_source_reference destination_local_reference;
326 u_int8_t cause;
327
328 /* optional */
329 u_int8_t optional_start;
330
331 /* optional */
332#if OPTIONAL
333 called party 4
334 data 3-130
335 importance 3
336 end_of_optional 1
337#endif
338
339 u_int8_t data[0];
340} __attribute__((packed));
341
342struct sccp_connection_released {
343 /* mandantory */
344 u_int8_t type;
345 struct sccp_source_reference destination_local_reference;
346 struct sccp_source_reference source_local_reference;
347 u_int8_t release_cause;
348
349
350 /* optional */
351 u_int8_t optional_start;
352
353#if OPTIONAL
354 data 3-130
355 importance 3
356 end_of_optional 1
357#endif
358 u_int8_t data[0];
359} __attribute__((packed));
360
361struct sccp_connection_release_complete {
362 u_int8_t type;
363 struct sccp_source_reference destination_local_reference;
364 struct sccp_source_reference source_local_reference;
365} __attribute__((packed));
366
367struct sccp_data_form1 {
368 /* mandantory */
369 u_int8_t type;
370 struct sccp_source_reference destination_local_reference;
371 u_int8_t segmenting;
372
373 /* variable */
374 u_int8_t variable_start;
375
376#if VARIABLE
377 data 2-256;
378#endif
379
380 u_int8_t data[0];
381} __attribute__((packed));
382
383
384struct sccp_data_unitdata {
385 /* mandantory */
386 u_int8_t type;
387 u_int8_t proto_class;
388
389
390 /* variable */
391 u_int8_t variable_called;
392 u_int8_t variable_calling;
393 u_int8_t variable_data;
394
395#if VARIABLE
396 called party address
397 calling party address
398#endif
399
400 u_int8_t data[0];
401} __attribute__((packed));
402
Holger Hans Peter Freyther3b9516e2009-11-18 22:11:28 +0100403struct sccp_data_it {
404 /* mandantory */
405 u_int8_t type;
406 struct sccp_source_reference destination_local_reference;
407 struct sccp_source_reference source_local_reference;
408 u_int8_t proto_class;
409
410 u_int8_t sequencing[2];
411 u_int8_t credit;
412} __attribute__((packed));
413
Holger Hans Peter Freytherac967702009-07-29 07:37:48 +0200414#endif