BIND 10 trac2383, updated. 8a0af829c62d143ebb80f99131f7bcb2918add82 [2383] Header of the Name constructor for parser
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Oct 29 17:21:05 UTC 2012
The branch, trac2383 has been updated
via 8a0af829c62d143ebb80f99131f7bcb2918add82 (commit)
from 4163ddf6d718bc6239a92a592687701053a5cf06 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 8a0af829c62d143ebb80f99131f7bcb2918add82
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Mon Oct 29 18:18:06 2012 +0100
[2383] Header of the Name constructor for parser
The master file parser will need a special Name constructor for
reasonable performance and for convenience/clarity of its code.
Introduce the header for the constructor, a new exception for it and
documentation.
-----------------------------------------------------------------------
Summary of changes:
src/lib/dns/name.h | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
-----------------------------------------------------------------------
diff --git a/src/lib/dns/name.h b/src/lib/dns/name.h
index a3e3674..02c868f 100644
--- a/src/lib/dns/name.h
+++ b/src/lib/dns/name.h
@@ -105,6 +105,17 @@ public:
NameParserException(file, line, what) {}
};
+/// \brief Thrown when origin is NULL and is needed.
+///
+/// The exception is thrown when the Name constructor for master file
+/// is used, the provided data is relative and the origin parameter is
+/// set to NULL.
+class MissingNameOrigin : public NameParserException {
+public:
+ MissingNameOrigin(const char* file, size_t line, const char* what) :
+ NameParserException(file, line, what) {}
+};
+
///
/// This is a supplemental class used only as a return value of
/// Name::compare() and LabelSequence::compare().
@@ -261,6 +272,37 @@ public:
/// \param namestr A string representation of the name to be constructed.
/// \param downcase Whether to convert upper case alphabets to lower case.
explicit Name(const std::string& namestr, bool downcase = false);
+
+ /// \brief Constructor for master file parser
+ ///
+ /// This acts similar to the above. But the data is passed as raw C-string
+ /// instead of wrapped-up C++ std::string.
+ ///
+ /// Also, when the origin is non-NULL and the name_data is not ending with
+ /// a dot, it is considered relative and the origin is appended to it.
+ ///
+ /// If the name_data is equal to "@", the content of origin is copied.
+ ///
+ /// \param name_data The raw data of the name.
+ /// \param data_len How many bytes in name_data is valid and considered
+ /// part of the name.
+ /// \param origin If non-NULL, it is taken as the origin to complete
+ /// relative names.
+ /// \param downcase Whether to convert upper case letters to lower case.
+ /// \throw NameParserException or any of its descendants in case the
+ /// input data is invalid.
+ /// \throw isc::InvalidParameter In case name_data is NULL or data_len is
+ /// 0.
+ /// \throw std::bad_alloc In case allocation fails.
+ /// \note This constructor is specially designed for the use of master
+ /// file parser. It mimics the behaviour of names in the master file
+ /// and accepts raw data. It is not recommended to be used by anything
+ /// else.
+ /// \todo Should we make it private and the parser a friend, to hide the
+ /// constructor?
+ Name(const char* name_data, size_t data_len, const Name* origin,
+ bool downcase = false);
+
/// Constructor from wire-format %data.
///
/// The \c buffer parameter normally stores a complete DNS message
More information about the bind10-changes
mailing list