diff options
author | Jelte Jansen <jelte@isc.org> | 2012-07-25 11:41:33 +0200 |
---|---|---|
committer | Jelte Jansen <jelte@isc.org> | 2012-07-25 11:41:33 +0200 |
commit | 1780e99cd241758c591d84565e11631b827f109c (patch) | |
tree | b987885d388f249ded564800f3c5415432d5035a /src/lib/dns/labelsequence.cc | |
parent | [2091a] more clarification on the use of separate memsgmt for each zone. (diff) | |
download | kea-1780e99cd241758c591d84565e11631b827f109c.tar.xz kea-1780e99cd241758c591d84565e11631b827f109c.zip |
[2148] 'extendable' labelsequence constructor
Diffstat (limited to 'src/lib/dns/labelsequence.cc')
-rw-r--r-- | src/lib/dns/labelsequence.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lib/dns/labelsequence.cc b/src/lib/dns/labelsequence.cc index 5675e5a044..8f22415892 100644 --- a/src/lib/dns/labelsequence.cc +++ b/src/lib/dns/labelsequence.cc @@ -55,6 +55,25 @@ LabelSequence::LabelSequence(const void* buf) { } } +LabelSequence::LabelSequence(const LabelSequence& src, + uint8_t buf[MAX_SERIALIZED_LENGTH]) +{ + size_t data_len; + const uint8_t *data = src.getData(&data_len); + memcpy(buf, data, data_len); + + for (size_t i = 0; i < src.getLabelCount(); ++i) { + buf[Name::MAX_WIRE + i] = src.offsets_[i + src.first_label_] - + src.offsets_[src.first_label_]; + } + + first_label_ = 0; + last_label_ = src.last_label_ - src.first_label_; + data_ = buf; + offsets_ = &buf[Name::MAX_WIRE]; +} + + const uint8_t* LabelSequence::getData(size_t *len) const { *len = getDataLength(); |