geoip2_c 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/ext/geoip2/libmaxminddb/.gitignore +35 -0
  3. data/ext/geoip2/libmaxminddb/.gitmodules +9 -0
  4. data/ext/geoip2/libmaxminddb/.perltidyrc +11 -0
  5. data/ext/geoip2/libmaxminddb/.travis.yml +48 -0
  6. data/ext/geoip2/libmaxminddb/.uncrustify.cfg +78 -0
  7. data/ext/geoip2/libmaxminddb/AUTHORS +0 -0
  8. data/ext/geoip2/libmaxminddb/Changes.md +238 -0
  9. data/ext/geoip2/libmaxminddb/LICENSE +202 -0
  10. data/ext/geoip2/libmaxminddb/Makefile.am +41 -0
  11. data/ext/geoip2/libmaxminddb/NOTICE +13 -0
  12. data/ext/geoip2/libmaxminddb/README.dev.md +58 -0
  13. data/ext/geoip2/libmaxminddb/README.md +122 -0
  14. data/ext/geoip2/libmaxminddb/appveyor.yml +33 -0
  15. data/ext/geoip2/libmaxminddb/bin/Makefile.am +5 -0
  16. data/ext/geoip2/libmaxminddb/bin/mmdblookup.c +397 -0
  17. data/ext/geoip2/libmaxminddb/bootstrap +21 -0
  18. data/ext/geoip2/libmaxminddb/common.mk +7 -0
  19. data/ext/geoip2/libmaxminddb/configure.ac +132 -0
  20. data/ext/geoip2/libmaxminddb/dev-bin/make-man-pages.pl +76 -0
  21. data/ext/geoip2/libmaxminddb/dev-bin/ppa-release.sh +50 -0
  22. data/ext/geoip2/libmaxminddb/dev-bin/regen-prototypes.pl +136 -0
  23. data/ext/geoip2/libmaxminddb/dev-bin/regen-win32-test-projs.pl +54 -0
  24. data/ext/geoip2/libmaxminddb/dev-bin/release.sh +106 -0
  25. data/ext/geoip2/libmaxminddb/dev-bin/uncrustify-all.sh +21 -0
  26. data/ext/geoip2/libmaxminddb/dev-bin/valgrind-all.pl +46 -0
  27. data/ext/geoip2/libmaxminddb/doc/libmaxminddb.md +889 -0
  28. data/ext/geoip2/libmaxminddb/doc/mmdblookup.md +103 -0
  29. data/ext/geoip2/libmaxminddb/include/maxminddb.h +232 -0
  30. data/ext/geoip2/libmaxminddb/include/maxminddb_config.h.in +14 -0
  31. data/ext/geoip2/libmaxminddb/projects/VS12/README.md +59 -0
  32. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb-release.props +32 -0
  33. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb-x64.props +14 -0
  34. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.props +32 -0
  35. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.sln +150 -0
  36. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.vcxproj +141 -0
  37. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.vcxproj.filters +26 -0
  38. data/ext/geoip2/libmaxminddb/projects/VS12/maxminddb_config.h +14 -0
  39. data/ext/geoip2/libmaxminddb/projects/VS12-tests/bad_pointers.vcxproj +105 -0
  40. data/ext/geoip2/libmaxminddb/projects/VS12-tests/basic_lookup.vcxproj +105 -0
  41. data/ext/geoip2/libmaxminddb/projects/VS12-tests/data_entry_list.vcxproj +105 -0
  42. data/ext/geoip2/libmaxminddb/projects/VS12-tests/data_types.vcxproj +105 -0
  43. data/ext/geoip2/libmaxminddb/projects/VS12-tests/dump.vcxproj +105 -0
  44. data/ext/geoip2/libmaxminddb/projects/VS12-tests/get_value.vcxproj +105 -0
  45. data/ext/geoip2/libmaxminddb/projects/VS12-tests/get_value_pointer_bug.vcxproj +105 -0
  46. data/ext/geoip2/libmaxminddb/projects/VS12-tests/ipv4_start_cache.vcxproj +105 -0
  47. data/ext/geoip2/libmaxminddb/projects/VS12-tests/ipv6_lookup_in_ipv4.vcxproj +105 -0
  48. data/ext/geoip2/libmaxminddb/projects/VS12-tests/libtap.vcxproj +85 -0
  49. data/ext/geoip2/libmaxminddb/projects/VS12-tests/maxminddb_test_helper.vcxproj +107 -0
  50. data/ext/geoip2/libmaxminddb/projects/VS12-tests/metadata.vcxproj +105 -0
  51. data/ext/geoip2/libmaxminddb/projects/VS12-tests/metadata_pointers.vcxproj +105 -0
  52. data/ext/geoip2/libmaxminddb/projects/VS12-tests/no_map_get_value.vcxproj +105 -0
  53. data/ext/geoip2/libmaxminddb/projects/VS12-tests/read_node.vcxproj +105 -0
  54. data/ext/geoip2/libmaxminddb/projects/VS12-tests/shared.vcxproj +104 -0
  55. data/ext/geoip2/libmaxminddb/projects/VS12-tests/threads.vcxproj +103 -0
  56. data/ext/geoip2/libmaxminddb/projects/VS12-tests/version.vcxproj +105 -0
  57. data/ext/geoip2/libmaxminddb/projects/test.vcxproj.template +105 -0
  58. data/ext/geoip2/libmaxminddb/src/Makefile.am +9 -0
  59. data/ext/geoip2/libmaxminddb/src/libmaxminddb.pc.in +11 -0
  60. data/ext/geoip2/libmaxminddb/src/maxminddb-compat-util.h +167 -0
  61. data/ext/geoip2/libmaxminddb/src/maxminddb.c +2171 -0
  62. data/ext/geoip2/libmaxminddb/t/Makefile.am +23 -0
  63. data/ext/geoip2/libmaxminddb/t/bad_databases_t.c +66 -0
  64. data/ext/geoip2/libmaxminddb/t/bad_pointers_t.c +53 -0
  65. data/ext/geoip2/libmaxminddb/t/basic_lookup_t.c +172 -0
  66. data/ext/geoip2/libmaxminddb/t/compile_c++_t.pl +107 -0
  67. data/ext/geoip2/libmaxminddb/t/data_entry_list_t.c +353 -0
  68. data/ext/geoip2/libmaxminddb/t/data_types_t.c +439 -0
  69. data/ext/geoip2/libmaxminddb/t/dump_t.c +103 -0
  70. data/ext/geoip2/libmaxminddb/t/get_value_pointer_bug_t.c +66 -0
  71. data/ext/geoip2/libmaxminddb/t/get_value_t.c +249 -0
  72. data/ext/geoip2/libmaxminddb/t/ipv4_start_cache_t.c +36 -0
  73. data/ext/geoip2/libmaxminddb/t/ipv6_lookup_in_ipv4_t.c +48 -0
  74. data/ext/geoip2/libmaxminddb/t/maxminddb_test_helper.c +255 -0
  75. data/ext/geoip2/libmaxminddb/t/maxminddb_test_helper.h +69 -0
  76. data/ext/geoip2/libmaxminddb/t/metadata_pointers_t.c +32 -0
  77. data/ext/geoip2/libmaxminddb/t/metadata_t.c +226 -0
  78. data/ext/geoip2/libmaxminddb/t/mmdblookup_t.pl +158 -0
  79. data/ext/geoip2/libmaxminddb/t/no_map_get_value_t.c +32 -0
  80. data/ext/geoip2/libmaxminddb/t/read_node_t.c +157 -0
  81. data/ext/geoip2/libmaxminddb/t/threads_t.c +196 -0
  82. data/ext/geoip2/libmaxminddb/t/version_t.c +10 -0
  83. data/geoip2_c.gemspec +1 -1
  84. data/lib/geoip2/version.rb +1 -1
  85. metadata +82 -1
@@ -0,0 +1,103 @@
1
+ # NAME
2
+
3
+ mmdblookup - a utility to look up an IP address in a MaxMind DB file
4
+
5
+ # SYNOPSIS
6
+
7
+ mmdblookup --file [FILE PATH] --ip [IP ADDRESS] [DATA PATH]
8
+
9
+ # DESCRIPTION
10
+
11
+ `mmdblookup` looks up an IP address in the specified MaxMind DB file. The
12
+ record for the IP address is displayed in a JSON-like structure with type
13
+ annotations.
14
+
15
+ If an IP's data entry resolves to a map or array, you can provide a lookup
16
+ path to only show part of that data.
17
+
18
+ For example, given a JSON structure like this:
19
+
20
+ ```js
21
+ {
22
+ "names": {
23
+ "en": "Germany",
24
+ "de": "Deutschland"
25
+ },
26
+ "cities": [ "Berlin", "Frankfurt" ]
27
+ }
28
+ ```
29
+
30
+ You could look up just the English name by calling mmdblookup with a lookup
31
+ path of:
32
+
33
+ ```bash
34
+ mmdblookup --file ... --ip ... names en
35
+ ```
36
+
37
+ Or you could look up the second city in the list with:
38
+
39
+ ```bash
40
+ mmdblookup --file ... --ip ... cities 1
41
+ ```
42
+
43
+ Array numbering begins with zero (0).
44
+
45
+ If you do not provide a path to lookup, all of the information for a given IP
46
+ will be shown.
47
+
48
+ # OPTIONS
49
+
50
+ This application accepts the following options:
51
+
52
+ -f, --file
53
+
54
+ : The path to the MMDB file. Required.
55
+
56
+ -i, --ip
57
+
58
+ : The IP address to look up. Required.
59
+
60
+ -v, --verbose
61
+
62
+ : Turns on verbose output. Specifically, this causes this
63
+ application to output the database metadata.
64
+
65
+ --version
66
+
67
+ : Print the program's version number and exit.
68
+
69
+ -h, -?, --help
70
+
71
+ : Show usage information.
72
+
73
+ # BUG REPORTS AND PULL REQUESTS
74
+
75
+ Please report all issues to
76
+ [our GitHub issue tracker](https://github.com/maxmind/libmaxminddb/issues). We
77
+ welcome bug reports and pull requests. Please note that pull requests are
78
+ greatly preferred over patches.
79
+
80
+ # AUTHORS
81
+
82
+ This utility was written by Boris Zentner (bzentner@maxmind.com) and Dave
83
+ Rolsky (drolsky@maxmind.com).
84
+
85
+ # COPYRIGHT AND LICENSE
86
+
87
+ Copyright 2013-2014 MaxMind, Inc.
88
+
89
+ Licensed under the Apache License, Version 2.0 (the "License");
90
+ you may not use this file except in compliance with the License.
91
+ You may obtain a copy of the License at
92
+
93
+ http://www.apache.org/licenses/LICENSE-2.0
94
+
95
+ Unless required by applicable law or agreed to in writing, software
96
+ distributed under the License is distributed on an "AS IS" BASIS,
97
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
98
+ See the License for the specific language governing permissions and
99
+ limitations under the License.
100
+
101
+ # SEE ALSO
102
+
103
+ libmaxminddb(3)
@@ -0,0 +1,232 @@
1
+ #ifdef __cplusplus
2
+ extern "C" {
3
+ #endif
4
+
5
+ #ifndef MAXMINDDB_H
6
+ #define MAXMINDDB_H
7
+
8
+ #ifndef _POSIX_C_SOURCE
9
+ #define _POSIX_C_SOURCE 200112L
10
+ #endif
11
+
12
+ #include "maxminddb_config.h"
13
+ #include <stdarg.h>
14
+ #include <stdbool.h>
15
+ #include <stdint.h>
16
+ #include <stdio.h>
17
+ #include <sys/types.h>
18
+
19
+ #ifdef _WIN32
20
+ #include <winsock2.h>
21
+ #include <ws2tcpip.h>
22
+ /* libmaxminddb package version from configure */
23
+ #define PACKAGE_VERSION "1.2.1"
24
+
25
+ typedef ADDRESS_FAMILY sa_family_t;
26
+
27
+ #if defined(_MSC_VER)
28
+ /* MSVC doesn't define signed size_t, copy it from configure */
29
+ #define ssize_t SSIZE_T
30
+
31
+ /* MSVC doesn't support restricted pointers */
32
+ #define restrict
33
+ #endif
34
+ #else
35
+ #include <netdb.h>
36
+ #include <netinet/in.h>
37
+ #include <sys/socket.h>
38
+ #endif
39
+
40
+ #define MMDB_DATA_TYPE_EXTENDED (0)
41
+ #define MMDB_DATA_TYPE_POINTER (1)
42
+ #define MMDB_DATA_TYPE_UTF8_STRING (2)
43
+ #define MMDB_DATA_TYPE_DOUBLE (3)
44
+ #define MMDB_DATA_TYPE_BYTES (4)
45
+ #define MMDB_DATA_TYPE_UINT16 (5)
46
+ #define MMDB_DATA_TYPE_UINT32 (6)
47
+ #define MMDB_DATA_TYPE_MAP (7)
48
+ #define MMDB_DATA_TYPE_INT32 (8)
49
+ #define MMDB_DATA_TYPE_UINT64 (9)
50
+ #define MMDB_DATA_TYPE_UINT128 (10)
51
+ #define MMDB_DATA_TYPE_ARRAY (11)
52
+ #define MMDB_DATA_TYPE_CONTAINER (12)
53
+ #define MMDB_DATA_TYPE_END_MARKER (13)
54
+ #define MMDB_DATA_TYPE_BOOLEAN (14)
55
+ #define MMDB_DATA_TYPE_FLOAT (15)
56
+
57
+ #define MMDB_RECORD_TYPE_SEARCH_NODE (0)
58
+ #define MMDB_RECORD_TYPE_EMPTY (1)
59
+ #define MMDB_RECORD_TYPE_DATA (2)
60
+ #define MMDB_RECORD_TYPE_INVALID (3)
61
+
62
+ /* flags for open */
63
+ #define MMDB_MODE_MMAP (1)
64
+ #define MMDB_MODE_MASK (7)
65
+
66
+ /* error codes */
67
+ #define MMDB_SUCCESS (0)
68
+ #define MMDB_FILE_OPEN_ERROR (1)
69
+ #define MMDB_CORRUPT_SEARCH_TREE_ERROR (2)
70
+ #define MMDB_INVALID_METADATA_ERROR (3)
71
+ #define MMDB_IO_ERROR (4)
72
+ #define MMDB_OUT_OF_MEMORY_ERROR (5)
73
+ #define MMDB_UNKNOWN_DATABASE_FORMAT_ERROR (6)
74
+ #define MMDB_INVALID_DATA_ERROR (7)
75
+ #define MMDB_INVALID_LOOKUP_PATH_ERROR (8)
76
+ #define MMDB_LOOKUP_PATH_DOES_NOT_MATCH_DATA_ERROR (9)
77
+ #define MMDB_INVALID_NODE_NUMBER_ERROR (10)
78
+ #define MMDB_IPV6_LOOKUP_IN_IPV4_DATABASE_ERROR (11)
79
+
80
+ #if !(MMDB_UINT128_IS_BYTE_ARRAY)
81
+ #if MMDB_UINT128_USING_MODE
82
+ typedef unsigned int mmdb_uint128_t __attribute__ ((__mode__(TI)));
83
+ #else
84
+ typedef unsigned __int128 mmdb_uint128_t;
85
+ #endif
86
+ #endif
87
+
88
+ /* This is a pointer into the data section for a given IP address lookup */
89
+ typedef struct MMDB_entry_s {
90
+ struct MMDB_s *mmdb;
91
+ uint32_t offset;
92
+ } MMDB_entry_s;
93
+
94
+ typedef struct MMDB_lookup_result_s {
95
+ bool found_entry;
96
+ MMDB_entry_s entry;
97
+ uint16_t netmask;
98
+ } MMDB_lookup_result_s;
99
+
100
+ typedef struct MMDB_entry_data_s {
101
+ bool has_data;
102
+ union {
103
+ uint32_t pointer;
104
+ const char *utf8_string;
105
+ double double_value;
106
+ const uint8_t *bytes;
107
+ uint16_t uint16;
108
+ uint32_t uint32;
109
+ int32_t int32;
110
+ uint64_t uint64;
111
+ #if MMDB_UINT128_IS_BYTE_ARRAY
112
+ uint8_t uint128[16];
113
+ #else
114
+ mmdb_uint128_t uint128;
115
+ #endif
116
+ bool boolean;
117
+ float float_value;
118
+ };
119
+ /* This is a 0 if a given entry cannot be found. This can only happen
120
+ * when a call to MMDB_(v)get_value() asks for hash keys or array
121
+ * indices that don't exist. */
122
+ uint32_t offset;
123
+ /* This is the next entry in the data section, but it's really only
124
+ * relevant for entries that part of a larger map or array
125
+ * struct. There's no good reason for an end user to look at this
126
+ * directly. */
127
+ uint32_t offset_to_next;
128
+ /* This is only valid for strings, utf8_strings or binary data */
129
+ uint32_t data_size;
130
+ /* This is an MMDB_DATA_TYPE_* constant */
131
+ uint32_t type;
132
+ } MMDB_entry_data_s;
133
+
134
+ /* This is the return type when someone asks for all the entry data in a map or array */
135
+ typedef struct MMDB_entry_data_list_s {
136
+ MMDB_entry_data_s entry_data;
137
+ struct MMDB_entry_data_list_s *next;
138
+ } MMDB_entry_data_list_s;
139
+
140
+ typedef struct MMDB_description_s {
141
+ const char *language;
142
+ const char *description;
143
+ } MMDB_description_s;
144
+
145
+ typedef struct MMDB_metadata_s {
146
+ uint32_t node_count;
147
+ uint16_t record_size;
148
+ uint16_t ip_version;
149
+ const char *database_type;
150
+ struct {
151
+ size_t count;
152
+ const char **names;
153
+ } languages;
154
+ uint16_t binary_format_major_version;
155
+ uint16_t binary_format_minor_version;
156
+ uint64_t build_epoch;
157
+ struct {
158
+ size_t count;
159
+ MMDB_description_s **descriptions;
160
+ } description;
161
+ } MMDB_metadata_s;
162
+
163
+ typedef struct MMDB_ipv4_start_node_s {
164
+ uint16_t netmask;
165
+ uint32_t node_value;
166
+ } MMDB_ipv4_start_node_s;
167
+
168
+ typedef struct MMDB_s {
169
+ uint32_t flags;
170
+ const char *filename;
171
+ ssize_t file_size;
172
+ const uint8_t *file_content;
173
+ const uint8_t *data_section;
174
+ uint32_t data_section_size;
175
+ const uint8_t *metadata_section;
176
+ uint32_t metadata_section_size;
177
+ uint16_t full_record_byte_size;
178
+ uint16_t depth;
179
+ MMDB_ipv4_start_node_s ipv4_start_node;
180
+ MMDB_metadata_s metadata;
181
+ } MMDB_s;
182
+
183
+ typedef struct MMDB_search_node_s {
184
+ uint64_t left_record;
185
+ uint64_t right_record;
186
+ uint8_t left_record_type;
187
+ uint8_t right_record_type;
188
+ MMDB_entry_s left_record_entry;
189
+ MMDB_entry_s right_record_entry;
190
+ } MMDB_search_node_s;
191
+
192
+ /* *INDENT-OFF* */
193
+ /* --prototypes automatically generated by dev-bin/regen-prototypes.pl - don't remove this comment */
194
+ extern int MMDB_open(const char *const filename, uint32_t flags, MMDB_s *const mmdb);
195
+ extern MMDB_lookup_result_s MMDB_lookup_string(MMDB_s *const mmdb,
196
+ const char *const ipstr,
197
+ int *const gai_error,
198
+ int *const mmdb_error);
199
+ extern MMDB_lookup_result_s MMDB_lookup_sockaddr(
200
+ MMDB_s *const mmdb,
201
+ const struct sockaddr *const sockaddr,
202
+ int *const mmdb_error);
203
+ extern int MMDB_read_node(MMDB_s *const mmdb, uint32_t node_number,
204
+ MMDB_search_node_s *const node);
205
+ extern int MMDB_get_value(MMDB_entry_s *const start,
206
+ MMDB_entry_data_s *const entry_data,
207
+ ...);
208
+ extern int MMDB_vget_value(MMDB_entry_s *const start,
209
+ MMDB_entry_data_s *const entry_data,
210
+ va_list va_path);
211
+ extern int MMDB_aget_value(MMDB_entry_s *const start,
212
+ MMDB_entry_data_s *const entry_data,
213
+ const char *const *const path);
214
+ extern int MMDB_get_metadata_as_entry_data_list(
215
+ MMDB_s *const mmdb, MMDB_entry_data_list_s **const entry_data_list);
216
+ extern int MMDB_get_entry_data_list(
217
+ MMDB_entry_s *start, MMDB_entry_data_list_s **const entry_data_list);
218
+ extern void MMDB_free_entry_data_list(MMDB_entry_data_list_s *const entry_data_list);
219
+ extern void MMDB_close(MMDB_s *const mmdb);
220
+ extern const char *MMDB_lib_version(void);
221
+ extern int MMDB_dump_entry_data_list(FILE *const stream,
222
+ MMDB_entry_data_list_s *const entry_data_list,
223
+ int indent);
224
+ extern const char *MMDB_strerror(int error_code);
225
+ /* --prototypes end - don't remove this comment-- */
226
+ /* *INDENT-ON* */
227
+
228
+ #endif /* MAXMINDDB_H */
229
+
230
+ #ifdef __cplusplus
231
+ }
232
+ #endif
@@ -0,0 +1,14 @@
1
+ #ifndef MAXMINDDB_CONFIG_H
2
+ #define MAXMINDDB_CONFIG_H
3
+
4
+ #ifndef MMDB_UINT128_USING_MODE
5
+ /* Define as 1 if we we use unsigned int __atribute__ ((__mode__(TI))) for uint128 values */
6
+ #define MMDB_UINT128_USING_MODE 0
7
+ #endif
8
+
9
+ #ifndef MMDB_UINT128_IS_BYTE_ARRAY
10
+ /* Define as 1 if we don't have an unsigned __int128 type */
11
+ #undef MMDB_UINT128_IS_BYTE_ARRAY
12
+ #endif
13
+
14
+ #endif /* MAXMINDDB_CONFIG_H */
@@ -0,0 +1,59 @@
1
+ # Project Notes
2
+
3
+ DO NOT modify project settings for each configuration and/or platform
4
+ on a per-project basis. Use property sheets to set shared configuration
5
+ properties. The rule of thumb - if you set same value for the same
6
+ property in more than one configuration or platform, you did it wrong.
7
+
8
+ ## libmaxminddb.props
9
+
10
+ This is the base property sheet for libMaxMindDB project. It contains
11
+ settings that are shared between all configurations, such as compiler
12
+ warning level, not using link-time code generation, etc.
13
+
14
+ In order to minimize the number of property sheet files, this propery
15
+ sheet also contains settings for Win32 and Debug configurations, which
16
+ are overridden by the x64 and Release property sheets described below.
17
+
18
+ ## libmaxminddb-release.props
19
+
20
+ This property sheet contains all Release settings and is shared between
21
+ Win32 and x64 release builds. It must be located higher than the base
22
+ property sheet in the property Manager window for each configuration
23
+ where it's used (i.e. Release|Win32 and Release|x64).
24
+
25
+ ## libmaxminddb-x64.props
26
+
27
+ This property sheet contains all x64 settings and is shared between all
28
+ Debug and Release x64 configurations. It must be located higher than the
29
+ base property sheet in the property Manager window for each configuration
30
+ where it's used (i.e. Debug|x64 and Release|x64).
31
+
32
+ ## Adding More Projects
33
+
34
+ If you want to add more projects into this solution, follow the same logic
35
+ and create their own property sheets. Do not use libmaxminddb property
36
+ sheets in those projects because it will interfere with their intermediate
37
+ directories. Instead, copy and rename libmaxminddb property sheets as a
38
+ starting point.
39
+
40
+ DO NOT add libmaxminddb.lib to the Additional Dependencies box of command
41
+ line tools or any other libraries you built, for that matter. This box is
42
+ only for standard Windows libraries. Instead, add libmaxminddb as a reference
43
+ to all command line tool projects. Do the same for any other library projects
44
+ you added to this solutionn.
45
+
46
+ For external 3rd-party .lib files, create a solution folder called Libraries
47
+ and add Debug, Debug64, Release, Release64 subfolders, then drag and drop all
48
+ versinos of .lib to their respective folders and use Exclude From Build in
49
+ each library file's property to assign them to the proper build confguration.
50
+ Unused libraries will be shown with a traffic stop sign in each configuration.
51
+ If you have a lot of projects, it might be easier to do this by editing .vcxproj
52
+ and .vcxproj.filters in a text editor.
53
+
54
+ # Tests
55
+
56
+ To use the tests, you must download the `libtap` and `maxmind-db` submodules.
57
+ This can be done by running `git submodule update --init --recursive` from
58
+ the Git checkout. Each test source file has a separate project. Once compiled,
59
+ the tests must be run from the base directory of the checkout.
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <ImportGroup Label="PropertySheets" />
4
+ <PropertyGroup Label="UserMacros" />
5
+ <PropertyGroup />
6
+ <ItemDefinitionGroup>
7
+ <ClCompile>
8
+ <Optimization>MaxSpeed</Optimization>
9
+ </ClCompile>
10
+ </ItemDefinitionGroup>
11
+ <ItemDefinitionGroup>
12
+ <ClCompile>
13
+ <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
14
+ </ClCompile>
15
+ </ItemDefinitionGroup>
16
+ <ItemDefinitionGroup>
17
+ <ClCompile>
18
+ <IntrinsicFunctions>true</IntrinsicFunctions>
19
+ </ClCompile>
20
+ </ItemDefinitionGroup>
21
+ <ItemDefinitionGroup>
22
+ <ClCompile>
23
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
24
+ </ClCompile>
25
+ </ItemDefinitionGroup>
26
+ <ItemDefinitionGroup>
27
+ <ClCompile>
28
+ <OmitFramePointers>true</OmitFramePointers>
29
+ </ClCompile>
30
+ </ItemDefinitionGroup>
31
+ <ItemGroup />
32
+ </Project>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <ImportGroup Label="PropertySheets" />
4
+ <PropertyGroup Label="UserMacros" />
5
+ <PropertyGroup>
6
+ <IntDir>$(SolutionDir)$(Platform)\$(Configuration)\obj\</IntDir>
7
+ </PropertyGroup>
8
+ <ItemDefinitionGroup>
9
+ <Lib>
10
+ <TargetMachine>MachineX64</TargetMachine>
11
+ </Lib>
12
+ </ItemDefinitionGroup>
13
+ <ItemGroup />
14
+ </Project>
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <ImportGroup Label="PropertySheets" />
4
+ <PropertyGroup Label="UserMacros" />
5
+ <PropertyGroup>
6
+ <IntDir>$(SolutionDir)$(Configuration)\obj\</IntDir>
7
+ </PropertyGroup>
8
+ <ItemDefinitionGroup>
9
+ <ClCompile>
10
+ <AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
11
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
12
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
13
+ <WarningLevel>Level3</WarningLevel>
14
+ <ExceptionHandling>false</ExceptionHandling>
15
+ <ProgramDataBaseFileName>$(OutDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
16
+ <Optimization>Disabled</Optimization>
17
+ <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
18
+ <OmitFramePointers>false</OmitFramePointers>
19
+ <WholeProgramOptimization>false</WholeProgramOptimization>
20
+ </ClCompile>
21
+ <PreBuildEvent>
22
+ <Command>if NOT EXIST (..\..\include\maxminddb_config.h) (
23
+ copy maxminddb_config.h ..\..\include\maxminddb_config.h
24
+ )</Command>
25
+ </PreBuildEvent>
26
+ <Lib>
27
+ <TargetMachine>MachineX86</TargetMachine>
28
+ <LinkTimeCodeGeneration>false</LinkTimeCodeGeneration>
29
+ </Lib>
30
+ </ItemDefinitionGroup>
31
+ <ItemGroup />
32
+ </Project>
@@ -0,0 +1,150 @@
1
+ 
2
+ Microsoft Visual Studio Solution File, Format Version 12.00
3
+ # Visual Studio 2013
4
+ VisualStudioVersion = 12.0.31101.0
5
+ MinimumVisualStudioVersion = 10.0.40219.1
6
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmaxminddb", "libmaxminddb.vcxproj", "{82953BDA-2960-4ADA-A6D5-92E65CCB4A3D}"
7
+ EndProject
8
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_basic_lookup", "..\VS12-tests\basic_lookup.vcxproj", "{8E11C512-7B63-11E4-AE98-6B41E8A9DDB2}"
9
+ EndProject
10
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_data_entry_list", "..\VS12-tests\data_entry_list.vcxproj", "{8E11C882-7B63-11E4-AE98-6B41E8A9DDB2}"
11
+ EndProject
12
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_data_types", "..\VS12-tests\data_types.vcxproj", "{8E11CBD4-7B63-11E4-AE98-6B41E8A9DDB2}"
13
+ EndProject
14
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_dump", "..\VS12-tests\dump.vcxproj", "{8E11CEEA-7B63-11E4-AE98-6B41E8A9DDB2}"
15
+ EndProject
16
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_get_value", "..\VS12-tests\get_value.vcxproj", "{8E11D5E8-7B63-11E4-AE98-6B41E8A9DDB2}"
17
+ EndProject
18
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_get_value_pointer_bug", "..\VS12-tests\get_value_pointer_bug.vcxproj", "{8E11D2AA-7B63-11E4-AE98-6B41E8A9DDB2}"
19
+ EndProject
20
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_ipv4_start_cache", "..\VS12-tests\ipv4_start_cache.vcxproj", "{8E11D930-7B63-11E4-AE98-6B41E8A9DDB2}"
21
+ EndProject
22
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_ipv6_lookup_in_ipv4", "..\VS12-tests\ipv6_lookup_in_ipv4.vcxproj", "{8E11DC64-7B63-11E4-AE98-6B41E8A9DDB2}"
23
+ EndProject
24
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtap", "..\VS12-tests\libtap.vcxproj", "{4DFC985A-83D7-4E61-85FE-C6EA6E43E3AA}"
25
+ EndProject
26
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_metadata", "..\VS12-tests\metadata.vcxproj", "{8E11DFC0-7B63-11E4-AE98-6B41E8A9DDB2}"
27
+ EndProject
28
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_no_map_get_value", "..\VS12-tests\no_map_get_value.vcxproj", "{8E11E33A-7B63-11E4-AE98-6B41E8A9DDB2}"
29
+ EndProject
30
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_read_node", "..\VS12-tests\read_node.vcxproj", "{8E11E68C-7B63-11E4-AE98-6B41E8A9DDB2}"
31
+ EndProject
32
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_maxminddb_test_helper", "..\VS12-tests\shared.vcxproj", "{A8F568F6-5507-4EC2-A834-F2C0A3C635A5}"
33
+ EndProject
34
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_version", "..\VS12-tests\version.vcxproj", "{8E11ED26-7B63-11E4-AE98-6B41E8A9DDB2}"
35
+ EndProject
36
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_bad_pointers", "..\VS12-tests\bad_pointers.vcxproj", "{8E11BAF4-7B63-11E4-AE98-6B41E8A9DDB2}"
37
+ EndProject
38
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_metadata_pointers", "..\VS12-tests\metadata_pointers.vcxproj", "{8E11CBD4-7B63-11E4-AE98-6B41E8A9DDB2}"
39
+ EndProject
40
+ Global
41
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
42
+ Debug|Win32 = Debug|Win32
43
+ Debug|x64 = Debug|x64
44
+ Release|Win32 = Release|Win32
45
+ Release|x64 = Release|x64
46
+ EndGlobalSection
47
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
48
+ {82953BDA-2960-4ADA-A6D5-92E65CCB4A3D}.Debug|Win32.ActiveCfg = Debug|Win32
49
+ {82953BDA-2960-4ADA-A6D5-92E65CCB4A3D}.Debug|Win32.Build.0 = Debug|Win32
50
+ {82953BDA-2960-4ADA-A6D5-92E65CCB4A3D}.Debug|x64.ActiveCfg = Debug|x64
51
+ {82953BDA-2960-4ADA-A6D5-92E65CCB4A3D}.Debug|x64.Build.0 = Debug|x64
52
+ {82953BDA-2960-4ADA-A6D5-92E65CCB4A3D}.Release|Win32.ActiveCfg = Release|Win32
53
+ {82953BDA-2960-4ADA-A6D5-92E65CCB4A3D}.Release|Win32.Build.0 = Release|Win32
54
+ {82953BDA-2960-4ADA-A6D5-92E65CCB4A3D}.Release|x64.ActiveCfg = Release|x64
55
+ {82953BDA-2960-4ADA-A6D5-92E65CCB4A3D}.Release|x64.Build.0 = Release|x64
56
+ {8E11C512-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.ActiveCfg = Debug|Win32
57
+ {8E11C512-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.Build.0 = Debug|Win32
58
+ {8E11C512-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|x64.ActiveCfg = Debug|Win32
59
+ {8E11C512-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.ActiveCfg = Release|Win32
60
+ {8E11C512-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.Build.0 = Release|Win32
61
+ {8E11C512-7B63-11E4-AE98-6B41E8A9DDB2}.Release|x64.ActiveCfg = Release|Win32
62
+ {8E11C882-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.ActiveCfg = Debug|Win32
63
+ {8E11C882-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.Build.0 = Debug|Win32
64
+ {8E11C882-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|x64.ActiveCfg = Debug|Win32
65
+ {8E11C882-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.ActiveCfg = Release|Win32
66
+ {8E11C882-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.Build.0 = Release|Win32
67
+ {8E11C882-7B63-11E4-AE98-6B41E8A9DDB2}.Release|x64.ActiveCfg = Release|Win32
68
+ {8E11CBD4-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.ActiveCfg = Debug|Win32
69
+ {8E11CBD4-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.Build.0 = Debug|Win32
70
+ {8E11CBD4-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|x64.ActiveCfg = Debug|Win32
71
+ {8E11CBD4-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.ActiveCfg = Release|Win32
72
+ {8E11CBD4-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.Build.0 = Release|Win32
73
+ {8E11CBD4-7B63-11E4-AE98-6B41E8A9DDB2}.Release|x64.ActiveCfg = Release|Win32
74
+ {8E11CEEA-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.ActiveCfg = Debug|Win32
75
+ {8E11CEEA-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.Build.0 = Debug|Win32
76
+ {8E11CEEA-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|x64.ActiveCfg = Debug|Win32
77
+ {8E11CEEA-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.ActiveCfg = Release|Win32
78
+ {8E11CEEA-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.Build.0 = Release|Win32
79
+ {8E11CEEA-7B63-11E4-AE98-6B41E8A9DDB2}.Release|x64.ActiveCfg = Release|Win32
80
+ {8E11D5E8-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.ActiveCfg = Debug|Win32
81
+ {8E11D5E8-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.Build.0 = Debug|Win32
82
+ {8E11D5E8-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|x64.ActiveCfg = Debug|Win32
83
+ {8E11D5E8-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.ActiveCfg = Release|Win32
84
+ {8E11D5E8-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.Build.0 = Release|Win32
85
+ {8E11D5E8-7B63-11E4-AE98-6B41E8A9DDB2}.Release|x64.ActiveCfg = Release|Win32
86
+ {8E11D2AA-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.ActiveCfg = Debug|Win32
87
+ {8E11D2AA-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.Build.0 = Debug|Win32
88
+ {8E11D2AA-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|x64.ActiveCfg = Debug|Win32
89
+ {8E11D2AA-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.ActiveCfg = Release|Win32
90
+ {8E11D2AA-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.Build.0 = Release|Win32
91
+ {8E11D2AA-7B63-11E4-AE98-6B41E8A9DDB2}.Release|x64.ActiveCfg = Release|Win32
92
+ {8E11D930-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.ActiveCfg = Debug|Win32
93
+ {8E11D930-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.Build.0 = Debug|Win32
94
+ {8E11D930-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|x64.ActiveCfg = Debug|Win32
95
+ {8E11D930-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.ActiveCfg = Release|Win32
96
+ {8E11D930-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.Build.0 = Release|Win32
97
+ {8E11D930-7B63-11E4-AE98-6B41E8A9DDB2}.Release|x64.ActiveCfg = Release|Win32
98
+ {8E11DC64-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.ActiveCfg = Debug|Win32
99
+ {8E11DC64-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.Build.0 = Debug|Win32
100
+ {8E11DC64-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|x64.ActiveCfg = Debug|Win32
101
+ {8E11DC64-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.ActiveCfg = Release|Win32
102
+ {8E11DC64-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.Build.0 = Release|Win32
103
+ {8E11DC64-7B63-11E4-AE98-6B41E8A9DDB2}.Release|x64.ActiveCfg = Release|Win32
104
+ {4DFC985A-83D7-4E61-85FE-C6EA6E43E3AA}.Debug|Win32.ActiveCfg = Debug|Win32
105
+ {4DFC985A-83D7-4E61-85FE-C6EA6E43E3AA}.Debug|Win32.Build.0 = Debug|Win32
106
+ {4DFC985A-83D7-4E61-85FE-C6EA6E43E3AA}.Debug|x64.ActiveCfg = Debug|Win32
107
+ {4DFC985A-83D7-4E61-85FE-C6EA6E43E3AA}.Release|Win32.ActiveCfg = Release|Win32
108
+ {4DFC985A-83D7-4E61-85FE-C6EA6E43E3AA}.Release|Win32.Build.0 = Release|Win32
109
+ {4DFC985A-83D7-4E61-85FE-C6EA6E43E3AA}.Release|x64.ActiveCfg = Release|Win32
110
+ {8E11DFC0-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.ActiveCfg = Debug|Win32
111
+ {8E11DFC0-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.Build.0 = Debug|Win32
112
+ {8E11DFC0-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|x64.ActiveCfg = Debug|Win32
113
+ {8E11DFC0-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.ActiveCfg = Release|Win32
114
+ {8E11DFC0-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.Build.0 = Release|Win32
115
+ {8E11DFC0-7B63-11E4-AE98-6B41E8A9DDB2}.Release|x64.ActiveCfg = Release|Win32
116
+ {8E11E33A-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.ActiveCfg = Debug|Win32
117
+ {8E11E33A-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.Build.0 = Debug|Win32
118
+ {8E11E33A-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|x64.ActiveCfg = Debug|Win32
119
+ {8E11E33A-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.ActiveCfg = Release|Win32
120
+ {8E11E33A-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.Build.0 = Release|Win32
121
+ {8E11E33A-7B63-11E4-AE98-6B41E8A9DDB2}.Release|x64.ActiveCfg = Release|Win32
122
+ {8E11E68C-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.ActiveCfg = Debug|Win32
123
+ {8E11E68C-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.Build.0 = Debug|Win32
124
+ {8E11E68C-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|x64.ActiveCfg = Debug|Win32
125
+ {8E11E68C-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.ActiveCfg = Release|Win32
126
+ {8E11E68C-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.Build.0 = Release|Win32
127
+ {8E11E68C-7B63-11E4-AE98-6B41E8A9DDB2}.Release|x64.ActiveCfg = Release|Win32
128
+ {A8F568F6-5507-4EC2-A834-F2C0A3C635A5}.Debug|Win32.ActiveCfg = Debug|Win32
129
+ {A8F568F6-5507-4EC2-A834-F2C0A3C635A5}.Debug|Win32.Build.0 = Debug|Win32
130
+ {A8F568F6-5507-4EC2-A834-F2C0A3C635A5}.Debug|x64.ActiveCfg = Debug|Win32
131
+ {A8F568F6-5507-4EC2-A834-F2C0A3C635A5}.Release|Win32.ActiveCfg = Release|Win32
132
+ {A8F568F6-5507-4EC2-A834-F2C0A3C635A5}.Release|Win32.Build.0 = Release|Win32
133
+ {A8F568F6-5507-4EC2-A834-F2C0A3C635A5}.Release|x64.ActiveCfg = Release|Win32
134
+ {8E11ED26-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.ActiveCfg = Debug|Win32
135
+ {8E11ED26-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.Build.0 = Debug|Win32
136
+ {8E11ED26-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|x64.ActiveCfg = Debug|Win32
137
+ {8E11ED26-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.ActiveCfg = Release|Win32
138
+ {8E11ED26-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.Build.0 = Release|Win32
139
+ {8E11ED26-7B63-11E4-AE98-6B41E8A9DDB2}.Release|x64.ActiveCfg = Release|Win32
140
+ {8E11BAF4-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.ActiveCfg = Debug|Win32
141
+ {8E11BAF4-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|Win32.Build.0 = Debug|Win32
142
+ {8E11BAF4-7B63-11E4-AE98-6B41E8A9DDB2}.Debug|x64.ActiveCfg = Debug|Win32
143
+ {8E11BAF4-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.ActiveCfg = Release|Win32
144
+ {8E11BAF4-7B63-11E4-AE98-6B41E8A9DDB2}.Release|Win32.Build.0 = Release|Win32
145
+ {8E11BAF4-7B63-11E4-AE98-6B41E8A9DDB2}.Release|x64.ActiveCfg = Release|Win32
146
+ EndGlobalSection
147
+ GlobalSection(SolutionProperties) = preSolution
148
+ HideSolutionNode = FALSE
149
+ EndGlobalSection
150
+ EndGlobal