summaryrefslogtreecommitdiffstats
path: root/src/GeoIP-1.4.0
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2013-07-27 16:34:45 +0200
committerSlávek Banko <slavek.banko@axis.cz>2013-07-27 16:34:45 +0200
commitd76ff81b7c1beffef0b84e570914c8f2d47834e6 (patch)
tree284b80ce7c5456fbb041f7979ac2c0baeead8902 /src/GeoIP-1.4.0
downloadtork-d76ff81b7c1beffef0b84e570914c8f2d47834e6.tar.gz
tork-d76ff81b7c1beffef0b84e570914c8f2d47834e6.zip
Initial import of tork 0.33
Diffstat (limited to 'src/GeoIP-1.4.0')
-rw-r--r--src/GeoIP-1.4.0/AUTHORS1
-rw-r--r--src/GeoIP-1.4.0/COPYING504
-rw-r--r--src/GeoIP-1.4.0/ChangeLog374
-rw-r--r--src/GeoIP-1.4.0/GeoIP-LICENSE.txt74
-rw-r--r--src/GeoIP-1.4.0/INSTALL182
-rw-r--r--src/GeoIP-1.4.0/Makefile.am10
-rw-r--r--src/GeoIP-1.4.0/NEWS0
-rw-r--r--src/GeoIP-1.4.0/README132
-rw-r--r--src/GeoIP-1.4.0/TODO54
-rw-r--r--src/GeoIP-1.4.0/data/GeoIP-LICENSE.txt76
-rw-r--r--src/GeoIP-1.4.0/data/GeoIP.datbin0 -> 1145452 bytes
-rw-r--r--src/GeoIP-1.4.0/data/Makefile.am7
-rw-r--r--src/GeoIP-1.4.0/data/README2
-rw-r--r--src/GeoIP-1.4.0/libGeoIP/GeoIP.c994
-rw-r--r--src/GeoIP-1.4.0/libGeoIP/GeoIP.h183
-rw-r--r--src/GeoIP-1.4.0/libGeoIP/GeoIPCity.c244
-rw-r--r--src/GeoIP-1.4.0/libGeoIP/GeoIPCity.h63
-rw-r--r--src/GeoIP-1.4.0/libGeoIP/GeoIPUpdate.c850
-rw-r--r--src/GeoIP-1.4.0/libGeoIP/GeoIPUpdate.h63
-rw-r--r--src/GeoIP-1.4.0/libGeoIP/GeoIP_internal.h11
-rw-r--r--src/GeoIP-1.4.0/libGeoIP/Makefile.am17
-rw-r--r--src/GeoIP-1.4.0/libGeoIP/global.h32
-rw-r--r--src/GeoIP-1.4.0/libGeoIP/md5.c332
-rw-r--r--src/GeoIP-1.4.0/libGeoIP/md5.h40
-rw-r--r--src/GeoIP-1.4.0/libGeoIP/regionName.c13311
-rw-r--r--src/GeoIP-1.4.0/libGeoIP/timeZone.c551
-rw-r--r--src/GeoIP-1.4.0/libGeoIP/types.h140
27 files changed, 18247 insertions, 0 deletions
diff --git a/src/GeoIP-1.4.0/AUTHORS b/src/GeoIP-1.4.0/AUTHORS
new file mode 100644
index 0000000..b1295b9
--- /dev/null
+++ b/src/GeoIP-1.4.0/AUTHORS
@@ -0,0 +1 @@
+T.J. Mather <tjmather@maxmind.com>
diff --git a/src/GeoIP-1.4.0/COPYING b/src/GeoIP-1.4.0/COPYING
new file mode 100644
index 0000000..5ab7695
--- /dev/null
+++ b/src/GeoIP-1.4.0/COPYING
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/src/GeoIP-1.4.0/ChangeLog b/src/GeoIP-1.4.0/ChangeLog
new file mode 100644
index 0000000..e127c97
--- /dev/null
+++ b/src/GeoIP-1.4.0/ChangeLog
@@ -0,0 +1,374 @@
+1.4.0 2006-8-7
+ * Changed license from GPL to LGPL, so that PHP Extension can be included in PECL (Olivier Hill)
+ * Rewrote GEOIP_CHECK_CACHE code, fixed numerous bugs
+ - CheckCache now works if GeoIP file is overwriten by mv command
+ - Fixed bug where CheckCache kept reloading in GEOIP_STANDARD_MODE
+ - Fixed segfault issue in GEOIP_MEMORY_CACHE mode
+ - Fixed garbage data appearing in GEOIP_INDEX_CACHE mode
+ - Fixed realloc in case realloc returns new memory block (Andre Morozov of Stone Steps)
+ * Updated geoipupdate to print status messages for each database instead of just last database
+ * Check that gi is not null before running code in GeoIP_delete
+ * Updated LICENSE file to add GPL License Exception for PHP
+ * Fixed alpha-3 codes ordering, replaced TLS,TKM,TUN,TON with TKM,TUN,TON,TLS
+ * TP/East Timor changed to TL/Timor-Leste, reflecting changes in ISO-3166
+ * Added Netware and Windows makefiles (Guenter Knauf)
+ * Fixed NetWare compiler issue with char block[block_size] declaration (Guenter Knauf)
+ * Updated geoipupdate example to run weekly
+
+1.3.17 2006-5-14
+ * Fixed headers for Windows/Netware compilation (Guenter Knauf)
+ * Fixed Received Error -21 (Sanity check database_info string failed)
+ when running geoipupdate with GeoIP Country when UserId and
+ productIds were not specified. Bug was introduced in 1.3.15.
+
+1.3.16 2006-4-17
+ * Fixed compliation error in GeoIPUpdate.c
+
+1.3.15 2006-4-14
+ * Updated README documentation
+ * Updated geoipupdate so that it writes file as it is uncompressed instead
+ of storing entire GeoIP.dat file in memory (Frank Mather)
+ * Updated geoiplookup so that it returns GeoIP Domain Name if available
+ (Frank Mather)
+ * Updated geoipupdate so that it reports whether databases are updated
+ in non-verbose mode (Frank Mather)
+
+1.3.14 2005-9-7
+ * Check if byte, ushort, ulong, u16, u32 are defined in configure
+ script. Fixes compilation issue on FreeBSD systems.
+ * Check for Big Endian byte order (needed for MD5 code in geoipupdate
+ to work properly on Mac OS X and other Big Endian processors)
+ * Fixed GEOIP_CHECK_CACHE mode when used with GEOIP_STANDARD to
+ only refresh upon file change
+ * Fixed memory leak when refreshing file in GEOIP_CHECK_CACHE mode
+ * Updated ltmain.sh to support Debian GNU/k*BSD bug #315425 (Marek Habersack)
+ * Added lookup functions using IP numeric representation as input (Frank Mather)
+ * Removed geoipexport
+ * Replaced Yugoslavia with Serbia and Montenegro
+ * Updated geoiplookup to only perform country lookup once instead of twice by using GeoIP_id_by_name
+
+1.3.13 2005-8-1
+ * Fixed autoconf weirdness that resulted in libraries being
+ installed without .so suffix
+
+1.3.12 2005-7-19
+ * Removed -lGeoIP from libGeoIPUpdate_la_LIBADD - fixes compilation error
+ if GeoIP isn't already installed (Thomas Steudten)
+
+1.3.11 2005-7-7
+ * Fixed gcc warnings and bug. Use int
+ instead of char for checking the return value of getopt in geoipupdate.c.
+ Moved the internal functions to GeoIP_internal.h to get rid
+ of those 'implicit declaration' warnings. (Ludwig Nussel/SUSE)
+ * Cleaned up name space by prefixing internal functions with
+ _GeoIP* (Ludwig Nussel/SUSE)
+ * Memory Leak fix for GeoIP City if fread error
+ * Added more verbose error messages for geoipupdate (Frank Mather)
+ * Added check for zlib.h to configure.in
+
+1.3.10 2005-4-17
+ * Added types.h to Makefile.am - fixes compilation error
+
+1.3.9 2005-4-14
+ * fixed bug with GEOIP_INDEX_CACHE (Frank Mather)
+ * fixed segfault issue if GeoIP.dat not found (Frank Mather)
+ * Updated MD5 checksum code to use GnuPG code which works
+ on 64bit machines (Frank Mather)
+ * Fixed memory leak in test-geoip-isp.c and test-geoip-org.c
+ * Added support for GeoIP Domain Names in geoipupdate
+
+1.3.8 2004-11-7
+ * Updated geoipupdate to report invalid userID and productID errors
+ * Check if gethostbyname_r is version that returns int or is other version
+ - should fix compile errors on Solaris and FreeBSD
+ * Updated URL to get license key, userId, and product Ids in conf/GeoIP.conf.default
+ * Updated test case, removed www.asahi.com
+ * Added support for GEOIP_INDEX_CACHE - which just caches
+ the most frequently access index portion of the database, resulting
+ in faster lookups than GEOIP_STANDARD, but less memory usage than
+ GEOIP_MEMORY_CACHE (Frank Mather)
+
+1.3.7 2004-10-5
+ * Updated test case, removed www.bundesregierung.de added www.asahi.com
+
+1.3.6 2004-8-8
+ * Check for gethostbyname_r support in configure (Mac OS X doesn't support gethostbyname_r)
+ * Made GeoIP City code thread safe
+ * Fixed bug with geoipupdate reading in product ids
+ * Added support for GeoIP Netspeed geoipupdate
+ * Fix memleak in lookupaddress (Ludwig Nussel/SUSE)
+ * Add prototype for _full_path_to to make 64bit clean
+ (Ludwig Nussel/SUSE)
+ * Add return values to test programs (Ludwig Nussel/SUSE)
+
+1.3.5 2004-7-5
+ * Added more documentation to README file
+ * Made GEOIP_CHECK_CACHE work with GEOIP_STANDARD mode - reloads filehandle
+ in case file changes.
+ * Added GeoIP_country_code_by_ipnum and GeoIP_id_by_ipnum to use
+ existing ulong IP Address in numeric form instead of having to
+ convert it to string (Boris Hajduk)
+ * Made code thread safe by replacing gethostbyname with gethostbyname_r
+
+1.3.4 2004-6-4
+ * Fixed bug where *.gz file(s) didn't get removed after geoipupdate
+
+1.3.3 2004-6-2
+ * Added support for NetSpeed lookup to geoiplookup
+ * inet_addr patch for 64 bit systems (Thomas Steudten)
+ * Added Support for automated downloads of GeoIP Region, City, ISP and Organization databases (Frank Mather)
+ * INADDR_NONE Patch for Solaris 9 (John Young)
+
+1.3.2 2004-4-20
+ * Added support for Maxmind NetSpeed
+
+MinGW patch from Stanislaw Pusep
+
+I was re-compiling Geolizer (http://sysd.org/log.php#glzr) on Win32 so I firstly needed to put up-to-date Win32 compatibility of libGeoIP itself. Fortunately MinGW plataform evolved a lot since last time I used it to compile libGeoIP. I'm sending you the patch with changes required for libGeoIP to work on both Win32 and UN*X. UN*X behavior is unaffected. Now, detailed explanation of what I did at all:
+1) Made correct header imports for both Win32 and UN*X. UN*X imports netdb.h & netinet/in.h and Win32 imports windows.h & winsock.h
+2) Win32 gethostbyname() is only able to resolve hostnames, it can't convert "127.0.0.1" string to 32-bit IP address. Thus I added lookupaddress() function that safely resolves any string to IP address and replaced all gethostbyname() calls by it.
+3) Database files were referenced by pre-compiled static strings. I malloc()ed buffers for file names so they can be changed "on fly". Thus, on Win32 version GeoIP.dat & other files are being seeked in the same directory as executable file or library.
+4) Added README.MinGW file with brief explanation on how to get GeoIP working under MinGW system.
+
+1.3.1 2003-11-11
+ * Check for stdint.h in autoconf (Sean Chittenden)
+ * prevent the geoipupdate man page from trying to install itself directly in the system directory (Gyepi Sam)
+
+1.3.0 2003-09-29
+ * Fixed includes to compile on Windows (Fabrice Colin)
+ * Removed the _addr_to_num() calls from GeoIP_*_by_name()
+ * _seek_record() optimizations (Maurice Cinquini)
+  1) Use a single buf ptr inside the loops.
+     Set to the stack buffer or the cached memory the start of the function.
+  2) Unroll the i=0,1 loop to allow constant folding.
+  3) Unroll the j loop for the common case of j = STANDARD_RECORD_LENGTH
+     (I've already done the above changes see attached function.)
+     With gcc -O2 calculating x[0] and x[1] for STANDARD_RECORD_LENGTH now
+     only takes 15 (was > 100) i80x86 instructions with 6 byte accesses of RAM. 4) only calculate x[0], x[1] when needed, may be a bigger win
+ than the above since all the other optimizations above only reduced
+ CPU instructions operating on CPU cached RAM.
+ ! IMPORTANT API Change: Changed GeoIPRegion to have region in structure. Saves space and a malloc.
+ Since GeoIPRegion.region is no longer a pointer but an in-structure
+ array so test the first byte of region == 0 rather testing if the region
+ pointer is NULL. (Maurice Cinquini)
+ * Added GeoIP_assign_region_by_inetaddr which doesn't do any mallocs and made all other region APIs go thru it (Maurice Cinquini)
+ * Replaced _h_addr_to_num() with ntohl() and removed _h_addr_to_num() (Maurice Cinquini)
+ * Fixed bug when IP address not found in region rev1 database (Jason Linhart)
+ * Added added extern "C" to GeoIPCity.h fixes problems when included in C++ library
+
+1.2.2 2003-08-10
+ * Added support for GeoIP ISP Edition identifier
+ * Fixed bug in GeoIP_database_info (Jason Linhart)
+ * Added support for GeoIP AS Number Edition
+ ! renamed GeoIP_org_by_* functions to GeoIP_name_by_* to reduce confusion
+ since these functions are used by GeoIP ISP and GeoIP ASNum as well
+ as GeoIP Organization
+ * Added support for GeoIP Proxy Edition
+ ! renamed GeoIP_country_id_by_* functions to GeoIP_id_by_*
+
+1.2.1 2003-07-12
+ * Added GeoIP_record_id_by_addr and GeoIP_next_record functions
+ * Added support for new GeoIP Region format, including Canadian Provinces
+
+1.2.0 2003-04-26
+ * Added support for GeoIP City format revision 1, including dma code and area code
+ * geoiplookup returns results from GeoIP Region, City, ISP and Organization databases
+ * Standardized location for GeoIP Region, City, ISP and Organization databases
+ * Added GeoIP_open_type to open database from default location for other dbs besides country
+ * Added check to make sure that the appropriate database is loaded for each lookup method
+ * Updated update code to check for first 12 characters of license key
+ * Added GeoIP_country_continent array to lookup continent by country ID
+
+1.1.9 2003-03-10
+ * merged windows patch into main code base (Kenneth R. Robinette)
+ * Changed const int to #define for windows compatibility
+
+1.1.8 2003-03-04
+ * Fixed bug with city database introduced in 1.1.6
+
+1.1.7 2003-03-04
+ * Fixed bug introduced in 1.1.6 when run in GEOIP_STANDARD mode
+ * Added test to test GEOIP_STANDARD
+
+1.1.6 2003-03-03
+ * Added spec for building RPMs (Ryan Weaver)
+ * Added support for 4byte records for Organization database
+ * Changed Taiwan, Province of China to Taiwan
+
+1.1.5 2003-02-10
+ * Added support for GeoIP Organization database
+
+1.1.4 2002-12-30
+ * Cast number to int in _num_to_addr in geoipexport (Ralf S. Engelschall)
+ * Removed printf debug statements from geoipexport
+ * correct library build ordering (Ralf S. Engelschall)
+ * ulong -> unsigned long (Sean Chittenden)
+
+1.1.3 2002-12-24
+ * Added GeoIPUpdate.h to EXTRA_DISTS
+ * Compile fixes for Solaris, FreeBSD (Michael McClennen, Corris Randall)
+ * Handle NULL in printf in test-geoip-region
+
+1.1.2 2002-12-16
+ * Added support for postal codes
+ * Added geoipexport, program to export bit binary file to
+ binary tree format and csv format
+ * Split update code into separate library, GeoIPUpdate.la
+ * Allow passing NULL callback to GeoIP_update_database function
+ (Sean Chittenden)
+ * Added geoipexport program, exports to CSV file
+ * Added GeoIP_database_edition method
+ * Changed DATADIR to GEOIPDATADIR
+
+1.1.1 2002-11-07
+ * Fixed segfault issue with GeoIPRegion_delete
+ * Handle test failures where lookup returns NULL more gracefully
+
+1.1.0 2002-11-06
+ * Perform sanity checking before installing datebase using geoipupdate
+ * Removed file locking, since we install file by renaming instead of writing to it.
+ * Fixed geoipupdate to check for NULL return value
+ * Added constants for different editions
+ * Added O1 code for "Other country", used in per-country city editions
+ * fixed multi-line string literals warning in test-geoip.c
+ * Use enum constants for GeoIP_update_database values
+ * Added GEOIP_CHECK_CACHE option (not working yet)
+
+1.0.10 2002-10-28
+ * IMPORTANT API Change - Return NULL instead of '--' and 'N/A'
+ Be sure to check the return value for NULL to avoid segmentation faults!!!!
+ * Added callback to print messages from GeoIP_update_database
+ * Moved GeoIPConfFile to geoipupdate.c
+ * Changed databaseSegments to unsigned int (Chris Gibbs)
+ * Fixed compiler warnings (Chris Gibbs)
+ * API Change - GeoIPRegion region member set to NULL when no region available
+ * Change short int to int (Chris Gibbs)
+ * Added write/read file locking for GeoIPUpdate.c/GeoIP.c
+
+1.0.9 2002-10-16
+ * removed -ansi from Makefile.am to avoid compile error on Solaris 8
+ * Compile fix for FreeBSD Stable (Kimura Fuyuki)
+
+1.0.8 2002-10-05
+ * Included header required for *BSD (Akinori Musha)
+
+1.0.7 2002-10-05
+ * Fixed compilation error with GeoIPUpdate.c
+
+1.0.6 2002-10-04
+ * Moved update code into separate file
+ * Added md5 checksums to update code
+ * Fixed memory leak when running geoiplookup -v
+ * Moved const RECORD_LENGTH to #define RECORD_LENGTH for Windows compatibility
+ (Randy Kobes)
+ * Cleaned up GeoIP_new code
+
+1.0.5 2002-09-23
+ * Supports GeoIP Regional Edition
+ * Macau is now "Macao" per ISO 3166-1 change
+ * Romania "ROM" is now "ROU" per ISO 3166-1 change
+ * Added #define for memcpy -> BSD's bcopy (Chris Gibbs)
+ * Removed "private" functions from GeoIP.h
+
+1.0.4 2002-08-27
+ * rewrote _seek_country to use loop instead of recursion for faster performance
+ * Removed "orphan" nodes from demo database resulting in smaller size (Jason Linhart)
+ * Moved changes for building windows DLL into separate patch
+ * Fixed segfaults when passed malformed IP addresses
+
+1.0.3 2002-08-26
+ * Added more changes for windows compatibility
+ (Stanislaw Pusep)
+ * Added benchmark program
+
+1.0.2 2002-08-21
+ * Open database using "rb" for windows compatibility
+ (Stanislaw Pusep)
+ * Removed superfluous inet_ntop command (Stanislaw Pusep)
+
+1.0.1 2002-08-20
+ * Fixed bug with resolving hostnames
+ * More fixes for compiler warnings (Chris Gibbs)
+ * Changed int to unsigned int in _is_ipaddr (Chris Gibbs)
+
+1.0.0 2002-08-12
+ * Changed license to GPL
+ * Don't perform Reverse DNS lookups on IP addresses
+ * Only include getopt.h on Linux (OpenPKG patch)
+ * Avoid the_license_key_str warning (OpenPKG patch)
+ * Added license for March 2002 database
+
+0.3.0 2002-08-04
+ * Added support for 'A2', Satellite Providers
+
+0.2.8 2002-07-30
+ * Handle malformed input gracefully
+ * Added section to README on Solaris workarounds
+ * Added geoipupdate man page
+
+0.2.7 2002-07-27
+ * Added section to README on automatic updates
+ * link to socket library on solaris
+
+0.2.6 2002-07-25
+ * optimized GeoIP_open (Chris Gibbs)
+ * check for partial file read in GeoIP_open (Chris Gibbs)
+ * optimized _addr_to_num() (Chris Gibbs)
+ * changed write and read to send and recv for sockets
+ * Only install GeoIP.conf and GeoIP.dat if not already installed
+
+0.2.5 2002-07-22
+ * Added verbose option to GeoIP_update_database
+
+0.2.4 2002-07-22
+ * Fix for GeoIP_update_database
+
+0.2.3 2002-07-22
+ * Fixes for FreeBSD
+ * All calls to malloc are checked for NULL pointer (Chris Gibbs)
+ * Fixed spelling of "Kazakhstan" (Chris Gibbs)
+ * Initialize cache_buf to NULL (Chris Gibbs)
+ * More memory leak fixes (Chris Gibbs)
+
+0.2.2 2002-07-18
+ * Added update database function
+ * Fixed memory leak in GeoIP_new (Chris Gibbs)
+
+0.2.1 2002-07-03
+ * Added support for anonymous proxies
+
+0.2.0 2002-06-23
+ * Added new memory caching option for improved performance
+
+0.1.7 2002-05-29
+ * Only add -lnsl for systems that support libnsl
+ * Added decl for 3 letter country code array to GeoIP.h
+
+0.1.6 2002-05-25
+ * Added 3 letter country code
+
+0.1.5 2002-05-23
+ * Added -lnsl fixed compile errors
+
+0.1.4 2002-05-11
+ * Fixed bugs in demo March 2002 database
+
+0.1.3 2002-04-21
+ * Fixed bug related to signed int (Brian Grossman)
+ * Better error handling when hostname not found
+ * Fixed bug when netmask=32 for netblock
+
+0.1.2 2002-04-20
+ * Added two new functions, GeoIP_country_id_by_addr
+ and GeoIP_country_id_by_name.
+ * Made GeoIP_country_code and GeoIP_country_name
+ viewable outside of library, to be with with
+ GeoIP_country_id_by_* functions.
+
+0.1.1 2002-04-07
+ * GeoIP.h is now installed to includedir
+ * constructor and destructor are now provided by
+ GeoIP_new, GeoIP_open, and GeoIP_delete
+
+0.1.0 2002-04-07
+ * Initial release
diff --git a/src/GeoIP-1.4.0/GeoIP-LICENSE.txt b/src/GeoIP-1.4.0/GeoIP-LICENSE.txt
new file mode 100644
index 0000000..457710d
--- /dev/null
+++ b/src/GeoIP-1.4.0/GeoIP-LICENSE.txt
@@ -0,0 +1,74 @@
+There are two licenses, one for the C library software, and one for
+the database.
+
+SOFTWARE LICENSE (C library)
+
+The GeoIP C Library is licensed under the GPL. For details see
+the COPYING file.
+
+OPEN DATA LICENSE (GeoIP Standard Edition Database)
+
+Copyright (c) 2003 MaxMind LLC. All Rights Reserved.
+
+All advertising materials and documentation mentioning features or use of
+this database must display the following acknowledgment:
+"This product includes GeoIP data created by MaxMind, available from
+http://maxmind.com/"
+
+Redistribution and use with or without modification, are permitted provided
+that the following conditions are met:
+1. Redistributions must retain the above copyright notice, this list of
+conditions and the following disclaimer in the documentation and/or other
+materials provided with the distribution.
+2. All advertising materials and documentation mentioning features or use of
+this database must display the following acknowledgement:
+"This product includes GeoIP data created by MaxMind, available from
+http://maxmind.com/"
+3. "MaxMind" may not be used to endorse or promote products derived from this
+database without specific prior written permission.
+
+THIS DATABASE IS PROVIDED BY MAXMIND.COM ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL MAXMIND.COM BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+DATABASE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Some parts of this software distribution are derived from the APNIC, ARIN and
+RIPE databases (copyright details below). The author of this module makes no
+claims of ownership on those parts.
+
+APNIC conditions of use:
+
+The files are freely available for download and use on the condition that APNIC
+will not be held responsible for any loss or damage arising from the application
+of the information contained in these reports.
+
+APNIC endeavours to the best of its ability to ensure the accuracy of these
+reports; however, APNIC makes no guarantee in this regard.
+
+In particular, it should be noted that these reports seek to indicate the
+country where resources were first allocated or assigned. It is not intended
+that these reports be considered as an authoritative statement of the location
+in which any specific resource may currently be in use.
+
+ARIN database copyright:
+
+Copyright (c) American Registry for Internet Numbers. All rights reserved.
+
+RIPE database copyright:
+
+The information in the RIPE Database is available to the public for agreed
+Internet operation purposes, but is under copyright. The copyright statement is:
+
+"Except for agreed Internet operational purposes, no part of this publication
+may be reproduced, stored in a retrieval system, or transmitted, in any form or
+by any means, electronic, mechanical, recording, or otherwise, without prior
+permission of the RIPE NCC on behalf of the copyright holders. Any use of this
+material to target advertising or similar activities is explicitly forbidden and
+may be prosecuted. The RIPE NCC requests to be notified of any such activities
+or suspicions thereof."
diff --git a/src/GeoIP-1.4.0/INSTALL b/src/GeoIP-1.4.0/INSTALL
new file mode 100644
index 0000000..b42a17a
--- /dev/null
+++ b/src/GeoIP-1.4.0/INSTALL
@@ -0,0 +1,182 @@
+Basic Installation
+==================
+
+ These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+ The file `configure.in' is used to create `configure' by a program
+called `autoconf'. You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes awhile. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+Compilers and Options
+=====================
+
+ Some systems require unusual options for compilation or linking that
+the `configure' script does not know about. You can give `configure'
+initial values for variables by setting them in the environment. Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+ CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+ env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+ You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory. After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+ By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc. You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+ Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+ There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on. Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+ CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+ If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+ If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+ Use and save the results of the tests in FILE instead of
+ `./config.cache'. Set FILE to `/dev/null' to disable caching, for
+ debugging `configure'.
+
+`--help'
+ Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`--version'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
diff --git a/src/GeoIP-1.4.0/Makefile.am b/src/GeoIP-1.4.0/Makefile.am
new file mode 100644
index 0000000..38cd92f
--- /dev/null
+++ b/src/GeoIP-1.4.0/Makefile.am
@@ -0,0 +1,10 @@
+NULL =
+
+INCLUDES = -Wall -ansi
+
+SUBDIRS = \
+ data \
+ libGeoIP \
+ $(NULL)
+
+EXTRA_DIST = READMEwin32.txt GeoIPWinDLL.patch TODO bootstrap GeoIP.spec GeoIP.spec.in
diff --git a/src/GeoIP-1.4.0/NEWS b/src/GeoIP-1.4.0/NEWS
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/GeoIP-1.4.0/NEWS
diff --git a/src/GeoIP-1.4.0/README b/src/GeoIP-1.4.0/README
new file mode 100644
index 0000000..9e09c98
--- /dev/null
+++ b/src/GeoIP-1.4.0/README
@@ -0,0 +1,132 @@
+ GeoIP 1.4.0
+ -----------
+
+IMPORTANT API Change for 1.3.x and above users for GeoIP Region database
+GeoIPRegion.region is no longer a pointer but an in-structure
+array so test the first byte of region == 0 rather testing if the region
+pointer is NULL.
+
+IMPORTANT API Change for 1.1.x and above users - as of GeoIP 1.1.0 the
+GeoIP_country_xxx_by_xxx functions return NULL if a country can not
+be found (it used to return '--' or 'N/A'. Be sure to check the
+return value for NULL, to avoid segmentation faults!
+
+GeoIP is a C library that enables the user to find geographical and
+network information of an IP address.
+Included is a free GeoLite Country database
+that is updated at the beginning of every month.
+To download the latest free GeoLite Country database, go to:
+http://www.maxmind.com/app/geoip_country
+
+There is also a free city-level geolocation database, GeoLite City,
+available from:
+http://www.maxmind.com/app/geolitecity
+
+We also offer commercial GeoIP databases with greater accuracy and
+additional network information, for more details, see:
+http://www.maxmind.com/app/products
+
+As of version 1.3.6, the GeoIP C library is thread safe.
+
+This module can be used to automatically select the geographically closest
+mirror, to analyze your web server logs to determine the countries of your
+visitors, for credit card fraud detection, and for software export controls.
+
+If you use GeoIP to block access from high risk countries in order
+to reduce fraud or abuse, you should also block access from known
+proxy servers. For more details, see:
+http://www.maxmind.com/app/proxy
+
+To install, run:
+
+./configure
+make
+make check
+make install
+
+The GeoIP C library relies on GNU make, not on BSD make
+
+MEMORY CACHING AND OTHER OPTIONS
+
+There are four options available:
+
+GEOIP_STANDARD - read database from filesystem, uses least memory.
+
+GEOIP_MEMORY_CACHE - load database into memory, faster performance
+ but uses more memory
+
+GEOIP_CHECK_CACHE - check for updated database. If database has been updated,
+ reload filehandle and/or memory cache.
+
+GEOIP_INDEX_CACHE - just cache
+ the most frequently accessed index portion of the database, resulting
+ in faster lookups than GEOIP_STANDARD, but less memory usage than
+ GEOIP_MEMORY_CACHE - useful for larger databases such as
+ GeoIP Organization and GeoIP City. Note, for GeoIP Country, Region
+ and Netspeed databases, GEOIP_INDEX_CACHE is equivalent to GEOIP_MEMORY_CACHE
+
+The options can be combined using bit operators. For example you can
+use both GEOIP_MEMORY_CACHE and GEOIP_CHECK_CACHE by calling:
+
+ GeoIP_open("/path/to/GeoIP.dat", GEOIP_MEMORY_CACHE | GEOIP_CHECK_CACHE);
+
+EXAMPLES
+
+See
+test/
+ test-geoip.c
+ test-geoip-region.c
+ test-geoip-city.c
+ test-geoip-isp.c
+ test-geoip-org.c
+ test-geoip-netspeed.c
+
+For examples of how to use the API. The test-geoip.c works with both the free and paid
+GeoIP Country databases. The other example programs require the paid databases available
+from http://www.maxmind.com/app/products
+
+AUTOMATIC UPDATES
+
+MaxMind offers a service where you can have your database updated
+automically each week. For more details see:
+
+http://www.maxmind.com/app/license_key
+
+TROUBLESHOOTING
+
+Note that it is recommended that you use GNU make. Also, if you are using
+OpenBSD, GeoIP requires OpenBSD 3.1 or greater.
+
+if you get "cannot load shared object file: No such file or directory"
+error, add the directory libGeoIP.so was installed to to /etc/ld.so.conf
+and run ldconfig
+
+On Solaris, if you get a
+ld: fatal: relocations remain against allocatable but non-writable sections
+error, try running
+
+# make clean
+# ./configure --disable-shared
+# make
+
+If you get a "ar : command not found" error, make sure that ar is
+in your path. On Solaris, ar is typically found in /usr/ccs/bin
+
+If you get a "geoipupdate.c:24: getopt.h: No such file or directory"
+error, run
+
+# export CPPFLAGS="-I/usr/local/include"
+
+(assuming that getopt.h is in /usr/local/include)
+
+If you get a "zlib.h: No such file or directory" error, make sure
+that the zlib development libraries are installed on your server.
+These are typically included in a "zlib-devel" package.
+
+If you get a "bad interpreter: No such file or directory" error
+when running ./configure, make sure that there are no DOS
+returns in the configure script. To remove DOS returns,
+run perl -pi -e 's!\r!!g' configure.
+
+Please contact support@maxmind.com with any questions or bug
+reports.
diff --git a/src/GeoIP-1.4.0/TODO b/src/GeoIP-1.4.0/TODO
new file mode 100644
index 0000000..32a6c80
--- /dev/null
+++ b/src/GeoIP-1.4.0/TODO
@@ -0,0 +1,54 @@
+Rutger Okhuizen 7/31/2006
+
+Implement waiting algorithm for GEOIP_CHECK_CACHE,
+so stat is called on every lookup.
+
+-----------------------
+
+Maurice Cinquini
+
+*** ifndef WIN32 on netdb.h ? ***
+In GeoIPCity.c you don't "#ifndef WIN32" the netdb.h include,
+but in GeoIP.c you do.  Which one is right?
+
+*** Warnings in GeoIP-1.2.1 before I made changes ***
+GeoIPUpdate.c:73: warning: implicit declaration of function `_setup_dbfilename'
+    I suggest a GeoIP_private.h file to include prototypes for
+    _setup_dbfilename and other private functions also used by GeoIPCity.c
+
+*** Drop the GeoIP_*_by_addr API calls ***
+And now that I think of it, why do you need a seperate
+GeoIP_region_by_addr and GeoIP_region_by_name since
+the later does the work of the former just as efficently.
+For backward compatibility you could #define GeoIP_region_by_addr
+to GeoIP_region_by_name
+
+
+
+
+Performance improvements suggested by Jason Linhart
+1. cluster nodes to improve disk performance when using GEOIP_STANDARD
+2. evaluate preformance of replacing binary tree with nodes containing 4 children
+
+Write function to list countries, sorted by name. Chris Gibbs contributed this which could be
+used:
+
+ int GeoIP_country_sorted_index[246] = {
+ 0, 5, 8, 61, 14, 3, 11, 7, 12, 6, 13, 9, 17, 1, 16, 15, 18, 32, 25, 21,
+ 20,36, 22, 37, 27, 28, 33, 30, 19, 35, 34, 31, 104, 29, 24, 23, 26,
+114, 47, 38, 52,121, 41, 207, 46, 48, 53, 39, 49, 116, 42, 40, 45,
+ 50, 44, 97, 51, 54, 55, 58, 57, 59, 60, 216, 62, 64, 203, 87, 66,
+ 63, 68, 2, 71, 73, 70, 69, 74, 75, 80, 170,208, 76, 84, 79, 56, 81,
+82, 88, 83, 78, 86, 91, 90, 85, 92, 93, 98, 95, 228, 96,94, 99, 107,
+ 103, 100, 106, 105, 101, 102, 108, 109, 111, 110, 122, 112, 115,
+ 118,119, 120, 113, 123, 132, 124, 129, 128, 133, 126, 130, 131,
+ 143, 139, 137,151,153, 150, 140, 148, 138, 145, 146, 149, 238,
+ 152, 72, 136, 135, 142, 147, 134,154, 141, 155, 164, 163, 161,
+10, 156, 166, 160, 157, 159, 165, 158, 144, 162, 167,173, 180,
+178, 168, 171, 181, 169, 172, 176, 174, 179, 177, 182, 183, 184,
+185,186, 193, 117, 125, 175, 229, 236, 198, 202, 187, 199, 189,
+197, 192, 196,194,188, 200, 240, 89, 67, 127, 190, 201, 195, 205,
+191, 43, 204, 220, 211, 221,210,209, 212, 215, 218, 214, 217,
+213,206, 219, 223, 222, 4, 77, 225, 224, 226,227,234, 230, 233,
+ 231,232, 235, 65, 237, 239, 242, 241, 243, 244, 245};
+
diff --git a/src/GeoIP-1.4.0/data/GeoIP-LICENSE.txt b/src/GeoIP-1.4.0/data/GeoIP-LICENSE.txt
new file mode 100644
index 0000000..a6bc1ac
--- /dev/null
+++ b/src/GeoIP-1.4.0/data/GeoIP-LICENSE.txt
@@ -0,0 +1,76 @@
+There are two licenses, one for the C library software, and one for
+the database.
+
+SOFTWARE LICENSE (C library)
+
+The GeoIP C Library is licensed under the GPL. For details see
+the COPYING file.
+
+OPEN DATA LICENSE (GeoIP Standard Edition Database)
+
+Copyright (c) 2003 MaxMind LLC. All Rights Reserved.
+
+All advertising materials and documentation mentioning features or use of
+this database must display the following acknowledgment:
+"This product includes GeoIP data created by MaxMind, available from
+http://maxmind.com/"
+
+Redistribution and use with or without modification, are permitted provided
+that the following conditions are met:
+1. Redistributions must retain the above copyright notice, this list of
+conditions and the following disclaimer in the documentation and/or other
+materials provided with the distribution.
+2. All advertising materials and documentation mentioning features or use of
+this database must display the following acknowledgement:
+"This product includes GeoIP data created by MaxMind, available from
+http://maxmind.com/"
+3. "MaxMind" may not be used to endorse or promote products derived from this
+database without specific prior written permission.
+
+THIS DATABASE IS PROVIDED BY MAXMIND.COM ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL MAXMIND.COM BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+DATABASE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Some parts of this software distribution are derived from the APNIC, ARIN and
+RIPE databases (copyright details below). The author of this module makes no
+claims of ownership on those parts.
+
+APNIC conditions of use:
+
+The files are freely available for download and use on the condition that APNIC
+will not be held responsible for any loss or damage arising from the application
+of the information contained in these reports.
+
+APNIC endeavours to the best of its ability to ensure the accuracy of these
+reports; however, APNIC makes no guarantee in this regard.
+
+In particular, it should be noted that these reports seek to indicate the
+country where resources were first allocated or assigned. It is not intended
+that these reports be considered as an authoritative statement of the location
+in which any specific resource may currently be in use.
+
+ARIN database copyright:
+
+Copyright (c) American Registry for Internet Numbers. All rights reserved.
+
+RIPE database copyright:
+
+The information in the RIPE Database is available to the public for agreed
+Internet operation purposes, but is under copyright. The copyright statement is:
+
+"Except for agreed Internet operational purposes, no part of this publication
+may be reproduced, stored in a retrieval system, or transmitted, in any form or
+by any means, electronic, mechanical, recording, or otherwise, without prior
+permission of the RIPE NCC on behalf of the copyright holders. Any use of this
+material to target advertising or similar activities is explicitly forbidden and
+may be prosecuted. The RIPE NCC requests to be notified of any such activities
+or suspicions thereof."
+
+.
diff --git a/src/GeoIP-1.4.0/data/GeoIP.dat b/src/GeoIP-1.4.0/data/GeoIP.dat
new file mode 100644
index 0000000..7775938
--- /dev/null
+++ b/src/GeoIP-1.4.0/data/GeoIP.dat
Binary files differ
diff --git a/src/GeoIP-1.4.0/data/Makefile.am b/src/GeoIP-1.4.0/data/Makefile.am
new file mode 100644
index 0000000..1109aa8
--- /dev/null
+++ b/src/GeoIP-1.4.0/data/Makefile.am
@@ -0,0 +1,7 @@
+METASOURCES = AUTO
+
+geotorkdatadir = $(kde_datadir)/tork/geoip
+
+GEOIP_FILES = GeoIP.dat GeoIP-LICENSE.txt
+
+geotorkdata_DATA = $(GEOIP_FILES) \ No newline at end of file
diff --git a/src/GeoIP-1.4.0/data/README b/src/GeoIP-1.4.0/data/README
new file mode 100644
index 0000000..ef76422
--- /dev/null
+++ b/src/GeoIP-1.4.0/data/README
@@ -0,0 +1,2 @@
+wget http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz
+gunzip GeoIP.dat.gz
diff --git a/src/GeoIP-1.4.0/libGeoIP/GeoIP.c b/src/GeoIP-1.4.0/libGeoIP/GeoIP.c
new file mode 100644
index 0000000..0cb6bc0
--- /dev/null
+++ b/src/GeoIP-1.4.0/libGeoIP/GeoIP.c
@@ -0,0 +1,994 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
+/* GeoIP.c
+ *
+ * Copyright (C) 2006 MaxMind LLC
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "GeoIP.h"
+#include "GeoIP_internal.h"
+
+#ifndef WIN32
+#include <netdb.h>
+#include <sys/socket.h>
+#include <netinet/in.h> /* For ntohl */
+#include <arpa/inet.h>
+#else
+#include <windows.h>
+#define snprintf _snprintf
+#endif
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <sys/types.h> /* for fstat */
+#include <sys/stat.h> /* for fstat */
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h> /* For uint32_t */
+#endif
+
+#ifndef INADDR_NONE
+#define INADDR_NONE -1
+#endif
+
+#define COUNTRY_BEGIN 16776960
+#define STATE_BEGIN_REV0 16700000
+#define STATE_BEGIN_REV1 16000000
+#define STRUCTURE_INFO_MAX_SIZE 20
+#define DATABASE_INFO_MAX_SIZE 100
+#define MAX_ORG_RECORD_LENGTH 300
+#define US_OFFSET 1
+#define CANADA_OFFSET 677
+#define WORLD_OFFSET 1353
+#define FIPS_RANGE 360
+
+#define CHECK_ERR(err, msg) { \
+ if (err != Z_OK) { \
+ fprintf(stderr, "%s error: %d\n", msg, err); \
+ exit(1); \
+ } \
+}
+
+const char GeoIP_country_code[251][3] = { "--","AP","EU","AD","AE","AF","AG","AI","AL","AM","AN",
+ "AO","AQ","AR","AS","AT","AU","AW","AZ","BA","BB",
+ "BD","BE","BF","BG","BH","BI","BJ","BM","BN","BO",
+ "BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD",
+ "CF","CG","CH","CI","CK","CL","CM","CN","CO","CR",
+ "CU","CV","CX","CY","CZ","DE","DJ","DK","DM","DO",
+ "DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ",
+ "FK","FM","FO","FR","FX","GA","GB","GD","GE","GF",
+ "GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT",
+ "GU","GW","GY","HK","HM","HN","HR","HT","HU","ID",
+ "IE","IL","IN","IO","IQ","IR","IS","IT","JM","JO",
+ "JP","KE","KG","KH","KI","KM","KN","KP","KR","KW",
+ "KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT",
+ "LU","LV","LY","MA","MC","MD","MG","MH","MK","ML",
+ "MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV",
+ "MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI",
+ "NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF",
+ "PG","PH","PK","PL","PM","PN","PR","PS","PT","PW",
+ "PY","QA","RE","RO","RU","RW","SA","SB","SC","SD",
+ "SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO",
+ "SR","ST","SV","SY","SZ","TC","TD","TF","TG","TH",
+ "TJ","TK","TM","TN","TO","TL","TR","TT","TV","TW",
+ "TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE",
+ "VG","VI","VN","VU","WF","WS","YE","YT","RS","ZA",
+ "ZM","ME","ZW","A1","A2","O1","AX","GG","IM","JE"};
+
+const char GeoIP_country_code3[251][4] = { "--","AP","EU","AND","ARE","AFG","ATG","AIA","ALB","ARM","ANT",
+ "AGO","AQ","ARG","ASM","AUT","AUS","ABW","AZE","BIH","BRB",
+ "BGD","BEL","BFA","BGR","BHR","BDI","BEN","BMU","BRN","BOL",
+ "BRA","BHS","BTN","BV","BWA","BLR","BLZ","CAN","CC","COD",
+ "CAF","COG","CHE","CIV","COK","CHL","CMR","CHN","COL","CRI",
+ "CUB","CPV","CX","CYP","CZE","DEU","DJI","DNK","DMA","DOM",
+ "DZA","ECU","EST","EGY","ESH","ERI","ESP","ETH","FIN","FJI",
+ "FLK","FSM","FRO","FRA","FX","GAB","GBR","GRD","GEO","GUF",
+ "GHA","GIB","GRL","GMB","GIN","GLP","GNQ","GRC","GS","GTM",
+ "GUM","GNB","GUY","HKG","HM","HND","HRV","HTI","HUN","IDN",
+ "IRL","ISR","IND","IO","IRQ","IRN","ISL","ITA","JAM","JOR",
+ "JPN","KEN","KGZ","KHM","KIR","COM","KNA","PRK","KOR","KWT",
+ "CYM","KAZ","LAO","LBN","LCA","LIE","LKA","LBR","LSO","LTU",
+ "LUX","LVA","LBY","MAR","MCO","MDA","MDG","MHL","MKD","MLI",
+ "MMR","MNG","MAC","MNP","MTQ","MRT","MSR","MLT","MUS","MDV",
+ "MWI","MEX","MYS","MOZ","NAM","NCL","NER","NFK","NGA","NIC",
+ "NLD","NOR","NPL","NRU","NIU","NZL","OMN","PAN","PER","PYF",
+ "PNG","PHL","PAK","POL","SPM","PCN","PRI","PSE","PRT","PLW",
+ "PRY","QAT","REU","ROU","RUS","RWA","SAU","SLB","SYC","SDN",
+ "SWE","SGP","SHN","SVN","SJM","SVK","SLE","SMR","SEN","SOM",
+ "SUR","STP","SLV","SYR","SWZ","TCA","TCD","TF","TGO","THA",
+ "TJK","TKL","TKM","TUN","TON","TLS","TUR","TTO","TUV","TWN",
+ "TZA","UKR","UGA","UM","USA","URY","UZB","VAT","VCT","VEN",
+ "VGB","VIR","VNM","VUT","WLF","WSM","YEM","YT","SRB","ZAF",
+ "ZMB","MNE","ZWE","A1","A2","O1","ALA","GGY","IMN","JEY"};
+
+const char * GeoIP_country_name[251] = {"N/A","Asia/Pacific Region","Europe","Andorra","United Arab Emirates","Afghanistan","Antigua and Barbuda","Anguilla","Albania","Armenia","Netherlands Antilles",
+ "Angola","Antarctica","Argentina","American Samoa","Austria","Australia","Aruba","Azerbaijan","Bosnia and Herzegovina","Barbados",
+ "Bangladesh","Belgium","Burkina Faso","Bulgaria","Bahrain","Burundi","Benin","Bermuda","Brunei Darussalam","Bolivia",
+ "Brazil","Bahamas","Bhutan","Bouvet Island","Botswana","Belarus","Belize","Canada","Cocos (Keeling) Islands","Congo, The Democratic Republic of the",
+ "Central African Republic","Congo","Switzerland","Cote D'Ivoire","Cook Islands","Chile","Cameroon","China","Colombia","Costa Rica",
+ "Cuba","Cape Verde","Christmas Island","Cyprus","Czech Republic","Germany","Djibouti","Denmark","Dominica","Dominican Republic",
+ "Algeria","Ecuador","Estonia","Egypt","Western Sahara","Eritrea","Spain","Ethiopia","Finland","Fiji",
+ "Falkland Islands (Malvinas)","Micronesia, Federated States of","Faroe Islands","France","France, Metropolitan","Gabon","United Kingdom","Grenada","Georgia","French Guiana",
+ "Ghana","Gibraltar","Greenland","Gambia","Guinea","Guadeloupe","Equatorial Guinea","Greece","South Georgia and the South Sandwich Islands","Guatemala",
+ "Guam","Guinea-Bissau","Guyana","Hong Kong","Heard Island and McDonald Islands","Honduras","Croatia","Haiti","Hungary","Indonesia",
+ "Ireland","Israel","India","British Indian Ocean Territory","Iraq","Iran, Islamic Republic of","Iceland","Italy","Jamaica","Jordan",
+ "Japan","Kenya","Kyrgyzstan","Cambodia","Kiribati","Comoros","Saint Kitts and Nevis","Korea, Democratic People's Republic of","Korea, Republic of","Kuwait",
+ "Cayman Islands","Kazakhstan","Lao People's Democratic Republic","Lebanon","Saint Lucia","Liechtenstein","Sri Lanka","Liberia","Lesotho","Lithuania",
+ "Luxembourg","Latvia","Libyan Arab Jamahiriya","Morocco","Monaco","Moldova, Republic of","Madagascar","Marshall Islands","Macedonia","Mali",
+ "Myanmar","Mongolia","Macau","Northern Mariana Islands","Martinique","Mauritania","Montserrat","Malta","Mauritius","Maldives",
+ "Malawi","Mexico","Malaysia","Mozambique","Namibia","New Caledonia","Niger","Norfolk Island","Nigeria","Nicaragua",
+ "Netherlands","Norway","Nepal","Nauru","Niue","New Zealand","Oman","Panama","Peru","French Polynesia",
+ "Papua New Guinea","Philippines","Pakistan","Poland","Saint Pierre and Miquelon","Pitcairn Islands","Puerto Rico","Palestinian Territory","Portugal","Palau",
+ "Paraguay","Qatar","Reunion","Romania","Russian Federation","Rwanda","Saudi Arabia","Solomon Islands","Seychelles","Sudan",
+ "Sweden","Singapore","Saint Helena","Slovenia","Svalbard and Jan Mayen","Slovakia","Sierra Leone","San Marino","Senegal","Somalia","Suriname",
+ "Sao Tome and Principe","El Salvador","Syrian Arab Republic","Swaziland","Turks and Caicos Islands","Chad","French Southern Territories","Togo","Thailand",
+ "Tajikistan","Tokelau","Turkmenistan","Tunisia","Tonga","Timor-Leste","Turkey","Trinidad and Tobago","Tuvalu","Taiwan",
+ "Tanzania, United Republic of","Ukraine","Uganda","United States Minor Outlying Islands","United States","Uruguay","Uzbekistan","Holy See (Vatican City State)","Saint Vincent and the Grenadines","Venezuela",
+ "Virgin Islands, British","Virgin Islands, U.S.","Vietnam","Vanuatu","Wallis and Futuna","Samoa","Yemen","Mayotte","Serbia","South Africa",
+ "Zambia","Montenegro","Zimbabwe","Anonymous Proxy","Satellite Provider","Other","Aland Islands","Guernsey","Isle of Man","Jersey"};
+
+/* Possible continent codes are AF, AS, EU, NA, OC, SA for Africa, Asia, Europe, North America, Oceania
+and South America. */
+
+const char GeoIP_country_continent[251][3] = {"--","AS","EU","EU","AS","AS","SA","SA","EU","AS","SA",
+ "AF","AN","SA","OC","EU","OC","SA","AS","EU","SA",
+ "AS","EU","AF","EU","AS","AF","AF","SA","AS","SA",
+ "SA","SA","AS","AF","AF","EU","SA","NA","AS","AF",
+ "AF","AF","EU","AF","OC","SA","AF","AS","SA","SA",
+ "SA","AF","AS","AS","EU","EU","AF","EU","SA","SA",
+ "AF","SA","EU","AF","AF","AF","EU","AF","EU","OC",
+ "SA","OC","EU","EU","EU","AF","EU","SA","AS","SA",
+ "AF","EU","SA","AF","AF","SA","AF","EU","SA","SA",
+ "OC","AF","SA","AS","AF","SA","EU","SA","EU","AS",
+ "EU","AS","AS","AS","AS","AS","EU","EU","SA","AS",
+ "AS","AF","AS","AS","OC","AF","SA","AS","AS","AS",
+ "SA","AS","AS","AS","SA","EU","AS","AF","AF","EU",
+ "EU","EU","AF","AF","EU","EU","AF","OC","EU","AF",
+ "AS","AS","AS","OC","SA","AF","SA","EU","AF","AS",
+ "AF","NA","AS","AF","AF","OC","AF","OC","AF","SA",
+ "EU","EU","AS","OC","OC","OC","AS","SA","SA","OC",
+ "OC","AS","AS","EU","SA","OC","SA","AS","EU","OC",
+ "SA","AS","AF","EU","AS","AF","AS","OC","AF","AF",
+ "EU","AS","AF","EU","EU","EU","AF","EU","AF","AF",
+ "SA","AF","SA","AS","AF","SA","AF","AF","AF","AS",
+ "AS","OC","AS","AF","OC","AS","AS","SA","OC","AS",
+ "AF","EU","AF","OC","NA","SA","AS","EU","SA","SA",
+ "SA","SA","AS","OC","OC","OC","AS","AF","EU","AF",
+ "AF","EU","AF","--","--","--","EU","EU","EU","EU"};
+
+const char * GeoIPDBDescription[NUM_DB_TYPES] = {NULL, "GeoIP Country Edition", "GeoIP City Edition, Rev 1", "GeoIP Region Edition, Rev 1", "GeoIP ISP Edition", "GeoIP Organization Edition", "GeoIP City Edition, Rev 0", "GeoIP Region Edition, Rev 0","GeoIP Proxy Edition","GeoIP ASNum Edition","GeoIP Netspeed Edition","GeoIP Domain Name Edition"};
+
+char * custom_directory = NULL;
+
+void GeoIP_setup_custom_directory (char * dir) {
+ custom_directory = dir;
+}
+
+char *_GeoIP_full_path_to(const char *file_name) {
+ int len;
+ char *path = malloc(sizeof(char) * 1024);
+
+ if (custom_directory == NULL){
+#ifndef WIN32
+ memset(path, 0, sizeof(char) * 1024);
+ snprintf(path, sizeof(char) * 1024 - 1, "%s/%s", GEOIPDATADIR, file_name);
+#else
+ char buf[MAX_PATH], *p, *q = NULL;
+ memset(buf, 0, sizeof(buf));
+ len = GetModuleFileName(GetModuleHandle(NULL), buf, sizeof(buf) - 1);
+ for (p = buf + len; p > buf; p--)
+ if (*p == '\\')
+ {
+ if (!q)
+ q = p;
+ else
+ *p = '/';
+ }
+ *q = 0;
+ memset(path, 0, sizeof(char) * 1024);
+ snprintf(path, sizeof(char) * 1024 - 1, "%s/%s", buf, file_name);
+#endif
+ } else {
+ len = strlen(custom_directory);
+ if (custom_directory[len-1] != '/') {
+ snprintf(path, sizeof(char) * 1024 - 1, "%s/%s",custom_directory, file_name);
+ } else {
+ snprintf(path, sizeof(char) * 1024 - 1, "%s%s", custom_directory, file_name);
+ }
+ }
+ return path;
+}
+
+char ** GeoIPDBFileName = NULL;
+
+extern void _GeoIP_setup_dbfilename() {
+ if (NULL == GeoIPDBFileName) {
+ GeoIPDBFileName = malloc(sizeof(char *) * NUM_DB_TYPES);
+ memset(GeoIPDBFileName, 0, sizeof(char *) * NUM_DB_TYPES);
+
+ GeoIPDBFileName[GEOIP_COUNTRY_EDITION] = _GeoIP_full_path_to("GeoIP.dat");
+ GeoIPDBFileName[GEOIP_REGION_EDITION_REV0] = _GeoIP_full_path_to("GeoIPRegion.dat");
+ GeoIPDBFileName[GEOIP_REGION_EDITION_REV1] = _GeoIP_full_path_to("GeoIPRegion.dat");
+ GeoIPDBFileName[GEOIP_CITY_EDITION_REV0] = _GeoIP_full_path_to("GeoIPCity.dat");
+ GeoIPDBFileName[GEOIP_CITY_EDITION_REV1] = _GeoIP_full_path_to("GeoIPCity.dat");
+ GeoIPDBFileName[GEOIP_ISP_EDITION] = _GeoIP_full_path_to("GeoIPISP.dat");
+ GeoIPDBFileName[GEOIP_ORG_EDITION] = _GeoIP_full_path_to("GeoIPOrg.dat");
+ GeoIPDBFileName[GEOIP_PROXY_EDITION] = _GeoIP_full_path_to("GeoIPProxy.dat");
+ GeoIPDBFileName[GEOIP_ASNUM_EDITION] = _GeoIP_full_path_to("GeoIPASNum.dat");
+ GeoIPDBFileName[GEOIP_NETSPEED_EDITION] = _GeoIP_full_path_to("GeoIPNetSpeed.dat");
+ GeoIPDBFileName[GEOIP_DOMAIN_EDITION] = _GeoIP_full_path_to("GeoIPDomain.dat");
+ }
+}
+
+static
+int _file_exists(const char *file_name) {
+ struct stat file_stat;
+ return( (stat(file_name, &file_stat) == 0) ? 1:0);
+}
+
+int GeoIP_db_avail(int type) {
+ const char * filePath;
+ if (type < 0 || type >= NUM_DB_TYPES) {
+ return 0;
+ }
+ _GeoIP_setup_dbfilename();
+ filePath = GeoIPDBFileName[type];
+ if (NULL == filePath) {
+ return 0;
+ }
+ return _file_exists(filePath);
+}
+
+static
+void _setup_segments(GeoIP * gi) {
+ int i, j;
+ unsigned char delim[3];
+ unsigned char buf[SEGMENT_RECORD_LENGTH];
+
+ gi->databaseSegments = NULL;
+
+ /* default to GeoIP Country Edition */
+ gi->databaseType = GEOIP_COUNTRY_EDITION;
+ gi->record_length = STANDARD_RECORD_LENGTH;
+ fseek(gi->GeoIPDatabase, -3l, SEEK_END);
+ for (i = 0; i < STRUCTURE_INFO_MAX_SIZE; i++) {
+ fread(delim, 1, 3, gi->GeoIPDatabase);
+ if (delim[0] == 255 && delim[1] == 255 && delim[2] == 255) {
+ fread(&gi->databaseType, 1, 1, gi->GeoIPDatabase);
+ if (gi->databaseType >= 106) {
+ /* backwards compatibility with databases from April 2003 and earlier */
+ gi->databaseType -= 105;
+ }
+
+ if (gi->databaseType == GEOIP_REGION_EDITION_REV0) {
+ /* Region Edition, pre June 2003 */
+ gi->databaseSegments = malloc(sizeof(int));
+ gi->databaseSegments[0] = STATE_BEGIN_REV0;
+ } else if (gi->databaseType == GEOIP_REGION_EDITION_REV1) {
+ /* Region Edition, post June 2003 */
+ gi->databaseSegments = malloc(sizeof(int));
+ gi->databaseSegments[0] = STATE_BEGIN_REV1;
+ } else if (gi->databaseType == GEOIP_CITY_EDITION_REV0 ||
+ gi->databaseType == GEOIP_CITY_EDITION_REV1 ||
+ gi->databaseType == GEOIP_ORG_EDITION ||
+ gi->databaseType == GEOIP_ISP_EDITION ||
+ gi->databaseType == GEOIP_ASNUM_EDITION) {
+ /* City/Org Editions have two segments, read offset of second segment */
+ gi->databaseSegments = malloc(sizeof(int));
+ gi->databaseSegments[0] = 0;
+ fread(buf, SEGMENT_RECORD_LENGTH, 1, gi->GeoIPDatabase);
+ for (j = 0; j < SEGMENT_RECORD_LENGTH; j++) {
+ gi->databaseSegments[0] += (buf[j] << (j * 8));
+ }
+ if (gi->databaseType == GEOIP_ORG_EDITION ||
+ gi->databaseType == GEOIP_ISP_EDITION)
+ gi->record_length = ORG_RECORD_LENGTH;
+ }
+ break;
+ } else {
+ fseek(gi->GeoIPDatabase, -4l, SEEK_CUR);
+ }
+ }
+ if (gi->databaseType == GEOIP_COUNTRY_EDITION ||
+ gi->databaseType == GEOIP_PROXY_EDITION ||
+ gi->databaseType == GEOIP_NETSPEED_EDITION) {
+ gi->databaseSegments = malloc(sizeof(int));
+ gi->databaseSegments[0] = COUNTRY_BEGIN;
+ }
+}
+
+static
+int _check_mtime(GeoIP *gi) {
+ struct stat buf;
+ if (gi->flags & GEOIP_CHECK_CACHE) {
+ if (stat(gi->file_path, &buf) != -1) {
+ if (buf.st_mtime != gi->mtime) {
+ /* GeoIP Database file updated */
+ if (gi->flags & GEOIP_MEMORY_CACHE) {
+ /* reload database into memory cache */
+ if ((gi->cache = (unsigned char*) realloc(gi->cache, buf.st_size)) == NULL) {
+ fprintf(stderr,"Out of memory when reloading %s\n",gi->file_path);
+ return -1;
+ }
+ }
+ /* refresh filehandle */
+ fclose(gi->GeoIPDatabase);
+ gi->GeoIPDatabase = fopen(gi->file_path,"rb");
+ if (gi->GeoIPDatabase == NULL) {
+ fprintf(stderr,"Error Opening file %s when reloading\n",gi->file_path);
+ return -1;
+ }
+ gi->mtime = buf.st_mtime;
+ if (gi->flags & GEOIP_MEMORY_CACHE) {
+ if (fread(gi->cache, sizeof(unsigned char), buf.st_size, gi->GeoIPDatabase) != (size_t) buf.st_size) {
+ fprintf(stderr,"Error reading file %s when reloading\n",gi->file_path);
+ return -1;
+ }
+ }
+ if (gi->databaseSegments != NULL) {
+ free(gi->databaseSegments);
+ gi->databaseSegments = NULL;
+ }
+ _setup_segments(gi);
+ if (gi->databaseSegments == NULL) {
+ fprintf(stderr, "Error reading file %s -- corrupt\n", gi->file_path);
+ return -1;
+ }
+ if (gi->flags & GEOIP_INDEX_CACHE) {
+ gi->index_cache = (unsigned char *) realloc(gi->index_cache, sizeof(unsigned char) * ((gi->databaseSegments[0] * (long)gi->record_length * 2)));
+ if (gi->index_cache != NULL) {
+ fseek(gi->GeoIPDatabase, 0, SEEK_SET);
+ if (fread(gi->index_cache, sizeof(unsigned char), gi->databaseSegments[0] * (long)gi->record_length * 2, gi->GeoIPDatabase) != (size_t) (gi->databaseSegments[0]*(long)gi->record_length * 2)) {
+ fprintf(stderr,"Error reading file %s where reloading\n",gi->file_path);
+ return -1;
+ }
+ }
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+unsigned int _GeoIP_seek_record (GeoIP *gi, unsigned long ipnum) {
+ int depth;
+ unsigned int x;
+ unsigned char stack_buffer[2 * MAX_RECORD_LENGTH];
+ const unsigned char *buf = (gi->cache == NULL) ? stack_buffer : NULL;
+ unsigned int offset = 0;
+
+ const unsigned char * p;
+ int j;
+
+ _check_mtime(gi);
+ for (depth = 31; depth >= 0; depth--) {
+ if (gi->cache == NULL && gi->index_cache == NULL) {
+ /* read from disk */
+ fseek(gi->GeoIPDatabase, (long)gi->record_length * 2 * offset, SEEK_SET);
+ fread(stack_buffer,gi->record_length,2,gi->GeoIPDatabase);
+ } else if (gi->index_cache == NULL) {
+ /* simply point to record in memory */
+ buf = gi->cache + (long)gi->record_length * 2 *offset;
+ } else {
+ buf = gi->index_cache + (long)gi->record_length * 2 * offset;
+ }
+
+ if (ipnum & (1 << depth)) {
+ /* Take the right-hand branch */
+ if ( gi->record_length == 3 ) {
+ /* Most common case is completely unrolled and uses constants. */
+ x = (buf[3*1 + 0] << (0*8))
+ + (buf[3*1 + 1] << (1*8))
+ + (buf[3*1 + 2] << (2*8));
+
+ } else {
+ /* General case */
+ j = gi->record_length;
+ p = &buf[2*j];
+ x = 0;
+ do {
+ x <<= 8;
+ x += *(--p);
+ } while ( --j );
+ }
+
+ } else {
+ /* Take the left-hand branch */
+ if ( gi->record_length == 3 ) {
+ /* Most common case is completely unrolled and uses constants. */
+ x = (buf[3*0 + 0] << (0*8))
+ + (buf[3*0 + 1] << (1*8))
+ + (buf[3*0 + 2] << (2*8));
+ } else {
+ /* General case */
+ j = gi->record_length;
+ p = &buf[1*j];
+ x = 0;
+ do {
+ x <<= 8;
+ x += *(--p);
+ } while ( --j );
+ }
+ }
+
+ if (x >= gi->databaseSegments[0]) {
+ gi->netmask = 32 - depth;
+ return x;
+ }
+ offset = x;
+ }
+
+ /* shouldn't reach here */
+ fprintf(stderr,"Error Traversing Database for ipnum = %lu - Perhaps database is corrupt?\n",ipnum);
+ return 0;
+}
+
+unsigned long _GeoIP_addr_to_num (const char *addr) {
+ int i;
+ char tok[4];
+ int octet;
+ int j = 0, k = 0;
+ unsigned long ipnum = 0;
+ char c = 0;
+
+ for (i=0; i<4; i++) {
+ for (;;) {
+ c = addr[k++];
+ if (c == '.' || c == '\0') {
+ tok[j] = '\0';
+ octet = atoi(tok);
+ if (octet > 255)
+ return 0;
+ ipnum += (octet << ((3-i)*8));
+ j = 0;
+ break;
+ } else if (c >= '0' && c<= '9') {
+ if (j > 2) {
+ return 0;
+ }
+ tok[j++] = c;
+ } else {
+ return 0;
+ }
+ }
+ if(c == '\0' && i<3) {
+ return 0;
+ }
+ }
+ return ipnum;
+}
+
+GeoIP* GeoIP_open_type (int type, int flags) {
+ GeoIP * gi;
+ const char * filePath;
+ if (type < 0 || type >= NUM_DB_TYPES) {
+ printf("Invalid database type %d\n", type);
+ return NULL;
+ }
+ _GeoIP_setup_dbfilename();
+ filePath = GeoIPDBFileName[type];
+ if (filePath == NULL) {
+ printf("Invalid database type %d\n", type);
+ return NULL;
+ }
+ gi = GeoIP_open (filePath, flags);
+ return gi;
+}
+
+GeoIP* GeoIP_new (int flags) {
+ GeoIP * gi;
+ _GeoIP_setup_dbfilename();
+ gi = GeoIP_open (GeoIPDBFileName[GEOIP_COUNTRY_EDITION], flags);
+ return gi;
+}
+
+GeoIP* GeoIP_open (const char * filename, int flags) {
+ struct stat buf;
+ GeoIP * gi;
+ size_t len;
+
+#ifdef WIN32
+ WSADATA wsa;
+ if (WSAStartup(MAKEWORD(1, 1), &wsa) != 0)
+ return NULL;
+#endif
+
+ gi = (GeoIP *)malloc(sizeof(GeoIP));
+ if (gi == NULL)
+ return NULL;
+ len = sizeof(char) * (strlen(filename)+1);
+ gi->file_path = malloc(len);
+ if (gi->file_path == NULL) {
+ free(gi);
+ return NULL;
+ }
+ strncpy(gi->file_path, filename, len);
+ gi->GeoIPDatabase = fopen(filename,"rb");
+ if (gi->GeoIPDatabase == NULL) {
+ fprintf(stderr,"Error Opening file %s\n",filename);
+ free(gi->file_path);
+ free(gi);
+ return NULL;
+ } else {
+ if (flags & GEOIP_MEMORY_CACHE) {
+ if (fstat(fileno(gi->GeoIPDatabase), &buf) == -1) {
+ fprintf(stderr,"Error stating file %s\n",filename);
+ free(gi->file_path);
+ free(gi);
+ return NULL;
+ }
+ gi->mtime = buf.st_mtime;
+ gi->cache = (unsigned char *) malloc(sizeof(unsigned char) * buf.st_size);
+ if (gi->cache != NULL) {
+ if (fread(gi->cache, sizeof(unsigned char), buf.st_size, gi->GeoIPDatabase) != (size_t) buf.st_size) {
+ fprintf(stderr,"Error reading file %s\n",filename);
+ free(gi->cache);
+ free(gi->file_path);
+ free(gi);
+ return NULL;
+ }
+ }
+ } else {
+ if (flags & GEOIP_CHECK_CACHE) {
+ if (fstat(fileno(gi->GeoIPDatabase), &buf) == -1) {
+ fprintf(stderr,"Error stating file %s\n",filename);
+ free(gi->file_path);
+ free(gi);
+ return NULL;
+ }
+ gi->mtime = buf.st_mtime;
+ }
+ gi->cache = NULL;
+ }
+ gi->flags = flags;
+ gi->charset = GEOIP_CHARSET_ISO_8859_1;
+
+ _setup_segments(gi);
+ if (flags & GEOIP_INDEX_CACHE) {
+ gi->index_cache = (unsigned char *) malloc(sizeof(unsigned char) * ((gi->databaseSegments[0] * (long)gi->record_length * 2)));
+ if (gi->index_cache != NULL) {
+ fseek(gi->GeoIPDatabase, 0, SEEK_SET);
+ if (fread(gi->index_cache, sizeof(unsigned char), gi->databaseSegments[0] * (long)gi->record_length * 2, gi->GeoIPDatabase) != (size_t) (gi->databaseSegments[0]*(long)gi->record_length * 2)) {
+ fprintf(stderr,"Error reading file %s\n",filename);
+ free(gi->databaseSegments);
+ free(gi->index_cache);
+ free(gi);
+ return NULL;
+ }
+ }
+ } else {
+ gi->index_cache = NULL;
+ }
+ return gi;
+ }
+}
+
+void GeoIP_delete (GeoIP *gi) {
+ if (gi == NULL )
+ return;
+ if (gi->GeoIPDatabase != NULL)
+ fclose(gi->GeoIPDatabase);
+ if (gi->cache != NULL)
+ free(gi->cache);
+ if (gi->index_cache != NULL)
+ free(gi->index_cache);
+ if (gi->file_path != NULL)
+ free(gi->file_path);
+ if (gi->databaseSegments != NULL)
+ free(gi->databaseSegments);
+ free(gi);
+}
+
+const char *GeoIP_country_code_by_name (GeoIP* gi, const char *name) {
+ int country_id;
+ country_id = GeoIP_id_by_name(gi, name);
+ return (country_id > 0) ? GeoIP_country_code[country_id] : NULL;
+}
+
+const char *GeoIP_country_code3_by_name (GeoIP* gi, const char *name) {
+ int country_id;
+ country_id = GeoIP_id_by_name(gi, name);
+ return (country_id > 0) ? GeoIP_country_code3[country_id] : NULL;
+}
+
+const char *GeoIP_country_name_by_name (GeoIP* gi, const char *name) {
+ int country_id;
+ country_id = GeoIP_id_by_name(gi, name);
+ return (country_id > 0) ? GeoIP_country_name[country_id] : NULL;
+}
+
+unsigned long _GeoIP_lookupaddress (const char *host) {
+ unsigned long addr = inet_addr(host);
+ struct hostent phe2;
+ struct hostent * phe = &phe2;
+ char *buf = NULL;
+#ifdef HAVE_GETHOSTBYNAME_R
+ int buflength = 16384;
+ int herr = 0;
+#endif
+ int result = 0;
+#ifdef HAVE_GETHOSTBYNAME_R
+ buf = malloc(buflength);
+#endif
+ if (addr == INADDR_NONE) {
+#ifdef HAVE_GETHOSTBYNAME_R
+ while (1) {
+ /* we use gethostbyname_r here because it is thread-safe and gethostbyname is not */
+#ifdef GETHOSTBYNAME_R_RETURNS_INT
+ result = gethostbyname_r(host,&phe2,buf,buflength,&phe,&herr);
+#else
+ phe = gethostbyname_r(host,&phe2,buf,buflength,&herr);
+#endif
+ if (herr != ERANGE)
+ break;
+ if (result == 0)
+ break;
+ /* double the buffer if the buffer is too small */
+ buflength = buflength * 2;
+ buf = realloc(buf,buflength);
+ }
+#endif
+#ifndef HAVE_GETHOSTBYNAME_R
+ /* Some systems do not support gethostbyname_r, such as Mac OS X */
+ phe = gethostbyname(host);
+#endif
+ if (!phe || result != 0) {
+ free(buf);
+ return 0;
+ }
+ addr = *((unsigned long *) phe->h_addr_list[0]);
+ }
+#ifdef HAVE_GETHOSTBYNAME_R
+ free(buf);
+#endif
+ return ntohl(addr);
+}
+
+int GeoIP_id_by_name (GeoIP* gi, const char *name) {
+ unsigned long ipnum;
+ int ret;
+ if (name == NULL) {
+ return 0;
+ }
+ if (gi->databaseType != GEOIP_COUNTRY_EDITION && gi->databaseType != GEOIP_PROXY_EDITION && gi->databaseType != GEOIP_NETSPEED_EDITION) {
+ printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int)gi->databaseType], GeoIPDBDescription[GEOIP_COUNTRY_EDITION]);
+ return 0;
+ }
+ if (!(ipnum = _GeoIP_lookupaddress(name)))
+ return 0;
+ ret = _GeoIP_seek_record(gi, ipnum) - COUNTRY_BEGIN;
+ return ret;
+
+}
+
+const char *GeoIP_country_code_by_addr (GeoIP* gi, const char *addr) {
+ int country_id;
+ country_id = GeoIP_id_by_addr(gi, addr);
+ return (country_id > 0) ? GeoIP_country_code[country_id] : NULL;
+}
+
+const char *GeoIP_country_code3_by_addr (GeoIP* gi, const char *addr) {
+ int country_id;
+ country_id = GeoIP_id_by_addr(gi, addr);
+ return (country_id > 0) ? GeoIP_country_code3[country_id] : NULL;
+ return GeoIP_country_code3[country_id];
+}
+
+const char *GeoIP_country_name_by_addr (GeoIP* gi, const char *addr) {
+ int country_id;
+ country_id = GeoIP_id_by_addr(gi, addr);
+ return (country_id > 0) ? GeoIP_country_name[country_id] : NULL;
+ return GeoIP_country_name[country_id];
+}
+
+const char *GeoIP_country_name_by_ipnum (GeoIP* gi, unsigned long ipnum) {
+ int country_id;
+ country_id = GeoIP_id_by_ipnum(gi, ipnum);
+ return (country_id > 0) ? GeoIP_country_name[country_id] : NULL;
+}
+
+const char *GeoIP_country_code_by_ipnum (GeoIP* gi, unsigned long ipnum) {
+ int country_id;
+ country_id = GeoIP_id_by_ipnum(gi, ipnum);
+ return (country_id > 0) ? GeoIP_country_code[country_id] : NULL;
+}
+
+const char *GeoIP_country_code3_by_ipnum (GeoIP* gi, unsigned long ipnum) {
+ int country_id;
+ country_id = GeoIP_id_by_ipnum(gi, ipnum);
+ return (country_id > 0) ? GeoIP_country_code3[country_id] : NULL;
+}
+
+int GeoIP_country_id_by_addr (GeoIP* gi, const char *addr) {
+ return GeoIP_id_by_addr(gi, addr);
+}
+
+int GeoIP_country_id_by_name (GeoIP* gi, const char *host) {
+ return GeoIP_id_by_name(gi, host);
+}
+
+int GeoIP_id_by_addr (GeoIP* gi, const char *addr) {
+ unsigned long ipnum;
+ int ret;
+ if (addr == NULL) {
+ return 0;
+ }
+ if (gi->databaseType != GEOIP_COUNTRY_EDITION &&
+ gi->databaseType != GEOIP_PROXY_EDITION &&
+ gi->databaseType != GEOIP_NETSPEED_EDITION) {
+ printf("Invalid database type %s, expected %s\n",
+ GeoIPDBDescription[(int)gi->databaseType],
+ GeoIPDBDescription[GEOIP_COUNTRY_EDITION]);
+ return 0;
+ }
+ ipnum = _GeoIP_addr_to_num(addr);
+ ret = _GeoIP_seek_record(gi, ipnum) - COUNTRY_BEGIN;
+ return ret;
+}
+
+int GeoIP_id_by_ipnum (GeoIP* gi, unsigned long ipnum) {
+ int ret;
+ if (ipnum == 0) {
+ return 0;
+ }
+ if (gi->databaseType != GEOIP_COUNTRY_EDITION &&
+ gi->databaseType != GEOIP_PROXY_EDITION &&
+ gi->databaseType != GEOIP_NETSPEED_EDITION) {
+ printf("Invalid database type %s, expected %s\n",
+ GeoIPDBDescription[(int)gi->databaseType],
+ GeoIPDBDescription[GEOIP_COUNTRY_EDITION]);
+ return 0;
+ }
+ ret = _GeoIP_seek_record(gi, ipnum) - COUNTRY_BEGIN;
+ return ret;
+}
+
+char *GeoIP_database_info (GeoIP* gi) {
+ int i;
+ unsigned char buf[3];
+ char *retval;
+ int hasStructureInfo = 0;
+
+ if(gi == NULL)
+ return NULL;
+
+ _check_mtime(gi);
+ fseek(gi->GeoIPDatabase, -3l, SEEK_END);
+
+ /* first get past the database structure information */
+ for (i = 0; i < STRUCTURE_INFO_MAX_SIZE; i++) {
+ fread(buf, 1, 3, gi->GeoIPDatabase);
+ if (buf[0] == 255 && buf[1] == 255 && buf[2] == 255) {
+ hasStructureInfo = 1;
+ break;
+ }
+ fseek(gi->GeoIPDatabase, -4l, SEEK_CUR);
+ }
+ if (hasStructureInfo == 1) {
+ fseek(gi->GeoIPDatabase, -6l, SEEK_CUR);
+ } else {
+ /* no structure info, must be pre Sep 2002 database, go back to end */
+ fseek(gi->GeoIPDatabase, -3l, SEEK_END);
+ }
+
+ for (i = 0; i < DATABASE_INFO_MAX_SIZE; i++) {
+ fread(buf, 1, 3, gi->GeoIPDatabase);
+ if (buf[0] == 0 && buf[1] == 0 && buf[2] == 0) {
+ retval = malloc(sizeof(char) * (i+1));
+ if (retval == NULL) {
+ return NULL;
+ }
+ fread(retval, 1, i, gi->GeoIPDatabase);
+ retval[i] = '\0';
+ return retval;
+ }
+ fseek(gi->GeoIPDatabase, -4l, SEEK_CUR);
+ }
+ return NULL;
+}
+
+/* GeoIP Region Edition functions */
+
+void GeoIP_assign_region_by_inetaddr(GeoIP* gi, unsigned long inetaddr, GeoIPRegion *region) {
+ unsigned int seek_region;
+
+ /* This also writes in the terminating NULs (if you decide to
+ * keep them) and clear any fields that are not set. */
+ memset(region, 0, sizeof(GeoIPRegion));
+
+ seek_region = _GeoIP_seek_record(gi, ntohl(inetaddr));
+
+ if (gi->databaseType == GEOIP_REGION_EDITION_REV0) {
+ /* Region Edition, pre June 2003 */
+ seek_region -= STATE_BEGIN_REV0;
+ if (seek_region >= 1000) {
+ region->country_code[0] = 'U';
+ region->country_code[1] = 'S';
+ region->region[0] = (char) ((seek_region - 1000)/26 + 65);
+ region->region[1] = (char) ((seek_region - 1000)%26 + 65);
+ } else {
+ memcpy(region->country_code, GeoIP_country_code[seek_region], 2);
+ }
+ } else if (gi->databaseType == GEOIP_REGION_EDITION_REV1) {
+ /* Region Edition, post June 2003 */
+ seek_region -= STATE_BEGIN_REV1;
+ if (seek_region < US_OFFSET) {
+ /* Unknown */
+ /* we don't need to do anything here b/c we memset region to 0 */
+ } else if (seek_region < CANADA_OFFSET) {
+ /* USA State */
+ region->country_code[0] = 'U';
+ region->country_code[1] = 'S';
+ region->region[0] = (char) ((seek_region - US_OFFSET)/26 + 65);
+ region->region[1] = (char) ((seek_region - US_OFFSET)%26 + 65);
+ } else if (seek_region < WORLD_OFFSET) {
+ /* Canada Province */
+ region->country_code[0] = 'C';
+ region->country_code[1] = 'A';
+ region->region[0] = (char) ((seek_region - CANADA_OFFSET)/26 + 65);
+ region->region[1] = (char) ((seek_region - CANADA_OFFSET)%26 + 65);
+ } else {
+ /* Not US or Canada */
+ memcpy(region->country_code, GeoIP_country_code[(seek_region - WORLD_OFFSET) / FIPS_RANGE], 2);
+ }
+ }
+}
+
+static
+GeoIPRegion * _get_region(GeoIP* gi, unsigned long ipnum) {
+ GeoIPRegion * region;
+
+ region = malloc(sizeof(GeoIPRegion));
+ if (region) {
+ GeoIP_assign_region_by_inetaddr(gi, htonl(ipnum), region);
+ }
+ return region;
+}
+
+GeoIPRegion * GeoIP_region_by_addr (GeoIP* gi, const char *addr) {
+ unsigned long ipnum;
+ if (addr == NULL) {
+ return 0;
+ }
+ if (gi->databaseType != GEOIP_REGION_EDITION_REV0 &&
+ gi->databaseType != GEOIP_REGION_EDITION_REV1) {
+ printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int)gi->databaseType], GeoIPDBDescription[GEOIP_REGION_EDITION_REV1]);
+ return 0;
+ }
+ ipnum = _GeoIP_addr_to_num(addr);
+ return _get_region(gi, ipnum);
+}
+
+GeoIPRegion * GeoIP_region_by_name (GeoIP* gi, const char *name) {
+ unsigned long ipnum;
+ if (name == NULL) {
+ return 0;
+ }
+ if (gi->databaseType != GEOIP_REGION_EDITION_REV0 &&
+ gi->databaseType != GEOIP_REGION_EDITION_REV1) {
+ printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int)gi->databaseType], GeoIPDBDescription[GEOIP_REGION_EDITION_REV1]);
+ return 0;
+ }
+ if (!(ipnum = _GeoIP_lookupaddress(name)))
+ return 0;
+ return _get_region(gi, ipnum);
+}
+
+GeoIPRegion * GeoIP_region_by_ipnum (GeoIP* gi, unsigned long ipnum) {
+ if (gi->databaseType != GEOIP_REGION_EDITION_REV0 &&
+ gi->databaseType != GEOIP_REGION_EDITION_REV1) {
+ printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int)gi->databaseType], GeoIPDBDescription[GEOIP_REGION_EDITION_REV1]);
+ return 0;
+ }
+ return _get_region(gi, ipnum);
+}
+
+void GeoIPRegion_delete (GeoIPRegion *gir) {
+ free(gir);
+}
+
+/* GeoIP Organization, ISP and AS Number Edition private method */
+static
+char *_get_name (GeoIP* gi, unsigned long ipnum) {
+ unsigned int seek_org;
+ char buf[MAX_ORG_RECORD_LENGTH];
+ char * org_buf, * buf_pointer;
+ int record_pointer;
+ size_t len;
+
+ if (gi->databaseType != GEOIP_ORG_EDITION &&
+ gi->databaseType != GEOIP_ISP_EDITION &&
+ gi->databaseType != GEOIP_ASNUM_EDITION) {
+ printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int)gi->databaseType], GeoIPDBDescription[GEOIP_ORG_EDITION]);
+ return 0;
+ }
+
+ seek_org = _GeoIP_seek_record(gi, ipnum);
+ if (seek_org == gi->databaseSegments[0])
+ return NULL;
+
+ record_pointer = seek_org + (2 * gi->record_length - 1) * gi->databaseSegments[0];
+
+ if (gi->cache == NULL) {
+ fseek(gi->GeoIPDatabase, record_pointer, SEEK_SET);
+ fread(buf, sizeof(char), MAX_ORG_RECORD_LENGTH, gi->GeoIPDatabase);
+ len = sizeof(char) * (strlen(buf)+1);
+ org_buf = malloc(len);
+ strncpy(org_buf, buf, len);
+ } else {
+ buf_pointer = (char *)gi->cache + (long)record_pointer;
+ len = sizeof(char) * (strlen(buf_pointer)+1);
+ org_buf = malloc(len);
+ strncpy(org_buf, buf_pointer, len);
+ }
+ return org_buf;
+}
+
+char *GeoIP_name_by_ipnum (GeoIP* gi, unsigned long ipnum) {
+ return _get_name(gi,ipnum);
+}
+
+char *GeoIP_name_by_addr (GeoIP* gi, const char *addr) {
+ unsigned long ipnum;
+ if (addr == NULL) {
+ return 0;
+ }
+ ipnum = _GeoIP_addr_to_num(addr);
+ return _get_name(gi, ipnum);
+}
+
+char *GeoIP_name_by_name (GeoIP* gi, const char *name) {
+ unsigned long ipnum;
+ if (name == NULL) {
+ return 0;
+ }
+ if (!(ipnum = _GeoIP_lookupaddress(name)))
+ return 0;
+ return _get_name(gi, ipnum);
+}
+
+char *GeoIP_org_by_ipnum (GeoIP* gi, unsigned long ipnum) {
+ return GeoIP_name_by_ipnum(gi, ipnum);
+}
+
+char *GeoIP_org_by_addr (GeoIP* gi, const char *addr) {
+ return GeoIP_name_by_addr(gi, addr);
+}
+
+char *GeoIP_org_by_name (GeoIP* gi, const char *name) {
+ return GeoIP_name_by_name(gi, name);
+}
+
+unsigned char GeoIP_database_edition (GeoIP* gi) {
+ return gi->databaseType;
+}
+
+int GeoIP_charset( GeoIP* gi){
+ return gi->charset;
+}
+
+int GeoIP_set_charset( GeoIP* gi, int charset ){
+ int old_charset = gi->charset;
+ gi->charset = charset;
+ return old_charset;
+}
+
+int GeoIP_last_netmask (GeoIP* gi) {
+ return gi->netmask;
+}
+
diff --git a/src/GeoIP-1.4.0/libGeoIP/GeoIP.h b/src/GeoIP-1.4.0/libGeoIP/GeoIP.h
new file mode 100644
index 0000000..edac45b
--- /dev/null
+++ b/src/GeoIP-1.4.0/libGeoIP/GeoIP.h
@@ -0,0 +1,183 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
+/* GeoIP.h
+ *
+ * Copyright (C) 2006 MaxMind LLC
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef GEOIP_H
+#define GEOIP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include<stdio.h>
+#include<stdlib.h>
+#include<string.h>
+#include <sys/types.h> /* for fstat */
+#include <sys/stat.h> /* for fstat */
+
+#define SEGMENT_RECORD_LENGTH 3
+#define STANDARD_RECORD_LENGTH 3
+#define ORG_RECORD_LENGTH 4
+#define MAX_RECORD_LENGTH 4
+#define NUM_DB_TYPES 20
+
+typedef struct GeoIPTag {
+ FILE *GeoIPDatabase;
+ char *file_path;
+ unsigned char *cache;
+ unsigned char *index_cache;
+ unsigned int *databaseSegments;
+ char databaseType;
+ time_t mtime;
+ int flags;
+ char record_length;
+ int charset; /* 0 iso-8859-1 1 utf8 */
+ int record_iter; /* used in GeoIP_next_record */
+ int netmask; /* netmask of last lookup - set using depth in _GeoIP_seek_record */
+} GeoIP;
+
+
+typedef enum {
+ GEOIP_CHARSET_ISO_8859_1 = 0,
+ GEOIP_CHARSET_UTF8 = 1
+} GeoIPCharset;
+
+typedef struct GeoIPRegionTag {
+ char country_code[3];
+ char region[3];
+} GeoIPRegion;
+
+typedef enum {
+ GEOIP_STANDARD = 0,
+ GEOIP_MEMORY_CACHE = 1,
+ GEOIP_CHECK_CACHE = 2,
+ GEOIP_INDEX_CACHE = 4,
+} GeoIPOptions;
+
+typedef enum {
+ GEOIP_COUNTRY_EDITION = 1,
+ GEOIP_REGION_EDITION_REV0 = 7,
+ GEOIP_CITY_EDITION_REV0 = 6,
+ GEOIP_ORG_EDITION = 5,
+ GEOIP_ISP_EDITION = 4,
+ GEOIP_CITY_EDITION_REV1 = 2,
+ GEOIP_REGION_EDITION_REV1 = 3,
+ GEOIP_PROXY_EDITION = 8,
+ GEOIP_ASNUM_EDITION = 9,
+ GEOIP_NETSPEED_EDITION = 10,
+ GEOIP_DOMAIN_EDITION = 11
+} GeoIPDBTypes;
+
+typedef enum {
+ GEOIP_ANON_PROXY = 1,
+ GEOIP_HTTP_X_FORWARDED_FOR_PROXY = 2,
+ GEOIP_HTTP_CLIENT_IP_PROXY = 3,
+} GeoIPProxyTypes;
+
+typedef enum {
+ GEOIP_UNKNOWN_SPEED = 0,
+ GEOIP_DIALUP_SPEED = 1,
+ GEOIP_CABLEDSL_SPEED = 2,
+ GEOIP_CORPORATE_SPEED = 3,
+} GeoIPNetspeedValues;
+
+extern char **GeoIPDBFileName;
+extern const char * GeoIPDBDescription[NUM_DB_TYPES];
+extern const char *GeoIPCountryDBFileName;
+extern const char *GeoIPRegionDBFileName;
+extern const char *GeoIPCityDBFileName;
+extern const char *GeoIPOrgDBFileName;
+extern const char *GeoIPISPDBFileName;
+
+extern const char GeoIP_country_code[251][3];
+extern const char GeoIP_country_code3[251][4];
+extern const char * GeoIP_country_name[251];
+extern const char GeoIP_country_continent[251][3];
+
+#ifdef DLL
+#define GEOIP_API __declspec(dllexport)
+#else
+#define GEOIP_API
+#endif /* DLL */
+
+GEOIP_API void GeoIP_setup_custom_directory(char *dir);
+GEOIP_API GeoIP* GeoIP_open_type (int type, int flags);
+GEOIP_API GeoIP* GeoIP_new(int flags);
+GEOIP_API GeoIP* GeoIP_open(const char * filename, int flags);
+GEOIP_API int GeoIP_db_avail(int type);
+GEOIP_API void GeoIP_delete(GeoIP* gi);
+GEOIP_API const char *GeoIP_country_code_by_addr (GeoIP* gi, const char *addr);
+GEOIP_API const char *GeoIP_country_code_by_name (GeoIP* gi, const char *host);
+GEOIP_API const char *GeoIP_country_code3_by_addr (GeoIP* gi, const char *addr);
+GEOIP_API const char *GeoIP_country_code3_by_name (GeoIP* gi, const char *host);
+GEOIP_API const char *GeoIP_country_name_by_addr (GeoIP* gi, const char *addr);
+GEOIP_API const char *GeoIP_country_name_by_name (GeoIP* gi, const char *host);
+GEOIP_API const char *GeoIP_country_name_by_ipnum (GeoIP* gi, unsigned long ipnum);
+GEOIP_API const char *GeoIP_country_code_by_ipnum (GeoIP* gi, unsigned long ipnum);
+GEOIP_API const char *GeoIP_country_code3_by_ipnum (GeoIP* gi, unsigned long ipnum);
+
+/* Deprecated - for backwards compatibility only */
+GEOIP_API int GeoIP_country_id_by_addr (GeoIP* gi, const char *addr);
+GEOIP_API int GeoIP_country_id_by_name (GeoIP* gi, const char *host);
+GEOIP_API char *GeoIP_org_by_addr (GeoIP* gi, const char *addr);
+GEOIP_API char *GeoIP_org_by_ipnum (GeoIP* gi, unsigned long ipnum);
+GEOIP_API char *GeoIP_org_by_name (GeoIP* gi, const char *host);
+/* End deprecated */
+
+GEOIP_API int GeoIP_id_by_addr (GeoIP* gi, const char *addr);
+GEOIP_API int GeoIP_id_by_name (GeoIP* gi, const char *host);
+GEOIP_API int GeoIP_id_by_ipnum (GeoIP* gi, unsigned long ipnum);
+
+GEOIP_API GeoIPRegion * GeoIP_region_by_addr (GeoIP* gi, const char *addr);
+GEOIP_API GeoIPRegion * GeoIP_region_by_name (GeoIP* gi, const char *host);
+GEOIP_API GeoIPRegion * GeoIP_region_by_ipnum (GeoIP *gi, unsigned long ipnum);
+
+/* Warning - don't call this after GeoIP_assign_region_by_inetaddr calls */
+GEOIP_API void GeoIPRegion_delete (GeoIPRegion *gir);
+
+GEOIP_API void GeoIP_assign_region_by_inetaddr(GeoIP* gi, unsigned long inetaddr, GeoIPRegion *gir);
+
+/* Used to query GeoIP Organization, ISP and AS Number databases */
+GEOIP_API char *GeoIP_name_by_ipnum (GeoIP* gi, unsigned long ipnum);
+GEOIP_API char *GeoIP_name_by_addr (GeoIP* gi, const char *addr);
+GEOIP_API char *GeoIP_name_by_name (GeoIP* gi, const char *host);
+
+GEOIP_API char *GeoIP_database_info (GeoIP* gi);
+GEOIP_API unsigned char GeoIP_database_edition (GeoIP* gi);
+
+GEOIP_API int GeoIP_charset (GeoIP* gi);
+GEOIP_API int GeoIP_set_charset (GeoIP* gi, int charset);
+
+GEOIP_API int GeoIP_last_netmask (GeoIP* gi);
+
+/* Convert region code to region name */
+GEOIP_API const char * GeoIP_region_name_by_code(const char *country_code, const char *region_code);
+
+/* Get timezone from country and region code */
+GEOIP_API const char * GeoIP_time_zone_by_country_and_region(const char *country_code, const char *region_code);
+
+#ifdef BSD
+#define memcpy(dest, src, n) bcopy(src, dest, n)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GEOIP_H */
diff --git a/src/GeoIP-1.4.0/libGeoIP/GeoIPCity.c b/src/GeoIP-1.4.0/libGeoIP/GeoIPCity.c
new file mode 100644
index 0000000..46fcf79
--- /dev/null
+++ b/src/GeoIP-1.4.0/libGeoIP/GeoIPCity.c
@@ -0,0 +1,244 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
+/* GeoIPCity.c
+ *
+ * Copyright (C) 2006 MaxMind LLC
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <GeoIP.h>
+#include <GeoIP_internal.h>
+#include <GeoIPCity.h>
+#ifndef WIN32
+#include <netdb.h>
+#include <netinet/in.h> /* For ntohl */
+#else
+#include <windows.h>
+#include <winsock.h>
+#endif
+#include <sys/types.h> /* For uint32_t */
+#ifdef HAVE_STDINT_H
+#include <stdint.h> /* For uint32_t */
+#endif
+
+static
+const int FULL_RECORD_LENGTH = 50;
+
+static
+GeoIPRecord * _extract_record(GeoIP* gi, unsigned int seek_record, int *next_record_ptr) {
+ int record_pointer;
+ unsigned char *record_buf = NULL;
+ unsigned char *begin_record_buf = NULL;
+ GeoIPRecord * record;
+ int str_length = 0;
+ int j;
+ double latitude = 0, longitude = 0;
+ int dmaarea_combo = 0;
+ int bytes_read = 0;
+ if (seek_record == gi->databaseSegments[0])
+ return NULL;
+
+ record = malloc(sizeof(GeoIPRecord));
+ memset(record, 0, sizeof(GeoIPRecord));
+
+ record->charset = gi->charset;
+
+ record_pointer = seek_record + (2 * gi->record_length - 1) * gi->databaseSegments[0];
+
+ if (gi->cache == NULL) {
+ fseek(gi->GeoIPDatabase, record_pointer, SEEK_SET);
+ begin_record_buf = record_buf = malloc(sizeof(char) * FULL_RECORD_LENGTH);
+ bytes_read = fread(record_buf, sizeof(char), FULL_RECORD_LENGTH, gi->GeoIPDatabase);
+ if (bytes_read == 0) {
+ /* eof or other error */
+ free(begin_record_buf);
+ free(record);
+ return NULL;
+ }
+ } else {
+ record_buf = gi->cache + (long)record_pointer;
+ }
+
+ /* get country */
+ record->continent_code = (char *) GeoIP_country_continent[record_buf[0]];
+ record->country_code = (char *) GeoIP_country_code [record_buf[0]];
+ record->country_code3 = (char *) GeoIP_country_code3[record_buf[0]];
+ record->country_name = (char *) GeoIP_country_name [record_buf[0]];
+ record_buf++;
+
+ /* get region */
+ while (record_buf[str_length] != '\0')
+ str_length++;
+ if (str_length > 0) {
+ record->region = malloc(str_length+1);
+ strncpy(record->region, (char *)record_buf, str_length+1);
+ }
+ record_buf += str_length + 1;
+ str_length = 0;
+
+ /* get city */
+ while (record_buf[str_length] != '\0')
+ str_length++;
+ if (str_length > 0) {
+ if ( gi->charset == GEOIP_CHARSET_UTF8 ) {
+ record->city = _iso_8859_1__utf8( (const char * ) record_buf );
+ } else {
+ record->city = malloc(str_length+1);
+ strncpy(record->city, ( const char * ) record_buf, str_length+1);
+ }
+ }
+ record_buf += (str_length + 1);
+ str_length = 0;
+
+ /* get postal code */
+ while (record_buf[str_length] != '\0')
+ str_length++;
+ if (str_length > 0) {
+ record->postal_code = malloc(str_length+1);
+ strncpy(record->postal_code, (char *)record_buf, str_length+1);
+ }
+ record_buf += (str_length + 1);
+
+ /* get latitude */
+for (j = 0; j < 3; ++j)
+ latitude += (record_buf[j] << (j * 8));
+ record->latitude = latitude/10000 - 180;
+ record_buf += 3;
+
+ /* get longitude */
+ for (j = 0; j < 3; ++j)
+ longitude += (record_buf[j] << (j * 8));
+ record->longitude = longitude/10000 - 180;
+
+ /* get area code and dma code for post April 2002 databases and for US locations */
+ if (GEOIP_CITY_EDITION_REV1 == gi->databaseType) {
+ if (!strcmp(record->country_code, "US")) {
+ record_buf += 3;
+ for (j = 0; j < 3; ++j)
+ dmaarea_combo += (record_buf[j] << (j * 8));
+ record->dma_code = dmaarea_combo/1000;
+ record->area_code = dmaarea_combo % 1000;
+ }
+ }
+
+ if (gi->cache == NULL)
+ free(begin_record_buf);
+
+ /* Used for GeoIP_next_record */
+ if (next_record_ptr != NULL)
+ *next_record_ptr = seek_record + record_buf - begin_record_buf + 3;
+
+ return record;
+}
+
+static
+GeoIPRecord * _get_record(GeoIP* gi, unsigned long ipnum) {
+ unsigned int seek_record;
+
+ if (gi->databaseType != GEOIP_CITY_EDITION_REV0 &&
+ gi->databaseType != GEOIP_CITY_EDITION_REV1) {
+ printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int)gi->databaseType], GeoIPDBDescription[GEOIP_CITY_EDITION_REV1]);
+ return 0;
+ }
+
+ seek_record = _GeoIP_seek_record(gi, ipnum);
+ return _extract_record(gi, seek_record, NULL);
+}
+
+GeoIPRecord * GeoIP_record_by_ipnum (GeoIP* gi, unsigned long ipnum) {
+ return _get_record(gi, ipnum);
+}
+
+GeoIPRecord * GeoIP_record_by_addr (GeoIP* gi, const char *addr) {
+ unsigned long ipnum;
+ if (addr == NULL) {
+ return 0;
+ }
+ ipnum = _GeoIP_addr_to_num(addr);
+ return _get_record(gi, ipnum);
+}
+
+GeoIPRecord * GeoIP_record_by_name (GeoIP* gi, const char *name) {
+ unsigned long ipnum;
+ if (name == NULL) {
+ return 0;
+ }
+ ipnum = _GeoIP_lookupaddress(name);
+ return _get_record(gi, ipnum);
+}
+
+int GeoIP_record_id_by_addr (GeoIP* gi, const char *addr) {
+ unsigned long ipnum;
+ if (gi->databaseType != GEOIP_CITY_EDITION_REV0 &&
+ gi->databaseType != GEOIP_CITY_EDITION_REV1) {
+ printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int)gi->databaseType], GeoIPDBDescription[GEOIP_CITY_EDITION_REV1]);
+ return 0;
+ }
+ if (addr == NULL) {
+ return 0;
+ }
+ ipnum = _GeoIP_addr_to_num(addr);
+ return _GeoIP_seek_record(gi, ipnum);
+}
+
+int GeoIP_init_record_iter (GeoIP* gi) {
+ return gi->databaseSegments[0] + 1;
+}
+
+int GeoIP_next_record (GeoIP* gi, GeoIPRecord **gir, int *record_iter) {
+ if (gi->cache != NULL) {
+ printf("GeoIP_next_record not supported in memory cache mode\n");
+ return 1;
+ }
+ *gir = _extract_record(gi, *record_iter, record_iter);
+ return 0;
+}
+
+void GeoIPRecord_delete (GeoIPRecord *gir) {
+ free(gir->region);
+ free(gir->city);
+ free(gir->postal_code);
+ free(gir);
+}
+
+
+
+char * _iso_8859_1__utf8(const char * iso) {
+ char c, k;
+ char * p;
+ char * t = (char *)iso;
+ int len = 0;
+ while ( ( c = *t++) ){
+ if ( c < 0 )
+ len++;
+ }
+ len += t - iso;
+ t = p = malloc( len );
+
+ if ( p ){
+ while ( ( c = *iso++ ) ) {
+ if (c < 0 ) {
+ k = 0xc2;
+ if (c >= -64 )
+ k++;
+ *t++ = k;
+ c &= ~0x40;
+ }
+ *t++ = c;
+ }
+ *t++ = 0x00;
+ }
+ return p;
+}
diff --git a/src/GeoIP-1.4.0/libGeoIP/GeoIPCity.h b/src/GeoIP-1.4.0/libGeoIP/GeoIPCity.h
new file mode 100644
index 0000000..c6ddf1b
--- /dev/null
+++ b/src/GeoIP-1.4.0/libGeoIP/GeoIPCity.h
@@ -0,0 +1,63 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
+/* GeoIPCity.h
+ *
+ * Copyright (C) 2006 MaxMind LLC
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef GEOIPCITY_H
+#define GEOIPCITY_H
+
+#include "GeoIP.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct GeoIPRecordTag {
+ char *country_code;
+ char *country_code3;
+ char *country_name;
+ char *region;
+ char *city;
+ char *postal_code;
+ float latitude;
+ float longitude;
+ int dma_code;
+ int area_code;
+ int charset;
+ char *continent_code;
+} GeoIPRecord;
+
+GeoIPRecord * GeoIP_record_by_ipnum (GeoIP* gi, unsigned long ipnum);
+GeoIPRecord * GeoIP_record_by_addr (GeoIP* gi, const char *addr);
+GeoIPRecord * GeoIP_record_by_name (GeoIP* gi, const char *host);
+
+int GeoIP_record_id_by_addr (GeoIP* gi, const char *addr);
+int GeoIP_init_record_iter (GeoIP* gi);
+/* returns 0 on success, 1 on failure */
+int GeoIP_next_record (GeoIP* gi, GeoIPRecord **gir, int *record_iter);
+
+void GeoIPRecord_delete (GeoIPRecord *gir);
+
+/* NULL on failure otherwise a malloced string in utf8 */
+char * _iso_8859_1__utf8(const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GEOIPCITY_H */
diff --git a/src/GeoIP-1.4.0/libGeoIP/GeoIPUpdate.c b/src/GeoIP-1.4.0/libGeoIP/GeoIPUpdate.c
new file mode 100644
index 0000000..a7bec6b
--- /dev/null
+++ b/src/GeoIP-1.4.0/libGeoIP/GeoIPUpdate.c
@@ -0,0 +1,850 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
+/* GeoIPUpdate.c
+ *
+ * Copyright (C) 2006 MaxMind LLC
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "GeoIPCity.h"
+#include "GeoIP.h"
+#include "GeoIPUpdate.h"
+#include "GeoIP_internal.h"
+
+#include "global.h"
+#include "md5.h"
+#include <sys/types.h>
+#ifndef WIN32
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#else
+#include <windows.h>
+#include <winsock.h>
+#endif
+#include <zlib.h>
+#include <time.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#define BLOCK_SIZE 1024
+
+const char *GeoIPUpdateHost = "updates.maxmind.com";
+const char *GeoIPHTTPRequest = "GET /app/update?license_key=%s&md5=%s HTTP/1.0\nHost: updates.maxmind.com\n\n";
+const char *GeoIPHTTPRequestMD5 = "GET /app/update_secure?db_md5=%s&challenge_md5=%s&user_id=%s&edition_id=%s HTTP/1.0\nHost: updates.maxmind.com\n\n";
+
+/* messages */
+const char *NoCurrentDB = "%s can't be opened, proceeding to download database\n";
+const char *MD5Info = "MD5 Digest of installed database is %s\n";
+const char *SavingGzip = "Saving gzip file to %s ... ";
+const char *WritingFile = "Writing uncompressed data to %s ...";
+
+/* TODO replace printf with GeoIP_printf - we need someway of having vargs with GeoIP_printf */
+
+const char * GeoIP_get_error_message(int i) {
+ switch (i) {
+ case GEOIP_NO_NEW_UPDATES:
+ return "no new updates";
+ case GEOIP_SUCCESS:
+ return "Success";
+ case GEOIP_LICENSE_KEY_INVALID_ERR:
+ return "License Key Invalid";
+ case GEOIP_DNS_ERR:
+ return "Unable to resolve hostname";
+ case GEOIP_NON_IPV4_ERR:
+ return "Non - IPv4 address";
+ case GEOIP_SOCKET_OPEN_ERR:
+ return "Error opening socket";
+ case GEOIP_CONNECTION_ERR:
+ return "Unable to connect";
+ case GEOIP_GZIP_IO_ERR:
+ return "Unable to write GeoIP.dat.gz file";
+ case GEOIP_TEST_IO_ERR:
+ return "Unable to write GeoIP.dat.test file";
+ case GEOIP_GZIP_READ_ERR:
+ return "Unable to read gzip data";
+ case GEOIP_OUT_OF_MEMORY_ERR:
+ return "Out of memory error";
+ case GEOIP_SOCKET_READ_ERR:
+ return "Error reading from socket, see errno";
+ case GEOIP_SANITY_OPEN_ERR:
+ return "Sanity check GeoIP_open error";
+ case GEOIP_SANITY_INFO_FAIL:
+ return "Sanity check database_info string failed";
+ case GEOIP_SANITY_LOOKUP_FAIL:
+ return "Sanity check ip address lookup failed";
+ case GEOIP_RENAME_ERR:
+ return "Rename error while installing db, check errno";
+ case GEOIP_USER_ID_INVALID_ERR:
+ return "Invalid userID";
+ case GEOIP_PRODUCT_ID_INVALID_ERR:
+ return "Invalid product ID or subscription expired";
+ case GEOIP_INVALID_SERVER_RESPONSE:
+ return "Server returned something unexpected";
+ default:
+ return "no error";
+ }
+}
+
+void GeoIP_printf(void (*f)(char *), const char *str) {
+ char * f_str;
+ size_t len = strlen(str)+1;
+ f_str = malloc(len);
+ strncpy(f_str,str,len);
+ if (f != NULL)
+ (*f)(f_str);
+ free(f_str);
+}
+
+short int GeoIP_update_database (char * license_key, int verbose, void (*f)( char *)) {
+ struct hostent *hostlist;
+ int sock;
+ char * buf;
+ struct sockaddr_in sa;
+ int offset = 0, err;
+ char * request_uri;
+ char * compr;
+ unsigned long comprLen;
+ FILE *comp_fh, *cur_db_fh, *gi_fh;
+ gzFile gz_fh;
+ char * file_path_gz, * file_path_test;
+ MD5_CONTEXT context;
+ unsigned char buffer[1024], digest[16];
+ char hex_digest[33] = "00000000000000000000000000000000\0";
+ unsigned int i;
+ char *f_str;
+ GeoIP * gi;
+ char * db_info;
+ char block[BLOCK_SIZE];
+ int block_size = BLOCK_SIZE;
+ size_t len;
+
+ _GeoIP_setup_dbfilename();
+
+ /* get MD5 of current GeoIP database file */
+ if ((cur_db_fh = fopen (GeoIPDBFileName[GEOIP_COUNTRY_EDITION], "rb")) == NULL) {
+ len = strlen(NoCurrentDB) + strlen(GeoIPDBFileName[GEOIP_COUNTRY_EDITION]) - 1;
+ f_str = malloc(len);
+ snprintf(f_str, len, NoCurrentDB, GeoIPDBFileName[GEOIP_COUNTRY_EDITION]);
+ if (f != NULL)
+ (*f)(f_str);
+ free(f_str);
+ } else {
+ md5_init(&context);
+ while ((len = fread (buffer, 1, 1024, cur_db_fh)) > 0)
+ md5_write (&context, buffer, len);
+ md5_final (&context);
+ memcpy(digest,context.buf,16);
+ fclose (cur_db_fh);
+ for (i = 0; i < 16; i++) {
+ /*"%02x" will write 3 chars*/
+ snprintf (&hex_digest[2*i], 3, "%02x", digest[i]);
+ }
+ len = strlen(MD5Info) + strlen(hex_digest) - 1;
+ f_str = malloc(len);
+ snprintf(f_str, len, MD5Info, hex_digest);
+ if (f != NULL)
+ (*f)(f_str);
+ free(f_str);
+ }
+
+ hostlist = gethostbyname(GeoIPUpdateHost);
+
+ if (hostlist == NULL)
+ return GEOIP_DNS_ERR;
+
+ if (hostlist->h_addrtype != AF_INET)
+ return GEOIP_NON_IPV4_ERR;
+
+ if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+ return GEOIP_SOCKET_OPEN_ERR;
+ }
+
+ memset(&sa, 0, sizeof(struct sockaddr_in));
+ sa.sin_port = htons(80);
+ memcpy(&sa.sin_addr, hostlist->h_addr_list[0], hostlist->h_length);
+ sa.sin_family = AF_INET;
+
+ if (verbose == 1)
+ GeoIP_printf(f,"Connecting to MaxMind GeoIP Update server\n");
+
+ /* Download gzip file */
+ if (connect(sock, (struct sockaddr *)&sa, sizeof(struct sockaddr))< 0)
+ return GEOIP_CONNECTION_ERR;
+
+ request_uri = malloc(sizeof(char) * (strlen(license_key) + strlen(GeoIPHTTPRequest)+36));
+ if (request_uri == NULL)
+ return GEOIP_OUT_OF_MEMORY_ERR;
+ sprintf(request_uri,GeoIPHTTPRequest,license_key, hex_digest);
+ send(sock, request_uri, strlen(request_uri),0);
+ free(request_uri);
+
+ buf = malloc(sizeof(char) * block_size);
+ if (buf == NULL)
+ return GEOIP_OUT_OF_MEMORY_ERR;
+
+ if (verbose == 1)
+ GeoIP_printf(f,"Downloading gzipped GeoIP Database...\n");
+
+ for (;;) {
+ int amt;
+ amt = recv(sock, &buf[offset], block_size,0);
+ if (amt == 0) {
+ break;
+ } else if (amt == -1) {
+ free(buf);
+ return GEOIP_SOCKET_READ_ERR;
+ }
+ offset += amt;
+ buf = realloc(buf, offset+block_size);
+ if (buf == NULL)
+ return GEOIP_OUT_OF_MEMORY_ERR;
+ }
+
+ compr = strstr(buf, "\r\n\r\n") + 4;
+ comprLen = offset + buf - compr;
+
+ if (strstr(compr, "License Key Invalid") != NULL) {
+ if (verbose == 1)
+ GeoIP_printf(f,"Failed\n");
+ free(buf);
+ return GEOIP_LICENSE_KEY_INVALID_ERR;
+ } else if (strstr(compr, "No new updates available") != NULL) {
+ free(buf);
+ return GEOIP_NO_NEW_UPDATES;
+ }
+
+ if (verbose == 1)
+ GeoIP_printf(f,"Done\n");
+
+ /* save gzip file */
+ file_path_gz = malloc(sizeof(char) * (strlen(GeoIPDBFileName[GEOIP_COUNTRY_EDITION]) + 4));
+ if (file_path_gz == NULL)
+ return GEOIP_OUT_OF_MEMORY_ERR;
+ strcpy(file_path_gz,GeoIPDBFileName[GEOIP_COUNTRY_EDITION]);
+ strcat(file_path_gz,".gz");
+ if (verbose == 1) {
+ len = strlen(SavingGzip) + strlen(file_path_gz) - 1;
+ f_str = malloc(len);
+ snprintf(f_str, len, SavingGzip,file_path_gz);
+ if (f != NULL)
+ (*f)(f_str);
+ free(f_str);
+ }
+ comp_fh = fopen(file_path_gz, "wb");
+
+ if(comp_fh == NULL) {
+ free(file_path_gz);
+ free(buf);
+ return GEOIP_GZIP_IO_ERR;
+ }
+
+ fwrite(compr, 1, comprLen, comp_fh);
+ fclose(comp_fh);
+ free(buf);
+
+ if (verbose == 1)
+ GeoIP_printf(f,"Done\n");
+
+ if (verbose == 1)
+ GeoIP_printf(f,"Uncompressing gzip file ... ");
+
+ /* uncompress gzip file */
+ gz_fh = gzopen(file_path_gz, "rb");
+ file_path_test = malloc(sizeof(char) * (strlen(GeoIPDBFileName[GEOIP_COUNTRY_EDITION]) + 6));
+ if (file_path_test == NULL)
+ return GEOIP_OUT_OF_MEMORY_ERR;
+ strcpy(file_path_test,GeoIPDBFileName[GEOIP_COUNTRY_EDITION]);
+ strcat(file_path_test,".test");
+ gi_fh = fopen(file_path_test, "wb");
+
+ if(gi_fh == NULL) {
+ free(file_path_test);
+ return GEOIP_TEST_IO_ERR;
+ }
+ for (;;) {
+ int amt;
+ amt = gzread(gz_fh, block, block_size);
+ if (amt == -1) {
+ free(file_path_test);
+ fclose(gi_fh);
+ gzclose(gz_fh);
+ return GEOIP_GZIP_READ_ERR;
+ }
+ if (amt == 0) {
+ break;
+ }
+ fwrite(block,1,amt,gi_fh);
+ }
+ gzclose(gz_fh);
+ unlink(file_path_gz);
+ free(file_path_gz);
+ fclose(gi_fh);
+
+ if (verbose == 1)
+ GeoIP_printf(f,"Done\n");
+
+ if (verbose == 1) {
+ f_str = malloc(strlen(WritingFile) + strlen(GeoIPDBFileName[GEOIP_COUNTRY_EDITION]) - 1);
+ sprintf(f_str,WritingFile,GeoIPDBFileName[GEOIP_COUNTRY_EDITION]);
+ if (f != NULL)
+ (*f)(f_str);
+ free(f_str);
+ }
+
+ /* sanity check */
+ gi = GeoIP_open(file_path_test, GEOIP_STANDARD);
+
+ if (verbose == 1)
+ GeoIP_printf(f,"Performing santity checks ... ");
+
+ if (gi == NULL) {
+ GeoIP_printf(f,"Error opening sanity check database\n");
+ return GEOIP_SANITY_OPEN_ERR;
+ }
+
+ /* this checks to make sure the files is complete, since info is at the end */
+ /* dependent on future databases having MaxMind in info */
+ if (verbose == 1)
+ GeoIP_printf(f,"database_info ");
+ db_info = GeoIP_database_info(gi);
+ if (db_info == NULL) {
+ GeoIP_delete(gi);
+ if (verbose == 1)
+ GeoIP_printf(f,"FAIL\n");
+ return GEOIP_SANITY_INFO_FAIL;
+ }
+ if (strstr(db_info, "MaxMind") == NULL) {
+ free(db_info);
+ GeoIP_delete(gi);
+ if (verbose == 1)
+ GeoIP_printf(f,"FAIL\n");
+ return GEOIP_SANITY_INFO_FAIL;
+ }
+ free(db_info);
+ if (verbose == 1)
+ GeoIP_printf(f,"PASS ");
+
+ /* this performs an IP lookup test of a US IP address */
+ if (verbose == 1)
+ GeoIP_printf(f,"lookup ");
+ if (strcmp(GeoIP_country_code_by_addr(gi,"24.24.24.24"), "US") != 0) {
+ GeoIP_delete(gi);
+ if (verbose == 1)
+ GeoIP_printf(f,"FAIL\n");
+ return GEOIP_SANITY_LOOKUP_FAIL;
+ }
+ GeoIP_delete(gi);
+ if (verbose == 1)
+ GeoIP_printf(f,"PASS\n");
+
+ /* install GeoIP.dat.test -> GeoIP.dat */
+ err = rename(file_path_test, GeoIPDBFileName[GEOIP_COUNTRY_EDITION]);
+ if (err != 0) {
+ GeoIP_printf(f,"GeoIP Install error while renaming file\n");
+ return GEOIP_RENAME_ERR;
+ }
+
+ if (verbose == 1)
+ GeoIP_printf(f,"Done\n");
+
+ return 0;
+}
+
+short int GeoIP_update_database_general (char * user_id,char * license_key,char *data_base_type, int verbose,char ** client_ipaddr, void (*f)( char *)) {
+ struct hostent *hostlist;
+ int sock;
+ char * buf;
+ struct sockaddr_in sa;
+ int offset = 0, err;
+ char * request_uri;
+ char * compr;
+ unsigned long comprLen;
+ FILE *comp_fh, *cur_db_fh, *gi_fh;
+ gzFile gz_fh;
+ char * file_path_gz, * file_path_test;
+ MD5_CONTEXT context;
+ MD5_CONTEXT context2;
+ unsigned char buffer[1024], digest[16] ,digest2[16];
+ char hex_digest[33] = "0000000000000000000000000000000\0";
+ char hex_digest2[33] = "0000000000000000000000000000000\0";
+ unsigned int i;
+ char *f_str;
+ GeoIP * gi;
+ char * db_info;
+ char *ipaddress;
+ char *geoipfilename;
+ char *tmpstr;
+ int dbtype;
+ int lookupresult = 1;
+ char block[BLOCK_SIZE];
+ int block_size = BLOCK_SIZE;
+ size_t len;
+ size_t request_uri_len;
+
+ hostlist = gethostbyname(GeoIPUpdateHost);
+
+ if (hostlist == NULL)
+ return GEOIP_DNS_ERR;
+
+ if (hostlist->h_addrtype != AF_INET)
+ return GEOIP_NON_IPV4_ERR;
+ if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+ return GEOIP_SOCKET_OPEN_ERR;
+ }
+
+ memset(&sa, 0, sizeof(struct sockaddr_in));
+ sa.sin_port = htons(80);
+ memcpy(&sa.sin_addr, hostlist->h_addr_list[0], hostlist->h_length);
+ sa.sin_family = AF_INET;
+ if (connect(sock, (struct sockaddr *)&sa, sizeof(struct sockaddr))< 0)
+ return GEOIP_CONNECTION_ERR;
+ request_uri = malloc(sizeof(char) * (strlen(license_key) + strlen(GeoIPHTTPRequestMD5)+1036));
+ if (request_uri == NULL)
+ return GEOIP_OUT_OF_MEMORY_ERR;
+
+ /* get the file name from a web page using the product id */
+ sprintf(request_uri,"GET /app/update_getfilename?product_id=%s HTTP/1.0\nHost: %s\n\n",data_base_type,GeoIPUpdateHost);
+ if (verbose == 1) {
+ printf("sending request %s \n",request_uri);
+ }
+ send(sock, request_uri, strlen(request_uri),0); /* send the request */
+ free(request_uri);
+ buf = malloc(sizeof(char) * (block_size+4));
+ if (buf == NULL)
+ return GEOIP_OUT_OF_MEMORY_ERR;
+ offset = 0;
+ for (;;){
+ int amt;
+ amt = recv(sock, &buf[offset], block_size,0);
+ if (amt == 0){
+ break;
+ } else if (amt == -1) {
+ free(buf);
+ return GEOIP_SOCKET_READ_ERR;
+ }
+ offset += amt;
+ buf = realloc(buf, offset + block_size + 4);
+ }
+ buf[offset] = 0;
+ offset = 0;
+ tmpstr = strstr(buf, "\r\n\r\n") + 4;
+ if (tmpstr[0] == '.' || strchr(tmpstr, '/') != NULL) {
+ free(buf);
+ return GEOIP_INVALID_SERVER_RESPONSE;
+ }
+ geoipfilename = _GeoIP_full_path_to(tmpstr);
+ free(buf);
+
+ /* print the database product id and the database filename */
+ if (verbose == 1){
+ printf("database product id %s database file name %s \n",data_base_type,geoipfilename);
+ }
+ _GeoIP_setup_dbfilename();
+
+ /* get MD5 of current GeoIP database file */
+ if ((cur_db_fh = fopen (geoipfilename, "rb")) == NULL) {
+ len = strlen(NoCurrentDB) + strlen(geoipfilename) - 1;
+ f_str = malloc(len);
+ snprintf(f_str, len, NoCurrentDB, geoipfilename);
+
+ if (f != NULL)
+ (*f)(f_str);
+ free(f_str);
+ } else {
+ md5_init(&context);
+ while ((len = fread (buffer, 1, 1024, cur_db_fh)) > 0)
+ md5_write (&context, buffer, len);
+ md5_final (&context);
+ memcpy(digest,context.buf,16);
+ fclose (cur_db_fh);
+ for (i = 0; i < 16; i++)
+ sprintf (&hex_digest[2*i], "%02x", digest[i]);
+ len = strlen(MD5Info) + strlen(hex_digest) - 1;
+ f_str = malloc(len);
+ snprintf(f_str, len, MD5Info, hex_digest);
+ if (f != NULL)
+ (*f)(f_str);
+ free(f_str);
+ }
+ if (verbose == 1) {
+ printf("MD5 sum of database %s is %s \n",geoipfilename,hex_digest);
+ }
+ if (client_ipaddr[0] == NULL) {
+ /* We haven't gotten our IP address yet, so let's request it */
+ if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+ free(geoipfilename);
+ return GEOIP_SOCKET_OPEN_ERR;
+ }
+
+ memset(&sa, 0, sizeof(struct sockaddr_in));
+ sa.sin_port = htons(80);
+ memcpy(&sa.sin_addr, hostlist->h_addr_list[0], hostlist->h_length);
+ sa.sin_family = AF_INET;
+
+ if (verbose == 1)
+ GeoIP_printf(f,"Connecting to MaxMind GeoIP Update server\n");
+
+ /* Download gzip file */
+ if (connect(sock, (struct sockaddr *)&sa, sizeof(struct sockaddr))< 0) {
+ free(geoipfilename);
+ return GEOIP_CONNECTION_ERR;
+ }
+ request_uri = malloc(sizeof(char) * (strlen(license_key) + strlen(GeoIPHTTPRequestMD5)+1036));
+ if (request_uri == NULL) {
+ free(geoipfilename);
+ return GEOIP_OUT_OF_MEMORY_ERR;
+ }
+
+ /* get client ip address from MaxMind web page */
+ sprintf(request_uri,"GET /app/update_getipaddr HTTP/1.0\nHost: %s\n\n",GeoIPUpdateHost);
+ send(sock, request_uri, strlen(request_uri),0); /* send the request */
+ if (verbose == 1) {
+ printf("sending request %s", request_uri);
+ }
+ free(request_uri);
+ buf = malloc(sizeof(char) * (block_size+1));
+ if (buf == NULL) {
+ free(geoipfilename);
+ return GEOIP_OUT_OF_MEMORY_ERR;
+ }
+ offset = 0;
+
+ for (;;){
+ int amt;
+ amt = recv(sock, &buf[offset], block_size,0);
+ if (amt == 0) {
+ break;
+ } else if (amt == -1) {
+ free(buf);
+ return GEOIP_SOCKET_READ_ERR;
+ }
+ offset += amt;
+ buf = realloc(buf, offset+block_size+1);
+ }
+
+ buf[offset] = 0;
+ offset = 0;
+ ipaddress = strstr(buf, "\r\n\r\n") + 4; /* get the ip address */
+ ipaddress = malloc(strlen(strstr(buf, "\r\n\r\n") + 4)+5);
+ strcpy(ipaddress,strstr(buf, "\r\n\r\n") + 4);
+ client_ipaddr[0] = ipaddress;
+ if (verbose == 1) {
+ printf("client ip address: %s\n",ipaddress);
+ }
+ free(buf);
+ close(sock);
+ }
+
+ ipaddress = client_ipaddr[0];
+
+ /* make a md5 sum of ip address and license_key and store it in hex_digest2 */
+ request_uri_len = sizeof(char) * 2036;
+ request_uri = malloc(request_uri_len);
+ md5_init(&context2);
+ md5_write (&context2, (unsigned char *)license_key, 12); /*add license key to the md5 sum*/
+ md5_write (&context2, (unsigned char *)ipaddress, strlen(ipaddress)); /*add ip address to the md5 sum*/
+ md5_final (&context2);
+ memcpy(digest2,context2.buf,16);
+ for (i = 0; i < 16; i++)
+ snprintf (&hex_digest2[2*i], 3, "%02x", digest2[i]); /*change the digest to a hex digest*/
+ if (verbose == 1) {
+ printf("md5sum of ip address and license key is %s \n",hex_digest2);
+ }
+
+ /* send the request using the user id,product id,
+ * md5 sum of the prev database and
+ * the md5 sum of the license_key and ip address */
+ if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+ return GEOIP_SOCKET_OPEN_ERR;
+ }
+ memset(&sa, 0, sizeof(struct sockaddr_in));
+ sa.sin_port = htons(80);
+ memcpy(&sa.sin_addr, hostlist->h_addr_list[0], hostlist->h_length);
+ sa.sin_family = AF_INET;
+ if (connect(sock, (struct sockaddr *)&sa, sizeof(struct sockaddr))< 0)
+ return GEOIP_CONNECTION_ERR;
+ snprintf(request_uri, request_uri_len, GeoIPHTTPRequestMD5,hex_digest,hex_digest2,user_id,data_base_type);
+ send(sock, request_uri, strlen(request_uri),0);
+ if (verbose == 1) {
+ printf("sending request %s\n",request_uri);
+ }
+
+ free(request_uri);
+
+ offset = 0;
+ buf = malloc(sizeof(char) * block_size);
+ if (buf == NULL)
+ return GEOIP_OUT_OF_MEMORY_ERR;
+
+ if (verbose == 1)
+ GeoIP_printf(f,"Downloading gzipped GeoIP Database...\n");
+
+ for (;;) {
+ int amt;
+ amt = recv(sock, &buf[offset], block_size,0);
+
+ if (amt == 0) {
+ break;
+ } else if (amt == -1) {
+ free(buf);
+ return GEOIP_SOCKET_READ_ERR;
+ }
+ offset += amt;
+ buf = realloc(buf, offset+block_size);
+ if (buf == NULL)
+ return GEOIP_OUT_OF_MEMORY_ERR;
+ }
+
+ compr = strstr(buf, "\r\n\r\n") + 4;
+ comprLen = offset + buf - compr;
+
+ if (strstr(compr, "License Key Invalid") != NULL) {
+ if (verbose == 1)
+ GeoIP_printf(f,"Failed\n");
+ free(buf);
+ return GEOIP_LICENSE_KEY_INVALID_ERR;
+ } else if (strstr(compr, "No new updates available") != NULL) {
+ free(buf);
+ printf("%s is up to date, no updates required\n", geoipfilename);
+ return GEOIP_NO_NEW_UPDATES;
+ } else if (strstr(compr, "Invalid UserId") != NULL){
+ free(buf);
+ return GEOIP_USER_ID_INVALID_ERR;
+ } else if (strstr(compr, "Invalid product ID or subscription expired") != NULL){
+ free(buf);
+ return GEOIP_PRODUCT_ID_INVALID_ERR;
+ }
+
+ if (verbose == 1)
+ GeoIP_printf(f,"Done\n");
+
+ printf("Updating %s\n", geoipfilename);
+
+ /* save gzip file */
+ file_path_gz = malloc(sizeof(char) * (strlen(geoipfilename) + 4));
+
+ if (file_path_gz == NULL)
+ return GEOIP_OUT_OF_MEMORY_ERR;
+ strcpy(file_path_gz,geoipfilename);
+ strcat(file_path_gz,".gz");
+ if (verbose == 1) {
+ len = strlen(SavingGzip) + strlen(file_path_gz) - 1;
+ f_str = malloc(len);
+ snprintf(f_str,len,SavingGzip,file_path_gz);
+ if (f != NULL)
+ (*f)(f_str);
+ free(f_str);
+ }
+ comp_fh = fopen(file_path_gz, "wb");
+
+ if(comp_fh == NULL) {
+ free(file_path_gz);
+ free(buf);
+ return GEOIP_GZIP_IO_ERR;
+ }
+
+ fwrite(compr, 1, comprLen, comp_fh);
+ fclose(comp_fh);
+ free(buf);
+
+ if (verbose == 1) {
+ printf("download data to a gz file named %s \n",file_path_gz);
+ }
+ if (verbose == 1)
+ GeoIP_printf(f,"Done\n");
+
+ if (verbose == 1)
+ GeoIP_printf(f,"Uncompressing gzip file ... ");
+
+ file_path_test = malloc(sizeof(char) * (strlen(GeoIPDBFileName[GEOIP_COUNTRY_EDITION]) + 6));
+ if (file_path_test == NULL) {
+ free(file_path_gz);
+ return GEOIP_OUT_OF_MEMORY_ERR;
+ }
+ strcpy(file_path_test,GeoIPDBFileName[GEOIP_COUNTRY_EDITION]);
+ strcat(file_path_test,".test");
+ gi_fh = fopen(file_path_test, "wb");
+ if(gi_fh == NULL) {
+ free(file_path_test);
+ free(file_path_gz);
+ return GEOIP_TEST_IO_ERR;
+ }
+ /* uncompress gzip file */
+ offset = 0;
+ gz_fh = gzopen(file_path_gz, "rb");
+ for (;;) {
+ int amt;
+ amt = gzread(gz_fh, block, block_size);
+ if (amt == -1) {
+ free(file_path_gz);
+ free(file_path_test);
+ gzclose(gz_fh);
+ fclose(gi_fh);
+ return GEOIP_GZIP_READ_ERR;
+ }
+ if (amt == 0) {
+ break;
+ }
+ fwrite(block,1,amt,gi_fh);
+ }
+ gzclose(gz_fh);
+ unlink(file_path_gz);
+ free(file_path_gz);
+ fclose(gi_fh);
+
+ if (verbose == 1)
+ GeoIP_printf(f,"Done\n");
+
+ if (verbose == 1) {
+ len = strlen(WritingFile) + strlen(geoipfilename) - 1;
+ f_str = malloc(len);
+ snprintf(f_str,len,WritingFile,geoipfilename);
+ free(f_str);
+ }
+
+ /* sanity check */
+ gi = GeoIP_open(file_path_test, GEOIP_STANDARD);
+
+ if (verbose == 1)
+ GeoIP_printf(f,"Performing santity checks ... ");
+
+ if (gi == NULL) {
+ GeoIP_printf(f,"Error opening sanity check database\n");
+ return GEOIP_SANITY_OPEN_ERR;
+ }
+
+
+ /* get the database type */
+ dbtype = GeoIP_database_edition(gi);
+ if (verbose == 1) {
+ printf("Database type is %d\n",dbtype);
+ }
+
+ /* this checks to make sure the files is complete, since info is at the end
+ dependent on future databases having MaxMind in info (ISP and Organization databases currently don't have info string */
+
+ if ((dbtype != GEOIP_ISP_EDITION)&&
+ (dbtype != GEOIP_ORG_EDITION)) {
+ if (verbose == 1)
+ GeoIP_printf(f,"database_info ");
+ db_info = GeoIP_database_info(gi);
+ if (db_info == NULL) {
+ GeoIP_delete(gi);
+ if (verbose == 1)
+ GeoIP_printf(f,"FAIL null\n");
+ return GEOIP_SANITY_INFO_FAIL;
+ }
+ if (strstr(db_info, "MaxMind") == NULL) {
+ free(db_info);
+ GeoIP_delete(gi);
+ if (verbose == 1)
+ GeoIP_printf(f,"FAIL maxmind\n");
+ return GEOIP_SANITY_INFO_FAIL;
+ }
+ free(db_info);
+ if (verbose == 1)
+ GeoIP_printf(f,"PASS ");
+ }
+
+ /* this performs an IP lookup test of a US IP address */
+ if (verbose == 1)
+ GeoIP_printf(f,"lookup ");
+ if (dbtype == GEOIP_NETSPEED_EDITION) {
+ int netspeed = GeoIP_id_by_name(gi,"24.24.24.24");
+ lookupresult = 0;
+ if (netspeed == GEOIP_CABLEDSL_SPEED){
+ lookupresult = 1;
+ }
+ }
+ if (dbtype == GEOIP_COUNTRY_EDITION) {
+ /* if data base type is country then call the function
+ * named GeoIP_country_code_by_addr */
+ lookupresult = 1;
+ if (strcmp(GeoIP_country_code_by_addr(gi,"24.24.24.24"), "US") != 0) {
+ lookupresult = 0;
+ }
+ if (verbose == 1) {
+ GeoIP_printf(f,"testing GEOIP_COUNTRY_EDITION\n");
+ }
+ }
+ if (dbtype == GEOIP_REGION_EDITION_REV1) {
+ /* if data base type is region then call the function
+ * named GeoIP_region_by_addr */
+ GeoIPRegion *r = GeoIP_region_by_addr(gi,"24.24.24.24");
+ lookupresult = 0;
+ if (r != NULL) {
+ lookupresult = 1;
+ free(r);
+ }
+ if (verbose == 1) {
+ GeoIP_printf(f,"testing GEOIP_REGION_EDITION\n");
+ }
+ }
+ if (dbtype == GEOIP_CITY_EDITION_REV1) {
+ /* if data base type is city then call the function
+ * named GeoIP_record_by_addr */
+ GeoIPRecord *r = GeoIP_record_by_addr(gi,"24.24.24.24");
+ lookupresult = 0;
+ if (r != NULL) {
+ lookupresult = 1;
+ free(r);
+ }
+ if (verbose == 1) {
+ GeoIP_printf(f,"testing GEOIP_CITY_EDITION\n");
+ }
+ }
+ if ((dbtype == GEOIP_ISP_EDITION)||
+ (dbtype == GEOIP_ORG_EDITION)) {
+ /* if data base type is isp or org then call the function
+ * named GeoIP_org_by_addr */
+ GeoIPRecord *r = (GeoIPRecord*)GeoIP_org_by_addr(gi,"24.24.24.24");
+ lookupresult = 0;
+ if (r != NULL) {
+ lookupresult = 1;
+ free(r);
+ }
+ if (verbose == 1) {
+ if (dbtype == GEOIP_ISP_EDITION) {
+ GeoIP_printf(f,"testing GEOIP_ISP_EDITION\n");
+ }
+ if (dbtype == GEOIP_ORG_EDITION) {
+ GeoIP_printf(f,"testing GEOIP_ORG_EDITION\n");
+ }
+ }
+ }
+ if (lookupresult == 0) {
+ GeoIP_delete(gi);
+ if (verbose == 1)
+ GeoIP_printf(f,"FAIL\n");
+ return GEOIP_SANITY_LOOKUP_FAIL;
+ }
+ GeoIP_delete(gi);
+ if (verbose == 1)
+ GeoIP_printf(f,"PASS\n");
+
+ /* install GeoIP.dat.test -> GeoIP.dat */
+ err = rename(file_path_test, geoipfilename);
+ if (err != 0) {
+ GeoIP_printf(f,"GeoIP Install error while renaming file\n");
+ return GEOIP_RENAME_ERR;
+ }
+
+ if (verbose == 1)
+ GeoIP_printf(f,"Done\n");
+ free(geoipfilename);
+ return 0;
+}
diff --git a/src/GeoIP-1.4.0/libGeoIP/GeoIPUpdate.h b/src/GeoIP-1.4.0/libGeoIP/GeoIPUpdate.h
new file mode 100644
index 0000000..c39df6e
--- /dev/null
+++ b/src/GeoIP-1.4.0/libGeoIP/GeoIPUpdate.h
@@ -0,0 +1,63 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
+/* GeoIP.h
+ *
+ * Copyright (C) 2006 MaxMind LLC
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef GEOIPUPDATE_H
+#define GEOIPUPDATE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ GEOIP_NO_NEW_UPDATES = 1, /* Database up-to-date, no action taken */
+ GEOIP_SUCCESS = 0, /* Success */
+ GEOIP_LICENSE_KEY_INVALID_ERR = -1, /* License Key Invalid */
+ GEOIP_DNS_ERR = -11, /* Unable to resolve hostname */
+ GEOIP_NON_IPV4_ERR = -12, /* Non - IPv4 address */
+ GEOIP_SOCKET_OPEN_ERR = -13, /* Error opening socket */
+ GEOIP_CONNECTION_ERR = -14, /* Unable to connect */
+ GEOIP_GZIP_IO_ERR = -15, /* Unable to write GeoIP.dat.gz file */
+ GEOIP_TEST_IO_ERR = -16, /* Unable to write GeoIP.dat.test file */
+ GEOIP_GZIP_READ_ERR = -17, /* Unable to read gzip data */
+ GEOIP_OUT_OF_MEMORY_ERR = -18, /* Out of memory error */
+ GEOIP_SOCKET_READ_ERR = -19, /* Error reading from socket, see errno */
+ GEOIP_SANITY_OPEN_ERR = -20, /* Sanity check GeoIP_open error */
+ GEOIP_SANITY_INFO_FAIL = -21, /* Sanity check database_info string failed */
+ GEOIP_SANITY_LOOKUP_FAIL = -22, /* Sanity check ip address lookup failed */
+ GEOIP_RENAME_ERR = -23, /* Rename error while installing db, check errno */
+ GEOIP_USER_ID_INVALID_ERR = -24, /* Invalid userID */
+ GEOIP_PRODUCT_ID_INVALID_ERR = -25, /* Invalid product ID or subscription expired */
+ GEOIP_INVALID_SERVER_RESPONSE = -26 /* Server returned invalid response */
+} GeoIPUpdateCode;
+
+const char * GeoIP_get_error_message(int i);
+
+/* Original Update Function, just for MaxMind GeoIP Country database */
+short int GeoIP_update_database (char * license_key, int verbose, void (*f)( char *));
+
+/* More generalized update function that works more databases */
+short int GeoIP_update_database_general (char * user_id, char * license_key,char * data_base_type, int verbose,char ** client_ipaddr, void (*f)( char *));
+void GeoIP_printf(void (*f)(char *), const char *str);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GEOIPUPDATE_H */
diff --git a/src/GeoIP-1.4.0/libGeoIP/GeoIP_internal.h b/src/GeoIP-1.4.0/libGeoIP/GeoIP_internal.h
new file mode 100644
index 0000000..8ec5c95
--- /dev/null
+++ b/src/GeoIP-1.4.0/libGeoIP/GeoIP_internal.h
@@ -0,0 +1,11 @@
+#ifndef GEOIP_INTERNAL_H
+#define GEOIP_INTERNAL_H
+
+GEOIP_API unsigned int _GeoIP_seek_record (GeoIP *gi, unsigned long ipnum);
+GEOIP_API unsigned long _GeoIP_addr_to_num (const char *addr);
+
+unsigned long _GeoIP_lookupaddress (const char *host);
+extern void _GeoIP_setup_dbfilename(void);
+extern char *_GeoIP_full_path_to(const char *file_name);
+
+#endif
diff --git a/src/GeoIP-1.4.0/libGeoIP/Makefile.am b/src/GeoIP-1.4.0/libGeoIP/Makefile.am
new file mode 100644
index 0000000..fdecb0a
--- /dev/null
+++ b/src/GeoIP-1.4.0/libGeoIP/Makefile.am
@@ -0,0 +1,17 @@
+noinst_LTLIBRARIES = libGeoIP.la libGeoIPUpdate.la
+
+EXTRA_DIST = md5.h global.h types.h GeoIP_internal.h
+
+AM_CPPFLAGS = -DGEOIPDATADIR=\"$(pkgdatadir)\" -Wall
+
+if WITH_CITY
+libGeoIP_la_SOURCES = GeoIP.c GeoIPCity.c regionName.c timeZone.c
+else
+libGeoIP_la_SOURCES = GeoIP.c regionName.c timeZone.c
+endif
+
+libGeoIPUpdate_la_SOURCES = GeoIPUpdate.c md5.c
+
+#libGeoIP_la_LDFLAGS = -version-info @GEOIP_VERSION_INFO@
+
+libGeoIPUpdate_la_LIBADD = -lz libGeoIP.la
diff --git a/src/GeoIP-1.4.0/libGeoIP/global.h b/src/GeoIP-1.4.0/libGeoIP/global.h
new file mode 100644
index 0000000..22c5684
--- /dev/null
+++ b/src/GeoIP-1.4.0/libGeoIP/global.h
@@ -0,0 +1,32 @@
+/* GLOBAL.H - RSAREF types and constants
+ */
+
+/* PROTOTYPES should be set to one if and only if the compiler supports
+ function argument prototyping.
+The following makes PROTOTYPES default to 0 if it has not already
+
+ been defined with C compiler flags.
+ */
+#ifndef PROTOTYPES
+#define PROTOTYPES 0
+#endif
+
+/* POINTER defines a generic pointer type */
+typedef unsigned char *POINTER;
+
+/* UINT2 defines a two byte word */
+typedef unsigned short int UINT2;
+
+/* UINT4 defines a four byte word */
+typedef unsigned long int UINT4;
+
+/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
+If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
+ returns an empty list.
+ */
+#if PROTOTYPES
+#define PROTO_LIST(list) list
+#else
+#define PROTO_LIST(list) ()
+#endif
+
diff --git a/src/GeoIP-1.4.0/libGeoIP/md5.c b/src/GeoIP-1.4.0/libGeoIP/md5.c
new file mode 100644
index 0000000..fc761cc
--- /dev/null
+++ b/src/GeoIP-1.4.0/libGeoIP/md5.c
@@ -0,0 +1,332 @@
+/* md5.c - MD5 Message-Digest Algorithm
+ * Copyright (C) 1995, 1996, 1998, 1999,
+ * 2000, 2001 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
+ *
+ * According to the definition of MD5 in RFC 1321 from April 1992.
+ * NOTE: This is *not* the same file as the one from glibc.
+ */
+/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */
+/* Heavily modified for GnuPG by <wk@gnupg.org> */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#include "types.h"
+
+
+#ifdef WORDS_BIGENDIAN
+#define BIG_ENDIAN_HOST
+#endif
+
+/*#define DIM(v) (sizeof(v)/sizeof((v)[0]))*/
+#define wipememory2(_ptr,_set,_len) do { volatile char *_vptr=(volatile char *)(_ptr); size_t _vlen=(_len); while(_vlen) { *_vptr=(_set); _vptr++; _vlen--; } } while(0)
+#define wipememory(_ptr,_len) wipememory2(_ptr,0,_len)
+#define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) )
+
+typedef struct {
+ u32 A,B,C,D; /* chaining variables */
+ u32 nblocks;
+ byte buf[64];
+ int count;
+} MD5_CONTEXT;
+
+void md5_init( MD5_CONTEXT *ctx );
+void md5_write( MD5_CONTEXT *hd, byte *inbuf, size_t inlen);
+void md5_final( MD5_CONTEXT *hd );
+
+
+void
+md5_init( MD5_CONTEXT *ctx )
+{
+ ctx->A = 0x67452301;
+ ctx->B = 0xefcdab89;
+ ctx->C = 0x98badcfe;
+ ctx->D = 0x10325476;
+
+ ctx->nblocks = 0;
+ ctx->count = 0;
+}
+
+
+
+
+/* These are the four functions used in the four steps of the MD5 algorithm
+ and defined in the RFC 1321. The first function is a little bit optimized
+ (as found in Colin Plumbs public domain implementation). */
+/* #define FF(b, c, d) ((b & c) | (~b & d)) */
+#define FF(b, c, d) (d ^ (b & (c ^ d)))
+#define FG(b, c, d) FF (d, b, c)
+#define FH(b, c, d) (b ^ c ^ d)
+#define FI(b, c, d) (c ^ (b | ~d))
+
+static void
+burn_stack (int bytes)
+{
+ char buf[128];
+
+ wipememory(buf,sizeof buf);
+ bytes -= sizeof buf;
+ if (bytes > 0)
+ burn_stack (bytes);
+}
+
+
+
+/****************
+ * transform n*64 bytes
+ */
+static void
+/*transform( MD5_CONTEXT *ctx, const void *buffer, size_t len )*/
+transform( MD5_CONTEXT *ctx, byte *data )
+{
+ u32 correct_words[16];
+ u32 A = ctx->A;
+ u32 B = ctx->B;
+ u32 C = ctx->C;
+ u32 D = ctx->D;
+ u32 *cwp = correct_words;
+
+#ifdef BIG_ENDIAN_HOST
+ { int i;
+ byte *p2, *p1;
+ for(i=0, p1=data, p2=(byte*)correct_words; i < 16; i++, p2 += 4 ) {
+ p2[3] = *p1++;
+ p2[2] = *p1++;
+ p2[1] = *p1++;
+ p2[0] = *p1++;
+ }
+ }
+#else
+ memcpy( correct_words, data, 64 );
+#endif
+
+
+#define OP(a, b, c, d, s, T) \
+ do \
+ { \
+ a += FF (b, c, d) + (*cwp++) + T; \
+ a = rol(a, s); \
+ a += b; \
+ } \
+ while (0)
+
+ /* Before we start, one word about the strange constants.
+ They are defined in RFC 1321 as
+
+ T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
+ */
+
+ /* Round 1. */
+ OP (A, B, C, D, 7, 0xd76aa478);
+ OP (D, A, B, C, 12, 0xe8c7b756);
+ OP (C, D, A, B, 17, 0x242070db);
+ OP (B, C, D, A, 22, 0xc1bdceee);
+ OP (A, B, C, D, 7, 0xf57c0faf);
+ OP (D, A, B, C, 12, 0x4787c62a);
+ OP (C, D, A, B, 17, 0xa8304613);
+ OP (B, C, D, A, 22, 0xfd469501);
+ OP (A, B, C, D, 7, 0x698098d8);
+ OP (D, A, B, C, 12, 0x8b44f7af);
+ OP (C, D, A, B, 17, 0xffff5bb1);
+ OP (B, C, D, A, 22, 0x895cd7be);
+ OP (A, B, C, D, 7, 0x6b901122);
+ OP (D, A, B, C, 12, 0xfd987193);
+ OP (C, D, A, B, 17, 0xa679438e);
+ OP (B, C, D, A, 22, 0x49b40821);
+
+#undef OP
+#define OP(f, a, b, c, d, k, s, T) \
+ do \
+ { \
+a += f (b, c, d) + correct_words[k] + T; \
+a = rol(a, s); \
+a += b; \
+ } \
+ while (0)
+
+ /* Round 2. */
+ OP (FG, A, B, C, D, 1, 5, 0xf61e2562);
+ OP (FG, D, A, B, C, 6, 9, 0xc040b340);
+ OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
+ OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa);
+ OP (FG, A, B, C, D, 5, 5, 0xd62f105d);
+ OP (FG, D, A, B, C, 10, 9, 0x02441453);
+ OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
+ OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8);
+ OP (FG, A, B, C, D, 9, 5, 0x21e1cde6);
+ OP (FG, D, A, B, C, 14, 9, 0xc33707d6);
+ OP (FG, C, D, A, B, 3, 14, 0xf4d50d87);
+ OP (FG, B, C, D, A, 8, 20, 0x455a14ed);
+ OP (FG, A, B, C, D, 13, 5, 0xa9e3e905);
+ OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8);
+ OP (FG, C, D, A, B, 7, 14, 0x676f02d9);
+ OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
+
+ /* Round 3. */
+ OP (FH, A, B, C, D, 5, 4, 0xfffa3942);
+ OP (FH, D, A, B, C, 8, 11, 0x8771f681);
+ OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
+ OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
+ OP (FH, A, B, C, D, 1, 4, 0xa4beea44);
+ OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9);
+ OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60);
+ OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
+ OP (FH, A, B, C, D, 13, 4, 0x289b7ec6);
+ OP (FH, D, A, B, C, 0, 11, 0xeaa127fa);
+ OP (FH, C, D, A, B, 3, 16, 0xd4ef3085);
+ OP (FH, B, C, D, A, 6, 23, 0x04881d05);
+ OP (FH, A, B, C, D, 9, 4, 0xd9d4d039);
+ OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
+ OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
+ OP (FH, B, C, D, A, 2, 23, 0xc4ac5665);
+
+ /* Round 4. */
+ OP (FI, A, B, C, D, 0, 6, 0xf4292244);
+ OP (FI, D, A, B, C, 7, 10, 0x432aff97);
+ OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
+ OP (FI, B, C, D, A, 5, 21, 0xfc93a039);
+ OP (FI, A, B, C, D, 12, 6, 0x655b59c3);
+ OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92);
+ OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
+ OP (FI, B, C, D, A, 1, 21, 0x85845dd1);
+ OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f);
+ OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
+ OP (FI, C, D, A, B, 6, 15, 0xa3014314);
+ OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
+ OP (FI, A, B, C, D, 4, 6, 0xf7537e82);
+ OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
+ OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb);
+ OP (FI, B, C, D, A, 9, 21, 0xeb86d391);
+
+ /* Put checksum in context given as argument. */
+ ctx->A += A;
+ ctx->B += B;
+ ctx->C += C;
+ ctx->D += D;
+}
+
+
+
+/* The routine updates the message-digest context to
+ * account for the presence of each of the characters inBuf[0..inLen-1]
+ * in the message whose digest is being computed.
+ */
+void
+md5_write( MD5_CONTEXT *hd, byte *inbuf, size_t inlen)
+{
+ if( hd->count == 64 ) { /* flush the buffer */
+ transform( hd, hd->buf );
+ burn_stack (80+6*sizeof(void*));
+ hd->count = 0;
+ hd->nblocks++;
+ }
+ if( !inbuf )
+ return;
+ if( hd->count ) {
+ for( ; inlen && hd->count < 64; inlen-- )
+ hd->buf[hd->count++] = *inbuf++;
+ md5_write( hd, NULL, 0 );
+ if( !inlen )
+ return;
+ }
+
+ while( inlen >= 64 ) {
+ transform( hd, inbuf );
+ hd->count = 0;
+ hd->nblocks++;
+ inlen -= 64;
+ inbuf += 64;
+ }
+ burn_stack (80+6*sizeof(void*));
+ for( ; inlen && hd->count < 64; inlen-- )
+ hd->buf[hd->count++] = *inbuf++;
+}
+/* The routine final terminates the message-digest computation and
+ * ends with the desired message digest in mdContext->digest[0...15].
+ * The handle is prepared for a new MD5 cycle.
+ * Returns 16 bytes representing the digest.
+ */
+
+void
+md5_final( MD5_CONTEXT *hd )
+{
+ u32 t, msb, lsb;
+ byte *p;
+
+ md5_write(hd, NULL, 0); /* flush */;
+
+ t = hd->nblocks;
+ /* multiply by 64 to make a byte count */
+ lsb = t << 6;
+ msb = t >> 26;
+ /* add the count */
+ t = lsb;
+ if( (lsb += hd->count) < t )
+ msb++;
+ /* multiply by 8 to make a bit count */
+ t = lsb;
+ lsb <<= 3;
+ msb <<= 3;
+ msb |= t >> 29;
+
+ if( hd->count < 56 ) { /* enough room */
+ hd->buf[hd->count++] = 0x80; /* pad */
+ while( hd->count < 56 )
+ hd->buf[hd->count++] = 0; /* pad */
+ }
+ else { /* need one extra block */
+ hd->buf[hd->count++] = 0x80; /* pad character */
+ while( hd->count < 64 )
+ hd->buf[hd->count++] = 0;
+ md5_write(hd, NULL, 0); /* flush */;
+ memset(hd->buf, 0, 56 ); /* fill next block with zeroes */
+ }
+ /* append the 64 bit count */
+ hd->buf[56] = lsb ;
+ hd->buf[57] = lsb >> 8;
+ hd->buf[58] = lsb >> 16;
+ hd->buf[59] = lsb >> 24;
+ hd->buf[60] = msb ;
+ hd->buf[61] = msb >> 8;
+ hd->buf[62] = msb >> 16;
+ hd->buf[63] = msb >> 24;
+ transform( hd, hd->buf );
+ burn_stack (80+6*sizeof(void*));
+
+ p = hd->buf;
+#ifdef BIG_ENDIAN_HOST
+#define X(a) do { *p++ = hd-> a ; *p++ = hd-> a >> 8; \
+ *p++ = hd-> a >> 16; *p++ = hd-> a >> 24; } while(0)
+#else /* little endian */
+#define X(a) do { *(u32*)p = hd-> a ; p += 4; } while(0)
+#endif
+ X(A);
+ X(B);
+ X(C);
+ X(D);
+#undef X
+
+}
+/*
+static byte *
+md5_read( MD5_CONTEXT *hd )
+{
+ return hd->buf;
+}*/
diff --git a/src/GeoIP-1.4.0/libGeoIP/md5.h b/src/GeoIP-1.4.0/libGeoIP/md5.h
new file mode 100644
index 0000000..e1607be
--- /dev/null
+++ b/src/GeoIP-1.4.0/libGeoIP/md5.h
@@ -0,0 +1,40 @@
+/* MD5.H - header file for MD5C.C
+ */
+
+/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
+rights reserved.
+
+License to copy and use this software is granted provided that it
+is identified as the "RSA Data Security, Inc. MD5 Message-Digest
+Algorithm" in all material mentioning or referencing this software
+or this function.
+
+License is also granted to make and use derivative works provided
+that such works are identified as "derived from the RSA Data
+Security, Inc. MD5 Message-Digest Algorithm" in all material
+mentioning or referencing the derived work.
+
+RSA Data Security, Inc. makes no representations concerning either
+the merchantability of this software or the suitability of this
+software for any particular purpose. It is provided "as is"
+without express or implied warranty of any kind.
+
+These notices must be retained in any copies of any part of this
+documentation and/or software.
+ */
+
+/* MD5 context. */
+
+#include "types.h"
+
+typedef struct {
+ u32 A,B,C,D; /* chaining variables */
+ u32 nblocks;
+ byte buf[64];
+ int count;
+} MD5_CONTEXT;
+
+void md5_init( MD5_CONTEXT *ctx );
+void md5_write( MD5_CONTEXT *hd, byte *inbuf, size_t inlen);
+void md5_final( MD5_CONTEXT *hd );
+
diff --git a/src/GeoIP-1.4.0/libGeoIP/regionName.c b/src/GeoIP-1.4.0/libGeoIP/regionName.c
new file mode 100644
index 0000000..023137a
--- /dev/null
+++ b/src/GeoIP-1.4.0/libGeoIP/regionName.c
@@ -0,0 +1,13311 @@
+#include <string.h>
+#include <stdio.h>
+#include "GeoIP.h"
+const char * GeoIP_region_name_by_code(const char * country_code,const char * region_code) {
+ const char * name = NULL;
+ int region_code2 = -1;
+ if (region_code == NULL) { return NULL; }
+ if ((region_code[0] >= 65) & (region_code[0] < (65 + 26))) {
+ if ((region_code[1] >= 65) & (region_code[1] < (65 + 26))) {
+ if ((strcmp(country_code,"US") == 0) |
+ (strcmp(country_code,"CA") == 0)) {
+ region_code2 = ((region_code[0]-65)*26)+(region_code[1]-65);
+ }
+ }
+ if ((region_code[1] >= 48) & (region_code[1] < (48 + 10))) {
+ region_code2 = ((region_code[0]-65)*10)+(region_code[1]-48)+100;
+ }
+ }
+ if ((region_code[0] >= 48) & (region_code[0] < (48 + 10))) {
+ if ((region_code[1] >= 48) & (region_code[1] < (48 + 10))) {
+ region_code2 = ((region_code[0]-48)*10)+(region_code[1]-48);
+ }
+ }
+ if (region_code2 == -1) {return NULL;}
+ if (strcmp(country_code,"CA") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Alberta";
+ break;
+ case 28:
+ name = "British Columbia";
+ break;
+ case 313:
+ name = "Manitoba";
+ break;
+ case 339:
+ name = "New Brunswick";
+ break;
+ case 343:
+ name = "Newfoundland";
+ break;
+ case 356:
+ name = "Nova Scotia";
+ break;
+ case 358:
+ name = "Nunavut";
+ break;
+ case 377:
+ name = "Ontario";
+ break;
+ case 394:
+ name = "Prince Edward Island";
+ break;
+ case 418:
+ name = "Quebec";
+ break;
+ case 478:
+ name = "Saskatchewan";
+ break;
+ case 357:
+ name = "Northwest Territories";
+ break;
+ case 643:
+ name = "Yukon Territory";
+ break;
+ }
+ }
+ if (strcmp(country_code,"US") == 0) {
+ switch (region_code2) {
+ case 0:
+ name = "Armed Forces Americas";
+ break;
+ case 4:
+ name = "Armed Forces Europe";
+ break;
+ case 10:
+ name = "Alaska";
+ break;
+ case 11:
+ name = "Alabama";
+ break;
+ case 15:
+ name = "Armed Forces Pacific";
+ break;
+ case 17:
+ name = "Arkansas";
+ break;
+ case 18:
+ name = "American Samoa";
+ break;
+ case 25:
+ name = "Arizona";
+ break;
+ case 52:
+ name = "California";
+ break;
+ case 66:
+ name = "Colorado";
+ break;
+ case 71:
+ name = "Connecticut";
+ break;
+ case 80:
+ name = "District of Columbia";
+ break;
+ case 82:
+ name = "Delaware";
+ break;
+ case 141:
+ name = "Florida";
+ break;
+ case 142:
+ name = "Federated States of Micronesia";
+ break;
+ case 156:
+ name = "Georgia";
+ break;
+ case 176:
+ name = "Guam";
+ break;
+ case 190:
+ name = "Hawaii";
+ break;
+ case 208:
+ name = "Iowa";
+ break;
+ case 211:
+ name = "Idaho";
+ break;
+ case 219:
+ name = "Illinois";
+ break;
+ case 221:
+ name = "Indiana";
+ break;
+ case 278:
+ name = "Kansas";
+ break;
+ case 284:
+ name = "Kentucky";
+ break;
+ case 286:
+ name = "Louisiana";
+ break;
+ case 312:
+ name = "Massachusetts";
+ break;
+ case 315:
+ name = "Maryland";
+ break;
+ case 316:
+ name = "Maine";
+ break;
+ case 319:
+ name = "Marshall Islands";
+ break;
+ case 320:
+ name = "Michigan";
+ break;
+ case 325:
+ name = "Minnesota";
+ break;
+ case 326:
+ name = "Missouri";
+ break;
+ case 327:
+ name = "Northern Mariana Islands";
+ break;
+ case 330:
+ name = "Mississippi";
+ break;
+ case 331:
+ name = "Montana";
+ break;
+ case 340:
+ name = "North Carolina";
+ break;
+ case 341:
+ name = "North Dakota";
+ break;
+ case 342:
+ name = "Nebraska";
+ break;
+ case 345:
+ name = "New Hampshire";
+ break;
+ case 347:
+ name = "New Jersey";
+ break;
+ case 350:
+ name = "New Mexico";
+ break;
+ case 359:
+ name = "Nevada";
+ break;
+ case 362:
+ name = "New York";
+ break;
+ case 371:
+ name = "Ohio";
+ break;
+ case 374:
+ name = "Oklahoma";
+ break;
+ case 381:
+ name = "Oregon";
+ break;
+ case 390:
+ name = "Pennsylvania";
+ break;
+ case 407:
+ name = "Puerto Rico";
+ break;
+ case 412:
+ name = "Palau";
+ break;
+ case 450:
+ name = "Rhode Island";
+ break;
+ case 470:
+ name = "South Carolina";
+ break;
+ case 471:
+ name = "South Dakota";
+ break;
+ case 507:
+ name = "Tennessee";
+ break;
+ case 517:
+ name = "Texas";
+ break;
+ case 539:
+ name = "Utah";
+ break;
+ case 546:
+ name = "Virginia";
+ break;
+ case 554:
+ name = "Virgin Islands";
+ break;
+ case 565:
+ name = "Vermont";
+ break;
+ case 572:
+ name = "Washington";
+ break;
+ case 593:
+ name = "West Virginia";
+ break;
+ case 580:
+ name = "Wisconsin";
+ break;
+ case 596:
+ name = "Wyoming";
+ break;
+ }
+ }
+ if (strcmp(country_code,"AD") == 0) {
+ switch (region_code2) {
+ case 2:
+ name = "Canillo";
+ break;
+ case 3:
+ name = "Encamp";
+ break;
+ case 4:
+ name = "La Massana";
+ break;
+ case 5:
+ name = "Ordino";
+ break;
+ case 6:
+ name = "Sant Julia de Loria";
+ break;
+ case 7:
+ name = "Andorra la Vella";
+ break;
+ case 8:
+ name = "Escaldes-Engordany";
+ break;
+ }
+ }
+ if (strcmp(country_code,"AE") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Abu Dhabi";
+ break;
+ case 2:
+ name = "Ajman";
+ break;
+ case 3:
+ name = "Dubai";
+ break;
+ case 4:
+ name = "Fujairah";
+ break;
+ case 5:
+ name = "Ras Al Khaimah";
+ break;
+ case 6:
+ name = "Sharjah";
+ break;
+ case 7:
+ name = "Umm Al Quwain";
+ break;
+ }
+ }
+ if (strcmp(country_code,"AF") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Badakhshan";
+ break;
+ case 2:
+ name = "Badghis";
+ break;
+ case 3:
+ name = "Baghlan";
+ break;
+ case 5:
+ name = "Bamian";
+ break;
+ case 6:
+ name = "Farah";
+ break;
+ case 7:
+ name = "Faryab";
+ break;
+ case 8:
+ name = "Ghazni";
+ break;
+ case 9:
+ name = "Ghowr";
+ break;
+ case 10:
+ name = "Helmand";
+ break;
+ case 11:
+ name = "Herat";
+ break;
+ case 13:
+ name = "Kabol";
+ break;
+ case 14:
+ name = "Kapisa";
+ break;
+ case 15:
+ name = "Konar";
+ break;
+ case 16:
+ name = "Laghman";
+ break;
+ case 17:
+ name = "Lowgar";
+ break;
+ case 18:
+ name = "Nangarhar";
+ break;
+ case 19:
+ name = "Nimruz";
+ break;
+ case 20:
+ name = "Oruzgan";
+ break;
+ case 21:
+ name = "Paktia";
+ break;
+ case 22:
+ name = "Parvan";
+ break;
+ case 23:
+ name = "Kandahar";
+ break;
+ case 24:
+ name = "Kondoz";
+ break;
+ case 26:
+ name = "Takhar";
+ break;
+ case 27:
+ name = "Vardak";
+ break;
+ case 28:
+ name = "Zabol";
+ break;
+ case 29:
+ name = "Paktika";
+ break;
+ case 30:
+ name = "Balkh";
+ break;
+ case 31:
+ name = "Jowzjan";
+ break;
+ case 32:
+ name = "Samangan";
+ break;
+ case 33:
+ name = "Sar-e Pol";
+ break;
+ case 34:
+ name = "Konar";
+ break;
+ case 35:
+ name = "Laghman";
+ break;
+ case 36:
+ name = "Paktia";
+ break;
+ case 37:
+ name = "Khowst";
+ break;
+ case 38:
+ name = "Nurestan";
+ break;
+ }
+ }
+ if (strcmp(country_code,"AG") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Barbuda";
+ break;
+ case 3:
+ name = "Saint George";
+ break;
+ case 4:
+ name = "Saint John";
+ break;
+ case 5:
+ name = "Saint Mary";
+ break;
+ case 6:
+ name = "Saint Paul";
+ break;
+ case 7:
+ name = "Saint Peter";
+ break;
+ case 8:
+ name = "Saint Philip";
+ break;
+ }
+ }
+ if (strcmp(country_code,"AL") == 0) {
+ switch (region_code2) {
+ case 40:
+ name = "Berat";
+ break;
+ case 41:
+ name = "Diber";
+ break;
+ case 42:
+ name = "Durres";
+ break;
+ case 43:
+ name = "Elbasan";
+ break;
+ case 44:
+ name = "Fier";
+ break;
+ case 45:
+ name = "Gjirokaster";
+ break;
+ case 46:
+ name = "Korce";
+ break;
+ case 47:
+ name = "Kukes";
+ break;
+ case 48:
+ name = "Lezhe";
+ break;
+ case 49:
+ name = "Shkoder";
+ break;
+ case 50:
+ name = "Tirane";
+ break;
+ case 51:
+ name = "Vlore";
+ break;
+ }
+ }
+ if (strcmp(country_code,"AM") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Aragatsotn";
+ break;
+ case 2:
+ name = "Ararat";
+ break;
+ case 3:
+ name = "Armavir";
+ break;
+ case 4:
+ name = "Geghark'unik'";
+ break;
+ case 5:
+ name = "Kotayk'";
+ break;
+ case 6:
+ name = "Lorri";
+ break;
+ case 7:
+ name = "Shirak";
+ break;
+ case 8:
+ name = "Syunik'";
+ break;
+ case 9:
+ name = "Tavush";
+ break;
+ case 10:
+ name = "Vayots' Dzor";
+ break;
+ case 11:
+ name = "Yerevan";
+ break;
+ }
+ }
+ if (strcmp(country_code,"AO") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Benguela";
+ break;
+ case 2:
+ name = "Bie";
+ break;
+ case 3:
+ name = "Cabinda";
+ break;
+ case 4:
+ name = "Cuando Cubango";
+ break;
+ case 5:
+ name = "Cuanza Norte";
+ break;
+ case 6:
+ name = "Cuanza Sul";
+ break;
+ case 7:
+ name = "Cunene";
+ break;
+ case 8:
+ name = "Huambo";
+ break;
+ case 9:
+ name = "Huila";
+ break;
+ case 12:
+ name = "Malanje";
+ break;
+ case 14:
+ name = "Moxico";
+ break;
+ case 15:
+ name = "Uige";
+ break;
+ case 16:
+ name = "Zaire";
+ break;
+ case 17:
+ name = "Lunda Norte";
+ break;
+ case 18:
+ name = "Lunda Sul";
+ break;
+ case 19:
+ name = "Bengo";
+ break;
+ case 20:
+ name = "Luanda";
+ break;
+ }
+ }
+ if (strcmp(country_code,"AR") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Buenos Aires";
+ break;
+ case 2:
+ name = "Catamarca";
+ break;
+ case 3:
+ name = "Chaco";
+ break;
+ case 4:
+ name = "Chubut";
+ break;
+ case 5:
+ name = "Cordoba";
+ break;
+ case 6:
+ name = "Corrientes";
+ break;
+ case 7:
+ name = "Distrito Federal";
+ break;
+ case 8:
+ name = "Entre Rios";
+ break;
+ case 9:
+ name = "Formosa";
+ break;
+ case 10:
+ name = "Jujuy";
+ break;
+ case 11:
+ name = "La Pampa";
+ break;
+ case 12:
+ name = "La Rioja";
+ break;
+ case 13:
+ name = "Mendoza";
+ break;
+ case 14:
+ name = "Misiones";
+ break;
+ case 15:
+ name = "Neuquen";
+ break;
+ case 16:
+ name = "Rio Negro";
+ break;
+ case 17:
+ name = "Salta";
+ break;
+ case 18:
+ name = "San Juan";
+ break;
+ case 19:
+ name = "San Luis";
+ break;
+ case 20:
+ name = "Santa Cruz";
+ break;
+ case 21:
+ name = "Santa Fe";
+ break;
+ case 22:
+ name = "Santiago del Estero";
+ break;
+ case 23:
+ name = "Tierra del Fuego";
+ break;
+ case 24:
+ name = "Tucuman";
+ break;
+ }
+ }
+ if (strcmp(country_code,"AT") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Burgenland";
+ break;
+ case 2:
+ name = "Karnten";
+ break;
+ case 3:
+ name = "Niederosterreich";
+ break;
+ case 4:
+ name = "Oberosterreich";
+ break;
+ case 5:
+ name = "Salzburg";
+ break;
+ case 6:
+ name = "Steiermark";
+ break;
+ case 7:
+ name = "Tirol";
+ break;
+ case 8:
+ name = "Vorarlberg";
+ break;
+ case 9:
+ name = "Wien";
+ break;
+ }
+ }
+ if (strcmp(country_code,"AU") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Australian Capital Territory";
+ break;
+ case 2:
+ name = "New South Wales";
+ break;
+ case 3:
+ name = "Northern Territory";
+ break;
+ case 4:
+ name = "Queensland";
+ break;
+ case 5:
+ name = "South Australia";
+ break;
+ case 6:
+ name = "Tasmania";
+ break;
+ case 7:
+ name = "Victoria";
+ break;
+ case 8:
+ name = "Western Australia";
+ break;
+ }
+ }
+ if (strcmp(country_code,"AZ") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Abseron";
+ break;
+ case 2:
+ name = "Agcabadi";
+ break;
+ case 3:
+ name = "Agdam";
+ break;
+ case 4:
+ name = "Agdas";
+ break;
+ case 5:
+ name = "Agstafa";
+ break;
+ case 6:
+ name = "Agsu";
+ break;
+ case 7:
+ name = "Ali Bayramli";
+ break;
+ case 8:
+ name = "Astara";
+ break;
+ case 9:
+ name = "Baki";
+ break;
+ case 10:
+ name = "Balakan";
+ break;
+ case 11:
+ name = "Barda";
+ break;
+ case 12:
+ name = "Beylaqan";
+ break;
+ case 13:
+ name = "Bilasuvar";
+ break;
+ case 14:
+ name = "Cabrayil";
+ break;
+ case 15:
+ name = "Calilabad";
+ break;
+ case 16:
+ name = "Daskasan";
+ break;
+ case 17:
+ name = "Davaci";
+ break;
+ case 18:
+ name = "Fuzuli";
+ break;
+ case 19:
+ name = "Gadabay";
+ break;
+ case 20:
+ name = "Ganca";
+ break;
+ case 21:
+ name = "Goranboy";
+ break;
+ case 22:
+ name = "Goycay";
+ break;
+ case 23:
+ name = "Haciqabul";
+ break;
+ case 24:
+ name = "Imisli";
+ break;
+ case 25:
+ name = "Ismayilli";
+ break;
+ case 26:
+ name = "Kalbacar";
+ break;
+ case 27:
+ name = "Kurdamir";
+ break;
+ case 28:
+ name = "Lacin";
+ break;
+ case 29:
+ name = "Lankaran";
+ break;
+ case 30:
+ name = "Lankaran";
+ break;
+ case 31:
+ name = "Lerik";
+ break;
+ case 32:
+ name = "Masalli";
+ break;
+ case 33:
+ name = "Mingacevir";
+ break;
+ case 34:
+ name = "Naftalan";
+ break;
+ case 35:
+ name = "Naxcivan";
+ break;
+ case 36:
+ name = "Neftcala";
+ break;
+ case 37:
+ name = "Oguz";
+ break;
+ case 38:
+ name = "Qabala";
+ break;
+ case 39:
+ name = "Qax";
+ break;
+ case 40:
+ name = "Qazax";
+ break;
+ case 41:
+ name = "Qobustan";
+ break;
+ case 42:
+ name = "Quba";
+ break;
+ case 43:
+ name = "Qubadli";
+ break;
+ case 44:
+ name = "Qusar";
+ break;
+ case 45:
+ name = "Saatli";
+ break;
+ case 46:
+ name = "Sabirabad";
+ break;
+ case 47:
+ name = "Saki";
+ break;
+ case 48:
+ name = "Saki";
+ break;
+ case 49:
+ name = "Salyan";
+ break;
+ case 50:
+ name = "Samaxi";
+ break;
+ case 51:
+ name = "Samkir";
+ break;
+ case 52:
+ name = "Samux";
+ break;
+ case 53:
+ name = "Siyazan";
+ break;
+ case 54:
+ name = "Sumqayit";
+ break;
+ case 55:
+ name = "Susa";
+ break;
+ case 56:
+ name = "Susa";
+ break;
+ case 57:
+ name = "Tartar";
+ break;
+ case 58:
+ name = "Tovuz";
+ break;
+ case 59:
+ name = "Ucar";
+ break;
+ case 60:
+ name = "Xacmaz";
+ break;
+ case 61:
+ name = "Xankandi";
+ break;
+ case 62:
+ name = "Xanlar";
+ break;
+ case 63:
+ name = "Xizi";
+ break;
+ case 64:
+ name = "Xocali";
+ break;
+ case 65:
+ name = "Xocavand";
+ break;
+ case 66:
+ name = "Yardimli";
+ break;
+ case 67:
+ name = "Yevlax";
+ break;
+ case 68:
+ name = "Yevlax";
+ break;
+ case 69:
+ name = "Zangilan";
+ break;
+ case 70:
+ name = "Zaqatala";
+ break;
+ case 71:
+ name = "Zardab";
+ break;
+ }
+ }
+ if (strcmp(country_code,"BA") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Federation of Bosnia and Herzegovina";
+ break;
+ case 2:
+ name = "Republika Srpska";
+ break;
+ }
+ }
+ if (strcmp(country_code,"BB") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Christ Church";
+ break;
+ case 2:
+ name = "Saint Andrew";
+ break;
+ case 3:
+ name = "Saint George";
+ break;
+ case 4:
+ name = "Saint James";
+ break;
+ case 5:
+ name = "Saint John";
+ break;
+ case 6:
+ name = "Saint Joseph";
+ break;
+ case 7:
+ name = "Saint Lucy";
+ break;
+ case 8:
+ name = "Saint Michael";
+ break;
+ case 9:
+ name = "Saint Peter";
+ break;
+ case 10:
+ name = "Saint Philip";
+ break;
+ case 11:
+ name = "Saint Thomas";
+ break;
+ }
+ }
+ if (strcmp(country_code,"BD") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Barisal";
+ break;
+ case 4:
+ name = "Bandarban";
+ break;
+ case 5:
+ name = "Comilla";
+ break;
+ case 12:
+ name = "Mymensingh";
+ break;
+ case 13:
+ name = "Noakhali";
+ break;
+ case 15:
+ name = "Patuakhali";
+ break;
+ case 22:
+ name = "Bagerhat";
+ break;
+ case 23:
+ name = "Bhola";
+ break;
+ case 24:
+ name = "Bogra";
+ break;
+ case 25:
+ name = "Barguna";
+ break;
+ case 26:
+ name = "Brahmanbaria";
+ break;
+ case 27:
+ name = "Chandpur";
+ break;
+ case 28:
+ name = "Chapai Nawabganj";
+ break;
+ case 29:
+ name = "Chattagram";
+ break;
+ case 30:
+ name = "Chuadanga";
+ break;
+ case 31:
+ name = "Cox's Bazar";
+ break;
+ case 32:
+ name = "Dhaka";
+ break;
+ case 33:
+ name = "Dinajpur";
+ break;
+ case 34:
+ name = "Faridpur";
+ break;
+ case 35:
+ name = "Feni";
+ break;
+ case 36:
+ name = "Gaibandha";
+ break;
+ case 37:
+ name = "Gazipur";
+ break;
+ case 38:
+ name = "Gopalganj";
+ break;
+ case 39:
+ name = "Habiganj";
+ break;
+ case 40:
+ name = "Jaipurhat";
+ break;
+ case 41:
+ name = "Jamalpur";
+ break;
+ case 42:
+ name = "Jessore";
+ break;
+ case 43:
+ name = "Jhalakati";
+ break;
+ case 44:
+ name = "Jhenaidah";
+ break;
+ case 45:
+ name = "Khagrachari";
+ break;
+ case 46:
+ name = "Khulna";
+ break;
+ case 47:
+ name = "Kishorganj";
+ break;
+ case 48:
+ name = "Kurigram";
+ break;
+ case 49:
+ name = "Kushtia";
+ break;
+ case 50:
+ name = "Laksmipur";
+ break;
+ case 51:
+ name = "Lalmonirhat";
+ break;
+ case 52:
+ name = "Madaripur";
+ break;
+ case 53:
+ name = "Magura";
+ break;
+ case 54:
+ name = "Manikganj";
+ break;
+ case 55:
+ name = "Meherpur";
+ break;
+ case 56:
+ name = "Moulavibazar";
+ break;
+ case 57:
+ name = "Munshiganj";
+ break;
+ case 58:
+ name = "Naogaon";
+ break;
+ case 59:
+ name = "Narail";
+ break;
+ case 60:
+ name = "Narayanganj";
+ break;
+ case 61:
+ name = "Narsingdi";
+ break;
+ case 62:
+ name = "Nator";
+ break;
+ case 63:
+ name = "Netrakona";
+ break;
+ case 64:
+ name = "Nilphamari";
+ break;
+ case 65:
+ name = "Pabna";
+ break;
+ case 66:
+ name = "Panchagar";
+ break;
+ case 67:
+ name = "Parbattya Chattagram";
+ break;
+ case 68:
+ name = "Pirojpur";
+ break;
+ case 69:
+ name = "Rajbari";
+ break;
+ case 70:
+ name = "Rajshahi";
+ break;
+ case 71:
+ name = "Rangpur";
+ break;
+ case 72:
+ name = "Satkhira";
+ break;
+ case 73:
+ name = "Shariyatpur";
+ break;
+ case 74:
+ name = "Sherpur";
+ break;
+ case 75:
+ name = "Sirajganj";
+ break;
+ case 76:
+ name = "Sunamganj";
+ break;
+ case 77:
+ name = "Sylhet";
+ break;
+ case 78:
+ name = "Tangail";
+ break;
+ case 79:
+ name = "Thakurgaon";
+ break;
+ }
+ }
+ if (strcmp(country_code,"BE") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Antwerpen";
+ break;
+ case 2:
+ name = "Brabant";
+ break;
+ case 3:
+ name = "Hainaut";
+ break;
+ case 4:
+ name = "Liege";
+ break;
+ case 5:
+ name = "Limburg";
+ break;
+ case 6:
+ name = "Luxembourg";
+ break;
+ case 7:
+ name = "Namur";
+ break;
+ case 8:
+ name = "Oost-Vlaanderen";
+ break;
+ case 9:
+ name = "West-Vlaanderen";
+ break;
+ case 10:
+ name = "Brabant Wallon";
+ break;
+ case 11:
+ name = "Brussels Hoofdstedelijk Gewest";
+ break;
+ case 12:
+ name = "Vlaams-Brabant";
+ break;
+ }
+ }
+ if (strcmp(country_code,"BF") == 0) {
+ switch (region_code2) {
+ case 15:
+ name = "Bam";
+ break;
+ case 19:
+ name = "Boulkiemde";
+ break;
+ case 20:
+ name = "Ganzourgou";
+ break;
+ case 21:
+ name = "Gnagna";
+ break;
+ case 28:
+ name = "Kouritenga";
+ break;
+ case 33:
+ name = "Oudalan";
+ break;
+ case 34:
+ name = "Passore";
+ break;
+ case 36:
+ name = "Sanguie";
+ break;
+ case 40:
+ name = "Soum";
+ break;
+ case 42:
+ name = "Tapoa";
+ break;
+ case 44:
+ name = "Zoundweogo";
+ break;
+ case 45:
+ name = "Bale";
+ break;
+ case 46:
+ name = "Banwa";
+ break;
+ case 47:
+ name = "Bazega";
+ break;
+ case 48:
+ name = "Bougouriba";
+ break;
+ case 49:
+ name = "Boulgou";
+ break;
+ case 50:
+ name = "Gourma";
+ break;
+ case 51:
+ name = "Houet";
+ break;
+ case 52:
+ name = "Ioba";
+ break;
+ case 53:
+ name = "Kadiogo";
+ break;
+ case 54:
+ name = "Kenedougou";
+ break;
+ case 55:
+ name = "Komoe";
+ break;
+ case 56:
+ name = "Komondjari";
+ break;
+ case 57:
+ name = "Kompienga";
+ break;
+ case 58:
+ name = "Kossi";
+ break;
+ case 59:
+ name = "Koulpelogo";
+ break;
+ case 60:
+ name = "Kourweogo";
+ break;
+ case 61:
+ name = "Leraba";
+ break;
+ case 62:
+ name = "Loroum";
+ break;
+ case 63:
+ name = "Mouhoun";
+ break;
+ case 64:
+ name = "Namentenga";
+ break;
+ case 65:
+ name = "Naouri";
+ break;
+ case 66:
+ name = "Nayala";
+ break;
+ case 67:
+ name = "Noumbiel";
+ break;
+ case 68:
+ name = "Oubritenga";
+ break;
+ case 69:
+ name = "Poni";
+ break;
+ case 70:
+ name = "Sanmatenga";
+ break;
+ case 71:
+ name = "Seno";
+ break;
+ case 72:
+ name = "Sissili";
+ break;
+ case 73:
+ name = "Sourou";
+ break;
+ case 74:
+ name = "Tuy";
+ break;
+ case 75:
+ name = "Yagha";
+ break;
+ case 76:
+ name = "Yatenga";
+ break;
+ case 77:
+ name = "Ziro";
+ break;
+ case 78:
+ name = "Zondoma";
+ break;
+ }
+ }
+ if (strcmp(country_code,"BG") == 0) {
+ switch (region_code2) {
+ case 33:
+ name = "Mikhaylovgrad";
+ break;
+ case 38:
+ name = "Blagoevgrad";
+ break;
+ case 39:
+ name = "Burgas";
+ break;
+ case 40:
+ name = "Dobrich";
+ break;
+ case 41:
+ name = "Gabrovo";
+ break;
+ case 42:
+ name = "Grad Sofiya";
+ break;
+ case 43:
+ name = "Khaskovo";
+ break;
+ case 44:
+ name = "Kurdzhali";
+ break;
+ case 45:
+ name = "Kyustendil";
+ break;
+ case 46:
+ name = "Lovech";
+ break;
+ case 47:
+ name = "Montana";
+ break;
+ case 48:
+ name = "Pazardzhik";
+ break;
+ case 49:
+ name = "Pernik";
+ break;
+ case 50:
+ name = "Pleven";
+ break;
+ case 51:
+ name = "Plovdiv";
+ break;
+ case 52:
+ name = "Razgrad";
+ break;
+ case 53:
+ name = "Ruse";
+ break;
+ case 54:
+ name = "Shumen";
+ break;
+ case 55:
+ name = "Silistra";
+ break;
+ case 56:
+ name = "Sliven";
+ break;
+ case 57:
+ name = "Smolyan";
+ break;
+ case 58:
+ name = "Sofiya";
+ break;
+ case 59:
+ name = "Stara Zagora";
+ break;
+ case 60:
+ name = "Turgovishte";
+ break;
+ case 61:
+ name = "Varna";
+ break;
+ case 62:
+ name = "Veliko Turnovo";
+ break;
+ case 63:
+ name = "Vidin";
+ break;
+ case 64:
+ name = "Vratsa";
+ break;
+ case 65:
+ name = "Yambol";
+ break;
+ }
+ }
+ if (strcmp(country_code,"BH") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Al Hadd";
+ break;
+ case 2:
+ name = "Al Manamah";
+ break;
+ case 3:
+ name = "Al Muharraq";
+ break;
+ case 5:
+ name = "Jidd Hafs";
+ break;
+ case 6:
+ name = "Sitrah";
+ break;
+ case 8:
+ name = "Al Mintaqah al Gharbiyah";
+ break;
+ case 9:
+ name = "Mintaqat Juzur Hawar";
+ break;
+ case 10:
+ name = "Al Mintaqah ash Shamaliyah";
+ break;
+ case 11:
+ name = "Al Mintaqah al Wusta";
+ break;
+ case 12:
+ name = "Madinat";
+ break;
+ case 13:
+ name = "Ar Rifa";
+ break;
+ case 14:
+ name = "Madinat Hamad";
+ break;
+ }
+ }
+ if (strcmp(country_code,"BI") == 0) {
+ switch (region_code2) {
+ case 2:
+ name = "Bujumbura";
+ break;
+ case 9:
+ name = "Bubanza";
+ break;
+ case 10:
+ name = "Bururi";
+ break;
+ case 11:
+ name = "Cankuzo";
+ break;
+ case 12:
+ name = "Cibitoke";
+ break;
+ case 13:
+ name = "Gitega";
+ break;
+ case 14:
+ name = "Karuzi";
+ break;
+ case 15:
+ name = "Kayanza";
+ break;
+ case 16:
+ name = "Kirundo";
+ break;
+ case 17:
+ name = "Makamba";
+ break;
+ case 18:
+ name = "Muyinga";
+ break;
+ case 19:
+ name = "Ngozi";
+ break;
+ case 20:
+ name = "Rutana";
+ break;
+ case 21:
+ name = "Ruyigi";
+ break;
+ case 22:
+ name = "Muramvya";
+ break;
+ case 23:
+ name = "Mwaro";
+ break;
+ }
+ }
+ if (strcmp(country_code,"BJ") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Atakora";
+ break;
+ case 2:
+ name = "Atlantique";
+ break;
+ case 3:
+ name = "Borgou";
+ break;
+ case 4:
+ name = "Mono";
+ break;
+ case 5:
+ name = "Oueme";
+ break;
+ case 6:
+ name = "Zou";
+ break;
+ }
+ }
+ if (strcmp(country_code,"BM") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Devonshire";
+ break;
+ case 2:
+ name = "Hamilton";
+ break;
+ case 3:
+ name = "Hamilton";
+ break;
+ case 4:
+ name = "Paget";
+ break;
+ case 5:
+ name = "Pembroke";
+ break;
+ case 6:
+ name = "Saint George";
+ break;
+ case 7:
+ name = "Saint George's";
+ break;
+ case 8:
+ name = "Sandys";
+ break;
+ case 9:
+ name = "Smiths";
+ break;
+ case 10:
+ name = "Southampton";
+ break;
+ case 11:
+ name = "Warwick";
+ break;
+ }
+ }
+ if (strcmp(country_code,"BN") == 0) {
+ switch (region_code2) {
+ case 7:
+ name = "Alibori";
+ break;
+ case 8:
+ name = "Belait";
+ break;
+ case 9:
+ name = "Brunei and Muara";
+ break;
+ case 10:
+ name = "Temburong";
+ break;
+ case 11:
+ name = "Collines";
+ break;
+ case 12:
+ name = "Kouffo";
+ break;
+ case 13:
+ name = "Donga";
+ break;
+ case 14:
+ name = "Littoral";
+ break;
+ case 15:
+ name = "Tutong";
+ break;
+ case 16:
+ name = "Oueme";
+ break;
+ case 17:
+ name = "Plateau";
+ break;
+ case 18:
+ name = "Zou";
+ break;
+ }
+ }
+ if (strcmp(country_code,"BO") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Chuquisaca";
+ break;
+ case 2:
+ name = "Cochabamba";
+ break;
+ case 3:
+ name = "El Beni";
+ break;
+ case 4:
+ name = "La Paz";
+ break;
+ case 5:
+ name = "Oruro";
+ break;
+ case 6:
+ name = "Pando";
+ break;
+ case 7:
+ name = "Potosi";
+ break;
+ case 8:
+ name = "Santa Cruz";
+ break;
+ case 9:
+ name = "Tarija";
+ break;
+ }
+ }
+ if (strcmp(country_code,"BR") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Acre";
+ break;
+ case 2:
+ name = "Alagoas";
+ break;
+ case 3:
+ name = "Amapa";
+ break;
+ case 4:
+ name = "Amazonas";
+ break;
+ case 5:
+ name = "Bahia";
+ break;
+ case 6:
+ name = "Ceara";
+ break;
+ case 7:
+ name = "Distrito Federal";
+ break;
+ case 8:
+ name = "Espirito Santo";
+ break;
+ case 11:
+ name = "Mato Grosso do Sul";
+ break;
+ case 13:
+ name = "Maranhao";
+ break;
+ case 14:
+ name = "Mato Grosso";
+ break;
+ case 15:
+ name = "Minas Gerais";
+ break;
+ case 16:
+ name = "Para";
+ break;
+ case 17:
+ name = "Paraiba";
+ break;
+ case 18:
+ name = "Parana";
+ break;
+ case 20:
+ name = "Piaui";
+ break;
+ case 21:
+ name = "Rio de Janeiro";
+ break;
+ case 22:
+ name = "Rio Grande do Norte";
+ break;
+ case 23:
+ name = "Rio Grande do Sul";
+ break;
+ case 24:
+ name = "Rondonia";
+ break;
+ case 25:
+ name = "Roraima";
+ break;
+ case 26:
+ name = "Santa Catarina";
+ break;
+ case 27:
+ name = "Sao Paulo";
+ break;
+ case 28:
+ name = "Sergipe";
+ break;
+ case 29:
+ name = "Goias";
+ break;
+ case 30:
+ name = "Pernambuco";
+ break;
+ case 31:
+ name = "Tocantins";
+ break;
+ }
+ }
+ if (strcmp(country_code,"BS") == 0) {
+ switch (region_code2) {
+ case 5:
+ name = "Bimini";
+ break;
+ case 6:
+ name = "Cat Island";
+ break;
+ case 10:
+ name = "Exuma";
+ break;
+ case 13:
+ name = "Inagua";
+ break;
+ case 15:
+ name = "Long Island";
+ break;
+ case 16:
+ name = "Mayaguana";
+ break;
+ case 18:
+ name = "Ragged Island";
+ break;
+ case 22:
+ name = "Harbour Island";
+ break;
+ case 23:
+ name = "New Providence";
+ break;
+ case 24:
+ name = "Acklins and Crooked Islands";
+ break;
+ case 25:
+ name = "Freeport";
+ break;
+ case 26:
+ name = "Fresh Creek";
+ break;
+ case 27:
+ name = "Governor's Harbour";
+ break;
+ case 28:
+ name = "Green Turtle Cay";
+ break;
+ case 29:
+ name = "High Rock";
+ break;
+ case 30:
+ name = "Kemps Bay";
+ break;
+ case 31:
+ name = "Marsh Harbour";
+ break;
+ case 32:
+ name = "Nichollstown and Berry Islands";
+ break;
+ case 33:
+ name = "Rock Sound";
+ break;
+ case 34:
+ name = "Sandy Point";
+ break;
+ case 35:
+ name = "San Salvador and Rum Cay";
+ break;
+ }
+ }
+ if (strcmp(country_code,"BT") == 0) {
+ switch (region_code2) {
+ case 5:
+ name = "Bumthang";
+ break;
+ case 6:
+ name = "Chhukha";
+ break;
+ case 7:
+ name = "Chirang";
+ break;
+ case 8:
+ name = "Daga";
+ break;
+ case 9:
+ name = "Geylegphug";
+ break;
+ case 10:
+ name = "Ha";
+ break;
+ case 11:
+ name = "Lhuntshi";
+ break;
+ case 12:
+ name = "Mongar";
+ break;
+ case 13:
+ name = "Paro";
+ break;
+ case 14:
+ name = "Pemagatsel";
+ break;
+ case 15:
+ name = "Punakha";
+ break;
+ case 16:
+ name = "Samchi";
+ break;
+ case 17:
+ name = "Samdrup";
+ break;
+ case 18:
+ name = "Shemgang";
+ break;
+ case 19:
+ name = "Tashigang";
+ break;
+ case 20:
+ name = "Thimphu";
+ break;
+ case 21:
+ name = "Tongsa";
+ break;
+ case 22:
+ name = "Wangdi Phodrang";
+ break;
+ }
+ }
+ if (strcmp(country_code,"BW") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Central";
+ break;
+ case 2:
+ name = "Chobe";
+ break;
+ case 3:
+ name = "Ghanzi";
+ break;
+ case 4:
+ name = "Kgalagadi";
+ break;
+ case 5:
+ name = "Kgatleng";
+ break;
+ case 6:
+ name = "Kweneng";
+ break;
+ case 7:
+ name = "Ngamiland";
+ break;
+ case 8:
+ name = "North-East";
+ break;
+ case 9:
+ name = "South-East";
+ break;
+ case 10:
+ name = "Southern";
+ break;
+ }
+ }
+ if (strcmp(country_code,"BY") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Brestskaya Voblasts'";
+ break;
+ case 2:
+ name = "Homyel'skaya Voblasts'";
+ break;
+ case 3:
+ name = "Hrodzyenskaya Voblasts'";
+ break;
+ case 4:
+ name = "Minsk";
+ break;
+ case 5:
+ name = "Minskaya Voblasts'";
+ break;
+ case 6:
+ name = "Mahilyowskaya Voblasts'";
+ break;
+ case 7:
+ name = "Vitsyebskaya Voblasts'";
+ break;
+ }
+ }
+ if (strcmp(country_code,"BZ") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Belize";
+ break;
+ case 2:
+ name = "Cayo";
+ break;
+ case 3:
+ name = "Corozal";
+ break;
+ case 4:
+ name = "Orange Walk";
+ break;
+ case 5:
+ name = "Stann Creek";
+ break;
+ case 6:
+ name = "Toledo";
+ break;
+ }
+ }
+ if (strcmp(country_code,"CF") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Bamingui-Bangoran";
+ break;
+ case 2:
+ name = "Basse-Kotto";
+ break;
+ case 3:
+ name = "Haute-Kotto";
+ break;
+ case 4:
+ name = "Mambere-Kadei";
+ break;
+ case 5:
+ name = "Haut-Mbomou";
+ break;
+ case 6:
+ name = "Kemo";
+ break;
+ case 7:
+ name = "Lobaye";
+ break;
+ case 8:
+ name = "Mbomou";
+ break;
+ case 9:
+ name = "Nana-Mambere";
+ break;
+ case 11:
+ name = "Ouaka";
+ break;
+ case 12:
+ name = "Ouham";
+ break;
+ case 13:
+ name = "Ouham-Pende";
+ break;
+ case 14:
+ name = "Vakaga";
+ break;
+ case 15:
+ name = "Nana-Grebizi";
+ break;
+ case 16:
+ name = "Sangha-Mbaere";
+ break;
+ case 17:
+ name = "Ombella-Mpoko";
+ break;
+ case 18:
+ name = "Bangui";
+ break;
+ }
+ }
+ if (strcmp(country_code,"CG") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Bouenza";
+ break;
+ case 3:
+ name = "Cuvette";
+ break;
+ case 4:
+ name = "Kouilou";
+ break;
+ case 5:
+ name = "Lekoumou";
+ break;
+ case 6:
+ name = "Likouala";
+ break;
+ case 7:
+ name = "Niari";
+ break;
+ case 8:
+ name = "Plateaux";
+ break;
+ case 10:
+ name = "Sangha";
+ break;
+ case 11:
+ name = "Pool";
+ break;
+ case 12:
+ name = "Brazzaville";
+ break;
+ }
+ }
+ if (strcmp(country_code,"CH") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Aargau";
+ break;
+ case 2:
+ name = "Ausser-Rhoden";
+ break;
+ case 3:
+ name = "Basel-Landschaft";
+ break;
+ case 4:
+ name = "Basel-Stadt";
+ break;
+ case 5:
+ name = "Bern";
+ break;
+ case 6:
+ name = "Fribourg";
+ break;
+ case 7:
+ name = "Geneve";
+ break;
+ case 8:
+ name = "Glarus";
+ break;
+ case 9:
+ name = "Graubunden";
+ break;
+ case 10:
+ name = "Inner-Rhoden";
+ break;
+ case 11:
+ name = "Luzern";
+ break;
+ case 12:
+ name = "Neuchatel";
+ break;
+ case 13:
+ name = "Nidwalden";
+ break;
+ case 14:
+ name = "Obwalden";
+ break;
+ case 15:
+ name = "Sankt Gallen";
+ break;
+ case 16:
+ name = "Schaffhausen";
+ break;
+ case 17:
+ name = "Schwyz";
+ break;
+ case 18:
+ name = "Solothurn";
+ break;
+ case 19:
+ name = "Thurgau";
+ break;
+ case 20:
+ name = "Ticino";
+ break;
+ case 21:
+ name = "Uri";
+ break;
+ case 22:
+ name = "Valais";
+ break;
+ case 23:
+ name = "Vaud";
+ break;
+ case 24:
+ name = "Zug";
+ break;
+ case 25:
+ name = "Zurich";
+ break;
+ case 26:
+ name = "Jura";
+ break;
+ }
+ }
+ if (strcmp(country_code,"CI") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Abengourou";
+ break;
+ case 3:
+ name = "Dabakala";
+ break;
+ case 5:
+ name = "Adzope";
+ break;
+ case 6:
+ name = "Agboville";
+ break;
+ case 7:
+ name = "Biankouma";
+ break;
+ case 11:
+ name = "Bouna";
+ break;
+ case 12:
+ name = "Boundiali";
+ break;
+ case 14:
+ name = "Danane";
+ break;
+ case 16:
+ name = "Divo";
+ break;
+ case 17:
+ name = "Ferkessedougou";
+ break;
+ case 18:
+ name = "Gagnoa";
+ break;
+ case 20:
+ name = "Katiola";
+ break;
+ case 21:
+ name = "Korhogo";
+ break;
+ case 23:
+ name = "Odienne";
+ break;
+ case 25:
+ name = "Seguela";
+ break;
+ case 26:
+ name = "Touba";
+ break;
+ case 27:
+ name = "Bongouanou";
+ break;
+ case 28:
+ name = "Issia";
+ break;
+ case 29:
+ name = "Lakota";
+ break;
+ case 30:
+ name = "Mankono";
+ break;
+ case 31:
+ name = "Oume";
+ break;
+ case 32:
+ name = "Soubre";
+ break;
+ case 33:
+ name = "Tingrela";
+ break;
+ case 34:
+ name = "Zuenoula";
+ break;
+ case 36:
+ name = "Bangolo";
+ break;
+ case 37:
+ name = "Beoumi";
+ break;
+ case 38:
+ name = "Bondoukou";
+ break;
+ case 39:
+ name = "Bouafle";
+ break;
+ case 40:
+ name = "Bouake";
+ break;
+ case 41:
+ name = "Daloa";
+ break;
+ case 42:
+ name = "Daoukro";
+ break;
+ case 44:
+ name = "Duekoue";
+ break;
+ case 45:
+ name = "Grand-Lahou";
+ break;
+ case 47:
+ name = "Man";
+ break;
+ case 48:
+ name = "Mbahiakro";
+ break;
+ case 49:
+ name = "Sakassou";
+ break;
+ case 50:
+ name = "San Pedro";
+ break;
+ case 51:
+ name = "Sassandra";
+ break;
+ case 52:
+ name = "Sinfra";
+ break;
+ case 53:
+ name = "Tabou";
+ break;
+ case 54:
+ name = "Tanda";
+ break;
+ case 55:
+ name = "Tiassale";
+ break;
+ case 56:
+ name = "Toumodi";
+ break;
+ case 57:
+ name = "Vavoua";
+ break;
+ case 61:
+ name = "Abidjan";
+ break;
+ case 62:
+ name = "Aboisso";
+ break;
+ case 63:
+ name = "Adiake";
+ break;
+ case 64:
+ name = "Alepe";
+ break;
+ case 65:
+ name = "Bocanda";
+ break;
+ case 66:
+ name = "Dabou";
+ break;
+ case 67:
+ name = "Dimbokro";
+ break;
+ case 68:
+ name = "Grand-Bassam";
+ break;
+ case 69:
+ name = "Guiglo";
+ break;
+ case 70:
+ name = "Jacqueville";
+ break;
+ case 71:
+ name = "Tiebissou";
+ break;
+ case 72:
+ name = "Toulepleu";
+ break;
+ case 73:
+ name = "Yamoussoukro";
+ break;
+ }
+ }
+ if (strcmp(country_code,"CL") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Valparaiso";
+ break;
+ case 2:
+ name = "Aisen del General Carlos Ibanez del Campo";
+ break;
+ case 3:
+ name = "Antofagasta";
+ break;
+ case 4:
+ name = "Araucania";
+ break;
+ case 5:
+ name = "Atacama";
+ break;
+ case 6:
+ name = "Bio-Bio";
+ break;
+ case 7:
+ name = "Coquimbo";
+ break;
+ case 8:
+ name = "Libertador General Bernardo O'Higgins";
+ break;
+ case 9:
+ name = "Los Lagos";
+ break;
+ case 10:
+ name = "Magallanes y de la Antartica Chilena";
+ break;
+ case 11:
+ name = "Maule";
+ break;
+ case 12:
+ name = "Region Metropolitana";
+ break;
+ case 13:
+ name = "Tarapaca";
+ break;
+ }
+ }
+ if (strcmp(country_code,"CM") == 0) {
+ switch (region_code2) {
+ case 4:
+ name = "Est";
+ break;
+ case 5:
+ name = "Littoral";
+ break;
+ case 7:
+ name = "Nord-Ouest";
+ break;
+ case 8:
+ name = "Ouest";
+ break;
+ case 9:
+ name = "Sud-Ouest";
+ break;
+ case 10:
+ name = "Adamaoua";
+ break;
+ case 11:
+ name = "Centre";
+ break;
+ case 12:
+ name = "Extreme-Nord";
+ break;
+ case 13:
+ name = "Nord";
+ break;
+ case 14:
+ name = "Sud";
+ break;
+ }
+ }
+ if (strcmp(country_code,"CN") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Anhui";
+ break;
+ case 2:
+ name = "Zhejiang";
+ break;
+ case 3:
+ name = "Jiangxi";
+ break;
+ case 4:
+ name = "Jiangsu";
+ break;
+ case 5:
+ name = "Jilin";
+ break;
+ case 6:
+ name = "Qinghai";
+ break;
+ case 7:
+ name = "Fujian";
+ break;
+ case 8:
+ name = "Heilongjiang";
+ break;
+ case 9:
+ name = "Henan";
+ break;
+ case 10:
+ name = "Hebei";
+ break;
+ case 11:
+ name = "Hunan";
+ break;
+ case 12:
+ name = "Hubei";
+ break;
+ case 13:
+ name = "Xinjiang";
+ break;
+ case 14:
+ name = "Xizang";
+ break;
+ case 15:
+ name = "Gansu";
+ break;
+ case 16:
+ name = "Guangxi";
+ break;
+ case 18:
+ name = "Guizhou";
+ break;
+ case 19:
+ name = "Liaoning";
+ break;
+ case 20:
+ name = "Nei Mongol";
+ break;
+ case 21:
+ name = "Ningxia";
+ break;
+ case 22:
+ name = "Beijing";
+ break;
+ case 23:
+ name = "Shanghai";
+ break;
+ case 24:
+ name = "Shanxi";
+ break;
+ case 25:
+ name = "Shandong";
+ break;
+ case 26:
+ name = "Shaanxi";
+ break;
+ case 28:
+ name = "Tianjin";
+ break;
+ case 29:
+ name = "Yunnan";
+ break;
+ case 30:
+ name = "Guangdong";
+ break;
+ case 31:
+ name = "Hainan";
+ break;
+ case 32:
+ name = "Sichuan";
+ break;
+ case 33:
+ name = "Chongqing";
+ break;
+ }
+ }
+ if (strcmp(country_code,"CO") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Amazonas";
+ break;
+ case 2:
+ name = "Antioquia";
+ break;
+ case 3:
+ name = "Arauca";
+ break;
+ case 4:
+ name = "Atlantico";
+ break;
+ case 8:
+ name = "Caqueta";
+ break;
+ case 9:
+ name = "Cauca";
+ break;
+ case 10:
+ name = "Cesar";
+ break;
+ case 11:
+ name = "Choco";
+ break;
+ case 12:
+ name = "Cordoba";
+ break;
+ case 14:
+ name = "Guaviare";
+ break;
+ case 15:
+ name = "Guainia";
+ break;
+ case 16:
+ name = "Huila";
+ break;
+ case 17:
+ name = "La Guajira";
+ break;
+ case 19:
+ name = "Meta";
+ break;
+ case 20:
+ name = "Narino";
+ break;
+ case 21:
+ name = "Norte de Santander";
+ break;
+ case 22:
+ name = "Putumayo";
+ break;
+ case 23:
+ name = "Quindio";
+ break;
+ case 24:
+ name = "Risaralda";
+ break;
+ case 25:
+ name = "San Andres y Providencia";
+ break;
+ case 26:
+ name = "Santander";
+ break;
+ case 27:
+ name = "Sucre";
+ break;
+ case 28:
+ name = "Tolima";
+ break;
+ case 29:
+ name = "Valle del Cauca";
+ break;
+ case 30:
+ name = "Vaupes";
+ break;
+ case 31:
+ name = "Vichada";
+ break;
+ case 32:
+ name = "Casanare";
+ break;
+ case 33:
+ name = "Cundinamarca";
+ break;
+ case 34:
+ name = "Distrito Especial";
+ break;
+ case 35:
+ name = "Bolivar";
+ break;
+ case 36:
+ name = "Boyaca";
+ break;
+ case 37:
+ name = "Caldas";
+ break;
+ case 38:
+ name = "Magdalena";
+ break;
+ }
+ }
+ if (strcmp(country_code,"CR") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Alajuela";
+ break;
+ case 2:
+ name = "Cartago";
+ break;
+ case 3:
+ name = "Guanacaste";
+ break;
+ case 4:
+ name = "Heredia";
+ break;
+ case 6:
+ name = "Limon";
+ break;
+ case 7:
+ name = "Puntarenas";
+ break;
+ case 8:
+ name = "San Jose";
+ break;
+ }
+ }
+ if (strcmp(country_code,"CU") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Pinar del Rio";
+ break;
+ case 2:
+ name = "Ciudad de la Habana";
+ break;
+ case 3:
+ name = "Matanzas";
+ break;
+ case 4:
+ name = "Isla de la Juventud";
+ break;
+ case 5:
+ name = "Camaguey";
+ break;
+ case 7:
+ name = "Ciego de Avila";
+ break;
+ case 8:
+ name = "Cienfuegos";
+ break;
+ case 9:
+ name = "Granma";
+ break;
+ case 10:
+ name = "Guantanamo";
+ break;
+ case 11:
+ name = "La Habana";
+ break;
+ case 12:
+ name = "Holguin";
+ break;
+ case 13:
+ name = "Las Tunas";
+ break;
+ case 14:
+ name = "Sancti Spiritus";
+ break;
+ case 15:
+ name = "Santiago de Cuba";
+ break;
+ case 16:
+ name = "Villa Clara";
+ break;
+ }
+ }
+ if (strcmp(country_code,"CV") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Boa Vista";
+ break;
+ case 2:
+ name = "Brava";
+ break;
+ case 4:
+ name = "Maio";
+ break;
+ case 5:
+ name = "Paul";
+ break;
+ case 7:
+ name = "Ribeira Grande";
+ break;
+ case 8:
+ name = "Sal";
+ break;
+ case 10:
+ name = "Sao Nicolau";
+ break;
+ case 11:
+ name = "Sao Vicente";
+ break;
+ case 13:
+ name = "Mosteiros";
+ break;
+ case 14:
+ name = "Praia";
+ break;
+ case 15:
+ name = "Santa Catarina";
+ break;
+ case 16:
+ name = "Santa Cruz";
+ break;
+ case 17:
+ name = "Sao Domingos";
+ break;
+ case 18:
+ name = "Sao Filipe";
+ break;
+ case 19:
+ name = "Sao Miguel";
+ break;
+ case 20:
+ name = "Tarrafal";
+ break;
+ }
+ }
+ if (strcmp(country_code,"CY") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Famagusta";
+ break;
+ case 2:
+ name = "Kyrenia";
+ break;
+ case 3:
+ name = "Larnaca";
+ break;
+ case 4:
+ name = "Nicosia";
+ break;
+ case 5:
+ name = "Limassol";
+ break;
+ case 6:
+ name = "Paphos";
+ break;
+ }
+ }
+ if (strcmp(country_code,"CZ") == 0) {
+ switch (region_code2) {
+ case 3:
+ name = "Blansko";
+ break;
+ case 4:
+ name = "Breclav";
+ break;
+ case 20:
+ name = "Hradec Kralove";
+ break;
+ case 21:
+ name = "Jablonec nad Nisou";
+ break;
+ case 23:
+ name = "Jiein";
+ break;
+ case 24:
+ name = "Jihlava";
+ break;
+ case 30:
+ name = "Kolin";
+ break;
+ case 33:
+ name = "Liberec";
+ break;
+ case 36:
+ name = "Melnik";
+ break;
+ case 37:
+ name = "Mlada Boleslav";
+ break;
+ case 39:
+ name = "Nachod";
+ break;
+ case 41:
+ name = "Nymburk";
+ break;
+ case 45:
+ name = "Pardubice";
+ break;
+ case 52:
+ name = "Hlavni Mesto Praha";
+ break;
+ case 61:
+ name = "Semily";
+ break;
+ case 70:
+ name = "Trutnov";
+ break;
+ case 78:
+ name = "Jihomoravsky Kraj";
+ break;
+ case 79:
+ name = "Jihocesky Kraj";
+ break;
+ case 80:
+ name = "Vysocina";
+ break;
+ case 81:
+ name = "Karlovarsky Kraj";
+ break;
+ case 82:
+ name = "Kralovehradecky Kraj";
+ break;
+ case 83:
+ name = "Liberecky Kraj";
+ break;
+ case 84:
+ name = "Olomoucky Kraj";
+ break;
+ case 85:
+ name = "Moravskoslezsky Kraj";
+ break;
+ case 86:
+ name = "Pardubicky Kraj";
+ break;
+ case 87:
+ name = "Plzensky Kraj";
+ break;
+ case 88:
+ name = "Stredocesky Kraj";
+ break;
+ case 89:
+ name = "Ustecky Kraj";
+ break;
+ case 90:
+ name = "Zlinsky Kraj";
+ break;
+ }
+ }
+ if (strcmp(country_code,"DE") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Baden-Württemberg";
+ break;
+ case 2:
+ name = "Bayern";
+ break;
+ case 3:
+ name = "Bremen";
+ break;
+ case 4:
+ name = "Hamburg";
+ break;
+ case 5:
+ name = "Hessen";
+ break;
+ case 6:
+ name = "Niedersachsen";
+ break;
+ case 7:
+ name = "Nordrhein-Westfalen";
+ break;
+ case 8:
+ name = "Rheinland-Pfalz";
+ break;
+ case 9:
+ name = "Saarland";
+ break;
+ case 10:
+ name = "Schleswig-Holstein";
+ break;
+ case 11:
+ name = "Brandenburg";
+ break;
+ case 12:
+ name = "Mecklenburg-Vorpommern";
+ break;
+ case 13:
+ name = "Sachsen";
+ break;
+ case 14:
+ name = "Sachsen-Anhalt";
+ break;
+ case 15:
+ name = "Thuringen";
+ break;
+ case 16:
+ name = "Berlin";
+ break;
+ }
+ }
+ if (strcmp(country_code,"DJ") == 0) {
+ switch (region_code2) {
+ case 2:
+ name = "Dikhil";
+ break;
+ case 3:
+ name = "Djibouti";
+ break;
+ case 4:
+ name = "Obock";
+ break;
+ case 5:
+ name = "Tadjoura";
+ break;
+ }
+ }
+ if (strcmp(country_code,"DK") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Arhus";
+ break;
+ case 2:
+ name = "Bornholm";
+ break;
+ case 3:
+ name = "Frederiksborg";
+ break;
+ case 4:
+ name = "Fyn";
+ break;
+ case 5:
+ name = "Kobenhavn";
+ break;
+ case 6:
+ name = "Staden Kobenhavn";
+ break;
+ case 7:
+ name = "Nordjylland";
+ break;
+ case 8:
+ name = "Ribe";
+ break;
+ case 9:
+ name = "Ringkobing";
+ break;
+ case 10:
+ name = "Roskilde";
+ break;
+ case 11:
+ name = "Sonderjylland";
+ break;
+ case 12:
+ name = "Storstrom";
+ break;
+ case 13:
+ name = "Vejle";
+ break;
+ case 14:
+ name = "Vestsjalland";
+ break;
+ case 15:
+ name = "Viborg";
+ break;
+ }
+ }
+ if (strcmp(country_code,"DM") == 0) {
+ switch (region_code2) {
+ case 2:
+ name = "Saint Andrew";
+ break;
+ case 3:
+ name = "Saint David";
+ break;
+ case 4:
+ name = "Saint George";
+ break;
+ case 5:
+ name = "Saint John";
+ break;
+ case 6:
+ name = "Saint Joseph";
+ break;
+ case 7:
+ name = "Saint Luke";
+ break;
+ case 8:
+ name = "Saint Mark";
+ break;
+ case 9:
+ name = "Saint Patrick";
+ break;
+ case 10:
+ name = "Saint Paul";
+ break;
+ case 11:
+ name = "Saint Peter";
+ break;
+ }
+ }
+ if (strcmp(country_code,"DO") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Azua";
+ break;
+ case 2:
+ name = "Baoruco";
+ break;
+ case 3:
+ name = "Barahona";
+ break;
+ case 4:
+ name = "Dajabon";
+ break;
+ case 5:
+ name = "Distrito Nacional";
+ break;
+ case 6:
+ name = "Duarte";
+ break;
+ case 8:
+ name = "Espaillat";
+ break;
+ case 9:
+ name = "Independencia";
+ break;
+ case 10:
+ name = "La Altagracia";
+ break;
+ case 11:
+ name = "Elias Pina";
+ break;
+ case 12:
+ name = "La Romana";
+ break;
+ case 14:
+ name = "Maria Trinidad Sanchez";
+ break;
+ case 15:
+ name = "Monte Cristi";
+ break;
+ case 16:
+ name = "Pedernales";
+ break;
+ case 17:
+ name = "Peravia";
+ break;
+ case 18:
+ name = "Puerto Plata";
+ break;
+ case 19:
+ name = "Salcedo";
+ break;
+ case 20:
+ name = "Samana";
+ break;
+ case 21:
+ name = "Sanchez Ramirez";
+ break;
+ case 23:
+ name = "San Juan";
+ break;
+ case 24:
+ name = "San Pedro De Macoris";
+ break;
+ case 25:
+ name = "Santiago";
+ break;
+ case 26:
+ name = "Santiago Rodriguez";
+ break;
+ case 27:
+ name = "Valverde";
+ break;
+ case 28:
+ name = "El Seibo";
+ break;
+ case 29:
+ name = "Hato Mayor";
+ break;
+ case 30:
+ name = "La Vega";
+ break;
+ case 31:
+ name = "Monsenor Nouel";
+ break;
+ case 32:
+ name = "Monte Plata";
+ break;
+ case 33:
+ name = "San Cristobal";
+ break;
+ }
+ }
+ if (strcmp(country_code,"DZ") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Alger";
+ break;
+ case 3:
+ name = "Batna";
+ break;
+ case 4:
+ name = "Constantine";
+ break;
+ case 6:
+ name = "Medea";
+ break;
+ case 7:
+ name = "Mostaganem";
+ break;
+ case 9:
+ name = "Oran";
+ break;
+ case 10:
+ name = "Saida";
+ break;
+ case 12:
+ name = "Setif";
+ break;
+ case 13:
+ name = "Tiaret";
+ break;
+ case 14:
+ name = "Tizi Ouzou";
+ break;
+ case 15:
+ name = "Tlemcen";
+ break;
+ case 18:
+ name = "Bejaia";
+ break;
+ case 19:
+ name = "Biskra";
+ break;
+ case 20:
+ name = "Blida";
+ break;
+ case 21:
+ name = "Bouira";
+ break;
+ case 22:
+ name = "Djelfa";
+ break;
+ case 23:
+ name = "Guelma";
+ break;
+ case 24:
+ name = "Jijel";
+ break;
+ case 25:
+ name = "Laghouat";
+ break;
+ case 26:
+ name = "Mascara";
+ break;
+ case 27:
+ name = "M'sila";
+ break;
+ case 29:
+ name = "Oum el Bouaghi";
+ break;
+ case 30:
+ name = "Sidi Bel Abbes";
+ break;
+ case 31:
+ name = "Skikda";
+ break;
+ case 33:
+ name = "Tebessa";
+ break;
+ case 34:
+ name = "Adrar";
+ break;
+ case 35:
+ name = "Ain Defla";
+ break;
+ case 36:
+ name = "Ain Temouchent";
+ break;
+ case 37:
+ name = "Annaba";
+ break;
+ case 38:
+ name = "Bechar";
+ break;
+ case 39:
+ name = "Bordj Bou Arreridj";
+ break;
+ case 40:
+ name = "Boumerdes";
+ break;
+ case 41:
+ name = "Chlef";
+ break;
+ case 42:
+ name = "El Bayadh";
+ break;
+ case 43:
+ name = "El Oued";
+ break;
+ case 44:
+ name = "El Tarf";
+ break;
+ case 45:
+ name = "Ghardaia";
+ break;
+ case 46:
+ name = "Illizi";
+ break;
+ case 47:
+ name = "Khenchela";
+ break;
+ case 48:
+ name = "Mila";
+ break;
+ case 49:
+ name = "Naama";
+ break;
+ case 50:
+ name = "Ouargla";
+ break;
+ case 51:
+ name = "Relizane";
+ break;
+ case 52:
+ name = "Souk Ahras";
+ break;
+ case 53:
+ name = "Tamanghasset";
+ break;
+ case 54:
+ name = "Tindouf";
+ break;
+ case 55:
+ name = "Tipaza";
+ break;
+ case 56:
+ name = "Tissemsilt";
+ break;
+ }
+ }
+ if (strcmp(country_code,"EC") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Galapagos";
+ break;
+ case 2:
+ name = "Azuay";
+ break;
+ case 3:
+ name = "Bolivar";
+ break;
+ case 4:
+ name = "Canar";
+ break;
+ case 5:
+ name = "Carchi";
+ break;
+ case 6:
+ name = "Chimborazo";
+ break;
+ case 7:
+ name = "Cotopaxi";
+ break;
+ case 8:
+ name = "El Oro";
+ break;
+ case 9:
+ name = "Esmeraldas";
+ break;
+ case 10:
+ name = "Guayas";
+ break;
+ case 11:
+ name = "Imbabura";
+ break;
+ case 12:
+ name = "Loja";
+ break;
+ case 13:
+ name = "Los Rios";
+ break;
+ case 14:
+ name = "Manabi";
+ break;
+ case 15:
+ name = "Morona-Santiago";
+ break;
+ case 17:
+ name = "Pastaza";
+ break;
+ case 18:
+ name = "Pichincha";
+ break;
+ case 19:
+ name = "Tungurahua";
+ break;
+ case 20:
+ name = "Zamora-Chinchipe";
+ break;
+ case 22:
+ name = "Sucumbios";
+ break;
+ case 23:
+ name = "Napo";
+ break;
+ case 24:
+ name = "Orellana";
+ break;
+ }
+ }
+ if (strcmp(country_code,"EE") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Harjumaa";
+ break;
+ case 2:
+ name = "Hiiumaa";
+ break;
+ case 3:
+ name = "Ida-Virumaa";
+ break;
+ case 4:
+ name = "Jarvamaa";
+ break;
+ case 5:
+ name = "Jogevamaa";
+ break;
+ case 6:
+ name = "Kohtla-Jarve";
+ break;
+ case 7:
+ name = "Laanemaa";
+ break;
+ case 8:
+ name = "Laane-Virumaa";
+ break;
+ case 9:
+ name = "Narva";
+ break;
+ case 10:
+ name = "Parnu";
+ break;
+ case 11:
+ name = "Parnumaa";
+ break;
+ case 12:
+ name = "Polvamaa";
+ break;
+ case 13:
+ name = "Raplamaa";
+ break;
+ case 14:
+ name = "Saaremaa";
+ break;
+ case 15:
+ name = "Sillamae";
+ break;
+ case 16:
+ name = "Tallinn";
+ break;
+ case 17:
+ name = "Tartu";
+ break;
+ case 18:
+ name = "Tartumaa";
+ break;
+ case 19:
+ name = "Valgamaa";
+ break;
+ case 20:
+ name = "Viljandimaa";
+ break;
+ case 21:
+ name = "Vorumaa";
+ break;
+ }
+ }
+ if (strcmp(country_code,"EG") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Ad Daqahliyah";
+ break;
+ case 2:
+ name = "Al Bahr al Ahmar";
+ break;
+ case 3:
+ name = "Al Buhayrah";
+ break;
+ case 4:
+ name = "Al Fayyum";
+ break;
+ case 5:
+ name = "Al Gharbiyah";
+ break;
+ case 6:
+ name = "Al Iskandariyah";
+ break;
+ case 7:
+ name = "Al Isma'iliyah";
+ break;
+ case 8:
+ name = "Al Jizah";
+ break;
+ case 9:
+ name = "Al Minufiyah";
+ break;
+ case 10:
+ name = "Al Minya";
+ break;
+ case 11:
+ name = "Al Qahirah";
+ break;
+ case 12:
+ name = "Al Qalyubiyah";
+ break;
+ case 13:
+ name = "Al Wadi al Jadid";
+ break;
+ case 14:
+ name = "Ash Sharqiyah";
+ break;
+ case 15:
+ name = "As Suways";
+ break;
+ case 16:
+ name = "Aswan";
+ break;
+ case 17:
+ name = "Asyut";
+ break;
+ case 18:
+ name = "Bani Suwayf";
+ break;
+ case 19:
+ name = "Bur Sa'id";
+ break;
+ case 20:
+ name = "Dumyat";
+ break;
+ case 21:
+ name = "Kafr ash Shaykh";
+ break;
+ case 22:
+ name = "Matruh";
+ break;
+ case 23:
+ name = "Qina";
+ break;
+ case 24:
+ name = "Suhaj";
+ break;
+ case 26:
+ name = "Janub Sina'";
+ break;
+ case 27:
+ name = "Shamal Sina'";
+ break;
+ }
+ }
+ if (strcmp(country_code,"ES") == 0) {
+ switch (region_code2) {
+ case 7:
+ name = "Islas Baleares";
+ break;
+ case 27:
+ name = "La Rioja";
+ break;
+ case 29:
+ name = "Madrid";
+ break;
+ case 31:
+ name = "Murcia";
+ break;
+ case 32:
+ name = "Navarra";
+ break;
+ case 34:
+ name = "Asturias";
+ break;
+ case 39:
+ name = "Cantabria";
+ break;
+ case 51:
+ name = "Andalucia";
+ break;
+ case 52:
+ name = "Aragon";
+ break;
+ case 53:
+ name = "Canarias";
+ break;
+ case 54:
+ name = "Castilla-La Mancha";
+ break;
+ case 55:
+ name = "Castilla y Leon";
+ break;
+ case 56:
+ name = "Cataluna";
+ break;
+ case 57:
+ name = "Extremadura";
+ break;
+ case 58:
+ name = "Galicia";
+ break;
+ case 59:
+ name = "Pais Vasco";
+ break;
+ case 60:
+ name = "Comunidad Valenciana";
+ break;
+ }
+ }
+ if (strcmp(country_code,"ET") == 0) {
+ switch (region_code2) {
+ case 2:
+ name = "Amhara";
+ break;
+ case 7:
+ name = "Somali";
+ break;
+ case 8:
+ name = "Gambella";
+ break;
+ case 10:
+ name = "Addis Abeba";
+ break;
+ case 11:
+ name = "Southern";
+ break;
+ case 12:
+ name = "Tigray";
+ break;
+ case 13:
+ name = "Benishangul";
+ break;
+ case 14:
+ name = "Afar";
+ break;
+ case 44:
+ name = "Adis Abeba";
+ break;
+ case 45:
+ name = "Afar";
+ break;
+ case 46:
+ name = "Amara";
+ break;
+ case 47:
+ name = "Binshangul Gumuz";
+ break;
+ case 48:
+ name = "Dire Dawa";
+ break;
+ case 49:
+ name = "Gambela Hizboch";
+ break;
+ case 50:
+ name = "Hareri Hizb";
+ break;
+ case 51:
+ name = "Oromiya";
+ break;
+ case 52:
+ name = "Sumale";
+ break;
+ case 53:
+ name = "Tigray";
+ break;
+ case 54:
+ name = "YeDebub Biheroch Bihereseboch na Hizboch";
+ break;
+ }
+ }
+ if (strcmp(country_code,"FI") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Åland";
+ break;
+ case 6:
+ name = "Lapland";
+ break;
+ case 8:
+ name = "Oulu";
+ break;
+ case 13:
+ name = "Southern Finland";
+ break;
+ case 14:
+ name = "Eastern Finland";
+ break;
+ case 15:
+ name = "Western Finland";
+ break;
+ }
+ }
+ if (strcmp(country_code,"FJ") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Central";
+ break;
+ case 2:
+ name = "Eastern";
+ break;
+ case 3:
+ name = "Northern";
+ break;
+ case 4:
+ name = "Rotuma";
+ break;
+ case 5:
+ name = "Western";
+ break;
+ }
+ }
+ if (strcmp(country_code,"FM") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Kosrae";
+ break;
+ case 2:
+ name = "Pohnpei";
+ break;
+ case 3:
+ name = "Chuuk";
+ break;
+ case 4:
+ name = "Yap";
+ break;
+ }
+ }
+ if (strcmp(country_code,"FR") == 0) {
+ switch (region_code2) {
+ case 97:
+ name = "Aquitaine";
+ break;
+ case 98:
+ name = "Auvergne";
+ break;
+ case 99:
+ name = "Basse-Normandie";
+ break;
+ case 101:
+ name = "Bourgogne";
+ break;
+ case 102:
+ name = "Bretagne";
+ break;
+ case 103:
+ name = "Centre";
+ break;
+ case 104:
+ name = "Champagne-Ardenne";
+ break;
+ case 105:
+ name = "Corse";
+ break;
+ case 106:
+ name = "Franche-Comte";
+ break;
+ case 107:
+ name = "Haute-Normandie";
+ break;
+ case 108:
+ name = "Ile-de-France";
+ break;
+ case 109:
+ name = "Languedoc-Roussillon";
+ break;
+ case 111:
+ name = "Limousin";
+ break;
+ case 112:
+ name = "Lorraine";
+ break;
+ case 113:
+ name = "Midi-Pyrenees";
+ break;
+ case 114:
+ name = "Nord-Pas-de-Calais";
+ break;
+ case 115:
+ name = "Pays de la Loire";
+ break;
+ case 116:
+ name = "Picardie";
+ break;
+ case 117:
+ name = "Poitou-Charentes";
+ break;
+ case 118:
+ name = "Provence-Alpes-Cote d'Azur";
+ break;
+ case 119:
+ name = "Rhone-Alpes";
+ break;
+ case 121:
+ name = "Alsace";
+ break;
+ }
+ }
+ if (strcmp(country_code,"GA") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Estuaire";
+ break;
+ case 2:
+ name = "Haut-Ogooue";
+ break;
+ case 3:
+ name = "Moyen-Ogooue";
+ break;
+ case 4:
+ name = "Ngounie";
+ break;
+ case 5:
+ name = "Nyanga";
+ break;
+ case 6:
+ name = "Ogooue-Ivindo";
+ break;
+ case 7:
+ name = "Ogooue-Lolo";
+ break;
+ case 8:
+ name = "Ogooue-Maritime";
+ break;
+ case 9:
+ name = "Woleu-Ntem";
+ break;
+ }
+ }
+ if (strcmp(country_code,"GB") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Avon";
+ break;
+ case 3:
+ name = "Berkshire";
+ break;
+ case 7:
+ name = "Cleveland";
+ break;
+ case 17:
+ name = "Greater London";
+ break;
+ case 18:
+ name = "Greater Manchester";
+ break;
+ case 20:
+ name = "Hereford and Worcester";
+ break;
+ case 22:
+ name = "Humberside";
+ break;
+ case 28:
+ name = "Merseyside";
+ break;
+ case 37:
+ name = "South Yorkshire";
+ break;
+ case 41:
+ name = "Tyne and Wear";
+ break;
+ case 43:
+ name = "West Midlands";
+ break;
+ case 45:
+ name = "West Yorkshire";
+ break;
+ case 79:
+ name = "Central";
+ break;
+ case 82:
+ name = "Grampian";
+ break;
+ case 84:
+ name = "Lothian";
+ break;
+ case 87:
+ name = "Strathclyde";
+ break;
+ case 88:
+ name = "Tayside";
+ break;
+ case 90:
+ name = "Clwyd";
+ break;
+ case 91:
+ name = "Dyfed";
+ break;
+ case 92:
+ name = "Gwent";
+ break;
+ case 94:
+ name = "Mid Glamorgan";
+ break;
+ case 96:
+ name = "South Glamorgan";
+ break;
+ case 97:
+ name = "West Glamorgan";
+ break;
+ case 101:
+ name = "Barking and Dagenham";
+ break;
+ case 102:
+ name = "Barnet";
+ break;
+ case 103:
+ name = "Barnsley";
+ break;
+ case 104:
+ name = "Bath and North East Somerset";
+ break;
+ case 105:
+ name = "Bedfordshire";
+ break;
+ case 106:
+ name = "Bexley";
+ break;
+ case 107:
+ name = "Birmingham";
+ break;
+ case 108:
+ name = "Blackburn with Darwen";
+ break;
+ case 109:
+ name = "Blackpool";
+ break;
+ case 111:
+ name = "Bolton";
+ break;
+ case 112:
+ name = "Bournemouth";
+ break;
+ case 113:
+ name = "Bracknell Forest";
+ break;
+ case 114:
+ name = "Bradford";
+ break;
+ case 115:
+ name = "Brent";
+ break;
+ case 116:
+ name = "Brighton and Hove";
+ break;
+ case 117:
+ name = "Bristol";
+ break;
+ case 118:
+ name = "Bromley";
+ break;
+ case 119:
+ name = "Buckinghamshire";
+ break;
+ case 121:
+ name = "Bury";
+ break;
+ case 122:
+ name = "Calderdale";
+ break;
+ case 123:
+ name = "Cambridgeshire";
+ break;
+ case 124:
+ name = "Camden";
+ break;
+ case 125:
+ name = "Cheshire";
+ break;
+ case 126:
+ name = "Cornwall";
+ break;
+ case 127:
+ name = "Coventry";
+ break;
+ case 128:
+ name = "Croydon";
+ break;
+ case 129:
+ name = "Cumbria";
+ break;
+ case 131:
+ name = "Darlington";
+ break;
+ case 132:
+ name = "Derby";
+ break;
+ case 133:
+ name = "Derbyshire";
+ break;
+ case 134:
+ name = "Devon";
+ break;
+ case 135:
+ name = "Doncaster";
+ break;
+ case 136:
+ name = "Dorset";
+ break;
+ case 137:
+ name = "Dudley";
+ break;
+ case 138:
+ name = "Durham";
+ break;
+ case 139:
+ name = "Ealing";
+ break;
+ case 141:
+ name = "East Riding of Yorkshire";
+ break;
+ case 142:
+ name = "East Sussex";
+ break;
+ case 143:
+ name = "Enfield";
+ break;
+ case 144:
+ name = "Essex";
+ break;
+ case 145:
+ name = "Gateshead";
+ break;
+ case 146:
+ name = "Gloucestershire";
+ break;
+ case 147:
+ name = "Greenwich";
+ break;
+ case 148:
+ name = "Hackney";
+ break;
+ case 149:
+ name = "Halton";
+ break;
+ case 151:
+ name = "Hammersmith and Fulham";
+ break;
+ case 152:
+ name = "Hampshire";
+ break;
+ case 153:
+ name = "Haringey";
+ break;
+ case 154:
+ name = "Harrow";
+ break;
+ case 155:
+ name = "Hartlepool";
+ break;
+ case 156:
+ name = "Havering";
+ break;
+ case 157:
+ name = "Herefordshire";
+ break;
+ case 158:
+ name = "Hertford";
+ break;
+ case 159:
+ name = "Hillingdon";
+ break;
+ case 161:
+ name = "Hounslow";
+ break;
+ case 162:
+ name = "Isle of Wight";
+ break;
+ case 163:
+ name = "Islington";
+ break;
+ case 164:
+ name = "Kensington and Chelsea";
+ break;
+ case 165:
+ name = "Kent";
+ break;
+ case 166:
+ name = "Kingston upon Hull";
+ break;
+ case 167:
+ name = "Kingston upon Thames";
+ break;
+ case 168:
+ name = "Kirklees";
+ break;
+ case 169:
+ name = "Knowsley";
+ break;
+ case 171:
+ name = "Lambeth";
+ break;
+ case 172:
+ name = "Lancashire";
+ break;
+ case 173:
+ name = "Leeds";
+ break;
+ case 174:
+ name = "Leicester";
+ break;
+ case 175:
+ name = "Leicestershire";
+ break;
+ case 176:
+ name = "Lewisham";
+ break;
+ case 177:
+ name = "Lincolnshire";
+ break;
+ case 178:
+ name = "Liverpool";
+ break;
+ case 179:
+ name = "London";
+ break;
+ case 181:
+ name = "Luton";
+ break;
+ case 182:
+ name = "Manchester";
+ break;
+ case 183:
+ name = "Medway";
+ break;
+ case 184:
+ name = "Merton";
+ break;
+ case 185:
+ name = "Middlesbrough";
+ break;
+ case 186:
+ name = "Milton Keynes";
+ break;
+ case 187:
+ name = "Newcastle upon Tyne";
+ break;
+ case 188:
+ name = "Newham";
+ break;
+ case 189:
+ name = "Norfolk";
+ break;
+ case 191:
+ name = "Northamptonshire";
+ break;
+ case 192:
+ name = "North East Lincolnshire";
+ break;
+ case 193:
+ name = "North Lincolnshire";
+ break;
+ case 194:
+ name = "North Somerset";
+ break;
+ case 195:
+ name = "North Tyneside";
+ break;
+ case 196:
+ name = "Northumberland";
+ break;
+ case 197:
+ name = "North Yorkshire";
+ break;
+ case 198:
+ name = "Nottingham";
+ break;
+ case 199:
+ name = "Nottinghamshire";
+ break;
+ case 201:
+ name = "Oldham";
+ break;
+ case 202:
+ name = "Oxfordshire";
+ break;
+ case 203:
+ name = "Peterborough";
+ break;
+ case 204:
+ name = "Plymouth";
+ break;
+ case 205:
+ name = "Poole";
+ break;
+ case 206:
+ name = "Portsmouth";
+ break;
+ case 207:
+ name = "Reading";
+ break;
+ case 208:
+ name = "Redbridge";
+ break;
+ case 209:
+ name = "Redcar and Cleveland";
+ break;
+ case 211:
+ name = "Richmond upon Thames";
+ break;
+ case 212:
+ name = "Rochdale";
+ break;
+ case 213:
+ name = "Rotherham";
+ break;
+ case 214:
+ name = "Rutland";
+ break;
+ case 215:
+ name = "Salford";
+ break;
+ case 216:
+ name = "Shropshire";
+ break;
+ case 217:
+ name = "Sandwell";
+ break;
+ case 218:
+ name = "Sefton";
+ break;
+ case 219:
+ name = "Sheffield";
+ break;
+ case 221:
+ name = "Slough";
+ break;
+ case 222:
+ name = "Solihull";
+ break;
+ case 223:
+ name = "Somerset";
+ break;
+ case 224:
+ name = "Southampton";
+ break;
+ case 225:
+ name = "Southend-on-Sea";
+ break;
+ case 226:
+ name = "South Gloucestershire";
+ break;
+ case 227:
+ name = "South Tyneside";
+ break;
+ case 228:
+ name = "Southwark";
+ break;
+ case 229:
+ name = "Staffordshire";
+ break;
+ case 231:
+ name = "St. Helens";
+ break;
+ case 232:
+ name = "Stockport";
+ break;
+ case 233:
+ name = "Stockton-on-Tees";
+ break;
+ case 234:
+ name = "Stoke-on-Trent";
+ break;
+ case 235:
+ name = "Suffolk";
+ break;
+ case 236:
+ name = "Sunderland";
+ break;
+ case 237:
+ name = "Surrey";
+ break;
+ case 238:
+ name = "Sutton";
+ break;
+ case 239:
+ name = "Swindon";
+ break;
+ case 241:
+ name = "Tameside";
+ break;
+ case 242:
+ name = "Telford and Wrekin";
+ break;
+ case 243:
+ name = "Thurrock";
+ break;
+ case 244:
+ name = "Torbay";
+ break;
+ case 245:
+ name = "Tower Hamlets";
+ break;
+ case 246:
+ name = "Trafford";
+ break;
+ case 247:
+ name = "Wakefield";
+ break;
+ case 248:
+ name = "Walsall";
+ break;
+ case 249:
+ name = "Waltham Forest";
+ break;
+ case 251:
+ name = "Wandsworth";
+ break;
+ case 252:
+ name = "Warrington";
+ break;
+ case 253:
+ name = "Warwickshire";
+ break;
+ case 254:
+ name = "West Berkshire";
+ break;
+ case 255:
+ name = "Westminster";
+ break;
+ case 256:
+ name = "West Sussex";
+ break;
+ case 257:
+ name = "Wigan";
+ break;
+ case 258:
+ name = "Wiltshire";
+ break;
+ case 259:
+ name = "Windsor and Maidenhead";
+ break;
+ case 261:
+ name = "Wirral";
+ break;
+ case 262:
+ name = "Wokingham";
+ break;
+ case 263:
+ name = "Wolverhampton";
+ break;
+ case 264:
+ name = "Worcestershire";
+ break;
+ case 265:
+ name = "York";
+ break;
+ case 266:
+ name = "Antrim";
+ break;
+ case 267:
+ name = "Ards";
+ break;
+ case 268:
+ name = "Armagh";
+ break;
+ case 269:
+ name = "Ballymena";
+ break;
+ case 271:
+ name = "Ballymoney";
+ break;
+ case 272:
+ name = "Banbridge";
+ break;
+ case 273:
+ name = "Belfast";
+ break;
+ case 274:
+ name = "Carrickfergus";
+ break;
+ case 275:
+ name = "Castlereagh";
+ break;
+ case 276:
+ name = "Coleraine";
+ break;
+ case 277:
+ name = "Cookstown";
+ break;
+ case 278:
+ name = "Craigavon";
+ break;
+ case 279:
+ name = "Down";
+ break;
+ case 281:
+ name = "Dungannon";
+ break;
+ case 282:
+ name = "Fermanagh";
+ break;
+ case 283:
+ name = "Larne";
+ break;
+ case 284:
+ name = "Limavady";
+ break;
+ case 285:
+ name = "Lisburn";
+ break;
+ case 286:
+ name = "Derry";
+ break;
+ case 287:
+ name = "Magherafelt";
+ break;
+ case 288:
+ name = "Moyle";
+ break;
+ case 289:
+ name = "Newry and Mourne";
+ break;
+ case 291:
+ name = "Newtownabbey";
+ break;
+ case 292:
+ name = "North Down";
+ break;
+ case 293:
+ name = "Omagh";
+ break;
+ case 294:
+ name = "Strabane";
+ break;
+ case 295:
+ name = "Aberdeen City";
+ break;
+ case 296:
+ name = "Aberdeenshire";
+ break;
+ case 297:
+ name = "Angus";
+ break;
+ case 298:
+ name = "Argyll and Bute";
+ break;
+ case 299:
+ name = "Scottish Borders";
+ break;
+ case 301:
+ name = "Clackmannanshire";
+ break;
+ case 302:
+ name = "Dumfries and Galloway";
+ break;
+ case 303:
+ name = "Dundee City";
+ break;
+ case 304:
+ name = "East Ayrshire";
+ break;
+ case 305:
+ name = "East Dunbartonshire";
+ break;
+ case 306:
+ name = "East Lothian";
+ break;
+ case 307:
+ name = "East Renfrewshire";
+ break;
+ case 308:
+ name = "Edinburgh";
+ break;
+ case 309:
+ name = "Falkirk";
+ break;
+ case 311:
+ name = "Fife";
+ break;
+ case 312:
+ name = "Glasgow City";
+ break;
+ case 313:
+ name = "Highland";
+ break;
+ case 314:
+ name = "Inverclyde";
+ break;
+ case 315:
+ name = "Midlothian";
+ break;
+ case 316:
+ name = "Moray";
+ break;
+ case 317:
+ name = "North Ayrshire";
+ break;
+ case 318:
+ name = "North Lanarkshire";
+ break;
+ case 319:
+ name = "Orkney";
+ break;
+ case 321:
+ name = "Perth and Kinross";
+ break;
+ case 322:
+ name = "Renfrewshire";
+ break;
+ case 323:
+ name = "Shetland Islands";
+ break;
+ case 324:
+ name = "South Ayrshire";
+ break;
+ case 325:
+ name = "South Lanarkshire";
+ break;
+ case 326:
+ name = "Stirling";
+ break;
+ case 327:
+ name = "West Dunbartonshire";
+ break;
+ case 328:
+ name = "Eilean Siar";
+ break;
+ case 329:
+ name = "West Lothian";
+ break;
+ case 331:
+ name = "Isle of Anglesey";
+ break;
+ case 332:
+ name = "Blaenau Gwent";
+ break;
+ case 333:
+ name = "Bridgend";
+ break;
+ case 334:
+ name = "Caerphilly";
+ break;
+ case 335:
+ name = "Cardiff";
+ break;
+ case 336:
+ name = "Ceredigion";
+ break;
+ case 337:
+ name = "Carmarthenshire";
+ break;
+ case 338:
+ name = "Conwy";
+ break;
+ case 339:
+ name = "Denbighshire";
+ break;
+ case 341:
+ name = "Flintshire";
+ break;
+ case 342:
+ name = "Gwynedd";
+ break;
+ case 343:
+ name = "Merthyr Tydfil";
+ break;
+ case 344:
+ name = "Monmouthshire";
+ break;
+ case 345:
+ name = "Neath Port Talbot";
+ break;
+ case 346:
+ name = "Newport";
+ break;
+ case 347:
+ name = "Pembrokeshire";
+ break;
+ case 348:
+ name = "Powys";
+ break;
+ case 349:
+ name = "Rhondda Cynon Taff";
+ break;
+ case 351:
+ name = "Swansea";
+ break;
+ case 352:
+ name = "Torfaen";
+ break;
+ case 353:
+ name = "Vale of Glamorgan";
+ break;
+ case 354:
+ name = "Wrexham";
+ break;
+ }
+ }
+ if (strcmp(country_code,"GD") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Saint Andrew";
+ break;
+ case 2:
+ name = "Saint David";
+ break;
+ case 3:
+ name = "Saint George";
+ break;
+ case 4:
+ name = "Saint John";
+ break;
+ case 5:
+ name = "Saint Mark";
+ break;
+ case 6:
+ name = "Saint Patrick";
+ break;
+ }
+ }
+ if (strcmp(country_code,"GE") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Abashis Raioni";
+ break;
+ case 2:
+ name = "Abkhazia";
+ break;
+ case 3:
+ name = "Adigenis Raioni";
+ break;
+ case 4:
+ name = "Ajaria";
+ break;
+ case 5:
+ name = "Akhalgoris Raioni";
+ break;
+ case 6:
+ name = "Akhalk'alak'is Raioni";
+ break;
+ case 7:
+ name = "Akhalts'ikhis Raioni";
+ break;
+ case 8:
+ name = "Akhmetis Raioni";
+ break;
+ case 9:
+ name = "Ambrolauris Raioni";
+ break;
+ case 10:
+ name = "Aspindzis Raioni";
+ break;
+ case 11:
+ name = "Baghdat'is Raioni";
+ break;
+ case 12:
+ name = "Bolnisis Raioni";
+ break;
+ case 13:
+ name = "Borjomis Raioni";
+ break;
+ case 14:
+ name = "Chiat'ura";
+ break;
+ case 15:
+ name = "Ch'khorotsqus Raioni";
+ break;
+ case 16:
+ name = "Ch'okhatauris Raioni";
+ break;
+ case 17:
+ name = "Dedop'listsqaros Raioni";
+ break;
+ case 18:
+ name = "Dmanisis Raioni";
+ break;
+ case 19:
+ name = "Dushet'is Raioni";
+ break;
+ case 20:
+ name = "Gardabanis Raioni";
+ break;
+ case 21:
+ name = "Gori";
+ break;
+ case 22:
+ name = "Goris Raioni";
+ break;
+ case 23:
+ name = "Gurjaanis Raioni";
+ break;
+ case 24:
+ name = "Javis Raioni";
+ break;
+ case 25:
+ name = "K'arelis Raioni";
+ break;
+ case 26:
+ name = "Kaspis Raioni";
+ break;
+ case 27:
+ name = "Kharagaulis Raioni";
+ break;
+ case 28:
+ name = "Khashuris Raioni";
+ break;
+ case 29:
+ name = "Khobis Raioni";
+ break;
+ case 30:
+ name = "Khonis Raioni";
+ break;
+ case 31:
+ name = "K'ut'aisi";
+ break;
+ case 32:
+ name = "Lagodekhis Raioni";
+ break;
+ case 33:
+ name = "Lanch'khut'is Raioni";
+ break;
+ case 34:
+ name = "Lentekhis Raioni";
+ break;
+ case 35:
+ name = "Marneulis Raioni";
+ break;
+ case 36:
+ name = "Martvilis Raioni";
+ break;
+ case 37:
+ name = "Mestiis Raioni";
+ break;
+ case 38:
+ name = "Mts'khet'is Raioni";
+ break;
+ case 39:
+ name = "Ninotsmindis Raioni";
+ break;
+ case 40:
+ name = "Onis Raioni";
+ break;
+ case 41:
+ name = "Ozurget'is Raioni";
+ break;
+ case 42:
+ name = "P'ot'i";
+ break;
+ case 43:
+ name = "Qazbegis Raioni";
+ break;
+ case 44:
+ name = "Qvarlis Raioni";
+ break;
+ case 45:
+ name = "Rust'avi";
+ break;
+ case 46:
+ name = "Sach'kheris Raioni";
+ break;
+ case 47:
+ name = "Sagarejos Raioni";
+ break;
+ case 48:
+ name = "Samtrediis Raioni";
+ break;
+ case 49:
+ name = "Senakis Raioni";
+ break;
+ case 50:
+ name = "Sighnaghis Raioni";
+ break;
+ case 51:
+ name = "T'bilisi";
+ break;
+ case 52:
+ name = "T'elavis Raioni";
+ break;
+ case 53:
+ name = "T'erjolis Raioni";
+ break;
+ case 54:
+ name = "T'et'ritsqaros Raioni";
+ break;
+ case 55:
+ name = "T'ianet'is Raioni";
+ break;
+ case 56:
+ name = "Tqibuli";
+ break;
+ case 57:
+ name = "Ts'ageris Raioni";
+ break;
+ case 58:
+ name = "Tsalenjikhis Raioni";
+ break;
+ case 59:
+ name = "Tsalkis Raioni";
+ break;
+ case 60:
+ name = "Tsqaltubo";
+ break;
+ case 61:
+ name = "Vanis Raioni";
+ break;
+ case 62:
+ name = "Zestap'onis Raioni";
+ break;
+ case 63:
+ name = "Zugdidi";
+ break;
+ case 64:
+ name = "Zugdidis Raioni";
+ break;
+ }
+ }
+ if (strcmp(country_code,"GH") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Greater Accra";
+ break;
+ case 2:
+ name = "Ashanti";
+ break;
+ case 3:
+ name = "Brong-Ahafo";
+ break;
+ case 4:
+ name = "Central";
+ break;
+ case 5:
+ name = "Eastern";
+ break;
+ case 6:
+ name = "Northern";
+ break;
+ case 8:
+ name = "Volta";
+ break;
+ case 9:
+ name = "Western";
+ break;
+ case 10:
+ name = "Upper East";
+ break;
+ case 11:
+ name = "Upper West";
+ break;
+ }
+ }
+ if (strcmp(country_code,"GL") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Nordgronland";
+ break;
+ case 2:
+ name = "Ostgronland";
+ break;
+ case 3:
+ name = "Vestgronland";
+ break;
+ }
+ }
+ if (strcmp(country_code,"GM") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Banjul";
+ break;
+ case 2:
+ name = "Lower River";
+ break;
+ case 3:
+ name = "MacCarthy Island";
+ break;
+ case 4:
+ name = "Upper River";
+ break;
+ case 5:
+ name = "Western";
+ break;
+ case 7:
+ name = "North Bank";
+ break;
+ }
+ }
+ if (strcmp(country_code,"GN") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Beyla";
+ break;
+ case 2:
+ name = "Boffa";
+ break;
+ case 3:
+ name = "Boke";
+ break;
+ case 4:
+ name = "Conakry";
+ break;
+ case 5:
+ name = "Dabola";
+ break;
+ case 6:
+ name = "Dalaba";
+ break;
+ case 7:
+ name = "Dinguiraye";
+ break;
+ case 9:
+ name = "Faranah";
+ break;
+ case 10:
+ name = "Forecariah";
+ break;
+ case 11:
+ name = "Fria";
+ break;
+ case 12:
+ name = "Gaoual";
+ break;
+ case 13:
+ name = "Gueckedou";
+ break;
+ case 15:
+ name = "Kerouane";
+ break;
+ case 16:
+ name = "Kindia";
+ break;
+ case 17:
+ name = "Kissidougou";
+ break;
+ case 18:
+ name = "Koundara";
+ break;
+ case 19:
+ name = "Kouroussa";
+ break;
+ case 21:
+ name = "Macenta";
+ break;
+ case 22:
+ name = "Mali";
+ break;
+ case 23:
+ name = "Mamou";
+ break;
+ case 25:
+ name = "Pita";
+ break;
+ case 27:
+ name = "Telimele";
+ break;
+ case 28:
+ name = "Tougue";
+ break;
+ case 29:
+ name = "Yomou";
+ break;
+ case 30:
+ name = "Coyah";
+ break;
+ case 31:
+ name = "Dubreka";
+ break;
+ case 32:
+ name = "Kankan";
+ break;
+ case 33:
+ name = "Koubia";
+ break;
+ case 34:
+ name = "Labe";
+ break;
+ case 35:
+ name = "Lelouma";
+ break;
+ case 36:
+ name = "Lola";
+ break;
+ case 37:
+ name = "Mandiana";
+ break;
+ case 38:
+ name = "Nzerekore";
+ break;
+ case 39:
+ name = "Siguiri";
+ break;
+ }
+ }
+ if (strcmp(country_code,"GQ") == 0) {
+ switch (region_code2) {
+ case 3:
+ name = "Annobon";
+ break;
+ case 4:
+ name = "Bioko Norte";
+ break;
+ case 5:
+ name = "Bioko Sur";
+ break;
+ case 6:
+ name = "Centro Sur";
+ break;
+ case 7:
+ name = "Kie-Ntem";
+ break;
+ case 8:
+ name = "Litoral";
+ break;
+ case 9:
+ name = "Wele-Nzas";
+ break;
+ }
+ }
+ if (strcmp(country_code,"GR") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Evros";
+ break;
+ case 2:
+ name = "Rodhopi";
+ break;
+ case 3:
+ name = "Xanthi";
+ break;
+ case 4:
+ name = "Drama";
+ break;
+ case 5:
+ name = "Serrai";
+ break;
+ case 6:
+ name = "Kilkis";
+ break;
+ case 7:
+ name = "Pella";
+ break;
+ case 8:
+ name = "Florina";
+ break;
+ case 9:
+ name = "Kastoria";
+ break;
+ case 10:
+ name = "Grevena";
+ break;
+ case 11:
+ name = "Kozani";
+ break;
+ case 12:
+ name = "Imathia";
+ break;
+ case 13:
+ name = "Thessaloniki";
+ break;
+ case 14:
+ name = "Kavala";
+ break;
+ case 15:
+ name = "Khalkidhiki";
+ break;
+ case 16:
+ name = "Pieria";
+ break;
+ case 17:
+ name = "Ioannina";
+ break;
+ case 18:
+ name = "Thesprotia";
+ break;
+ case 19:
+ name = "Preveza";
+ break;
+ case 20:
+ name = "Arta";
+ break;
+ case 21:
+ name = "Larisa";
+ break;
+ case 22:
+ name = "Trikala";
+ break;
+ case 23:
+ name = "Kardhitsa";
+ break;
+ case 24:
+ name = "Magnisia";
+ break;
+ case 25:
+ name = "Kerkira";
+ break;
+ case 26:
+ name = "Levkas";
+ break;
+ case 27:
+ name = "Kefallinia";
+ break;
+ case 28:
+ name = "Zakinthos";
+ break;
+ case 29:
+ name = "Fthiotis";
+ break;
+ case 30:
+ name = "Evritania";
+ break;
+ case 31:
+ name = "Aitolia kai Akarnania";
+ break;
+ case 32:
+ name = "Fokis";
+ break;
+ case 33:
+ name = "Voiotia";
+ break;
+ case 34:
+ name = "Evvoia";
+ break;
+ case 35:
+ name = "Attiki";
+ break;
+ case 36:
+ name = "Argolis";
+ break;
+ case 37:
+ name = "Korinthia";
+ break;
+ case 38:
+ name = "Akhaia";
+ break;
+ case 39:
+ name = "Ilia";
+ break;
+ case 40:
+ name = "Messinia";
+ break;
+ case 41:
+ name = "Arkadhia";
+ break;
+ case 42:
+ name = "Lakonia";
+ break;
+ case 43:
+ name = "Khania";
+ break;
+ case 44:
+ name = "Rethimni";
+ break;
+ case 45:
+ name = "Iraklion";
+ break;
+ case 46:
+ name = "Lasithi";
+ break;
+ case 47:
+ name = "Dhodhekanisos";
+ break;
+ case 48:
+ name = "Samos";
+ break;
+ case 49:
+ name = "Kikladhes";
+ break;
+ case 50:
+ name = "Khios";
+ break;
+ case 51:
+ name = "Lesvos";
+ break;
+ }
+ }
+ if (strcmp(country_code,"GT") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Alta Verapaz";
+ break;
+ case 2:
+ name = "Baja Verapaz";
+ break;
+ case 3:
+ name = "Chimaltenango";
+ break;
+ case 4:
+ name = "Chiquimula";
+ break;
+ case 5:
+ name = "El Progreso";
+ break;
+ case 6:
+ name = "Escuintla";
+ break;
+ case 7:
+ name = "Guatemala";
+ break;
+ case 8:
+ name = "Huehuetenango";
+ break;
+ case 9:
+ name = "Izabal";
+ break;
+ case 10:
+ name = "Jalapa";
+ break;
+ case 11:
+ name = "Jutiapa";
+ break;
+ case 12:
+ name = "Peten";
+ break;
+ case 13:
+ name = "Quetzaltenango";
+ break;
+ case 14:
+ name = "Quiche";
+ break;
+ case 15:
+ name = "Retalhuleu";
+ break;
+ case 16:
+ name = "Sacatepequez";
+ break;
+ case 17:
+ name = "San Marcos";
+ break;
+ case 18:
+ name = "Santa Rosa";
+ break;
+ case 19:
+ name = "Solola";
+ break;
+ case 20:
+ name = "Suchitepequez";
+ break;
+ case 21:
+ name = "Totonicapan";
+ break;
+ case 22:
+ name = "Zacapa";
+ break;
+ }
+ }
+ if (strcmp(country_code,"GW") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Bafata";
+ break;
+ case 2:
+ name = "Quinara";
+ break;
+ case 4:
+ name = "Oio";
+ break;
+ case 5:
+ name = "Bolama";
+ break;
+ case 6:
+ name = "Cacheu";
+ break;
+ case 7:
+ name = "Tombali";
+ break;
+ case 10:
+ name = "Gabu";
+ break;
+ case 11:
+ name = "Bissau";
+ break;
+ case 12:
+ name = "Biombo";
+ break;
+ }
+ }
+ if (strcmp(country_code,"GY") == 0) {
+ switch (region_code2) {
+ case 10:
+ name = "Barima-Waini";
+ break;
+ case 11:
+ name = "Cuyuni-Mazaruni";
+ break;
+ case 12:
+ name = "Demerara-Mahaica";
+ break;
+ case 13:
+ name = "East Berbice-Corentyne";
+ break;
+ case 14:
+ name = "Essequibo Islands-West Demerara";
+ break;
+ case 15:
+ name = "Mahaica-Berbice";
+ break;
+ case 16:
+ name = "Pomeroon-Supenaam";
+ break;
+ case 17:
+ name = "Potaro-Siparuni";
+ break;
+ case 18:
+ name = "Upper Demerara-Berbice";
+ break;
+ case 19:
+ name = "Upper Takutu-Upper Essequibo";
+ break;
+ }
+ }
+ if (strcmp(country_code,"HN") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Atlantida";
+ break;
+ case 2:
+ name = "Choluteca";
+ break;
+ case 3:
+ name = "Colon";
+ break;
+ case 4:
+ name = "Comayagua";
+ break;
+ case 5:
+ name = "Copan";
+ break;
+ case 6:
+ name = "Cortes";
+ break;
+ case 7:
+ name = "El Paraiso";
+ break;
+ case 8:
+ name = "Francisco Morazan";
+ break;
+ case 9:
+ name = "Gracias a Dios";
+ break;
+ case 10:
+ name = "Intibuca";
+ break;
+ case 11:
+ name = "Islas de la Bahia";
+ break;
+ case 12:
+ name = "La Paz";
+ break;
+ case 13:
+ name = "Lempira";
+ break;
+ case 14:
+ name = "Ocotepeque";
+ break;
+ case 15:
+ name = "Olancho";
+ break;
+ case 16:
+ name = "Santa Barbara";
+ break;
+ case 17:
+ name = "Valle";
+ break;
+ case 18:
+ name = "Yoro";
+ break;
+ }
+ }
+ if (strcmp(country_code,"HR") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Bjelovarsko-Bilogorska";
+ break;
+ case 2:
+ name = "Brodsko-Posavska";
+ break;
+ case 3:
+ name = "Dubrovacko-Neretvanska";
+ break;
+ case 4:
+ name = "Istarska";
+ break;
+ case 5:
+ name = "Karlovacka";
+ break;
+ case 6:
+ name = "Koprivnicko-Krizevacka";
+ break;
+ case 7:
+ name = "Krapinsko-Zagorska";
+ break;
+ case 8:
+ name = "Licko-Senjska";
+ break;
+ case 9:
+ name = "Medimurska";
+ break;
+ case 10:
+ name = "Osjecko-Baranjska";
+ break;
+ case 11:
+ name = "Pozesko-Slavonska";
+ break;
+ case 12:
+ name = "Primorsko-Goranska";
+ break;
+ case 13:
+ name = "Sibensko-Kninska";
+ break;
+ case 14:
+ name = "Sisacko-Moslavacka";
+ break;
+ case 15:
+ name = "Splitsko-Dalmatinska";
+ break;
+ case 16:
+ name = "Varazdinska";
+ break;
+ case 17:
+ name = "Viroviticko-Podravska";
+ break;
+ case 18:
+ name = "Vukovarsko-Srijemska";
+ break;
+ case 19:
+ name = "Zadarska";
+ break;
+ case 20:
+ name = "Zagrebacka";
+ break;
+ case 21:
+ name = "Grad Zagreb";
+ break;
+ }
+ }
+ if (strcmp(country_code,"HT") == 0) {
+ switch (region_code2) {
+ case 3:
+ name = "Nord-Ouest";
+ break;
+ case 6:
+ name = "Artibonite";
+ break;
+ case 7:
+ name = "Centre";
+ break;
+ case 8:
+ name = "Grand' Anse";
+ break;
+ case 9:
+ name = "Nord";
+ break;
+ case 10:
+ name = "Nord-Est";
+ break;
+ case 11:
+ name = "Ouest";
+ break;
+ case 12:
+ name = "Sud";
+ break;
+ case 13:
+ name = "Sud-Est";
+ break;
+ }
+ }
+ if (strcmp(country_code,"HU") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Bacs-Kiskun";
+ break;
+ case 2:
+ name = "Baranya";
+ break;
+ case 3:
+ name = "Bekes";
+ break;
+ case 4:
+ name = "Borsod-Abauj-Zemplen";
+ break;
+ case 5:
+ name = "Budapest";
+ break;
+ case 6:
+ name = "Csongrad";
+ break;
+ case 7:
+ name = "Debrecen";
+ break;
+ case 8:
+ name = "Fejer";
+ break;
+ case 9:
+ name = "Gyor-Moson-Sopron";
+ break;
+ case 10:
+ name = "Hajdu-Bihar";
+ break;
+ case 11:
+ name = "Heves";
+ break;
+ case 12:
+ name = "Komarom-Esztergom";
+ break;
+ case 13:
+ name = "Miskolc";
+ break;
+ case 14:
+ name = "Nograd";
+ break;
+ case 15:
+ name = "Pecs";
+ break;
+ case 16:
+ name = "Pest";
+ break;
+ case 17:
+ name = "Somogy";
+ break;
+ case 18:
+ name = "Szabolcs-Szatmar-Bereg";
+ break;
+ case 19:
+ name = "Szeged";
+ break;
+ case 20:
+ name = "Jasz-Nagykun-Szolnok";
+ break;
+ case 21:
+ name = "Tolna";
+ break;
+ case 22:
+ name = "Vas";
+ break;
+ case 23:
+ name = "Veszprem";
+ break;
+ case 24:
+ name = "Zala";
+ break;
+ case 25:
+ name = "Gyor";
+ break;
+ case 26:
+ name = "Bekescsaba";
+ break;
+ case 27:
+ name = "Dunaujvaros";
+ break;
+ case 28:
+ name = "Eger";
+ break;
+ case 29:
+ name = "Hodmezovasarhely";
+ break;
+ case 30:
+ name = "Kaposvar";
+ break;
+ case 31:
+ name = "Kecskemet";
+ break;
+ case 32:
+ name = "Nagykanizsa";
+ break;
+ case 33:
+ name = "Nyiregyhaza";
+ break;
+ case 34:
+ name = "Sopron";
+ break;
+ case 35:
+ name = "Szekesfehervar";
+ break;
+ case 36:
+ name = "Szolnok";
+ break;
+ case 37:
+ name = "Szombathely";
+ break;
+ case 38:
+ name = "Tatabanya";
+ break;
+ case 39:
+ name = "Veszprem";
+ break;
+ case 40:
+ name = "Zalaegerszeg";
+ break;
+ }
+ }
+ if (strcmp(country_code,"ID") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Aceh";
+ break;
+ case 2:
+ name = "Bali";
+ break;
+ case 3:
+ name = "Bengkulu";
+ break;
+ case 4:
+ name = "Jakarta Raya";
+ break;
+ case 5:
+ name = "Jambi";
+ break;
+ case 7:
+ name = "Jawa Tengah";
+ break;
+ case 8:
+ name = "Jawa Timur";
+ break;
+ case 9:
+ name = "Papua";
+ break;
+ case 10:
+ name = "Yogyakarta";
+ break;
+ case 11:
+ name = "Kalimantan Barat";
+ break;
+ case 12:
+ name = "Kalimantan Selatan";
+ break;
+ case 13:
+ name = "Kalimantan Tengah";
+ break;
+ case 14:
+ name = "Kalimantan Timur";
+ break;
+ case 15:
+ name = "Lampung";
+ break;
+ case 17:
+ name = "Nusa Tenggara Barat";
+ break;
+ case 18:
+ name = "Nusa Tenggara Timur";
+ break;
+ case 19:
+ name = "Riau";
+ break;
+ case 20:
+ name = "Sulawesi Selatan";
+ break;
+ case 21:
+ name = "Sulawesi Tengah";
+ break;
+ case 22:
+ name = "Sulawesi Tenggara";
+ break;
+ case 24:
+ name = "Sumatera Barat";
+ break;
+ case 26:
+ name = "Sumatera Utara";
+ break;
+ case 28:
+ name = "Maluku";
+ break;
+ case 29:
+ name = "Maluku Utara";
+ break;
+ case 30:
+ name = "Jawa Barat";
+ break;
+ case 31:
+ name = "Sulawesi Utara";
+ break;
+ case 32:
+ name = "Sumatera Selatan";
+ break;
+ case 33:
+ name = "Banten";
+ break;
+ case 34:
+ name = "Gorontalo";
+ break;
+ case 35:
+ name = "Kepulauan Bangka Belitung";
+ break;
+ }
+ }
+ if (strcmp(country_code,"IE") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Carlow";
+ break;
+ case 2:
+ name = "Cavan";
+ break;
+ case 3:
+ name = "Clare";
+ break;
+ case 4:
+ name = "Cork";
+ break;
+ case 6:
+ name = "Donegal";
+ break;
+ case 7:
+ name = "Dublin";
+ break;
+ case 10:
+ name = "Galway";
+ break;
+ case 11:
+ name = "Kerry";
+ break;
+ case 12:
+ name = "Kildare";
+ break;
+ case 13:
+ name = "Kilkenny";
+ break;
+ case 14:
+ name = "Leitrim";
+ break;
+ case 15:
+ name = "Laois";
+ break;
+ case 16:
+ name = "Limerick";
+ break;
+ case 18:
+ name = "Longford";
+ break;
+ case 19:
+ name = "Louth";
+ break;
+ case 20:
+ name = "Mayo";
+ break;
+ case 21:
+ name = "Meath";
+ break;
+ case 22:
+ name = "Monaghan";
+ break;
+ case 23:
+ name = "Offaly";
+ break;
+ case 24:
+ name = "Roscommon";
+ break;
+ case 25:
+ name = "Sligo";
+ break;
+ case 26:
+ name = "Tipperary";
+ break;
+ case 27:
+ name = "Waterford";
+ break;
+ case 29:
+ name = "Westmeath";
+ break;
+ case 30:
+ name = "Wexford";
+ break;
+ case 31:
+ name = "Wicklow";
+ break;
+ }
+ }
+ if (strcmp(country_code,"IL") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "HaDarom";
+ break;
+ case 2:
+ name = "HaMerkaz";
+ break;
+ case 3:
+ name = "HaZafon";
+ break;
+ case 4:
+ name = "Hefa";
+ break;
+ case 5:
+ name = "Tel Aviv";
+ break;
+ case 6:
+ name = "Yerushalayim";
+ break;
+ }
+ }
+ if (strcmp(country_code,"IN") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Andaman and Nicobar Islands";
+ break;
+ case 2:
+ name = "Andhra Pradesh";
+ break;
+ case 3:
+ name = "Assam";
+ break;
+ case 5:
+ name = "Chandigarh";
+ break;
+ case 6:
+ name = "Dadra and Nagar Haveli";
+ break;
+ case 7:
+ name = "Delhi";
+ break;
+ case 9:
+ name = "Gujarat";
+ break;
+ case 10:
+ name = "Haryana";
+ break;
+ case 11:
+ name = "Himachal Pradesh";
+ break;
+ case 12:
+ name = "Jammu and Kashmir";
+ break;
+ case 13:
+ name = "Kerala";
+ break;
+ case 14:
+ name = "Lakshadweep";
+ break;
+ case 16:
+ name = "Maharashtra";
+ break;
+ case 17:
+ name = "Manipur";
+ break;
+ case 18:
+ name = "Meghalaya";
+ break;
+ case 19:
+ name = "Karnataka";
+ break;
+ case 20:
+ name = "Nagaland";
+ break;
+ case 21:
+ name = "Orissa";
+ break;
+ case 22:
+ name = "Pondicherry";
+ break;
+ case 23:
+ name = "Punjab";
+ break;
+ case 24:
+ name = "Rajasthan";
+ break;
+ case 25:
+ name = "Tamil Nadu";
+ break;
+ case 26:
+ name = "Tripura";
+ break;
+ case 28:
+ name = "West Bengal";
+ break;
+ case 29:
+ name = "Sikkim";
+ break;
+ case 30:
+ name = "Arunachal Pradesh";
+ break;
+ case 31:
+ name = "Mizoram";
+ break;
+ case 32:
+ name = "Daman and Diu";
+ break;
+ case 33:
+ name = "Goa";
+ break;
+ case 34:
+ name = "Bihar";
+ break;
+ case 35:
+ name = "Madhya Pradesh";
+ break;
+ case 36:
+ name = "Uttar Pradesh";
+ break;
+ case 37:
+ name = "Chhattisgarh";
+ break;
+ case 38:
+ name = "Jharkhand";
+ break;
+ case 39:
+ name = "Uttaranchal";
+ break;
+ }
+ }
+ if (strcmp(country_code,"IQ") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Al Anbar";
+ break;
+ case 2:
+ name = "Al Basrah";
+ break;
+ case 3:
+ name = "Al Muthanna";
+ break;
+ case 4:
+ name = "Al Qadisiyah";
+ break;
+ case 5:
+ name = "As Sulaymaniyah";
+ break;
+ case 6:
+ name = "Babil";
+ break;
+ case 7:
+ name = "Baghdad";
+ break;
+ case 8:
+ name = "Dahuk";
+ break;
+ case 9:
+ name = "Dhi Qar";
+ break;
+ case 10:
+ name = "Diyala";
+ break;
+ case 11:
+ name = "Arbil";
+ break;
+ case 12:
+ name = "Karbala'";
+ break;
+ case 13:
+ name = "At Ta'mim";
+ break;
+ case 14:
+ name = "Maysan";
+ break;
+ case 15:
+ name = "Ninawa";
+ break;
+ case 16:
+ name = "Wasit";
+ break;
+ case 17:
+ name = "An Najaf";
+ break;
+ case 18:
+ name = "Salah ad Din";
+ break;
+ }
+ }
+ if (strcmp(country_code,"IR") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Azarbayjan-e Bakhtari";
+ break;
+ case 2:
+ name = "Azarbayjan-e Khavari";
+ break;
+ case 3:
+ name = "Chahar Mahall va Bakhtiari";
+ break;
+ case 4:
+ name = "Sistan va Baluchestan";
+ break;
+ case 5:
+ name = "Kohkiluyeh va Buyer Ahmadi";
+ break;
+ case 7:
+ name = "Fars";
+ break;
+ case 8:
+ name = "Gilan";
+ break;
+ case 9:
+ name = "Hamadan";
+ break;
+ case 10:
+ name = "Ilam";
+ break;
+ case 11:
+ name = "Hormozgan";
+ break;
+ case 13:
+ name = "Bakhtaran";
+ break;
+ case 15:
+ name = "Khuzestan";
+ break;
+ case 16:
+ name = "Kordestan";
+ break;
+ case 22:
+ name = "Bushehr";
+ break;
+ case 23:
+ name = "Lorestan";
+ break;
+ case 25:
+ name = "Semnan";
+ break;
+ case 26:
+ name = "Tehran";
+ break;
+ case 28:
+ name = "Esfahan";
+ break;
+ case 29:
+ name = "Kerman";
+ break;
+ case 30:
+ name = "Khorasan";
+ break;
+ case 31:
+ name = "Yazd";
+ break;
+ case 32:
+ name = "Ardabil";
+ break;
+ case 34:
+ name = "Markazi";
+ break;
+ case 35:
+ name = "Mazandaran";
+ break;
+ case 36:
+ name = "Zanjan";
+ break;
+ case 37:
+ name = "Golestan";
+ break;
+ case 38:
+ name = "Qazvin";
+ break;
+ case 39:
+ name = "Qom";
+ break;
+ }
+ }
+ if (strcmp(country_code,"IS") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Akranes";
+ break;
+ case 2:
+ name = "Akureyri";
+ break;
+ case 3:
+ name = "Arnessysla";
+ break;
+ case 4:
+ name = "Austur-Bardastrandarsysla";
+ break;
+ case 5:
+ name = "Austur-Hunavatnssysla";
+ break;
+ case 6:
+ name = "Austur-Skaftafellssysla";
+ break;
+ case 7:
+ name = "Borgarfjardarsysla";
+ break;
+ case 8:
+ name = "Dalasysla";
+ break;
+ case 9:
+ name = "Eyjafjardarsysla";
+ break;
+ case 10:
+ name = "Gullbringusysla";
+ break;
+ case 11:
+ name = "Hafnarfjordur";
+ break;
+ case 12:
+ name = "Husavik";
+ break;
+ case 13:
+ name = "Isafjordur";
+ break;
+ case 14:
+ name = "Keflavik";
+ break;
+ case 15:
+ name = "Kjosarsysla";
+ break;
+ case 16:
+ name = "Kopavogur";
+ break;
+ case 17:
+ name = "Myrasysla";
+ break;
+ case 18:
+ name = "Neskaupstadur";
+ break;
+ case 19:
+ name = "Nordur-Isafjardarsysla";
+ break;
+ case 20:
+ name = "Nordur-Mulasysla";
+ break;
+ case 21:
+ name = "Nordur-Tingeyjarsysla";
+ break;
+ case 22:
+ name = "Olafsfjordur";
+ break;
+ case 23:
+ name = "Rangarvallasysla";
+ break;
+ case 24:
+ name = "Reykjavik";
+ break;
+ case 25:
+ name = "Saudarkrokur";
+ break;
+ case 26:
+ name = "Seydisfjordur";
+ break;
+ case 27:
+ name = "Siglufjordur";
+ break;
+ case 28:
+ name = "Skagafjardarsysla";
+ break;
+ case 29:
+ name = "Snafellsnes- og Hnappadalssysla";
+ break;
+ case 30:
+ name = "Strandasysla";
+ break;
+ case 31:
+ name = "Sudur-Mulasysla";
+ break;
+ case 32:
+ name = "Sudur-Tingeyjarsysla";
+ break;
+ case 33:
+ name = "Vestmannaeyjar";
+ break;
+ case 34:
+ name = "Vestur-Bardastrandarsysla";
+ break;
+ case 35:
+ name = "Vestur-Hunavatnssysla";
+ break;
+ case 36:
+ name = "Vestur-Isafjardarsysla";
+ break;
+ case 37:
+ name = "Vestur-Skaftafellssysla";
+ break;
+ }
+ }
+ if (strcmp(country_code,"IT") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Abruzzi";
+ break;
+ case 2:
+ name = "Basilicata";
+ break;
+ case 3:
+ name = "Calabria";
+ break;
+ case 4:
+ name = "Campania";
+ break;
+ case 5:
+ name = "Emilia-Romagna";
+ break;
+ case 6:
+ name = "Friuli-Venezia Giulia";
+ break;
+ case 7:
+ name = "Lazio";
+ break;
+ case 8:
+ name = "Liguria";
+ break;
+ case 9:
+ name = "Lombardia";
+ break;
+ case 10:
+ name = "Marche";
+ break;
+ case 11:
+ name = "Molise";
+ break;
+ case 12:
+ name = "Piemonte";
+ break;
+ case 13:
+ name = "Puglia";
+ break;
+ case 14:
+ name = "Sardegna";
+ break;
+ case 15:
+ name = "Sicilia";
+ break;
+ case 16:
+ name = "Toscana";
+ break;
+ case 17:
+ name = "Trentino-Alto Adige";
+ break;
+ case 18:
+ name = "Umbria";
+ break;
+ case 19:
+ name = "Valle d'Aosta";
+ break;
+ case 20:
+ name = "Veneto";
+ break;
+ }
+ }
+ if (strcmp(country_code,"JM") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Clarendon";
+ break;
+ case 2:
+ name = "Hanover";
+ break;
+ case 4:
+ name = "Manchester";
+ break;
+ case 7:
+ name = "Portland";
+ break;
+ case 8:
+ name = "Saint Andrew";
+ break;
+ case 9:
+ name = "Saint Ann";
+ break;
+ case 10:
+ name = "Saint Catherine";
+ break;
+ case 11:
+ name = "Saint Elizabeth";
+ break;
+ case 12:
+ name = "Saint James";
+ break;
+ case 13:
+ name = "Saint Mary";
+ break;
+ case 14:
+ name = "Saint Thomas";
+ break;
+ case 15:
+ name = "Trelawny";
+ break;
+ case 16:
+ name = "Westmoreland";
+ break;
+ case 17:
+ name = "Kingston";
+ break;
+ }
+ }
+ if (strcmp(country_code,"JO") == 0) {
+ switch (region_code2) {
+ case 2:
+ name = "Al Balqa'";
+ break;
+ case 7:
+ name = "Ma";
+ break;
+ case 9:
+ name = "Al Karak";
+ break;
+ case 10:
+ name = "Al Mafraq";
+ break;
+ case 12:
+ name = "At Tafilah";
+ break;
+ case 13:
+ name = "Az Zarqa";
+ break;
+ case 14:
+ name = "Irbid";
+ break;
+ case 16:
+ name = "Amman";
+ break;
+ }
+ }
+ if (strcmp(country_code,"JP") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Aichi";
+ break;
+ case 2:
+ name = "Akita";
+ break;
+ case 3:
+ name = "Aomori";
+ break;
+ case 4:
+ name = "Chiba";
+ break;
+ case 5:
+ name = "Ehime";
+ break;
+ case 6:
+ name = "Fukui";
+ break;
+ case 7:
+ name = "Fukuoka";
+ break;
+ case 8:
+ name = "Fukushima";
+ break;
+ case 9:
+ name = "Gifu";
+ break;
+ case 10:
+ name = "Gumma";
+ break;
+ case 11:
+ name = "Hiroshima";
+ break;
+ case 12:
+ name = "Hokkaido";
+ break;
+ case 13:
+ name = "Hyogo";
+ break;
+ case 14:
+ name = "Ibaraki";
+ break;
+ case 15:
+ name = "Ishikawa";
+ break;
+ case 16:
+ name = "Iwate";
+ break;
+ case 17:
+ name = "Kagawa";
+ break;
+ case 18:
+ name = "Kagoshima";
+ break;
+ case 19:
+ name = "Kanagawa";
+ break;
+ case 20:
+ name = "Kochi";
+ break;
+ case 21:
+ name = "Kumamoto";
+ break;
+ case 22:
+ name = "Kyoto";
+ break;
+ case 23:
+ name = "Mie";
+ break;
+ case 24:
+ name = "Miyagi";
+ break;
+ case 25:
+ name = "Miyazaki";
+ break;
+ case 26:
+ name = "Nagano";
+ break;
+ case 27:
+ name = "Nagasaki";
+ break;
+ case 28:
+ name = "Nara";
+ break;
+ case 29:
+ name = "Niigata";
+ break;
+ case 30:
+ name = "Oita";
+ break;
+ case 31:
+ name = "Okayama";
+ break;
+ case 32:
+ name = "Osaka";
+ break;
+ case 33:
+ name = "Saga";
+ break;
+ case 34:
+ name = "Saitama";
+ break;
+ case 35:
+ name = "Shiga";
+ break;
+ case 36:
+ name = "Shimane";
+ break;
+ case 37:
+ name = "Shizuoka";
+ break;
+ case 38:
+ name = "Tochigi";
+ break;
+ case 39:
+ name = "Tokushima";
+ break;
+ case 40:
+ name = "Tokyo";
+ break;
+ case 41:
+ name = "Tottori";
+ break;
+ case 42:
+ name = "Toyama";
+ break;
+ case 43:
+ name = "Wakayama";
+ break;
+ case 44:
+ name = "Yamagata";
+ break;
+ case 45:
+ name = "Yamaguchi";
+ break;
+ case 46:
+ name = "Yamanashi";
+ break;
+ case 47:
+ name = "Okinawa";
+ break;
+ }
+ }
+ if (strcmp(country_code,"KE") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Central";
+ break;
+ case 2:
+ name = "Coast";
+ break;
+ case 3:
+ name = "Eastern";
+ break;
+ case 5:
+ name = "Nairobi Area";
+ break;
+ case 6:
+ name = "North-Eastern";
+ break;
+ case 7:
+ name = "Nyanza";
+ break;
+ case 8:
+ name = "Rift Valley";
+ break;
+ case 9:
+ name = "Western";
+ break;
+ }
+ }
+ if (strcmp(country_code,"KG") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Bishkek";
+ break;
+ case 2:
+ name = "Chuy";
+ break;
+ case 3:
+ name = "Jalal-Abad";
+ break;
+ case 4:
+ name = "Naryn";
+ break;
+ case 6:
+ name = "Talas";
+ break;
+ case 7:
+ name = "Ysyk-Kol";
+ break;
+ case 8:
+ name = "Osh";
+ break;
+ case 9:
+ name = "Batken";
+ break;
+ }
+ }
+ if (strcmp(country_code,"KH") == 0) {
+ switch (region_code2) {
+ case 2:
+ name = "Kampong Cham";
+ break;
+ case 3:
+ name = "Kampong Chhnang";
+ break;
+ case 4:
+ name = "Kampong Spoe";
+ break;
+ case 5:
+ name = "Kampong Thum";
+ break;
+ case 6:
+ name = "Kampot";
+ break;
+ case 7:
+ name = "Kandal";
+ break;
+ case 8:
+ name = "Kaoh Kong";
+ break;
+ case 9:
+ name = "Kracheh";
+ break;
+ case 10:
+ name = "Mondol Kiri";
+ break;
+ case 11:
+ name = "Phnum Penh";
+ break;
+ case 12:
+ name = "Pouthisat";
+ break;
+ case 13:
+ name = "Preah Vihear";
+ break;
+ case 14:
+ name = "Prey Veng";
+ break;
+ case 15:
+ name = "Rotanokiri";
+ break;
+ case 16:
+ name = "Siemreab-Otdar Meanchey";
+ break;
+ case 17:
+ name = "Stoeng Treng";
+ break;
+ case 18:
+ name = "Svay Rieng";
+ break;
+ case 19:
+ name = "Takev";
+ break;
+ case 29:
+ name = "Batdambang";
+ break;
+ case 30:
+ name = "Pailin";
+ break;
+ }
+ }
+ if (strcmp(country_code,"KI") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Gilbert Islands";
+ break;
+ case 2:
+ name = "Line Islands";
+ break;
+ case 3:
+ name = "Phoenix Islands";
+ break;
+ }
+ }
+ if (strcmp(country_code,"KM") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Anjouan";
+ break;
+ case 2:
+ name = "Grande Comore";
+ break;
+ case 3:
+ name = "Moheli";
+ break;
+ }
+ }
+ if (strcmp(country_code,"KN") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Christ Church Nichola Town";
+ break;
+ case 2:
+ name = "Saint Anne Sandy Point";
+ break;
+ case 3:
+ name = "Saint George Basseterre";
+ break;
+ case 4:
+ name = "Saint George Gingerland";
+ break;
+ case 5:
+ name = "Saint James Windward";
+ break;
+ case 6:
+ name = "Saint John Capisterre";
+ break;
+ case 7:
+ name = "Saint John Figtree";
+ break;
+ case 8:
+ name = "Saint Mary Cayon";
+ break;
+ case 9:
+ name = "Saint Paul Capisterre";
+ break;
+ case 10:
+ name = "Saint Paul Charlestown";
+ break;
+ case 11:
+ name = "Saint Peter Basseterre";
+ break;
+ case 12:
+ name = "Saint Thomas Lowland";
+ break;
+ case 13:
+ name = "Saint Thomas Middle Island";
+ break;
+ case 15:
+ name = "Trinity Palmetto Point";
+ break;
+ }
+ }
+ if (strcmp(country_code,"KP") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Chagang-do";
+ break;
+ case 3:
+ name = "Hamgyong-namdo";
+ break;
+ case 6:
+ name = "Hwanghae-namdo";
+ break;
+ case 7:
+ name = "Hwanghae-bukto";
+ break;
+ case 8:
+ name = "Kaesong-si";
+ break;
+ case 9:
+ name = "Kangwon-do";
+ break;
+ case 11:
+ name = "P'yongan-bukto";
+ break;
+ case 12:
+ name = "P'yongyang-si";
+ break;
+ case 13:
+ name = "Yanggang-do";
+ break;
+ case 14:
+ name = "Namp'o-si";
+ break;
+ case 15:
+ name = "P'yongan-namdo";
+ break;
+ case 17:
+ name = "Hamgyong-bukto";
+ break;
+ case 18:
+ name = "Najin Sonbong-si";
+ break;
+ }
+ }
+ if (strcmp(country_code,"KR") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Cheju-do";
+ break;
+ case 3:
+ name = "Cholla-bukto";
+ break;
+ case 5:
+ name = "Ch'ungch'ong-bukto";
+ break;
+ case 6:
+ name = "Kangwon-do";
+ break;
+ case 10:
+ name = "Pusan-jikhalsi";
+ break;
+ case 11:
+ name = "Seoul-t'ukpyolsi";
+ break;
+ case 12:
+ name = "Inch'on-jikhalsi";
+ break;
+ case 13:
+ name = "Kyonggi-do";
+ break;
+ case 14:
+ name = "Kyongsang-bukto";
+ break;
+ case 15:
+ name = "Taegu-jikhalsi";
+ break;
+ case 16:
+ name = "Cholla-namdo";
+ break;
+ case 17:
+ name = "Ch'ungch'ong-namdo";
+ break;
+ case 18:
+ name = "Kwangju-jikhalsi";
+ break;
+ case 19:
+ name = "Taejon-jikhalsi";
+ break;
+ case 20:
+ name = "Kyongsang-namdo";
+ break;
+ case 21:
+ name = "Ulsan-gwangyoksi";
+ break;
+ }
+ }
+ if (strcmp(country_code,"KW") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Al Ahmadi";
+ break;
+ case 2:
+ name = "Al Kuwayt";
+ break;
+ case 3:
+ name = "Hawalli";
+ break;
+ case 5:
+ name = "Al Jahra";
+ break;
+ }
+ }
+ if (strcmp(country_code,"KY") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Creek";
+ break;
+ case 2:
+ name = "Eastern";
+ break;
+ case 3:
+ name = "Midland";
+ break;
+ case 4:
+ name = "South Town";
+ break;
+ case 5:
+ name = "Spot Bay";
+ break;
+ case 6:
+ name = "Stake Bay";
+ break;
+ case 7:
+ name = "West End";
+ break;
+ case 8:
+ name = "Western";
+ break;
+ }
+ }
+ if (strcmp(country_code,"KZ") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Almaty";
+ break;
+ case 2:
+ name = "Almaty City";
+ break;
+ case 3:
+ name = "Aqmola";
+ break;
+ case 4:
+ name = "Aqtöbe";
+ break;
+ case 5:
+ name = "Astana";
+ break;
+ case 6:
+ name = "Atyrau";
+ break;
+ case 7:
+ name = "West Kazakhstan";
+ break;
+ case 8:
+ name = "Bayqonyr";
+ break;
+ case 9:
+ name = "Mangghystau";
+ break;
+ case 10:
+ name = "South Kazakhstan";
+ break;
+ case 11:
+ name = "Pavlodar";
+ break;
+ case 12:
+ name = "Qaraghandy";
+ break;
+ case 13:
+ name = "Qostanay";
+ break;
+ case 14:
+ name = "Qyzylorda";
+ break;
+ case 15:
+ name = "East Kazakhstan";
+ break;
+ case 16:
+ name = "North Kazakhstan";
+ break;
+ case 17:
+ name = "Zhambyl";
+ break;
+ }
+ }
+ if (strcmp(country_code,"LA") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Attapu";
+ break;
+ case 2:
+ name = "Champasak";
+ break;
+ case 3:
+ name = "Houaphan";
+ break;
+ case 4:
+ name = "Khammouan";
+ break;
+ case 5:
+ name = "Louang Namtha";
+ break;
+ case 7:
+ name = "Oudomxai";
+ break;
+ case 8:
+ name = "Phongsali";
+ break;
+ case 9:
+ name = "Saravan";
+ break;
+ case 10:
+ name = "Savannakhet";
+ break;
+ case 11:
+ name = "Vientiane";
+ break;
+ case 13:
+ name = "Xaignabouri";
+ break;
+ case 14:
+ name = "Xiangkhoang";
+ break;
+ case 17:
+ name = "Louangphrabang";
+ break;
+ }
+ }
+ if (strcmp(country_code,"LB") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Beqaa";
+ break;
+ case 3:
+ name = "Liban-Nord";
+ break;
+ case 4:
+ name = "Beyrouth";
+ break;
+ case 5:
+ name = "Mont-Liban";
+ break;
+ case 6:
+ name = "Liban-Sud";
+ break;
+ case 7:
+ name = "Nabatiye";
+ break;
+ }
+ }
+ if (strcmp(country_code,"LC") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Anse-la-Raye";
+ break;
+ case 2:
+ name = "Dauphin";
+ break;
+ case 3:
+ name = "Castries";
+ break;
+ case 4:
+ name = "Choiseul";
+ break;
+ case 5:
+ name = "Dennery";
+ break;
+ case 6:
+ name = "Gros-Islet";
+ break;
+ case 7:
+ name = "Laborie";
+ break;
+ case 8:
+ name = "Micoud";
+ break;
+ case 9:
+ name = "Soufriere";
+ break;
+ case 10:
+ name = "Vieux-Fort";
+ break;
+ case 11:
+ name = "Praslin";
+ break;
+ }
+ }
+ if (strcmp(country_code,"LI") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Balzers";
+ break;
+ case 2:
+ name = "Eschen";
+ break;
+ case 3:
+ name = "Gamprin";
+ break;
+ case 4:
+ name = "Mauren";
+ break;
+ case 5:
+ name = "Planken";
+ break;
+ case 6:
+ name = "Ruggell";
+ break;
+ case 7:
+ name = "Schaan";
+ break;
+ case 8:
+ name = "Schellenberg";
+ break;
+ case 9:
+ name = "Triesen";
+ break;
+ case 10:
+ name = "Triesenberg";
+ break;
+ case 11:
+ name = "Vaduz";
+ break;
+ }
+ }
+ if (strcmp(country_code,"LK") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Amparai";
+ break;
+ case 2:
+ name = "Anuradhapura";
+ break;
+ case 3:
+ name = "Badulla";
+ break;
+ case 4:
+ name = "Batticaloa";
+ break;
+ case 6:
+ name = "Galle";
+ break;
+ case 7:
+ name = "Hambantota";
+ break;
+ case 9:
+ name = "Kalutara";
+ break;
+ case 10:
+ name = "Kandy";
+ break;
+ case 11:
+ name = "Kegalla";
+ break;
+ case 12:
+ name = "Kurunegala";
+ break;
+ case 14:
+ name = "Matale";
+ break;
+ case 15:
+ name = "Matara";
+ break;
+ case 16:
+ name = "Moneragala";
+ break;
+ case 17:
+ name = "Nuwara Eliya";
+ break;
+ case 18:
+ name = "Polonnaruwa";
+ break;
+ case 19:
+ name = "Puttalam";
+ break;
+ case 20:
+ name = "Ratnapura";
+ break;
+ case 21:
+ name = "Trincomalee";
+ break;
+ case 23:
+ name = "Colombo";
+ break;
+ case 24:
+ name = "Gampaha";
+ break;
+ case 25:
+ name = "Jaffna";
+ break;
+ case 26:
+ name = "Mannar";
+ break;
+ case 27:
+ name = "Mullaittivu";
+ break;
+ case 28:
+ name = "Vavuniya";
+ break;
+ }
+ }
+ if (strcmp(country_code,"LR") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Bong";
+ break;
+ case 2:
+ name = "Grand Jide";
+ break;
+ case 4:
+ name = "Grand Cape Mount";
+ break;
+ case 5:
+ name = "Lofa";
+ break;
+ case 6:
+ name = "Maryland";
+ break;
+ case 7:
+ name = "Monrovia";
+ break;
+ case 9:
+ name = "Nimba";
+ break;
+ case 10:
+ name = "Sino";
+ break;
+ case 11:
+ name = "Grand Bassa";
+ break;
+ case 14:
+ name = "Montserrado";
+ break;
+ }
+ }
+ if (strcmp(country_code,"LS") == 0) {
+ switch (region_code2) {
+ case 10:
+ name = "Berea";
+ break;
+ case 11:
+ name = "Butha-Buthe";
+ break;
+ case 12:
+ name = "Leribe";
+ break;
+ case 13:
+ name = "Mafeteng";
+ break;
+ case 14:
+ name = "Maseru";
+ break;
+ case 15:
+ name = "Mohales Hoek";
+ break;
+ case 16:
+ name = "Mokhotlong";
+ break;
+ case 17:
+ name = "Qachas Nek";
+ break;
+ case 18:
+ name = "Quthing";
+ break;
+ case 19:
+ name = "Thaba-Tseka";
+ break;
+ }
+ }
+ if (strcmp(country_code,"LT") == 0) {
+ switch (region_code2) {
+ case 56:
+ name = "Alytaus Apskritis";
+ break;
+ case 57:
+ name = "Kauno Apskritis";
+ break;
+ case 58:
+ name = "Klaipedos Apskritis";
+ break;
+ case 59:
+ name = "Marijampoles Apskritis";
+ break;
+ case 60:
+ name = "Panevezio Apskritis";
+ break;
+ case 61:
+ name = "Siauliu Apskritis";
+ break;
+ case 62:
+ name = "Taurages Apskritis";
+ break;
+ case 63:
+ name = "Telsiu Apskritis";
+ break;
+ case 64:
+ name = "Utenos Apskritis";
+ break;
+ case 65:
+ name = "Vilniaus Apskritis";
+ break;
+ }
+ }
+ if (strcmp(country_code,"LU") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Diekirch";
+ break;
+ case 2:
+ name = "Grevenmacher";
+ break;
+ case 3:
+ name = "Luxembourg";
+ break;
+ }
+ }
+ if (strcmp(country_code,"LV") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Aizkraukles";
+ break;
+ case 2:
+ name = "Aluksnes";
+ break;
+ case 3:
+ name = "Balvu";
+ break;
+ case 4:
+ name = "Bauskas";
+ break;
+ case 5:
+ name = "Césu";
+ break;
+ case 6:
+ name = "Daugavpils";
+ break;
+ case 7:
+ name = "Daugavpils";
+ break;
+ case 8:
+ name = "Dobeles";
+ break;
+ case 9:
+ name = "Gulbenes";
+ break;
+ case 10:
+ name = "Jékabpils";
+ break;
+ case 11:
+ name = "Jelgava";
+ break;
+ case 12:
+ name = "Jelgavas";
+ break;
+ case 13:
+ name = "Jurmala";
+ break;
+ case 14:
+ name = "Kráslavas";
+ break;
+ case 15:
+ name = "Kuldigas";
+ break;
+ case 16:
+ name = "Liepája";
+ break;
+ case 17:
+ name = "Liepájas";
+ break;
+ case 18:
+ name = "Limbazu";
+ break;
+ case 19:
+ name = "Ludzas";
+ break;
+ case 20:
+ name = "Madonas";
+ break;
+ case 21:
+ name = "Ogres";
+ break;
+ case 22:
+ name = "Preilu";
+ break;
+ case 23:
+ name = "Rézekne";
+ break;
+ case 24:
+ name = "Rézeknes";
+ break;
+ case 25:
+ name = "Riga";
+ break;
+ case 26:
+ name = "Rigas";
+ break;
+ case 27:
+ name = "Saldus";
+ break;
+ case 28:
+ name = "Talsu";
+ break;
+ case 29:
+ name = "Tukuma";
+ break;
+ case 30:
+ name = "Valkas";
+ break;
+ case 31:
+ name = "Valmieras";
+ break;
+ case 32:
+ name = "Ventspils";
+ break;
+ case 33:
+ name = "Ventspils";
+ break;
+ }
+ }
+ if (strcmp(country_code,"LY") == 0) {
+ switch (region_code2) {
+ case 3:
+ name = "Al";
+ break;
+ case 5:
+ name = "Al Jufrah";
+ break;
+ case 8:
+ name = "Al Kufrah";
+ break;
+ case 13:
+ name = "Ash Shati'";
+ break;
+ case 30:
+ name = "Murzuq";
+ break;
+ case 34:
+ name = "Sabha";
+ break;
+ case 41:
+ name = "Tarhunah";
+ break;
+ case 42:
+ name = "Tubruq";
+ break;
+ case 45:
+ name = "Zlitan";
+ break;
+ case 47:
+ name = "Ajdabiya";
+ break;
+ case 48:
+ name = "Al Fatih";
+ break;
+ case 49:
+ name = "Al Jabal al Akhdar";
+ break;
+ case 50:
+ name = "Al Khums";
+ break;
+ case 51:
+ name = "An Nuqat al Khams";
+ break;
+ case 52:
+ name = "Awbari";
+ break;
+ case 53:
+ name = "Az Zawiyah";
+ break;
+ case 54:
+ name = "Banghazi";
+ break;
+ case 55:
+ name = "Darnah";
+ break;
+ case 56:
+ name = "Ghadamis";
+ break;
+ case 57:
+ name = "Gharyan";
+ break;
+ case 58:
+ name = "Misratah";
+ break;
+ case 59:
+ name = "Sawfajjin";
+ break;
+ case 60:
+ name = "Surt";
+ break;
+ case 61:
+ name = "Tarabulus";
+ break;
+ case 62:
+ name = "Yafran";
+ break;
+ }
+ }
+ if (strcmp(country_code,"MA") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Agadir";
+ break;
+ case 2:
+ name = "Al Hoceima";
+ break;
+ case 3:
+ name = "Azilal";
+ break;
+ case 4:
+ name = "Ben Slimane";
+ break;
+ case 5:
+ name = "Beni Mellal";
+ break;
+ case 6:
+ name = "Boulemane";
+ break;
+ case 7:
+ name = "Casablanca";
+ break;
+ case 8:
+ name = "Chaouen";
+ break;
+ case 9:
+ name = "El Jadida";
+ break;
+ case 10:
+ name = "El Kelaa des Srarhna";
+ break;
+ case 11:
+ name = "Er Rachidia";
+ break;
+ case 12:
+ name = "Essaouira";
+ break;
+ case 13:
+ name = "Fes";
+ break;
+ case 14:
+ name = "Figuig";
+ break;
+ case 15:
+ name = "Kenitra";
+ break;
+ case 16:
+ name = "Khemisset";
+ break;
+ case 17:
+ name = "Khenifra";
+ break;
+ case 18:
+ name = "Khouribga";
+ break;
+ case 19:
+ name = "Marrakech";
+ break;
+ case 20:
+ name = "Meknes";
+ break;
+ case 21:
+ name = "Nador";
+ break;
+ case 22:
+ name = "Ouarzazate";
+ break;
+ case 23:
+ name = "Oujda";
+ break;
+ case 24:
+ name = "Rabat-Sale";
+ break;
+ case 25:
+ name = "Safi";
+ break;
+ case 26:
+ name = "Settat";
+ break;
+ case 27:
+ name = "Tanger";
+ break;
+ case 29:
+ name = "Tata";
+ break;
+ case 30:
+ name = "Taza";
+ break;
+ case 32:
+ name = "Tiznit";
+ break;
+ case 33:
+ name = "Guelmim";
+ break;
+ case 34:
+ name = "Ifrane";
+ break;
+ case 35:
+ name = "Laayoune";
+ break;
+ case 36:
+ name = "Tan-Tan";
+ break;
+ case 37:
+ name = "Taounate";
+ break;
+ case 38:
+ name = "Sidi Kacem";
+ break;
+ case 39:
+ name = "Taroudannt";
+ break;
+ case 40:
+ name = "Tetouan";
+ break;
+ case 41:
+ name = "Larache";
+ break;
+ }
+ }
+ if (strcmp(country_code,"MC") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "La Condamine";
+ break;
+ case 2:
+ name = "Monaco";
+ break;
+ case 3:
+ name = "Monte-Carlo";
+ break;
+ }
+ }
+ if (strcmp(country_code,"MD") == 0) {
+ switch (region_code2) {
+ case 46:
+ name = "Balti";
+ break;
+ case 47:
+ name = "Cahul";
+ break;
+ case 48:
+ name = "Chisinau";
+ break;
+ case 49:
+ name = "Stinga Nistrului";
+ break;
+ case 50:
+ name = "Edinet";
+ break;
+ case 51:
+ name = "Gagauzia";
+ break;
+ case 52:
+ name = "Lapusna";
+ break;
+ case 53:
+ name = "Orhei";
+ break;
+ case 54:
+ name = "Soroca";
+ break;
+ case 55:
+ name = "Tighina";
+ break;
+ case 56:
+ name = "Ungheni";
+ break;
+ }
+ }
+ if (strcmp(country_code,"MG") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Antsiranana";
+ break;
+ case 2:
+ name = "Fianarantsoa";
+ break;
+ case 3:
+ name = "Mahajanga";
+ break;
+ case 4:
+ name = "Toamasina";
+ break;
+ case 5:
+ name = "Antananarivo";
+ break;
+ case 6:
+ name = "Toliara";
+ break;
+ }
+ }
+ if (strcmp(country_code,"MK") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Aracinovo";
+ break;
+ case 2:
+ name = "Bac";
+ break;
+ case 3:
+ name = "Belcista";
+ break;
+ case 4:
+ name = "Berovo";
+ break;
+ case 5:
+ name = "Bistrica";
+ break;
+ case 6:
+ name = "Bitola";
+ break;
+ case 7:
+ name = "Blatec";
+ break;
+ case 8:
+ name = "Bogdanci";
+ break;
+ case 9:
+ name = "Bogomila";
+ break;
+ case 10:
+ name = "Bogovinje";
+ break;
+ case 11:
+ name = "Bosilovo";
+ break;
+ case 12:
+ name = "Brvenica";
+ break;
+ case 13:
+ name = "Cair";
+ break;
+ case 14:
+ name = "Capari";
+ break;
+ case 15:
+ name = "Caska";
+ break;
+ case 16:
+ name = "Cegrane";
+ break;
+ case 17:
+ name = "Centar";
+ break;
+ case 18:
+ name = "Centar Zupa";
+ break;
+ case 19:
+ name = "Cesinovo";
+ break;
+ case 20:
+ name = "Cucer-Sandevo";
+ break;
+ case 21:
+ name = "Debar";
+ break;
+ case 22:
+ name = "Delcevo";
+ break;
+ case 23:
+ name = "Delogozdi";
+ break;
+ case 24:
+ name = "Demir Hisar";
+ break;
+ case 25:
+ name = "Demir Kapija";
+ break;
+ case 26:
+ name = "Dobrusevo";
+ break;
+ case 27:
+ name = "Dolna Banjica";
+ break;
+ case 28:
+ name = "Dolneni";
+ break;
+ case 29:
+ name = "Dorce Petrov";
+ break;
+ case 30:
+ name = "Drugovo";
+ break;
+ case 31:
+ name = "Dzepciste";
+ break;
+ case 32:
+ name = "Gazi Baba";
+ break;
+ case 33:
+ name = "Gevgelija";
+ break;
+ case 34:
+ name = "Gostivar";
+ break;
+ case 35:
+ name = "Gradsko";
+ break;
+ case 36:
+ name = "Ilinden";
+ break;
+ case 37:
+ name = "Izvor";
+ break;
+ case 38:
+ name = "Jegunovce";
+ break;
+ case 39:
+ name = "Kamenjane";
+ break;
+ case 40:
+ name = "Karbinci";
+ break;
+ case 41:
+ name = "Karpos";
+ break;
+ case 42:
+ name = "Kavadarci";
+ break;
+ case 43:
+ name = "Kicevo";
+ break;
+ case 44:
+ name = "Kisela Voda";
+ break;
+ case 45:
+ name = "Klecevce";
+ break;
+ case 46:
+ name = "Kocani";
+ break;
+ case 47:
+ name = "Konce";
+ break;
+ case 48:
+ name = "Kondovo";
+ break;
+ case 49:
+ name = "Konopiste";
+ break;
+ case 50:
+ name = "Kosel";
+ break;
+ case 51:
+ name = "Kratovo";
+ break;
+ case 52:
+ name = "Kriva Palanka";
+ break;
+ case 53:
+ name = "Krivogastani";
+ break;
+ case 54:
+ name = "Krusevo";
+ break;
+ case 55:
+ name = "Kuklis";
+ break;
+ case 56:
+ name = "Kukurecani";
+ break;
+ case 57:
+ name = "Kumanovo";
+ break;
+ case 58:
+ name = "Labunista";
+ break;
+ case 59:
+ name = "Lipkovo";
+ break;
+ case 60:
+ name = "Lozovo";
+ break;
+ case 61:
+ name = "Lukovo";
+ break;
+ case 62:
+ name = "Makedonska Kamenica";
+ break;
+ case 63:
+ name = "Makedonski Brod";
+ break;
+ case 64:
+ name = "Mavrovi Anovi";
+ break;
+ case 65:
+ name = "Meseista";
+ break;
+ case 66:
+ name = "Miravci";
+ break;
+ case 67:
+ name = "Mogila";
+ break;
+ case 68:
+ name = "Murtino";
+ break;
+ case 69:
+ name = "Negotino";
+ break;
+ case 70:
+ name = "Negotino-Polosko";
+ break;
+ case 71:
+ name = "Novaci";
+ break;
+ case 72:
+ name = "Novo Selo";
+ break;
+ case 73:
+ name = "Oblesevo";
+ break;
+ case 74:
+ name = "Ohrid";
+ break;
+ case 75:
+ name = "Orasac";
+ break;
+ case 76:
+ name = "Orizari";
+ break;
+ case 77:
+ name = "Oslomej";
+ break;
+ case 78:
+ name = "Pehcevo";
+ break;
+ case 79:
+ name = "Petrovec";
+ break;
+ case 80:
+ name = "Plasnica";
+ break;
+ case 81:
+ name = "Podares";
+ break;
+ case 82:
+ name = "Prilep";
+ break;
+ case 83:
+ name = "Probistip";
+ break;
+ case 84:
+ name = "Radovis";
+ break;
+ case 85:
+ name = "Rankovce";
+ break;
+ case 86:
+ name = "Resen";
+ break;
+ case 87:
+ name = "Rosoman";
+ break;
+ case 88:
+ name = "Rostusa";
+ break;
+ case 89:
+ name = "Samokov";
+ break;
+ case 90:
+ name = "Saraj";
+ break;
+ case 91:
+ name = "Sipkovica";
+ break;
+ case 92:
+ name = "Sopiste";
+ break;
+ case 93:
+ name = "Sopotnica";
+ break;
+ case 94:
+ name = "Srbinovo";
+ break;
+ case 95:
+ name = "Staravina";
+ break;
+ case 96:
+ name = "Star Dojran";
+ break;
+ case 97:
+ name = "Staro Nagoricane";
+ break;
+ case 98:
+ name = "Stip";
+ break;
+ case 99:
+ name = "Struga";
+ break;
+ case 101:
+ name = "Strumica";
+ break;
+ case 102:
+ name = "Studenicani";
+ break;
+ case 103:
+ name = "Suto Orizari";
+ break;
+ case 104:
+ name = "Sveti Nikole";
+ break;
+ case 105:
+ name = "Tearce";
+ break;
+ case 106:
+ name = "Tetovo";
+ break;
+ case 107:
+ name = "Topolcani";
+ break;
+ case 108:
+ name = "Valandovo";
+ break;
+ case 109:
+ name = "Vasilevo";
+ break;
+ case 111:
+ name = "Veles";
+ break;
+ case 112:
+ name = "Velesta";
+ break;
+ case 113:
+ name = "Vevcani";
+ break;
+ case 114:
+ name = "Vinica";
+ break;
+ case 115:
+ name = "Vitoliste";
+ break;
+ case 116:
+ name = "Vranestica";
+ break;
+ case 117:
+ name = "Vrapciste";
+ break;
+ case 118:
+ name = "Vratnica";
+ break;
+ case 119:
+ name = "Vrutok";
+ break;
+ case 121:
+ name = "Zajas";
+ break;
+ case 122:
+ name = "Zelenikovo";
+ break;
+ case 123:
+ name = "Zelino";
+ break;
+ case 124:
+ name = "Zitose";
+ break;
+ case 125:
+ name = "Zletovo";
+ break;
+ case 126:
+ name = "Zrnovci";
+ break;
+ }
+ }
+ if (strcmp(country_code,"ML") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Bamako";
+ break;
+ case 3:
+ name = "Kayes";
+ break;
+ case 4:
+ name = "Mopti";
+ break;
+ case 5:
+ name = "Segou";
+ break;
+ case 6:
+ name = "Sikasso";
+ break;
+ case 7:
+ name = "Koulikoro";
+ break;
+ case 8:
+ name = "Tombouctou";
+ break;
+ case 9:
+ name = "Gao";
+ break;
+ case 10:
+ name = "Kidal";
+ break;
+ }
+ }
+ if (strcmp(country_code,"MM") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Rakhine State";
+ break;
+ case 2:
+ name = "Chin State";
+ break;
+ case 3:
+ name = "Irrawaddy";
+ break;
+ case 4:
+ name = "Kachin State";
+ break;
+ case 5:
+ name = "Karan State";
+ break;
+ case 6:
+ name = "Kayah State";
+ break;
+ case 7:
+ name = "Magwe";
+ break;
+ case 8:
+ name = "Mandalay";
+ break;
+ case 9:
+ name = "Pegu";
+ break;
+ case 10:
+ name = "Sagaing";
+ break;
+ case 11:
+ name = "Shan State";
+ break;
+ case 12:
+ name = "Tenasserim";
+ break;
+ case 13:
+ name = "Mon State";
+ break;
+ case 14:
+ name = "Rangoon";
+ break;
+ case 17:
+ name = "Yangon";
+ break;
+ }
+ }
+ if (strcmp(country_code,"MN") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Arhangay";
+ break;
+ case 2:
+ name = "Bayanhongor";
+ break;
+ case 3:
+ name = "Bayan-Olgiy";
+ break;
+ case 5:
+ name = "Darhan";
+ break;
+ case 6:
+ name = "Dornod";
+ break;
+ case 7:
+ name = "Dornogovi";
+ break;
+ case 8:
+ name = "Dundgovi";
+ break;
+ case 9:
+ name = "Dzavhan";
+ break;
+ case 10:
+ name = "Govi-Altay";
+ break;
+ case 11:
+ name = "Hentiy";
+ break;
+ case 12:
+ name = "Hovd";
+ break;
+ case 13:
+ name = "Hovsgol";
+ break;
+ case 14:
+ name = "Omnogovi";
+ break;
+ case 15:
+ name = "Ovorhangay";
+ break;
+ case 16:
+ name = "Selenge";
+ break;
+ case 17:
+ name = "Suhbaatar";
+ break;
+ case 18:
+ name = "Tov";
+ break;
+ case 19:
+ name = "Uvs";
+ break;
+ case 20:
+ name = "Ulaanbaatar";
+ break;
+ case 21:
+ name = "Bulgan";
+ break;
+ case 22:
+ name = "Erdenet";
+ break;
+ case 23:
+ name = "Darhan Uul";
+ break;
+ case 24:
+ name = "Govi-Sumber";
+ break;
+ case 25:
+ name = "Orhon";
+ break;
+ }
+ }
+ if (strcmp(country_code,"MO") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Ilhas";
+ break;
+ case 2:
+ name = "Macau";
+ break;
+ }
+ }
+ if (strcmp(country_code,"MR") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Hodh Ech Chargui";
+ break;
+ case 2:
+ name = "Hodh El Gharbi";
+ break;
+ case 3:
+ name = "Assaba";
+ break;
+ case 4:
+ name = "Gorgol";
+ break;
+ case 5:
+ name = "Brakna";
+ break;
+ case 6:
+ name = "Trarza";
+ break;
+ case 7:
+ name = "Adrar";
+ break;
+ case 8:
+ name = "Dakhlet Nouadhibou";
+ break;
+ case 9:
+ name = "Tagant";
+ break;
+ case 10:
+ name = "Guidimaka";
+ break;
+ case 11:
+ name = "Tiris Zemmour";
+ break;
+ case 12:
+ name = "Inchiri";
+ break;
+ }
+ }
+ if (strcmp(country_code,"MS") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Saint Anthony";
+ break;
+ case 2:
+ name = "Saint Georges";
+ break;
+ case 3:
+ name = "Saint Peter";
+ break;
+ }
+ }
+ if (strcmp(country_code,"MU") == 0) {
+ switch (region_code2) {
+ case 12:
+ name = "Black River";
+ break;
+ case 13:
+ name = "Flacq";
+ break;
+ case 14:
+ name = "Grand Port";
+ break;
+ case 15:
+ name = "Moka";
+ break;
+ case 16:
+ name = "Pamplemousses";
+ break;
+ case 17:
+ name = "Plaines Wilhems";
+ break;
+ case 18:
+ name = "Port Louis";
+ break;
+ case 19:
+ name = "Riviere du Rempart";
+ break;
+ case 20:
+ name = "Savanne";
+ break;
+ case 21:
+ name = "Agalega Islands";
+ break;
+ case 22:
+ name = "Cargados Carajos";
+ break;
+ case 23:
+ name = "Rodrigues";
+ break;
+ }
+ }
+ if (strcmp(country_code,"MV") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Seenu";
+ break;
+ case 2:
+ name = "Aliff";
+ break;
+ case 3:
+ name = "Laviyani";
+ break;
+ case 4:
+ name = "Waavu";
+ break;
+ case 5:
+ name = "Laamu";
+ break;
+ case 7:
+ name = "Haa Aliff";
+ break;
+ case 8:
+ name = "Thaa";
+ break;
+ case 12:
+ name = "Meemu";
+ break;
+ case 13:
+ name = "Raa";
+ break;
+ case 14:
+ name = "Faafu";
+ break;
+ case 17:
+ name = "Daalu";
+ break;
+ case 20:
+ name = "Baa";
+ break;
+ case 23:
+ name = "Haa Daalu";
+ break;
+ case 24:
+ name = "Shaviyani";
+ break;
+ case 25:
+ name = "Noonu";
+ break;
+ case 26:
+ name = "Kaafu";
+ break;
+ case 27:
+ name = "Gaafu Aliff";
+ break;
+ case 28:
+ name = "Gaafu Daalu";
+ break;
+ case 29:
+ name = "Naviyani";
+ break;
+ }
+ }
+ if (strcmp(country_code,"MW") == 0) {
+ switch (region_code2) {
+ case 2:
+ name = "Chikwawa";
+ break;
+ case 3:
+ name = "Chiradzulu";
+ break;
+ case 4:
+ name = "Chitipa";
+ break;
+ case 5:
+ name = "Thyolo";
+ break;
+ case 6:
+ name = "Dedza";
+ break;
+ case 7:
+ name = "Dowa";
+ break;
+ case 8:
+ name = "Karonga";
+ break;
+ case 9:
+ name = "Kasungu";
+ break;
+ case 11:
+ name = "Lilongwe";
+ break;
+ case 12:
+ name = "Mangochi";
+ break;
+ case 13:
+ name = "Mchinji";
+ break;
+ case 15:
+ name = "Mzimba";
+ break;
+ case 16:
+ name = "Ntcheu";
+ break;
+ case 17:
+ name = "Nkhata Bay";
+ break;
+ case 18:
+ name = "Nkhotakota";
+ break;
+ case 19:
+ name = "Nsanje";
+ break;
+ case 20:
+ name = "Ntchisi";
+ break;
+ case 21:
+ name = "Rumphi";
+ break;
+ case 22:
+ name = "Salima";
+ break;
+ case 23:
+ name = "Zomba";
+ break;
+ case 24:
+ name = "Blantyre";
+ break;
+ case 25:
+ name = "Mwanza";
+ break;
+ case 26:
+ name = "Balaka";
+ break;
+ case 27:
+ name = "Likoma";
+ break;
+ case 28:
+ name = "Machinga";
+ break;
+ case 29:
+ name = "Mulanje";
+ break;
+ case 30:
+ name = "Phalombe";
+ break;
+ }
+ }
+ if (strcmp(country_code,"MX") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Aguascalientes";
+ break;
+ case 2:
+ name = "Baja California";
+ break;
+ case 3:
+ name = "Baja California Sur";
+ break;
+ case 4:
+ name = "Campeche";
+ break;
+ case 5:
+ name = "Chiapas";
+ break;
+ case 6:
+ name = "Chihuahua";
+ break;
+ case 7:
+ name = "Coahuila de Zaragoza";
+ break;
+ case 8:
+ name = "Colima";
+ break;
+ case 9:
+ name = "Distrito Federal";
+ break;
+ case 10:
+ name = "Durango";
+ break;
+ case 11:
+ name = "Guanajuato";
+ break;
+ case 12:
+ name = "Guerrero";
+ break;
+ case 13:
+ name = "Hidalgo";
+ break;
+ case 14:
+ name = "Jalisco";
+ break;
+ case 15:
+ name = "Mexico";
+ break;
+ case 16:
+ name = "Michoacan de Ocampo";
+ break;
+ case 17:
+ name = "Morelos";
+ break;
+ case 18:
+ name = "Nayarit";
+ break;
+ case 19:
+ name = "Nuevo Leon";
+ break;
+ case 20:
+ name = "Oaxaca";
+ break;
+ case 21:
+ name = "Puebla";
+ break;
+ case 22:
+ name = "Queretaro de Arteaga";
+ break;
+ case 23:
+ name = "Quintana Roo";
+ break;
+ case 24:
+ name = "San Luis Potosi";
+ break;
+ case 25:
+ name = "Sinaloa";
+ break;
+ case 26:
+ name = "Sonora";
+ break;
+ case 27:
+ name = "Tabasco";
+ break;
+ case 28:
+ name = "Tamaulipas";
+ break;
+ case 29:
+ name = "Tlaxcala";
+ break;
+ case 30:
+ name = "Veracruz-Llave";
+ break;
+ case 31:
+ name = "Yucatan";
+ break;
+ case 32:
+ name = "Zacatecas";
+ break;
+ }
+ }
+ if (strcmp(country_code,"MY") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Johor";
+ break;
+ case 2:
+ name = "Kedah";
+ break;
+ case 3:
+ name = "Kelantan";
+ break;
+ case 4:
+ name = "Melaka";
+ break;
+ case 5:
+ name = "Negeri Sembilan";
+ break;
+ case 6:
+ name = "Pahang";
+ break;
+ case 7:
+ name = "Perak";
+ break;
+ case 8:
+ name = "Perlis";
+ break;
+ case 9:
+ name = "Pulau Pinang";
+ break;
+ case 11:
+ name = "Sarawak";
+ break;
+ case 12:
+ name = "Selangor";
+ break;
+ case 13:
+ name = "Terengganu";
+ break;
+ case 14:
+ name = "Wilayah Persekutuan";
+ break;
+ case 15:
+ name = "Labuan";
+ break;
+ case 16:
+ name = "Sabah";
+ break;
+ }
+ }
+ if (strcmp(country_code,"MZ") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Cabo Delgado";
+ break;
+ case 2:
+ name = "Gaza";
+ break;
+ case 3:
+ name = "Inhambane";
+ break;
+ case 4:
+ name = "Maputo";
+ break;
+ case 5:
+ name = "Sofala";
+ break;
+ case 6:
+ name = "Nampula";
+ break;
+ case 7:
+ name = "Niassa";
+ break;
+ case 8:
+ name = "Tete";
+ break;
+ case 9:
+ name = "Zambezia";
+ break;
+ case 10:
+ name = "Manica";
+ break;
+ }
+ }
+ if (strcmp(country_code,"NA") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Bethanien";
+ break;
+ case 2:
+ name = "Caprivi Oos";
+ break;
+ case 3:
+ name = "Boesmanland";
+ break;
+ case 4:
+ name = "Gobabis";
+ break;
+ case 5:
+ name = "Grootfontein";
+ break;
+ case 6:
+ name = "Kaokoland";
+ break;
+ case 7:
+ name = "Karibib";
+ break;
+ case 8:
+ name = "Keetmanshoop";
+ break;
+ case 9:
+ name = "Luderitz";
+ break;
+ case 10:
+ name = "Maltahohe";
+ break;
+ case 11:
+ name = "Okahandja";
+ break;
+ case 12:
+ name = "Omaruru";
+ break;
+ case 13:
+ name = "Otjiwarongo";
+ break;
+ case 14:
+ name = "Outjo";
+ break;
+ case 15:
+ name = "Owambo";
+ break;
+ case 16:
+ name = "Rehoboth";
+ break;
+ case 17:
+ name = "Swakopmund";
+ break;
+ case 18:
+ name = "Tsumeb";
+ break;
+ case 20:
+ name = "Karasburg";
+ break;
+ case 21:
+ name = "Windhoek";
+ break;
+ case 22:
+ name = "Damaraland";
+ break;
+ case 23:
+ name = "Hereroland Oos";
+ break;
+ case 24:
+ name = "Hereroland Wes";
+ break;
+ case 25:
+ name = "Kavango";
+ break;
+ case 26:
+ name = "Mariental";
+ break;
+ case 27:
+ name = "Namaland";
+ break;
+ case 28:
+ name = "Caprivi";
+ break;
+ case 29:
+ name = "Erongo";
+ break;
+ case 30:
+ name = "Hardap";
+ break;
+ case 31:
+ name = "Karas";
+ break;
+ case 32:
+ name = "Kunene";
+ break;
+ case 33:
+ name = "Ohangwena";
+ break;
+ case 34:
+ name = "Okavango";
+ break;
+ case 35:
+ name = "Omaheke";
+ break;
+ case 36:
+ name = "Omusati";
+ break;
+ case 37:
+ name = "Oshana";
+ break;
+ case 38:
+ name = "Oshikoto";
+ break;
+ case 39:
+ name = "Otjozondjupa";
+ break;
+ }
+ }
+ if (strcmp(country_code,"NE") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Agadez";
+ break;
+ case 2:
+ name = "Diffa";
+ break;
+ case 3:
+ name = "Dosso";
+ break;
+ case 4:
+ name = "Maradi";
+ break;
+ case 5:
+ name = "Niamey";
+ break;
+ case 6:
+ name = "Tahoua";
+ break;
+ case 7:
+ name = "Zinder";
+ break;
+ }
+ }
+ if (strcmp(country_code,"NG") == 0) {
+ switch (region_code2) {
+ case 5:
+ name = "Lagos";
+ break;
+ case 11:
+ name = "Abuja Capital Territory";
+ break;
+ case 16:
+ name = "Ogun";
+ break;
+ case 21:
+ name = "Akwa Ibom";
+ break;
+ case 22:
+ name = "Cross River";
+ break;
+ case 23:
+ name = "Kaduna";
+ break;
+ case 24:
+ name = "Katsina";
+ break;
+ case 25:
+ name = "Anambra";
+ break;
+ case 26:
+ name = "Benue";
+ break;
+ case 27:
+ name = "Borno";
+ break;
+ case 28:
+ name = "Imo";
+ break;
+ case 29:
+ name = "Kano";
+ break;
+ case 30:
+ name = "Kwara";
+ break;
+ case 31:
+ name = "Niger";
+ break;
+ case 32:
+ name = "Oyo";
+ break;
+ case 35:
+ name = "Adamawa";
+ break;
+ case 36:
+ name = "Delta";
+ break;
+ case 37:
+ name = "Edo";
+ break;
+ case 39:
+ name = "Jigawa";
+ break;
+ case 40:
+ name = "Kebbi";
+ break;
+ case 41:
+ name = "Kogi";
+ break;
+ case 42:
+ name = "Osun";
+ break;
+ case 43:
+ name = "Taraba";
+ break;
+ case 44:
+ name = "Yobe";
+ break;
+ case 45:
+ name = "Abia";
+ break;
+ case 46:
+ name = "Bauchi";
+ break;
+ case 47:
+ name = "Enugu";
+ break;
+ case 48:
+ name = "Ondo";
+ break;
+ case 49:
+ name = "Plateau";
+ break;
+ case 50:
+ name = "Rivers";
+ break;
+ case 51:
+ name = "Sokoto";
+ break;
+ case 52:
+ name = "Bayelsa";
+ break;
+ case 53:
+ name = "Ebonyi";
+ break;
+ case 54:
+ name = "Ekiti";
+ break;
+ case 55:
+ name = "Gombe";
+ break;
+ case 56:
+ name = "Nassarawa";
+ break;
+ case 57:
+ name = "Zamfara";
+ break;
+ }
+ }
+ if (strcmp(country_code,"NI") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Boaco";
+ break;
+ case 2:
+ name = "Carazo";
+ break;
+ case 3:
+ name = "Chinandega";
+ break;
+ case 4:
+ name = "Chontales";
+ break;
+ case 5:
+ name = "Esteli";
+ break;
+ case 6:
+ name = "Granada";
+ break;
+ case 7:
+ name = "Jinotega";
+ break;
+ case 8:
+ name = "Leon";
+ break;
+ case 9:
+ name = "Madriz";
+ break;
+ case 10:
+ name = "Managua";
+ break;
+ case 11:
+ name = "Masaya";
+ break;
+ case 12:
+ name = "Matagalpa";
+ break;
+ case 13:
+ name = "Nueva Segovia";
+ break;
+ case 14:
+ name = "Rio San Juan";
+ break;
+ case 15:
+ name = "Rivas";
+ break;
+ case 16:
+ name = "Zelaya";
+ break;
+ }
+ }
+ if (strcmp(country_code,"NL") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Drenthe";
+ break;
+ case 2:
+ name = "Friesland";
+ break;
+ case 3:
+ name = "Gelderland";
+ break;
+ case 4:
+ name = "Groningen";
+ break;
+ case 5:
+ name = "Limburg";
+ break;
+ case 6:
+ name = "Noord-Brabant";
+ break;
+ case 7:
+ name = "Noord-Holland";
+ break;
+ case 8:
+ name = "Overijssel";
+ break;
+ case 9:
+ name = "Utrecht";
+ break;
+ case 10:
+ name = "Zeeland";
+ break;
+ case 11:
+ name = "Zuid-Holland";
+ break;
+ case 12:
+ name = "Dronten";
+ break;
+ case 13:
+ name = "Zuidelijke IJsselmeerpolders";
+ break;
+ case 14:
+ name = "Lelystad";
+ break;
+ case 15:
+ name = "Overijssel";
+ break;
+ case 16:
+ name = "Flevoland";
+ break;
+ }
+ }
+ if (strcmp(country_code,"NO") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Akershus";
+ break;
+ case 2:
+ name = "Aust-Agder";
+ break;
+ case 4:
+ name = "Buskerud";
+ break;
+ case 5:
+ name = "Finnmark";
+ break;
+ case 6:
+ name = "Hedmark";
+ break;
+ case 7:
+ name = "Hordaland";
+ break;
+ case 8:
+ name = "More og Romsdal";
+ break;
+ case 9:
+ name = "Nordland";
+ break;
+ case 10:
+ name = "Nord-Trondelag";
+ break;
+ case 11:
+ name = "Oppland";
+ break;
+ case 12:
+ name = "Oslo";
+ break;
+ case 13:
+ name = "Ostfold";
+ break;
+ case 14:
+ name = "Rogaland";
+ break;
+ case 15:
+ name = "Sogn og Fjordane";
+ break;
+ case 16:
+ name = "Sor-Trondelag";
+ break;
+ case 17:
+ name = "Telemark";
+ break;
+ case 18:
+ name = "Troms";
+ break;
+ case 19:
+ name = "Vest-Agder";
+ break;
+ case 20:
+ name = "Vestfold";
+ break;
+ }
+ }
+ if (strcmp(country_code,"NP") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Bagmati";
+ break;
+ case 2:
+ name = "Bheri";
+ break;
+ case 3:
+ name = "Dhawalagiri";
+ break;
+ case 4:
+ name = "Gandaki";
+ break;
+ case 5:
+ name = "Janakpur";
+ break;
+ case 6:
+ name = "Karnali";
+ break;
+ case 7:
+ name = "Kosi";
+ break;
+ case 8:
+ name = "Lumbini";
+ break;
+ case 9:
+ name = "Mahakali";
+ break;
+ case 10:
+ name = "Mechi";
+ break;
+ case 11:
+ name = "Narayani";
+ break;
+ case 12:
+ name = "Rapti";
+ break;
+ case 13:
+ name = "Sagarmatha";
+ break;
+ case 14:
+ name = "Seti";
+ break;
+ }
+ }
+ if (strcmp(country_code,"NR") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Aiwo";
+ break;
+ case 2:
+ name = "Anabar";
+ break;
+ case 3:
+ name = "Anetan";
+ break;
+ case 4:
+ name = "Anibare";
+ break;
+ case 5:
+ name = "Baiti";
+ break;
+ case 6:
+ name = "Boe";
+ break;
+ case 7:
+ name = "Buada";
+ break;
+ case 8:
+ name = "Denigomodu";
+ break;
+ case 9:
+ name = "Ewa";
+ break;
+ case 10:
+ name = "Ijuw";
+ break;
+ case 11:
+ name = "Meneng";
+ break;
+ case 12:
+ name = "Nibok";
+ break;
+ case 13:
+ name = "Uaboe";
+ break;
+ case 14:
+ name = "Yaren";
+ break;
+ }
+ }
+ if (strcmp(country_code,"NZ") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Akaroa";
+ break;
+ case 3:
+ name = "Amuri";
+ break;
+ case 4:
+ name = "Ashburton";
+ break;
+ case 7:
+ name = "Bay of Islands";
+ break;
+ case 8:
+ name = "Bruce";
+ break;
+ case 9:
+ name = "Buller";
+ break;
+ case 10:
+ name = "Chatham Islands";
+ break;
+ case 11:
+ name = "Cheviot";
+ break;
+ case 12:
+ name = "Clifton";
+ break;
+ case 13:
+ name = "Clutha";
+ break;
+ case 14:
+ name = "Cook";
+ break;
+ case 16:
+ name = "Dannevirke";
+ break;
+ case 17:
+ name = "Egmont";
+ break;
+ case 18:
+ name = "Eketahuna";
+ break;
+ case 19:
+ name = "Ellesmere";
+ break;
+ case 20:
+ name = "Eltham";
+ break;
+ case 21:
+ name = "Eyre";
+ break;
+ case 22:
+ name = "Featherston";
+ break;
+ case 24:
+ name = "Franklin";
+ break;
+ case 26:
+ name = "Golden Bay";
+ break;
+ case 27:
+ name = "Great Barrier Island";
+ break;
+ case 28:
+ name = "Grey";
+ break;
+ case 29:
+ name = "Hauraki Plains";
+ break;
+ case 30:
+ name = "Hawera";
+ break;
+ case 31:
+ name = "Hawke's Bay";
+ break;
+ case 32:
+ name = "Heathcote";
+ break;
+ case 33:
+ name = "Hobson";
+ break;
+ case 34:
+ name = "Hokianga";
+ break;
+ case 35:
+ name = "Horowhenua";
+ break;
+ case 36:
+ name = "Hutt";
+ break;
+ case 37:
+ name = "Inangahua";
+ break;
+ case 38:
+ name = "Inglewood";
+ break;
+ case 39:
+ name = "Kaikoura";
+ break;
+ case 40:
+ name = "Kairanga";
+ break;
+ case 41:
+ name = "Kiwitea";
+ break;
+ case 43:
+ name = "Lake";
+ break;
+ case 45:
+ name = "Mackenzie";
+ break;
+ case 46:
+ name = "Malvern";
+ break;
+ case 47:
+ name = "Manawatu";
+ break;
+ case 48:
+ name = "Mangonui";
+ break;
+ case 49:
+ name = "Maniototo";
+ break;
+ case 50:
+ name = "Marlborough";
+ break;
+ case 51:
+ name = "Masterton";
+ break;
+ case 52:
+ name = "Matamata";
+ break;
+ case 53:
+ name = "Mount Herbert";
+ break;
+ case 54:
+ name = "Ohinemuri";
+ break;
+ case 55:
+ name = "Opotiki";
+ break;
+ case 56:
+ name = "Oroua";
+ break;
+ case 57:
+ name = "Otamatea";
+ break;
+ case 58:
+ name = "Otorohanga";
+ break;
+ case 59:
+ name = "Oxford";
+ break;
+ case 60:
+ name = "Pahiatua";
+ break;
+ case 61:
+ name = "Paparua";
+ break;
+ case 63:
+ name = "Patea";
+ break;
+ case 65:
+ name = "Piako";
+ break;
+ case 66:
+ name = "Pohangina";
+ break;
+ case 67:
+ name = "Raglan";
+ break;
+ case 68:
+ name = "Rangiora";
+ break;
+ case 69:
+ name = "Rangitikei";
+ break;
+ case 70:
+ name = "Rodney";
+ break;
+ case 71:
+ name = "Rotorua";
+ break;
+ case 72:
+ name = "Southland";
+ break;
+ case 73:
+ name = "Stewart Island";
+ break;
+ case 74:
+ name = "Stratford";
+ break;
+ case 76:
+ name = "Taranaki";
+ break;
+ case 77:
+ name = "Taumarunui";
+ break;
+ case 78:
+ name = "Taupo";
+ break;
+ case 79:
+ name = "Tauranga";
+ break;
+ case 81:
+ name = "Tuapeka";
+ break;
+ case 82:
+ name = "Vincent";
+ break;
+ case 83:
+ name = "Waiapu";
+ break;
+ case 84:
+ name = "Waihemo";
+ break;
+ case 85:
+ name = "Waikato";
+ break;
+ case 86:
+ name = "Waikohu";
+ break;
+ case 88:
+ name = "Waimairi";
+ break;
+ case 89:
+ name = "Waimarino";
+ break;
+ case 90:
+ name = "Waimate";
+ break;
+ case 91:
+ name = "Waimate West";
+ break;
+ case 92:
+ name = "Waimea";
+ break;
+ case 93:
+ name = "Waipa";
+ break;
+ case 95:
+ name = "Waipawa";
+ break;
+ case 96:
+ name = "Waipukurau";
+ break;
+ case 97:
+ name = "Wairarapa South";
+ break;
+ case 98:
+ name = "Wairewa";
+ break;
+ case 99:
+ name = "Wairoa";
+ break;
+ case 101:
+ name = "Whangarei";
+ break;
+ case 102:
+ name = "Whangaroa";
+ break;
+ case 103:
+ name = "Woodville";
+ break;
+ case 104:
+ name = "Waitaki";
+ break;
+ case 106:
+ name = "Waitomo";
+ break;
+ case 108:
+ name = "Waitotara";
+ break;
+ case 112:
+ name = "Wanganui";
+ break;
+ case 113:
+ name = "Westland";
+ break;
+ case 114:
+ name = "Whakatane";
+ break;
+ case 134:
+ name = "Hurunui";
+ break;
+ case 135:
+ name = "Silverpeaks";
+ break;
+ case 136:
+ name = "Strathallan";
+ break;
+ case 138:
+ name = "Waiheke";
+ break;
+ case 139:
+ name = "Hikurangi";
+ break;
+ case 141:
+ name = "Manaia";
+ break;
+ case 142:
+ name = "Runanga";
+ break;
+ case 143:
+ name = "Saint Kilda";
+ break;
+ case 144:
+ name = "Thames-Coromandel";
+ break;
+ case 145:
+ name = "Waverley";
+ break;
+ case 146:
+ name = "Wallace";
+ break;
+ }
+ }
+ if (strcmp(country_code,"OM") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Ad Dakhiliyah";
+ break;
+ case 2:
+ name = "Al Batinah";
+ break;
+ case 3:
+ name = "Al Wusta";
+ break;
+ case 4:
+ name = "Ash Sharqiyah";
+ break;
+ case 5:
+ name = "Az Zahirah";
+ break;
+ case 6:
+ name = "Masqat";
+ break;
+ case 7:
+ name = "Musandam";
+ break;
+ case 8:
+ name = "Zufar";
+ break;
+ }
+ }
+ if (strcmp(country_code,"PA") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Bocas del Toro";
+ break;
+ case 2:
+ name = "Chiriqui";
+ break;
+ case 3:
+ name = "Cocle";
+ break;
+ case 4:
+ name = "Colon";
+ break;
+ case 5:
+ name = "Darien";
+ break;
+ case 6:
+ name = "Herrera";
+ break;
+ case 7:
+ name = "Los Santos";
+ break;
+ case 8:
+ name = "Panama";
+ break;
+ case 9:
+ name = "San Blas";
+ break;
+ case 10:
+ name = "Veraguas";
+ break;
+ }
+ }
+ if (strcmp(country_code,"PE") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Amazonas";
+ break;
+ case 2:
+ name = "Ancash";
+ break;
+ case 3:
+ name = "Apurimac";
+ break;
+ case 4:
+ name = "Arequipa";
+ break;
+ case 5:
+ name = "Ayacucho";
+ break;
+ case 6:
+ name = "Cajamarca";
+ break;
+ case 7:
+ name = "Callao";
+ break;
+ case 8:
+ name = "Cusco";
+ break;
+ case 9:
+ name = "Huancavelica";
+ break;
+ case 10:
+ name = "Huanuco";
+ break;
+ case 11:
+ name = "Ica";
+ break;
+ case 12:
+ name = "Junin";
+ break;
+ case 13:
+ name = "La Libertad";
+ break;
+ case 14:
+ name = "Lambayeque";
+ break;
+ case 15:
+ name = "Lima";
+ break;
+ case 16:
+ name = "Loreto";
+ break;
+ case 17:
+ name = "Madre de Dios";
+ break;
+ case 18:
+ name = "Moquegua";
+ break;
+ case 19:
+ name = "Pasco";
+ break;
+ case 20:
+ name = "Piura";
+ break;
+ case 21:
+ name = "Puno";
+ break;
+ case 22:
+ name = "San Martin";
+ break;
+ case 23:
+ name = "Tacna";
+ break;
+ case 24:
+ name = "Tumbes";
+ break;
+ case 25:
+ name = "Ucayali";
+ break;
+ }
+ }
+ if (strcmp(country_code,"PG") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Central";
+ break;
+ case 2:
+ name = "Gulf";
+ break;
+ case 3:
+ name = "Milne Bay";
+ break;
+ case 4:
+ name = "Northern";
+ break;
+ case 5:
+ name = "Southern Highlands";
+ break;
+ case 6:
+ name = "Western";
+ break;
+ case 7:
+ name = "North Solomons";
+ break;
+ case 8:
+ name = "Chimbu";
+ break;
+ case 9:
+ name = "Eastern Highlands";
+ break;
+ case 10:
+ name = "East New Britain";
+ break;
+ case 11:
+ name = "East Sepik";
+ break;
+ case 12:
+ name = "Madang";
+ break;
+ case 13:
+ name = "Manus";
+ break;
+ case 14:
+ name = "Morobe";
+ break;
+ case 15:
+ name = "New Ireland";
+ break;
+ case 16:
+ name = "Western Highlands";
+ break;
+ case 17:
+ name = "West New Britain";
+ break;
+ case 18:
+ name = "Sandaun";
+ break;
+ case 19:
+ name = "Enga";
+ break;
+ case 20:
+ name = "National Capital";
+ break;
+ }
+ }
+ if (strcmp(country_code,"PH") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Abra";
+ break;
+ case 2:
+ name = "Agusan del Norte";
+ break;
+ case 3:
+ name = "Agusan del Sur";
+ break;
+ case 4:
+ name = "Aklan";
+ break;
+ case 5:
+ name = "Albay";
+ break;
+ case 6:
+ name = "Antique";
+ break;
+ case 7:
+ name = "Bataan";
+ break;
+ case 8:
+ name = "Batanes";
+ break;
+ case 9:
+ name = "Batangas";
+ break;
+ case 10:
+ name = "Benguet";
+ break;
+ case 11:
+ name = "Bohol";
+ break;
+ case 12:
+ name = "Bukidnon";
+ break;
+ case 13:
+ name = "Bulacan";
+ break;
+ case 14:
+ name = "Cagayan";
+ break;
+ case 15:
+ name = "Camarines Norte";
+ break;
+ case 16:
+ name = "Camarines Sur";
+ break;
+ case 17:
+ name = "Camiguin";
+ break;
+ case 18:
+ name = "Capiz";
+ break;
+ case 19:
+ name = "Catanduanes";
+ break;
+ case 20:
+ name = "Cavite";
+ break;
+ case 21:
+ name = "Cebu";
+ break;
+ case 22:
+ name = "Basilan";
+ break;
+ case 23:
+ name = "Eastern Samar";
+ break;
+ case 24:
+ name = "Davao";
+ break;
+ case 25:
+ name = "Davao del Sur";
+ break;
+ case 26:
+ name = "Davao Oriental";
+ break;
+ case 27:
+ name = "Ifugao";
+ break;
+ case 28:
+ name = "Ilocos Norte";
+ break;
+ case 29:
+ name = "Ilocos Sur";
+ break;
+ case 30:
+ name = "Iloilo";
+ break;
+ case 31:
+ name = "Isabela";
+ break;
+ case 32:
+ name = "Kalinga-Apayao";
+ break;
+ case 33:
+ name = "Laguna";
+ break;
+ case 34:
+ name = "Lanao del Norte";
+ break;
+ case 35:
+ name = "Lanao del Sur";
+ break;
+ case 36:
+ name = "La Union";
+ break;
+ case 37:
+ name = "Leyte";
+ break;
+ case 38:
+ name = "Marinduque";
+ break;
+ case 39:
+ name = "Masbate";
+ break;
+ case 40:
+ name = "Mindoro Occidental";
+ break;
+ case 41:
+ name = "Mindoro Oriental";
+ break;
+ case 42:
+ name = "Misamis Occidental";
+ break;
+ case 43:
+ name = "Misamis Oriental";
+ break;
+ case 44:
+ name = "Mountain";
+ break;
+ case 46:
+ name = "Negros Oriental";
+ break;
+ case 47:
+ name = "Nueva Ecija";
+ break;
+ case 48:
+ name = "Nueva Vizcaya";
+ break;
+ case 49:
+ name = "Palawan";
+ break;
+ case 50:
+ name = "Pampanga";
+ break;
+ case 51:
+ name = "Pangasinan";
+ break;
+ case 53:
+ name = "Rizal";
+ break;
+ case 54:
+ name = "Romblon";
+ break;
+ case 55:
+ name = "Samar";
+ break;
+ case 56:
+ name = "Maguindanao";
+ break;
+ case 57:
+ name = "North Cotabato";
+ break;
+ case 58:
+ name = "Sorsogon";
+ break;
+ case 59:
+ name = "Southern Leyte";
+ break;
+ case 60:
+ name = "Sulu";
+ break;
+ case 61:
+ name = "Surigao del Norte";
+ break;
+ case 62:
+ name = "Surigao del Sur";
+ break;
+ case 63:
+ name = "Tarlac";
+ break;
+ case 64:
+ name = "Zambales";
+ break;
+ case 65:
+ name = "Zamboanga del Norte";
+ break;
+ case 66:
+ name = "Zamboanga del Sur";
+ break;
+ case 67:
+ name = "Northern Samar";
+ break;
+ case 68:
+ name = "Quirino";
+ break;
+ case 69:
+ name = "Siquijor";
+ break;
+ case 70:
+ name = "South Cotabato";
+ break;
+ case 71:
+ name = "Sultan Kudarat";
+ break;
+ case 72:
+ name = "Tawitawi";
+ break;
+ case 101:
+ name = "Angeles";
+ break;
+ case 102:
+ name = "Bacolod";
+ break;
+ case 103:
+ name = "Bago";
+ break;
+ case 104:
+ name = "Baguio";
+ break;
+ case 105:
+ name = "Bais";
+ break;
+ case 106:
+ name = "Basilan City";
+ break;
+ case 107:
+ name = "Batangas City";
+ break;
+ case 108:
+ name = "Butuan";
+ break;
+ case 109:
+ name = "Cabanatuan";
+ break;
+ case 111:
+ name = "Cadiz";
+ break;
+ case 112:
+ name = "Cagayan de Oro";
+ break;
+ case 113:
+ name = "Calbayog";
+ break;
+ case 114:
+ name = "Caloocan";
+ break;
+ case 115:
+ name = "Canlaon";
+ break;
+ case 116:
+ name = "Cavite City";
+ break;
+ case 117:
+ name = "Cebu City";
+ break;
+ case 118:
+ name = "Cotabato";
+ break;
+ case 119:
+ name = "Dagupan";
+ break;
+ case 121:
+ name = "Danao";
+ break;
+ case 122:
+ name = "Dapitan";
+ break;
+ case 123:
+ name = "Davao City";
+ break;
+ case 124:
+ name = "Dipolog";
+ break;
+ case 125:
+ name = "Dumaguete";
+ break;
+ case 126:
+ name = "General Santos";
+ break;
+ case 127:
+ name = "Gingoog";
+ break;
+ case 128:
+ name = "Iligan";
+ break;
+ case 129:
+ name = "Iloilo City";
+ break;
+ case 131:
+ name = "Iriga";
+ break;
+ case 132:
+ name = "La Carlota";
+ break;
+ case 133:
+ name = "Laoag";
+ break;
+ case 134:
+ name = "Lapu-Lapu";
+ break;
+ case 135:
+ name = "Legaspi";
+ break;
+ case 136:
+ name = "Lipa";
+ break;
+ case 137:
+ name = "Lucena";
+ break;
+ case 138:
+ name = "Mandaue";
+ break;
+ case 139:
+ name = "Manila";
+ break;
+ case 141:
+ name = "Marawi";
+ break;
+ case 142:
+ name = "Naga";
+ break;
+ case 143:
+ name = "Olongapo";
+ break;
+ case 144:
+ name = "Ormoc";
+ break;
+ case 145:
+ name = "Oroquieta";
+ break;
+ case 146:
+ name = "Ozamis";
+ break;
+ case 147:
+ name = "Pagadian";
+ break;
+ case 148:
+ name = "Palayan";
+ break;
+ case 149:
+ name = "Pasay";
+ break;
+ case 151:
+ name = "Puerto Princesa";
+ break;
+ case 152:
+ name = "Quezon City";
+ break;
+ case 153:
+ name = "Roxas";
+ break;
+ case 154:
+ name = "San Carlos";
+ break;
+ case 155:
+ name = "San Carlos";
+ break;
+ case 156:
+ name = "San Jose";
+ break;
+ case 157:
+ name = "San Pablo";
+ break;
+ case 158:
+ name = "Silay";
+ break;
+ case 159:
+ name = "Surigao";
+ break;
+ case 161:
+ name = "Tacloban";
+ break;
+ case 162:
+ name = "Tagaytay";
+ break;
+ case 163:
+ name = "Tagbilaran";
+ break;
+ case 164:
+ name = "Tangub";
+ break;
+ case 165:
+ name = "Toledo";
+ break;
+ case 166:
+ name = "Trece Martires";
+ break;
+ case 167:
+ name = "Zamboanga";
+ break;
+ case 168:
+ name = "Aurora";
+ break;
+ case 172:
+ name = "Quezon";
+ break;
+ case 173:
+ name = "Negros Occidental";
+ break;
+ }
+ }
+ if (strcmp(country_code,"PK") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Federally Administered Tribal Areas";
+ break;
+ case 2:
+ name = "Balochistan";
+ break;
+ case 3:
+ name = "North-West Frontier";
+ break;
+ case 4:
+ name = "Punjab";
+ break;
+ case 5:
+ name = "Sindh";
+ break;
+ case 6:
+ name = "Azad Kashmir";
+ break;
+ case 7:
+ name = "Northern Areas";
+ break;
+ case 8:
+ name = "Islamabad";
+ break;
+ }
+ }
+ if (strcmp(country_code,"PL") == 0) {
+ switch (region_code2) {
+ case 23:
+ name = "Biala Podlaska";
+ break;
+ case 24:
+ name = "Bialystok";
+ break;
+ case 25:
+ name = "Bielsko";
+ break;
+ case 26:
+ name = "Bydgoszcz";
+ break;
+ case 27:
+ name = "Chelm";
+ break;
+ case 28:
+ name = "Ciechanow";
+ break;
+ case 29:
+ name = "Czestochowa";
+ break;
+ case 30:
+ name = "Elblag";
+ break;
+ case 31:
+ name = "Gdansk";
+ break;
+ case 32:
+ name = "Gorzow";
+ break;
+ case 33:
+ name = "Jelenia Gora";
+ break;
+ case 34:
+ name = "Kalisz";
+ break;
+ case 35:
+ name = "Katowice";
+ break;
+ case 36:
+ name = "Kielce";
+ break;
+ case 37:
+ name = "Konin";
+ break;
+ case 38:
+ name = "Koszalin";
+ break;
+ case 39:
+ name = "Krakow";
+ break;
+ case 40:
+ name = "Krosno";
+ break;
+ case 41:
+ name = "Legnica";
+ break;
+ case 42:
+ name = "Leszno";
+ break;
+ case 43:
+ name = "Lodz";
+ break;
+ case 44:
+ name = "Lomza";
+ break;
+ case 45:
+ name = "Lublin";
+ break;
+ case 46:
+ name = "Nowy Sacz";
+ break;
+ case 47:
+ name = "Olsztyn";
+ break;
+ case 48:
+ name = "Opole";
+ break;
+ case 49:
+ name = "Ostroleka";
+ break;
+ case 50:
+ name = "Pila";
+ break;
+ case 51:
+ name = "Piotrkow";
+ break;
+ case 52:
+ name = "Plock";
+ break;
+ case 53:
+ name = "Poznan";
+ break;
+ case 54:
+ name = "Przemysl";
+ break;
+ case 55:
+ name = "Radom";
+ break;
+ case 56:
+ name = "Rzeszow";
+ break;
+ case 57:
+ name = "Siedlce";
+ break;
+ case 58:
+ name = "Sieradz";
+ break;
+ case 59:
+ name = "Skierniewice";
+ break;
+ case 60:
+ name = "Slupsk";
+ break;
+ case 61:
+ name = "Suwalki";
+ break;
+ case 62:
+ name = "Szczecin";
+ break;
+ case 63:
+ name = "Tarnobrzeg";
+ break;
+ case 64:
+ name = "Tarnow";
+ break;
+ case 65:
+ name = "Torun";
+ break;
+ case 66:
+ name = "Walbrzych";
+ break;
+ case 67:
+ name = "Warszawa";
+ break;
+ case 68:
+ name = "Wloclawek";
+ break;
+ case 69:
+ name = "Wroclaw";
+ break;
+ case 70:
+ name = "Zamosc";
+ break;
+ case 71:
+ name = "Zielona Gora";
+ break;
+ case 72:
+ name = "Dolnoslaskie";
+ break;
+ case 73:
+ name = "Kujawsko-Pomorskie";
+ break;
+ case 74:
+ name = "Lodzkie";
+ break;
+ case 75:
+ name = "Lubelskie";
+ break;
+ case 76:
+ name = "Lubuskie";
+ break;
+ case 77:
+ name = "Malopolskie";
+ break;
+ case 78:
+ name = "Mazowieckie";
+ break;
+ case 79:
+ name = "Opolskie";
+ break;
+ case 80:
+ name = "Podkarpackie";
+ break;
+ case 81:
+ name = "Podlaskie";
+ break;
+ case 82:
+ name = "Pomorskie";
+ break;
+ case 83:
+ name = "Slaskie";
+ break;
+ case 84:
+ name = "Swietokrzyskie";
+ break;
+ case 85:
+ name = "Warminsko-Mazurskie";
+ break;
+ case 86:
+ name = "Wielkopolskie";
+ break;
+ case 87:
+ name = "Zachodniopomorskie";
+ break;
+ }
+ }
+ if (strcmp(country_code,"PT") == 0) {
+ switch (region_code2) {
+ case 2:
+ name = "Aveiro";
+ break;
+ case 3:
+ name = "Beja";
+ break;
+ case 4:
+ name = "Braga";
+ break;
+ case 5:
+ name = "Braganca";
+ break;
+ case 6:
+ name = "Castelo Branco";
+ break;
+ case 7:
+ name = "Coimbra";
+ break;
+ case 8:
+ name = "Evora";
+ break;
+ case 9:
+ name = "Faro";
+ break;
+ case 10:
+ name = "Madeira";
+ break;
+ case 11:
+ name = "Guarda";
+ break;
+ case 13:
+ name = "Leiria";
+ break;
+ case 14:
+ name = "Lisboa";
+ break;
+ case 16:
+ name = "Portalegre";
+ break;
+ case 17:
+ name = "Porto";
+ break;
+ case 18:
+ name = "Santarem";
+ break;
+ case 19:
+ name = "Setubal";
+ break;
+ case 20:
+ name = "Viana do Castelo";
+ break;
+ case 21:
+ name = "Vila Real";
+ break;
+ case 22:
+ name = "Viseu";
+ break;
+ case 23:
+ name = "Azores";
+ break;
+ }
+ }
+ if (strcmp(country_code,"PY") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Alto Parana";
+ break;
+ case 2:
+ name = "Amambay";
+ break;
+ case 3:
+ name = "Boqueron";
+ break;
+ case 4:
+ name = "Caaguazu";
+ break;
+ case 5:
+ name = "Caazapa";
+ break;
+ case 6:
+ name = "Central";
+ break;
+ case 7:
+ name = "Concepcion";
+ break;
+ case 8:
+ name = "Cordillera";
+ break;
+ case 10:
+ name = "Guaira";
+ break;
+ case 11:
+ name = "Itapua";
+ break;
+ case 12:
+ name = "Misiones";
+ break;
+ case 13:
+ name = "Neembucu";
+ break;
+ case 15:
+ name = "Paraguari";
+ break;
+ case 16:
+ name = "Presidente Hayes";
+ break;
+ case 17:
+ name = "San Pedro";
+ break;
+ case 19:
+ name = "Canindeyu";
+ break;
+ case 20:
+ name = "Chaco";
+ break;
+ case 21:
+ name = "Nueva Asuncion";
+ break;
+ case 23:
+ name = "Alto Paraguay";
+ break;
+ }
+ }
+ if (strcmp(country_code,"QA") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Ad Dawhah";
+ break;
+ case 2:
+ name = "Al Ghuwariyah";
+ break;
+ case 3:
+ name = "Al Jumaliyah";
+ break;
+ case 4:
+ name = "Al Khawr";
+ break;
+ case 6:
+ name = "Ar Rayyan";
+ break;
+ case 8:
+ name = "Madinat ach Shamal";
+ break;
+ case 9:
+ name = "Umm Salal";
+ break;
+ case 10:
+ name = "Al Wakrah";
+ break;
+ case 11:
+ name = "Jariyan al Batnah";
+ break;
+ case 12:
+ name = "Umm Sa'id";
+ break;
+ }
+ }
+ if (strcmp(country_code,"RO") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Alba";
+ break;
+ case 2:
+ name = "Arad";
+ break;
+ case 3:
+ name = "Arges";
+ break;
+ case 4:
+ name = "Bacau";
+ break;
+ case 5:
+ name = "Bihor";
+ break;
+ case 6:
+ name = "Bistrita-Nasaud";
+ break;
+ case 7:
+ name = "Botosani";
+ break;
+ case 8:
+ name = "Braila";
+ break;
+ case 9:
+ name = "Brasov";
+ break;
+ case 10:
+ name = "Bucuresti";
+ break;
+ case 11:
+ name = "Buzau";
+ break;
+ case 12:
+ name = "Caras-Severin";
+ break;
+ case 13:
+ name = "Cluj";
+ break;
+ case 14:
+ name = "Constanta";
+ break;
+ case 15:
+ name = "Covasna";
+ break;
+ case 16:
+ name = "Dambovita";
+ break;
+ case 17:
+ name = "Dolj";
+ break;
+ case 18:
+ name = "Galati";
+ break;
+ case 19:
+ name = "Gorj";
+ break;
+ case 20:
+ name = "Harghita";
+ break;
+ case 21:
+ name = "Hunedoara";
+ break;
+ case 22:
+ name = "Ialomita";
+ break;
+ case 23:
+ name = "Iasi";
+ break;
+ case 25:
+ name = "Maramures";
+ break;
+ case 26:
+ name = "Mehedinti";
+ break;
+ case 27:
+ name = "Mures";
+ break;
+ case 28:
+ name = "Neamt";
+ break;
+ case 29:
+ name = "Olt";
+ break;
+ case 30:
+ name = "Prahova";
+ break;
+ case 31:
+ name = "Salaj";
+ break;
+ case 32:
+ name = "Satu Mare";
+ break;
+ case 33:
+ name = "Sibiu";
+ break;
+ case 34:
+ name = "Suceava";
+ break;
+ case 35:
+ name = "Teleorman";
+ break;
+ case 36:
+ name = "Timis";
+ break;
+ case 37:
+ name = "Tulcea";
+ break;
+ case 38:
+ name = "Vaslui";
+ break;
+ case 39:
+ name = "Valcea";
+ break;
+ case 40:
+ name = "Vrancea";
+ break;
+ case 41:
+ name = "Calarasi";
+ break;
+ case 42:
+ name = "Giurgiu";
+ break;
+ case 43:
+ name = "Ilfov";
+ break;
+ }
+ }
+ if (strcmp(country_code,"RU") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Adygeya";
+ break;
+ case 2:
+ name = "Aginsky Buryatsky AO";
+ break;
+ case 3:
+ name = "Gorno-Altay";
+ break;
+ case 4:
+ name = "Altaisky krai";
+ break;
+ case 5:
+ name = "Amur";
+ break;
+ case 6:
+ name = "Arkhangel'sk";
+ break;
+ case 7:
+ name = "Astrakhan'";
+ break;
+ case 8:
+ name = "Bashkortostan";
+ break;
+ case 9:
+ name = "Belgorod";
+ break;
+ case 10:
+ name = "Bryansk";
+ break;
+ case 11:
+ name = "Buryat";
+ break;
+ case 12:
+ name = "Chechnya";
+ break;
+ case 13:
+ name = "Chelyabinsk";
+ break;
+ case 14:
+ name = "Chita";
+ break;
+ case 15:
+ name = "Chukot";
+ break;
+ case 16:
+ name = "Chuvashia";
+ break;
+ case 17:
+ name = "Dagestan";
+ break;
+ case 18:
+ name = "Evenk";
+ break;
+ case 19:
+ name = "Ingush";
+ break;
+ case 20:
+ name = "Irkutsk";
+ break;
+ case 21:
+ name = "Ivanovo";
+ break;
+ case 22:
+ name = "Kabardin-Balkar";
+ break;
+ case 23:
+ name = "Kaliningrad";
+ break;
+ case 24:
+ name = "Kalmyk";
+ break;
+ case 25:
+ name = "Kaluga";
+ break;
+ case 26:
+ name = "Kamchatka";
+ break;
+ case 27:
+ name = "Karachay-Cherkess";
+ break;
+ case 28:
+ name = "Karelia";
+ break;
+ case 29:
+ name = "Kemerovo";
+ break;
+ case 30:
+ name = "Khabarovsk";
+ break;
+ case 31:
+ name = "Khakass";
+ break;
+ case 32:
+ name = "Khanty-Mansiy";
+ break;
+ case 33:
+ name = "Kirov";
+ break;
+ case 34:
+ name = "Komi";
+ break;
+ case 35:
+ name = "Komi-Permyak";
+ break;
+ case 36:
+ name = "Koryak";
+ break;
+ case 37:
+ name = "Kostroma";
+ break;
+ case 38:
+ name = "Krasnodar";
+ break;
+ case 39:
+ name = "Krasnoyarsk";
+ break;
+ case 40:
+ name = "Kurgan";
+ break;
+ case 41:
+ name = "Kursk";
+ break;
+ case 42:
+ name = "Leningrad";
+ break;
+ case 43:
+ name = "Lipetsk";
+ break;
+ case 44:
+ name = "Magadan";
+ break;
+ case 45:
+ name = "Mariy-El";
+ break;
+ case 46:
+ name = "Mordovia";
+ break;
+ case 47:
+ name = "Moskva";
+ break;
+ case 48:
+ name = "Moscow City";
+ break;
+ case 49:
+ name = "Murmansk";
+ break;
+ case 50:
+ name = "Nenets";
+ break;
+ case 51:
+ name = "Nizhegorod";
+ break;
+ case 52:
+ name = "Novgorod";
+ break;
+ case 53:
+ name = "Novosibirsk";
+ break;
+ case 54:
+ name = "Omsk";
+ break;
+ case 55:
+ name = "Orenburg";
+ break;
+ case 56:
+ name = "Orel";
+ break;
+ case 57:
+ name = "Penza";
+ break;
+ case 58:
+ name = "Perm'";
+ break;
+ case 59:
+ name = "Primor'ye";
+ break;
+ case 60:
+ name = "Pskov";
+ break;
+ case 61:
+ name = "Rostov";
+ break;
+ case 62:
+ name = "Ryazan'";
+ break;
+ case 63:
+ name = "Sakha";
+ break;
+ case 64:
+ name = "Sakhalin";
+ break;
+ case 65:
+ name = "Samara";
+ break;
+ case 66:
+ name = "Saint Petersburg City";
+ break;
+ case 67:
+ name = "Saratov";
+ break;
+ case 68:
+ name = "North Ossetia";
+ break;
+ case 69:
+ name = "Smolensk";
+ break;
+ case 70:
+ name = "Stavropol'";
+ break;
+ case 71:
+ name = "Sverdlovsk";
+ break;
+ case 72:
+ name = "Tambovskaya oblast";
+ break;
+ case 73:
+ name = "Tatarstan";
+ break;
+ case 74:
+ name = "Taymyr";
+ break;
+ case 75:
+ name = "Tomsk";
+ break;
+ case 76:
+ name = "Tula";
+ break;
+ case 77:
+ name = "Tver'";
+ break;
+ case 78:
+ name = "Tyumen'";
+ break;
+ case 79:
+ name = "Tuva";
+ break;
+ case 80:
+ name = "Udmurt";
+ break;
+ case 81:
+ name = "Ul'yanovsk";
+ break;
+ case 82:
+ name = "Ust-Orda Buryat";
+ break;
+ case 83:
+ name = "Vladimir";
+ break;
+ case 84:
+ name = "Volgograd";
+ break;
+ case 85:
+ name = "Vologda";
+ break;
+ case 86:
+ name = "Voronezh";
+ break;
+ case 87:
+ name = "Yamal-Nenets";
+ break;
+ case 88:
+ name = "Yaroslavl'";
+ break;
+ case 89:
+ name = "Yevrey";
+ break;
+ }
+ }
+ if (strcmp(country_code,"RW") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Butare";
+ break;
+ case 2:
+ name = "Byumba";
+ break;
+ case 3:
+ name = "Cyangugu";
+ break;
+ case 4:
+ name = "Gikongoro";
+ break;
+ case 5:
+ name = "Gisenyi";
+ break;
+ case 6:
+ name = "Gitarama";
+ break;
+ case 7:
+ name = "Kibungo";
+ break;
+ case 8:
+ name = "Kibuye";
+ break;
+ case 9:
+ name = "Kigali";
+ break;
+ case 10:
+ name = "Ruhengeri";
+ break;
+ }
+ }
+ if (strcmp(country_code,"SA") == 0) {
+ switch (region_code2) {
+ case 2:
+ name = "Al Bahah";
+ break;
+ case 3:
+ name = "Al Jawf";
+ break;
+ case 5:
+ name = "Al Madinah";
+ break;
+ case 6:
+ name = "Ash Sharqiyah";
+ break;
+ case 8:
+ name = "Al Qasim";
+ break;
+ case 9:
+ name = "Al Qurayyat";
+ break;
+ case 10:
+ name = "Ar Riyad";
+ break;
+ case 13:
+ name = "Ha'il";
+ break;
+ case 14:
+ name = "Makkah";
+ break;
+ case 15:
+ name = "Al Hudud ash Shamaliyah";
+ break;
+ case 16:
+ name = "Najran";
+ break;
+ case 17:
+ name = "Jizan";
+ break;
+ case 19:
+ name = "Tabuk";
+ break;
+ case 20:
+ name = "Al Jawf";
+ break;
+ }
+ }
+ if (strcmp(country_code,"SB") == 0) {
+ switch (region_code2) {
+ case 3:
+ name = "Malaita";
+ break;
+ case 4:
+ name = "Western";
+ break;
+ case 5:
+ name = "Central";
+ break;
+ case 6:
+ name = "Guadalcanal";
+ break;
+ case 7:
+ name = "Isabel";
+ break;
+ case 8:
+ name = "Makira";
+ break;
+ case 9:
+ name = "Temotu";
+ break;
+ }
+ }
+ if (strcmp(country_code,"SC") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Anse aux Pins";
+ break;
+ case 2:
+ name = "Anse Boileau";
+ break;
+ case 3:
+ name = "Anse Etoile";
+ break;
+ case 4:
+ name = "Anse Louis";
+ break;
+ case 5:
+ name = "Anse Royale";
+ break;
+ case 6:
+ name = "Baie Lazare";
+ break;
+ case 7:
+ name = "Baie Sainte Anne";
+ break;
+ case 8:
+ name = "Beau Vallon";
+ break;
+ case 9:
+ name = "Bel Air";
+ break;
+ case 10:
+ name = "Bel Ombre";
+ break;
+ case 11:
+ name = "Cascade";
+ break;
+ case 12:
+ name = "Glacis";
+ break;
+ case 13:
+ name = "Grand' Anse";
+ break;
+ case 14:
+ name = "Grand' Anse";
+ break;
+ case 15:
+ name = "La Digue";
+ break;
+ case 16:
+ name = "La Riviere Anglaise";
+ break;
+ case 17:
+ name = "Mont Buxton";
+ break;
+ case 18:
+ name = "Mont Fleuri";
+ break;
+ case 19:
+ name = "Plaisance";
+ break;
+ case 20:
+ name = "Pointe La Rue";
+ break;
+ case 21:
+ name = "Port Glaud";
+ break;
+ case 22:
+ name = "Saint Louis";
+ break;
+ case 23:
+ name = "Takamaka";
+ break;
+ }
+ }
+ if (strcmp(country_code,"SD") == 0) {
+ switch (region_code2) {
+ case 27:
+ name = "Al Wusta";
+ break;
+ case 28:
+ name = "Al Istiwa'iyah";
+ break;
+ case 29:
+ name = "Al Khartum";
+ break;
+ case 30:
+ name = "Ash Shamaliyah";
+ break;
+ case 31:
+ name = "Ash Sharqiyah";
+ break;
+ case 32:
+ name = "Bahr al Ghazal";
+ break;
+ case 33:
+ name = "Darfur";
+ break;
+ case 34:
+ name = "Kurdufan";
+ break;
+ }
+ }
+ if (strcmp(country_code,"SE") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Alvsborgs Lan";
+ break;
+ case 2:
+ name = "Blekinge Lan";
+ break;
+ case 3:
+ name = "Gavleborgs Lan";
+ break;
+ case 4:
+ name = "Goteborgs och Bohus Lan";
+ break;
+ case 5:
+ name = "Gotlands Lan";
+ break;
+ case 6:
+ name = "Hallands Lan";
+ break;
+ case 7:
+ name = "Jamtlands Lan";
+ break;
+ case 8:
+ name = "Jonkopings Lan";
+ break;
+ case 9:
+ name = "Kalmar Lan";
+ break;
+ case 10:
+ name = "Dalarnas Lan";
+ break;
+ case 11:
+ name = "Kristianstads Lan";
+ break;
+ case 12:
+ name = "Kronobergs Lan";
+ break;
+ case 13:
+ name = "Malmohus Lan";
+ break;
+ case 14:
+ name = "Norrbottens Lan";
+ break;
+ case 15:
+ name = "Orebro Lan";
+ break;
+ case 16:
+ name = "Ostergotlands Lan";
+ break;
+ case 17:
+ name = "Skaraborgs Lan";
+ break;
+ case 18:
+ name = "Sodermanlands Lan";
+ break;
+ case 21:
+ name = "Uppsala Lan";
+ break;
+ case 22:
+ name = "Varmlands Lan";
+ break;
+ case 23:
+ name = "Vasterbottens Lan";
+ break;
+ case 24:
+ name = "Vasternorrlands Lan";
+ break;
+ case 25:
+ name = "Vastmanlands Lan";
+ break;
+ case 26:
+ name = "Stockholms Lan";
+ break;
+ case 27:
+ name = "Skane Lan";
+ break;
+ case 28:
+ name = "Vastra Gotaland";
+ break;
+ }
+ }
+ if (strcmp(country_code,"SH") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Ascension";
+ break;
+ case 2:
+ name = "Saint Helena";
+ break;
+ case 3:
+ name = "Tristan da Cunha";
+ break;
+ }
+ }
+ if (strcmp(country_code,"SI") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Ajdovscina";
+ break;
+ case 2:
+ name = "Beltinci";
+ break;
+ case 3:
+ name = "Bled";
+ break;
+ case 4:
+ name = "Bohinj";
+ break;
+ case 5:
+ name = "Borovnica";
+ break;
+ case 6:
+ name = "Bovec";
+ break;
+ case 7:
+ name = "Brda";
+ break;
+ case 8:
+ name = "Brezice";
+ break;
+ case 9:
+ name = "Brezovica";
+ break;
+ case 11:
+ name = "Celje";
+ break;
+ case 12:
+ name = "Cerklje na Gorenjskem";
+ break;
+ case 13:
+ name = "Cerknica";
+ break;
+ case 14:
+ name = "Cerkno";
+ break;
+ case 15:
+ name = "Crensovci";
+ break;
+ case 16:
+ name = "Crna na Koroskem";
+ break;
+ case 17:
+ name = "Crnomelj";
+ break;
+ case 19:
+ name = "Divaca";
+ break;
+ case 20:
+ name = "Dobrepolje";
+ break;
+ case 22:
+ name = "Dol pri Ljubljani";
+ break;
+ case 24:
+ name = "Dornava";
+ break;
+ case 25:
+ name = "Dravograd";
+ break;
+ case 26:
+ name = "Duplek";
+ break;
+ case 27:
+ name = "Gorenja Vas-Poljane";
+ break;
+ case 28:
+ name = "Gorisnica";
+ break;
+ case 29:
+ name = "Gornja Radgona";
+ break;
+ case 30:
+ name = "Gornji Grad";
+ break;
+ case 31:
+ name = "Gornji Petrovci";
+ break;
+ case 32:
+ name = "Grosuplje";
+ break;
+ case 34:
+ name = "Hrastnik";
+ break;
+ case 35:
+ name = "Hrpelje-Kozina";
+ break;
+ case 36:
+ name = "Idrija";
+ break;
+ case 37:
+ name = "Ig";
+ break;
+ case 38:
+ name = "Ilirska Bistrica";
+ break;
+ case 39:
+ name = "Ivancna Gorica";
+ break;
+ case 40:
+ name = "Izola-Isola";
+ break;
+ case 42:
+ name = "Jursinci";
+ break;
+ case 44:
+ name = "Kanal";
+ break;
+ case 45:
+ name = "Kidricevo";
+ break;
+ case 46:
+ name = "Kobarid";
+ break;
+ case 47:
+ name = "Kobilje";
+ break;
+ case 49:
+ name = "Komen";
+ break;
+ case 50:
+ name = "Koper-Capodistria";
+ break;
+ case 51:
+ name = "Kozje";
+ break;
+ case 52:
+ name = "Kranj";
+ break;
+ case 53:
+ name = "Kranjska Gora";
+ break;
+ case 54:
+ name = "Krsko";
+ break;
+ case 55:
+ name = "Kungota";
+ break;
+ case 57:
+ name = "Lasko";
+ break;
+ case 61:
+ name = "Ljubljana";
+ break;
+ case 62:
+ name = "Ljubno";
+ break;
+ case 64:
+ name = "Logatec";
+ break;
+ case 66:
+ name = "Loski Potok";
+ break;
+ case 68:
+ name = "Lukovica";
+ break;
+ case 71:
+ name = "Medvode";
+ break;
+ case 72:
+ name = "Menges";
+ break;
+ case 73:
+ name = "Metlika";
+ break;
+ case 74:
+ name = "Mezica";
+ break;
+ case 76:
+ name = "Mislinja";
+ break;
+ case 77:
+ name = "Moravce";
+ break;
+ case 78:
+ name = "Moravske Toplice";
+ break;
+ case 79:
+ name = "Mozirje";
+ break;
+ case 80:
+ name = "Murska Sobota";
+ break;
+ case 81:
+ name = "Muta";
+ break;
+ case 82:
+ name = "Naklo";
+ break;
+ case 83:
+ name = "Nazarje";
+ break;
+ case 84:
+ name = "Nova Gorica";
+ break;
+ case 86:
+ name = "Odranci";
+ break;
+ case 87:
+ name = "Ormoz";
+ break;
+ case 88:
+ name = "Osilnica";
+ break;
+ case 89:
+ name = "Pesnica";
+ break;
+ case 91:
+ name = "Pivka";
+ break;
+ case 92:
+ name = "Podcetrtek";
+ break;
+ case 94:
+ name = "Postojna";
+ break;
+ case 97:
+ name = "Puconci";
+ break;
+ case 98:
+ name = "Racam";
+ break;
+ case 99:
+ name = "Radece";
+ break;
+ case 101:
+ name = "Radenci";
+ break;
+ case 102:
+ name = "Radlje ob Dravi";
+ break;
+ case 103:
+ name = "Radovljica";
+ break;
+ case 106:
+ name = "Rogasovci";
+ break;
+ case 107:
+ name = "Rogaska Slatina";
+ break;
+ case 108:
+ name = "Rogatec";
+ break;
+ case 111:
+ name = "Semic";
+ break;
+ case 112:
+ name = "Sencur";
+ break;
+ case 113:
+ name = "Sentilj";
+ break;
+ case 114:
+ name = "Sentjernej";
+ break;
+ case 116:
+ name = "Sevnica";
+ break;
+ case 117:
+ name = "Sezana";
+ break;
+ case 118:
+ name = "Skocjan";
+ break;
+ case 119:
+ name = "Skofja Loka";
+ break;
+ case 121:
+ name = "Skofljica";
+ break;
+ case 122:
+ name = "Slovenj Gradec";
+ break;
+ case 124:
+ name = "Slovenske Konjice";
+ break;
+ case 125:
+ name = "Smarje pri Jelsah";
+ break;
+ case 126:
+ name = "Smartno ob Paki";
+ break;
+ case 127:
+ name = "Sostanj";
+ break;
+ case 128:
+ name = "Starse";
+ break;
+ case 129:
+ name = "Store";
+ break;
+ case 131:
+ name = "Sveti Jurij";
+ break;
+ case 132:
+ name = "Tolmin";
+ break;
+ case 133:
+ name = "Trbovlje";
+ break;
+ case 134:
+ name = "Trebnje";
+ break;
+ case 135:
+ name = "Trzic";
+ break;
+ case 136:
+ name = "Turnisce";
+ break;
+ case 137:
+ name = "Velenje";
+ break;
+ case 138:
+ name = "Velike Lasce";
+ break;
+ case 141:
+ name = "Vipava";
+ break;
+ case 142:
+ name = "Vitanje";
+ break;
+ case 143:
+ name = "Vodice";
+ break;
+ case 145:
+ name = "Vrhnika";
+ break;
+ case 146:
+ name = "Vuzenica";
+ break;
+ case 147:
+ name = "Zagorje ob Savi";
+ break;
+ case 149:
+ name = "Zavrc";
+ break;
+ case 151:
+ name = "Zelezniki";
+ break;
+ case 152:
+ name = "Ziri";
+ break;
+ case 153:
+ name = "Zrece";
+ break;
+ case 164:
+ name = "Dobrova-Horjul-Polhov Gradec";
+ break;
+ case 167:
+ name = "Domzale";
+ break;
+ case 174:
+ name = "Jesenice";
+ break;
+ case 176:
+ name = "Kamnik";
+ break;
+ case 177:
+ name = "Kocevje";
+ break;
+ case 182:
+ name = "Kuzma";
+ break;
+ case 183:
+ name = "Lenart";
+ break;
+ case 185:
+ name = "Litija";
+ break;
+ case 186:
+ name = "Ljutomer";
+ break;
+ case 187:
+ name = "Loska Dolina";
+ break;
+ case 189:
+ name = "Luce";
+ break;
+ case 191:
+ name = "Majsperk";
+ break;
+ case 192:
+ name = "Maribor";
+ break;
+ case 195:
+ name = "Miren-Kostanjevica";
+ break;
+ case 197:
+ name = "Novo Mesto";
+ break;
+ case 199:
+ name = "Piran";
+ break;
+ case 205:
+ name = "Preddvor";
+ break;
+ case 207:
+ name = "Ptuj";
+ break;
+ case 211:
+ name = "Ribnica";
+ break;
+ case 213:
+ name = "Ruse";
+ break;
+ case 217:
+ name = "Sentjur pri Celju";
+ break;
+ case 218:
+ name = "Slovenska Bistrica";
+ break;
+ case 232:
+ name = "Videm";
+ break;
+ case 233:
+ name = "Vojnik";
+ break;
+ case 235:
+ name = "Zalec";
+ break;
+ }
+ }
+ if (strcmp(country_code,"SK") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Banska Bystrica";
+ break;
+ case 2:
+ name = "Bratislava";
+ break;
+ case 3:
+ name = "Kosice";
+ break;
+ case 4:
+ name = "Nitra";
+ break;
+ case 5:
+ name = "Presov";
+ break;
+ case 6:
+ name = "Trencin";
+ break;
+ case 7:
+ name = "Trnava";
+ break;
+ case 8:
+ name = "Zilina";
+ break;
+ }
+ }
+ if (strcmp(country_code,"SL") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Eastern";
+ break;
+ case 2:
+ name = "Northern";
+ break;
+ case 3:
+ name = "Southern";
+ break;
+ case 4:
+ name = "Western Area";
+ break;
+ }
+ }
+ if (strcmp(country_code,"SM") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Acquaviva";
+ break;
+ case 2:
+ name = "Chiesanuova";
+ break;
+ case 3:
+ name = "Domagnano";
+ break;
+ case 4:
+ name = "Faetano";
+ break;
+ case 5:
+ name = "Fiorentino";
+ break;
+ case 6:
+ name = "Borgo Maggiore";
+ break;
+ case 7:
+ name = "San Marino";
+ break;
+ case 8:
+ name = "Monte Giardino";
+ break;
+ case 9:
+ name = "Serravalle";
+ break;
+ }
+ }
+ if (strcmp(country_code,"SN") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Dakar";
+ break;
+ case 3:
+ name = "Diourbel";
+ break;
+ case 4:
+ name = "Saint-Louis";
+ break;
+ case 5:
+ name = "Tambacounda";
+ break;
+ case 7:
+ name = "Thies";
+ break;
+ case 8:
+ name = "Louga";
+ break;
+ case 9:
+ name = "Fatick";
+ break;
+ case 10:
+ name = "Kaolack";
+ break;
+ case 11:
+ name = "Kolda";
+ break;
+ case 12:
+ name = "Ziguinchor";
+ break;
+ }
+ }
+ if (strcmp(country_code,"SO") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Bakool";
+ break;
+ case 2:
+ name = "Banaadir";
+ break;
+ case 3:
+ name = "Bari";
+ break;
+ case 4:
+ name = "Bay";
+ break;
+ case 5:
+ name = "Galguduud";
+ break;
+ case 6:
+ name = "Gedo";
+ break;
+ case 7:
+ name = "Hiiraan";
+ break;
+ case 8:
+ name = "Jubbada Dhexe";
+ break;
+ case 9:
+ name = "Jubbada Hoose";
+ break;
+ case 10:
+ name = "Mudug";
+ break;
+ case 11:
+ name = "Nugaal";
+ break;
+ case 12:
+ name = "Sanaag";
+ break;
+ case 13:
+ name = "Shabeellaha Dhexe";
+ break;
+ case 14:
+ name = "Shabeellaha Hoose";
+ break;
+ case 15:
+ name = "Togdheer";
+ break;
+ case 16:
+ name = "Woqooyi Galbeed";
+ break;
+ }
+ }
+ if (strcmp(country_code,"SR") == 0) {
+ switch (region_code2) {
+ case 10:
+ name = "Brokopondo";
+ break;
+ case 11:
+ name = "Commewijne";
+ break;
+ case 12:
+ name = "Coronie";
+ break;
+ case 13:
+ name = "Marowijne";
+ break;
+ case 14:
+ name = "Nickerie";
+ break;
+ case 15:
+ name = "Para";
+ break;
+ case 16:
+ name = "Paramaribo";
+ break;
+ case 17:
+ name = "Saramacca";
+ break;
+ case 18:
+ name = "Sipaliwini";
+ break;
+ case 19:
+ name = "Wanica";
+ break;
+ }
+ }
+ if (strcmp(country_code,"ST") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Principe";
+ break;
+ case 2:
+ name = "Sao Tome";
+ break;
+ }
+ }
+ if (strcmp(country_code,"SV") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Ahuachapan";
+ break;
+ case 2:
+ name = "Cabanas";
+ break;
+ case 3:
+ name = "Chalatenango";
+ break;
+ case 4:
+ name = "Cuscatlan";
+ break;
+ case 5:
+ name = "La Libertad";
+ break;
+ case 6:
+ name = "La Paz";
+ break;
+ case 7:
+ name = "La Union";
+ break;
+ case 8:
+ name = "Morazan";
+ break;
+ case 9:
+ name = "San Miguel";
+ break;
+ case 10:
+ name = "San Salvador";
+ break;
+ case 11:
+ name = "Santa Ana";
+ break;
+ case 12:
+ name = "San Vicente";
+ break;
+ case 13:
+ name = "Sonsonate";
+ break;
+ case 14:
+ name = "Usulutan";
+ break;
+ }
+ }
+ if (strcmp(country_code,"SY") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Al Hasakah";
+ break;
+ case 2:
+ name = "Al Ladhiqiyah";
+ break;
+ case 3:
+ name = "Al Qunaytirah";
+ break;
+ case 4:
+ name = "Ar Raqqah";
+ break;
+ case 5:
+ name = "As Suwayda'";
+ break;
+ case 6:
+ name = "Dar";
+ break;
+ case 7:
+ name = "Dayr az Zawr";
+ break;
+ case 8:
+ name = "Rif Dimashq";
+ break;
+ case 9:
+ name = "Halab";
+ break;
+ case 10:
+ name = "Hamah";
+ break;
+ case 11:
+ name = "Hims";
+ break;
+ case 12:
+ name = "Idlib";
+ break;
+ case 13:
+ name = "Dimashq";
+ break;
+ case 14:
+ name = "Tartus";
+ break;
+ }
+ }
+ if (strcmp(country_code,"SZ") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Hhohho";
+ break;
+ case 2:
+ name = "Lubombo";
+ break;
+ case 3:
+ name = "Manzini";
+ break;
+ case 4:
+ name = "Shiselweni";
+ break;
+ case 5:
+ name = "Praslin";
+ break;
+ }
+ }
+ if (strcmp(country_code,"TD") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Batha";
+ break;
+ case 2:
+ name = "Biltine";
+ break;
+ case 3:
+ name = "Borkou-Ennedi-Tibesti";
+ break;
+ case 4:
+ name = "Chari-Baguirmi";
+ break;
+ case 5:
+ name = "Guera";
+ break;
+ case 6:
+ name = "Kanem";
+ break;
+ case 7:
+ name = "Lac";
+ break;
+ case 8:
+ name = "Logone Occidental";
+ break;
+ case 9:
+ name = "Logone Oriental";
+ break;
+ case 10:
+ name = "Mayo-Kebbi";
+ break;
+ case 11:
+ name = "Moyen-Chari";
+ break;
+ case 12:
+ name = "Ouaddai";
+ break;
+ case 13:
+ name = "Salamat";
+ break;
+ case 14:
+ name = "Tandjile";
+ break;
+ }
+ }
+ if (strcmp(country_code,"TG") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Amlame";
+ break;
+ case 2:
+ name = "Aneho";
+ break;
+ case 3:
+ name = "Atakpame";
+ break;
+ case 4:
+ name = "Bafilo";
+ break;
+ case 5:
+ name = "Bassar";
+ break;
+ case 6:
+ name = "Dapaong";
+ break;
+ case 7:
+ name = "Kante";
+ break;
+ case 8:
+ name = "Klouto";
+ break;
+ case 9:
+ name = "Lama-Kara";
+ break;
+ case 10:
+ name = "Lome";
+ break;
+ case 11:
+ name = "Mango";
+ break;
+ case 12:
+ name = "Niamtougou";
+ break;
+ case 13:
+ name = "Notse";
+ break;
+ case 14:
+ name = "Kpagouda";
+ break;
+ case 15:
+ name = "Badou";
+ break;
+ case 16:
+ name = "Sotouboua";
+ break;
+ case 17:
+ name = "Tabligbo";
+ break;
+ case 18:
+ name = "Tsevie";
+ break;
+ case 19:
+ name = "Tchamba";
+ break;
+ case 20:
+ name = "Tchaoudjo";
+ break;
+ case 21:
+ name = "Vogan";
+ break;
+ }
+ }
+ if (strcmp(country_code,"TH") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Mae Hong Son";
+ break;
+ case 2:
+ name = "Chiang Mai";
+ break;
+ case 3:
+ name = "Chiang Rai";
+ break;
+ case 4:
+ name = "Nan";
+ break;
+ case 5:
+ name = "Lamphun";
+ break;
+ case 6:
+ name = "Lampang";
+ break;
+ case 7:
+ name = "Phrae";
+ break;
+ case 8:
+ name = "Tak";
+ break;
+ case 9:
+ name = "Sukhothai";
+ break;
+ case 10:
+ name = "Uttaradit";
+ break;
+ case 11:
+ name = "Kamphaeng Phet";
+ break;
+ case 12:
+ name = "Phitsanulok";
+ break;
+ case 13:
+ name = "Phichit";
+ break;
+ case 14:
+ name = "Phetchabun";
+ break;
+ case 15:
+ name = "Uthai Thani";
+ break;
+ case 16:
+ name = "Nakhon Sawan";
+ break;
+ case 17:
+ name = "Nong Khai";
+ break;
+ case 18:
+ name = "Loei";
+ break;
+ case 20:
+ name = "Sakon Nakhon";
+ break;
+ case 21:
+ name = "Nakhon Phanom";
+ break;
+ case 22:
+ name = "Khon Kaen";
+ break;
+ case 23:
+ name = "Kalasin";
+ break;
+ case 24:
+ name = "Maha Sarakham";
+ break;
+ case 25:
+ name = "Roi Et";
+ break;
+ case 26:
+ name = "Chaiyaphum";
+ break;
+ case 27:
+ name = "Nakhon Ratchasima";
+ break;
+ case 28:
+ name = "Buriram";
+ break;
+ case 29:
+ name = "Surin";
+ break;
+ case 30:
+ name = "Sisaket";
+ break;
+ case 31:
+ name = "Narathiwat";
+ break;
+ case 32:
+ name = "Chai Nat";
+ break;
+ case 33:
+ name = "Sing Buri";
+ break;
+ case 34:
+ name = "Lop Buri";
+ break;
+ case 35:
+ name = "Ang Thong";
+ break;
+ case 36:
+ name = "Phra Nakhon Si Ayutthaya";
+ break;
+ case 37:
+ name = "Saraburi";
+ break;
+ case 38:
+ name = "Nonthaburi";
+ break;
+ case 39:
+ name = "Pathum Thani";
+ break;
+ case 40:
+ name = "Krung Thep";
+ break;
+ case 41:
+ name = "Phayao";
+ break;
+ case 42:
+ name = "Samut Prakan";
+ break;
+ case 43:
+ name = "Nakhon Nayok";
+ break;
+ case 44:
+ name = "Chachoengsao";
+ break;
+ case 45:
+ name = "Prachin Buri";
+ break;
+ case 46:
+ name = "Chon Buri";
+ break;
+ case 47:
+ name = "Rayong";
+ break;
+ case 48:
+ name = "Chanthaburi";
+ break;
+ case 49:
+ name = "Trat";
+ break;
+ case 50:
+ name = "Kanchanaburi";
+ break;
+ case 51:
+ name = "Suphan Buri";
+ break;
+ case 52:
+ name = "Ratchaburi";
+ break;
+ case 53:
+ name = "Nakhon Pathom";
+ break;
+ case 54:
+ name = "Samut Songkhram";
+ break;
+ case 55:
+ name = "Samut Sakhon";
+ break;
+ case 56:
+ name = "Phetchaburi";
+ break;
+ case 57:
+ name = "Prachuap Khiri Khan";
+ break;
+ case 58:
+ name = "Chumphon";
+ break;
+ case 59:
+ name = "Ranong";
+ break;
+ case 60:
+ name = "Surat Thani";
+ break;
+ case 61:
+ name = "Phangnga";
+ break;
+ case 62:
+ name = "Phuket";
+ break;
+ case 63:
+ name = "Krabi";
+ break;
+ case 64:
+ name = "Nakhon Si Thammarat";
+ break;
+ case 65:
+ name = "Trang";
+ break;
+ case 66:
+ name = "Phatthalung";
+ break;
+ case 67:
+ name = "Satun";
+ break;
+ case 68:
+ name = "Songkhla";
+ break;
+ case 69:
+ name = "Pattani";
+ break;
+ case 70:
+ name = "Yala";
+ break;
+ case 72:
+ name = "Yasothon";
+ break;
+ case 75:
+ name = "Ubon Ratchathani";
+ break;
+ case 76:
+ name = "Udon Thani";
+ break;
+ case 78:
+ name = "Mukdahan";
+ break;
+ }
+ }
+ if (strcmp(country_code,"TJ") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Kuhistoni Badakhshon";
+ break;
+ case 2:
+ name = "Khatlon";
+ break;
+ case 3:
+ name = "Sughd";
+ break;
+ }
+ }
+ if (strcmp(country_code,"TM") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Ahal";
+ break;
+ case 2:
+ name = "Balkan";
+ break;
+ case 3:
+ name = "Dashoguz";
+ break;
+ case 4:
+ name = "Lebap";
+ break;
+ case 5:
+ name = "Mary";
+ break;
+ }
+ }
+ if (strcmp(country_code,"TN") == 0) {
+ switch (region_code2) {
+ case 2:
+ name = "Al Qasrayn";
+ break;
+ case 3:
+ name = "Al Qayrawan";
+ break;
+ case 6:
+ name = "Jundubah";
+ break;
+ case 10:
+ name = "Qafsah";
+ break;
+ case 14:
+ name = "Kef";
+ break;
+ case 15:
+ name = "Al Mahdiyah";
+ break;
+ case 16:
+ name = "Al Munastir";
+ break;
+ case 17:
+ name = "Bajah";
+ break;
+ case 18:
+ name = "Banzart";
+ break;
+ case 19:
+ name = "Nabul";
+ break;
+ case 22:
+ name = "Silyanah";
+ break;
+ case 23:
+ name = "Susah";
+ break;
+ case 27:
+ name = "Bin";
+ break;
+ case 28:
+ name = "Madanin";
+ break;
+ case 29:
+ name = "Qabis";
+ break;
+ case 31:
+ name = "Qibili";
+ break;
+ case 32:
+ name = "Safaqis";
+ break;
+ case 33:
+ name = "Sidi Bu Zayd";
+ break;
+ case 34:
+ name = "Tatawin";
+ break;
+ case 35:
+ name = "Tawzar";
+ break;
+ case 36:
+ name = "Tunis";
+ break;
+ case 37:
+ name = "Zaghwan";
+ break;
+ case 38:
+ name = "Ariana";
+ break;
+ case 39:
+ name = "Manouba";
+ break;
+ }
+ }
+ if (strcmp(country_code,"TO") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Ha";
+ break;
+ case 2:
+ name = "Tongatapu";
+ break;
+ case 3:
+ name = "Vava";
+ break;
+ }
+ }
+ if (strcmp(country_code,"TR") == 0) {
+ switch (region_code2) {
+ case 2:
+ name = "Adiyaman";
+ break;
+ case 3:
+ name = "Afyon";
+ break;
+ case 4:
+ name = "Agri";
+ break;
+ case 5:
+ name = "Amasya";
+ break;
+ case 7:
+ name = "Antalya";
+ break;
+ case 8:
+ name = "Artvin";
+ break;
+ case 9:
+ name = "Aydin";
+ break;
+ case 10:
+ name = "Balikesir";
+ break;
+ case 11:
+ name = "Bilecik";
+ break;
+ case 12:
+ name = "Bingol";
+ break;
+ case 13:
+ name = "Bitlis";
+ break;
+ case 14:
+ name = "Bolu";
+ break;
+ case 15:
+ name = "Burdur";
+ break;
+ case 16:
+ name = "Bursa";
+ break;
+ case 17:
+ name = "Canakkale";
+ break;
+ case 19:
+ name = "Corum";
+ break;
+ case 20:
+ name = "Denizli";
+ break;
+ case 21:
+ name = "Diyarbakir";
+ break;
+ case 22:
+ name = "Edirne";
+ break;
+ case 23:
+ name = "Elazig";
+ break;
+ case 24:
+ name = "Erzincan";
+ break;
+ case 25:
+ name = "Erzurum";
+ break;
+ case 26:
+ name = "Eskisehir";
+ break;
+ case 28:
+ name = "Giresun";
+ break;
+ case 31:
+ name = "Hatay";
+ break;
+ case 32:
+ name = "Icel";
+ break;
+ case 33:
+ name = "Isparta";
+ break;
+ case 34:
+ name = "Istanbul";
+ break;
+ case 35:
+ name = "Izmir";
+ break;
+ case 37:
+ name = "Kastamonu";
+ break;
+ case 38:
+ name = "Kayseri";
+ break;
+ case 39:
+ name = "Kirklareli";
+ break;
+ case 40:
+ name = "Kirsehir";
+ break;
+ case 41:
+ name = "Kocaeli";
+ break;
+ case 43:
+ name = "Kutahya";
+ break;
+ case 44:
+ name = "Malatya";
+ break;
+ case 45:
+ name = "Manisa";
+ break;
+ case 46:
+ name = "Kahramanmaras";
+ break;
+ case 48:
+ name = "Mugla";
+ break;
+ case 49:
+ name = "Mus";
+ break;
+ case 50:
+ name = "Nevsehir";
+ break;
+ case 52:
+ name = "Ordu";
+ break;
+ case 53:
+ name = "Rize";
+ break;
+ case 54:
+ name = "Sakarya";
+ break;
+ case 55:
+ name = "Samsun";
+ break;
+ case 57:
+ name = "Sinop";
+ break;
+ case 58:
+ name = "Sivas";
+ break;
+ case 59:
+ name = "Tekirdag";
+ break;
+ case 60:
+ name = "Tokat";
+ break;
+ case 61:
+ name = "Trabzon";
+ break;
+ case 62:
+ name = "Tunceli";
+ break;
+ case 63:
+ name = "Sanliurfa";
+ break;
+ case 64:
+ name = "Usak";
+ break;
+ case 65:
+ name = "Van";
+ break;
+ case 66:
+ name = "Yozgat";
+ break;
+ case 68:
+ name = "Ankara";
+ break;
+ case 69:
+ name = "Gumushane";
+ break;
+ case 70:
+ name = "Hakkari";
+ break;
+ case 71:
+ name = "Konya";
+ break;
+ case 72:
+ name = "Mardin";
+ break;
+ case 73:
+ name = "Nigde";
+ break;
+ case 74:
+ name = "Siirt";
+ break;
+ case 75:
+ name = "Aksaray";
+ break;
+ case 76:
+ name = "Batman";
+ break;
+ case 77:
+ name = "Bayburt";
+ break;
+ case 78:
+ name = "Karaman";
+ break;
+ case 79:
+ name = "Kirikkale";
+ break;
+ case 80:
+ name = "Sirnak";
+ break;
+ case 81:
+ name = "Adana";
+ break;
+ case 82:
+ name = "Cankiri";
+ break;
+ case 83:
+ name = "Gaziantep";
+ break;
+ case 84:
+ name = "Kars";
+ break;
+ case 85:
+ name = "Zonguldak";
+ break;
+ case 86:
+ name = "Ardahan";
+ break;
+ case 87:
+ name = "Bartin";
+ break;
+ case 88:
+ name = "Igdir";
+ break;
+ case 89:
+ name = "Karabuk";
+ break;
+ case 90:
+ name = "Kilis";
+ break;
+ case 91:
+ name = "Osmaniye";
+ break;
+ case 92:
+ name = "Yalova";
+ break;
+ case 93:
+ name = "Duzce";
+ break;
+ }
+ }
+ if (strcmp(country_code,"TT") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Arima";
+ break;
+ case 2:
+ name = "Caroni";
+ break;
+ case 3:
+ name = "Mayaro";
+ break;
+ case 4:
+ name = "Nariva";
+ break;
+ case 5:
+ name = "Port-of-Spain";
+ break;
+ case 6:
+ name = "Saint Andrew";
+ break;
+ case 7:
+ name = "Saint David";
+ break;
+ case 8:
+ name = "Saint George";
+ break;
+ case 9:
+ name = "Saint Patrick";
+ break;
+ case 10:
+ name = "San Fernando";
+ break;
+ case 11:
+ name = "Tobago";
+ break;
+ case 12:
+ name = "Victoria";
+ break;
+ }
+ }
+ if (strcmp(country_code,"TW") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Fu-chien";
+ break;
+ case 2:
+ name = "Kao-hsiung";
+ break;
+ case 3:
+ name = "T'ai-pei";
+ break;
+ case 4:
+ name = "T'ai-wan";
+ break;
+ }
+ }
+ if (strcmp(country_code,"TZ") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Arusha";
+ break;
+ case 2:
+ name = "Pwani";
+ break;
+ case 3:
+ name = "Dodoma";
+ break;
+ case 4:
+ name = "Iringa";
+ break;
+ case 5:
+ name = "Kigoma";
+ break;
+ case 6:
+ name = "Kilimanjaro";
+ break;
+ case 7:
+ name = "Lindi";
+ break;
+ case 8:
+ name = "Mara";
+ break;
+ case 9:
+ name = "Mbeya";
+ break;
+ case 10:
+ name = "Morogoro";
+ break;
+ case 11:
+ name = "Mtwara";
+ break;
+ case 12:
+ name = "Mwanza";
+ break;
+ case 13:
+ name = "Pemba North";
+ break;
+ case 14:
+ name = "Ruvuma";
+ break;
+ case 15:
+ name = "Shinyanga";
+ break;
+ case 16:
+ name = "Singida";
+ break;
+ case 17:
+ name = "Tabora";
+ break;
+ case 18:
+ name = "Tanga";
+ break;
+ case 19:
+ name = "Kagera";
+ break;
+ case 20:
+ name = "Pemba South";
+ break;
+ case 21:
+ name = "Zanzibar Central";
+ break;
+ case 22:
+ name = "Zanzibar North";
+ break;
+ case 23:
+ name = "Dar es Salaam";
+ break;
+ case 24:
+ name = "Rukwa";
+ break;
+ case 25:
+ name = "Zanzibar Urban";
+ break;
+ }
+ }
+ if (strcmp(country_code,"UA") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Cherkas'ka Oblast'";
+ break;
+ case 2:
+ name = "Chernihivs'ka Oblast'";
+ break;
+ case 3:
+ name = "Chernivets'ka Oblast'";
+ break;
+ case 4:
+ name = "Dnipropetrovs'ka Oblast'";
+ break;
+ case 5:
+ name = "Donets'ka Oblast'";
+ break;
+ case 6:
+ name = "Ivano-Frankivs'ka Oblast'";
+ break;
+ case 7:
+ name = "Kharkivs'ka Oblast'";
+ break;
+ case 8:
+ name = "Khersons'ka Oblast'";
+ break;
+ case 9:
+ name = "Khmel'nyts'ka Oblast'";
+ break;
+ case 10:
+ name = "Kirovohrads'ka Oblast'";
+ break;
+ case 11:
+ name = "Krym";
+ break;
+ case 12:
+ name = "Kyyiv";
+ break;
+ case 13:
+ name = "Kyyivs'ka Oblast'";
+ break;
+ case 14:
+ name = "Luhans'ka Oblast'";
+ break;
+ case 15:
+ name = "L'vivs'ka Oblast'";
+ break;
+ case 16:
+ name = "Mykolayivs'ka Oblast'";
+ break;
+ case 17:
+ name = "Odes'ka Oblast'";
+ break;
+ case 18:
+ name = "Poltavs'ka Oblast'";
+ break;
+ case 19:
+ name = "Rivnens'ka Oblast'";
+ break;
+ case 20:
+ name = "Sevastopol'";
+ break;
+ case 21:
+ name = "Sums'ka Oblast'";
+ break;
+ case 22:
+ name = "Ternopil's'ka Oblast'";
+ break;
+ case 23:
+ name = "Vinnyts'ka Oblast'";
+ break;
+ case 24:
+ name = "Volyns'ka Oblast'";
+ break;
+ case 25:
+ name = "Zakarpats'ka Oblast'";
+ break;
+ case 26:
+ name = "Zaporiz'ka Oblast'";
+ break;
+ case 27:
+ name = "Zhytomyrs'ka Oblast'";
+ break;
+ }
+ }
+ if (strcmp(country_code,"UG") == 0) {
+ switch (region_code2) {
+ case 5:
+ name = "Busoga";
+ break;
+ case 8:
+ name = "Karamoja";
+ break;
+ case 12:
+ name = "South Buganda";
+ break;
+ case 18:
+ name = "Central";
+ break;
+ case 20:
+ name = "Eastern";
+ break;
+ case 21:
+ name = "Nile";
+ break;
+ case 22:
+ name = "North Buganda";
+ break;
+ case 23:
+ name = "Northern";
+ break;
+ case 24:
+ name = "Southern";
+ break;
+ case 25:
+ name = "Western";
+ break;
+ case 37:
+ name = "Kampala";
+ break;
+ case 65:
+ name = "Adjumani";
+ break;
+ case 66:
+ name = "Bugiri";
+ break;
+ case 67:
+ name = "Busia";
+ break;
+ case 69:
+ name = "Katakwi";
+ break;
+ case 73:
+ name = "Nakasongola";
+ break;
+ case 74:
+ name = "Sembabule";
+ break;
+ case 77:
+ name = "Arua";
+ break;
+ case 78:
+ name = "Iganga";
+ break;
+ case 79:
+ name = "Kabarole";
+ break;
+ case 80:
+ name = "Kaberamaido";
+ break;
+ case 81:
+ name = "Kamwenge";
+ break;
+ case 82:
+ name = "Kanungu";
+ break;
+ case 83:
+ name = "Kayunga";
+ break;
+ case 84:
+ name = "Kitgum";
+ break;
+ case 85:
+ name = "Kyenjojo";
+ break;
+ case 86:
+ name = "Mayuge";
+ break;
+ case 87:
+ name = "Mbale";
+ break;
+ case 88:
+ name = "Moroto";
+ break;
+ case 89:
+ name = "Mpigi";
+ break;
+ case 90:
+ name = "Mukono";
+ break;
+ case 91:
+ name = "Nakapiripirit";
+ break;
+ case 92:
+ name = "Pader";
+ break;
+ case 93:
+ name = "Rukungiri";
+ break;
+ case 94:
+ name = "Sironko";
+ break;
+ case 95:
+ name = "Soroti";
+ break;
+ case 96:
+ name = "Wakiso";
+ break;
+ case 97:
+ name = "Yumbe";
+ break;
+ }
+ }
+ if (strcmp(country_code,"UY") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Artigas";
+ break;
+ case 2:
+ name = "Canelones";
+ break;
+ case 3:
+ name = "Cerro Largo";
+ break;
+ case 4:
+ name = "Colonia";
+ break;
+ case 5:
+ name = "Durazno";
+ break;
+ case 6:
+ name = "Flores";
+ break;
+ case 7:
+ name = "Florida";
+ break;
+ case 8:
+ name = "Lavalleja";
+ break;
+ case 9:
+ name = "Maldonado";
+ break;
+ case 10:
+ name = "Montevideo";
+ break;
+ case 11:
+ name = "Paysandu";
+ break;
+ case 12:
+ name = "Rio Negro";
+ break;
+ case 13:
+ name = "Rivera";
+ break;
+ case 14:
+ name = "Rocha";
+ break;
+ case 15:
+ name = "Salto";
+ break;
+ case 16:
+ name = "San Jose";
+ break;
+ case 17:
+ name = "Soriano";
+ break;
+ case 18:
+ name = "Tacuarembo";
+ break;
+ case 19:
+ name = "Treinta y Tres";
+ break;
+ }
+ }
+ if (strcmp(country_code,"UZ") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Andijon";
+ break;
+ case 2:
+ name = "Bukhoro";
+ break;
+ case 3:
+ name = "Farghona";
+ break;
+ case 4:
+ name = "Jizzakh";
+ break;
+ case 5:
+ name = "Khorazm";
+ break;
+ case 6:
+ name = "Namangan";
+ break;
+ case 7:
+ name = "Nawoiy";
+ break;
+ case 8:
+ name = "Qashqadaryo";
+ break;
+ case 9:
+ name = "Qoraqalpoghiston";
+ break;
+ case 10:
+ name = "Samarqand";
+ break;
+ case 11:
+ name = "Sirdaryo";
+ break;
+ case 12:
+ name = "Surkhondaryo";
+ break;
+ case 13:
+ name = "Toshkent";
+ break;
+ case 14:
+ name = "Toshkent";
+ break;
+ }
+ }
+ if (strcmp(country_code,"VC") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Charlotte";
+ break;
+ case 2:
+ name = "Saint Andrew";
+ break;
+ case 3:
+ name = "Saint David";
+ break;
+ case 4:
+ name = "Saint George";
+ break;
+ case 5:
+ name = "Saint Patrick";
+ break;
+ case 6:
+ name = "Grenadines";
+ break;
+ }
+ }
+ if (strcmp(country_code,"VE") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Amazonas";
+ break;
+ case 2:
+ name = "Anzoategui";
+ break;
+ case 3:
+ name = "Apure";
+ break;
+ case 4:
+ name = "Aragua";
+ break;
+ case 5:
+ name = "Barinas";
+ break;
+ case 6:
+ name = "Bolivar";
+ break;
+ case 7:
+ name = "Carabobo";
+ break;
+ case 8:
+ name = "Cojedes";
+ break;
+ case 9:
+ name = "Delta Amacuro";
+ break;
+ case 11:
+ name = "Falcon";
+ break;
+ case 12:
+ name = "Guarico";
+ break;
+ case 13:
+ name = "Lara";
+ break;
+ case 14:
+ name = "Merida";
+ break;
+ case 15:
+ name = "Miranda";
+ break;
+ case 16:
+ name = "Monagas";
+ break;
+ case 17:
+ name = "Nueva Esparta";
+ break;
+ case 18:
+ name = "Portuguesa";
+ break;
+ case 19:
+ name = "Sucre";
+ break;
+ case 20:
+ name = "Tachira";
+ break;
+ case 21:
+ name = "Trujillo";
+ break;
+ case 22:
+ name = "Yaracuy";
+ break;
+ case 23:
+ name = "Zulia";
+ break;
+ case 24:
+ name = "Dependencias Federales";
+ break;
+ case 25:
+ name = "Distrito Federal";
+ break;
+ case 26:
+ name = "Vargas";
+ break;
+ }
+ }
+ if (strcmp(country_code,"VN") == 0) {
+ switch (region_code2) {
+ case 2:
+ name = "Bac Thai";
+ break;
+ case 3:
+ name = "Ben Tre";
+ break;
+ case 5:
+ name = "Cao Bang";
+ break;
+ case 11:
+ name = "Ha Bac";
+ break;
+ case 12:
+ name = "Hai Hung";
+ break;
+ case 13:
+ name = "Hai Phong";
+ break;
+ case 22:
+ name = "Lai Chau";
+ break;
+ case 23:
+ name = "Lam Dong";
+ break;
+ case 24:
+ name = "Long An";
+ break;
+ case 29:
+ name = "Quang Nam-Da Nang";
+ break;
+ case 30:
+ name = "Quang Ninh";
+ break;
+ case 32:
+ name = "Son La";
+ break;
+ case 33:
+ name = "Tay Ninh";
+ break;
+ case 34:
+ name = "Thanh Hoa";
+ break;
+ case 35:
+ name = "Thai Binh";
+ break;
+ case 37:
+ name = "Tien Giang";
+ break;
+ case 39:
+ name = "Lang Son";
+ break;
+ case 43:
+ name = "An Giang";
+ break;
+ case 44:
+ name = "Dac Lac";
+ break;
+ case 45:
+ name = "Dong Nai";
+ break;
+ case 46:
+ name = "Dong Thap";
+ break;
+ case 47:
+ name = "Kien Giang";
+ break;
+ case 48:
+ name = "Minh Hai";
+ break;
+ case 49:
+ name = "Song Be";
+ break;
+ case 50:
+ name = "Vinh Phu";
+ break;
+ case 51:
+ name = "Ha Noi";
+ break;
+ case 52:
+ name = "Ho Chi Minh";
+ break;
+ case 53:
+ name = "Ba Ria-Vung Tau";
+ break;
+ case 54:
+ name = "Binh Dinh";
+ break;
+ case 55:
+ name = "Binh Thuan";
+ break;
+ case 56:
+ name = "Can Tho";
+ break;
+ case 57:
+ name = "Gia Lai";
+ break;
+ case 58:
+ name = "Ha Giang";
+ break;
+ case 59:
+ name = "Ha Tay";
+ break;
+ case 60:
+ name = "Ha Tinh";
+ break;
+ case 61:
+ name = "Hoa Binh";
+ break;
+ case 62:
+ name = "Khanh Hoa";
+ break;
+ case 63:
+ name = "Kon Tum";
+ break;
+ case 64:
+ name = "Lao Cai";
+ break;
+ case 65:
+ name = "Nam Ha";
+ break;
+ case 66:
+ name = "Nghe An";
+ break;
+ case 67:
+ name = "Ninh Binh";
+ break;
+ case 68:
+ name = "Ninh Thuan";
+ break;
+ case 69:
+ name = "Phu Yen";
+ break;
+ case 70:
+ name = "Quang Binh";
+ break;
+ case 71:
+ name = "Quang Ngai";
+ break;
+ case 72:
+ name = "Quang Tri";
+ break;
+ case 73:
+ name = "Soc Trang";
+ break;
+ case 74:
+ name = "Thua Thien";
+ break;
+ case 75:
+ name = "Tra Vinh";
+ break;
+ case 76:
+ name = "Tuyen Quang";
+ break;
+ case 77:
+ name = "Vinh Long";
+ break;
+ case 78:
+ name = "Yen Bai";
+ break;
+ }
+ }
+ if (strcmp(country_code,"VU") == 0) {
+ switch (region_code2) {
+ case 5:
+ name = "Ambrym";
+ break;
+ case 6:
+ name = "Aoba";
+ break;
+ case 7:
+ name = "Torba";
+ break;
+ case 8:
+ name = "Efate";
+ break;
+ case 9:
+ name = "Epi";
+ break;
+ case 10:
+ name = "Malakula";
+ break;
+ case 11:
+ name = "Paama";
+ break;
+ case 12:
+ name = "Pentecote";
+ break;
+ case 13:
+ name = "Sanma";
+ break;
+ case 14:
+ name = "Shepherd";
+ break;
+ case 15:
+ name = "Tafea";
+ break;
+ case 16:
+ name = "Malampa";
+ break;
+ case 17:
+ name = "Penama";
+ break;
+ case 18:
+ name = "Shefa";
+ break;
+ }
+ }
+ if (strcmp(country_code,"WS") == 0) {
+ switch (region_code2) {
+ case 2:
+ name = "Aiga-i-le-Tai";
+ break;
+ case 3:
+ name = "Atua";
+ break;
+ case 4:
+ name = "Fa";
+ break;
+ case 5:
+ name = "Gaga";
+ break;
+ case 6:
+ name = "Va";
+ break;
+ case 7:
+ name = "Gagaifomauga";
+ break;
+ case 8:
+ name = "Palauli";
+ break;
+ case 9:
+ name = "Satupa";
+ break;
+ case 10:
+ name = "Tuamasaga";
+ break;
+ case 11:
+ name = "Vaisigano";
+ break;
+ }
+ }
+ if (strcmp(country_code,"YE") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Abyan";
+ break;
+ case 3:
+ name = "Al Mahrah";
+ break;
+ case 4:
+ name = "Hadramawt";
+ break;
+ case 5:
+ name = "Shabwah";
+ break;
+ case 8:
+ name = "Al Hudaydah";
+ break;
+ case 10:
+ name = "Al Mahwit";
+ break;
+ case 11:
+ name = "Dhamar";
+ break;
+ case 14:
+ name = "Ma'rib";
+ break;
+ case 15:
+ name = "Sa";
+ break;
+ case 16:
+ name = "San";
+ break;
+ case 20:
+ name = "Al Bayda'";
+ break;
+ case 21:
+ name = "Al Jawf";
+ break;
+ case 22:
+ name = "Hajjah";
+ break;
+ case 23:
+ name = "Ibb";
+ break;
+ case 24:
+ name = "Lahij";
+ break;
+ case 25:
+ name = "Ta";
+ break;
+ }
+ }
+ if (strcmp(country_code,"ZA") == 0) {
+ switch (region_code2) {
+ case 2:
+ name = "KwaZulu-Natal";
+ break;
+ case 3:
+ name = "Free State";
+ break;
+ case 5:
+ name = "Eastern Cape";
+ break;
+ case 6:
+ name = "Gauteng";
+ break;
+ case 7:
+ name = "Mpumalanga";
+ break;
+ case 8:
+ name = "Northern Cape";
+ break;
+ case 9:
+ name = "Limpopo";
+ break;
+ case 10:
+ name = "North-West";
+ break;
+ case 11:
+ name = "Western Cape";
+ break;
+ }
+ }
+ if (strcmp(country_code,"ZM") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Western";
+ break;
+ case 2:
+ name = "Central";
+ break;
+ case 3:
+ name = "Eastern";
+ break;
+ case 4:
+ name = "Luapula";
+ break;
+ case 5:
+ name = "Northern";
+ break;
+ case 6:
+ name = "North-Western";
+ break;
+ case 7:
+ name = "Southern";
+ break;
+ case 8:
+ name = "Copperbelt";
+ break;
+ case 9:
+ name = "Lusaka";
+ break;
+ }
+ }
+ if (strcmp(country_code,"ZR") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Bandundu";
+ break;
+ case 2:
+ name = "Equateur";
+ break;
+ case 3:
+ name = "Kasai-Occidental";
+ break;
+ case 4:
+ name = "Kasai-Oriental";
+ break;
+ case 5:
+ name = "Katanga";
+ break;
+ case 6:
+ name = "Kinshasa";
+ break;
+ case 7:
+ name = "Kivu";
+ break;
+ case 8:
+ name = "Bas-Congo";
+ break;
+ case 9:
+ name = "Orientale";
+ break;
+ case 10:
+ name = "Maniema";
+ break;
+ case 11:
+ name = "Nord-Kivu";
+ break;
+ case 12:
+ name = "Sud-Kivu";
+ break;
+ }
+ }
+ if (strcmp(country_code,"ZW") == 0) {
+ switch (region_code2) {
+ case 1:
+ name = "Manicaland";
+ break;
+ case 2:
+ name = "Midlands";
+ break;
+ case 3:
+ name = "Mashonaland Central";
+ break;
+ case 4:
+ name = "Mashonaland East";
+ break;
+ case 5:
+ name = "Mashonaland West";
+ break;
+ case 6:
+ name = "Matabeleland North";
+ break;
+ case 7:
+ name = "Matabeleland South";
+ break;
+ case 8:
+ name = "Masvingo";
+ break;
+ case 9:
+ name = "Bulawayo";
+ break;
+ case 10:
+ name = "Harare";
+ break;
+ }
+ }
+ return name;
+}
diff --git a/src/GeoIP-1.4.0/libGeoIP/timeZone.c b/src/GeoIP-1.4.0/libGeoIP/timeZone.c
new file mode 100644
index 0000000..6e514fa
--- /dev/null
+++ b/src/GeoIP-1.4.0/libGeoIP/timeZone.c
@@ -0,0 +1,551 @@
+#include <string.h>
+#include "GeoIP.h"
+const char* GeoIP_time_zone_by_country_and_region(const char * country,const char * region) {
+ const char* timezone = NULL;
+ if (country == NULL) {
+ return NULL;
+ }
+ if (region == NULL) {
+ region = "";
+ }
+ if (strcmp(country,"US") == 0) {
+ if (strcmp(region,"AL") == 0) {
+ timezone = "America/Chicago";
+ } else if (strcmp(region,"AK") == 0) {
+ timezone = "America/Anchorage";
+ } else if (strcmp(region,"AZ") == 0) {
+ timezone = "America/Phoenix";
+ } else if (strcmp(region,"AR") == 0) {
+ timezone = "America/Chicago";
+ } else if (strcmp(region,"CA") == 0) {
+ timezone = "America/Los_Angeles";
+ } else if (strcmp(region,"CO") == 0) {
+ timezone = "America/Denver";
+ } else if (strcmp(region,"CT") == 0) {
+ timezone = "America/New_York";
+ } else if (strcmp(region,"DE") == 0) {
+ timezone = "America/New_York";
+ } else if (strcmp(region,"DC") == 0) {
+ timezone = "America/New_York";
+ } else if (strcmp(region,"FL") == 0) {
+ timezone = "America/New_York";
+ } else if (strcmp(region,"GA") == 0) {
+ timezone = "America/New_York";
+ } else if (strcmp(region,"HI") == 0) {
+ timezone = "Pacific/Honolulu";
+ } else if (strcmp(region,"ID") == 0) {
+ timezone = "America/Denver";
+ } else if (strcmp(region,"IL") == 0) {
+ timezone = "America/Chicago";
+ } else if (strcmp(region,"IN") == 0) {
+ timezone = "America/Indianapolis";
+ } else if (strcmp(region,"IA") == 0) {
+ timezone = "America/Chicago";
+ } else if (strcmp(region,"KS") == 0) {
+ timezone = "America/Chicago";
+ } else if (strcmp(region,"KY") == 0) {
+ timezone = "America/New_York";
+ } else if (strcmp(region,"LA") == 0) {
+ timezone = "America/Chicago";
+ } else if (strcmp(region,"ME") == 0) {
+ timezone = "America/New_York";
+ } else if (strcmp(region,"MD") == 0) {
+ timezone = "America/New_York";
+ } else if (strcmp(region,"MA") == 0) {
+ timezone = "America/New_York";
+ } else if (strcmp(region,"MI") == 0) {
+ timezone = "America/New_York";
+ } else if (strcmp(region,"MN") == 0) {
+ timezone = "America/Chicago";
+ } else if (strcmp(region,"MS") == 0) {
+ timezone = "America/Chicago";
+ } else if (strcmp(region,"MO") == 0) {
+ timezone = "America/Chicago";
+ } else if (strcmp(region,"MT") == 0) {
+ timezone = "America/Denver";
+ } else if (strcmp(region,"NE") == 0) {
+ timezone = "America/Chicago";
+ } else if (strcmp(region,"NV") == 0) {
+ timezone = "America/Los_Angeles";
+ } else if (strcmp(region,"NH") == 0) {
+ timezone = "America/New_York";
+ } else if (strcmp(region,"NJ") == 0) {
+ timezone = "America/New_York";
+ } else if (strcmp(region,"NM") == 0) {
+ timezone = "America/Denver";
+ } else if (strcmp(region,"NY") == 0) {
+ timezone = "America/New_York";
+ } else if (strcmp(region,"NC") == 0) {
+ timezone = "America/New_York";
+ } else if (strcmp(region,"ND") == 0) {
+ timezone = "America/Chicago";
+ } else if (strcmp(region,"OH") == 0) {
+ timezone = "America/New_York";
+ } else if (strcmp(region,"OK") == 0) {
+ timezone = "America/Chicago";
+ } else if (strcmp(region,"OR") == 0) {
+ timezone = "America/Los_Angeles";
+ } else if (strcmp(region,"PA") == 0) {
+ timezone = "America/New_York";
+ } else if (strcmp(region,"RI") == 0) {
+ timezone = "America/New_York";
+ } else if (strcmp(region,"SC") == 0) {
+ timezone = "America/New_York";
+ } else if (strcmp(region,"SD") == 0) {
+ timezone = "America/Chicago";
+ } else if (strcmp(region,"TN") == 0) {
+ timezone = "America/Chicago";
+ } else if (strcmp(region,"TX") == 0) {
+ timezone = "America/Chicago";
+ } else if (strcmp(region,"UT") == 0) {
+ timezone = "America/Denver";
+ } else if (strcmp(region,"VT") == 0) {
+ timezone = "America/New_York";
+ } else if (strcmp(region,"VA") == 0) {
+ timezone = "America/New_York";
+ } else if (strcmp(region,"WA") == 0) {
+ timezone = "America/Los_Angeles";
+ } else if (strcmp(region,"WV") == 0) {
+ timezone = "America/New_York";
+ } else if (strcmp(region,"WI") == 0) {
+ timezone = "America/Chicago";
+ } else {
+ timezone = "America/Chicago";
+ }
+ } else if (strcmp(country,"CA") == 0) {
+ if (strcmp(region,"AB") == 0) {
+ timezone = "America/Edmonton";
+ } else if (strcmp(region,"BC") == 0) {
+ timezone = "America/Vancouver";
+ } else if (strcmp(region,"MB") == 0) {
+ timezone = "America/Winnipeg";
+ } else if (strcmp(region,"NB") == 0) {
+ timezone = "America/Halifax";
+ } else if (strcmp(region,"NF") == 0) {
+ timezone = "America/St_Johns";
+ } else if (strcmp(region,"NT") == 0) {
+ timezone = "America/Yellowknife";
+ } else if (strcmp(region,"NS") == 0) {
+ timezone = "America/Halifax";
+ } else if (strcmp(region,"NU") == 0) {
+ timezone = "America/Rankin_Inlet";
+ } else if (strcmp(region,"ON") == 0) {
+ timezone = "America/Rainy_River";
+ } else if (strcmp(region,"PE") == 0) {
+ timezone = "America/Halifax";
+ } else if (strcmp(region,"QC") == 0) {
+ timezone = "America/Montreal";
+ } else if (strcmp(region,"SK") == 0) {
+ timezone = "America/Regina";
+ } else {
+ timezone = "America/Rainy_River";
+ }
+ } else if (strcmp(country,"AS") == 0) {
+ timezone = "US/Samoa";
+ } else if (strcmp(country,"CI") == 0) {
+ timezone = "Africa/Abidjan";
+ } else if (strcmp(country,"GH") == 0) {
+ timezone = "Africa/Accra";
+ } else if (strcmp(country,"DZ") == 0) {
+ timezone = "Africa/Algiers";
+ } else if (strcmp(country,"ER") == 0) {
+ timezone = "Africa/Asmera";
+ } else if (strcmp(country,"ML") == 0) {
+ timezone = "Africa/Bamako";
+ } else if (strcmp(country,"CF") == 0) {
+ timezone = "Africa/Bangui";
+ } else if (strcmp(country,"GM") == 0) {
+ timezone = "Africa/Banjul";
+ } else if (strcmp(country,"GW") == 0) {
+ timezone = "Africa/Bissau";
+ } else if (strcmp(country,"CG") == 0) {
+ timezone = "Africa/Brazzaville";
+ } else if (strcmp(country,"BI") == 0) {
+ timezone = "Africa/Bujumbura";
+ } else if (strcmp(country,"EG") == 0) {
+ timezone = "Africa/Cairo";
+ } else if (strcmp(country,"MA") == 0) {
+ timezone = "Africa/Casablanca";
+ } else if (strcmp(country,"GN") == 0) {
+ timezone = "Africa/Conakry";
+ } else if (strcmp(country,"SN") == 0) {
+ timezone = "Africa/Dakar";
+ } else if (strcmp(country,"DJ") == 0) {
+ timezone = "Africa/Djibouti";
+ } else if (strcmp(country,"SL") == 0) {
+ timezone = "Africa/Freetown";
+ } else if (strcmp(country,"BW") == 0) {
+ timezone = "Africa/Gaborone";
+ } else if (strcmp(country,"ZW") == 0) {
+ timezone = "Africa/Harare";
+ } else if (strcmp(country,"ZA") == 0) {
+ timezone = "Africa/Johannesburg";
+ } else if (strcmp(country,"UG") == 0) {
+ timezone = "Africa/Kampala";
+ } else if (strcmp(country,"SD") == 0) {
+ timezone = "Africa/Khartoum";
+ } else if (strcmp(country,"RW") == 0) {
+ timezone = "Africa/Kigali";
+ } else if (strcmp(country,"NG") == 0) {
+ timezone = "Africa/Lagos";
+ } else if (strcmp(country,"GA") == 0) {
+ timezone = "Africa/Libreville";
+ } else if (strcmp(country,"TG") == 0) {
+ timezone = "Africa/Lome";
+ } else if (strcmp(country,"AO") == 0) {
+ timezone = "Africa/Luanda";
+ } else if (strcmp(country,"ZM") == 0) {
+ timezone = "Africa/Lusaka";
+ } else if (strcmp(country,"GQ") == 0) {
+ timezone = "Africa/Malabo";
+ } else if (strcmp(country,"MZ") == 0) {
+ timezone = "Africa/Maputo";
+ } else if (strcmp(country,"LS") == 0) {
+ timezone = "Africa/Maseru";
+ } else if (strcmp(country,"SZ") == 0) {
+ timezone = "Africa/Mbabane";
+ } else if (strcmp(country,"SO") == 0) {
+ timezone = "Africa/Mogadishu";
+ } else if (strcmp(country,"LR") == 0) {
+ timezone = "Africa/Monrovia";
+ } else if (strcmp(country,"KE") == 0) {
+ timezone = "Africa/Nairobi";
+ } else if (strcmp(country,"TD") == 0) {
+ timezone = "Africa/Ndjamena";
+ } else if (strcmp(country,"NE") == 0) {
+ timezone = "Africa/Niamey";
+ } else if (strcmp(country,"MR") == 0) {
+ timezone = "Africa/Nouakchott";
+ } else if (strcmp(country,"BF") == 0) {
+ timezone = "Africa/Ouagadougou";
+ } else if (strcmp(country,"ST") == 0) {
+ timezone = "Africa/Sao_Tome";
+ } else if (strcmp(country,"LY") == 0) {
+ timezone = "Africa/Tripoli";
+ } else if (strcmp(country,"TN") == 0) {
+ timezone = "Africa/Tunis";
+ } else if (strcmp(country,"AI") == 0) {
+ timezone = "America/Anguilla";
+ } else if (strcmp(country,"AG") == 0) {
+ timezone = "America/Antigua";
+ } else if (strcmp(country,"AW") == 0) {
+ timezone = "America/Aruba";
+ } else if (strcmp(country,"BB") == 0) {
+ timezone = "America/Barbados";
+ } else if (strcmp(country,"BZ") == 0) {
+ timezone = "America/Belize";
+ } else if (strcmp(country,"CO") == 0) {
+ timezone = "America/Bogota";
+ } else if (strcmp(country,"VE") == 0) {
+ timezone = "America/Caracas";
+ } else if (strcmp(country,"KY") == 0) {
+ timezone = "America/Cayman";
+ } else if (strcmp(country,"MX") == 0) {
+ timezone = "America/Chihuahua";
+ } else if (strcmp(country,"CR") == 0) {
+ timezone = "America/Costa_Rica";
+ } else if (strcmp(country,"DM") == 0) {
+ timezone = "America/Dominica";
+ } else if (strcmp(country,"SV") == 0) {
+ timezone = "America/El_Salvador";
+ } else if (strcmp(country,"GD") == 0) {
+ timezone = "America/Grenada";
+ } else if (strcmp(country,"FR") == 0) {
+ timezone = "Europe/Paris";
+ } else if (strcmp(country,"GP") == 0) {
+ timezone = "America/Guadeloupe";
+ } else if (strcmp(country,"GT") == 0) {
+ timezone = "America/Guatemala";
+ } else if (strcmp(country,"EC") == 0) {
+ timezone = "America/Guayaquil";
+ } else if (strcmp(country,"GY") == 0) {
+ timezone = "America/Guyana";
+ } else if (strcmp(country,"CU") == 0) {
+ timezone = "America/Havana";
+ } else if (strcmp(country,"JM") == 0) {
+ timezone = "America/Jamaica";
+ } else if (strcmp(country,"BO") == 0) {
+ timezone = "America/La_Paz";
+ } else if (strcmp(country,"PE") == 0) {
+ timezone = "America/Lima";
+ } else if (strcmp(country,"NI") == 0) {
+ timezone = "America/Managua";
+ } else if (strcmp(country,"MQ") == 0) {
+ timezone = "America/Martinique";
+ } else if (strcmp(country,"AR") == 0) {
+ timezone = "America/Mendoza";
+ } else if (strcmp(country,"UY") == 0) {
+ timezone = "America/Montevideo";
+ } else if (strcmp(country,"MS") == 0) {
+ timezone = "America/Montserrat";
+ } else if (strcmp(country,"BS") == 0) {
+ timezone = "America/Nassau";
+ } else if (strcmp(country,"PA") == 0) {
+ timezone = "America/Panama";
+ } else if (strcmp(country,"SR") == 0) {
+ timezone = "America/Paramaribo";
+ } else if (strcmp(country,"PR") == 0) {
+ timezone = "America/Puerto_Rico";
+ } else if (strcmp(country,"KN") == 0) {
+ timezone = "America/St_Kitts";
+ } else if (strcmp(country,"LC") == 0) {
+ timezone = "America/St_Lucia";
+ } else if (strcmp(country,"VC") == 0) {
+ timezone = "America/St_Vincent";
+ } else if (strcmp(country,"HN") == 0) {
+ timezone = "America/Tegucigalpa";
+ } else if (strcmp(country,"YE") == 0) {
+ timezone = "Asia/Aden";
+ } else if (strcmp(country,"KZ") == 0) {
+ timezone = "Asia/Almaty";
+ } else if (strcmp(country,"JO") == 0) {
+ timezone = "Asia/Amman";
+ } else if (strcmp(country,"TM") == 0) {
+ timezone = "Asia/Ashgabat";
+ } else if (strcmp(country,"IQ") == 0) {
+ timezone = "Asia/Baghdad";
+ } else if (strcmp(country,"BH") == 0) {
+ timezone = "Asia/Bahrain";
+ } else if (strcmp(country,"AZ") == 0) {
+ timezone = "Asia/Baku";
+ } else if (strcmp(country,"TH") == 0) {
+ timezone = "Asia/Bangkok";
+ } else if (strcmp(country,"LB") == 0) {
+ timezone = "Asia/Beirut";
+ } else if (strcmp(country,"KG") == 0) {
+ timezone = "Asia/Bishkek";
+ } else if (strcmp(country,"BN") == 0) {
+ timezone = "Asia/Brunei";
+ } else if (strcmp(country,"IN") == 0) {
+ timezone = "Asia/Calcutta";
+ } else if (strcmp(country,"MN") == 0) {
+ timezone = "Asia/Choibalsan";
+ } else if (strcmp(country,"CN") == 0) {
+ timezone = "Asia/Chongqing";
+ } else if (strcmp(country,"LK") == 0) {
+ timezone = "Asia/Colombo";
+ } else if (strcmp(country,"BD") == 0) {
+ timezone = "Asia/Dhaka";
+ } else if (strcmp(country,"AE") == 0) {
+ timezone = "Asia/Dubai";
+ } else if (strcmp(country,"TJ") == 0) {
+ timezone = "Asia/Dushanbe";
+ } else if (strcmp(country,"HK") == 0) {
+ timezone = "Asia/Hong_Kong";
+ } else if (strcmp(country,"TR") == 0) {
+ timezone = "Asia/Istanbul";
+ } else if (strcmp(country,"ID") == 0) {
+ timezone = "Asia/Jakarta";
+ } else if (strcmp(country,"IL") == 0) {
+ timezone = "Asia/Jerusalem";
+ } else if (strcmp(country,"AF") == 0) {
+ timezone = "Asia/Kabul";
+ } else if (strcmp(country,"PK") == 0) {
+ timezone = "Asia/Karachi";
+ } else if (strcmp(country,"NP") == 0) {
+ timezone = "Asia/Katmandu";
+ } else if (strcmp(country,"KW") == 0) {
+ timezone = "Asia/Kuwait";
+ } else if (strcmp(country,"MO") == 0) {
+ timezone = "Asia/Macao";
+ } else if (strcmp(country,"PH") == 0) {
+ timezone = "Asia/Manila";
+ } else if (strcmp(country,"OM") == 0) {
+ timezone = "Asia/Muscat";
+ } else if (strcmp(country,"CY") == 0) {
+ timezone = "Asia/Nicosia";
+ } else if (strcmp(country,"KP") == 0) {
+ timezone = "Asia/Pyongyang";
+ } else if (strcmp(country,"QA") == 0) {
+ timezone = "Asia/Qatar";
+ } else if (strcmp(country,"MM") == 0) {
+ timezone = "Asia/Rangoon";
+ } else if (strcmp(country,"SA") == 0) {
+ timezone = "Asia/Riyadh";
+ } else if (strcmp(country,"KR") == 0) {
+ timezone = "Asia/Seoul";
+ } else if (strcmp(country,"SG") == 0) {
+ timezone = "Asia/Singapore";
+ } else if (strcmp(country,"TW") == 0) {
+ timezone = "Asia/Taipei";
+ } else if (strcmp(country,"UZ") == 0) {
+ timezone = "Asia/Tashkent";
+ } else if (strcmp(country,"GE") == 0) {
+ timezone = "Asia/Tbilisi";
+ } else if (strcmp(country,"BT") == 0) {
+ timezone = "Asia/Thimphu";
+ } else if (strcmp(country,"JP") == 0) {
+ timezone = "Asia/Tokyo";
+ } else if (strcmp(country,"LA") == 0) {
+ timezone = "Asia/Vientiane";
+ } else if (strcmp(country,"AM") == 0) {
+ timezone = "Asia/Yerevan";
+ } else if (strcmp(country,"PT") == 0) {
+ timezone = "Atlantic/Azores";
+ } else if (strcmp(country,"BM") == 0) {
+ timezone = "Atlantic/Bermuda";
+ } else if (strcmp(country,"CV") == 0) {
+ timezone = "Atlantic/Cape_Verde";
+ } else if (strcmp(country,"FO") == 0) {
+ timezone = "Atlantic/Faeroe";
+ } else if (strcmp(country,"IS") == 0) {
+ timezone = "Atlantic/Reykjavik";
+ } else if (strcmp(country,"GS") == 0) {
+ timezone = "Atlantic/South_Georgia";
+ } else if (strcmp(country,"SH") == 0) {
+ timezone = "Atlantic/St_Helena";
+ } else if (strcmp(country,"AU") == 0) {
+ timezone = "Australia/Queensland";
+ } else if (strcmp(country,"BR") == 0) {
+ timezone = "Brazil/Acre";
+ } else if (strcmp(country,"CL") == 0) {
+ timezone = "Chile/Continental";
+ } else if (strcmp(country,"NL") == 0) {
+ timezone = "Europe/Amsterdam";
+ } else if (strcmp(country,"AD") == 0) {
+ timezone = "Europe/Andorra";
+ } else if (strcmp(country,"GR") == 0) {
+ timezone = "Europe/Athens";
+ } else if (strcmp(country,"YU") == 0) {
+ timezone = "Europe/Belgrade";
+ } else if (strcmp(country,"DE") == 0) {
+ timezone = "Europe/Berlin";
+ } else if (strcmp(country,"SK") == 0) {
+ timezone = "Europe/Bratislava";
+ } else if (strcmp(country,"BE") == 0) {
+ timezone = "Europe/Brussels";
+ } else if (strcmp(country,"RO") == 0) {
+ timezone = "Europe/Bucharest";
+ } else if (strcmp(country,"HU") == 0) {
+ timezone = "Europe/Budapest";
+ } else if (strcmp(country,"DK") == 0) {
+ timezone = "Europe/Copenhagen";
+ } else if (strcmp(country,"IE") == 0) {
+ timezone = "Europe/Dublin";
+ } else if (strcmp(country,"GI") == 0) {
+ timezone = "Europe/Gibraltar";
+ } else if (strcmp(country,"FI") == 0) {
+ timezone = "Europe/Helsinki";
+ } else if (strcmp(country,"UA") == 0) {
+ timezone = "Europe/Kiev";
+ } else if (strcmp(country,"SI") == 0) {
+ timezone = "Europe/Ljubljana";
+ } else if (strcmp(country,"GB") == 0) {
+ timezone = "Europe/London";
+ } else if (strcmp(country,"LU") == 0) {
+ timezone = "Europe/Luxembourg";
+ } else if (strcmp(country,"ES") == 0) {
+ timezone = "Europe/Madrid";
+ } else if (strcmp(country,"MT") == 0) {
+ timezone = "Europe/Malta";
+ } else if (strcmp(country,"BY") == 0) {
+ timezone = "Europe/Minsk";
+ } else if (strcmp(country,"MC") == 0) {
+ timezone = "Europe/Monaco";
+ } else if (strcmp(country,"RU") == 0) {
+ timezone = "Europe/Moscow";
+ } else if (strcmp(country,"NO") == 0) {
+ timezone = "Europe/Oslo";
+ } else if (strcmp(country,"CZ") == 0) {
+ timezone = "Europe/Prague";
+ } else if (strcmp(country,"LV") == 0) {
+ timezone = "Europe/Riga";
+ } else if (strcmp(country,"IT") == 0) {
+ timezone = "Europe/Rome";
+ } else if (strcmp(country,"SM") == 0) {
+ timezone = "Europe/San_Marino";
+ } else if (strcmp(country,"BA") == 0) {
+ timezone = "Europe/Sarajevo";
+ } else if (strcmp(country,"MK") == 0) {
+ timezone = "Europe/Skopje";
+ } else if (strcmp(country,"BG") == 0) {
+ timezone = "Europe/Sofia";
+ } else if (strcmp(country,"SE") == 0) {
+ timezone = "Europe/Stockholm";
+ } else if (strcmp(country,"EE") == 0) {
+ timezone = "Europe/Tallinn";
+ } else if (strcmp(country,"AL") == 0) {
+ timezone = "Europe/Tirane";
+ } else if (strcmp(country,"LI") == 0) {
+ timezone = "Europe/Vaduz";
+ } else if (strcmp(country,"VA") == 0) {
+ timezone = "Europe/Vatican";
+ } else if (strcmp(country,"AT") == 0) {
+ timezone = "Europe/Vienna";
+ } else if (strcmp(country,"LT") == 0) {
+ timezone = "Europe/Vilnius";
+ } else if (strcmp(country,"PL") == 0) {
+ timezone = "Europe/Warsaw";
+ } else if (strcmp(country,"HR") == 0) {
+ timezone = "Europe/Zagreb";
+ } else if (strcmp(country,"IR") == 0) {
+ timezone = "Asia/Tehran";
+ } else if (strcmp(country,"NZ") == 0) {
+ timezone = "Pacific/Auckland";
+ } else if (strcmp(country,"MG") == 0) {
+ timezone = "Indian/Antananarivo";
+ } else if (strcmp(country,"CX") == 0) {
+ timezone = "Indian/Christmas";
+ } else if (strcmp(country,"CC") == 0) {
+ timezone = "Indian/Cocos";
+ } else if (strcmp(country,"KM") == 0) {
+ timezone = "Indian/Comoro";
+ } else if (strcmp(country,"MV") == 0) {
+ timezone = "Indian/Maldives";
+ } else if (strcmp(country,"MU") == 0) {
+ timezone = "Indian/Mauritius";
+ } else if (strcmp(country,"YT") == 0) {
+ timezone = "Indian/Mayotte";
+ } else if (strcmp(country,"RE") == 0) {
+ timezone = "Indian/Reunion";
+ } else if (strcmp(country,"FJ") == 0) {
+ timezone = "Pacific/Fiji";
+ } else if (strcmp(country,"TV") == 0) {
+ timezone = "Pacific/Funafuti";
+ } else if (strcmp(country,"GU") == 0) {
+ timezone = "Pacific/Guam";
+ } else if (strcmp(country,"NR") == 0) {
+ timezone = "Pacific/Nauru";
+ } else if (strcmp(country,"NU") == 0) {
+ timezone = "Pacific/Niue";
+ } else if (strcmp(country,"NF") == 0) {
+ timezone = "Pacific/Norfolk";
+ } else if (strcmp(country,"PW") == 0) {
+ timezone = "Pacific/Palau";
+ } else if (strcmp(country,"PN") == 0) {
+ timezone = "Pacific/Pitcairn";
+ } else if (strcmp(country,"CK") == 0) {
+ timezone = "Pacific/Rarotonga";
+ } else if (strcmp(country,"WS") == 0) {
+ timezone = "Pacific/Samoa";
+ } else if (strcmp(country,"KI") == 0) {
+ timezone = "Pacific/Tarawa";
+ } else if (strcmp(country,"TO") == 0) {
+ timezone = "Pacific/Tongatapu";
+ } else if (strcmp(country,"WF") == 0) {
+ timezone = "Pacific/Wallis";
+ } else if (strcmp(country,"TZ") == 0) {
+ timezone = "Africa/Dar_es_Salaam";
+ } else if (strcmp(country,"VN") == 0) {
+ timezone = "Asia/Phnom_Penh";
+ } else if (strcmp(country,"KH") == 0) {
+ timezone = "Asia/Phnom_Penh";
+ } else if (strcmp(country,"CM") == 0) {
+ timezone = "Africa/Lagos";
+ } else if (strcmp(country,"DO") == 0) {
+ timezone = "America/Santo_Domingo";
+ } else if (strcmp(country,"TL") == 0) {
+ timezone = "Asia/Jakarta";
+ } else if (strcmp(country,"ET") == 0) {
+ timezone = "Africa/Addis_Ababa";
+ } else if (strcmp(country,"FX") == 0) {
+ timezone = "Europe/Paris";
+ } else if (strcmp(country,"GL") == 0) {
+ timezone = "America/Godthab";
+ } else if (strcmp(country,"HT") == 0) {
+ timezone = "America/Port-au-Prince";
+ } else if (strcmp(country,"CH") == 0) {
+ timezone = "Europe/Zurich";
+ }
+ return timezone;
+}
diff --git a/src/GeoIP-1.4.0/libGeoIP/types.h b/src/GeoIP-1.4.0/libGeoIP/types.h
new file mode 100644
index 0000000..4a8b80a
--- /dev/null
+++ b/src/GeoIP-1.4.0/libGeoIP/types.h
@@ -0,0 +1,140 @@
+/* types.h - some common typedefs
+ * Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ *
+ * This file is part of GNUPG.
+ *
+ * GNUPG is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GNUPG is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.,51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef G10_TYPES_H
+#define G10_TYPES_H
+
+#ifdef HAVE_INTTYPES_H
+/* For uint64_t */
+#include <inttypes.h>
+#endif
+
+/* The AC_CHECK_SIZEOF() in configure fails for some machines.
+ * we provide some fallback values here */
+#if !SIZEOF_UNSIGNED_SHORT
+#undef SIZEOF_UNSIGNED_SHORT
+#define SIZEOF_UNSIGNED_SHORT 2
+#endif
+#if !SIZEOF_UNSIGNED_INT
+#undef SIZEOF_UNSIGNED_INT
+#define SIZEOF_UNSIGNED_INT 4
+#endif
+#if !SIZEOF_UNSIGNED_LONG
+#undef SIZEOF_UNSIGNED_LONG
+#define SIZEOF_UNSIGNED_LONG 4
+#endif
+
+
+#include <sys/types.h>
+
+#ifndef HAVE_BYTE_TYPEDEF
+#undef byte /* maybe there is a macro with this name */
+#ifndef __riscos__
+typedef unsigned char byte;
+#else
+/* Norcroft treats char = unsigned char as legal assignment
+ but char* = unsigned char* as illegal assignment
+ and the same applies to the signed variants as well */
+typedef char byte;
+#endif
+#define HAVE_BYTE_TYPEDEF
+#endif
+
+#ifndef HAVE_USHORT_TYPEDEF
+#undef ushort /* maybe there is a macro with this name */
+typedef unsigned short ushort;
+#define HAVE_USHORT_TYPEDEF
+#endif
+
+#ifndef HAVE_ULONG_TYPEDEF
+#undef ulong /* maybe there is a macro with this name */
+typedef unsigned long ulong;
+#define HAVE_ULONG_TYPEDEF
+#endif
+
+#ifndef HAVE_U16_TYPEDEF
+#undef u16 /* maybe there is a macro with this name */
+#if SIZEOF_UNSIGNED_INT == 2
+typedef unsigned int u16;
+#elif SIZEOF_UNSIGNED_SHORT == 2
+typedef unsigned short u16;
+#else
+#error no typedef for u16
+#endif
+#define HAVE_U16_TYPEDEF
+#endif
+
+#ifndef HAVE_U32_TYPEDEF
+#undef u32 /* maybe there is a macro with this name */
+#if SIZEOF_UNSIGNED_INT == 4
+typedef unsigned int u32;
+#elif SIZEOF_UNSIGNED_LONG == 4
+typedef unsigned long u32;
+#else
+#error no typedef for u32
+#endif
+#define HAVE_U32_TYPEDEF
+#endif
+
+/****************
+ * Warning: Some systems segfault when this u64 typedef and
+ * the dummy code in cipher/md.c is not available. Examples are
+ * Solaris and IRIX.
+ */
+#ifndef HAVE_U64_TYPEDEF
+#undef u64 /* maybe there is a macro with this name */
+#if SIZEOF_UINT64_T == 8
+typedef uint64_t u64;
+#define U64_C(c) (UINT64_C(c))
+#define HAVE_U64_TYPEDEF
+#elif SIZEOF_UNSIGNED_INT == 8
+typedef unsigned int u64;
+#define U64_C(c) (c ## U)
+#define HAVE_U64_TYPEDEF
+#elif SIZEOF_UNSIGNED_LONG == 8
+typedef unsigned long u64;
+#define U64_C(c) (c ## UL)
+#define HAVE_U64_TYPEDEF
+#elif SIZEOF_UNSIGNED_LONG_LONG == 8
+typedef unsigned long long u64;
+#define U64_C(c) (c ## ULL)
+#define HAVE_U64_TYPEDEF
+#endif
+#endif
+
+typedef union {
+ int a;
+ short b;
+ char c[1];
+ long d;
+#ifdef HAVE_U64_TYPEDEF
+ u64 e;
+#endif
+ float f;
+ double g;
+} PROPERLY_ALIGNED_TYPE;
+
+typedef struct string_list {
+ struct string_list *next;
+ unsigned int flags;
+ char d[1];
+} *STRLIST;
+
+#endif /*G10_TYPES_H*/