From: JINMEI Tatuya Date: Sat, 11 Feb 2012 03:42:14 +0000 (-0800) Subject: [1641] documentation update X-Git-Tag: trac2351_base~97^2~37^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8e98da42d48e5e847cd12debab6738c585db4740;p=thirdparty%2Fkea.git [1641] documentation update --- diff --git a/src/lib/dns/rdata/generic/detail/nsec_bitmap.h b/src/lib/dns/rdata/generic/detail/nsec_bitmap.h index fdb100c607..27a51666ba 100644 --- a/src/lib/dns/rdata/generic/detail/nsec_bitmap.h +++ b/src/lib/dns/rdata/generic/detail/nsec_bitmap.h @@ -24,14 +24,21 @@ namespace generic { namespace detail { namespace nsec { +/// \file +/// +/// This helper module provides some utilities that handle NSEC and NSEC3 +/// type bitmaps. The format and processing of the type bitmaps are generally +/// the same for these two RRs, so it would make sense to consolidate +/// the processing logic into a single implementation module. +/// +/// The functions defined here are essentially private and are only expected +/// to be called from the \c NSEC and \c NSEC3 class implementations. + /// \brief Check if a given "type bitmap" for NSEC/NSEC3 is valid. /// -/// This helper function checks given wire format data (stored in a +/// This function checks given wire format data (stored in a /// \c std::vector) is a valid type bitmaps used for the NSEC and NSEC3 RRs -/// according to RFC4034 and RFC5155. The validation logic is the same -/// for these two RRs, so a unified check function is provided. -/// This function is essentially private and is only expected to be called -/// from the \c NSEC and \c NSEC3 class implementations. +/// according to RFC4034 and RFC5155. /// /// \exception DNSMessageFORMERR The bitmap is not valid. /// @@ -42,10 +49,45 @@ namespace nsec { void checkRRTypeBitmaps(const char* const rrtype_name, const std::vector& typebits); +/// \brief Convert textual sequence of RR types into type bitmaps. +/// +/// This function extracts a sequence of strings, converts each sequence +/// into an RR type, and builds NSEC/NSEC3 type bitmaps with the corresponding +/// bits for the extracted types being on. The resulting bitmaps (which are +/// in the wire format according to RFC4034 and RFC5155) are stored in the +/// given vector. This function expects the given string stream ends with +/// the sequence. +/// +/// \exception InvalidRdataText The given input stream does not meet the +/// assumption (e.g. including invalid form of RR type, not ending with +/// an RR type string). +/// +/// \param rrtype_name Either "NSEC" or "NSEC3"; used as part of exception +/// messages. +/// \param iss Input stream that consists of a complete sequence of textual +/// RR types for which the corresponding bits are set. +/// \param typebits A placeholder for the resulting bitmaps. Expected to be +/// empty, but it's not checked. void buildBitmapsFromText(const char* const rrtype_name, std::istringstream& iss, std::vector& typebits); +/// \brief Convert type bitmaps to textual sequence of RR types. +/// +/// This function converts wire-format data of type bitmaps for NSEC/NSEC3 +/// into a sequence of corresponding RR type strings, and inserts them +/// into the given output stream with separating them by a single space +/// character. +/// +/// This function assumes the given bitmaps are valid in terms of RFC4034 +/// and RFC5155 (in practice, it assumes it's from a validly constructed +/// NSEC or NSEC3 object); if it detects a format error, it aborts the +/// program with assert(). +/// +/// \param typebits The type bitmaps in wire format. The size of vector +/// is the total length of the bitmaps. +/// \param oss The output stream to which the converted RR type sequence +/// are to be inserted. void bitmapsToText(const std::vector& typebits, std::ostringstream& oss); }