diff options
author | JINMEI Tatuya <jinmei@isc.org> | 2012-11-30 23:28:52 +0100 |
---|---|---|
committer | JINMEI Tatuya <jinmei@isc.org> | 2012-12-01 04:40:59 +0100 |
commit | 3ae13a89a2f238602d5dd7e3dc12da963de21ec8 (patch) | |
tree | 762b734735bfb3d380f708e1ba56e7c6eb4d3744 /src/lib/dns/rdata/in_1/aaaa_28.cc | |
parent | [2382] unrelated fix to lexer: support empty qstring and nul termination. (diff) | |
download | kea-3ae13a89a2f238602d5dd7e3dc12da963de21ec8.tar.xz kea-3ae13a89a2f238602d5dd7e3dc12da963de21ec8.zip |
[2382] added from-lexer ctor for AAAA RDATA.
not directly related to this task, but I found we need one real (non wrapper)
example to test some of the feature of generic createRdata().
also updated RDATA template including with-lexer constructor.
Diffstat (limited to 'src/lib/dns/rdata/in_1/aaaa_28.cc')
-rw-r--r-- | src/lib/dns/rdata/in_1/aaaa_28.cc | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/lib/dns/rdata/in_1/aaaa_28.cc b/src/lib/dns/rdata/in_1/aaaa_28.cc index ce49a04c51..0466f1a445 100644 --- a/src/lib/dns/rdata/in_1/aaaa_28.cc +++ b/src/lib/dns/rdata/in_1/aaaa_28.cc @@ -12,6 +12,15 @@ // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. +#include <exceptions/exceptions.h> +#include <util/buffer.h> +#include <dns/exceptions.h> +#include <dns/messagerenderer.h> +#include <dns/rdata.h> +#include <dns/rdataclass.h> +#include <dns/master_lexer.h> +#include <dns/master_loader.h> + #include <stdint.h> #include <string.h> @@ -20,14 +29,6 @@ #include <arpa/inet.h> // XXX: for inet_pton/ntop(), not exist in C++ standards #include <sys/socket.h> // for AF_INET/AF_INET6 -#include <exceptions/exceptions.h> - -#include <util/buffer.h> -#include <dns/exceptions.h> -#include <dns/messagerenderer.h> -#include <dns/rdata.h> -#include <dns/rdataclass.h> - using namespace std; using namespace isc::util; @@ -42,6 +43,16 @@ AAAA::AAAA(const std::string& addrstr) { } } +AAAA::AAAA(MasterLexer& lexer, const Name*, + MasterLoader::Options, MasterLoaderCallbacks&) +{ + const MasterToken& token = lexer.getNextToken(MasterToken::STRING); + if (inet_pton(AF_INET6, token.getStringRegion().beg, &addr_) != 1) { + isc_throw(InvalidRdataText, "Failed to convert '" + << token.getString() << "' to IN/AAAA RDATA"); + } +} + AAAA::AAAA(InputBuffer& buffer, size_t rdata_len) { if (rdata_len != sizeof(addr_)) { isc_throw(DNSMessageFORMERR, |