summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author[Thomas Green] <thomas.green@afnic.fr>2023-01-17 19:09:36 +0100
committer[Thomas Green] <thomas.green@afnic.fr>2023-01-17 19:09:36 +0100
commit380382aa961d21f24f00c99b573c9d84c1433e65 (patch)
tree11f0a1013e57396616a66e8f7ba6d7fc38478e72
parentbed4a20a8899bd759099c6077e4baea860088b83 (diff)
Revert renaming of variable, update documentation, refactoring
-rw-r--r--src/LDNS.xs27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/LDNS.xs b/src/LDNS.xs
index 2f1dd24..3e9b2cf 100644
--- a/src/LDNS.xs
+++ b/src/LDNS.xs
@@ -1375,42 +1375,39 @@ packet_edns_version(obj,...)
# -------------------
# Get/set EDNS data
#
-# This function will set EDNS RDATA in a packet when given a parameter,
-# otherwise it will return the entire EDNS RDATA of the packet (if any).
+# This function will set OPT RDATA in a packet when given a parameter,
+# otherwise it will return the entire OPT RDATA of the packet (if any).
#
-# Beware, when setting EDNS RDATA, this code can only take a unique U32 parameter
+# Beware, when setting OPT RDATA, this code can only take a unique U32 parameter
# which means it is not a full implementation of EDNS data but it is enough for our
# current purpose. It can only deal with option codes with OPTION-LENGTH=0
# (see 6.1.2 section of RFC 6891) which means OPTION-DATA is always empty.
#
-# returns: a bytes string (or undef if no EDNS data is found)
+# returns: a bytes string (or undef if no OPT RDATA is found)
#
SV *
packet_edns_data(obj,...)
Zonemaster::LDNS::Packet obj;
CODE:
- ldns_rdf* rdf;
+ ldns_rdf* opt;
if(items>=2)
{
SvGETMAGIC(ST(1));
- rdf = ldns_native2rdf_int32(LDNS_RDF_TYPE_INT32, (U32)SvIV(ST(1)));
- if(rdf == NULL)
+ opt = ldns_native2rdf_int32(LDNS_RDF_TYPE_INT32, (U32)SvIV(ST(1)));
+ if(opt == NULL)
{
- croak("Failed to set rdf RDATA");
+ croak("Failed to set OPT RDATA");
}
- ldns_pkt_set_edns_data(obj, rdf);
- RETVAL = newSVpvn((char*)(rdf), 4);
+ ldns_pkt_set_edns_data(obj, opt);
}
else {
- rdf = ldns_pkt_edns_data(obj);
- if(rdf == NULL)
+ opt = ldns_pkt_edns_data(obj);
+ if(opt == NULL)
{
XSRETURN_UNDEF;
}
- else{
- RETVAL = newSVpvn((char*)(rdf->_data), rdf->_size);
- }
}
+ RETVAL = newSVpvn((char*)(opt->_data), opt->_size);
OUTPUT:
RETVAL