summaryrefslogtreecommitdiffstats
path: root/src/lib/dns/labelsequence.cc
diff options
context:
space:
mode:
authorJelte Jansen <jelte@isc.org>2012-07-25 11:41:33 +0200
committerJelte Jansen <jelte@isc.org>2012-07-25 11:41:33 +0200
commit1780e99cd241758c591d84565e11631b827f109c (patch)
treeb987885d388f249ded564800f3c5415432d5035a /src/lib/dns/labelsequence.cc
parent[2091a] more clarification on the use of separate memsgmt for each zone. (diff)
downloadkea-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.cc19
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();