diff options
author | Jelte Jansen <jelte@isc.org> | 2012-07-05 17:53:43 +0200 |
---|---|---|
committer | Jelte Jansen <jelte@isc.org> | 2012-07-06 12:45:50 +0200 |
commit | 50dc1afa945214cf133502ea600c48bfeb363a7d (patch) | |
tree | 36fd677491e067829836159b53be6293fe3e228d /src/lib/dns/labelsequence.h | |
parent | Merge #2044 (diff) | |
download | kea-50dc1afa945214cf133502ea600c48bfeb363a7d.tar.xz kea-50dc1afa945214cf133502ea600c48bfeb363a7d.zip |
[2086] use raw Name data in LabelSequence
instead of reference to Name
- moved actual name comparison code to labelsequence
- removed Name reference
- replaced by data, offsets, and offset_size values
- added 'raw' constructor for LabelSequence
Diffstat (limited to 'src/lib/dns/labelsequence.h')
-rw-r--r-- | src/lib/dns/labelsequence.h | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/lib/dns/labelsequence.h b/src/lib/dns/labelsequence.h index 25adc711a2..f2b3c112ef 100644 --- a/src/lib/dns/labelsequence.h +++ b/src/lib/dns/labelsequence.h @@ -53,11 +53,35 @@ public: /// to the labels in the Name object). /// /// \param name The Name to construct a LabelSequence for - LabelSequence(const Name& name): name_(name), + explicit LabelSequence(const Name& name): /*name_(name),*/ + data_(&name.ndata_[0]), + offsets_(&name.offsets_[0]), + offsets_size_(name.offsets_.size()), first_label_(0), last_label_(name.getLabelCount()) {} + /// \brief Constructs a LabelSequence for the given data + /// + /// \note The associated data MUST remain in scope during the lifetime + /// of this LabelSequence, since only the pointers are copied. + /// + /// \note No validation is done on the given data upon construction; + /// use with care. + /// + /// \param data The Name data, in wire format + /// \param offsets The offsets of the labels in the Name, as given + /// by the Name object or another LabelSequence + /// \param offsets_size The size of the offsets data + LabelSequence(const uint8_t* data, + const uint8_t* offsets, + size_t offsets_size) : data_(data), + offsets_(offsets), + offsets_size_(offsets_size), + first_label_(0), + last_label_(offsets_size_) + {} + /// \brief Return the wire-format data for this LabelSequence /// /// The data, is returned as a pointer to the original wireformat @@ -201,7 +225,9 @@ public: bool isAbsolute() const; private: - const Name& name_; + const uint8_t* data_; + const uint8_t* offsets_; + size_t offsets_size_; size_t first_label_; size_t last_label_; }; |