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