undns 0.4.0d → 0.4.0f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/update_origins_dat +183 -0
- data/ext/undns/conventions.c +800 -723
- data/ext/undns/conventions.h +30 -38
- data/ext/undns/conventlex.c +45 -58
- data/ext/undns/earth.c +20 -1
- data/ext/undns/extconf.rb +3 -1
- data/ext/undns/hashtable.c +6 -2
- data/ext/undns/originAS.c +6 -4
- data/ext/undns/originAS.h +3 -0
- data/ext/undns/progress.c +3 -3
- data/ext/undns/ruleset.c +9 -3
- data/ext/undns/ruleset.h +3 -1
- data/ext/undns/swig-undns_wrap-rb.c +140 -103
- data/lib/undns.rb +14 -1
- data/lib/undns/LocationTable +2804 -0
- data/lib/undns/keys/Makefile +90 -91
- data/lib/undns/keys/Makefile.am +2 -2
- data/lib/undns/keys/Makefile.in +29 -30
- data/lib/undns/origins.dat +517715 -0
- data/test/test_undns.rb +80 -0
- metadata +20 -13
data/ext/undns/earth.c
CHANGED
@@ -5,12 +5,17 @@
|
|
5
5
|
#include <string.h>
|
6
6
|
#include <math.h>
|
7
7
|
#include <assert.h>
|
8
|
+
#include <sys/types.h>
|
8
9
|
|
9
10
|
#ifdef HAVE_GNUREGEX_H
|
11
|
+
#ifdef DEPRECATED_GNU_REGEX
|
10
12
|
#include <gnuregex.h>
|
11
13
|
#else
|
12
14
|
#include <regex.h>
|
13
15
|
#endif
|
16
|
+
#else
|
17
|
+
#include <regex.h>
|
18
|
+
#endif
|
14
19
|
|
15
20
|
#include "xmalloc.h"
|
16
21
|
#include "nscommon.h"
|
@@ -108,13 +113,27 @@ void init_earth(const char *LocationTableFilename) {
|
|
108
113
|
free(newlte);
|
109
114
|
}
|
110
115
|
#else
|
111
|
-
|
116
|
+
// printf("-- %s", linebuf);
|
117
|
+
memset(regs, 0, sizeof(regs));
|
118
|
+
int reg_ret = regexec(&rpbuf, linebuf, REGS_LEN-1, regs, 0);
|
112
119
|
if(reg_ret == REG_NOMATCH) {
|
113
120
|
fprintf(stderr, "init_earth: Couldn't parse line: %s", linebuf);
|
114
121
|
free(newlte);
|
115
122
|
continue;
|
123
|
+
} else if(reg_ret == REG_ILLSEQ) {
|
124
|
+
fprintf(stderr, "init_earth: Illegal character sequence in (skipped) line: %s", linebuf);
|
125
|
+
free(newlte);
|
126
|
+
continue;
|
127
|
+
} else if(reg_ret != 0) {
|
128
|
+
fprintf(stderr, "init_earth: unexpected nonzero return from regexec: %d\n", reg_ret);
|
129
|
+
exit(1);
|
116
130
|
}
|
131
|
+
/* on mac, at least, rm_eo and rm_so are long long (64 bit) */
|
132
|
+
// printf("%d %s %lld %lld\n", reg_ret, linebuf, regs[1].rm_eo, regs[1].rm_so);
|
133
|
+
/* if incorrectly thought to be 32 bit when it's 64, eo will be zero; fail quickly */
|
134
|
+
assert(regs[1].rm_eo >= regs[1].rm_so);
|
117
135
|
newlte->place = malloc(regs[1].rm_eo - regs[1].rm_so + 1);
|
136
|
+
assert(newlte->place);
|
118
137
|
strncpy(newlte->place, linebuf+regs[1].rm_so, regs[1].rm_eo-regs[1].rm_so);
|
119
138
|
newlte->place[ regs[1].rm_eo - regs[1].rm_so ] = '\0';
|
120
139
|
if(lte_ht_lookup(loctable, newlte) == NULL) {
|
data/ext/undns/extconf.rb
CHANGED
@@ -15,7 +15,9 @@ have_header('sys/types.h')
|
|
15
15
|
have_header('sys/time.h')
|
16
16
|
have_header('ruby/io.h')
|
17
17
|
have_func('snprintf')
|
18
|
-
|
18
|
+
# if installed as system, likely in rubylibdir
|
19
|
+
# if installed as user, perhaps relative to where unpacked.
|
20
|
+
$defs.push('-DPKGDATADIR=\"$(RUBYLIBDIR)/undns:%s\"' % [ File.expand_path(File.dirname(__FILE__) + "/../../lib/undns") ])
|
19
21
|
$defs.push('-DONIG_ESCAPE_REGEX_T_COLLISION') # deep in there is a typedef
|
20
22
|
|
21
23
|
# create_header('config.h')
|
data/ext/undns/hashtable.c
CHANGED
@@ -88,14 +88,18 @@ hashtable ht_new(unsigned int size,
|
|
88
88
|
ht->isequal = isequal;
|
89
89
|
ht->free_keyval = free_keyval;
|
90
90
|
#ifdef _REENTRANT
|
91
|
-
#ifdef PTHREAD_MUTEX_RECURSIVE_NP
|
92
91
|
(void)pthread_mutexattr_init(&attrib);
|
93
92
|
// (void)pthread_mutexattr_setkind_np(&attrib, PTHREAD_MUTEX_RECURSIVE_NP);
|
94
93
|
// (void)pthread_mutexattr_setkind(&attrib, PTHREAD_MUTEX_RECURSIVE_NP);
|
94
|
+
#ifdef PTHREAD_MUTEX_RECURSIVE_NP
|
95
|
+
/* linux only */
|
95
96
|
(void)pthread_mutexattr_settype(&attrib, PTHREAD_MUTEX_RECURSIVE_NP);
|
97
|
+
#else
|
98
|
+
/* mac, at least */
|
99
|
+
(void)pthread_mutexattr_settype(&attrib, PTHREAD_MUTEX_RECURSIVE);
|
100
|
+
#endif
|
96
101
|
(void)pthread_mutex_init(&ht->mutex, &attrib);
|
97
102
|
(void)pthread_mutexattr_destroy(&attrib);
|
98
|
-
#endif
|
99
103
|
#endif
|
100
104
|
return(ht);
|
101
105
|
}
|
data/ext/undns/originAS.c
CHANGED
@@ -22,12 +22,14 @@ static in_addr_t addr_from_octets(unsigned int o1, unsigned int o2,
|
|
22
22
|
return (htonl((o1<<24) + (o2<<16) + (o3<<8) + o4));
|
23
23
|
}
|
24
24
|
|
25
|
+
const char *Origins_In_Use;
|
26
|
+
|
25
27
|
void
|
26
28
|
origins_init(const char *origins_dat) {
|
27
29
|
char linebuf[60];
|
28
30
|
// FILE *in = popen("./show_origins.pl | sort -u", "r");
|
29
31
|
const char *filename = (origins_dat != NULL) ? origins_dat : "origins.dat";
|
30
|
-
FILE *in = fopen_path_r(filename);
|
32
|
+
FILE *in = fopen_path_r(filename, &Origins_In_Use);
|
31
33
|
if(in == NULL) {
|
32
34
|
char buf[255];
|
33
35
|
sprintf(buf, "can't open origins.dat(%s): %s", filename, strerror(errno));
|
@@ -99,7 +101,7 @@ origins_regression_test(const char *origins_dat) {
|
|
99
101
|
FILE *in;
|
100
102
|
char linebuf[60];
|
101
103
|
origins_init(origins_dat);
|
102
|
-
in = fopen_path_r(origins_dat);
|
104
|
+
in = fopen_path_r(origins_dat, &Origins_In_Use);
|
103
105
|
while(!feof(in) && fgets(linebuf, sizeof(linebuf), in) != NULL) {
|
104
106
|
unsigned int o1, o2, o3, o4, len, as;
|
105
107
|
if(sscanf(linebuf, "%u.%u.%u.%u/%u %u",
|
@@ -112,7 +114,7 @@ origins_regression_test(const char *origins_dat) {
|
|
112
114
|
fprintf(stderr, "failed to verify %u == %u on line:\n%s",
|
113
115
|
as, (unsigned int) pe->data, linebuf);
|
114
116
|
if(pe->prefixlen > len) {
|
115
|
-
fprintf(stderr, " -- because a more specific was matched. (%
|
117
|
+
fprintf(stderr, " -- because a more specific was matched. (%u > %u)\n", pe->prefixlen, len);
|
116
118
|
} else {
|
117
119
|
#if !defined(CHECK_ORIGINS_SHOULD_FAIL) || CHECK_ORIGINS_SHOULD_FAIL == 0
|
118
120
|
abort();
|
@@ -130,5 +132,5 @@ origins_regression_test(const char *origins_dat) {
|
|
130
132
|
}
|
131
133
|
}
|
132
134
|
}
|
133
|
-
fclose(in);
|
135
|
+
(void)fclose(in);
|
134
136
|
}
|
data/ext/undns/originAS.h
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
/* (c) neil spring 2002 */
|
2
2
|
|
3
3
|
#include "nscommon.h"
|
4
|
+
#include <sys/types.h>
|
4
5
|
#include <netinet/in.h>
|
5
6
|
|
7
|
+
extern const char *Origins_In_Use; /* for ensuring the right one is being used */
|
8
|
+
|
6
9
|
void origins_init(const char *origins_dat);
|
7
10
|
unsigned short origin_for_address(in_addr_t a);
|
8
11
|
unsigned short origin_for_address_str(const char *addrstring);
|
data/ext/undns/progress.c
CHANGED
data/ext/undns/ruleset.c
CHANGED
@@ -70,7 +70,7 @@ static const char *inst_format_stats(char *buf, unsigned int buflen, const struc
|
|
70
70
|
|
71
71
|
/* also invoked by originAS.c */
|
72
72
|
/*@null@*/ FILE *
|
73
|
-
fopen_path_r(const char *filename) {
|
73
|
+
fopen_path_r(const char *filename, const char **found_path_name) {
|
74
74
|
char *fullpath = searchPath(ruleset_path, filename);
|
75
75
|
if(fullpath != NULL) {
|
76
76
|
FILE * ret;
|
@@ -85,7 +85,11 @@ fopen_path_r(const char *filename) {
|
|
85
85
|
}
|
86
86
|
*/
|
87
87
|
ret = fopen(fullpath, "r");
|
88
|
-
|
88
|
+
if(found_path_name) {
|
89
|
+
*found_path_name = fullpath;
|
90
|
+
} else {
|
91
|
+
free(fullpath);
|
92
|
+
}
|
89
93
|
return ret;
|
90
94
|
} else {
|
91
95
|
errno = ENOENT;
|
@@ -93,13 +97,15 @@ fopen_path_r(const char *filename) {
|
|
93
97
|
}
|
94
98
|
}
|
95
99
|
|
100
|
+
const char *Ruleset_In_Use;
|
101
|
+
|
96
102
|
/* returns true if all good, false if there was a parse error */
|
97
103
|
void load_ruleset(const char *filename) {
|
98
104
|
FILE *fp;
|
99
105
|
if(filename == NULL) {
|
100
106
|
throw_void("load_ruleset: no filename to load\n");
|
101
107
|
}
|
102
|
-
fp=fopen_path_r(filename);
|
108
|
+
fp=fopen_path_r(filename, &Ruleset_In_Use);
|
103
109
|
if(fp != NULL) {
|
104
110
|
if(is_nonempty(fp)) {
|
105
111
|
input_filename = filename;
|
data/ext/undns/ruleset.h
CHANGED
@@ -16,6 +16,8 @@
|
|
16
16
|
#include "nscommon.h"
|
17
17
|
#include <stdio.h>
|
18
18
|
|
19
|
+
extern const char *Ruleset_In_Use; /* for ensuring the right one is being used */
|
20
|
+
|
19
21
|
struct instrumentation {
|
20
22
|
const char *file; unsigned int line;
|
21
23
|
unsigned int dynamic_match_count;
|
@@ -98,7 +100,7 @@ const char *get_role(int asn, const char *hostname);
|
|
98
100
|
const char *get_loc_list(int asn, const char **hostname_list); /* majority rule */
|
99
101
|
int get_asn_bydns(const char *hostname);
|
100
102
|
/*@mustfree@*/ /*@null@*/ char * search_path(const char *path, const char *find_me);
|
101
|
-
/*@null@*/ FILE *fopen_path_r (const char *filename);
|
103
|
+
/*@null@*/ FILE *fopen_path_r (const char *filename, /*@out null@*/ const char **found);
|
102
104
|
extern const char *ruleset_path; /* where to search */
|
103
105
|
|
104
106
|
void set_conventions_debug(boolean v);
|
@@ -1,11 +1,11 @@
|
|
1
1
|
/* ----------------------------------------------------------------------------
|
2
2
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
3
|
-
* Version 2.0.
|
4
|
-
*
|
5
|
-
* This file is not intended to be easily readable and contains a number of
|
3
|
+
* Version 2.0.7
|
4
|
+
*
|
5
|
+
* This file is not intended to be easily readable and contains a number of
|
6
6
|
* coding conventions designed to improve portability and efficiency. Do not make
|
7
|
-
* changes to this file unless you know what you are doing--modify the SWIG
|
8
|
-
* interface file instead.
|
7
|
+
* changes to this file unless you know what you are doing--modify the SWIG
|
8
|
+
* interface file instead.
|
9
9
|
* ----------------------------------------------------------------------------- */
|
10
10
|
|
11
11
|
#define SWIGRUBY
|
@@ -41,28 +41,28 @@
|
|
41
41
|
#ifndef SWIGUNUSED
|
42
42
|
# if defined(__GNUC__)
|
43
43
|
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
44
|
-
# define SWIGUNUSED __attribute__ ((__unused__))
|
44
|
+
# define SWIGUNUSED __attribute__ ((__unused__))
|
45
45
|
# else
|
46
46
|
# define SWIGUNUSED
|
47
47
|
# endif
|
48
48
|
# elif defined(__ICC)
|
49
|
-
# define SWIGUNUSED __attribute__ ((__unused__))
|
49
|
+
# define SWIGUNUSED __attribute__ ((__unused__))
|
50
50
|
# else
|
51
|
-
# define SWIGUNUSED
|
51
|
+
# define SWIGUNUSED
|
52
52
|
# endif
|
53
53
|
#endif
|
54
54
|
|
55
55
|
#ifndef SWIG_MSC_UNSUPPRESS_4505
|
56
56
|
# if defined(_MSC_VER)
|
57
57
|
# pragma warning(disable : 4505) /* unreferenced local function has been removed */
|
58
|
-
# endif
|
58
|
+
# endif
|
59
59
|
#endif
|
60
60
|
|
61
61
|
#ifndef SWIGUNUSEDPARM
|
62
62
|
# ifdef __cplusplus
|
63
63
|
# define SWIGUNUSEDPARM(p)
|
64
64
|
# else
|
65
|
-
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
|
65
|
+
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
|
66
66
|
# endif
|
67
67
|
#endif
|
68
68
|
|
@@ -105,7 +105,7 @@
|
|
105
105
|
# define SWIGSTDCALL __stdcall
|
106
106
|
# else
|
107
107
|
# define SWIGSTDCALL
|
108
|
-
# endif
|
108
|
+
# endif
|
109
109
|
#endif
|
110
110
|
|
111
111
|
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
|
@@ -150,28 +150,28 @@
|
|
150
150
|
#ifndef SWIGUNUSED
|
151
151
|
# if defined(__GNUC__)
|
152
152
|
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
153
|
-
# define SWIGUNUSED __attribute__ ((__unused__))
|
153
|
+
# define SWIGUNUSED __attribute__ ((__unused__))
|
154
154
|
# else
|
155
155
|
# define SWIGUNUSED
|
156
156
|
# endif
|
157
157
|
# elif defined(__ICC)
|
158
|
-
# define SWIGUNUSED __attribute__ ((__unused__))
|
158
|
+
# define SWIGUNUSED __attribute__ ((__unused__))
|
159
159
|
# else
|
160
|
-
# define SWIGUNUSED
|
160
|
+
# define SWIGUNUSED
|
161
161
|
# endif
|
162
162
|
#endif
|
163
163
|
|
164
164
|
#ifndef SWIG_MSC_UNSUPPRESS_4505
|
165
165
|
# if defined(_MSC_VER)
|
166
166
|
# pragma warning(disable : 4505) /* unreferenced local function has been removed */
|
167
|
-
# endif
|
167
|
+
# endif
|
168
168
|
#endif
|
169
169
|
|
170
170
|
#ifndef SWIGUNUSEDPARM
|
171
171
|
# ifdef __cplusplus
|
172
172
|
# define SWIGUNUSEDPARM(p)
|
173
173
|
# else
|
174
|
-
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
|
174
|
+
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
|
175
175
|
# endif
|
176
176
|
#endif
|
177
177
|
|
@@ -214,7 +214,7 @@
|
|
214
214
|
# define SWIGSTDCALL __stdcall
|
215
215
|
# else
|
216
216
|
# define SWIGSTDCALL
|
217
|
-
# endif
|
217
|
+
# endif
|
218
218
|
#endif
|
219
219
|
|
220
220
|
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
|
@@ -252,7 +252,7 @@
|
|
252
252
|
You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
|
253
253
|
creating a static or dynamic library from the SWIG runtime code.
|
254
254
|
In 99.9% of the cases, SWIG just needs to declare them as 'static'.
|
255
|
-
|
255
|
+
|
256
256
|
But only do this if strictly necessary, ie, if you have problems
|
257
257
|
with your compiler or suchlike.
|
258
258
|
*/
|
@@ -278,16 +278,16 @@
|
|
278
278
|
#define SWIG_POINTER_OWN 0x1
|
279
279
|
|
280
280
|
|
281
|
-
/*
|
281
|
+
/*
|
282
282
|
Flags/methods for returning states.
|
283
|
-
|
284
|
-
The SWIG conversion methods, as ConvertPtr, return an integer
|
283
|
+
|
284
|
+
The SWIG conversion methods, as ConvertPtr, return an integer
|
285
285
|
that tells if the conversion was successful or not. And if not,
|
286
286
|
an error code can be returned (see swigerrors.swg for the codes).
|
287
|
-
|
287
|
+
|
288
288
|
Use the following macros/flags to set or process the returning
|
289
289
|
states.
|
290
|
-
|
290
|
+
|
291
291
|
In old versions of SWIG, code such as the following was usually written:
|
292
292
|
|
293
293
|
if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
|
@@ -320,23 +320,23 @@
|
|
320
320
|
} else {
|
321
321
|
// fail code
|
322
322
|
}
|
323
|
-
|
323
|
+
|
324
324
|
I.e., now SWIG_ConvertPtr can return new objects and you can
|
325
325
|
identify the case and take care of the deallocation. Of course that
|
326
326
|
also requires SWIG_ConvertPtr to return new result values, such as
|
327
327
|
|
328
|
-
int SWIG_ConvertPtr(obj, ptr,...) {
|
329
|
-
if (<obj is ok>) {
|
330
|
-
if (<need new object>) {
|
331
|
-
*ptr = <ptr to new allocated object>;
|
332
|
-
return SWIG_NEWOBJ;
|
333
|
-
} else {
|
334
|
-
*ptr = <ptr to old object>;
|
335
|
-
return SWIG_OLDOBJ;
|
336
|
-
}
|
337
|
-
} else {
|
338
|
-
return SWIG_BADOBJ;
|
339
|
-
}
|
328
|
+
int SWIG_ConvertPtr(obj, ptr,...) {
|
329
|
+
if (<obj is ok>) {
|
330
|
+
if (<need new object>) {
|
331
|
+
*ptr = <ptr to new allocated object>;
|
332
|
+
return SWIG_NEWOBJ;
|
333
|
+
} else {
|
334
|
+
*ptr = <ptr to old object>;
|
335
|
+
return SWIG_OLDOBJ;
|
336
|
+
}
|
337
|
+
} else {
|
338
|
+
return SWIG_BADOBJ;
|
339
|
+
}
|
340
340
|
}
|
341
341
|
|
342
342
|
Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
|
@@ -350,17 +350,17 @@
|
|
350
350
|
int fooi(int);
|
351
351
|
|
352
352
|
and you call
|
353
|
-
|
353
|
+
|
354
354
|
food(1) // cast rank '1' (1 -> 1.0)
|
355
355
|
fooi(1) // cast rank '0'
|
356
356
|
|
357
357
|
just use the SWIG_AddCast()/SWIG_CheckState()
|
358
358
|
*/
|
359
359
|
|
360
|
-
#define SWIG_OK (0)
|
360
|
+
#define SWIG_OK (0)
|
361
361
|
#define SWIG_ERROR (-1)
|
362
362
|
#define SWIG_IsOK(r) (r >= 0)
|
363
|
-
#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
|
363
|
+
#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
|
364
364
|
|
365
365
|
/* The CastRankLimit says how many bits are used for the cast rank */
|
366
366
|
#define SWIG_CASTRANKLIMIT (1 << 8)
|
@@ -391,14 +391,14 @@
|
|
391
391
|
# endif
|
392
392
|
# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
|
393
393
|
# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
|
394
|
-
SWIGINTERNINLINE int SWIG_AddCast(int r) {
|
394
|
+
SWIGINTERNINLINE int SWIG_AddCast(int r) {
|
395
395
|
return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
|
396
396
|
}
|
397
|
-
SWIGINTERNINLINE int SWIG_CheckState(int r) {
|
398
|
-
return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
|
397
|
+
SWIGINTERNINLINE int SWIG_CheckState(int r) {
|
398
|
+
return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
|
399
399
|
}
|
400
400
|
#else /* no cast-rank mode */
|
401
|
-
# define SWIG_AddCast
|
401
|
+
# define SWIG_AddCast
|
402
402
|
# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
|
403
403
|
#endif
|
404
404
|
|
@@ -442,7 +442,7 @@ typedef struct swig_module_info {
|
|
442
442
|
void *clientdata; /* Language specific module data */
|
443
443
|
} swig_module_info;
|
444
444
|
|
445
|
-
/*
|
445
|
+
/*
|
446
446
|
Compare two type names skipping the space characters, therefore
|
447
447
|
"char*" == "char *" and "Class<int>" == "Class<int >", etc.
|
448
448
|
|
@@ -462,18 +462,18 @@ SWIG_TypeNameComp(const char *f1, const char *l1,
|
|
462
462
|
|
463
463
|
/*
|
464
464
|
Check type equivalence in a name list like <name1>|<name2>|...
|
465
|
-
Return 0 if equal,
|
465
|
+
Return 0 if not equal, 1 if equal
|
466
466
|
*/
|
467
467
|
SWIGRUNTIME int
|
468
|
-
|
469
|
-
int equiv =
|
468
|
+
SWIG_TypeEquiv(const char *nb, const char *tb) {
|
469
|
+
int equiv = 0;
|
470
470
|
const char* te = tb + strlen(tb);
|
471
471
|
const char* ne = nb;
|
472
|
-
while (equiv
|
472
|
+
while (!equiv && *ne) {
|
473
473
|
for (nb = ne; *ne; ++ne) {
|
474
474
|
if (*ne == '|') break;
|
475
475
|
}
|
476
|
-
equiv = SWIG_TypeNameComp(nb, ne, tb, te);
|
476
|
+
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
|
477
477
|
if (*ne) ++ne;
|
478
478
|
}
|
479
479
|
return equiv;
|
@@ -481,13 +481,24 @@ SWIG_TypeCmp(const char *nb, const char *tb) {
|
|
481
481
|
|
482
482
|
/*
|
483
483
|
Check type equivalence in a name list like <name1>|<name2>|...
|
484
|
-
Return 0 if
|
484
|
+
Return 0 if equal, -1 if nb < tb, 1 if nb > tb
|
485
485
|
*/
|
486
486
|
SWIGRUNTIME int
|
487
|
-
|
488
|
-
|
487
|
+
SWIG_TypeCompare(const char *nb, const char *tb) {
|
488
|
+
int equiv = 0;
|
489
|
+
const char* te = tb + strlen(tb);
|
490
|
+
const char* ne = nb;
|
491
|
+
while (!equiv && *ne) {
|
492
|
+
for (nb = ne; *ne; ++ne) {
|
493
|
+
if (*ne == '|') break;
|
494
|
+
}
|
495
|
+
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
|
496
|
+
if (*ne) ++ne;
|
497
|
+
}
|
498
|
+
return equiv;
|
489
499
|
}
|
490
500
|
|
501
|
+
|
491
502
|
/*
|
492
503
|
Check the typename
|
493
504
|
*/
|
@@ -515,7 +526,7 @@ SWIG_TypeCheck(const char *c, swig_type_info *ty) {
|
|
515
526
|
return 0;
|
516
527
|
}
|
517
528
|
|
518
|
-
/*
|
529
|
+
/*
|
519
530
|
Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
|
520
531
|
*/
|
521
532
|
SWIGRUNTIME swig_cast_info *
|
@@ -550,7 +561,7 @@ SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
|
|
550
561
|
return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
|
551
562
|
}
|
552
563
|
|
553
|
-
/*
|
564
|
+
/*
|
554
565
|
Dynamic pointer casting. Down an inheritance hierarchy
|
555
566
|
*/
|
556
567
|
SWIGRUNTIME swig_type_info *
|
@@ -594,7 +605,7 @@ SWIG_TypePrettyName(const swig_type_info *type) {
|
|
594
605
|
return type->name;
|
595
606
|
}
|
596
607
|
|
597
|
-
/*
|
608
|
+
/*
|
598
609
|
Set the clientdata field for a type
|
599
610
|
*/
|
600
611
|
SWIGRUNTIME void
|
@@ -602,14 +613,14 @@ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
|
|
602
613
|
swig_cast_info *cast = ti->cast;
|
603
614
|
/* if (ti->clientdata == clientdata) return; */
|
604
615
|
ti->clientdata = clientdata;
|
605
|
-
|
616
|
+
|
606
617
|
while (cast) {
|
607
618
|
if (!cast->converter) {
|
608
619
|
swig_type_info *tc = cast->type;
|
609
620
|
if (!tc->clientdata) {
|
610
621
|
SWIG_TypeClientData(tc, clientdata);
|
611
622
|
}
|
612
|
-
}
|
623
|
+
}
|
613
624
|
cast = cast->next;
|
614
625
|
}
|
615
626
|
}
|
@@ -618,18 +629,18 @@ SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
|
|
618
629
|
SWIG_TypeClientData(ti, clientdata);
|
619
630
|
ti->owndata = 1;
|
620
631
|
}
|
621
|
-
|
632
|
+
|
622
633
|
/*
|
623
634
|
Search for a swig_type_info structure only by mangled name
|
624
635
|
Search is a O(log #types)
|
625
|
-
|
626
|
-
We start searching at module start, and finish searching when start == end.
|
636
|
+
|
637
|
+
We start searching at module start, and finish searching when start == end.
|
627
638
|
Note: if start == end at the beginning of the function, we go all the way around
|
628
639
|
the circular list.
|
629
640
|
*/
|
630
641
|
SWIGRUNTIME swig_type_info *
|
631
|
-
SWIG_MangledTypeQueryModule(swig_module_info *start,
|
632
|
-
swig_module_info *end,
|
642
|
+
SWIG_MangledTypeQueryModule(swig_module_info *start,
|
643
|
+
swig_module_info *end,
|
633
644
|
const char *name) {
|
634
645
|
swig_module_info *iter = start;
|
635
646
|
do {
|
@@ -638,11 +649,11 @@ SWIG_MangledTypeQueryModule(swig_module_info *start,
|
|
638
649
|
register size_t r = iter->size - 1;
|
639
650
|
do {
|
640
651
|
/* since l+r >= 0, we can (>> 1) instead (/ 2) */
|
641
|
-
register size_t i = (l + r) >> 1;
|
652
|
+
register size_t i = (l + r) >> 1;
|
642
653
|
const char *iname = iter->types[i]->name;
|
643
654
|
if (iname) {
|
644
655
|
register int compare = strcmp(name, iname);
|
645
|
-
if (compare == 0) {
|
656
|
+
if (compare == 0) {
|
646
657
|
return iter->types[i];
|
647
658
|
} else if (compare < 0) {
|
648
659
|
if (i) {
|
@@ -667,14 +678,14 @@ SWIG_MangledTypeQueryModule(swig_module_info *start,
|
|
667
678
|
Search for a swig_type_info structure for either a mangled name or a human readable name.
|
668
679
|
It first searches the mangled names of the types, which is a O(log #types)
|
669
680
|
If a type is not found it then searches the human readable names, which is O(#types).
|
670
|
-
|
671
|
-
We start searching at module start, and finish searching when start == end.
|
681
|
+
|
682
|
+
We start searching at module start, and finish searching when start == end.
|
672
683
|
Note: if start == end at the beginning of the function, we go all the way around
|
673
684
|
the circular list.
|
674
685
|
*/
|
675
686
|
SWIGRUNTIME swig_type_info *
|
676
|
-
SWIG_TypeQueryModule(swig_module_info *start,
|
677
|
-
swig_module_info *end,
|
687
|
+
SWIG_TypeQueryModule(swig_module_info *start,
|
688
|
+
swig_module_info *end,
|
678
689
|
const char *name) {
|
679
690
|
/* STEP 1: Search the name field using binary search */
|
680
691
|
swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
|
@@ -693,12 +704,12 @@ SWIG_TypeQueryModule(swig_module_info *start,
|
|
693
704
|
iter = iter->next;
|
694
705
|
} while (iter != end);
|
695
706
|
}
|
696
|
-
|
707
|
+
|
697
708
|
/* neither found a match */
|
698
709
|
return 0;
|
699
710
|
}
|
700
711
|
|
701
|
-
/*
|
712
|
+
/*
|
702
713
|
Pack binary data into a string
|
703
714
|
*/
|
704
715
|
SWIGRUNTIME char *
|
@@ -714,7 +725,7 @@ SWIG_PackData(char *c, void *ptr, size_t sz) {
|
|
714
725
|
return c;
|
715
726
|
}
|
716
727
|
|
717
|
-
/*
|
728
|
+
/*
|
718
729
|
Unpack binary data from a string
|
719
730
|
*/
|
720
731
|
SWIGRUNTIME const char *
|
@@ -728,21 +739,21 @@ SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|
728
739
|
uu = ((d - '0') << 4);
|
729
740
|
else if ((d >= 'a') && (d <= 'f'))
|
730
741
|
uu = ((d - ('a'-10)) << 4);
|
731
|
-
else
|
742
|
+
else
|
732
743
|
return (char *) 0;
|
733
744
|
d = *(c++);
|
734
745
|
if ((d >= '0') && (d <= '9'))
|
735
746
|
uu |= (d - '0');
|
736
747
|
else if ((d >= 'a') && (d <= 'f'))
|
737
748
|
uu |= (d - ('a'-10));
|
738
|
-
else
|
749
|
+
else
|
739
750
|
return (char *) 0;
|
740
751
|
*u = uu;
|
741
752
|
}
|
742
753
|
return c;
|
743
754
|
}
|
744
755
|
|
745
|
-
/*
|
756
|
+
/*
|
746
757
|
Pack 'void *' into a string buffer.
|
747
758
|
*/
|
748
759
|
SWIGRUNTIME char *
|
@@ -802,18 +813,18 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
|
|
802
813
|
#endif
|
803
814
|
|
804
815
|
/* Errors in SWIG */
|
805
|
-
#define SWIG_UnknownError -1
|
806
|
-
#define SWIG_IOError -2
|
807
|
-
#define SWIG_RuntimeError -3
|
808
|
-
#define SWIG_IndexError -4
|
809
|
-
#define SWIG_TypeError -5
|
810
|
-
#define SWIG_DivisionByZero -6
|
811
|
-
#define SWIG_OverflowError -7
|
812
|
-
#define SWIG_SyntaxError -8
|
813
|
-
#define SWIG_ValueError -9
|
816
|
+
#define SWIG_UnknownError -1
|
817
|
+
#define SWIG_IOError -2
|
818
|
+
#define SWIG_RuntimeError -3
|
819
|
+
#define SWIG_IndexError -4
|
820
|
+
#define SWIG_TypeError -5
|
821
|
+
#define SWIG_DivisionByZero -6
|
822
|
+
#define SWIG_OverflowError -7
|
823
|
+
#define SWIG_SyntaxError -8
|
824
|
+
#define SWIG_ValueError -9
|
814
825
|
#define SWIG_SystemError -10
|
815
826
|
#define SWIG_AttributeError -11
|
816
|
-
#define SWIG_MemoryError -12
|
827
|
+
#define SWIG_MemoryError -12
|
817
828
|
#define SWIG_NullReferenceError -13
|
818
829
|
|
819
830
|
|
@@ -1363,7 +1374,7 @@ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
|
|
1363
1374
|
|
1364
1375
|
/* Runtime API */
|
1365
1376
|
|
1366
|
-
#define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule(
|
1377
|
+
#define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule()
|
1367
1378
|
#define SWIG_SetModule(clientdata, pointer) SWIG_Ruby_SetModule(pointer)
|
1368
1379
|
|
1369
1380
|
|
@@ -1699,7 +1710,7 @@ SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
|
|
1699
1710
|
}
|
1700
1711
|
|
1701
1712
|
SWIGRUNTIME swig_module_info *
|
1702
|
-
SWIG_Ruby_GetModule(void
|
1713
|
+
SWIG_Ruby_GetModule(void)
|
1703
1714
|
{
|
1704
1715
|
VALUE pointer;
|
1705
1716
|
swig_module_info *ret = 0;
|
@@ -1739,7 +1750,7 @@ SWIG_Ruby_SetModule(swig_module_info *pointer)
|
|
1739
1750
|
SWIGINTERN
|
1740
1751
|
int SWIG_Ruby_isCallable( VALUE proc )
|
1741
1752
|
{
|
1742
|
-
if ( rb_respond_to( proc, swig_call_id ) )
|
1753
|
+
if ( rb_respond_to( proc, swig_call_id ) == Qtrue )
|
1743
1754
|
return 1;
|
1744
1755
|
return 0;
|
1745
1756
|
}
|
@@ -1752,7 +1763,7 @@ int SWIG_Ruby_isCallable( VALUE proc )
|
|
1752
1763
|
SWIGINTERN
|
1753
1764
|
int SWIG_Ruby_arity( VALUE proc, int minimal )
|
1754
1765
|
{
|
1755
|
-
if ( rb_respond_to( proc, swig_arity_id ) )
|
1766
|
+
if ( rb_respond_to( proc, swig_arity_id ) == Qtrue )
|
1756
1767
|
{
|
1757
1768
|
VALUE num = rb_funcall( proc, swig_arity_id, 0 );
|
1758
1769
|
int arity = NUM2INT(num);
|
@@ -1801,7 +1812,7 @@ static VALUE mUndns;
|
|
1801
1812
|
#define SWIG_RUBY_THREAD_END_BLOCK
|
1802
1813
|
|
1803
1814
|
|
1804
|
-
#define SWIGVERSION
|
1815
|
+
#define SWIGVERSION 0x020007
|
1805
1816
|
#define SWIG_VERSION SWIGVERSION
|
1806
1817
|
|
1807
1818
|
|
@@ -1887,7 +1898,7 @@ SWIG_ruby_failed(void)
|
|
1887
1898
|
}
|
1888
1899
|
|
1889
1900
|
|
1890
|
-
/*@SWIG:/usr/share/
|
1901
|
+
/*@SWIG:/usr/local/Cellar/swig/2.0.7/share/swig/2.0.7/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
|
1891
1902
|
SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
|
1892
1903
|
{
|
1893
1904
|
VALUE obj = args[0];
|
@@ -1993,7 +2004,11 @@ SWIGINTERN int
|
|
1993
2004
|
SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
|
1994
2005
|
{
|
1995
2006
|
if (TYPE(obj) == T_STRING) {
|
2007
|
+
#if defined(StringValuePtr)
|
1996
2008
|
char *cstr = StringValuePtr(obj);
|
2009
|
+
#else
|
2010
|
+
char *cstr = STR2CSTR(obj);
|
2011
|
+
#endif
|
1997
2012
|
size_t size = RSTRING_LEN(obj) + 1;
|
1998
2013
|
if (cptr) {
|
1999
2014
|
if (alloc) {
|
@@ -2169,6 +2184,24 @@ fail:
|
|
2169
2184
|
}
|
2170
2185
|
|
2171
2186
|
|
2187
|
+
SWIGINTERN VALUE
|
2188
|
+
_wrap_Ruleset_In_Use_get(VALUE self) {
|
2189
|
+
VALUE _val;
|
2190
|
+
|
2191
|
+
_val = SWIG_FromCharPtr(Ruleset_In_Use);
|
2192
|
+
return _val;
|
2193
|
+
}
|
2194
|
+
|
2195
|
+
|
2196
|
+
SWIGINTERN VALUE
|
2197
|
+
_wrap_Origins_In_Use_get(VALUE self) {
|
2198
|
+
VALUE _val;
|
2199
|
+
|
2200
|
+
_val = SWIG_FromCharPtr(Origins_In_Use);
|
2201
|
+
return _val;
|
2202
|
+
}
|
2203
|
+
|
2204
|
+
|
2172
2205
|
SWIGINTERN VALUE
|
2173
2206
|
_wrap_get_loc(int argc, VALUE *argv, VALUE self) {
|
2174
2207
|
int arg1 ;
|
@@ -2708,18 +2741,18 @@ static swig_cast_info *swig_cast_initial[] = {
|
|
2708
2741
|
|
2709
2742
|
/* -----------------------------------------------------------------------------
|
2710
2743
|
* Type initialization:
|
2711
|
-
* This problem is tough by the requirement that no dynamic
|
2712
|
-
* memory is used. Also, since swig_type_info structures store pointers to
|
2744
|
+
* This problem is tough by the requirement that no dynamic
|
2745
|
+
* memory is used. Also, since swig_type_info structures store pointers to
|
2713
2746
|
* swig_cast_info structures and swig_cast_info structures store pointers back
|
2714
|
-
* to swig_type_info structures, we need some lookup code at initialization.
|
2715
|
-
* The idea is that swig generates all the structures that are needed.
|
2716
|
-
* The runtime then collects these partially filled structures.
|
2717
|
-
* The SWIG_InitializeModule function takes these initial arrays out of
|
2747
|
+
* to swig_type_info structures, we need some lookup code at initialization.
|
2748
|
+
* The idea is that swig generates all the structures that are needed.
|
2749
|
+
* The runtime then collects these partially filled structures.
|
2750
|
+
* The SWIG_InitializeModule function takes these initial arrays out of
|
2718
2751
|
* swig_module, and does all the lookup, filling in the swig_module.types
|
2719
2752
|
* array with the correct data and linking the correct swig_cast_info
|
2720
2753
|
* structures together.
|
2721
2754
|
*
|
2722
|
-
* The generated swig_type_info structures are assigned staticly to an initial
|
2755
|
+
* The generated swig_type_info structures are assigned staticly to an initial
|
2723
2756
|
* array. We just loop through that array, and handle each type individually.
|
2724
2757
|
* First we lookup if this type has been already loaded, and if so, use the
|
2725
2758
|
* loaded structure instead of the generated one. Then we have to fill in the
|
@@ -2729,17 +2762,17 @@ static swig_cast_info *swig_cast_initial[] = {
|
|
2729
2762
|
* a column is one of the swig_cast_info structures for that type.
|
2730
2763
|
* The cast_initial array is actually an array of arrays, because each row has
|
2731
2764
|
* a variable number of columns. So to actually build the cast linked list,
|
2732
|
-
* we find the array of casts associated with the type, and loop through it
|
2765
|
+
* we find the array of casts associated with the type, and loop through it
|
2733
2766
|
* adding the casts to the list. The one last trick we need to do is making
|
2734
2767
|
* sure the type pointer in the swig_cast_info struct is correct.
|
2735
2768
|
*
|
2736
|
-
* First off, we lookup the cast->type name to see if it is already loaded.
|
2769
|
+
* First off, we lookup the cast->type name to see if it is already loaded.
|
2737
2770
|
* There are three cases to handle:
|
2738
2771
|
* 1) If the cast->type has already been loaded AND the type we are adding
|
2739
2772
|
* casting info to has not been loaded (it is in this module), THEN we
|
2740
2773
|
* replace the cast->type pointer with the type pointer that has already
|
2741
2774
|
* been loaded.
|
2742
|
-
* 2) If BOTH types (the one we are adding casting info to, and the
|
2775
|
+
* 2) If BOTH types (the one we are adding casting info to, and the
|
2743
2776
|
* cast->type) are loaded, THEN the cast info has already been loaded by
|
2744
2777
|
* the previous module so we just ignore it.
|
2745
2778
|
* 3) Finally, if cast->type has not already been loaded, then we add that
|
@@ -2765,6 +2798,8 @@ SWIG_InitializeModule(void *clientdata) {
|
|
2765
2798
|
swig_module_info *module_head, *iter;
|
2766
2799
|
int found, init;
|
2767
2800
|
|
2801
|
+
clientdata = clientdata;
|
2802
|
+
|
2768
2803
|
/* check to see if the circular list has been setup, if not, set it up */
|
2769
2804
|
if (swig_module.next==0) {
|
2770
2805
|
/* Initialize the swig_module */
|
@@ -2802,7 +2837,7 @@ SWIG_InitializeModule(void *clientdata) {
|
|
2802
2837
|
module_head->next = &swig_module;
|
2803
2838
|
}
|
2804
2839
|
|
2805
|
-
/* When multiple
|
2840
|
+
/* When multiple interpeters are used, a module could have already been initialized in
|
2806
2841
|
a different interpreter, but not yet have a pointer in this interpreter.
|
2807
2842
|
In this case, we do not want to continue adding types... everything should be
|
2808
2843
|
set up already */
|
@@ -2816,7 +2851,7 @@ SWIG_InitializeModule(void *clientdata) {
|
|
2816
2851
|
swig_type_info *type = 0;
|
2817
2852
|
swig_type_info *ret;
|
2818
2853
|
swig_cast_info *cast;
|
2819
|
-
|
2854
|
+
|
2820
2855
|
#ifdef SWIGRUNTIME_DEBUG
|
2821
2856
|
printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
|
2822
2857
|
#endif
|
@@ -2843,7 +2878,7 @@ SWIG_InitializeModule(void *clientdata) {
|
|
2843
2878
|
/* Insert casting types */
|
2844
2879
|
cast = swig_module.cast_initial[i];
|
2845
2880
|
while (cast->type) {
|
2846
|
-
|
2881
|
+
|
2847
2882
|
/* Don't need to add information already in the list */
|
2848
2883
|
ret = 0;
|
2849
2884
|
#ifdef SWIGRUNTIME_DEBUG
|
@@ -2965,6 +3000,8 @@ SWIGEXPORT void Init_undns(void) {
|
|
2965
3000
|
rb_define_singleton_method(mUndns, "want_conventions_debug=", _wrap_want_conventions_debug_set, 1);
|
2966
3001
|
rb_define_singleton_method(mUndns, "ruleset_path", _wrap_ruleset_path_get, 0);
|
2967
3002
|
rb_define_singleton_method(mUndns, "ruleset_path=", _wrap_ruleset_path_set, 1);
|
3003
|
+
rb_define_singleton_method(mUndns, "Ruleset_In_Use", _wrap_Ruleset_In_Use_get, 0);
|
3004
|
+
rb_define_singleton_method(mUndns, "Origins_In_Use", _wrap_Origins_In_Use_get, 0);
|
2968
3005
|
rb_define_module_function(mUndns, "get_loc", _wrap_get_loc, -1);
|
2969
3006
|
rb_define_module_function(mUndns, "get_role", _wrap_get_role, -1);
|
2970
3007
|
rb_define_module_function(mUndns, "get_asn_bydns", _wrap_get_asn_bydns, -1);
|