BIND 10 #2497: introduce wrapper version of "from lexer" rdata factory

BIND 10 Development do-not-reply at isc.org
Fri Nov 30 21:42:05 UTC 2012


#2497: introduce wrapper version of "from lexer" rdata factory
-------------------------------------+-------------------------------------
            Reporter:  jinmei        |                        Owner:
                Type:  task          |  jinmei
            Priority:  medium        |                       Status:
           Component:  libdns++      |  reviewing
            Keywords:                |                    Milestone:
           Sensitive:  0             |  Sprint-20121204
         Sub-Project:  DNS           |                   Resolution:
Estimated Difficulty:  0             |                 CVSS Scoring:
         Total Hours:  0             |              Defect Severity:  N/A
                                     |  Feature Depending on Ticket:
                                     |  loadzone-ng
                                     |          Add Hours to Ticket:  0
                                     |                    Internal?:  0
-------------------------------------+-------------------------------------

Comment (by jinmei):

 '''gen-rdatacode.py.in'''

 - `new_rdatafactory_users` must be able to work pairs of RR type and
   RR class, not only for types (e.g. A/IN and A/CH are different types).
 - Also, please add a comment on what should be added
 `new_rdatafactory_users`
   to with an example:
 {{{#!python
 new_rdatafactory_users = []
 }}}
   No one except the original author can figure out what should be
   added to the list when a new type is supported unless they bother to
   read the code to understand how this list is used.

 '''rrparamregistry-placeholder.cc'''

 - not really for this particular task, but the repeated patter of
   code to identify the factory now look redundant duplicate:
 {{{#!cpp
     RdataFactoryMap::const_iterator found =
         impl_->rdata_factories.find(RRTypeClass(rrtype, rrclass));
     if (found != impl_->rdata_factories.end()) {
         return (found->second->create(PARAMETERS));
     }

     GenericRdataFactoryMap::const_iterator genfound =
         impl_->genericrdata_factories.find(rrtype);
     if (genfound != impl_->genericrdata_factories.end()) {
         return (genfound->second->create(PARAMETERS));
     }
 }}}
   I'm attaching a proposed diff to unify these.

 '''rdata_hinfo_unittest.cc'''

 - I suspect this is not a good example of bad input:
 {{{
 +    // Exceptions cause NULL to be returned.
 +    EXPECT_FALSE(test::createRdataUsingLexer(RRType::HINFO(),
 RRClass::IN(),
 +                                             "\"Pentium\"\"Linux\""));
 }}}
   With the generic lexer it would become valid (and BIND 9 would
   accept it too)

 '''rdata_txt_like_unittest.cc'''
 - I'd remove these cases:
 {{{#!cpp
     EXPECT_EQ(0, this->rdata_txt_like.compare(
         *test::createRdataUsingLexer(RRTYPE<TypeParam>(), RRClass::IN(),
                                      "Test String")));
     EXPECT_EQ(0, this->rdata_txt_like_empty.compare(
         *test::createRdataUsingLexer(RRTYPE<TypeParam>(), RRClass::IN(),
                                      "")));
 }}}
   they will soon result in different results with the generic lexer.

-- 
Ticket URL: <http://bind10.isc.org/ticket/2497#comment:17>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list