BIND 10 #2096: Define and implement `RdataIterator` class

BIND 10 Development do-not-reply at isc.org
Fri Jun 29 08:59:58 UTC 2012


#2096: Define and implement `RdataIterator` class
-------------------------------------+-------------------------------------
            Reporter:  jinmei        |                        Owner:
                Type:  task          |                       Status:  new
            Priority:  medium        |                    Milestone:  Next-
           Component:  data source   |  Sprint-Proposed
           Sensitive:  0             |                     Keywords:
         Sub-Project:  DNS           |              Defect Severity:  N/A
Estimated Difficulty:  0             |  Feature Depending on Ticket:
         Total Hours:  0             |  scalable inmemory
                                     |          Add Hours to Ticket:  0
                                     |                    Internal?:  0
-------------------------------------+-------------------------------------
 This is different from the generic iterator defined in libdns++.
 It provides lightweight (efficient) interface for the user to iterate
 over RDATA (and RRSIG RDATA) encoded in memory.  Like `RdataEncoder`
 class, it doesn't necessarily have to be this way, but for reference,
 this is what I'd do based on my experiment:

 {{{#!cpp
 class RdataIterator {
 public:
     // functor called for each "Name" field.  the second parameter is
     // its attributes (compresible or not, needing additional handling
     // or not)
     typedef boost::function<void(const LabelSequence&, unsigned int)>
 NameAction;
     // functor called for each "Data" field.  Just wire-format data
     // will be passed.
     typedef boost::function<void(const uint8_t*, size_t)> DataAction;

     // constructor.  caller specifies the RR type, # of RDATA, and
     // the entry pointer to the encoded data.  It passes callback
     // functors.  Note: we should probably also pass RRClass.
     // Also, it would be nice if we can begin with an arbitrary
     // count of RDATA (starting from the 2nd one instead of 1st, etc)
     // so we can use it for RR rotation in the answer section.
     // but that would be a future extension.
     RdataIterator(dns::RRType type, uint16_t n_rdata,
                   const uint8_t* encoded_data,
                   NameAction name_action, DataAction data_action);

     // iterate over RDATA fields of the "current" RDATA and call the
     // callback functor for each field, then move to the next RDATA
     void action();
     bool isLast() const;

    // We'll need RRSIG RDATA version of these, too.
 };
 }}}

 Depend on #2094.

-- 
Ticket URL: <http://bind10.isc.org/ticket/2096>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list