2 * Routines for output and filtering of E164 numbers common
4 * Copyright 2004, Anders Broman <anders.broman@ericsson.com>
6 * $Id: packet-e164.c,v 1.2 2004/03/19 10:24:43 guy Exp $
8 * Ethereal - Network traffic analyzer
9 * By Gerald Combs <gerald@ethereal.com>
10 * Copyright 1998 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 * Ref ITU-T E.164 05/97
35 #include <epan/packet.h>
36 #include "packet-e164.h"
38 const value_string E164_country_code_value[] = {
39 { 0x00, "Reserved (Assignment of all 0XX codes will be feasible after 31 December 2000. This question is currently under study.)"},
42 { 0x0210,"Spare code"},
43 { 0x0211,"Spare code"},
46 { 0x0214,"spare code"},
47 { 0x0215,"spare code"},
49 { 0x0217,"Spare code"},
51 { 0x0219,"Spare code"},
54 { 0x0222,"Mauritania"},
57 { 0x0225,"Ivory Coast"},
58 { 0x0226,"Burkina Faso"},
60 { 0x0228,"Togolese Republic"},
62 { 0x0230,"Mauritius"},
64 { 0x0232,"Sierra Leone"},
68 { 0x0236,"Central African Republic"},
70 { 0x0238,"Cape Verde"},
71 { 0x0239,"Sao Tome and Principe"},
72 { 0x0240,"Equatorial Guinea"},
73 { 0x0241,"Gabonese Republic"},
74 { 0x0242,"Republic of Congo"},
75 { 0x0243,"Democratic Republic of Congo"},
77 { 0x0245,"Guinea-Bissau"},
78 { 0x0246,"Diego Garcia"},
79 { 0x0247,"Ascension"},
80 { 0x0248,"Seychelles"},
82 { 0x0250,"Rwandese Republic"},
90 { 0x0258,"Mozambique"},
91 { 0x0259,"Spare code"},
93 { 0x0261,"Madagascar"},
94 { 0x0262,"Reunion Island"},
100 { 0x0268,"Swaziland"},
101 { 0x0269,"Comoros Mayotte"},
102 { 0x027,"South Africa"},
103 { 0x0281,"spare code"},
104 { 0x0282,"spare code"},
105 { 0x0283,"spare code"},
106 { 0x0284,"spare code"},
107 { 0x0285,"spare code"},
108 { 0x0286,"spare code"},
109 { 0x0287,"spare code"},
110 { 0x0288,"spare code"},
111 { 0x0289,"spare code"},
112 { 0x0290,"Saint Helena"},
114 { 0x0292,"spare code"},
115 { 0x0293,"spare code"},
116 { 0x0294,"spare code"},
117 { 0x0295,"spare code"},
118 { 0x0296,"spare code"},
120 { 0x0298,"Faroe Islands"},
121 { 0x0299,"Greenland"},
123 { 0x031,"Netherlands"},
127 { 0x0350,"Gibraltar"},
128 { 0x0351,"Portugal"},
129 { 0x0352,"Luxembourg"},
136 { 0x0359,"Bulgaria"},
138 { 0x0370,"Lithuania"},
146 { 0x0378,"San Marino"},
149 { 0x0381,"Yugoslavia"},
150 { 0x0382,"spare code"},
151 { 0x0383,"spare code"},
152 { 0x0384,"spare code"},
154 { 0x0386,"Slovenia"},
155 { 0x0387,"Bosnia and Herzegovina"},
156 { 0x0388,"Groups of contries:"},
157 { 0x0389,"Macedonia"},
160 { 0x041,"Switzerland"},
161 { 0x0420,"Czech Republic"},
162 { 0x0421,"Slovak Republic"},
163 { 0x0422,"Spare code"},
164 { 0x0423,"Liechtenstein"},
165 { 0x0424,"spare code"},
166 { 0x0425,"spare code"},
167 { 0x0426,"spare code"},
168 { 0x0427,"spare code"},
169 { 0x0428,"spare code"},
170 { 0x0429,"spare code"},
172 { 0x044,"United Kingdom"},
178 { 0x0500,"Falkland Islands (Malvinas)"},
180 { 0x0502,"Guatemala"},
181 { 0x0503,"El Salvador"},
182 { 0x0504,"Honduras"},
183 { 0x0505,"Nicaragua"},
184 { 0x0506,"Costa Rica"},
186 { 0x0508,"Saint Pierre and Miquelon"},
191 { 0x054,"Argentina"},
195 { 0x058,"Venezuela"},
196 { 0x0590,"Guadeloupe"},
200 { 0x0594,"French Guiana"},
201 { 0x0595,"Paraguay"},
202 { 0x0596,"Martinique"},
203 { 0x0597,"Suriname"},
205 { 0x0599,"Netherlands Antilles"},
207 { 0x061,"Australia"},
208 { 0x062,"Indonesia"},
209 { 0x063,"Philippines"},
210 { 0x064,"New Zealand"},
211 { 0x065,"Singapore"},
213 { 0x0670,"East Timor"},
214 { 0x0671,"Spare code"},
215 { 0x0672,"Australian External Territories"},
216 { 0x0673,"Brunei Darussalam"},
218 { 0x0675,"Papua New Guinea"},
220 { 0x0677,"Solomon Islands"},
224 { 0x0681,"Wallis and Futuna"},
225 { 0x0682,"Cook Islands"},
227 { 0x0684,"American Samoa"},
229 { 0x0686,"Kiribati"},
230 { 0x0687,"New Caledonia"},
232 { 0x0689,"French Polynesia"},
234 { 0x0691,"Micronesia"},
235 { 0x0692,"Marshall Islands"},
236 { 0x0693,"spare code"},
237 { 0x0694,"spare code"},
238 { 0x0695,"spare code"},
239 { 0x0696,"spare code"},
240 { 0x0697,"spare code"},
241 { 0x0698,"spare code"},
242 { 0x0699,"spare code"},
243 { 0x07,"Russian Federation,Kazakstan"},
244 { 0x0800,"International Freephone Service (see E.169.1)"},
245 { 0x0801,"spare code"},
246 { 0x0802,"spare code"},
247 { 0x0803,"spare code"},
248 { 0x0804,"spare code"},
249 { 0x0805,"spare code"},
250 { 0x0806,"spare code"},
251 { 0x0807,"spare code"},
252 { 0x0808,"Universal International Shared Cost Number (see E.169.3)"},
253 { 0x0809,"Spare code"},
255 { 0x082,"Korea (Republic of)"},
256 { 0x0830,"Spare code"},
257 { 0x0831,"Spare code"},
258 { 0x0832,"Spare code"},
259 { 0x0833,"Spare code"},
260 { 0x0834,"Spare code"},
261 { 0x0835,"Spare code"},
262 { 0x0836,"Spare code"},
263 { 0x0837,"Spare code"},
264 { 0x0838,"Spare code"},
265 { 0x0839,"Spare code"},
267 { 0x0850,"Democratic People's Republic of Korea"},
268 { 0x0851,"Spare code"},
269 { 0x0852,"Hongkong, China"},
270 { 0x0853,"Macau, China"},
271 { 0x0854,"Spare code"},
272 { 0x0855,"Cambodia"},
274 { 0x0857,"Spare code"},
275 { 0x0858,"Spare code"},
276 { 0x0859,"Spare code"},
277 { 0x086,"China (People's Republic of)"},
278 { 0x0870,"Inmarsat SNAC"},
279 { 0x0871,"Inmarsat (Atlantic Ocean-East)"},
280 { 0x0872,"Inmarsat (Pacific Ocean)"},
281 { 0x0873,"Inmarsat (Indian Ocean)"},
282 { 0x0874,"Inmarsat (Atlantic Ocean-West)"},
283 { 0x0875,"Reserved - Maritime Mobile Service Applications"},
284 { 0x0876,"Reserved - Maritime Mobile Service Applications"},
285 { 0x0877,"Reserved - Maritime Mobile Service Applications"},
286 { 0x0878,"Reserved - Universal Personal Telecommunication Service (UPT)"},
287 { 0x0879,"Reserved for national non-commercial purposes"},
288 { 0x0880,"Bangladesh"},
289 { 0x0881,"Global Mobile Satellite System (GMSS), shared code:"},
290 { 0x0882,"International Networks: (see E.164)"},
291 { 0x0883,"Spare code"},
292 { 0x0884,"Spare code"},
293 { 0x0885,"Spare code"},
294 { 0x0886,"Reserved"},
295 { 0x0887,"Spare code"},
296 { 0x0888,"Reserved for future global services (see E.164)"},
297 { 0x0889,"Spare code"},
298 { 0x0890,"Spare code"},
299 { 0x0891,"Spare code"},
300 { 0x0892,"Spare code"},
301 { 0x0893,"Spare code"},
302 { 0x0894,"Spare code"},
303 { 0x0895,"Spare code"},
304 { 0x0896,"Spare code"},
305 { 0x0897,"Spare code"},
306 { 0x0898,"Spare code"},
307 { 0x0899,"Spare code"},
311 { 0x093,"Afghanistan"},
312 { 0x094,"Sri Lanka"},
314 { 0x0960,"Maldives"},
317 { 0x0963,"Syrian Arab Republic"},
320 { 0x0966,"Saudi Arabia"},
323 { 0x0969,"Reserved"},
324 { 0x0970,"Reserved"},
325 { 0x0971,"United Arab Emirates"},
330 { 0x0976,"Mongolia"},
332 { 0x0978,"Spare code"},
333 { 0x0979,"Universal International Premium Rate Number (see E.169.2)"},
335 { 0x0990,"Spare code"},
336 { 0x0991,"Trial service (see E.164.2)"},
337 { 0x0992,"Tajikstan"},
338 { 0x0993,"Turkmenistan"},
339 { 0x0994,"Azerbaijani Republic"},
341 { 0x0996,"Kyrgyz Republic"},
342 { 0x0997,"Spare code"},
343 { 0x0998,"Uzbekistan"},
344 { 0x0999,"Spare code"},
347 const value_string E164_International_Networks_vals[] = {
348 { 0x10, "British Telecommunications"},
349 { 0x11, "Singapore Telecommunications"},
350 { 0x12, "MCIWorldCom"},
351 { 0x13, "Telespazio"},
354 { 0x16, "United Arab Emirates"},
356 { 0x18, "Teledesic"},
357 { 0x19, "Telecom Italia"},
358 { 0x20, "Asia Cellular Satellite"},
359 { 0x21, "Ameritech"},
360 { 0x22, "Cable & Wireless"},
361 { 0x23, "Sita-Equant"},
363 { 0x25, "Constellation Communications"},
364 { 0x26, "SBC Communications"},
368 static int proto_e164 = -1;
369 static int hf_E164_calling_party_number = -1;
370 static int hf_E164_called_party_number = -1;
375 dissect_e164_number(tvbuff_t *tvb, proto_tree *tree, int offset,
376 int length,e164_info_t e164_info)
378 switch (e164_info.e164_number_type){
379 case CALLING_PARTY_NUMBER :
380 proto_tree_add_string(tree, hf_E164_calling_party_number, tvb, offset,
381 length, e164_info.E164_number_str);
384 case CALLED_PARTY_NUMBER :
385 proto_tree_add_string(tree, hf_E164_called_party_number, tvb, offset,
386 length, e164_info.E164_number_str);
396 * Register the protocol with Ethereal.
398 * This format is required because a script is used to build the C function
399 * that calls all the protocol registration.
403 proto_register_e164(void)
406 /* Setup list of header fields See Section 1.6.1 for details */
407 static hf_register_info hf[] = {
408 { &hf_E164_calling_party_number,
409 { "E.164 Calling party number digits", "e164.calling_party_number.digits",
410 FT_STRING, BASE_NONE, NULL, 0x0,
413 { &hf_E164_called_party_number,
414 { "E.164 Called party number digits", "e164.called_party_number.digits",
415 FT_STRING, BASE_NONE, NULL, 0x0,
420 * Register the protocol name and description
422 proto_e164 = proto_register_protocol(
423 "ITU-T E.164 number",
428 * Required function calls to register
429 * the header fields and subtrees used.
431 proto_register_field_array(proto_e164, hf, array_length(hf));