5 A Linux/Unix toolset and driver for Nokia mobile phones.
7 Released under the terms of the GNU GPL, see file COPYING for more details.
9 This file implements GSM networks searching.
17 #include "gsm-common.h"
18 #include "gsm-networks.h"
19 #include "gsm-coding.h"
21 static GSM_Country GSM_Countries[] =
24 { "204", "Netherlands" },
30 { "218", "Bosnia Herzegovina" },
32 { "220", "Yugoslavia" },
35 { "228", "Switzerland" },
36 { "230", "Czech Republic" },
37 { "231", "Slovak Republic" },
39 { "234", "United Kingdom" },
44 { "246", "Lithuania" },
52 { "266", "Gibraltar" },
53 { "268", "Portugal" },
54 { "270", "Luxembourg" },
62 { "284", "Bulgaria" },
64 { "290", "Greenland" },
65 { "293", "Slovenia" },
66 { "294", "Macedonia" },
68 { "310", "Papua New Guinea" },
70 { "340", "French West Indies" },
71 { "400", "Azerbaijan" },
73 { "410", "Pakistan" },
74 { "413", "Sri Lanka" },
80 { "420", "Saudi Arabia" },
82 { "424", "United Arab Emirates" },
87 { "434", "Uzbekistan" },
88 { "437", "Kyrgyz Republic" },
90 { "454", "Hong Kong" },
92 { "456", "Cambodia" },
96 { "470", "Bangladesh" },
97 { "502", "Malaysia" },
98 { "505", "Australia" },
99 { "510", "Indonesia" },
100 { "515", "Philippines" },
101 { "520", "Thailand" },
102 { "525", "Singapore" },
103 { "528", "Brunei Darussalam" },
104 { "530", "New Zealand" },
106 { "546", "New Caledonia" },
107 { "547", "French Polynesia" },
109 { "603", "Algeria" },
110 { "604", "Morocco" },
111 { "605", "Tunisia" },
112 { "608", "Senegal" },
114 { "612", "Cote d'Ivoire" },
116 { "617", "Mauritius" },
117 { "618", "Liberia" },
119 { "624", "Cameroon" },
120 { "625", "Cape Verde" },
121 { "633", "Seychelles" },
122 { "634", "Mozambique" },
125 { "636", "Ethiopia" },
126 { "640", "Tanzania" },
129 { "646", "Madagascar" },
130 { "647", "Reunion" },
131 { "648", "Zimbabwe" },
132 { "649", "Namibia" },
134 { "651", "Lesotho" },
135 { "652", "Botswana" },
136 { "655", "South Africa" },
138 { "734", "Venezuela" },
140 { "undefined", "unknown" }
143 GSM_Network GSM_Networks[] =
145 { "202 01", "Cosmote" },
146 { "202 05", "PANAFON" },
147 { "202 10", "TELESTET" },
148 { "204 04", "LIBERTEL" },
149 { "204 08", "KPN Telecom" },
150 { "204 12", "Telfort" },
152 { "204 20", "Dutchtone NV" },
153 { "206 01", "PROXIMUS" },
154 { "206 10", "Mobistar" },
155 { "208 01", "ITINERIS" },
157 { "208 20", "Bouygues Telecom" },
158 { "213 03", "MOBILAND" },
159 { "214 01", "Airtel GSM 900-Spain" },
160 { "214 03", "Retevision Movil" },
161 { "214 07", "MOVISTAR" },
162 { "216 01", "Pannon GSM" },
163 { "216 70", "Vodafone" },
164 { "216 30", "Westel 900" },
165 { "218 90", "GSMBIH" },
166 { "219 01", "CRONET" },
168 { "220 01", "MOBTEL" },
169 { "220 02", "ProMonte GSM" },
170 { "222 01", "Telecom Italia Mobile" },
171 { "222 10", "OMNITEL" },
172 { "222 88", "Wind Telecomunicazioni SpA" },
173 { "226 01", "CONNEX GSM" },
174 { "226 10", "DIALOG" },
175 { "228 01", "NATEL International" },
176 { "228 02", "diAx Mobile AG" },
177 { "230 01", "Paegas" },
178 { "230 02", "EuroTel" },
179 { "230 03", "Oskar" },
180 { "231 01", "Globtel" },
181 { "231 02", "EuroTel GSM" },
183 { "232 03", "max.mobil." },
185 { "232 07", "tele.ring" },
186 { "234 10", "Cellnet" },
187 { "234 15", "Vodafone" },
188 { "234 30", "One 2 One" },
189 { "234 33", "ORANGE" },
190 { "234 50", "Jersey Telecoms GSM" },
191 { "234 55", "Guernsey Telecoms GSM" },
192 { "234 58", "PRONTO GSM" },
193 { "238 01", "TDK-MOBIL" },
194 { "238 02", "SONOFON" },
195 { "238 20", "TELIA DK" },
196 { "238 30", "Mobilix" },
197 { "240 01", "Telia AB" },
198 { "240 07", "COMVIQ" },
199 { "240 08", "EUROPOLITAN" },
200 { "242 01", "Telenor Mobil" },
201 { "242 02", "NetCom GSM" },
202 { "244 03", "Telia City (Finland)" },
203 { "244 05", "Radiolinja" },
204 { "244 09", "Finnet" },
205 { "244 91", "Sonera" },
206 { "246 01", "OMNITEL" },
207 { "246 02", "Bite GSM" },
208 { "247 01", "LMT LV" },
209 { "247 02", "BALTCOM GSM" },
210 { "248 01", "EMT GSM" },
211 { "248 02", "Radiolinja Eesti AS" },
212 { "248 03", "Q GSM" },
213 { "250 01", "Mobile Telesystems" },
214 { "250 02", "North-West GSM" },
215 { "250 05", "Siberian Cellular Systems 900" },
216 { "250 07", "BM Telecom" },
217 { "250 10", "Don Telecom" },
218 { "250 12", "FECS-900" },
219 { "250 13", "Kuban GSM" },
220 { "250 39", "Uraltel" },
221 { "250 44", "North Caucasian GSM" },
222 { "250 99", "BeeLine" },
224 { "255 02", "WellCOM" },
225 { "255 03", "Kyivstar" },
226 { "255 05", "Golden Telecom" },
227 { "259 01", "VOXTEL" },
228 { "260 01", "PLUS GSM" },
229 { "260 02", "ERA GSM" },
230 { "260 03", "IDEA Centertel" },
231 { "262 01", "D1 TELEKOM" },
232 { "262 02", "D2 PRIVAT" },
233 { "262 03", "E-Plus" },
234 { "262 07", "Interkom" },
235 { "266 01", "Gibtel GSM" },
236 { "268 01", "TELECEL" },
237 { "268 03", "OPTIMUS" },
239 { "270 01", "LUXGSM" },
240 { "270 77", "TANGO" },
241 { "272 01", "EIRCELL-GSM" },
242 { "272 02", "Digifone" },
243 { "274 01", "Landssiminn GSM 900" },
244 { "274 02", "TAL hf" },
246 { "278 01", "Vodafone Malta Limited" },
247 { "280 01", "CYTAGSM" },
248 { "282 01", "Geocell Limited" },
249 { "282 02", "Magti GSM" },
250 { "283 01", "ArmGSM" },
251 { "284 01", "M-TEL GSM BG" },
252 { "286 01", "Turkcell" },
253 { "286 02", "TELSIM GSM" },
254 { "288 01", "Faroese Telecom" },
255 { "290 01", "Tele Greenland" },
256 { "293 40", "SI.MOBIL d. d." },
257 { "293 41", "MOBITEL" },
258 { "294 01", "MobiMak" },
259 { "302 37", "Microcell Connexions Inc" },
260 { "310 01", "Cellnet" },
261 { "310 02", "Sprint Spectrum" },
262 { "310 11", "Wireless 2000 Telephone Co." },
263 { "310 15", "BellSouth Mobility DCS" },
264 { "310 16", "Omnipoint" },
265 { "310 17", "Pac Bell" },
266 { "310 26", "VOICESTREAM" },
267 { "310 27", "Powertel" },
268 { "310 31", "AERIAL" },
269 { "310 77", "Iowa Wireless Services LP" },
270 { "340 01", "AMERIS" },
271 { "400 01", "AZERCELL GSM" },
272 { "400 02", "Bakcell GSM 2000" },
274 { "404 01", "AIRCELL"},
275 { "404 02", "Evergrowth"},
276 { "404 03", "Bharthi Telenet"},
277 { "404 05", "Fascel"},
278 { "404 07", "Tata Cell"}, //TATA Cellular
279 { "404 08", "Koshika"},
280 { "404 09", "Reliance"},
281 { "404 10", "AIRTEL"}, //AirTel
282 { "404 11", "Essar"}, //Essar Cellphone
283 { "404 12", "Escotel"},
284 { "404 14", "Spice"}, //Modicom
285 { "404 15", "AIRCELL"}, //Essar Cellphone
286 { "404 18", "Reliance"},
287 { "404 19", "Escotel"},
288 { "404 20", "Orange"}, //Max Touch
289 { "404 21", "BPL Mobile"}, //BPL - Mobile
290 { "404 22", "Birla AT&T"},
291 { "404 24", "Birla AT&T"},
292 { "404 26", "Koshika"},
293 { "404 27", "BPL Mobile"}, //BPL USWEST Cellular
294 { "404 30", "Usha"}, //Command
295 { "404 31", "AIRCELL"}, //?
296 { "404 31", "Command"}, //?
297 { "404 32", "Koshika"},
298 { "404 34", "Koshika"},
299 { "404 36", "Reliance"},
300 { "404 40", "SkyCell"},
301 { "404 41", "RPG"}, //RPG Cellular
302 { "404 42", "AIRCELL"}, //AIRCEL
303 { "404 43", "BPL Mobile"},
304 { "404 44", "Spice"},
305 { "404 45", "AIRTEL-blr"},
306 { "404 46", "BPL Moibile"},
307 { "404 49", "AIRTEL"},
308 { "404 50", "Reliance"},
309 { "404 52", "Reliance"},
310 { "404 56", "Escotel"},
311 { "404 60", "AIRCELL"},
312 { "404 67", "Reliance"},
313 { "404 70", "Hexacom"},
315 { "404 85", "Reliance"},
317 { "410 01", "Mobilink" },
318 { "413 02", "DIALOG GSM" },
319 { "415 01", "CELLIS" },
320 { "415 03", "LIBANCELL" },
321 { "416 01", "Fastlink" },
322 { "417 09", "MOBILE SYRIA" },
323 { "419 02", "MTCNet" },
324 { "420 01", "Al Jawwal" },
325 { "420 07", "E.A.E" },
327 { "424 02", "UAE-ETISALAT" },
328 { "425 01", "Partner Communications Company Ltd" },
329 { "426 01", "BHR MOBILE PLUS" },
330 { "427 01", "QATARNET" },
332 { "434 04", "Daewoo Unitel" },
333 { "434 05", "Coscom" },
334 { "437 01", "Bitel" },
335 { "454 00", "TCSL GSM" },
336 { "454 04", "HKGHT" },
337 { "454 06", "SMARTONE GSM" },
338 { "454 10", "New World PCS" },
339 { "454 12", "PEOPLES" },
340 { "454 16", "SUNDAY" },
341 { "455 01", "TELEMOVEL+ GSM900-Macau" },
342 { "456 01", "MobiTel" },
343 { "456 02", "SAMART-GSM" },
344 { "457 01", "Lao Shinawatra Telecom" },
345 { "460 00", "China Telecom GSM" },
346 { "460 01", "CU-GSM" },
347 { "466 01", "Far EasTone Telecoms 900" },
348 { "466 06", "TUNTEX GSM 1800" },
349 { "466 88", "KG Telecom" },
350 { "466 92", "Chunghwa GSM" },
351 { "466 93", "MobiTai" },
352 { "466 97", "TWNGSM" },
353 { "466 99", "TransAsia" },
354 { "470 01", "GrameenPhone Ltd" },
355 { "470 19", "Mobile 2000" },
356 { "502 12", "Maxis Mobile" },
357 { "502 13", "TM Touch" },
358 { "502 16", "DiGi 1800" },
359 { "502 17", "ADAM" },
360 { "502 19", "CELCOM" },
361 { "505 01", "MobileNet" },
362 { "505 02", "OPTUS" },
363 { "505 03", "VODAFONE" },
364 { "505 08", "One.Tel" },
365 { "510 01", "SATELINDO" },
366 { "510 10", "TELKOMSEL" },
367 { "510 11", "Excelcom" },
368 { "515 01", "ISLACOM" },
369 { "515 02", "Globe Telecom" },
370 { "520 01", "AIS GSM" },
372 { "520 18", "Worldphone 1800" },
373 { "520 23", "HELLO" },
374 { "525 01", "SingTel Mobile" },
375 { "525 02", "ST-PCN" },
376 { "525 03", "MOBILEONE" },
377 { "528 11", "DSTCom" },
378 { "530 01", "Vodafone New Zealand Limited" },
379 { "542 01", "Vodafone" },
380 { "546 01", "Mobilis" },
381 { "547 20", "VINI" },
382 { "602 01", "MobiNil" },
383 { "602 02", "Tunicell" },
384 { "603 01", "ALGERIAN MOBILE NETWORK" },
385 { "604 01", "I A M" },
386 { "608 01", "ALIZE" },
387 { "611 02", "Lagui" },
388 { "612 03", "IVOIRIS" },
389 { "612 05", "Telecel" },
390 { "615 01", "TOGO CELL" },
391 { "617 01", "Cellplus Mobile Comms" },
392 { "618 01", "Omega" },
393 { "620 01", "SPACEFON" },
394 { "625 01", "CVMOVEL" },
395 { "633 01", "Seychelles Cellular Services" },
396 { "633 10", "AIRTEL" },
397 { "634 01", "MobiTel" },
398 { "635 10", "Rwandacell" },
399 { "636 01", "ETMTN" },
400 { "640 01", "TRITEL" },
401 { "641 10", "MTN-Uganda" },
402 { "642 02", "ANTARIS" },
403 { "643 01", "T.D.M GSM 900" },
404 { "645 01", "ZAMCELL" },
405 { "646 01", "Madacom" },
406 { "646 03", "Sacel Madagascar S.A." },
408 { "648 01", "NET*ONE" },
409 { "648 03", "Telecel" },
411 { "650 01", "Callpoint 900" },
412 { "651 01", "Vodacom Lesotho (Pty) Ltd" },
413 { "655 01", "Vodacom" },
415 { "680 38", "NPI Wireless" },
416 { "730 01", "Entel Telefonia Movi" },
417 { "730 10", "Entel PCS" },
418 { "734 01", "Infonet" },
420 { "undefined", "unknown" }
423 char *GSM_GetNetworkName(char *NetworkCode)
428 while ( strcmp(GSM_Networks[index].Code, NetworkCode) &&
429 strcmp(GSM_Networks[index].Code, "undefined") )
432 return GSM_Networks[index].Name;
435 char *GSM_GetNetworkCode(char *NetworkName)
440 while ( strcmp(GSM_Networks[index].Name, NetworkName) &&
441 strcmp(GSM_Networks[index].Code, "undefined") )
444 return GSM_Networks[index].Code;
447 char *GSM_GetCountryName(char *CountryCode)
452 while ( strncmp(GSM_Countries[index].Code, CountryCode, 3) &&
453 strcmp(GSM_Countries[index].Code, "undefined") )
456 return GSM_Countries[index].Name;
459 static char *GSM_GetCountryCode(char *CountryName)
464 while ( strcmp(GSM_Countries[index].Name, CountryName) &&
465 strcmp(GSM_Countries[index].Code, "undefined") )
468 return GSM_Countries[index].Code;
471 void EncodeNetworkCode(unsigned char* buffer, unsigned char* output)
473 EncodeBCD (buffer, output, 6, false);
474 buffer[1]=buffer[1] | 0xf0;
477 void DecodeNetworkCode(unsigned char* buffer, unsigned char* output)
479 DecodeBCD (output, buffer, 3);