blob: c6b11820cd17ac2968d6aff6a773b60b4df6dfa1 [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
27/* Table 1/Q.713 - SCCP message types */
28enum sccp_message_types {
29 SCCP_MSG_TYPE_CR = 1,
30 SCCP_MSG_TYPE_CC = 2,
31 SCCP_MSG_TYPE_CREF = 3,
32 SCCP_MSG_TYPE_RLSD = 4,
33 SCCP_MSG_TYPE_RLC = 5,
34 SCCP_MSG_TYPE_DT1 = 6,
35 SCCP_MSG_TYPE_DT2 = 7,
36 SCCP_MSG_TYPE_AK = 8,
37 SCCP_MSG_TYPE_UDT = 9,
38 SCCP_MSG_TYPE_UDTS = 10,
39 SCCP_MSG_TYPE_ED = 11,
40 SCCP_MSG_TYPE_EA = 12,
41 SCCP_MSG_TYPE_RSR = 13,
42 SCCP_MSG_TYPE_RSC = 14,
43 SCCP_MSG_TYPE_ERR = 15,
44 SCCP_MSG_TYPE_IT = 16,
45 SCCP_MSG_TYPE_XUDT = 17,
46 SCCP_MSG_TYPE_XUDTS = 18,
47 SCCP_MSG_TYPE_LUDT = 19,
48 SCCP_MSG_TYPE_LUDTS = 20
49};
50
51/* Table 2/Q.713 - SCCP parameter name codes */
52enum sccp_parameter_name_codes {
53 SCCP_PNC_END_OF_OPTIONAL = 0,
54 SCCP_PNC_DESTINATION_LOCAL_REFERENCE = 1,
55 SCCP_PNC_SOURCE_LOCAL_REFERENCE = 2,
56 SCCP_PNC_CALLED_PARTY_ADDRESS = 3,
57 SCCP_PNC_CALLING_PARTY_ADDRESS = 4,
58 SCCP_PNC_PROTOCOL_CLASS = 5,
59 SCCP_PNC_SEGMENTING = 6,
60 SCCP_PNC_RECEIVE_SEQ_NUMBER = 7,
61 SCCP_PNC_SEQUENCING = 8,
62 SCCP_PNC_CREDIT = 9,
63 SCCP_PNC_RELEASE_CAUSE = 10,
64 SCCP_PNC_RETURN_CAUSE = 11,
65 SCCP_PNC_RESET_CAUSE = 12,
66 SCCP_PNC_ERROR_CAUSE = 13,
67 SCCP_PNC_REFUSAL_CAUSE = 14,
68 SCCP_PNC_DATA = 15,
69 SCCP_PNC_SEGMENTATION = 16,
70 SCCP_PNC_HOP_COUNTER = 17,
71 SCCP_PNC_IMPORTANCE = 18,
72 SCCP_PNC_LONG_DATA = 19,
73};
74
75/* Figure 3/Q.713 Called/calling party address */
76enum {
77 SCCP_TITLE_IND_NONE = 0,
78 SCCP_TITLE_IND_NATURE_ONLY = 1,
79 SCCP_TITLE_IND_TRANSLATION_ONLY = 2,
80 SCCP_TITLE_IND_TRANS_NUM_ENC = 3,
81 SCCP_TITLE_IND_TRANS_NUM_ENC_NATURE = 4,
82};
83
84enum {
85 SCCP_CALL_ROUTE_ON_SSN = 1,
86 SCCP_CALL_ROUTE_ON_GT = 0,
87};
88
89struct sccp_called_party_address {
90 u_int8_t point_code_indicator : 1,
91 ssn_indicator : 1,
92 global_title_indicator : 4,
93 routing_indicator : 1,
94 reserved : 1;
95 u_int8_t data[0];
96} __attribute__((packed));
97
98/* indicator indicates presence in the above order */
99
100/* Figure 6/Q.713 */
101struct sccp_signalling_point_code {
102 u_int8_t lsb;
103 u_int8_t msb : 6,
104 reserved : 2;
105} __attribute__((packed));
106
107/* SSN == subsystem number */
108enum sccp_subsystem_number {
109 SCCP_SSN_NOT_KNOWN_OR_USED = 0,
110 SCCP_SSN_MANAGEMENT = 1,
111 SCCP_SSN_RESERVED_ITU = 2,
112 SCCP_SSN_ISDN_USER_PART = 3,
113 SCCP_SSN_OMAP = 4, /* operation, maint and administration part */
114 SCCP_SSN_MAP = 5, /* mobile application part */
115 SCCP_SSN_HLR = 6,
116 SCCP_SSN_VLR = 7,
117 SCCP_SSN_MSC = 8,
118 SCCP_SSN_EIC = 9, /* equipent identifier centre */
119 SCCP_SSN_AUC = 10, /* authentication centre */
120 SCCP_SSN_ISDN_SUPPL_SERVICES = 11,
121 SCCP_SSN_RESERVED_INTL = 12,
122 SCCP_SSN_ISDN_EDGE_TO_EDGE = 13,
123 SCCP_SSN_TC_TEST_RESPONDER = 14,
124
125 /* From GSM 03.03 8.2 */
126 SCCP_SSN_BSSAP = 254,
127 SCCP_SSN_BSSOM = 253,
128};
129
130/* Q.713, 3.4.2.3 */
131enum {
132 SCCP_NAI_UNKNOWN = 0,
133 SCCP_NAI_SUBSCRIBER_NUMBER = 1,
134 SCCP_NAI_RESERVED_NATIONAL = 2,
135 SCCP_NAI_NATIONAL_SIGNIFICANT = 3,
136 SCCP_NAI_INTERNATIONAL = 4,
137};
138
139struct sccp_global_title {
140 u_int8_t nature_of_addr_ind : 7,
141 odd_even : 1;
142 u_int8_t data[0];
143} __attribute__((packed));
144
145/* Q.713, 3.3 */
146struct sccp_source_reference {
147 u_int8_t octet1;
148 u_int8_t octet2;
149 u_int8_t octet3;
150} __attribute__((packed));
151
152/* Q.714, 3.6 */
153enum sccp_protocol_class {
154 SCCP_PROTOCOL_CLASS_0 = 0,
155 SCCP_PROTOCOL_CLASS_1 = 1,
156 SCCP_PROTOCOL_CLASS_2 = 2,
157 SCCP_PROTOCOL_CLASS_3 = 3,
158};
159
160/* bits 5-8 when class0, class1 is used */
161enum sccp_protocol_options {
162 SCCP_PROTOCOL_NO_SPECIAL = 0,
163 SCCP_PROTOCOL_RETURN_MESSAGE = 8,
164};
165
166enum sccp_release_cause {
167 SCCP_RELEASE_CAUSE_END_USER_ORIGINATED = 0,
168 SCCP_RELEASE_CAUSE_END_USER_CONGESTION = 1,
169 SCCP_RELEASE_CAUSE_END_USER_FAILURE = 2,
170 SCCP_RELEASE_CAUSE_SCCP_USER_ORIGINATED = 3,
171 SCCP_RELEASE_CAUSE_REMOTE_PROCEDURE_ERROR = 4,
172 SCCP_RELEASE_CAUSE_INCONSISTENT_CONN_DATA = 5,
173 SCCP_RELEASE_CAUSE_ACCESS_FAILURE = 6,
174 SCCP_RELEASE_CAUSE_ACCESS_CONGESTION = 7,
175 SCCP_RELEASE_CAUSE_SUBSYSTEM_FAILURE = 8,
176 SCCP_RELEASE_CAUSE_SUBSYSTEM_CONGESTION = 9,
177 SCCP_RELEASE_CAUSE_MTP_FAILURE = 10,
178 SCCP_RELEASE_CAUSE_NETWORK_CONGESTION = 11,
179 SCCP_RELEASE_CAUSE_EXPIRATION_RESET = 12,
180 SCCP_RELEASE_CAUSE_EXPIRATION_INACTIVE = 13,
181 SCCP_RELEASE_CAUSE_RESERVED = 14,
182 SCCP_RELEASE_CAUSE_UNQUALIFIED = 15,
183 SCCP_RELEASE_CAUSE_SCCP_FAILURE = 16,
184};
185
186enum sccp_return_cause {
187 SCCP_RETURN_CAUSE_NO_TRANSLATION_NATURE = 0,
188 SCCP_RETURN_CAUSE_NO_TRANSLATION = 1,
189 SCCP_RETURN_CAUSE_SUBSYSTEM_CONGESTION = 2,
190 SCCP_RETURN_CAUSE_SUBSYSTEM_FAILURE = 3,
191 SCCP_RETURN_CAUSE_UNEQUIPPED_USER = 4,
192 SCCP_RETURN_CAUSE_MTP_FAILURE = 5,
193 SCCP_RETURN_CAUSE_NETWORK_CONGESTION = 6,
194 SCCP_RETURN_CAUSE_UNQUALIFIED = 7,
195 SCCP_RETURN_CAUSE_ERROR_IN_MSG_TRANSPORT = 8,
196 SCCP_RETURN_CAUSE_ERROR_IN_LOCAL_PROCESSING = 9,
197 SCCP_RETURN_CAUSE_DEST_CANNOT_PERFORM_REASSEMBLY = 10,
198 SCCP_RETURN_CAUSE_SCCP_FAILURE = 11,
199 SCCP_RETURN_CAUSE_HOP_COUNTER_VIOLATION = 12,
200 SCCP_RETURN_CAUSE_SEGMENTATION_NOT_SUPPORTED= 13,
201 SCCP_RETURN_CAUSE_SEGMENTATION_FAOLURE = 14
202};
203
204enum sccp_reset_cause {
205 SCCP_RESET_CAUSE_END_USER_ORIGINATED = 0,
206 SCCP_RESET_CAUSE_SCCP_USER_ORIGINATED = 1,
207 SCCP_RESET_CAUSE_MSG_OUT_OF_ORDER_PS = 2,
208 SCCP_RESET_CAUSE_MSG_OUT_OF_ORDER_PR = 3,
209 SCCP_RESET_CAUSE_RPC_OUT_OF_WINDOW = 4,
210 SCCP_RESET_CAUSE_RPC_INCORRECT_PS = 5,
211 SCCP_RESET_CAUSE_RPC_GENERAL = 6,
212 SCCP_RESET_CAUSE_REMOTE_END_USER_OPERATIONAL= 7,
213 SCCP_RESET_CAUSE_NETWORK_OPERATIONAL = 8,
214 SCCP_RESET_CAUSE_ACCESS_OPERATIONAL = 9,
215 SCCP_RESET_CAUSE_NETWORK_CONGESTION = 10,
216 SCCP_RESET_CAUSE_RESERVED = 11,
217};
218
219enum sccp_error_cause {
220 SCCP_ERROR_LRN_MISMATCH_UNASSIGNED = 0, /* local reference number */
221 SCCP_ERROR_LRN_MISMATCH_INCONSISTENT = 1,
222 SCCP_ERROR_POINT_CODE_MISMATCH = 2,
223 SCCP_ERROR_SERVICE_CLASS_MISMATCH = 3,
224 SCCP_ERROR_UNQUALIFIED = 4,
225};
226
227enum sccp_refusal_cause {
228 SCCP_REFUSAL_END_USER_ORIGINATED = 0,
229 SCCP_REFUSAL_END_USER_CONGESTION = 1,
230 SCCP_REFUSAL_END_USER_FAILURE = 2,
231 SCCP_REFUSAL_SCCP_USER_ORIGINATED = 3,
232 SCCP_REFUSAL_DESTINATION_ADDRESS_UKNOWN = 4,
233 SCCP_REFUSAL_DESTINATION_INACCESSIBLE = 5,
234 SCCP_REFUSAL_NET_QOS_NON_TRANSIENT = 6,
235 SCCP_REFUSAL_NET_QOS_TRANSIENT = 7,
236 SCCP_REFUSAL_ACCESS_FAILURE = 8,
237 SCCP_REFUSAL_ACCESS_CONGESTION = 9,
238 SCCP_REFUSAL_SUBSYSTEM_FAILURE = 10,
239 SCCP_REFUSAL_SUBSYTEM_CONGESTION = 11,
240 SCCP_REFUSAL_EXPIRATION = 12,
241 SCCP_REFUSAL_INCOMPATIBLE_USER_DATA = 13,
242 SCCP_REFUSAL_RESERVED = 14,
243 SCCP_REFUSAL_UNQUALIFIED = 15,
244 SCCP_REFUSAL_HOP_COUNTER_VIOLATION = 16,
245 SCCP_REFUSAL_SCCP_FAILURE = 17,
246 SCCP_REFUSAL_UNEQUIPPED_USER = 18,
247};
248
249/*
250 * messages... as of Q.713 Chapter 4
251 */
252struct sccp_connection_request {
253 /* mandantory */
254 u_int8_t type;
255 struct sccp_source_reference source_local_reference;
256 u_int8_t proto_class;
257
258
259 /* variable */
260 u_int8_t variable_called;
261#if VARIABLE
262 called_party_address
263#endif
264
265 /* optional */
266 u_int8_t optional_start;
267
268#if OPTIONAL
269 credit 3
270 callingparty var 4-n
271 data 3-130
272 hop_counter 3
273 importance 3
274 end_of_optional 1
275#endif
276
277 u_int8_t data[0];
278} __attribute__((packed));
279
280struct sccp_connection_confirm {
281 /* mandantory */
282 u_int8_t type;
283 struct sccp_source_reference destination_local_reference;
284 struct sccp_source_reference source_local_reference;
285 u_int8_t proto_class;
286
287 /* optional */
288 u_int8_t optional_start;
289
290 /* optional */
291#if OPTIONAL
292 credit 3
293 called party 4
294 data 3-130
295 importance 3
296 end_of_optional 1
297#endif
298
299 u_int8_t data[0];
300} __attribute__((packed));
301
302struct sccp_connection_refused {
303 /* mandantory */
304 u_int8_t type;
305 struct sccp_source_reference destination_local_reference;
306 u_int8_t cause;
307
308 /* optional */
309 u_int8_t optional_start;
310
311 /* optional */
312#if OPTIONAL
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_released {
323 /* mandantory */
324 u_int8_t type;
325 struct sccp_source_reference destination_local_reference;
326 struct sccp_source_reference source_local_reference;
327 u_int8_t release_cause;
328
329
330 /* optional */
331 u_int8_t optional_start;
332
333#if OPTIONAL
334 data 3-130
335 importance 3
336 end_of_optional 1
337#endif
338 u_int8_t data[0];
339} __attribute__((packed));
340
341struct sccp_connection_release_complete {
342 u_int8_t type;
343 struct sccp_source_reference destination_local_reference;
344 struct sccp_source_reference source_local_reference;
345} __attribute__((packed));
346
347struct sccp_data_form1 {
348 /* mandantory */
349 u_int8_t type;
350 struct sccp_source_reference destination_local_reference;
351 u_int8_t segmenting;
352
353 /* variable */
354 u_int8_t variable_start;
355
356#if VARIABLE
357 data 2-256;
358#endif
359
360 u_int8_t data[0];
361} __attribute__((packed));
362
363
364struct sccp_data_unitdata {
365 /* mandantory */
366 u_int8_t type;
367 u_int8_t proto_class;
368
369
370 /* variable */
371 u_int8_t variable_called;
372 u_int8_t variable_calling;
373 u_int8_t variable_data;
374
375#if VARIABLE
376 called party address
377 calling party address
378#endif
379
380 u_int8_t data[0];
381} __attribute__((packed));
382
383#endif