2 * Routines for output and filtering of E.212 numbers common
4 * Copyright 2006, Anders Broman <anders.broman@ericsson.com>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
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 COMPLEMENT TO ITU-T RECOMMENDATION E.212 (11/98)
35 #include <epan/packet.h>
37 #include "packet-e212.h"
40 const value_string E212_codes[] = {
42 { 204, "Netherlands (Kingdom of the)" },
45 { 212, "Monaco (Principality of)" },
46 { 213, "Andorra (Principality of)" },
48 { 216, "Hungary (Republic of)" },
49 { 218, "Bosnia and Herzegovina" },
50 { 219, "Croatia (Republic of)" },
51 { 220, "Serbia and Montenegro" },
53 { 225, "Vatican City State" },
55 { 228, "Switzerland (Confederation of)" },
56 { 230, "Czech Republic" },
57 { 231, "Slovak Republic" },
59 { 234, "United Kingdom of Great Britain and Northern Ireland" },
60 { 235, "United Kingdom of Great Britain and Northern Ireland" },
65 { 246, "Lithuania (Republic of)" },
66 { 247, "Latvia (Republic of)" },
67 { 248, "Estonia (Republic of)" },
68 { 250, "Russian Federation" },
70 { 257, "Belarus (Republic of)" },
71 { 259, "Moldova (Republic of)" },
72 { 260, "Poland (Republic of)" },
73 { 262, "Germany (Federal Republic of)" },
76 { 270, "Luxembourg" },
79 { 276, "Albania (Republic of)" },
81 { 280, "Cyprus (Republic of)" },
83 { 283, "Armenia (Republic of)" },
84 { 284, "Bulgaria (Republic of)" },
86 { 288, "Faroe Islands" },
87 { 290, "Greenland (Denmark)" },
88 { 292, "San Marino (Republic of)" },
89 { 293, "Slovenia (Republic of)" },
90 { 294, "The Former Yugoslav Republic of Macedonia" },
91 { 295, "Liechtenstein (Principality of)" },
93 { 308, "Saint Pierre and Miquelon (Collectivite territoriale de la Republique francaise)" },
94 { 310, "United States of America" },
95 { 311, "United States of America" },
96 { 312, "United States of America" },
97 { 313, "United States of America" },
98 { 314, "United States of America" },
99 { 315, "United States of America" },
100 { 316, "United States of America" },
101 { 330, "Puerto Rico" },
102 { 332, "United States Virgin Islands" },
105 { 340, "Martinique (French Department of)" },
106 { 340, "Guadeloupe (French Department of)" },
108 { 344, "Antigua and Barbuda" },
109 { 346, "Cayman Islands" },
110 { 348, "British Virgin Islands" },
113 { 354, "Montserrat" },
114 { 356, "Saint Kitts and Nevis" },
115 { 358, "Saint Lucia" },
116 { 360, "Saint Vincent and the Grenadines" },
117 { 362, "Netherlands Antilles" },
119 { 364, "Bahamas (Commonwealth of the)" },
121 { 366, "Dominica (Commonwealth of)" },
123 { 370, "Dominican Republic" },
124 { 372, "Haiti (Republic of)" },
125 { 374, "Trinidad and Tobago" },
126 { 376, "Turks and Caicos Islands" },
127 { 400, "Azerbaijani Republic" },
128 { 401, "Kazakhstan (Republic of)" },
129 { 402, "Bhutan (Kingdom of)" },
130 { 404, "India (Republic of)" },
131 { 410, "Pakistan (Islamic Republic of)" },
132 { 412, "Afghanistan" },
133 { 413, "Sri Lanka (Democratic Socialist Republic of)" },
134 { 414, "Myanmar (Union of)" },
136 { 416, "Jordan (Hashemite Kingdom of)" },
137 { 417, "Syrian Arab Republic" },
138 { 418, "Iraq (Republic of)" },
139 { 419, "Kuwait (State of)" },
140 { 420, "Saudi Arabia (Kingdom of)" },
141 { 421, "Yemen (Republic of)" },
142 { 422, "Oman (Sultanate of)" },
143 { 424, "United Arab Emirates" },
144 { 425, "Israel (State of)" },
145 { 426, "Bahrain (Kingdom of)" },
146 { 427, "Qatar (State of)" },
149 { 430, "United Arab Emirates (Abu Dhabi)" },
150 { 431, "United Arab Emirates (Dubai)" },
151 { 432, "Iran (Islamic Republic of)" },
152 { 434, "Uzbekistan (Republic of)" },
153 { 436, "Tajikistan (Republic of)" },
154 { 437, "Kyrgyz Republic" },
155 { 438, "Turkmenistan" },
158 { 450, "Korea (Republic of)" },
159 { 452, "Viet Nam (Socialist Republic of)" },
160 { 454, "Hongkong, China" },
161 { 455, "Macao, China" },
162 { 456, "Cambodia (Kingdom of)" },
163 { 457, "Lao People's Democratic Republic" },
164 { 460, "China (People's Republic of)" },
165 { 461, "China (People's Republic of)" },
166 { 466, "Taiwan, China" },
167 { 467, "Democratic People's Republic of Korea" },
168 { 470, "Bangladesh (People's Republic of)" },
169 { 472, "Maldives (Republic of)" },
171 { 505, "Australia" },
172 { 510, "Indonesia (Republic of)" },
173 { 514, "Democratique Republic of Timor-Leste" },
174 { 515, "Philippines (Republic of the)" },
176 { 525, "Singapore (Republic of)" },
177 { 528, "Brunei Darussalam" },
178 { 530, "New Zealand" },
179 { 534, "Northern Mariana Islands (Commonwealth of the)" },
181 { 536, "Nauru (Republic of)" },
182 { 537, "Papua New Guinea" },
183 { 539, "Tonga (Kingdom of)" },
184 { 540, "Solomon Islands" },
185 { 541, "Vanuatu (Republic of)" },
186 { 542, "Fiji (Republic of)" },
187 { 543, "Wallis and Futuna (Territoire francais d'outre-mer)" },
188 { 544, "American Samoa" },
189 { 545, "Kiribati (Republic of)" },
190 { 546, "New Caledonia (Territoire francais d'outre-mer)" },
191 { 547, "French Polynesia (Territoire francais d'outre-mer)" },
192 { 548, "Cook Islands" },
193 { 549, "Samoa (Independent State of)" },
194 { 550, "Micronesia (Federated States of)" },
195 { 551, "Marshall Islands (Republic of the)" },
196 { 552, "Palau (Republic of)" },
197 { 602, "Egypt (Arab Republic of)" },
198 { 603, "Algeria (People's Democratic Republic of)" },
199 { 604, "Morocco (Kingdom of)" },
201 { 606, "Libya (Socialist People's Libyan Arab Jamahiriya)" },
202 { 607, "Gambia (Republic of the)" },
203 { 608, "Senegal (Republic of)" },
204 { 609, "Mauritania (Islamic Republic of)" },
205 { 610, "Mali (Republic of)" },
206 { 611, "Guinea (Republic of)" },
207 { 612, "Cote d'Ivoire (Republic of)" },
208 { 613, "Burkina Faso" },
209 { 614, "Niger (Republic of the)" },
210 { 615, "Togolese Republic" },
211 { 616, "Benin (Republic of)" },
212 { 617, "Mauritius (Republic of)" },
213 { 618, "Liberia (Republic of)" },
214 { 619, "Sierra Leone" },
216 { 621, "Nigeria (Federal Republic of)" },
217 { 622, "Chad (Republic of)" },
218 { 623, "Central African Republic" },
219 { 624, "Cameroon (Republic of)" },
220 { 625, "Cape Verde (Republic of)" },
221 { 626, "Sao Tome and Principe (Democratic Republic of)" },
222 { 627, "Equatorial Guinea (Republic of)" },
223 { 628, "Gabonese Republic" },
224 { 629, "Congo (Republic of the)" },
225 { 630, "Democratic Republic of the Congo" },
226 { 631, "Angola (Republic of)" },
227 { 632, "Guinea-Bissau (Republic of)" },
228 { 633, "Seychelles (Republic of)" },
229 { 634, "Sudan (Republic of the)" },
230 { 635, "Rwandese Republic" },
231 { 636, "Ethiopia (Federal Democratic Republic of)" },
232 { 637, "Somali Democratic Republic" },
233 { 638, "Djibouti (Republic of)" },
234 { 639, "Kenya (Republic of)" },
235 { 640, "Tanzania (United Republic of)" },
236 { 641, "Uganda (Republic of)" },
237 { 642, "Burundi (Republic of)" },
238 { 643, "Mozambique (Republic of)" },
239 { 645, "Zambia (Republic of)" },
240 { 646, "Madagascar (Republic of)" },
241 { 647, "Reunion (French Department of)" },
242 { 648, "Zimbabwe (Republic of)" },
243 { 649, "Namibia (Republic of)" },
245 { 651, "Lesotho (Kingdom of)" },
246 { 652, "Botswana (Republic of)" },
247 { 653, "Swaziland (Kingdom of)" },
248 { 654, "Comoros (Union of the)" },
249 { 655, "South Africa (Republic of)" },
252 { 704, "Guatemala (Republic of)" },
253 { 706, "El Salvador (Republic of)" },
254 { 708, "Honduras (Republic of)" },
255 { 710, "Nicaragua" },
256 { 712, "Costa Rica" },
257 { 714, "Panama (Republic of)" },
259 { 722, "Argentine Republic" },
260 { 724, "Brazil (Federative Republic of)" },
262 { 732, "Colombia (Republic of)" },
263 { 734, "Venezuela (Bolivarian Republic of)" },
264 { 736, "Bolivia (Republic of)" },
267 { 742, "French Guiana (French Department of)" },
268 { 744, "Paraguay (Republic of)" },
269 { 746, "Suriname (Republic of)" },
270 { 748, "Uruguay (Eastern Republic of)" },
271 { 901, "International Mobile, shared code" },
275 static int proto_e212 = -1;
276 static int hf_E212_mcc = -1;
277 static int hf_E212_mnc = -1;
278 static int hf_E212_msin = -1;
282 * MCC digit 2 MCC digit 1 octet x
283 * MNC digit 3 MCC digit 3 octet x+1
284 * MNC digit 2 MNC digit 1 octet x+2
289 dissect_e212_mcc_mnc(tvbuff_t *tvb, proto_tree *tree, int offset){
294 guint8 mcc1, mcc2, mcc3, mnc1, mnc2, mnc3;
296 start_offset = offset;
297 /* Mobile country code MCC */
298 octet = tvb_get_guint8(tvb,offset);
302 octet = tvb_get_guint8(tvb,offset);
304 /* MNC, Mobile network code (octet 3 bits 5 to 8, octet 4) */
307 octet = tvb_get_guint8(tvb,offset);
311 mcc = 100 * mcc1 + 10 * mcc2 + mcc3;
312 mnc = 10 * mnc1 + mnc2;
314 mnc = 10 * mnc + mnc3;
316 proto_tree_add_uint(tree, hf_E212_mcc , tvb, start_offset, 2, mcc );
317 proto_tree_add_uint(tree, hf_E212_mnc , tvb, start_offset + 1, 2, mnc );
323 * Register the protocol with Wireshark.
325 * This format is required because a script is used to build the C function
326 * that calls all the protocol registration.
331 proto_register_e212(void)
334 /* Setup list of header fields See Section 1.6.1 for details */
335 static hf_register_info hf[] = {
337 { "Mobile Country Code (MCC)","e212.mcc",
338 FT_UINT16, BASE_DEC, VALS(E212_codes), 0x0,
339 "Mobile Country Code MCC", HFILL }
342 { "Mobile network code (MNC)","e212.mnc",
343 FT_UINT16, BASE_DEC, NULL, 0x0,
344 "Mobile network code", HFILL }
347 { "Mobile Subscriber Identification Number (MSIN)", "e212.msin",
348 FT_STRING, BASE_NONE, NULL, 0,
349 "Mobile Subscriber Identification Number(MSIN)", HFILL }},
353 * Register the protocol name and description
355 proto_e212 = proto_register_protocol(
356 "ITU-T E.212 number",
361 * Required function calls to register
362 * the header fields and subtrees used.
364 proto_register_field_array(proto_e212, hf, array_length(hf));