summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelte Jansen <jelte@isc.org>2012-02-22 09:02:53 +0100
committerJelte Jansen <jelte@isc.org>2012-02-22 09:02:53 +0100
commit7ac5487d208f8b4cb9c3e2955bd7d1f03b2ad942 (patch)
treef6fe0c5caa7c5093de88e5eabddbe76d8ec750e0
parent[1602] get rid of internal buffer (diff)
downloadkea-7ac5487d208f8b4cb9c3e2955bd7d1f03b2ad942.tar.xz
kea-7ac5487d208f8b4cb9c3e2955bd7d1f03b2ad942.zip
[1602] start with doxygen docs
-rw-r--r--src/lib/dns/labelsequence.cc27
-rw-r--r--src/lib/dns/labelsequence.h2
2 files changed, 25 insertions, 4 deletions
diff --git a/src/lib/dns/labelsequence.cc b/src/lib/dns/labelsequence.cc
index 21da769e31..b43d8e4d61 100644
--- a/src/lib/dns/labelsequence.cc
+++ b/src/lib/dns/labelsequence.cc
@@ -15,13 +15,34 @@
#include <dns/labelsequence.h>
#include <exceptions/exceptions.h>
-// TODO: REMOVE
-#include <iostream>
+/// Light-weight Accessor to Name object
+///
+/// The purpose of this class is to easily match Names and parts of Names,
+/// without needing to copy the underlying data on each split.
+///
+/// It can only work on existing Name objects, and the Name object MUST
+/// remain in scope during the entire lifetime of its associated
+/// LabelSequence(s)
+///
+/// Upon creation of a LabelSequence, it records the offsets of the
+/// labels in the wireformat data of the Name. When split() is called on
+/// the LabelSequence, no changes in the Name's data occur, but the
+/// internal pointers of the LabelSequence are modified.
+///
+/// LabelSequences can be compared to other LabelSequences, and their
+/// data can be requested (which then points to part of the original
+/// data of the associated Name object).
+///
namespace isc {
namespace dns {
-
+/// \brief Constructs a LabelSequence for the given name
+///
+/// The associated Name MUST remain in scope during the lifetime of
+/// this LabelSequence, since getData() refers to data from the
+/// Name object (the only data the LabelSequence stores are pointers
+/// to the labels in the Name object).
LabelSequence::LabelSequence(const Name& name) : name_(name),
first_label_(0) {
size_t label_count_ = name.getLabelCount();
diff --git a/src/lib/dns/labelsequence.h b/src/lib/dns/labelsequence.h
index 87704f6093..686442f146 100644
--- a/src/lib/dns/labelsequence.h
+++ b/src/lib/dns/labelsequence.h
@@ -32,7 +32,7 @@ public:
void split(int i);
- size_t getLabelCount() { return last_label_ - first_label_; }
+ size_t getLabelCount() const { return last_label_ - first_label_; }
const Name& getName() const { return name_; }