line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#include |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
MODULE = Zonemaster::LDNS PACKAGE = Zonemaster::LDNS |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
PROTOTYPES: ENABLE |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
SV * |
8
|
|
|
|
|
|
|
to_idn(...) |
9
|
|
|
|
|
|
|
PPCODE: |
10
|
|
|
|
|
|
|
{ |
11
|
|
|
|
|
|
|
#ifdef WE_CAN_HAZ_IDN |
12
|
|
|
|
|
|
|
int i; |
13
|
|
|
|
|
|
|
for( i = 0; i
|
14
|
|
|
|
|
|
|
{ |
15
|
|
|
|
|
|
|
char *out; |
16
|
|
|
|
|
|
|
int status; |
17
|
|
|
|
|
|
|
SV *obj = ST(i); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
if (SvPOK(ST(i))) |
20
|
|
|
|
|
|
|
{ |
21
|
|
|
|
|
|
|
status = idna_to_ascii_8z(SvPVutf8_nolen(obj), &out, IDNA_ALLOW_UNASSIGNED); |
22
|
|
|
|
|
|
|
if (status == IDNA_SUCCESS) |
23
|
|
|
|
|
|
|
{ |
24
|
|
|
|
|
|
|
SV *new = newSVpv(out,0); |
25
|
|
|
|
|
|
|
SvUTF8_on(new); /* We know the string is plain ASCII, so let Perl know too */ |
26
|
|
|
|
|
|
|
mXPUSHs(new); |
27
|
|
|
|
|
|
|
free(out); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
else |
30
|
|
|
|
|
|
|
{ |
31
|
|
|
|
|
|
|
croak("Error: %s\n", idna_strerror(status)); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
#else |
36
|
1
|
|
|
|
|
|
croak("libidn not installed"); |
37
|
|
|
|
|
|
|
#endif |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
bool |
41
|
|
|
|
|
|
|
has_idn() |
42
|
|
|
|
|
|
|
CODE: |
43
|
|
|
|
|
|
|
#ifdef WE_CAN_HAZ_IDN |
44
|
|
|
|
|
|
|
RETVAL = 1; |
45
|
|
|
|
|
|
|
#else |
46
|
1
|
|
|
|
|
|
RETVAL = 0; |
47
|
|
|
|
|
|
|
#endif |
48
|
|
|
|
|
|
|
OUTPUT: |
49
|
|
|
|
|
|
|
RETVAL |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
bool |
52
|
|
|
|
|
|
|
has_gost() |
53
|
|
|
|
|
|
|
CODE: |
54
|
|
|
|
|
|
|
#ifdef USE_GOST |
55
|
0
|
|
|
|
|
|
RETVAL = 1; |
56
|
|
|
|
|
|
|
#else |
57
|
|
|
|
|
|
|
RETVAL = 0; |
58
|
|
|
|
|
|
|
#endif |
59
|
|
|
|
|
|
|
OUTPUT: |
60
|
|
|
|
|
|
|
RETVAL |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
const char * |
63
|
|
|
|
|
|
|
lib_version() |
64
|
|
|
|
|
|
|
CODE: |
65
|
1
|
|
|
|
|
|
RETVAL = ldns_version(); |
66
|
|
|
|
|
|
|
OUTPUT: |
67
|
|
|
|
|
|
|
RETVAL |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
SV * |
70
|
|
|
|
|
|
|
load_zonefile(filename) |
71
|
|
|
|
|
|
|
char *filename; |
72
|
|
|
|
|
|
|
PPCODE: |
73
|
|
|
|
|
|
|
{ |
74
|
|
|
|
|
|
|
ldns_zone *zone; |
75
|
|
|
|
|
|
|
ldns_status s; |
76
|
|
|
|
|
|
|
ldns_rr *soa; |
77
|
|
|
|
|
|
|
ldns_rr_list *rrs; |
78
|
1
|
|
|
|
|
|
ldns_rdf *root = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME,"."); |
79
|
1
|
50
|
|
|
|
|
I32 context = GIMME_V; |
80
|
|
|
|
|
|
|
size_t i,n; |
81
|
|
|
|
|
|
|
|
82
|
1
|
50
|
|
|
|
|
if (context == G_VOID) |
83
|
|
|
|
|
|
|
{ |
84
|
0
|
|
|
|
|
|
return; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
1
|
|
|
|
|
|
FILE *fp = fopen(filename, "r"); |
88
|
1
|
50
|
|
|
|
|
if(!fp) |
89
|
|
|
|
|
|
|
{ |
90
|
0
|
|
|
|
|
|
croak("%s",strerror(errno)); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
1
|
|
|
|
|
|
s = ldns_zone_new_frm_fp(&zone, fp, root, 3600, LDNS_RR_CLASS_IN); |
94
|
1
|
50
|
|
|
|
|
if(s != LDNS_STATUS_OK) |
95
|
|
|
|
|
|
|
{ |
96
|
0
|
|
|
|
|
|
croak("%s",ldns_get_errorstr_by_id(s)); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
1
|
|
|
|
|
|
soa = ldns_zone_soa(zone); |
100
|
1
|
|
|
|
|
|
rrs = ldns_zone_rrs(zone); |
101
|
|
|
|
|
|
|
|
102
|
1
|
|
|
|
|
|
n = ldns_rr_list_rr_count(rrs); |
103
|
|
|
|
|
|
|
|
104
|
1
|
50
|
|
|
|
|
if (context == G_SCALAR) |
105
|
|
|
|
|
|
|
{ |
106
|
0
|
|
|
|
|
|
ldns_zone_deep_free(zone); |
107
|
0
|
|
|
|
|
|
ldns_rdf_deep_free(root); |
108
|
0
|
|
|
|
|
|
XSRETURN_IV(n+1); /* Add one for SOA */ |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
1
|
50
|
|
|
|
|
mXPUSHs(rr2sv(ldns_rr_clone(soa))); |
112
|
16
|
100
|
|
|
|
|
for(i = 0; i < n; ++i) |
113
|
|
|
|
|
|
|
{ |
114
|
15
|
50
|
|
|
|
|
mXPUSHs(rr2sv(ldns_rr_clone(ldns_rr_list_rr(rrs,i)))); |
115
|
|
|
|
|
|
|
} |
116
|
1
|
|
|
|
|
|
ldns_zone_deep_free(zone); |
117
|
1
|
|
|
|
|
|
ldns_rdf_deep_free(root); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
SV * |
121
|
|
|
|
|
|
|
new(class, ...) |
122
|
|
|
|
|
|
|
char *class; |
123
|
|
|
|
|
|
|
CODE: |
124
|
|
|
|
|
|
|
{ |
125
|
|
|
|
|
|
|
int i; |
126
|
|
|
|
|
|
|
ldns_resolver *res; |
127
|
18
|
|
|
|
|
|
RETVAL = newSV(0); |
128
|
|
|
|
|
|
|
|
129
|
18
|
100
|
|
|
|
|
if (items == 1 ) { /* Called without arguments, use resolv.conf */ |
130
|
1
|
|
|
|
|
|
ldns_resolver_new_frm_file(&res,NULL); |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
else { |
133
|
17
|
|
|
|
|
|
res = ldns_resolver_new(); |
134
|
17
|
|
|
|
|
|
ldns_resolver_set_recursive(res, 1); |
135
|
33
|
100
|
|
|
|
|
for (i=1;i
|
136
|
|
|
|
|
|
|
{ |
137
|
|
|
|
|
|
|
ldns_status s; |
138
|
|
|
|
|
|
|
ldns_rdf *addr; |
139
|
|
|
|
|
|
|
|
140
|
17
|
50
|
|
|
|
|
SvGETMAGIC(ST(i)); |
|
|
0
|
|
|
|
|
|
141
|
17
|
50
|
|
|
|
|
addr = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, SvPV_nolen(ST(i))); |
142
|
17
|
100
|
|
|
|
|
if ( addr == NULL) { |
143
|
1
|
50
|
|
|
|
|
addr = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, SvPV_nolen(ST(i))); |
144
|
|
|
|
|
|
|
} |
145
|
17
|
100
|
|
|
|
|
if ( addr == NULL ) { |
146
|
1
|
50
|
|
|
|
|
croak("Failed to parse IP address: %s", SvPV_nolen(ST(i))); |
147
|
|
|
|
|
|
|
} |
148
|
16
|
|
|
|
|
|
s = ldns_resolver_push_nameserver(res, addr); |
149
|
16
|
|
|
|
|
|
ldns_rdf_deep_free(addr); |
150
|
16
|
50
|
|
|
|
|
if(s != LDNS_STATUS_OK) |
151
|
|
|
|
|
|
|
{ |
152
|
0
|
|
|
|
|
|
croak("Adding nameserver failed: %s", ldns_get_errorstr_by_id(s)); |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
} |
156
|
17
|
|
|
|
|
|
sv_setref_pv(RETVAL, class, res); |
157
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
158
|
|
|
|
|
|
|
net_ldns_remember_resolver(RETVAL); |
159
|
|
|
|
|
|
|
#endif |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
OUTPUT: |
162
|
|
|
|
|
|
|
RETVAL |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
SV * |
165
|
|
|
|
|
|
|
query(obj, dname, rrtype="A", rrclass="IN") |
166
|
|
|
|
|
|
|
Zonemaster::LDNS obj; |
167
|
|
|
|
|
|
|
char *dname; |
168
|
|
|
|
|
|
|
char *rrtype; |
169
|
|
|
|
|
|
|
char *rrclass; |
170
|
|
|
|
|
|
|
CODE: |
171
|
|
|
|
|
|
|
{ |
172
|
|
|
|
|
|
|
ldns_rdf *domain; |
173
|
|
|
|
|
|
|
ldns_rr_type t; |
174
|
|
|
|
|
|
|
ldns_rr_class c; |
175
|
|
|
|
|
|
|
ldns_status status; |
176
|
|
|
|
|
|
|
ldns_pkt *pkt; |
177
|
21
|
|
|
|
|
|
uint16_t flags = 0; |
178
|
|
|
|
|
|
|
|
179
|
21
|
|
|
|
|
|
t = ldns_get_rr_type_by_name(rrtype); |
180
|
21
|
100
|
|
|
|
|
if(!t) |
181
|
|
|
|
|
|
|
{ |
182
|
1
|
|
|
|
|
|
croak("Unknown RR type: %s", rrtype); |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
|
185
|
20
|
|
|
|
|
|
c = ldns_get_rr_class_by_name(rrclass); |
186
|
20
|
100
|
|
|
|
|
if(!c) |
187
|
|
|
|
|
|
|
{ |
188
|
1
|
|
|
|
|
|
croak("Unknown RR class: %s", rrclass); |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
|
191
|
19
|
|
|
|
|
|
domain = ldns_dname_new_frm_str(dname); |
192
|
19
|
100
|
|
|
|
|
if(domain==NULL) |
193
|
|
|
|
|
|
|
{ |
194
|
1
|
|
|
|
|
|
croak("Invalid domain name: %s", dname); |
195
|
|
|
|
|
|
|
} |
196
|
|
|
|
|
|
|
|
197
|
18
|
100
|
|
|
|
|
if(ldns_resolver_recursive(obj)) |
198
|
|
|
|
|
|
|
{ |
199
|
16
|
|
|
|
|
|
flags |= LDNS_RD; |
200
|
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
|
202
|
18
|
50
|
|
|
|
|
if(ldns_resolver_dnssec_cd(obj)) |
203
|
|
|
|
|
|
|
{ |
204
|
0
|
|
|
|
|
|
flags |= LDNS_CD; |
205
|
|
|
|
|
|
|
} |
206
|
|
|
|
|
|
|
|
207
|
18
|
|
|
|
|
|
status = ldns_resolver_send(&pkt, obj, domain, t, c, flags); |
208
|
18
|
100
|
|
|
|
|
if ( status != LDNS_STATUS_OK) { |
209
|
|
|
|
|
|
|
/* Remove and reinsert nameserver to make ldns forget it failed */ |
210
|
|
|
|
|
|
|
ldns_status s; |
211
|
1
|
|
|
|
|
|
ldns_rdf *ns = ldns_resolver_pop_nameserver(obj); |
212
|
1
|
50
|
|
|
|
|
if (ns != NULL) { |
213
|
1
|
|
|
|
|
|
s = ldns_resolver_push_nameserver(obj, ns); |
214
|
1
|
50
|
|
|
|
|
if ( s != LDNS_STATUS_OK) { |
215
|
0
|
|
|
|
|
|
croak("Failed to reinsert nameserver after failure (ouch): %s", ldns_get_errorstr_by_id(s)); |
216
|
|
|
|
|
|
|
} |
217
|
1
|
|
|
|
|
|
ldns_rdf_deep_free(ns); |
218
|
|
|
|
|
|
|
} |
219
|
1
|
|
|
|
|
|
ldns_rdf_deep_free(domain); |
220
|
1
|
|
|
|
|
|
croak("%s", ldns_get_errorstr_by_id(status)); |
221
|
|
|
|
|
|
|
RETVAL = NULL; |
222
|
|
|
|
|
|
|
} |
223
|
17
|
|
|
|
|
|
ldns_pkt *clone = ldns_pkt_clone(pkt); |
224
|
17
|
|
|
|
|
|
ldns_pkt_set_timestamp(clone, ldns_pkt_timestamp(pkt)); |
225
|
17
|
|
|
|
|
|
RETVAL = sv_setref_pv(newSV(0), "Zonemaster::LDNS::Packet", clone); |
226
|
17
|
|
|
|
|
|
ldns_rdf_deep_free(domain); |
227
|
17
|
|
|
|
|
|
ldns_pkt_free(pkt); |
228
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
229
|
|
|
|
|
|
|
net_ldns_remember_packet(RETVAL); |
230
|
|
|
|
|
|
|
#endif |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
OUTPUT: |
233
|
|
|
|
|
|
|
RETVAL |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
bool |
236
|
|
|
|
|
|
|
recurse(obj,...) |
237
|
|
|
|
|
|
|
Zonemaster::LDNS obj; |
238
|
|
|
|
|
|
|
CODE: |
239
|
5
|
100
|
|
|
|
|
if(items>1) { |
240
|
3
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
241
|
3
|
50
|
|
|
|
|
ldns_resolver_set_recursive(obj, SvIV(ST(1))); |
242
|
|
|
|
|
|
|
} |
243
|
5
|
|
|
|
|
|
RETVAL = ldns_resolver_recursive(obj); |
244
|
|
|
|
|
|
|
OUTPUT: |
245
|
|
|
|
|
|
|
RETVAL |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
bool |
248
|
|
|
|
|
|
|
debug(obj,...) |
249
|
|
|
|
|
|
|
Zonemaster::LDNS obj; |
250
|
|
|
|
|
|
|
CODE: |
251
|
4
|
100
|
|
|
|
|
if ( items > 1 ) { |
252
|
2
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
253
|
2
|
50
|
|
|
|
|
ldns_resolver_set_debug(obj, SvIV(ST(1))); |
254
|
|
|
|
|
|
|
} |
255
|
4
|
|
|
|
|
|
RETVAL = ldns_resolver_debug(obj); |
256
|
|
|
|
|
|
|
OUTPUT: |
257
|
|
|
|
|
|
|
RETVAL |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
bool |
260
|
|
|
|
|
|
|
dnssec(obj,...) |
261
|
|
|
|
|
|
|
Zonemaster::LDNS obj; |
262
|
|
|
|
|
|
|
CODE: |
263
|
5
|
100
|
|
|
|
|
if ( items > 1 ) { |
264
|
3
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
265
|
3
|
50
|
|
|
|
|
ldns_resolver_set_dnssec(obj, SvIV(ST(1))); |
266
|
|
|
|
|
|
|
} |
267
|
5
|
|
|
|
|
|
RETVAL = ldns_resolver_dnssec(obj); |
268
|
|
|
|
|
|
|
OUTPUT: |
269
|
|
|
|
|
|
|
RETVAL |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
bool |
272
|
|
|
|
|
|
|
cd(obj,...) |
273
|
|
|
|
|
|
|
Zonemaster::LDNS obj; |
274
|
|
|
|
|
|
|
CODE: |
275
|
4
|
100
|
|
|
|
|
if ( items > 1 ) { |
276
|
2
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
277
|
2
|
50
|
|
|
|
|
ldns_resolver_set_dnssec_cd(obj, SvIV(ST(1))); |
278
|
|
|
|
|
|
|
} |
279
|
4
|
|
|
|
|
|
RETVAL = ldns_resolver_dnssec_cd(obj); |
280
|
|
|
|
|
|
|
OUTPUT: |
281
|
|
|
|
|
|
|
RETVAL |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
bool |
284
|
|
|
|
|
|
|
usevc(obj,...) |
285
|
|
|
|
|
|
|
Zonemaster::LDNS obj; |
286
|
|
|
|
|
|
|
CODE: |
287
|
4
|
100
|
|
|
|
|
if ( items > 1 ) { |
288
|
2
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
289
|
2
|
50
|
|
|
|
|
ldns_resolver_set_usevc(obj, SvIV(ST(1))); |
290
|
|
|
|
|
|
|
} |
291
|
4
|
|
|
|
|
|
RETVAL = ldns_resolver_usevc(obj); |
292
|
|
|
|
|
|
|
OUTPUT: |
293
|
|
|
|
|
|
|
RETVAL |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
bool |
296
|
|
|
|
|
|
|
igntc(obj,...) |
297
|
|
|
|
|
|
|
Zonemaster::LDNS obj; |
298
|
|
|
|
|
|
|
CODE: |
299
|
4
|
100
|
|
|
|
|
if ( items > 1 ) { |
300
|
2
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
301
|
2
|
50
|
|
|
|
|
ldns_resolver_set_igntc(obj, SvIV(ST(1))); |
302
|
|
|
|
|
|
|
} |
303
|
4
|
|
|
|
|
|
RETVAL = ldns_resolver_igntc(obj); |
304
|
|
|
|
|
|
|
OUTPUT: |
305
|
|
|
|
|
|
|
RETVAL |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
U8 |
308
|
|
|
|
|
|
|
retry(obj,...) |
309
|
|
|
|
|
|
|
Zonemaster::LDNS obj; |
310
|
|
|
|
|
|
|
CODE: |
311
|
2
|
100
|
|
|
|
|
if ( items > 1 ) { |
312
|
1
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
313
|
1
|
50
|
|
|
|
|
ldns_resolver_set_retry(obj, SvIV(ST(1))); |
314
|
|
|
|
|
|
|
} |
315
|
2
|
|
|
|
|
|
RETVAL = ldns_resolver_retry(obj); |
316
|
|
|
|
|
|
|
OUTPUT: |
317
|
|
|
|
|
|
|
RETVAL |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
U8 |
320
|
|
|
|
|
|
|
retrans(obj,...) |
321
|
|
|
|
|
|
|
Zonemaster::LDNS obj; |
322
|
|
|
|
|
|
|
CODE: |
323
|
2
|
100
|
|
|
|
|
if ( items > 1 ) { |
324
|
1
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
325
|
1
|
50
|
|
|
|
|
ldns_resolver_set_retrans(obj, SvIV(ST(1))); |
326
|
|
|
|
|
|
|
} |
327
|
2
|
|
|
|
|
|
RETVAL = ldns_resolver_retrans(obj); |
328
|
|
|
|
|
|
|
OUTPUT: |
329
|
|
|
|
|
|
|
RETVAL |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
U16 |
332
|
|
|
|
|
|
|
edns_size(obj,...) |
333
|
|
|
|
|
|
|
Zonemaster::LDNS obj; |
334
|
|
|
|
|
|
|
CODE: |
335
|
4
|
100
|
|
|
|
|
if( items > 1 ) |
336
|
|
|
|
|
|
|
{ |
337
|
2
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
338
|
2
|
50
|
|
|
|
|
ldns_resolver_set_edns_udp_size(obj, (U16)SvIV(ST(1))); |
339
|
|
|
|
|
|
|
} |
340
|
4
|
|
|
|
|
|
RETVAL = ldns_resolver_edns_udp_size(obj); |
341
|
|
|
|
|
|
|
OUTPUT: |
342
|
|
|
|
|
|
|
RETVAL |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
U16 |
345
|
|
|
|
|
|
|
port(obj,...) |
346
|
|
|
|
|
|
|
Zonemaster::LDNS obj; |
347
|
|
|
|
|
|
|
CODE: |
348
|
0
|
0
|
|
|
|
|
if( items > 1 ) |
349
|
|
|
|
|
|
|
{ |
350
|
0
|
0
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
351
|
0
|
0
|
|
|
|
|
ldns_resolver_set_port(obj, (U16)SvIV(ST(1))); |
352
|
|
|
|
|
|
|
} |
353
|
0
|
|
|
|
|
|
RETVAL = ldns_resolver_port(obj); |
354
|
|
|
|
|
|
|
OUTPUT: |
355
|
|
|
|
|
|
|
RETVAL |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
SV * |
358
|
|
|
|
|
|
|
name2addr(obj,name) |
359
|
|
|
|
|
|
|
Zonemaster::LDNS obj; |
360
|
|
|
|
|
|
|
const char *name; |
361
|
|
|
|
|
|
|
PPCODE: |
362
|
|
|
|
|
|
|
{ |
363
|
|
|
|
|
|
|
ldns_rr_list *addrs; |
364
|
|
|
|
|
|
|
ldns_rdf *dname; |
365
|
|
|
|
|
|
|
size_t n, i; |
366
|
|
|
|
|
|
|
I32 context; |
367
|
|
|
|
|
|
|
|
368
|
2
|
50
|
|
|
|
|
context = GIMME_V; |
369
|
|
|
|
|
|
|
|
370
|
2
|
50
|
|
|
|
|
if(context == G_VOID) |
371
|
|
|
|
|
|
|
{ |
372
|
0
|
|
|
|
|
|
XSRETURN_NO; |
373
|
|
|
|
|
|
|
} |
374
|
|
|
|
|
|
|
|
375
|
2
|
|
|
|
|
|
dname = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, name); |
376
|
2
|
50
|
|
|
|
|
if(dname==NULL) |
377
|
|
|
|
|
|
|
{ |
378
|
0
|
|
|
|
|
|
croak("Name error for '%s'", name); |
379
|
|
|
|
|
|
|
} |
380
|
|
|
|
|
|
|
|
381
|
2
|
|
|
|
|
|
addrs = ldns_get_rr_list_addr_by_name(obj,dname,LDNS_RR_CLASS_IN,0); |
382
|
2
|
|
|
|
|
|
n = ldns_rr_list_rr_count(addrs); |
383
|
2
|
|
|
|
|
|
ldns_rdf_deep_free(dname); |
384
|
|
|
|
|
|
|
|
385
|
2
|
100
|
|
|
|
|
if (context == G_SCALAR) |
386
|
|
|
|
|
|
|
{ |
387
|
1
|
|
|
|
|
|
ldns_rr_list_deep_free(addrs); |
388
|
1
|
|
|
|
|
|
XSRETURN_IV(n); |
389
|
|
|
|
|
|
|
} |
390
|
|
|
|
|
|
|
else |
391
|
|
|
|
|
|
|
{ |
392
|
3
|
100
|
|
|
|
|
for(i = 0; i < n; ++i) |
393
|
|
|
|
|
|
|
{ |
394
|
2
|
|
|
|
|
|
ldns_rr *rr = ldns_rr_list_rr(addrs,i); |
395
|
2
|
|
|
|
|
|
ldns_rdf *addr_rdf = ldns_rr_a_address(rr); |
396
|
2
|
|
|
|
|
|
char *addr_str = ldns_rdf2str(addr_rdf); |
397
|
|
|
|
|
|
|
|
398
|
2
|
|
|
|
|
|
SV* sv = newSVpv(addr_str,0); |
399
|
2
|
50
|
|
|
|
|
mXPUSHs(sv); |
400
|
2
|
|
|
|
|
|
free(addr_str); |
401
|
|
|
|
|
|
|
} |
402
|
1
|
|
|
|
|
|
ldns_rr_list_deep_free(addrs); |
403
|
|
|
|
|
|
|
} |
404
|
|
|
|
|
|
|
} |
405
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
SV * |
407
|
|
|
|
|
|
|
addr2name(obj,addr_in) |
408
|
|
|
|
|
|
|
Zonemaster::LDNS obj; |
409
|
|
|
|
|
|
|
const char *addr_in; |
410
|
|
|
|
|
|
|
PPCODE: |
411
|
|
|
|
|
|
|
{ |
412
|
|
|
|
|
|
|
ldns_rr_list *names; |
413
|
|
|
|
|
|
|
ldns_rdf *addr_rdf; |
414
|
|
|
|
|
|
|
size_t n, i; |
415
|
|
|
|
|
|
|
I32 context; |
416
|
|
|
|
|
|
|
|
417
|
2
|
50
|
|
|
|
|
context = GIMME_V; |
418
|
|
|
|
|
|
|
|
419
|
2
|
50
|
|
|
|
|
if(context == G_VOID) |
420
|
|
|
|
|
|
|
{ |
421
|
0
|
|
|
|
|
|
XSRETURN_NO; |
422
|
|
|
|
|
|
|
} |
423
|
|
|
|
|
|
|
|
424
|
2
|
|
|
|
|
|
addr_rdf = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, addr_in); |
425
|
2
|
50
|
|
|
|
|
if(addr_rdf==NULL) |
426
|
|
|
|
|
|
|
{ |
427
|
0
|
|
|
|
|
|
addr_rdf = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, addr_in); |
428
|
|
|
|
|
|
|
} |
429
|
2
|
50
|
|
|
|
|
if(addr_rdf==NULL) |
430
|
|
|
|
|
|
|
{ |
431
|
0
|
|
|
|
|
|
croak("Failed to parse address: %s", addr_in); |
432
|
|
|
|
|
|
|
} |
433
|
|
|
|
|
|
|
|
434
|
2
|
|
|
|
|
|
names = ldns_get_rr_list_name_by_addr(obj,addr_rdf,LDNS_RR_CLASS_IN,0); |
435
|
2
|
|
|
|
|
|
ldns_rdf_deep_free(addr_rdf); |
436
|
2
|
|
|
|
|
|
n = ldns_rr_list_rr_count(names); |
437
|
|
|
|
|
|
|
|
438
|
2
|
100
|
|
|
|
|
if (context == G_SCALAR) |
439
|
|
|
|
|
|
|
{ |
440
|
1
|
|
|
|
|
|
ldns_rr_list_deep_free(names); |
441
|
1
|
|
|
|
|
|
XSRETURN_IV(n); |
442
|
|
|
|
|
|
|
} |
443
|
|
|
|
|
|
|
else |
444
|
|
|
|
|
|
|
{ |
445
|
2
|
100
|
|
|
|
|
for(i = 0; i < n; ++i) |
446
|
|
|
|
|
|
|
{ |
447
|
1
|
|
|
|
|
|
ldns_rr *rr = ldns_rr_list_rr(names,i); |
448
|
1
|
|
|
|
|
|
ldns_rdf *name_rdf = ldns_rr_rdf(rr,0); |
449
|
1
|
|
|
|
|
|
char *name_str = randomize_capitalization(ldns_rdf2str(name_rdf)); |
450
|
|
|
|
|
|
|
|
451
|
1
|
|
|
|
|
|
SV* sv = newSVpv(name_str,0); |
452
|
1
|
50
|
|
|
|
|
mXPUSHs(sv); |
453
|
1
|
|
|
|
|
|
free(name_str); |
454
|
|
|
|
|
|
|
} |
455
|
1
|
|
|
|
|
|
ldns_rr_list_deep_free(names); |
456
|
|
|
|
|
|
|
} |
457
|
|
|
|
|
|
|
} |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
bool |
460
|
|
|
|
|
|
|
axfr(obj,dname,callback,class="IN") |
461
|
|
|
|
|
|
|
Zonemaster::LDNS obj; |
462
|
|
|
|
|
|
|
const char *dname; |
463
|
|
|
|
|
|
|
SV *callback; |
464
|
|
|
|
|
|
|
const char *class; |
465
|
|
|
|
|
|
|
CODE: |
466
|
|
|
|
|
|
|
{ |
467
|
2
|
|
|
|
|
|
ldns_rdf *domain = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, dname); |
468
|
2
|
|
|
|
|
|
ldns_rr_class cl = ldns_get_rr_class_by_name(class); |
469
|
|
|
|
|
|
|
ldns_status status; |
470
|
|
|
|
|
|
|
|
471
|
2
|
50
|
|
|
|
|
SvGETMAGIC(callback); |
|
|
0
|
|
|
|
|
|
472
|
2
|
50
|
|
|
|
|
if(SvTYPE(SvRV(callback)) != SVt_PVCV) |
473
|
|
|
|
|
|
|
{ |
474
|
0
|
|
|
|
|
|
ldns_rdf_deep_free(domain); |
475
|
0
|
|
|
|
|
|
croak("Callback not a code reference"); |
476
|
|
|
|
|
|
|
} |
477
|
|
|
|
|
|
|
|
478
|
2
|
50
|
|
|
|
|
if(domain==NULL) |
479
|
|
|
|
|
|
|
{ |
480
|
0
|
|
|
|
|
|
ldns_rdf_deep_free(domain); |
481
|
0
|
|
|
|
|
|
croak("Name error for '%s", dname); |
482
|
|
|
|
|
|
|
} |
483
|
|
|
|
|
|
|
|
484
|
2
|
50
|
|
|
|
|
if(!cl) |
485
|
|
|
|
|
|
|
{ |
486
|
0
|
|
|
|
|
|
ldns_rdf_deep_free(domain); |
487
|
0
|
|
|
|
|
|
croak("Unknown RR class: %s", class); |
488
|
|
|
|
|
|
|
} |
489
|
|
|
|
|
|
|
|
490
|
2
|
|
|
|
|
|
status = ldns_axfr_start(obj, domain, cl); |
491
|
2
|
|
|
|
|
|
ldns_rdf_deep_free(domain); |
492
|
|
|
|
|
|
|
|
493
|
2
|
50
|
|
|
|
|
if(status != LDNS_STATUS_OK) |
494
|
|
|
|
|
|
|
{ |
495
|
0
|
|
|
|
|
|
croak("AXFR setup error: %s", ldns_get_errorstr_by_id(status)); |
496
|
|
|
|
|
|
|
} |
497
|
|
|
|
|
|
|
|
498
|
2
|
|
|
|
|
|
RETVAL = 1; |
499
|
34
|
50
|
|
|
|
|
while (!ldns_axfr_complete(obj)) |
500
|
|
|
|
|
|
|
{ |
501
|
|
|
|
|
|
|
int count; |
502
|
|
|
|
|
|
|
SV *ret; |
503
|
34
|
|
|
|
|
|
ldns_rr *rr = ldns_axfr_next(obj); |
504
|
34
|
100
|
|
|
|
|
if(rr==NULL) |
505
|
|
|
|
|
|
|
{ |
506
|
1
|
|
|
|
|
|
ldns_pkt *pkt = ldns_axfr_last_pkt(obj); |
507
|
1
|
50
|
|
|
|
|
if(pkt != NULL) |
508
|
|
|
|
|
|
|
{ |
509
|
|
|
|
|
|
|
char tmp[20]; |
510
|
1
|
|
|
|
|
|
char *msg = ldns_pkt_rcode2str(ldns_pkt_get_rcode(pkt)); |
511
|
1
|
|
|
|
|
|
strncpy(tmp,msg,19); |
512
|
1
|
|
|
|
|
|
free(msg); |
513
|
1
|
|
|
|
|
|
croak("AXFR transfer error: %s", tmp); |
514
|
|
|
|
|
|
|
} |
515
|
|
|
|
|
|
|
else { |
516
|
0
|
|
|
|
|
|
croak("AXFR transfer error: unknown problem"); |
517
|
|
|
|
|
|
|
} |
518
|
|
|
|
|
|
|
ldns_pkt_free(pkt); |
519
|
|
|
|
|
|
|
} |
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
/* Enter the Cargo Cult */ |
522
|
33
|
|
|
|
|
|
ENTER; |
523
|
33
|
|
|
|
|
|
SAVETMPS; |
524
|
33
|
50
|
|
|
|
|
PUSHMARK(SP); |
525
|
33
|
50
|
|
|
|
|
mXPUSHs(rr2sv(rr)); |
526
|
33
|
|
|
|
|
|
PUTBACK; |
527
|
33
|
|
|
|
|
|
count = call_sv(callback, G_SCALAR); |
528
|
33
|
|
|
|
|
|
SPAGAIN; |
529
|
|
|
|
|
|
|
|
530
|
33
|
50
|
|
|
|
|
if(count != 1) |
531
|
|
|
|
|
|
|
{ |
532
|
0
|
|
|
|
|
|
croak("Callback did not return exactly one value in scalar context"); |
533
|
|
|
|
|
|
|
} |
534
|
|
|
|
|
|
|
|
535
|
33
|
|
|
|
|
|
ret = POPs; |
536
|
|
|
|
|
|
|
|
537
|
33
|
50
|
|
|
|
|
if(!SvTRUE(ret)) |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
538
|
|
|
|
|
|
|
{ |
539
|
1
|
|
|
|
|
|
RETVAL = 0; |
540
|
1
|
|
|
|
|
|
break; |
541
|
|
|
|
|
|
|
} |
542
|
32
|
|
|
|
|
|
PUTBACK; |
543
|
32
|
50
|
|
|
|
|
FREETMPS; |
544
|
32
|
|
|
|
|
|
LEAVE; |
545
|
|
|
|
|
|
|
/* Callback magic ends */ |
546
|
|
|
|
|
|
|
} |
547
|
1
|
|
|
|
|
|
ldns_axfr_abort(obj); |
548
|
|
|
|
|
|
|
} |
549
|
|
|
|
|
|
|
OUTPUT: |
550
|
|
|
|
|
|
|
RETVAL |
551
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
bool |
553
|
|
|
|
|
|
|
axfr_start(obj,dname,class="IN") |
554
|
|
|
|
|
|
|
Zonemaster::LDNS obj; |
555
|
|
|
|
|
|
|
const char *dname; |
556
|
|
|
|
|
|
|
const char *class; |
557
|
|
|
|
|
|
|
CODE: |
558
|
|
|
|
|
|
|
{ |
559
|
0
|
|
|
|
|
|
ldns_rdf *domain = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, dname); |
560
|
0
|
|
|
|
|
|
ldns_rr_class cl = ldns_get_rr_class_by_name(class); |
561
|
|
|
|
|
|
|
ldns_status s; |
562
|
|
|
|
|
|
|
|
563
|
0
|
0
|
|
|
|
|
if(domain==NULL) |
564
|
|
|
|
|
|
|
{ |
565
|
0
|
|
|
|
|
|
croak("Name error for '%s", dname); |
566
|
|
|
|
|
|
|
} |
567
|
|
|
|
|
|
|
|
568
|
0
|
0
|
|
|
|
|
if(!cl) |
569
|
|
|
|
|
|
|
{ |
570
|
0
|
|
|
|
|
|
croak("Unknown RR class: %s", class); |
571
|
|
|
|
|
|
|
} |
572
|
|
|
|
|
|
|
|
573
|
0
|
|
|
|
|
|
s = ldns_axfr_start(obj, domain, cl); |
574
|
|
|
|
|
|
|
|
575
|
0
|
|
|
|
|
|
RETVAL = (s==LDNS_STATUS_OK); |
576
|
|
|
|
|
|
|
} |
577
|
|
|
|
|
|
|
OUTPUT: |
578
|
|
|
|
|
|
|
RETVAL |
579
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
SV * |
581
|
|
|
|
|
|
|
axfr_next(obj) |
582
|
|
|
|
|
|
|
Zonemaster::LDNS obj; |
583
|
|
|
|
|
|
|
CODE: |
584
|
|
|
|
|
|
|
{ |
585
|
|
|
|
|
|
|
ldns_rr *rr; |
586
|
|
|
|
|
|
|
|
587
|
|
|
|
|
|
|
/* ldns unfortunately prints to standard error, so close it while we call them */ |
588
|
|
|
|
|
|
|
/* EDIT: That behavior should be changed starting with ldns 1.6.17, but we'll keep the closing for a while */ |
589
|
0
|
|
|
|
|
|
int err_fd = fileno(stderr); /* Remember fd for stderr */ |
590
|
0
|
|
|
|
|
|
int save_fd = dup(err_fd); /* Copy open fd for stderr */ |
591
|
|
|
|
|
|
|
int tmp_fd; |
592
|
|
|
|
|
|
|
|
593
|
0
|
|
|
|
|
|
fflush(stderr); /* Print anything waiting */ |
594
|
0
|
|
|
|
|
|
tmp_fd = open("/dev/null",O_RDWR); /* Open something to allocate the now-free fd stderr used */ |
595
|
0
|
|
|
|
|
|
dup2(tmp_fd,err_fd); |
596
|
0
|
|
|
|
|
|
rr = ldns_axfr_next(obj); /* Shut up */ |
597
|
0
|
|
|
|
|
|
close(tmp_fd); /* Close the placeholder */ |
598
|
0
|
|
|
|
|
|
fflush(stderr); /* Flush anything ldns buffered */ |
599
|
0
|
|
|
|
|
|
dup2(save_fd,err_fd); /* And copy the open stderr back to where it should be */ |
600
|
|
|
|
|
|
|
|
601
|
0
|
0
|
|
|
|
|
if(rr==NULL) |
602
|
|
|
|
|
|
|
{ |
603
|
0
|
|
|
|
|
|
croak("AXFR error"); |
604
|
|
|
|
|
|
|
} |
605
|
|
|
|
|
|
|
|
606
|
0
|
|
|
|
|
|
RETVAL = rr2sv(rr); |
607
|
|
|
|
|
|
|
} |
608
|
|
|
|
|
|
|
OUTPUT: |
609
|
|
|
|
|
|
|
RETVAL |
610
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
bool |
612
|
|
|
|
|
|
|
axfr_complete(obj) |
613
|
|
|
|
|
|
|
Zonemaster::LDNS obj; |
614
|
|
|
|
|
|
|
CODE: |
615
|
0
|
|
|
|
|
|
RETVAL = ldns_axfr_complete(obj); |
616
|
|
|
|
|
|
|
OUTPUT: |
617
|
|
|
|
|
|
|
RETVAL |
618
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet |
620
|
|
|
|
|
|
|
axfr_last_packet(obj) |
621
|
|
|
|
|
|
|
Zonemaster::LDNS obj; |
622
|
|
|
|
|
|
|
CODE: |
623
|
0
|
|
|
|
|
|
RETVAL = ldns_axfr_last_pkt(obj); |
624
|
|
|
|
|
|
|
OUTPUT: |
625
|
|
|
|
|
|
|
RETVAL |
626
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
double |
628
|
|
|
|
|
|
|
timeout(obj,...) |
629
|
|
|
|
|
|
|
Zonemaster::LDNS obj; |
630
|
|
|
|
|
|
|
CODE: |
631
|
|
|
|
|
|
|
struct timeval tv; |
632
|
|
|
|
|
|
|
|
633
|
3
|
100
|
|
|
|
|
if( items > 1) |
634
|
|
|
|
|
|
|
{ |
635
|
|
|
|
|
|
|
double dec_part, int_part; |
636
|
|
|
|
|
|
|
struct timeval tn; |
637
|
|
|
|
|
|
|
|
638
|
1
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
639
|
1
|
50
|
|
|
|
|
dec_part = modf(SvNV(ST(1)), &int_part); |
640
|
1
|
|
|
|
|
|
tn.tv_sec = int_part; |
641
|
1
|
|
|
|
|
|
tn.tv_usec = 1000000*dec_part; |
642
|
1
|
|
|
|
|
|
ldns_resolver_set_timeout(obj, tn); |
643
|
|
|
|
|
|
|
} |
644
|
|
|
|
|
|
|
|
645
|
3
|
|
|
|
|
|
tv = ldns_resolver_timeout(obj); |
646
|
3
|
|
|
|
|
|
RETVAL = (double)tv.tv_sec; |
647
|
3
|
|
|
|
|
|
RETVAL += ((double)tv.tv_usec)/1000000; |
648
|
|
|
|
|
|
|
OUTPUT: |
649
|
|
|
|
|
|
|
RETVAL |
650
|
|
|
|
|
|
|
|
651
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
char * |
653
|
|
|
|
|
|
|
source(obj,...) |
654
|
|
|
|
|
|
|
Zonemaster::LDNS obj; |
655
|
|
|
|
|
|
|
CODE: |
656
|
2
|
100
|
|
|
|
|
if(items >= 2) |
657
|
|
|
|
|
|
|
{ |
658
|
|
|
|
|
|
|
ldns_rdf *address; |
659
|
|
|
|
|
|
|
|
660
|
1
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
661
|
1
|
50
|
|
|
|
|
address = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, SvPV_nolen(ST(1))); |
662
|
1
|
50
|
|
|
|
|
if(address == NULL) |
663
|
|
|
|
|
|
|
{ |
664
|
0
|
0
|
|
|
|
|
address = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, SvPV_nolen(ST(1))); |
665
|
|
|
|
|
|
|
} |
666
|
1
|
50
|
|
|
|
|
if(address == NULL) |
667
|
|
|
|
|
|
|
{ |
668
|
0
|
0
|
|
|
|
|
croak("Failed to parse IP address: %s", SvPV_nolen(ST(1))); |
669
|
|
|
|
|
|
|
} |
670
|
|
|
|
|
|
|
|
671
|
1
|
|
|
|
|
|
ldns_resolver_set_source(obj, address); |
672
|
|
|
|
|
|
|
} |
673
|
2
|
|
|
|
|
|
RETVAL = ldns_rdf2str(ldns_resolver_source(obj)); |
674
|
|
|
|
|
|
|
OUTPUT: |
675
|
|
|
|
|
|
|
RETVAL |
676
|
|
|
|
|
|
|
CLEANUP: |
677
|
2
|
|
|
|
|
|
free(RETVAL); |
678
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
|
680
|
|
|
|
|
|
|
|
681
|
|
|
|
|
|
|
void |
682
|
|
|
|
|
|
|
DESTROY(obj) |
683
|
|
|
|
|
|
|
Zonemaster::LDNS obj; |
684
|
|
|
|
|
|
|
CODE: |
685
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
686
|
|
|
|
|
|
|
net_ldns_forget(); |
687
|
|
|
|
|
|
|
#endif |
688
|
17
|
|
|
|
|
|
ldns_axfr_abort(obj); |
689
|
17
|
|
|
|
|
|
ldns_resolver_deep_free(obj); |
690
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
692
|
|
|
|
|
|
|
|
693
|
|
|
|
|
|
|
void |
694
|
|
|
|
|
|
|
CLONE(class) |
695
|
|
|
|
|
|
|
char *class; |
696
|
|
|
|
|
|
|
CODE: |
697
|
|
|
|
|
|
|
net_ldns_clone_resolvers(); |
698
|
|
|
|
|
|
|
|
699
|
|
|
|
|
|
|
#endif |
700
|
|
|
|
|
|
|
|
701
|
|
|
|
|
|
|
MODULE = Zonemaster::LDNS PACKAGE = Zonemaster::LDNS::Packet PREFIX=packet_ |
702
|
|
|
|
|
|
|
|
703
|
|
|
|
|
|
|
SV * |
704
|
|
|
|
|
|
|
packet_new(objclass,name,type="A",class="IN") |
705
|
|
|
|
|
|
|
char *objclass; |
706
|
|
|
|
|
|
|
char *name; |
707
|
|
|
|
|
|
|
char *type; |
708
|
|
|
|
|
|
|
char *class; |
709
|
|
|
|
|
|
|
CODE: |
710
|
|
|
|
|
|
|
{ |
711
|
|
|
|
|
|
|
ldns_rdf *rr_name; |
712
|
|
|
|
|
|
|
ldns_rr_type rr_type; |
713
|
|
|
|
|
|
|
ldns_rr_class rr_class; |
714
|
|
|
|
|
|
|
ldns_pkt *pkt; |
715
|
|
|
|
|
|
|
|
716
|
4
|
|
|
|
|
|
rr_type = ldns_get_rr_type_by_name(type); |
717
|
4
|
50
|
|
|
|
|
if(!rr_type) |
718
|
|
|
|
|
|
|
{ |
719
|
0
|
|
|
|
|
|
croak("Unknown RR type: %s", type); |
720
|
|
|
|
|
|
|
} |
721
|
|
|
|
|
|
|
|
722
|
4
|
|
|
|
|
|
rr_class = ldns_get_rr_class_by_name(class); |
723
|
4
|
50
|
|
|
|
|
if(!rr_class) |
724
|
|
|
|
|
|
|
{ |
725
|
0
|
|
|
|
|
|
croak("Unknown RR class: %s", class); |
726
|
|
|
|
|
|
|
} |
727
|
|
|
|
|
|
|
|
728
|
4
|
|
|
|
|
|
rr_name = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, name); |
729
|
4
|
50
|
|
|
|
|
if(rr_name == NULL) |
730
|
|
|
|
|
|
|
{ |
731
|
0
|
|
|
|
|
|
croak("Name error for '%s'", name); |
732
|
|
|
|
|
|
|
} |
733
|
|
|
|
|
|
|
|
734
|
4
|
|
|
|
|
|
pkt = ldns_pkt_query_new(rr_name, rr_type, rr_class,0); |
735
|
4
|
|
|
|
|
|
RETVAL = newSV(0); |
736
|
4
|
|
|
|
|
|
sv_setref_pv(RETVAL, objclass, pkt); |
737
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
738
|
|
|
|
|
|
|
net_ldns_remember_packet(RETVAL); |
739
|
|
|
|
|
|
|
#endif |
740
|
|
|
|
|
|
|
} |
741
|
|
|
|
|
|
|
OUTPUT: |
742
|
|
|
|
|
|
|
RETVAL |
743
|
|
|
|
|
|
|
|
744
|
|
|
|
|
|
|
char * |
745
|
|
|
|
|
|
|
packet_rcode(obj,...) |
746
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
747
|
|
|
|
|
|
|
CODE: |
748
|
16
|
100
|
|
|
|
|
if ( items > 1 ) { |
749
|
12
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
750
|
12
|
50
|
|
|
|
|
if ( strnEQ("NOERROR", SvPV_nolen(ST(1)), 7) ) { |
|
|
100
|
|
|
|
|
|
751
|
1
|
|
|
|
|
|
ldns_pkt_set_rcode(obj, LDNS_RCODE_NOERROR); |
752
|
|
|
|
|
|
|
} |
753
|
11
|
50
|
|
|
|
|
else if ( strnEQ("FORMERR", SvPV_nolen(ST(1)), 7) ) { |
|
|
100
|
|
|
|
|
|
754
|
1
|
|
|
|
|
|
ldns_pkt_set_rcode(obj, LDNS_RCODE_FORMERR); |
755
|
|
|
|
|
|
|
} |
756
|
10
|
50
|
|
|
|
|
else if ( strnEQ("SERVFAIL", SvPV_nolen(ST(1)), 8) ) { |
|
|
100
|
|
|
|
|
|
757
|
1
|
|
|
|
|
|
ldns_pkt_set_rcode(obj, LDNS_RCODE_SERVFAIL); |
758
|
|
|
|
|
|
|
} |
759
|
9
|
50
|
|
|
|
|
else if ( strnEQ("NXDOMAIN", SvPV_nolen(ST(1)), 8) ) { |
|
|
100
|
|
|
|
|
|
760
|
1
|
|
|
|
|
|
ldns_pkt_set_rcode(obj, LDNS_RCODE_NXDOMAIN); |
761
|
|
|
|
|
|
|
} |
762
|
8
|
50
|
|
|
|
|
else if ( strnEQ("NOTIMPL", SvPV_nolen(ST(1)), 7) ) { |
|
|
100
|
|
|
|
|
|
763
|
1
|
|
|
|
|
|
ldns_pkt_set_rcode(obj, LDNS_RCODE_NOTIMPL); |
764
|
|
|
|
|
|
|
} |
765
|
7
|
50
|
|
|
|
|
else if ( strnEQ("REFUSED", SvPV_nolen(ST(1)), 7) ) { |
|
|
100
|
|
|
|
|
|
766
|
1
|
|
|
|
|
|
ldns_pkt_set_rcode(obj, LDNS_RCODE_REFUSED); |
767
|
|
|
|
|
|
|
} |
768
|
6
|
50
|
|
|
|
|
else if ( strnEQ("YXDOMAIN", SvPV_nolen(ST(1)), 8) ) { |
|
|
100
|
|
|
|
|
|
769
|
1
|
|
|
|
|
|
ldns_pkt_set_rcode(obj, LDNS_RCODE_YXDOMAIN); |
770
|
|
|
|
|
|
|
} |
771
|
5
|
50
|
|
|
|
|
else if ( strnEQ("YXRRSET", SvPV_nolen(ST(1)), 7) ) { |
|
|
100
|
|
|
|
|
|
772
|
1
|
|
|
|
|
|
ldns_pkt_set_rcode(obj, LDNS_RCODE_YXRRSET); |
773
|
|
|
|
|
|
|
} |
774
|
4
|
50
|
|
|
|
|
else if ( strnEQ("NXRRSET", SvPV_nolen(ST(1)), 7) ) { |
|
|
100
|
|
|
|
|
|
775
|
1
|
|
|
|
|
|
ldns_pkt_set_rcode(obj, LDNS_RCODE_NXRRSET); |
776
|
|
|
|
|
|
|
} |
777
|
3
|
50
|
|
|
|
|
else if ( strnEQ("NOTAUTH", SvPV_nolen(ST(1)), 7) ) { |
|
|
100
|
|
|
|
|
|
778
|
1
|
|
|
|
|
|
ldns_pkt_set_rcode(obj, LDNS_RCODE_NOTAUTH); |
779
|
|
|
|
|
|
|
} |
780
|
2
|
50
|
|
|
|
|
else if ( strnEQ("NOTZONE", SvPV_nolen(ST(1)), 7) ) { |
|
|
100
|
|
|
|
|
|
781
|
1
|
|
|
|
|
|
ldns_pkt_set_rcode(obj, LDNS_RCODE_NOTZONE); |
782
|
|
|
|
|
|
|
} |
783
|
|
|
|
|
|
|
else { |
784
|
1
|
50
|
|
|
|
|
croak("Unknown RCODE: %s", SvPV_nolen(ST(1))); |
785
|
|
|
|
|
|
|
} |
786
|
|
|
|
|
|
|
} |
787
|
15
|
|
|
|
|
|
RETVAL = ldns_pkt_rcode2str(ldns_pkt_get_rcode(obj)); |
788
|
|
|
|
|
|
|
OUTPUT: |
789
|
|
|
|
|
|
|
RETVAL |
790
|
|
|
|
|
|
|
CLEANUP: |
791
|
15
|
|
|
|
|
|
free(RETVAL); |
792
|
|
|
|
|
|
|
|
793
|
|
|
|
|
|
|
char * |
794
|
|
|
|
|
|
|
packet_opcode(obj,...) |
795
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
796
|
|
|
|
|
|
|
CODE: |
797
|
9
|
100
|
|
|
|
|
if ( items > 1 ) { |
798
|
6
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
799
|
6
|
50
|
|
|
|
|
if ( strnEQ("QUERY", SvPV_nolen(ST(1)), 5) ) { |
|
|
100
|
|
|
|
|
|
800
|
1
|
|
|
|
|
|
ldns_pkt_set_opcode(obj, LDNS_PACKET_QUERY); |
801
|
|
|
|
|
|
|
} |
802
|
5
|
50
|
|
|
|
|
else if ( strnEQ("IQUERY", SvPV_nolen(ST(1)), 6) ) { |
|
|
100
|
|
|
|
|
|
803
|
1
|
|
|
|
|
|
ldns_pkt_set_opcode(obj, LDNS_PACKET_IQUERY); |
804
|
|
|
|
|
|
|
} |
805
|
4
|
50
|
|
|
|
|
else if ( strnEQ("STATUS", SvPV_nolen(ST(1)), 6) ) { |
|
|
100
|
|
|
|
|
|
806
|
1
|
|
|
|
|
|
ldns_pkt_set_opcode(obj, LDNS_PACKET_STATUS); |
807
|
|
|
|
|
|
|
} |
808
|
3
|
50
|
|
|
|
|
else if ( strnEQ("NOTIFY", SvPV_nolen(ST(1)), 6) ) { |
|
|
100
|
|
|
|
|
|
809
|
1
|
|
|
|
|
|
ldns_pkt_set_opcode(obj, LDNS_PACKET_NOTIFY); |
810
|
|
|
|
|
|
|
} |
811
|
2
|
50
|
|
|
|
|
else if ( strnEQ("UPDATE", SvPV_nolen(ST(1)), 6) ) { |
|
|
100
|
|
|
|
|
|
812
|
1
|
|
|
|
|
|
ldns_pkt_set_opcode(obj, LDNS_PACKET_UPDATE); |
813
|
|
|
|
|
|
|
} |
814
|
|
|
|
|
|
|
else { |
815
|
1
|
50
|
|
|
|
|
croak("Unknown OPCODE: %s", SvPV_nolen(ST(1))); |
816
|
|
|
|
|
|
|
} |
817
|
|
|
|
|
|
|
} |
818
|
8
|
|
|
|
|
|
RETVAL = ldns_pkt_opcode2str(ldns_pkt_get_opcode(obj)); |
819
|
|
|
|
|
|
|
OUTPUT: |
820
|
|
|
|
|
|
|
RETVAL |
821
|
|
|
|
|
|
|
CLEANUP: |
822
|
8
|
|
|
|
|
|
free(RETVAL); |
823
|
|
|
|
|
|
|
|
824
|
|
|
|
|
|
|
U16 |
825
|
|
|
|
|
|
|
packet_id(obj,...) |
826
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
827
|
|
|
|
|
|
|
CODE: |
828
|
3
|
100
|
|
|
|
|
if ( items > 1 ) { |
829
|
2
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
830
|
2
|
50
|
|
|
|
|
ldns_pkt_set_id(obj, (U16)SvIV(ST(1))); |
831
|
|
|
|
|
|
|
} |
832
|
3
|
|
|
|
|
|
RETVAL = ldns_pkt_id(obj); |
833
|
|
|
|
|
|
|
OUTPUT: |
834
|
|
|
|
|
|
|
RETVAL |
835
|
|
|
|
|
|
|
|
836
|
|
|
|
|
|
|
bool |
837
|
|
|
|
|
|
|
packet_qr(obj,...) |
838
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
839
|
|
|
|
|
|
|
CODE: |
840
|
4
|
100
|
|
|
|
|
if ( items > 1 ) { |
841
|
1
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
842
|
1
|
50
|
|
|
|
|
ldns_pkt_set_qr(obj, SvIV(ST(1))); |
843
|
|
|
|
|
|
|
} |
844
|
4
|
|
|
|
|
|
RETVAL = ldns_pkt_qr(obj); |
845
|
|
|
|
|
|
|
OUTPUT: |
846
|
|
|
|
|
|
|
RETVAL |
847
|
|
|
|
|
|
|
|
848
|
|
|
|
|
|
|
bool |
849
|
|
|
|
|
|
|
packet_aa(obj,...) |
850
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
851
|
|
|
|
|
|
|
CODE: |
852
|
4
|
100
|
|
|
|
|
if ( items > 1 ) { |
853
|
1
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
854
|
1
|
50
|
|
|
|
|
ldns_pkt_set_aa(obj, SvIV(ST(1))); |
855
|
|
|
|
|
|
|
} |
856
|
4
|
|
|
|
|
|
RETVAL = ldns_pkt_aa(obj); |
857
|
|
|
|
|
|
|
OUTPUT: |
858
|
|
|
|
|
|
|
RETVAL |
859
|
|
|
|
|
|
|
|
860
|
|
|
|
|
|
|
bool |
861
|
|
|
|
|
|
|
packet_tc(obj,...) |
862
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
863
|
|
|
|
|
|
|
CODE: |
864
|
4
|
100
|
|
|
|
|
if ( items > 1 ) { |
865
|
1
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
866
|
1
|
50
|
|
|
|
|
ldns_pkt_set_tc(obj, SvIV(ST(1))); |
867
|
|
|
|
|
|
|
} |
868
|
4
|
|
|
|
|
|
RETVAL = ldns_pkt_tc(obj); |
869
|
|
|
|
|
|
|
OUTPUT: |
870
|
|
|
|
|
|
|
RETVAL |
871
|
|
|
|
|
|
|
|
872
|
|
|
|
|
|
|
bool |
873
|
|
|
|
|
|
|
packet_rd(obj,...) |
874
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
875
|
|
|
|
|
|
|
CODE: |
876
|
5
|
100
|
|
|
|
|
if ( items > 1 ) { |
877
|
1
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
878
|
1
|
50
|
|
|
|
|
ldns_pkt_set_rd(obj, SvIV(ST(1))); |
879
|
|
|
|
|
|
|
} |
880
|
5
|
|
|
|
|
|
RETVAL = ldns_pkt_rd(obj); |
881
|
|
|
|
|
|
|
OUTPUT: |
882
|
|
|
|
|
|
|
RETVAL |
883
|
|
|
|
|
|
|
|
884
|
|
|
|
|
|
|
bool |
885
|
|
|
|
|
|
|
packet_cd(obj,...) |
886
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
887
|
|
|
|
|
|
|
CODE: |
888
|
4
|
100
|
|
|
|
|
if ( items > 1 ) { |
889
|
1
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
890
|
1
|
50
|
|
|
|
|
ldns_pkt_set_cd(obj, SvIV(ST(1))); |
891
|
|
|
|
|
|
|
} |
892
|
4
|
|
|
|
|
|
RETVAL = ldns_pkt_cd(obj); |
893
|
|
|
|
|
|
|
OUTPUT: |
894
|
|
|
|
|
|
|
RETVAL |
895
|
|
|
|
|
|
|
|
896
|
|
|
|
|
|
|
bool |
897
|
|
|
|
|
|
|
packet_ra(obj,...) |
898
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
899
|
|
|
|
|
|
|
CODE: |
900
|
4
|
100
|
|
|
|
|
if ( items > 1 ) { |
901
|
1
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
902
|
1
|
50
|
|
|
|
|
ldns_pkt_set_ra(obj, SvIV(ST(1))); |
903
|
|
|
|
|
|
|
} |
904
|
4
|
|
|
|
|
|
RETVAL = ldns_pkt_ra(obj); |
905
|
|
|
|
|
|
|
OUTPUT: |
906
|
|
|
|
|
|
|
RETVAL |
907
|
|
|
|
|
|
|
|
908
|
|
|
|
|
|
|
bool |
909
|
|
|
|
|
|
|
packet_ad(obj,...) |
910
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
911
|
|
|
|
|
|
|
CODE: |
912
|
4
|
100
|
|
|
|
|
if ( items > 1 ) { |
913
|
1
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
914
|
1
|
50
|
|
|
|
|
ldns_pkt_set_ad(obj, SvIV(ST(1))); |
915
|
|
|
|
|
|
|
} |
916
|
4
|
|
|
|
|
|
RETVAL = ldns_pkt_ad(obj); |
917
|
|
|
|
|
|
|
OUTPUT: |
918
|
|
|
|
|
|
|
RETVAL |
919
|
|
|
|
|
|
|
|
920
|
|
|
|
|
|
|
bool |
921
|
|
|
|
|
|
|
packet_do(obj,...) |
922
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
923
|
|
|
|
|
|
|
CODE: |
924
|
4
|
100
|
|
|
|
|
if ( items > 1 ) { |
925
|
1
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
926
|
1
|
50
|
|
|
|
|
ldns_pkt_set_edns_do(obj, SvIV(ST(1))); |
927
|
|
|
|
|
|
|
} |
928
|
4
|
|
|
|
|
|
RETVAL = ldns_pkt_edns_do(obj); |
929
|
|
|
|
|
|
|
OUTPUT: |
930
|
|
|
|
|
|
|
RETVAL |
931
|
|
|
|
|
|
|
|
932
|
|
|
|
|
|
|
size_t |
933
|
|
|
|
|
|
|
packet_size(obj) |
934
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
935
|
|
|
|
|
|
|
CODE: |
936
|
0
|
|
|
|
|
|
RETVAL = ldns_pkt_size(obj); |
937
|
|
|
|
|
|
|
OUTPUT: |
938
|
|
|
|
|
|
|
RETVAL |
939
|
|
|
|
|
|
|
|
940
|
|
|
|
|
|
|
U32 |
941
|
|
|
|
|
|
|
packet_querytime(obj,...) |
942
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
943
|
|
|
|
|
|
|
CODE: |
944
|
5
|
100
|
|
|
|
|
if ( items > 1 ) { |
945
|
2
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
946
|
2
|
50
|
|
|
|
|
ldns_pkt_set_querytime(obj, (U32)SvIV(ST(1))); |
947
|
|
|
|
|
|
|
} |
948
|
5
|
|
|
|
|
|
RETVAL = ldns_pkt_querytime(obj); |
949
|
|
|
|
|
|
|
OUTPUT: |
950
|
|
|
|
|
|
|
RETVAL |
951
|
|
|
|
|
|
|
|
952
|
|
|
|
|
|
|
char * |
953
|
|
|
|
|
|
|
packet_answerfrom(obj,...) |
954
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
955
|
|
|
|
|
|
|
CODE: |
956
|
9
|
100
|
|
|
|
|
if(items >= 2) |
957
|
|
|
|
|
|
|
{ |
958
|
|
|
|
|
|
|
ldns_rdf *address; |
959
|
|
|
|
|
|
|
|
960
|
3
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
961
|
3
|
50
|
|
|
|
|
address = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, SvPV_nolen(ST(1))); |
962
|
3
|
50
|
|
|
|
|
if(address == NULL) |
963
|
|
|
|
|
|
|
{ |
964
|
0
|
0
|
|
|
|
|
address = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, SvPV_nolen(ST(1))); |
965
|
|
|
|
|
|
|
} |
966
|
3
|
50
|
|
|
|
|
if(address == NULL) |
967
|
|
|
|
|
|
|
{ |
968
|
0
|
0
|
|
|
|
|
croak("Failed to parse IP address: %s", SvPV_nolen(ST(1))); |
969
|
|
|
|
|
|
|
} |
970
|
|
|
|
|
|
|
|
971
|
3
|
|
|
|
|
|
ldns_pkt_set_answerfrom(obj, address); |
972
|
|
|
|
|
|
|
} |
973
|
9
|
|
|
|
|
|
RETVAL = ldns_rdf2str(ldns_pkt_answerfrom(obj)); |
974
|
|
|
|
|
|
|
OUTPUT: |
975
|
|
|
|
|
|
|
RETVAL |
976
|
|
|
|
|
|
|
CLEANUP: |
977
|
9
|
|
|
|
|
|
free(RETVAL); |
978
|
|
|
|
|
|
|
|
979
|
|
|
|
|
|
|
double |
980
|
|
|
|
|
|
|
packet_timestamp(obj,...) |
981
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
982
|
|
|
|
|
|
|
CODE: |
983
|
8
|
100
|
|
|
|
|
if(items >= 2) |
984
|
|
|
|
|
|
|
{ |
985
|
|
|
|
|
|
|
struct timeval tn; |
986
|
|
|
|
|
|
|
double dec_part, int_part; |
987
|
|
|
|
|
|
|
|
988
|
3
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
989
|
3
|
100
|
|
|
|
|
dec_part = modf(SvNV(ST(1)), &int_part); |
990
|
3
|
|
|
|
|
|
tn.tv_sec = int_part; |
991
|
3
|
|
|
|
|
|
tn.tv_usec = 1000000*dec_part; |
992
|
3
|
|
|
|
|
|
ldns_pkt_set_timestamp(obj,tn); |
993
|
|
|
|
|
|
|
} |
994
|
8
|
|
|
|
|
|
struct timeval t = ldns_pkt_timestamp(obj); |
995
|
8
|
|
|
|
|
|
RETVAL = (double)t.tv_sec; |
996
|
8
|
|
|
|
|
|
RETVAL += ((double)t.tv_usec)/1000000; |
997
|
|
|
|
|
|
|
OUTPUT: |
998
|
|
|
|
|
|
|
RETVAL |
999
|
|
|
|
|
|
|
|
1000
|
|
|
|
|
|
|
SV * |
1001
|
|
|
|
|
|
|
packet_answer(obj) |
1002
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
1003
|
|
|
|
|
|
|
PPCODE: |
1004
|
|
|
|
|
|
|
{ |
1005
|
|
|
|
|
|
|
size_t i,n; |
1006
|
|
|
|
|
|
|
ldns_rr_list *rrs; |
1007
|
18
|
50
|
|
|
|
|
I32 context = GIMME_V; |
1008
|
|
|
|
|
|
|
|
1009
|
18
|
50
|
|
|
|
|
if (context == G_VOID) |
1010
|
|
|
|
|
|
|
{ |
1011
|
0
|
|
|
|
|
|
return; |
1012
|
|
|
|
|
|
|
} |
1013
|
|
|
|
|
|
|
|
1014
|
18
|
|
|
|
|
|
rrs = ldns_pkt_answer(obj); |
1015
|
18
|
|
|
|
|
|
n = ldns_rr_list_rr_count(rrs); |
1016
|
|
|
|
|
|
|
|
1017
|
18
|
100
|
|
|
|
|
if (context == G_SCALAR) |
1018
|
|
|
|
|
|
|
{ |
1019
|
6
|
|
|
|
|
|
XSRETURN_IV(n); |
1020
|
|
|
|
|
|
|
} |
1021
|
|
|
|
|
|
|
|
1022
|
32
|
100
|
|
|
|
|
for(i = 0; i < n; ++i) |
1023
|
|
|
|
|
|
|
{ |
1024
|
20
|
50
|
|
|
|
|
mXPUSHs(rr2sv(ldns_rr_clone(ldns_rr_list_rr(rrs,i)))); |
1025
|
|
|
|
|
|
|
} |
1026
|
|
|
|
|
|
|
} |
1027
|
|
|
|
|
|
|
|
1028
|
|
|
|
|
|
|
SV * |
1029
|
|
|
|
|
|
|
packet_authority(obj) |
1030
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
1031
|
|
|
|
|
|
|
PPCODE: |
1032
|
|
|
|
|
|
|
{ |
1033
|
|
|
|
|
|
|
size_t i,n; |
1034
|
|
|
|
|
|
|
ldns_rr_list *rrs; |
1035
|
1
|
50
|
|
|
|
|
I32 context = GIMME_V; |
1036
|
|
|
|
|
|
|
|
1037
|
1
|
50
|
|
|
|
|
if (context == G_VOID) |
1038
|
|
|
|
|
|
|
{ |
1039
|
0
|
|
|
|
|
|
return; |
1040
|
|
|
|
|
|
|
} |
1041
|
|
|
|
|
|
|
|
1042
|
1
|
|
|
|
|
|
rrs = ldns_pkt_authority(obj); |
1043
|
1
|
|
|
|
|
|
n = ldns_rr_list_rr_count(rrs); |
1044
|
|
|
|
|
|
|
|
1045
|
1
|
50
|
|
|
|
|
if (context == G_SCALAR) |
1046
|
|
|
|
|
|
|
{ |
1047
|
1
|
|
|
|
|
|
XSRETURN_IV(n); |
1048
|
|
|
|
|
|
|
} |
1049
|
|
|
|
|
|
|
|
1050
|
0
|
0
|
|
|
|
|
for(i = 0; i < n; ++i) |
1051
|
|
|
|
|
|
|
{ |
1052
|
0
|
0
|
|
|
|
|
mXPUSHs(rr2sv(ldns_rr_clone(ldns_rr_list_rr(rrs,i)))); |
1053
|
|
|
|
|
|
|
} |
1054
|
|
|
|
|
|
|
} |
1055
|
|
|
|
|
|
|
|
1056
|
|
|
|
|
|
|
SV * |
1057
|
|
|
|
|
|
|
packet_additional(obj) |
1058
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
1059
|
|
|
|
|
|
|
PPCODE: |
1060
|
|
|
|
|
|
|
{ |
1061
|
|
|
|
|
|
|
size_t i,n; |
1062
|
|
|
|
|
|
|
ldns_rr_list *rrs; |
1063
|
1
|
50
|
|
|
|
|
I32 context = GIMME_V; |
1064
|
|
|
|
|
|
|
|
1065
|
1
|
50
|
|
|
|
|
if (context == G_VOID) |
1066
|
|
|
|
|
|
|
{ |
1067
|
0
|
|
|
|
|
|
return; |
1068
|
|
|
|
|
|
|
} |
1069
|
|
|
|
|
|
|
|
1070
|
1
|
|
|
|
|
|
rrs = ldns_pkt_additional(obj); |
1071
|
1
|
|
|
|
|
|
n = ldns_rr_list_rr_count(rrs); |
1072
|
|
|
|
|
|
|
|
1073
|
1
|
50
|
|
|
|
|
if (context == G_SCALAR) |
1074
|
|
|
|
|
|
|
{ |
1075
|
1
|
|
|
|
|
|
XSRETURN_IV(n); |
1076
|
|
|
|
|
|
|
} |
1077
|
|
|
|
|
|
|
|
1078
|
0
|
0
|
|
|
|
|
for(i = 0; i < n; ++i) |
1079
|
|
|
|
|
|
|
{ |
1080
|
0
|
0
|
|
|
|
|
mXPUSHs(rr2sv(ldns_rr_clone(ldns_rr_list_rr(rrs,i)))); |
1081
|
|
|
|
|
|
|
} |
1082
|
|
|
|
|
|
|
} |
1083
|
|
|
|
|
|
|
|
1084
|
|
|
|
|
|
|
SV * |
1085
|
|
|
|
|
|
|
packet_question(obj) |
1086
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
1087
|
|
|
|
|
|
|
PPCODE: |
1088
|
|
|
|
|
|
|
{ |
1089
|
|
|
|
|
|
|
size_t i,n; |
1090
|
|
|
|
|
|
|
ldns_rr_list *rrs; |
1091
|
1
|
50
|
|
|
|
|
I32 context = GIMME_V; |
1092
|
|
|
|
|
|
|
|
1093
|
1
|
50
|
|
|
|
|
if (context == G_VOID) |
1094
|
|
|
|
|
|
|
{ |
1095
|
0
|
|
|
|
|
|
return; |
1096
|
|
|
|
|
|
|
} |
1097
|
|
|
|
|
|
|
|
1098
|
1
|
|
|
|
|
|
rrs = ldns_pkt_question(obj); |
1099
|
1
|
|
|
|
|
|
n = ldns_rr_list_rr_count(rrs); |
1100
|
|
|
|
|
|
|
|
1101
|
1
|
50
|
|
|
|
|
if (context == G_SCALAR) |
1102
|
|
|
|
|
|
|
{ |
1103
|
1
|
|
|
|
|
|
XSRETURN_IV(n); |
1104
|
|
|
|
|
|
|
} |
1105
|
|
|
|
|
|
|
|
1106
|
0
|
0
|
|
|
|
|
for(i = 0; i < n; ++i) |
1107
|
|
|
|
|
|
|
{ |
1108
|
0
|
0
|
|
|
|
|
mXPUSHs(rr2sv(ldns_rr_clone(ldns_rr_list_rr(rrs,i)))); |
1109
|
|
|
|
|
|
|
} |
1110
|
|
|
|
|
|
|
} |
1111
|
|
|
|
|
|
|
|
1112
|
|
|
|
|
|
|
bool |
1113
|
|
|
|
|
|
|
packet_unique_push(obj,section,rr) |
1114
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
1115
|
|
|
|
|
|
|
char *section; |
1116
|
|
|
|
|
|
|
Zonemaster::LDNS::RR rr; |
1117
|
|
|
|
|
|
|
CODE: |
1118
|
|
|
|
|
|
|
{ |
1119
|
|
|
|
|
|
|
ldns_pkt_section sec; |
1120
|
|
|
|
|
|
|
char lbuf[21]; |
1121
|
|
|
|
|
|
|
char *p; |
1122
|
|
|
|
|
|
|
|
1123
|
3
|
|
|
|
|
|
p = lbuf; |
1124
|
3
|
|
|
|
|
|
strncpy(lbuf, section, 20); |
1125
|
21
|
100
|
|
|
|
|
for(; *p; p++) *p = tolower(*p); |
1126
|
|
|
|
|
|
|
|
1127
|
3
|
50
|
|
|
|
|
if(strncmp(lbuf, "answer", 6)==0) |
1128
|
|
|
|
|
|
|
{ |
1129
|
3
|
|
|
|
|
|
sec = LDNS_SECTION_ANSWER; |
1130
|
|
|
|
|
|
|
} |
1131
|
0
|
0
|
|
|
|
|
else if(strncmp(lbuf, "additional", 10)==0) |
1132
|
|
|
|
|
|
|
{ |
1133
|
0
|
|
|
|
|
|
sec = LDNS_SECTION_ADDITIONAL; |
1134
|
|
|
|
|
|
|
} |
1135
|
0
|
0
|
|
|
|
|
else if(strncmp(lbuf, "authority", 9)==0) |
1136
|
|
|
|
|
|
|
{ |
1137
|
0
|
|
|
|
|
|
sec = LDNS_SECTION_AUTHORITY; |
1138
|
|
|
|
|
|
|
} |
1139
|
0
|
0
|
|
|
|
|
else if(strncmp(lbuf, "question", 8)==0) |
1140
|
|
|
|
|
|
|
{ |
1141
|
0
|
|
|
|
|
|
sec = LDNS_SECTION_QUESTION; |
1142
|
|
|
|
|
|
|
} |
1143
|
|
|
|
|
|
|
else |
1144
|
|
|
|
|
|
|
{ |
1145
|
0
|
|
|
|
|
|
croak("Unknown section: %s", section); |
1146
|
|
|
|
|
|
|
} |
1147
|
|
|
|
|
|
|
|
1148
|
3
|
|
|
|
|
|
RETVAL = ldns_pkt_safe_push_rr(obj, sec, ldns_rr_clone(rr)); |
1149
|
|
|
|
|
|
|
} |
1150
|
|
|
|
|
|
|
OUTPUT: |
1151
|
|
|
|
|
|
|
RETVAL |
1152
|
|
|
|
|
|
|
|
1153
|
|
|
|
|
|
|
SV * |
1154
|
|
|
|
|
|
|
packet_all(obj) |
1155
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
1156
|
|
|
|
|
|
|
CODE: |
1157
|
2
|
|
|
|
|
|
ldns_rr_list *list = ldns_pkt_all_noquestion(obj); |
1158
|
2
|
|
|
|
|
|
RETVAL = sv_setref_pv(newSV(0), "Zonemaster::LDNS::RRList", list); |
1159
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
1160
|
|
|
|
|
|
|
net_ldns_remember_rrlist(RETVAL); |
1161
|
|
|
|
|
|
|
#endif |
1162
|
|
|
|
|
|
|
OUTPUT: |
1163
|
|
|
|
|
|
|
RETVAL |
1164
|
|
|
|
|
|
|
|
1165
|
|
|
|
|
|
|
char * |
1166
|
|
|
|
|
|
|
packet_string(obj) |
1167
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
1168
|
|
|
|
|
|
|
CODE: |
1169
|
0
|
|
|
|
|
|
RETVAL = ldns_pkt2str(obj); |
1170
|
0
|
|
|
|
|
|
RETVAL[strlen(RETVAL)-1] = '\0'; |
1171
|
|
|
|
|
|
|
OUTPUT: |
1172
|
|
|
|
|
|
|
RETVAL |
1173
|
|
|
|
|
|
|
CLEANUP: |
1174
|
0
|
|
|
|
|
|
free(RETVAL); |
1175
|
|
|
|
|
|
|
|
1176
|
|
|
|
|
|
|
SV * |
1177
|
|
|
|
|
|
|
packet_wireformat(obj) |
1178
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
1179
|
|
|
|
|
|
|
CODE: |
1180
|
|
|
|
|
|
|
{ |
1181
|
|
|
|
|
|
|
size_t sz; |
1182
|
|
|
|
|
|
|
uint8_t *buf; |
1183
|
|
|
|
|
|
|
ldns_status status; |
1184
|
|
|
|
|
|
|
|
1185
|
3
|
|
|
|
|
|
status = ldns_pkt2wire(&buf, obj, &sz); |
1186
|
3
|
50
|
|
|
|
|
if(status != LDNS_STATUS_OK) |
1187
|
|
|
|
|
|
|
{ |
1188
|
0
|
|
|
|
|
|
croak("Failed to produce wire format: %s", ldns_get_errorstr_by_id(status)); |
1189
|
|
|
|
|
|
|
} |
1190
|
|
|
|
|
|
|
else |
1191
|
|
|
|
|
|
|
{ |
1192
|
3
|
|
|
|
|
|
RETVAL = newSVpvn((const char *)buf,sz); |
1193
|
3
|
|
|
|
|
|
free(buf); |
1194
|
|
|
|
|
|
|
} |
1195
|
|
|
|
|
|
|
} |
1196
|
|
|
|
|
|
|
OUTPUT: |
1197
|
|
|
|
|
|
|
RETVAL |
1198
|
|
|
|
|
|
|
|
1199
|
|
|
|
|
|
|
SV * |
1200
|
|
|
|
|
|
|
packet_new_from_wireformat(class,buf) |
1201
|
|
|
|
|
|
|
char *class; |
1202
|
|
|
|
|
|
|
SV *buf; |
1203
|
|
|
|
|
|
|
CODE: |
1204
|
|
|
|
|
|
|
{ |
1205
|
|
|
|
|
|
|
Zonemaster__LDNS__Packet pkt; |
1206
|
|
|
|
|
|
|
ldns_status status; |
1207
|
|
|
|
|
|
|
|
1208
|
1
|
50
|
|
|
|
|
SvGETMAGIC(buf); |
|
|
0
|
|
|
|
|
|
1209
|
1
|
50
|
|
|
|
|
status = ldns_wire2pkt(&pkt, (const uint8_t *)SvPV_nolen(buf), SvCUR(buf)); |
1210
|
1
|
50
|
|
|
|
|
if(status != LDNS_STATUS_OK) |
1211
|
|
|
|
|
|
|
{ |
1212
|
0
|
|
|
|
|
|
croak("Failed to parse wire format: %s", ldns_get_errorstr_by_id(status)); |
1213
|
|
|
|
|
|
|
} |
1214
|
|
|
|
|
|
|
else |
1215
|
|
|
|
|
|
|
{ |
1216
|
1
|
|
|
|
|
|
RETVAL = newSV(0); |
1217
|
1
|
|
|
|
|
|
sv_setref_pv(RETVAL, class, pkt); |
1218
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
1219
|
|
|
|
|
|
|
net_ldns_remember_packet(RETVAL); |
1220
|
|
|
|
|
|
|
#endif |
1221
|
|
|
|
|
|
|
} |
1222
|
|
|
|
|
|
|
} |
1223
|
|
|
|
|
|
|
OUTPUT: |
1224
|
|
|
|
|
|
|
RETVAL |
1225
|
|
|
|
|
|
|
|
1226
|
|
|
|
|
|
|
U16 |
1227
|
|
|
|
|
|
|
packet_edns_size(obj,...) |
1228
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
1229
|
|
|
|
|
|
|
CODE: |
1230
|
4
|
100
|
|
|
|
|
if(items>=2) |
1231
|
|
|
|
|
|
|
{ |
1232
|
2
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
1233
|
2
|
100
|
|
|
|
|
ldns_pkt_set_edns_udp_size(obj, (U16)SvIV(ST(1))); |
1234
|
|
|
|
|
|
|
} |
1235
|
4
|
|
|
|
|
|
RETVAL = ldns_pkt_edns_udp_size(obj); |
1236
|
|
|
|
|
|
|
OUTPUT: |
1237
|
|
|
|
|
|
|
RETVAL |
1238
|
|
|
|
|
|
|
|
1239
|
|
|
|
|
|
|
U8 |
1240
|
|
|
|
|
|
|
packet_edns_rcode(obj,...) |
1241
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
1242
|
|
|
|
|
|
|
CODE: |
1243
|
3
|
100
|
|
|
|
|
if(items>=2) |
1244
|
|
|
|
|
|
|
{ |
1245
|
1
|
50
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
1246
|
1
|
50
|
|
|
|
|
ldns_pkt_set_edns_extended_rcode(obj, (U8)SvIV(ST(1))); |
1247
|
|
|
|
|
|
|
} |
1248
|
3
|
|
|
|
|
|
RETVAL = ldns_pkt_edns_extended_rcode(obj); |
1249
|
|
|
|
|
|
|
OUTPUT: |
1250
|
|
|
|
|
|
|
RETVAL |
1251
|
|
|
|
|
|
|
|
1252
|
|
|
|
|
|
|
U8 |
1253
|
|
|
|
|
|
|
packet_edns_version(obj,...) |
1254
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
1255
|
|
|
|
|
|
|
CODE: |
1256
|
0
|
0
|
|
|
|
|
if(items>=2) |
1257
|
|
|
|
|
|
|
{ |
1258
|
0
|
0
|
|
|
|
|
SvGETMAGIC(ST(1)); |
|
|
0
|
|
|
|
|
|
1259
|
0
|
0
|
|
|
|
|
ldns_pkt_set_edns_version(obj, (U8)SvIV(ST(1))); |
1260
|
|
|
|
|
|
|
} |
1261
|
0
|
|
|
|
|
|
RETVAL = ldns_pkt_edns_version(obj); |
1262
|
|
|
|
|
|
|
OUTPUT: |
1263
|
|
|
|
|
|
|
RETVAL |
1264
|
|
|
|
|
|
|
|
1265
|
|
|
|
|
|
|
bool |
1266
|
|
|
|
|
|
|
packet_needs_edns(obj) |
1267
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
1268
|
|
|
|
|
|
|
ALIAS: |
1269
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet::has_edns = 1 |
1270
|
|
|
|
|
|
|
CODE: |
1271
|
0
|
|
|
|
|
|
RETVAL = ldns_pkt_edns(obj); |
1272
|
|
|
|
|
|
|
OUTPUT: |
1273
|
|
|
|
|
|
|
RETVAL |
1274
|
|
|
|
|
|
|
|
1275
|
|
|
|
|
|
|
SV * |
1276
|
|
|
|
|
|
|
packet_type(obj) |
1277
|
|
|
|
|
|
|
Zonemaster::LDNS::Packet obj; |
1278
|
|
|
|
|
|
|
CODE: |
1279
|
1
|
|
|
|
|
|
ldns_pkt_type type = ldns_pkt_reply_type(obj); |
1280
|
1
|
|
|
|
|
|
switch (type){ |
1281
|
|
|
|
|
|
|
case LDNS_PACKET_QUESTION: |
1282
|
0
|
|
|
|
|
|
RETVAL = newSVpvs_share("question"); |
1283
|
0
|
|
|
|
|
|
break; |
1284
|
|
|
|
|
|
|
|
1285
|
|
|
|
|
|
|
case LDNS_PACKET_REFERRAL: |
1286
|
0
|
|
|
|
|
|
RETVAL = newSVpvs_share("referral"); |
1287
|
0
|
|
|
|
|
|
break; |
1288
|
|
|
|
|
|
|
|
1289
|
|
|
|
|
|
|
case LDNS_PACKET_ANSWER: |
1290
|
1
|
|
|
|
|
|
RETVAL = newSVpvs_share("answer"); |
1291
|
1
|
|
|
|
|
|
break; |
1292
|
|
|
|
|
|
|
|
1293
|
|
|
|
|
|
|
case LDNS_PACKET_NXDOMAIN: |
1294
|
0
|
|
|
|
|
|
RETVAL = newSVpvs_share("nxdomain"); |
1295
|
0
|
|
|
|
|
|
break; |
1296
|
|
|
|
|
|
|
|
1297
|
|
|
|
|
|
|
case LDNS_PACKET_NODATA: |
1298
|
0
|
|
|
|
|
|
RETVAL = newSVpvs_share("nodata"); |
1299
|
0
|
|
|
|
|
|
break; |
1300
|
|
|
|
|
|
|
|
1301
|
|
|
|
|
|
|
case LDNS_PACKET_UNKNOWN: |
1302
|
0
|
|
|
|
|
|
RETVAL = newSVpvs_share("unknown"); |
1303
|
0
|
|
|
|
|
|
break; |
1304
|
|
|
|
|
|
|
|
1305
|
|
|
|
|
|
|
default: |
1306
|
0
|
|
|
|
|
|
croak("Packet type is not even unknown"); |
1307
|
|
|
|
|
|
|
} |
1308
|
|
|
|
|
|
|
OUTPUT: |
1309
|
|
|
|
|
|
|
RETVAL |
1310
|
|
|
|
|
|
|
|
1311
|
|
|
|
|
|
|
void |
1312
|
|
|
|
|
|
|
packet_DESTROY(sv) |
1313
|
|
|
|
|
|
|
SV *sv; |
1314
|
|
|
|
|
|
|
CODE: |
1315
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
1316
|
|
|
|
|
|
|
net_ldns_forget(); |
1317
|
|
|
|
|
|
|
#endif |
1318
|
22
|
50
|
|
|
|
|
SvGETMAGIC(sv); |
|
|
0
|
|
|
|
|
|
1319
|
22
|
50
|
|
|
|
|
ldns_pkt *obj = INT2PTR(ldns_pkt *, SvIV((SV *)SvRV(sv))); |
1320
|
22
|
|
|
|
|
|
ldns_pkt_free(obj); |
1321
|
|
|
|
|
|
|
|
1322
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
1323
|
|
|
|
|
|
|
|
1324
|
|
|
|
|
|
|
void |
1325
|
|
|
|
|
|
|
packet_CLONE(class) |
1326
|
|
|
|
|
|
|
char *class; |
1327
|
|
|
|
|
|
|
CODE: |
1328
|
|
|
|
|
|
|
net_ldns_clone_packets(); |
1329
|
|
|
|
|
|
|
|
1330
|
|
|
|
|
|
|
#endif |
1331
|
|
|
|
|
|
|
|
1332
|
|
|
|
|
|
|
MODULE = Zonemaster::LDNS PACKAGE = Zonemaster::LDNS::RRList PREFIX=rrlist_ |
1333
|
|
|
|
|
|
|
|
1334
|
|
|
|
|
|
|
size_t |
1335
|
|
|
|
|
|
|
rrlist_count(obj) |
1336
|
|
|
|
|
|
|
Zonemaster::LDNS::RRList obj; |
1337
|
|
|
|
|
|
|
CODE: |
1338
|
4
|
|
|
|
|
|
RETVAL = ldns_rr_list_rr_count(obj); |
1339
|
|
|
|
|
|
|
OUTPUT: |
1340
|
|
|
|
|
|
|
RETVAL |
1341
|
|
|
|
|
|
|
|
1342
|
|
|
|
|
|
|
SV * |
1343
|
|
|
|
|
|
|
rrlist_pop(obj) |
1344
|
|
|
|
|
|
|
Zonemaster::LDNS::RRList obj; |
1345
|
|
|
|
|
|
|
CODE: |
1346
|
6
|
|
|
|
|
|
ldns_rr *rr = ldns_rr_list_pop_rr(obj); |
1347
|
6
|
100
|
|
|
|
|
if(rr==NULL) |
1348
|
|
|
|
|
|
|
{ |
1349
|
2
|
|
|
|
|
|
RETVAL = &PL_sv_no; |
1350
|
|
|
|
|
|
|
} |
1351
|
|
|
|
|
|
|
else |
1352
|
|
|
|
|
|
|
{ |
1353
|
4
|
|
|
|
|
|
RETVAL = rr2sv(rr); |
1354
|
|
|
|
|
|
|
} |
1355
|
|
|
|
|
|
|
OUTPUT: |
1356
|
|
|
|
|
|
|
RETVAL |
1357
|
|
|
|
|
|
|
|
1358
|
|
|
|
|
|
|
bool |
1359
|
|
|
|
|
|
|
rrlist_push(obj,rr) |
1360
|
|
|
|
|
|
|
Zonemaster::LDNS::RRList obj; |
1361
|
|
|
|
|
|
|
Zonemaster::LDNS::RR rr; |
1362
|
|
|
|
|
|
|
CODE: |
1363
|
3
|
|
|
|
|
|
RETVAL = ldns_rr_list_push_rr(obj,ldns_rr_clone(rr)); |
1364
|
|
|
|
|
|
|
OUTPUT: |
1365
|
|
|
|
|
|
|
RETVAL |
1366
|
|
|
|
|
|
|
|
1367
|
|
|
|
|
|
|
bool |
1368
|
|
|
|
|
|
|
rrlist_is_rrset(obj) |
1369
|
|
|
|
|
|
|
Zonemaster::LDNS::RRList obj; |
1370
|
|
|
|
|
|
|
CODE: |
1371
|
3
|
|
|
|
|
|
RETVAL = ldns_is_rrset(obj); |
1372
|
|
|
|
|
|
|
OUTPUT: |
1373
|
|
|
|
|
|
|
RETVAL |
1374
|
|
|
|
|
|
|
|
1375
|
|
|
|
|
|
|
void |
1376
|
|
|
|
|
|
|
rrlist_DESTROY(obj) |
1377
|
|
|
|
|
|
|
Zonemaster::LDNS::RRList obj; |
1378
|
|
|
|
|
|
|
CODE: |
1379
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
1380
|
|
|
|
|
|
|
net_ldns_forget(); |
1381
|
|
|
|
|
|
|
#endif |
1382
|
2
|
|
|
|
|
|
ldns_rr_list_deep_free(obj); |
1383
|
|
|
|
|
|
|
|
1384
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
1385
|
|
|
|
|
|
|
|
1386
|
|
|
|
|
|
|
void |
1387
|
|
|
|
|
|
|
rrlist_CLONE(class) |
1388
|
|
|
|
|
|
|
char *class; |
1389
|
|
|
|
|
|
|
CODE: |
1390
|
|
|
|
|
|
|
net_ldns_clone_rrlists(); |
1391
|
|
|
|
|
|
|
|
1392
|
|
|
|
|
|
|
#endif |
1393
|
|
|
|
|
|
|
|
1394
|
|
|
|
|
|
|
MODULE = Zonemaster::LDNS PACKAGE = Zonemaster::LDNS::RR PREFIX=rr_ |
1395
|
|
|
|
|
|
|
|
1396
|
|
|
|
|
|
|
SV * |
1397
|
|
|
|
|
|
|
rr_new_from_string(class,str) |
1398
|
|
|
|
|
|
|
char *class; |
1399
|
|
|
|
|
|
|
char *str; |
1400
|
|
|
|
|
|
|
PPCODE: |
1401
|
|
|
|
|
|
|
ldns_status s; |
1402
|
|
|
|
|
|
|
ldns_rr *rr; |
1403
|
|
|
|
|
|
|
char rrclass[40]; |
1404
|
|
|
|
|
|
|
char *rrtype; |
1405
|
|
|
|
|
|
|
SV* rr_sv; |
1406
|
|
|
|
|
|
|
|
1407
|
21
|
|
|
|
|
|
s = ldns_rr_new_frm_str(&rr, str, 0, NULL, NULL); |
1408
|
21
|
50
|
|
|
|
|
if(s != LDNS_STATUS_OK) |
1409
|
|
|
|
|
|
|
{ |
1410
|
0
|
|
|
|
|
|
croak("Failed to build RR: %s", ldns_get_errorstr_by_id(s)); |
1411
|
|
|
|
|
|
|
} |
1412
|
21
|
|
|
|
|
|
rrtype = ldns_rr_type2str(ldns_rr_get_type(rr)); |
1413
|
21
|
|
|
|
|
|
snprintf(rrclass, 39, "Zonemaster::LDNS::RR::%s", rrtype); |
1414
|
21
|
|
|
|
|
|
free(rrtype); |
1415
|
21
|
|
|
|
|
|
rr_sv = sv_newmortal(); |
1416
|
21
|
|
|
|
|
|
sv_setref_pv(rr_sv, rrclass, rr); |
1417
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
1418
|
|
|
|
|
|
|
net_ldns_remember_rr(rr_sv); |
1419
|
|
|
|
|
|
|
#endif |
1420
|
21
|
|
|
|
|
|
PUSHs(rr_sv); |
1421
|
|
|
|
|
|
|
|
1422
|
|
|
|
|
|
|
char * |
1423
|
|
|
|
|
|
|
rr_owner(obj) |
1424
|
|
|
|
|
|
|
Zonemaster::LDNS::RR obj; |
1425
|
|
|
|
|
|
|
CODE: |
1426
|
5
|
|
|
|
|
|
RETVAL = randomize_capitalization(ldns_rdf2str(ldns_rr_owner(obj))); |
1427
|
|
|
|
|
|
|
OUTPUT: |
1428
|
|
|
|
|
|
|
RETVAL |
1429
|
|
|
|
|
|
|
CLEANUP: |
1430
|
5
|
|
|
|
|
|
free(RETVAL); |
1431
|
|
|
|
|
|
|
|
1432
|
|
|
|
|
|
|
U32 |
1433
|
|
|
|
|
|
|
rr_ttl(obj) |
1434
|
|
|
|
|
|
|
Zonemaster::LDNS::RR obj; |
1435
|
|
|
|
|
|
|
CODE: |
1436
|
6
|
|
|
|
|
|
RETVAL = ldns_rr_ttl(obj); |
1437
|
|
|
|
|
|
|
OUTPUT: |
1438
|
|
|
|
|
|
|
RETVAL |
1439
|
|
|
|
|
|
|
|
1440
|
|
|
|
|
|
|
char * |
1441
|
|
|
|
|
|
|
rr_type(obj) |
1442
|
|
|
|
|
|
|
Zonemaster::LDNS::RR obj; |
1443
|
|
|
|
|
|
|
CODE: |
1444
|
40
|
|
|
|
|
|
RETVAL = ldns_rr_type2str(ldns_rr_get_type(obj)); |
1445
|
|
|
|
|
|
|
OUTPUT: |
1446
|
|
|
|
|
|
|
RETVAL |
1447
|
|
|
|
|
|
|
CLEANUP: |
1448
|
40
|
|
|
|
|
|
free(RETVAL); |
1449
|
|
|
|
|
|
|
|
1450
|
|
|
|
|
|
|
char * |
1451
|
|
|
|
|
|
|
rr_class(obj) |
1452
|
|
|
|
|
|
|
Zonemaster::LDNS::RR obj; |
1453
|
|
|
|
|
|
|
CODE: |
1454
|
3
|
|
|
|
|
|
RETVAL = ldns_rr_class2str(ldns_rr_get_class(obj)); |
1455
|
|
|
|
|
|
|
OUTPUT: |
1456
|
|
|
|
|
|
|
RETVAL |
1457
|
|
|
|
|
|
|
CLEANUP: |
1458
|
3
|
|
|
|
|
|
free(RETVAL); |
1459
|
|
|
|
|
|
|
|
1460
|
|
|
|
|
|
|
char * |
1461
|
|
|
|
|
|
|
rr_string(obj) |
1462
|
|
|
|
|
|
|
Zonemaster::LDNS::RR obj; |
1463
|
|
|
|
|
|
|
CODE: |
1464
|
13
|
|
|
|
|
|
RETVAL = ldns_rr2str(obj); |
1465
|
13
|
|
|
|
|
|
RETVAL[strlen(RETVAL)-1] = '\0'; |
1466
|
|
|
|
|
|
|
OUTPUT: |
1467
|
|
|
|
|
|
|
RETVAL |
1468
|
|
|
|
|
|
|
CLEANUP: |
1469
|
13
|
|
|
|
|
|
free(RETVAL); |
1470
|
|
|
|
|
|
|
|
1471
|
|
|
|
|
|
|
I32 |
1472
|
|
|
|
|
|
|
rr_compare(obj1,obj2) |
1473
|
|
|
|
|
|
|
Zonemaster::LDNS::RR obj1; |
1474
|
|
|
|
|
|
|
Zonemaster::LDNS::RR obj2; |
1475
|
|
|
|
|
|
|
CODE: |
1476
|
6
|
|
|
|
|
|
RETVAL = ldns_rr_compare(obj1,obj2); |
1477
|
|
|
|
|
|
|
OUTPUT: |
1478
|
|
|
|
|
|
|
RETVAL |
1479
|
|
|
|
|
|
|
|
1480
|
|
|
|
|
|
|
size_t |
1481
|
|
|
|
|
|
|
rr_rd_count(obj) |
1482
|
|
|
|
|
|
|
Zonemaster::LDNS::RR obj; |
1483
|
|
|
|
|
|
|
CODE: |
1484
|
2
|
|
|
|
|
|
RETVAL = ldns_rr_rd_count(obj); |
1485
|
|
|
|
|
|
|
OUTPUT: |
1486
|
|
|
|
|
|
|
RETVAL |
1487
|
|
|
|
|
|
|
|
1488
|
|
|
|
|
|
|
SV * |
1489
|
|
|
|
|
|
|
rr_rdf(obj,n) |
1490
|
|
|
|
|
|
|
Zonemaster::LDNS::RR obj; |
1491
|
|
|
|
|
|
|
size_t n; |
1492
|
|
|
|
|
|
|
CODE: |
1493
|
10
|
|
|
|
|
|
ldns_rdf *rdf = ldns_rr_rdf(obj,n); |
1494
|
10
|
100
|
|
|
|
|
if(rdf==NULL) |
1495
|
|
|
|
|
|
|
{ |
1496
|
1
|
|
|
|
|
|
croak("Trying to fetch nonexistent RDATA at position %lu", n); |
1497
|
|
|
|
|
|
|
} |
1498
|
9
|
|
|
|
|
|
RETVAL = newSVpvn((char*)ldns_rdf_data(rdf), ldns_rdf_size(rdf)); |
1499
|
|
|
|
|
|
|
OUTPUT: |
1500
|
|
|
|
|
|
|
RETVAL |
1501
|
|
|
|
|
|
|
|
1502
|
|
|
|
|
|
|
void |
1503
|
|
|
|
|
|
|
rr_DESTROY(obj) |
1504
|
|
|
|
|
|
|
Zonemaster::LDNS::RR obj; |
1505
|
|
|
|
|
|
|
CODE: |
1506
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
1507
|
|
|
|
|
|
|
net_ldns_forget(); |
1508
|
|
|
|
|
|
|
#endif |
1509
|
98
|
|
|
|
|
|
ldns_rr_free(obj); |
1510
|
|
|
|
|
|
|
|
1511
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
1512
|
|
|
|
|
|
|
|
1513
|
|
|
|
|
|
|
void |
1514
|
|
|
|
|
|
|
rr_CLONE(class) |
1515
|
|
|
|
|
|
|
char *class; |
1516
|
|
|
|
|
|
|
CODE: |
1517
|
|
|
|
|
|
|
if(strEQ(class,"Zonemaster::LDNS::RR")) { |
1518
|
|
|
|
|
|
|
net_ldns_clone_rrs(); |
1519
|
|
|
|
|
|
|
} |
1520
|
|
|
|
|
|
|
|
1521
|
|
|
|
|
|
|
#endif |
1522
|
|
|
|
|
|
|
|
1523
|
|
|
|
|
|
|
MODULE = Zonemaster::LDNS PACKAGE = Zonemaster::LDNS::RR::NS PREFIX=rr_ns_ |
1524
|
|
|
|
|
|
|
|
1525
|
|
|
|
|
|
|
char * |
1526
|
|
|
|
|
|
|
rr_ns_nsdname(obj) |
1527
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::NS obj; |
1528
|
|
|
|
|
|
|
CODE: |
1529
|
6
|
|
|
|
|
|
RETVAL = randomize_capitalization(ldns_rdf2str(ldns_rr_rdf(obj, 0))); |
1530
|
|
|
|
|
|
|
OUTPUT: |
1531
|
|
|
|
|
|
|
RETVAL |
1532
|
|
|
|
|
|
|
CLEANUP: |
1533
|
6
|
|
|
|
|
|
free(RETVAL); |
1534
|
|
|
|
|
|
|
|
1535
|
|
|
|
|
|
|
|
1536
|
|
|
|
|
|
|
MODULE = Zonemaster::LDNS PACKAGE = Zonemaster::LDNS::RR::MX PREFIX=rr_mx_ |
1537
|
|
|
|
|
|
|
|
1538
|
|
|
|
|
|
|
U16 |
1539
|
|
|
|
|
|
|
rr_mx_preference(obj) |
1540
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::MX obj; |
1541
|
|
|
|
|
|
|
CODE: |
1542
|
2
|
|
|
|
|
|
RETVAL = D_U16(obj, 0); |
1543
|
|
|
|
|
|
|
OUTPUT: |
1544
|
|
|
|
|
|
|
RETVAL |
1545
|
|
|
|
|
|
|
|
1546
|
|
|
|
|
|
|
char * |
1547
|
|
|
|
|
|
|
rr_mx_exchange(obj) |
1548
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::MX obj; |
1549
|
|
|
|
|
|
|
CODE: |
1550
|
4
|
|
|
|
|
|
RETVAL = randomize_capitalization(D_STRING(obj, 1)); |
1551
|
|
|
|
|
|
|
OUTPUT: |
1552
|
|
|
|
|
|
|
RETVAL |
1553
|
|
|
|
|
|
|
CLEANUP: |
1554
|
4
|
|
|
|
|
|
free(RETVAL); |
1555
|
|
|
|
|
|
|
|
1556
|
|
|
|
|
|
|
|
1557
|
|
|
|
|
|
|
MODULE = Zonemaster::LDNS PACKAGE = Zonemaster::LDNS::RR::A PREFIX=rr_a_ |
1558
|
|
|
|
|
|
|
|
1559
|
|
|
|
|
|
|
char * |
1560
|
|
|
|
|
|
|
rr_a_address(obj) |
1561
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::A obj; |
1562
|
|
|
|
|
|
|
CODE: |
1563
|
1
|
|
|
|
|
|
RETVAL = D_STRING(obj,0); |
1564
|
|
|
|
|
|
|
OUTPUT: |
1565
|
|
|
|
|
|
|
RETVAL |
1566
|
|
|
|
|
|
|
CLEANUP: |
1567
|
1
|
|
|
|
|
|
free(RETVAL); |
1568
|
|
|
|
|
|
|
|
1569
|
|
|
|
|
|
|
|
1570
|
|
|
|
|
|
|
MODULE = Zonemaster::LDNS PACKAGE = Zonemaster::LDNS::RR::AAAA PREFIX=rr_aaaa_ |
1571
|
|
|
|
|
|
|
|
1572
|
|
|
|
|
|
|
char * |
1573
|
|
|
|
|
|
|
rr_aaaa_address(obj) |
1574
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::AAAA obj; |
1575
|
|
|
|
|
|
|
CODE: |
1576
|
1
|
|
|
|
|
|
RETVAL = D_STRING(obj,0); |
1577
|
|
|
|
|
|
|
OUTPUT: |
1578
|
|
|
|
|
|
|
RETVAL |
1579
|
|
|
|
|
|
|
CLEANUP: |
1580
|
1
|
|
|
|
|
|
free(RETVAL); |
1581
|
|
|
|
|
|
|
|
1582
|
|
|
|
|
|
|
|
1583
|
|
|
|
|
|
|
MODULE = Zonemaster::LDNS PACKAGE = Zonemaster::LDNS::RR::SOA PREFIX=rr_soa_ |
1584
|
|
|
|
|
|
|
|
1585
|
|
|
|
|
|
|
char * |
1586
|
|
|
|
|
|
|
rr_soa_mname(obj) |
1587
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::SOA obj; |
1588
|
|
|
|
|
|
|
CODE: |
1589
|
1
|
|
|
|
|
|
RETVAL = randomize_capitalization(D_STRING(obj,0)); |
1590
|
|
|
|
|
|
|
OUTPUT: |
1591
|
|
|
|
|
|
|
RETVAL |
1592
|
|
|
|
|
|
|
CLEANUP: |
1593
|
1
|
|
|
|
|
|
free(RETVAL); |
1594
|
|
|
|
|
|
|
|
1595
|
|
|
|
|
|
|
char * |
1596
|
|
|
|
|
|
|
rr_soa_rname(obj) |
1597
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::SOA obj; |
1598
|
|
|
|
|
|
|
CODE: |
1599
|
1
|
|
|
|
|
|
RETVAL = randomize_capitalization(D_STRING(obj,1)); |
1600
|
|
|
|
|
|
|
OUTPUT: |
1601
|
|
|
|
|
|
|
RETVAL |
1602
|
|
|
|
|
|
|
CLEANUP: |
1603
|
1
|
|
|
|
|
|
free(RETVAL); |
1604
|
|
|
|
|
|
|
|
1605
|
|
|
|
|
|
|
U32 |
1606
|
|
|
|
|
|
|
rr_soa_serial(obj) |
1607
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::SOA obj; |
1608
|
|
|
|
|
|
|
CODE: |
1609
|
1
|
|
|
|
|
|
RETVAL = D_U32(obj,2); |
1610
|
|
|
|
|
|
|
OUTPUT: |
1611
|
|
|
|
|
|
|
RETVAL |
1612
|
|
|
|
|
|
|
|
1613
|
|
|
|
|
|
|
U32 |
1614
|
|
|
|
|
|
|
rr_soa_refresh(obj) |
1615
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::SOA obj; |
1616
|
|
|
|
|
|
|
CODE: |
1617
|
1
|
|
|
|
|
|
RETVAL = D_U32(obj,3); |
1618
|
|
|
|
|
|
|
OUTPUT: |
1619
|
|
|
|
|
|
|
RETVAL |
1620
|
|
|
|
|
|
|
|
1621
|
|
|
|
|
|
|
U32 |
1622
|
|
|
|
|
|
|
rr_soa_retry(obj) |
1623
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::SOA obj; |
1624
|
|
|
|
|
|
|
CODE: |
1625
|
1
|
|
|
|
|
|
RETVAL = D_U32(obj,4); |
1626
|
|
|
|
|
|
|
OUTPUT: |
1627
|
|
|
|
|
|
|
RETVAL |
1628
|
|
|
|
|
|
|
|
1629
|
|
|
|
|
|
|
U32 |
1630
|
|
|
|
|
|
|
rr_soa_expire(obj) |
1631
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::SOA obj; |
1632
|
|
|
|
|
|
|
CODE: |
1633
|
1
|
|
|
|
|
|
RETVAL = D_U32(obj,5); |
1634
|
|
|
|
|
|
|
OUTPUT: |
1635
|
|
|
|
|
|
|
RETVAL |
1636
|
|
|
|
|
|
|
|
1637
|
|
|
|
|
|
|
U32 |
1638
|
|
|
|
|
|
|
rr_soa_minimum(obj) |
1639
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::SOA obj; |
1640
|
|
|
|
|
|
|
CODE: |
1641
|
1
|
|
|
|
|
|
RETVAL = D_U32(obj,6); |
1642
|
|
|
|
|
|
|
OUTPUT: |
1643
|
|
|
|
|
|
|
RETVAL |
1644
|
|
|
|
|
|
|
|
1645
|
|
|
|
|
|
|
|
1646
|
|
|
|
|
|
|
MODULE = Zonemaster::LDNS PACKAGE = Zonemaster::LDNS::RR::DS PREFIX=rr_ds_ |
1647
|
|
|
|
|
|
|
|
1648
|
|
|
|
|
|
|
U16 |
1649
|
|
|
|
|
|
|
rr_ds_keytag(obj) |
1650
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::DS obj; |
1651
|
|
|
|
|
|
|
CODE: |
1652
|
2
|
|
|
|
|
|
RETVAL = D_U16(obj,0); |
1653
|
|
|
|
|
|
|
OUTPUT: |
1654
|
|
|
|
|
|
|
RETVAL |
1655
|
|
|
|
|
|
|
|
1656
|
|
|
|
|
|
|
U8 |
1657
|
|
|
|
|
|
|
rr_ds_algorithm(obj) |
1658
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::DS obj; |
1659
|
|
|
|
|
|
|
CODE: |
1660
|
2
|
|
|
|
|
|
RETVAL = D_U8(obj,1); |
1661
|
|
|
|
|
|
|
OUTPUT: |
1662
|
|
|
|
|
|
|
RETVAL |
1663
|
|
|
|
|
|
|
|
1664
|
|
|
|
|
|
|
U8 |
1665
|
|
|
|
|
|
|
rr_ds_digtype(obj) |
1666
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::DS obj; |
1667
|
|
|
|
|
|
|
CODE: |
1668
|
3
|
|
|
|
|
|
RETVAL = D_U8(obj,2); |
1669
|
|
|
|
|
|
|
OUTPUT: |
1670
|
|
|
|
|
|
|
RETVAL |
1671
|
|
|
|
|
|
|
|
1672
|
|
|
|
|
|
|
SV * |
1673
|
|
|
|
|
|
|
rr_ds_digest(obj) |
1674
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::DS obj; |
1675
|
|
|
|
|
|
|
CODE: |
1676
|
|
|
|
|
|
|
{ |
1677
|
0
|
|
|
|
|
|
ldns_rdf *rdf = ldns_rr_rdf(obj,3); |
1678
|
0
|
|
|
|
|
|
RETVAL = newSVpvn((char*)ldns_rdf_data(rdf), ldns_rdf_size(rdf)); |
1679
|
|
|
|
|
|
|
} |
1680
|
|
|
|
|
|
|
OUTPUT: |
1681
|
|
|
|
|
|
|
RETVAL |
1682
|
|
|
|
|
|
|
|
1683
|
|
|
|
|
|
|
char * |
1684
|
|
|
|
|
|
|
rr_ds_hexdigest(obj) |
1685
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::DS obj; |
1686
|
|
|
|
|
|
|
CODE: |
1687
|
3
|
|
|
|
|
|
RETVAL = D_STRING(obj,3); |
1688
|
|
|
|
|
|
|
OUTPUT: |
1689
|
|
|
|
|
|
|
RETVAL |
1690
|
|
|
|
|
|
|
CLEANUP: |
1691
|
3
|
|
|
|
|
|
free(RETVAL); |
1692
|
|
|
|
|
|
|
|
1693
|
|
|
|
|
|
|
|
1694
|
|
|
|
|
|
|
bool |
1695
|
|
|
|
|
|
|
rr_ds_verify(obj,other) |
1696
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::DS obj; |
1697
|
|
|
|
|
|
|
Zonemaster::LDNS::RR other; |
1698
|
|
|
|
|
|
|
CODE: |
1699
|
8
|
|
|
|
|
|
RETVAL = ldns_rr_compare_ds(obj, other); |
1700
|
|
|
|
|
|
|
OUTPUT: |
1701
|
|
|
|
|
|
|
RETVAL |
1702
|
|
|
|
|
|
|
|
1703
|
|
|
|
|
|
|
MODULE = Zonemaster::LDNS PACKAGE = Zonemaster::LDNS::RR::DNSKEY PREFIX=rr_dnskey_ |
1704
|
|
|
|
|
|
|
|
1705
|
|
|
|
|
|
|
U32 |
1706
|
|
|
|
|
|
|
rr_dnskey_keysize(obj) |
1707
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::DNSKEY obj; |
1708
|
|
|
|
|
|
|
CODE: |
1709
|
|
|
|
|
|
|
{ |
1710
|
2
|
|
|
|
|
|
U8 algorithm = D_U8(obj,2); |
1711
|
2
|
|
|
|
|
|
ldns_rdf *rdf = ldns_rr_rdf(obj,3); |
1712
|
2
|
|
|
|
|
|
uint8_t *data = ldns_rdf_data(rdf); |
1713
|
2
|
|
|
|
|
|
size_t total = ldns_rdf_size(rdf); |
1714
|
|
|
|
|
|
|
|
1715
|
|
|
|
|
|
|
/* RSA variants */ |
1716
|
2
|
50
|
|
|
|
|
if(algorithm==1||algorithm==5||algorithm==7||algorithm==8||algorithm==10) |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1717
|
2
|
|
|
|
|
|
{ |
1718
|
|
|
|
|
|
|
size_t ex_len; |
1719
|
|
|
|
|
|
|
|
1720
|
2
|
50
|
|
|
|
|
if(data[0] == 0) |
1721
|
|
|
|
|
|
|
{ |
1722
|
0
|
|
|
|
|
|
ex_len = 3+(U16)data[1]; |
1723
|
|
|
|
|
|
|
} |
1724
|
|
|
|
|
|
|
else |
1725
|
|
|
|
|
|
|
{ |
1726
|
2
|
|
|
|
|
|
ex_len = 1+(U8)data[0]; |
1727
|
|
|
|
|
|
|
} |
1728
|
2
|
|
|
|
|
|
RETVAL = 8*(total-ex_len); |
1729
|
|
|
|
|
|
|
} |
1730
|
|
|
|
|
|
|
/* DSA variants */ |
1731
|
0
|
0
|
|
|
|
|
else if(algorithm==3||algorithm==6) |
|
|
0
|
|
|
|
|
|
1732
|
|
|
|
|
|
|
{ |
1733
|
0
|
|
|
|
|
|
RETVAL = (U8)data[0]; /* First octet is T value */ |
1734
|
|
|
|
|
|
|
} |
1735
|
|
|
|
|
|
|
/* Diffie-Hellman */ |
1736
|
0
|
0
|
|
|
|
|
else if(algorithm==2) |
1737
|
|
|
|
|
|
|
{ |
1738
|
0
|
|
|
|
|
|
RETVAL = (U16)data[4]; |
1739
|
|
|
|
|
|
|
} |
1740
|
|
|
|
|
|
|
/* No idea what this is */ |
1741
|
|
|
|
|
|
|
else |
1742
|
|
|
|
|
|
|
{ |
1743
|
0
|
|
|
|
|
|
RETVAL = 0; |
1744
|
|
|
|
|
|
|
} |
1745
|
|
|
|
|
|
|
} |
1746
|
|
|
|
|
|
|
OUTPUT: |
1747
|
|
|
|
|
|
|
RETVAL |
1748
|
|
|
|
|
|
|
|
1749
|
|
|
|
|
|
|
U16 |
1750
|
|
|
|
|
|
|
rr_dnskey_flags(obj) |
1751
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::DNSKEY obj; |
1752
|
|
|
|
|
|
|
CODE: |
1753
|
3
|
|
|
|
|
|
RETVAL = D_U16(obj,0); |
1754
|
|
|
|
|
|
|
OUTPUT: |
1755
|
|
|
|
|
|
|
RETVAL |
1756
|
|
|
|
|
|
|
|
1757
|
|
|
|
|
|
|
U8 |
1758
|
|
|
|
|
|
|
rr_dnskey_protocol(obj) |
1759
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::DNSKEY obj; |
1760
|
|
|
|
|
|
|
CODE: |
1761
|
2
|
|
|
|
|
|
RETVAL = D_U8(obj,1); |
1762
|
|
|
|
|
|
|
OUTPUT: |
1763
|
|
|
|
|
|
|
RETVAL |
1764
|
|
|
|
|
|
|
|
1765
|
|
|
|
|
|
|
U8 |
1766
|
|
|
|
|
|
|
rr_dnskey_algorithm(obj) |
1767
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::DNSKEY obj; |
1768
|
|
|
|
|
|
|
CODE: |
1769
|
2
|
|
|
|
|
|
RETVAL = D_U8(obj,2); |
1770
|
|
|
|
|
|
|
OUTPUT: |
1771
|
|
|
|
|
|
|
RETVAL |
1772
|
|
|
|
|
|
|
|
1773
|
|
|
|
|
|
|
SV * |
1774
|
|
|
|
|
|
|
rr_dnskey_keydata(obj) |
1775
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::DNSKEY obj; |
1776
|
|
|
|
|
|
|
CODE: |
1777
|
|
|
|
|
|
|
{ |
1778
|
0
|
|
|
|
|
|
ldns_rdf *rdf = ldns_rr_rdf(obj,3); |
1779
|
0
|
|
|
|
|
|
RETVAL = newSVpvn((char*)ldns_rdf_data(rdf), ldns_rdf_size(rdf)); |
1780
|
|
|
|
|
|
|
} |
1781
|
|
|
|
|
|
|
OUTPUT: |
1782
|
|
|
|
|
|
|
RETVAL |
1783
|
|
|
|
|
|
|
|
1784
|
|
|
|
|
|
|
U16 |
1785
|
|
|
|
|
|
|
rr_dnskey_keytag(obj) |
1786
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::DNSKEY obj; |
1787
|
|
|
|
|
|
|
CODE: |
1788
|
1
|
|
|
|
|
|
RETVAL = ldns_calc_keytag(obj); |
1789
|
|
|
|
|
|
|
OUTPUT: |
1790
|
|
|
|
|
|
|
RETVAL |
1791
|
|
|
|
|
|
|
|
1792
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::DS |
1793
|
|
|
|
|
|
|
rr_dnskey_ds(obj, hash) |
1794
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::DNSKEY obj; |
1795
|
|
|
|
|
|
|
const char *hash; |
1796
|
|
|
|
|
|
|
CODE: |
1797
|
|
|
|
|
|
|
{ |
1798
|
|
|
|
|
|
|
char lbuf[21]; |
1799
|
|
|
|
|
|
|
char *p; |
1800
|
|
|
|
|
|
|
ldns_hash htype; |
1801
|
|
|
|
|
|
|
|
1802
|
4
|
|
|
|
|
|
p = lbuf; |
1803
|
4
|
|
|
|
|
|
strncpy(lbuf, hash, 20); |
1804
|
24
|
100
|
|
|
|
|
for(; *p; p++) *p = tolower(*p); |
1805
|
|
|
|
|
|
|
|
1806
|
4
|
100
|
|
|
|
|
if(strEQ(lbuf,"sha1")) |
1807
|
|
|
|
|
|
|
{ |
1808
|
1
|
|
|
|
|
|
htype = LDNS_SHA1; |
1809
|
|
|
|
|
|
|
} |
1810
|
3
|
100
|
|
|
|
|
else if(strEQ(lbuf, "sha256")) |
1811
|
|
|
|
|
|
|
{ |
1812
|
1
|
|
|
|
|
|
htype = LDNS_SHA256; |
1813
|
|
|
|
|
|
|
} |
1814
|
2
|
100
|
|
|
|
|
else if(strEQ(lbuf, "sha384")) |
1815
|
|
|
|
|
|
|
{ |
1816
|
1
|
|
|
|
|
|
htype = LDNS_SHA384; |
1817
|
|
|
|
|
|
|
} |
1818
|
1
|
50
|
|
|
|
|
else if(strEQ(lbuf,"gost")) |
1819
|
|
|
|
|
|
|
{ |
1820
|
1
|
|
|
|
|
|
htype = LDNS_HASH_GOST; |
1821
|
|
|
|
|
|
|
} |
1822
|
|
|
|
|
|
|
else |
1823
|
|
|
|
|
|
|
{ |
1824
|
0
|
|
|
|
|
|
croak("Unknown hash type: %s", hash); |
1825
|
|
|
|
|
|
|
} |
1826
|
|
|
|
|
|
|
|
1827
|
4
|
|
|
|
|
|
RETVAL = ldns_key_rr2ds(obj,htype); |
1828
|
|
|
|
|
|
|
} |
1829
|
|
|
|
|
|
|
OUTPUT: |
1830
|
|
|
|
|
|
|
RETVAL |
1831
|
|
|
|
|
|
|
|
1832
|
|
|
|
|
|
|
MODULE = Zonemaster::LDNS PACKAGE = Zonemaster::LDNS::RR::RRSIG PREFIX=rr_rrsig_ |
1833
|
|
|
|
|
|
|
|
1834
|
|
|
|
|
|
|
char * |
1835
|
|
|
|
|
|
|
rr_rrsig_typecovered(obj) |
1836
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::RRSIG obj; |
1837
|
|
|
|
|
|
|
CODE: |
1838
|
5
|
|
|
|
|
|
RETVAL = D_STRING(obj,0); |
1839
|
|
|
|
|
|
|
OUTPUT: |
1840
|
|
|
|
|
|
|
RETVAL |
1841
|
|
|
|
|
|
|
CLEANUP: |
1842
|
5
|
|
|
|
|
|
free(RETVAL); |
1843
|
|
|
|
|
|
|
|
1844
|
|
|
|
|
|
|
U8 |
1845
|
|
|
|
|
|
|
rr_rrsig_algorithm(obj) |
1846
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::RRSIG obj; |
1847
|
|
|
|
|
|
|
CODE: |
1848
|
0
|
|
|
|
|
|
RETVAL = D_U8(obj,1); |
1849
|
|
|
|
|
|
|
OUTPUT: |
1850
|
|
|
|
|
|
|
RETVAL |
1851
|
|
|
|
|
|
|
|
1852
|
|
|
|
|
|
|
U8 |
1853
|
|
|
|
|
|
|
rr_rrsig_labels(obj) |
1854
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::RRSIG obj; |
1855
|
|
|
|
|
|
|
CODE: |
1856
|
5
|
|
|
|
|
|
RETVAL = D_U8(obj,2); |
1857
|
|
|
|
|
|
|
OUTPUT: |
1858
|
|
|
|
|
|
|
RETVAL |
1859
|
|
|
|
|
|
|
|
1860
|
|
|
|
|
|
|
U32 |
1861
|
|
|
|
|
|
|
rr_rrsig_origttl(obj) |
1862
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::RRSIG obj; |
1863
|
|
|
|
|
|
|
CODE: |
1864
|
0
|
|
|
|
|
|
RETVAL = D_U32(obj,3); |
1865
|
|
|
|
|
|
|
OUTPUT: |
1866
|
|
|
|
|
|
|
RETVAL |
1867
|
|
|
|
|
|
|
|
1868
|
|
|
|
|
|
|
U32 |
1869
|
|
|
|
|
|
|
rr_rrsig_expiration(obj) |
1870
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::RRSIG obj; |
1871
|
|
|
|
|
|
|
CODE: |
1872
|
0
|
|
|
|
|
|
RETVAL = D_U32(obj,4); |
1873
|
|
|
|
|
|
|
OUTPUT: |
1874
|
|
|
|
|
|
|
RETVAL |
1875
|
|
|
|
|
|
|
|
1876
|
|
|
|
|
|
|
U32 |
1877
|
|
|
|
|
|
|
rr_rrsig_inception(obj) |
1878
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::RRSIG obj; |
1879
|
|
|
|
|
|
|
CODE: |
1880
|
0
|
|
|
|
|
|
RETVAL = D_U32(obj,5); |
1881
|
|
|
|
|
|
|
OUTPUT: |
1882
|
|
|
|
|
|
|
RETVAL |
1883
|
|
|
|
|
|
|
|
1884
|
|
|
|
|
|
|
U16 |
1885
|
|
|
|
|
|
|
rr_rrsig_keytag(obj) |
1886
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::RRSIG obj; |
1887
|
|
|
|
|
|
|
CODE: |
1888
|
2
|
|
|
|
|
|
RETVAL = D_U16(obj,6); |
1889
|
|
|
|
|
|
|
OUTPUT: |
1890
|
|
|
|
|
|
|
RETVAL |
1891
|
|
|
|
|
|
|
|
1892
|
|
|
|
|
|
|
char * |
1893
|
|
|
|
|
|
|
rr_rrsig_signer(obj) |
1894
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::RRSIG obj; |
1895
|
|
|
|
|
|
|
CODE: |
1896
|
5
|
|
|
|
|
|
RETVAL = D_STRING(obj,7); |
1897
|
|
|
|
|
|
|
OUTPUT: |
1898
|
|
|
|
|
|
|
RETVAL |
1899
|
|
|
|
|
|
|
CLEANUP: |
1900
|
5
|
|
|
|
|
|
free(RETVAL); |
1901
|
|
|
|
|
|
|
|
1902
|
|
|
|
|
|
|
SV * |
1903
|
|
|
|
|
|
|
rr_rrsig_signature(obj) |
1904
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::RRSIG obj; |
1905
|
|
|
|
|
|
|
CODE: |
1906
|
|
|
|
|
|
|
{ |
1907
|
0
|
|
|
|
|
|
ldns_rdf *rdf = ldns_rr_rdf(obj,8); |
1908
|
0
|
|
|
|
|
|
RETVAL = newSVpvn((char*)ldns_rdf_data(rdf), ldns_rdf_size(rdf)); |
1909
|
|
|
|
|
|
|
} |
1910
|
|
|
|
|
|
|
OUTPUT: |
1911
|
|
|
|
|
|
|
RETVAL |
1912
|
|
|
|
|
|
|
|
1913
|
|
|
|
|
|
|
bool |
1914
|
|
|
|
|
|
|
rr_rrsig_verify_time(obj,rrset_in,keys_in, when, msg) |
1915
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::RRSIG obj; |
1916
|
|
|
|
|
|
|
AV *rrset_in; |
1917
|
|
|
|
|
|
|
AV *keys_in; |
1918
|
|
|
|
|
|
|
time_t when; |
1919
|
|
|
|
|
|
|
const char *msg; |
1920
|
|
|
|
|
|
|
CODE: |
1921
|
|
|
|
|
|
|
{ |
1922
|
|
|
|
|
|
|
size_t i; |
1923
|
|
|
|
|
|
|
ldns_status s; |
1924
|
5
|
|
|
|
|
|
ldns_rr_list *rrset = ldns_rr_list_new(); |
1925
|
5
|
|
|
|
|
|
ldns_rr_list *keys = ldns_rr_list_new(); |
1926
|
5
|
|
|
|
|
|
ldns_rr_list *sig = ldns_rr_list_new(); |
1927
|
5
|
|
|
|
|
|
ldns_rr_list *good = ldns_rr_list_new(); |
1928
|
|
|
|
|
|
|
|
1929
|
5
|
50
|
|
|
|
|
if(av_len(rrset_in)==-1) |
1930
|
|
|
|
|
|
|
{ |
1931
|
0
|
|
|
|
|
|
croak("RRset is empty"); |
1932
|
|
|
|
|
|
|
} |
1933
|
|
|
|
|
|
|
|
1934
|
5
|
50
|
|
|
|
|
if(av_len(keys_in)==-1) |
1935
|
|
|
|
|
|
|
{ |
1936
|
0
|
|
|
|
|
|
croak("Key list is empty"); |
1937
|
|
|
|
|
|
|
} |
1938
|
|
|
|
|
|
|
|
1939
|
|
|
|
|
|
|
/* Make a list with only the RRSIG */ |
1940
|
5
|
|
|
|
|
|
ldns_rr_list_push_rr(sig, obj); |
1941
|
|
|
|
|
|
|
|
1942
|
|
|
|
|
|
|
/* Take RRs out of the array and stick in a list */ |
1943
|
10
|
100
|
|
|
|
|
for(i = 0; i <= av_len(rrset_in); ++i) |
1944
|
|
|
|
|
|
|
{ |
1945
|
|
|
|
|
|
|
ldns_rr *rr; |
1946
|
5
|
|
|
|
|
|
SV **rrsv = av_fetch(rrset_in,i,1); |
1947
|
5
|
50
|
|
|
|
|
if (rrsv != NULL) { |
1948
|
5
|
50
|
|
|
|
|
SvGETMAGIC(*rrsv); |
|
|
0
|
|
|
|
|
|
1949
|
5
|
50
|
|
|
|
|
IV tmp = SvIV((SV*)SvRV(*rrsv)); |
1950
|
5
|
|
|
|
|
|
rr = INT2PTR(ldns_rr *,tmp); |
1951
|
5
|
50
|
|
|
|
|
if(rr != NULL) |
1952
|
|
|
|
|
|
|
{ |
1953
|
5
|
|
|
|
|
|
ldns_rr_list_push_rr(rrset, rr); |
1954
|
|
|
|
|
|
|
} |
1955
|
|
|
|
|
|
|
} |
1956
|
|
|
|
|
|
|
} |
1957
|
|
|
|
|
|
|
|
1958
|
|
|
|
|
|
|
/* Again, for the keys */ |
1959
|
13
|
100
|
|
|
|
|
for(i = 0; i <= av_len(keys_in); ++i) |
1960
|
|
|
|
|
|
|
{ |
1961
|
|
|
|
|
|
|
ldns_rr *rr; |
1962
|
8
|
|
|
|
|
|
SV **rrsv = av_fetch(keys_in,i,1); |
1963
|
8
|
50
|
|
|
|
|
IV tmp = SvIV((SV*)SvRV(*rrsv)); |
1964
|
8
|
|
|
|
|
|
rr = INT2PTR(ldns_rr *,tmp); |
1965
|
8
|
50
|
|
|
|
|
if(rr != NULL) |
1966
|
|
|
|
|
|
|
{ |
1967
|
8
|
|
|
|
|
|
ldns_rr_list_push_rr(keys, rr); |
1968
|
|
|
|
|
|
|
} |
1969
|
|
|
|
|
|
|
} |
1970
|
|
|
|
|
|
|
|
1971
|
|
|
|
|
|
|
/* And verify using the lists */ |
1972
|
5
|
|
|
|
|
|
s = ldns_verify_time(rrset, sig, keys, when, good); |
1973
|
|
|
|
|
|
|
|
1974
|
5
|
|
|
|
|
|
RETVAL = (s == LDNS_STATUS_OK); |
1975
|
5
|
|
|
|
|
|
msg = ldns_get_errorstr_by_id(s); |
1976
|
|
|
|
|
|
|
|
1977
|
5
|
|
|
|
|
|
ldns_rr_list_free(rrset); |
1978
|
5
|
|
|
|
|
|
ldns_rr_list_free(keys); |
1979
|
5
|
|
|
|
|
|
ldns_rr_list_free(sig); |
1980
|
5
|
|
|
|
|
|
ldns_rr_list_free(good); |
1981
|
|
|
|
|
|
|
} |
1982
|
|
|
|
|
|
|
OUTPUT: |
1983
|
|
|
|
|
|
|
RETVAL |
1984
|
|
|
|
|
|
|
msg |
1985
|
|
|
|
|
|
|
|
1986
|
|
|
|
|
|
|
MODULE = Zonemaster::LDNS PACKAGE = Zonemaster::LDNS::RR::NSEC PREFIX=rr_nsec_ |
1987
|
|
|
|
|
|
|
|
1988
|
|
|
|
|
|
|
char * |
1989
|
|
|
|
|
|
|
rr_nsec_next(obj) |
1990
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::NSEC obj; |
1991
|
|
|
|
|
|
|
CODE: |
1992
|
0
|
|
|
|
|
|
RETVAL = randomize_capitalization(D_STRING(obj,0)); |
1993
|
|
|
|
|
|
|
OUTPUT: |
1994
|
|
|
|
|
|
|
RETVAL |
1995
|
|
|
|
|
|
|
|
1996
|
|
|
|
|
|
|
char * |
1997
|
|
|
|
|
|
|
rr_nsec_typelist(obj) |
1998
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::NSEC obj; |
1999
|
|
|
|
|
|
|
CODE: |
2000
|
1
|
|
|
|
|
|
RETVAL = D_STRING(obj,1); |
2001
|
|
|
|
|
|
|
OUTPUT: |
2002
|
|
|
|
|
|
|
RETVAL |
2003
|
|
|
|
|
|
|
CLEANUP: |
2004
|
1
|
|
|
|
|
|
free(RETVAL); |
2005
|
|
|
|
|
|
|
|
2006
|
|
|
|
|
|
|
SV * |
2007
|
|
|
|
|
|
|
rr_nsec_typehref(obj) |
2008
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::NSEC obj; |
2009
|
|
|
|
|
|
|
CODE: |
2010
|
|
|
|
|
|
|
{ |
2011
|
3
|
|
|
|
|
|
char *typestring = D_STRING(obj,1); |
2012
|
3
|
|
|
|
|
|
char *copy = typestring; |
2013
|
|
|
|
|
|
|
size_t pos; |
2014
|
3
|
|
|
|
|
|
HV *res = newHV(); |
2015
|
|
|
|
|
|
|
|
2016
|
3
|
|
|
|
|
|
pos = 0; |
2017
|
72
|
100
|
|
|
|
|
while(typestring[pos] != '\0') |
2018
|
|
|
|
|
|
|
{ |
2019
|
69
|
|
|
|
|
|
pos++; |
2020
|
69
|
100
|
|
|
|
|
if(typestring[pos] == ' ') |
2021
|
|
|
|
|
|
|
{ |
2022
|
18
|
|
|
|
|
|
typestring[pos] = '\0'; |
2023
|
18
|
50
|
|
|
|
|
if(hv_store(res,typestring,pos,newSViv(1),0)==NULL) |
2024
|
|
|
|
|
|
|
{ |
2025
|
0
|
|
|
|
|
|
croak("Failed to store to hash"); |
2026
|
|
|
|
|
|
|
} |
2027
|
18
|
|
|
|
|
|
typestring += pos+1; |
2028
|
18
|
|
|
|
|
|
pos = 0; |
2029
|
|
|
|
|
|
|
} |
2030
|
|
|
|
|
|
|
} |
2031
|
3
|
|
|
|
|
|
RETVAL = newRV_noinc((SV *)res); |
2032
|
3
|
|
|
|
|
|
free(copy); |
2033
|
|
|
|
|
|
|
} |
2034
|
|
|
|
|
|
|
OUTPUT: |
2035
|
|
|
|
|
|
|
RETVAL |
2036
|
|
|
|
|
|
|
|
2037
|
|
|
|
|
|
|
bool |
2038
|
|
|
|
|
|
|
rr_nsec_covers(obj,name) |
2039
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::NSEC obj; |
2040
|
|
|
|
|
|
|
const char *name; |
2041
|
|
|
|
|
|
|
CODE: |
2042
|
1
|
|
|
|
|
|
ldns_rdf *dname = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, name); |
2043
|
1
|
|
|
|
|
|
ldns_dname2canonical(dname); |
2044
|
1
|
|
|
|
|
|
ldns_rr2canonical(obj); |
2045
|
1
|
|
|
|
|
|
RETVAL = ldns_nsec_covers_name(obj,dname); |
2046
|
1
|
|
|
|
|
|
ldns_rdf_deep_free(dname); |
2047
|
|
|
|
|
|
|
OUTPUT: |
2048
|
|
|
|
|
|
|
RETVAL |
2049
|
|
|
|
|
|
|
|
2050
|
|
|
|
|
|
|
MODULE = Zonemaster::LDNS PACKAGE = Zonemaster::LDNS::RR::NSEC3 PREFIX=rr_nsec3_ |
2051
|
|
|
|
|
|
|
|
2052
|
|
|
|
|
|
|
U8 |
2053
|
|
|
|
|
|
|
rr_nsec3_algorithm(obj) |
2054
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::NSEC3 obj; |
2055
|
|
|
|
|
|
|
CODE: |
2056
|
1
|
|
|
|
|
|
RETVAL = ldns_nsec3_algorithm(obj); |
2057
|
|
|
|
|
|
|
OUTPUT: |
2058
|
|
|
|
|
|
|
RETVAL |
2059
|
|
|
|
|
|
|
|
2060
|
|
|
|
|
|
|
U8 |
2061
|
|
|
|
|
|
|
rr_nsec3_flags(obj) |
2062
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::NSEC3 obj; |
2063
|
|
|
|
|
|
|
CODE: |
2064
|
1
|
|
|
|
|
|
RETVAL = ldns_nsec3_flags(obj); |
2065
|
|
|
|
|
|
|
OUTPUT: |
2066
|
|
|
|
|
|
|
RETVAL |
2067
|
|
|
|
|
|
|
|
2068
|
|
|
|
|
|
|
bool |
2069
|
|
|
|
|
|
|
rr_nsec3_optout(obj) |
2070
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::NSEC3 obj; |
2071
|
|
|
|
|
|
|
CODE: |
2072
|
1
|
|
|
|
|
|
RETVAL = ldns_nsec3_optout(obj); |
2073
|
|
|
|
|
|
|
OUTPUT: |
2074
|
|
|
|
|
|
|
RETVAL |
2075
|
|
|
|
|
|
|
|
2076
|
|
|
|
|
|
|
U16 |
2077
|
|
|
|
|
|
|
rr_nsec3_iterations(obj) |
2078
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::NSEC3 obj; |
2079
|
|
|
|
|
|
|
CODE: |
2080
|
1
|
|
|
|
|
|
RETVAL = ldns_nsec3_iterations(obj); |
2081
|
|
|
|
|
|
|
OUTPUT: |
2082
|
|
|
|
|
|
|
RETVAL |
2083
|
|
|
|
|
|
|
|
2084
|
|
|
|
|
|
|
SV * |
2085
|
|
|
|
|
|
|
rr_nsec3_salt(obj) |
2086
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::NSEC3 obj; |
2087
|
|
|
|
|
|
|
PPCODE: |
2088
|
1
|
50
|
|
|
|
|
if(ldns_nsec3_salt_length(obj) > 0) |
2089
|
|
|
|
|
|
|
{ |
2090
|
0
|
|
|
|
|
|
ldns_rdf *buf = ldns_nsec3_salt(obj); |
2091
|
0
|
|
|
|
|
|
ST(0) = sv_2mortal(newSVpvn((char *)ldns_rdf_data(buf), ldns_rdf_size(buf))); |
2092
|
0
|
|
|
|
|
|
ldns_rdf_deep_free(buf); |
2093
|
|
|
|
|
|
|
} |
2094
|
|
|
|
|
|
|
|
2095
|
|
|
|
|
|
|
SV * |
2096
|
|
|
|
|
|
|
rr_nsec3_next_owner(obj) |
2097
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::NSEC3 obj; |
2098
|
|
|
|
|
|
|
CODE: |
2099
|
1
|
|
|
|
|
|
ldns_rdf *buf = ldns_nsec3_next_owner(obj); |
2100
|
1
|
|
|
|
|
|
RETVAL = newSVpvn((char *)ldns_rdf_data(buf), ldns_rdf_size(buf)); |
2101
|
|
|
|
|
|
|
OUTPUT: |
2102
|
|
|
|
|
|
|
RETVAL |
2103
|
|
|
|
|
|
|
|
2104
|
|
|
|
|
|
|
char * |
2105
|
|
|
|
|
|
|
rr_nsec3_typelist(obj) |
2106
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::NSEC3 obj; |
2107
|
|
|
|
|
|
|
CODE: |
2108
|
1
|
|
|
|
|
|
RETVAL = ldns_rdf2str(ldns_nsec3_bitmap(obj)); |
2109
|
|
|
|
|
|
|
OUTPUT: |
2110
|
|
|
|
|
|
|
RETVAL |
2111
|
|
|
|
|
|
|
CLEANUP: |
2112
|
1
|
|
|
|
|
|
free(RETVAL); |
2113
|
|
|
|
|
|
|
|
2114
|
|
|
|
|
|
|
SV * |
2115
|
|
|
|
|
|
|
rr_nsec3_typehref(obj) |
2116
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::NSEC3 obj; |
2117
|
|
|
|
|
|
|
CODE: |
2118
|
|
|
|
|
|
|
{ |
2119
|
1
|
|
|
|
|
|
char *typestring = ldns_rdf2str(ldns_nsec3_bitmap(obj)); |
2120
|
1
|
|
|
|
|
|
char *copy = typestring; |
2121
|
|
|
|
|
|
|
size_t pos; |
2122
|
1
|
|
|
|
|
|
HV *res = newHV(); |
2123
|
|
|
|
|
|
|
|
2124
|
1
|
|
|
|
|
|
pos = 0; |
2125
|
10
|
100
|
|
|
|
|
while(typestring[pos] != '\0') |
2126
|
|
|
|
|
|
|
{ |
2127
|
9
|
|
|
|
|
|
pos++; |
2128
|
9
|
100
|
|
|
|
|
if(typestring[pos] == ' ') |
2129
|
|
|
|
|
|
|
{ |
2130
|
3
|
|
|
|
|
|
typestring[pos] = '\0'; |
2131
|
3
|
50
|
|
|
|
|
if(hv_store(res,typestring,pos,newSViv(1),0)==NULL) |
2132
|
|
|
|
|
|
|
{ |
2133
|
0
|
|
|
|
|
|
croak("Failed to store to hash"); |
2134
|
|
|
|
|
|
|
} |
2135
|
3
|
|
|
|
|
|
typestring += pos+1; |
2136
|
3
|
|
|
|
|
|
pos = 0; |
2137
|
|
|
|
|
|
|
} |
2138
|
|
|
|
|
|
|
} |
2139
|
1
|
|
|
|
|
|
RETVAL = newRV_noinc((SV *)res); |
2140
|
1
|
|
|
|
|
|
free(copy); |
2141
|
|
|
|
|
|
|
} |
2142
|
|
|
|
|
|
|
OUTPUT: |
2143
|
|
|
|
|
|
|
RETVAL |
2144
|
|
|
|
|
|
|
|
2145
|
|
|
|
|
|
|
bool |
2146
|
|
|
|
|
|
|
rr_nsec3_covers(obj,name) |
2147
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::NSEC3 obj; |
2148
|
|
|
|
|
|
|
const char *name; |
2149
|
|
|
|
|
|
|
CODE: |
2150
|
|
|
|
|
|
|
{ |
2151
|
|
|
|
|
|
|
ldns_rr *clone; |
2152
|
|
|
|
|
|
|
ldns_rdf *dname; |
2153
|
|
|
|
|
|
|
ldns_rdf *hashed; |
2154
|
|
|
|
|
|
|
ldns_rdf *chopped; |
2155
|
|
|
|
|
|
|
|
2156
|
1
|
|
|
|
|
|
clone = ldns_rr_clone(obj); |
2157
|
1
|
|
|
|
|
|
dname = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, name); |
2158
|
1
|
|
|
|
|
|
ldns_dname2canonical(dname); |
2159
|
1
|
|
|
|
|
|
ldns_rr2canonical(clone); |
2160
|
1
|
|
|
|
|
|
hashed = ldns_nsec3_hash_name_frm_nsec3(clone, dname); |
2161
|
1
|
|
|
|
|
|
chopped = ldns_dname_left_chop(dname); |
2162
|
1
|
|
|
|
|
|
ldns_rdf_deep_free(dname); |
2163
|
1
|
|
|
|
|
|
ldns_dname_cat(hashed,chopped); |
2164
|
1
|
|
|
|
|
|
RETVAL = ldns_nsec_covers_name(clone,hashed); |
2165
|
1
|
|
|
|
|
|
ldns_rdf_deep_free(hashed); |
2166
|
1
|
|
|
|
|
|
ldns_rdf_deep_free(chopped); |
2167
|
1
|
|
|
|
|
|
ldns_rr_free(clone); |
2168
|
|
|
|
|
|
|
} |
2169
|
|
|
|
|
|
|
OUTPUT: |
2170
|
|
|
|
|
|
|
RETVAL |
2171
|
|
|
|
|
|
|
|
2172
|
|
|
|
|
|
|
MODULE = Zonemaster::LDNS PACKAGE = Zonemaster::LDNS::RR::NSEC3PARAM PREFIX=rr_nsec3param_ |
2173
|
|
|
|
|
|
|
|
2174
|
|
|
|
|
|
|
U8 |
2175
|
|
|
|
|
|
|
rr_nsec3param_algorithm(obj) |
2176
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::NSEC3PARAM obj; |
2177
|
|
|
|
|
|
|
CODE: |
2178
|
1
|
|
|
|
|
|
RETVAL = D_U8(obj,0); |
2179
|
|
|
|
|
|
|
OUTPUT: |
2180
|
|
|
|
|
|
|
RETVAL |
2181
|
|
|
|
|
|
|
|
2182
|
|
|
|
|
|
|
U8 |
2183
|
|
|
|
|
|
|
rr_nsec3param_flags(obj) |
2184
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::NSEC3PARAM obj; |
2185
|
|
|
|
|
|
|
CODE: |
2186
|
1
|
|
|
|
|
|
RETVAL = D_U8(obj,1); |
2187
|
|
|
|
|
|
|
OUTPUT: |
2188
|
|
|
|
|
|
|
RETVAL |
2189
|
|
|
|
|
|
|
|
2190
|
|
|
|
|
|
|
|
2191
|
|
|
|
|
|
|
U16 |
2192
|
|
|
|
|
|
|
rr_nsec3param_iterations(obj) |
2193
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::NSEC3PARAM obj; |
2194
|
|
|
|
|
|
|
CODE: |
2195
|
1
|
|
|
|
|
|
RETVAL = D_U16(obj,2); |
2196
|
|
|
|
|
|
|
OUTPUT: |
2197
|
|
|
|
|
|
|
RETVAL |
2198
|
|
|
|
|
|
|
|
2199
|
|
|
|
|
|
|
SV * |
2200
|
|
|
|
|
|
|
rr_nsec3param_salt(obj) |
2201
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::NSEC3PARAM obj; |
2202
|
|
|
|
|
|
|
PPCODE: |
2203
|
1
|
|
|
|
|
|
ldns_rdf *rdf = ldns_rr_rdf(obj,3); |
2204
|
1
|
50
|
|
|
|
|
if(ldns_rdf_size(rdf) > 0) |
2205
|
|
|
|
|
|
|
{ |
2206
|
1
|
|
|
|
|
|
mPUSHs(newSVpvn((char *)ldns_rdf_data(rdf), ldns_rdf_size(rdf))); |
2207
|
|
|
|
|
|
|
} |
2208
|
|
|
|
|
|
|
|
2209
|
|
|
|
|
|
|
MODULE = Zonemaster::LDNS PACKAGE = Zonemaster::LDNS::RR::PTR PREFIX=rr_ptr_ |
2210
|
|
|
|
|
|
|
|
2211
|
|
|
|
|
|
|
char * |
2212
|
|
|
|
|
|
|
rr_ptr_ptrdname(obj) |
2213
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::PTR obj; |
2214
|
|
|
|
|
|
|
CODE: |
2215
|
0
|
|
|
|
|
|
RETVAL = randomize_capitalization(D_STRING(obj,0)); |
2216
|
|
|
|
|
|
|
OUTPUT: |
2217
|
|
|
|
|
|
|
RETVAL |
2218
|
|
|
|
|
|
|
CLEANUP: |
2219
|
0
|
|
|
|
|
|
free(RETVAL); |
2220
|
|
|
|
|
|
|
|
2221
|
|
|
|
|
|
|
|
2222
|
|
|
|
|
|
|
MODULE = Zonemaster::LDNS PACKAGE = Zonemaster::LDNS::RR::CNAME PREFIX=rr_cname_ |
2223
|
|
|
|
|
|
|
|
2224
|
|
|
|
|
|
|
char * |
2225
|
|
|
|
|
|
|
rr_cname_cname(obj) |
2226
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::CNAME obj; |
2227
|
|
|
|
|
|
|
CODE: |
2228
|
0
|
|
|
|
|
|
RETVAL = randomize_capitalization(D_STRING(obj,0)); |
2229
|
|
|
|
|
|
|
OUTPUT: |
2230
|
|
|
|
|
|
|
RETVAL |
2231
|
|
|
|
|
|
|
CLEANUP: |
2232
|
0
|
|
|
|
|
|
free(RETVAL); |
2233
|
|
|
|
|
|
|
|
2234
|
|
|
|
|
|
|
|
2235
|
|
|
|
|
|
|
MODULE = Zonemaster::LDNS PACKAGE = Zonemaster::LDNS::RR::TXT PREFIX=rr_txt_ |
2236
|
|
|
|
|
|
|
|
2237
|
|
|
|
|
|
|
char * |
2238
|
|
|
|
|
|
|
rr_txt_txtdata(obj) |
2239
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::TXT obj; |
2240
|
|
|
|
|
|
|
CODE: |
2241
|
1
|
|
|
|
|
|
RETVAL = D_STRING(obj,0); |
2242
|
|
|
|
|
|
|
OUTPUT: |
2243
|
|
|
|
|
|
|
RETVAL |
2244
|
|
|
|
|
|
|
CLEANUP: |
2245
|
1
|
|
|
|
|
|
free(RETVAL); |
2246
|
|
|
|
|
|
|
|
2247
|
|
|
|
|
|
|
MODULE = Zonemaster::LDNS PACKAGE = Zonemaster::LDNS::RR::SPF PREFIX=rr_spf_ |
2248
|
|
|
|
|
|
|
|
2249
|
|
|
|
|
|
|
char * |
2250
|
|
|
|
|
|
|
rr_spf_spfdata(obj) |
2251
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::SPF obj; |
2252
|
|
|
|
|
|
|
CODE: |
2253
|
1
|
|
|
|
|
|
RETVAL = D_STRING(obj,0); |
2254
|
|
|
|
|
|
|
OUTPUT: |
2255
|
|
|
|
|
|
|
RETVAL |
2256
|
|
|
|
|
|
|
CLEANUP: |
2257
|
1
|
|
|
|
|
|
free(RETVAL); |
2258
|
|
|
|
|
|
|
|
2259
|
|
|
|
|
|
|
MODULE = Zonemaster::LDNS PACKAGE = Zonemaster::LDNS::RR::KEY PREFIX=rr_key_ |
2260
|
|
|
|
|
|
|
|
2261
|
|
|
|
|
|
|
U16 |
2262
|
|
|
|
|
|
|
rr_key_flags(obj) |
2263
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::KEY obj; |
2264
|
|
|
|
|
|
|
CODE: |
2265
|
0
|
|
|
|
|
|
RETVAL = D_U16(obj,0); |
2266
|
|
|
|
|
|
|
OUTPUT: |
2267
|
|
|
|
|
|
|
RETVAL |
2268
|
|
|
|
|
|
|
|
2269
|
|
|
|
|
|
|
U8 |
2270
|
|
|
|
|
|
|
rr_key_protocol(obj) |
2271
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::KEY obj; |
2272
|
|
|
|
|
|
|
CODE: |
2273
|
0
|
|
|
|
|
|
RETVAL = D_U8(obj,1); |
2274
|
|
|
|
|
|
|
OUTPUT: |
2275
|
|
|
|
|
|
|
RETVAL |
2276
|
|
|
|
|
|
|
|
2277
|
|
|
|
|
|
|
U8 |
2278
|
|
|
|
|
|
|
rr_key_algorithm(obj) |
2279
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::KEY obj; |
2280
|
|
|
|
|
|
|
CODE: |
2281
|
0
|
|
|
|
|
|
RETVAL = D_U8(obj,2); |
2282
|
|
|
|
|
|
|
OUTPUT: |
2283
|
|
|
|
|
|
|
RETVAL |
2284
|
|
|
|
|
|
|
|
2285
|
|
|
|
|
|
|
SV * |
2286
|
|
|
|
|
|
|
rr_key_keydata(obj) |
2287
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::KEY obj; |
2288
|
|
|
|
|
|
|
CODE: |
2289
|
|
|
|
|
|
|
{ |
2290
|
0
|
|
|
|
|
|
ldns_rdf *rdf = ldns_rr_rdf(obj,3); |
2291
|
0
|
|
|
|
|
|
RETVAL = newSVpvn((char*)ldns_rdf_data(rdf), ldns_rdf_size(rdf)); |
2292
|
|
|
|
|
|
|
} |
2293
|
|
|
|
|
|
|
OUTPUT: |
2294
|
|
|
|
|
|
|
RETVAL |
2295
|
|
|
|
|
|
|
|
2296
|
|
|
|
|
|
|
MODULE = Zonemaster::LDNS PACKAGE = Zonemaster::LDNS::RR::SIG PREFIX=rr_sig_ |
2297
|
|
|
|
|
|
|
|
2298
|
|
|
|
|
|
|
char * |
2299
|
|
|
|
|
|
|
rr_sig_typecovered(obj) |
2300
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::SIG obj; |
2301
|
|
|
|
|
|
|
CODE: |
2302
|
0
|
|
|
|
|
|
RETVAL = D_STRING(obj,0); |
2303
|
|
|
|
|
|
|
OUTPUT: |
2304
|
|
|
|
|
|
|
RETVAL |
2305
|
|
|
|
|
|
|
CLEANUP: |
2306
|
0
|
|
|
|
|
|
free(RETVAL); |
2307
|
|
|
|
|
|
|
|
2308
|
|
|
|
|
|
|
U8 |
2309
|
|
|
|
|
|
|
rr_sig_algorithm(obj) |
2310
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::SIG obj; |
2311
|
|
|
|
|
|
|
CODE: |
2312
|
0
|
|
|
|
|
|
RETVAL = D_U8(obj,1); |
2313
|
|
|
|
|
|
|
OUTPUT: |
2314
|
|
|
|
|
|
|
RETVAL |
2315
|
|
|
|
|
|
|
|
2316
|
|
|
|
|
|
|
U8 |
2317
|
|
|
|
|
|
|
rr_sig_labels(obj) |
2318
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::SIG obj; |
2319
|
|
|
|
|
|
|
CODE: |
2320
|
0
|
|
|
|
|
|
RETVAL = D_U8(obj,2); |
2321
|
|
|
|
|
|
|
OUTPUT: |
2322
|
|
|
|
|
|
|
RETVAL |
2323
|
|
|
|
|
|
|
|
2324
|
|
|
|
|
|
|
U32 |
2325
|
|
|
|
|
|
|
rr_sig_origttl(obj) |
2326
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::SIG obj; |
2327
|
|
|
|
|
|
|
CODE: |
2328
|
0
|
|
|
|
|
|
RETVAL = D_U32(obj,3); |
2329
|
|
|
|
|
|
|
OUTPUT: |
2330
|
|
|
|
|
|
|
RETVAL |
2331
|
|
|
|
|
|
|
|
2332
|
|
|
|
|
|
|
U32 |
2333
|
|
|
|
|
|
|
rr_sig_expiration(obj) |
2334
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::SIG obj; |
2335
|
|
|
|
|
|
|
CODE: |
2336
|
0
|
|
|
|
|
|
RETVAL = D_U32(obj,4); |
2337
|
|
|
|
|
|
|
OUTPUT: |
2338
|
|
|
|
|
|
|
RETVAL |
2339
|
|
|
|
|
|
|
|
2340
|
|
|
|
|
|
|
U32 |
2341
|
|
|
|
|
|
|
rr_sig_inception(obj) |
2342
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::SIG obj; |
2343
|
|
|
|
|
|
|
CODE: |
2344
|
0
|
|
|
|
|
|
RETVAL = D_U32(obj,5); |
2345
|
|
|
|
|
|
|
OUTPUT: |
2346
|
|
|
|
|
|
|
RETVAL |
2347
|
|
|
|
|
|
|
|
2348
|
|
|
|
|
|
|
U16 |
2349
|
|
|
|
|
|
|
rr_sig_keytag(obj) |
2350
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::SIG obj; |
2351
|
|
|
|
|
|
|
CODE: |
2352
|
0
|
|
|
|
|
|
RETVAL = D_U16(obj,6); |
2353
|
|
|
|
|
|
|
OUTPUT: |
2354
|
|
|
|
|
|
|
RETVAL |
2355
|
|
|
|
|
|
|
|
2356
|
|
|
|
|
|
|
char * |
2357
|
|
|
|
|
|
|
rr_sig_signer(obj) |
2358
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::SIG obj; |
2359
|
|
|
|
|
|
|
CODE: |
2360
|
0
|
|
|
|
|
|
RETVAL = D_STRING(obj,7); |
2361
|
|
|
|
|
|
|
OUTPUT: |
2362
|
|
|
|
|
|
|
RETVAL |
2363
|
|
|
|
|
|
|
CLEANUP: |
2364
|
0
|
|
|
|
|
|
free(RETVAL); |
2365
|
|
|
|
|
|
|
|
2366
|
|
|
|
|
|
|
SV * |
2367
|
|
|
|
|
|
|
rr_sig_signature(obj) |
2368
|
|
|
|
|
|
|
Zonemaster::LDNS::RR::SIG obj; |
2369
|
|
|
|
|
|
|
CODE: |
2370
|
|
|
|
|
|
|
{ |
2371
|
0
|
|
|
|
|
|
ldns_rdf *rdf = ldns_rr_rdf(obj,8); |
2372
|
0
|
|
|
|
|
|
RETVAL = newSVpvn((char*)ldns_rdf_data(rdf), ldns_rdf_size(rdf)); |
2373
|
|
|
|
|
|
|
} |
2374
|
|
|
|
|
|
|
OUTPUT: |
2375
|
|
|
|
|
|
|
RETVAL |