rrparamregistry.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. // Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. #ifndef RRPARAMREGISTRY_H
  15. #define RRPARAMREGISTRY_H 1
  16. #include <string>
  17. #include <stdint.h>
  18. #include <boost/shared_ptr.hpp>
  19. #include <exceptions/exceptions.h>
  20. #include <dns/rdata.h>
  21. namespace isc {
  22. namespace dns {
  23. // forward declarations
  24. struct RRParamRegistryImpl;
  25. ///
  26. /// \brief A standard DNS module exception that is thrown if a new RR type is
  27. /// being registered with a different type string.
  28. ///
  29. class RRTypeExists : public Exception {
  30. public:
  31. RRTypeExists(const char* file, size_t line, const char* what) :
  32. isc::Exception(file, line, what) {}
  33. };
  34. ///
  35. /// \brief A standard DNS module exception that is thrown if a new RR class is
  36. /// being registered with a different type string.
  37. ///
  38. class RRClassExists : public Exception {
  39. public:
  40. RRClassExists(const char* file, size_t line, const char* what) :
  41. isc::Exception(file, line, what) {}
  42. };
  43. namespace rdata {
  44. /// \brief The \c AbstractRdataFactory class is an abstract base class to
  45. /// encapsulate a set of Rdata factory methods in a polymorphic way.
  46. ///
  47. /// An external developers who want to introduce a new or experimental RR type
  48. /// are expected to define a corresponding derived class of \c
  49. /// AbstractRdataFactory and register it via \c RRParamRegistry.
  50. ///
  51. /// For other users of this API normally do not have to care about this class
  52. /// or its derived classes; this class is generally intended to be used
  53. /// as an internal utility of the API implementation.
  54. class AbstractRdataFactory {
  55. ///
  56. /// \name Constructors and Destructor
  57. ///
  58. //@{
  59. protected:
  60. /// The default constructor
  61. ///
  62. /// This is intentionally defined as \c protected as this base class should
  63. /// never be instantiated (except as part of a derived class).
  64. AbstractRdataFactory() {}
  65. public:
  66. /// The destructor.
  67. virtual ~AbstractRdataFactory() {};
  68. //@}
  69. ///
  70. /// \name Factory methods for polymorphic creation.
  71. ///
  72. //@{
  73. /// \brief Create RDATA from a string.
  74. ///
  75. /// This method creates from a string an \c Rdata object of specific class
  76. /// corresponding to the specific derived class of \c AbstractRdataFactory.
  77. ///
  78. /// \param rdata_str A string of textual representation of the \c Rdata.
  79. /// \return An \c RdataPtr object pointing to the created \c Rdata object.
  80. virtual RdataPtr create(const std::string& rdata_str) const = 0;
  81. /// \brief Create RDATA from wire-format data.
  82. ///
  83. /// This method creates from wire-format binary data an \c Rdata object
  84. /// of specific class corresponding to the specific derived class of
  85. /// \c AbstractRdataFactory.
  86. ///
  87. /// \param buffer A reference to an \c InputBuffer object storing the
  88. /// \c Rdata to parse.
  89. /// \param rdata_len The length in buffer of the \c Rdata. In bytes.
  90. /// \return An \c RdataPtr object pointing to the created \c Rdata object.
  91. virtual RdataPtr create(isc::util::InputBuffer& buffer, size_t rdata_len) const = 0;
  92. /// \brief Create RDATA from another \c Rdata object of the same type.
  93. ///
  94. /// This method creates an \c Rdata object of specific class corresponding
  95. /// to the specific derived class of \c AbstractRdataFactory, copying the
  96. /// content of the given \c Rdata, \c source.
  97. ///
  98. /// \c source must be an object of the concrete derived class corresponding
  99. /// to the specific derived class of \c AbstractRdataFactory;
  100. /// otherwise, an exception of class \c std::bad_cast will be thrown.
  101. ///
  102. /// \param source A reference to an \c Rdata object whose content is to
  103. /// be copied to the created \c Rdata object.
  104. /// \return An \c RdataPtr object pointing to the created \c Rdata object.
  105. virtual RdataPtr create(const rdata::Rdata& source) const = 0;
  106. /// \brief Create RDATA using MasterLexer.
  107. ///
  108. /// This version of the method defines the entry point of factory
  109. /// of a specific RR type and class for \c RRParamRegistry::createRdata()
  110. /// that uses \c MasterLexer. See its description for the expected
  111. /// behavior and meaning of the parameters.
  112. ///
  113. /// \note Right now this is not defined as a pure virtual method and
  114. /// provides the default implementation. This is an intermediate
  115. /// workaround until we implement the underlying constructor for all
  116. /// supported \c Rdata classes; once it's completed the workaround
  117. /// default implementation should be removed and this method should become
  118. /// pure virtual.
  119. virtual RdataPtr create(MasterLexer& lexer, const Name* origin,
  120. MasterLoader::Options options,
  121. MasterLoaderCallbacks& callbacks) const;
  122. //@}
  123. };
  124. ///
  125. /// The \c RdataFactoryPtr type is a pointer-like type, pointing to an
  126. /// object of some concrete derived class of \c AbstractRdataFactory.
  127. ///
  128. typedef boost::shared_ptr<AbstractRdataFactory> RdataFactoryPtr;
  129. } // end of namespace rdata
  130. ///
  131. /// The \c RRParamRegistry class represents a registry of parameters to
  132. /// manipulate DNS resource records (RRs).
  133. ///
  134. /// A \c RRParamRegistry class object stores a mapping between RR types or
  135. /// classes and their textual representations. It will also have knowledge of
  136. /// how to create an RDATA object for a specific pair of RR type and class
  137. /// (not implemented in this version).
  138. ///
  139. /// Normal applications that only handle standard DNS protocols won't have to
  140. /// care about this class. This is mostly an internal class to the DNS library
  141. /// to manage standard parameters. Some advanced applications may still need
  142. /// to use this class explicitly. For example, if an application wants to
  143. /// define and use an experimental non-standard RR type, it may want to register
  144. /// related protocol parameters for its convenience. This class is designed to
  145. /// allow such usage without modifying the library source code or rebuilding
  146. /// the library.
  147. ///
  148. /// It is assumed that at most one instance of this class can exist so that
  149. /// the application uses the consistent set of registered parameters. To ensure
  150. /// this, this class is designed and implemented as a "singleton class": the
  151. /// constructor is intentionally private, and applications must get access to
  152. /// the single instance via the \c getRegistry() static member function.
  153. ///
  154. /// In the current implementation, access to the singleton \c RRParamRegistry
  155. /// object is not thread safe.
  156. /// The application should ensure that multiple threads don't race in the
  157. /// first invocation of \c getRegistry(), and, if the registry needs to
  158. /// be changed dynamically, read and write operations are performed
  159. /// exclusively.
  160. /// Since this class should be static in common usage this restriction would
  161. /// be acceptable in practice.
  162. /// In the future, we may extend the implementation so that multiple threads can
  163. /// get access to the registry fully concurrently without any restriction.
  164. ///
  165. /// Note: the implementation of this class is incomplete: we should at least
  166. /// add RDATA related parameters. This will be done in a near future version,
  167. /// at which point some of method signatures will be changed.
  168. class RRParamRegistry {
  169. ///
  170. /// \name Constructors and Destructor
  171. ///
  172. /// These are intentionally hidden (see the class description).
  173. //@{
  174. private:
  175. RRParamRegistry();
  176. RRParamRegistry(const RRParamRegistry& orig);
  177. ~RRParamRegistry();
  178. //@}
  179. public:
  180. ///
  181. /// \brief Return the singleton instance of \c RRParamRegistry.
  182. ///
  183. /// This method is a unified access point to the singleton instance of
  184. /// the RR parameter registry (\c RRParamRegistry).
  185. /// On first invocation it internally constructs an instance of the
  186. /// \c RRParamRegistry class and returns a reference to it.
  187. /// This is a static object inside this method and will remain valid
  188. /// throughout the rest of the application lifetime.
  189. /// On subsequent calls this method simply returns a reference to the
  190. /// singleton object.
  191. ///
  192. /// If resource allocation fails in the first invocation,
  193. /// a corresponding standard exception will be thrown.
  194. /// This method never fails otherwise. In particular, this method
  195. /// doesn't throw an exception once the singleton instance is constructed.
  196. ///
  197. /// \return A reference to the singleton instance of \c RRParamRegistry.
  198. static RRParamRegistry& getRegistry();
  199. ///
  200. /// \name Registry Update Methods
  201. ///
  202. //@{
  203. ///
  204. /// \brief Add a set of parameters for a pair of RR type and class.
  205. ///
  206. /// This method adds to the registry a specified set of RR parameters,
  207. /// including mappings between type/class codes and their textual
  208. /// representations.
  209. ///
  210. /// Regarding the mappings between textual representations and integer
  211. /// codes, this method behaves in the same way as \c addType() and
  212. /// \c addClass(). That is, it ignores any overriding attempt as
  213. /// long as the mapping is the same; otherwise the corresponding exception
  214. /// will be thrown.
  215. ///
  216. /// This method provides the strong exception guarantee: unless an
  217. /// exception is thrown the entire specified set of parameters must be
  218. /// stored in the registry; if this method throws an exception the
  219. /// registry will remain in the state before this method is called.
  220. ///
  221. /// \param type_string The textual representation of the RR type.
  222. /// \param type_code The integer code of the RR type.
  223. /// \param class_string The textual representation of the RR class.
  224. /// \param class_code The integer code of the RR class.
  225. /// \param rdata_factory An \c RdataFactoryPtr object pointing to a
  226. /// concrete RDATA factory.
  227. void add(const std::string& type_string, uint16_t type_code,
  228. const std::string& class_string, uint16_t class_code,
  229. rdata::RdataFactoryPtr rdata_factory);
  230. /// \brief Add a set of parameters for a class-independent RR type.
  231. ///
  232. /// This method behaves as exactly same as the other \c add method except
  233. /// that it handles class-independent types (such as NS, CNAME, or SOA).
  234. ///
  235. /// \param type_string The textual representation of the RR type.
  236. /// \param type_code The integer code of the RR type.
  237. /// \param rdata_factory An \c RdataFactoryPtr object pointing to a
  238. /// concrete RDATA factory.
  239. void add(const std::string& type_string, uint16_t type_code,
  240. rdata::RdataFactoryPtr rdata_factory);
  241. /// \brief Add mappings between RR type code and textual representation.
  242. ///
  243. /// This method adds a mapping from the type code of an RR to its textual
  244. /// representation and the reverse mapping in the registry.
  245. ///
  246. /// If the given RR type is already registered with the same textual
  247. /// representation, this method simply ignores the duplicate mapping;
  248. /// if the given type is registered and a new pair with a different
  249. /// textual representation is being added,an exception of class
  250. /// \c RRTypeExist will be thrown.
  251. /// To replace an existing mapping with a different textual representation,
  252. /// the existing one must be removed by the \c removeType() method
  253. /// beforehand.
  254. ///
  255. /// In addition, if resource allocation for the new mapping entries fails,
  256. /// a corresponding standard exception will be thrown.
  257. ///
  258. /// This method provides the strong exception guarantee: unless an exception
  259. /// is thrown the specified mappings must be stored in the registry
  260. /// (although it may be an already existing one) on completion of the
  261. /// method; if this method throws an exception the registry will remain
  262. /// in the state before this method is called.
  263. ///
  264. /// \param type_string The textual representation of the RR type.
  265. /// \param type_code The integer code of the RR type.
  266. /// \return \c true if a new mapping is added to the repository; \c false
  267. /// if the same mapping is already registered.
  268. bool addType(const std::string& type_string, uint16_t type_code);
  269. /// \brief Remove mappings between RR type code and textual representation
  270. /// for a given type.
  271. ///
  272. /// This method can safely be called whether or not the specified mappings
  273. /// exist in the registry. If not, this method simply ignores the attempt
  274. /// and returns \c false.
  275. ///
  276. /// This method never throws an exception.
  277. ///
  278. /// \param type_code The integer code of the RR type.
  279. /// \return \c true if mappings for the specified RR type exists and is
  280. /// removed; \c false if no such mapping is in the registry.
  281. bool removeType(uint16_t type_code);
  282. /// \brief Add mappings between RR class code and textual representation.
  283. ///
  284. /// This method adds a mapping from the class code of an RR to its textual
  285. /// representation and the reverse mapping in the registry.
  286. ///
  287. /// If the given RR class is already registered with the same textual
  288. /// representation, this method simply ignores the duplicate mapping;
  289. /// if the given class is registered and a new pair with a different
  290. /// textual representation is being added,an exception of class
  291. /// \c RRClassExist will be thrown.
  292. /// To replace an existing mapping with a different textual representation,
  293. /// the existing one must be removed by the \c removeClass() method
  294. /// beforehand.
  295. ///
  296. /// In addition, if resource allocation for the new mapping entries fails,
  297. /// a corresponding standard exception will be thrown.
  298. ///
  299. /// This method provides the strong exception guarantee: unless an exception
  300. /// is thrown the specified mappings must be stored in the registry
  301. /// (although it may be an already existing one) on completion of the
  302. /// method; if this method throws an exception the registry will remain
  303. /// in the state before this method is called.
  304. ///
  305. /// \param class_string The textual representation of the RR class.
  306. /// \param class_code The integer code of the RR class.
  307. /// \return \c true if a new mapping is added to the repository; \c false
  308. /// if the same mapping is already registered.
  309. bool addClass(const std::string& class_string, uint16_t class_code);
  310. /// \brief Remove mappings between RR class code and textual representation
  311. /// for a given class.
  312. ///
  313. /// This method can safely be called whether or not the specified mappings
  314. /// exist in the registry. If not, this method simply ignores the attempt
  315. /// and returns \c false.
  316. ///
  317. /// This method never throws an exception.
  318. ///
  319. /// \param class_code The integer code of the RR class.
  320. /// \return \c true if mappings for the specified RR type exists and is
  321. /// removed; \c false if no such mapping is in the registry.
  322. bool removeClass(uint16_t class_code);
  323. /// \brief Remove registered RDATA factory for the given pair of \c RRType
  324. /// and \c RRClass.
  325. ///
  326. /// This method can safely be called whether or not the specified factory
  327. /// object exist in the registry. If not, this method simply ignores the
  328. /// attempt and returns \c false.
  329. ///
  330. /// This method never throws an exception.
  331. ///
  332. /// \param rrtype An \c RRType object specifying the type/class pair.
  333. /// \param rrclass An \c RRClass object specifying the type/class pair.
  334. /// \return \c true if a factory object for the specified RR type/class
  335. /// pair exists and is removed; \c false if no such object is in the
  336. /// registry.
  337. bool removeRdataFactory(const RRType& rrtype, const RRClass& rrclass);
  338. /// \brief Remove registered RDATA factory for the given pair of \c RRType
  339. /// and \c RRClass.
  340. ///
  341. /// This method can safely be called whether or not the specified factory
  342. /// object exist in the registry. If not, this method simply ignores the
  343. /// attempt and returns \c false.
  344. ///
  345. /// This method never throws an exception.
  346. ///
  347. /// \param rrtype An \c RRType object specifying the type/class pair.
  348. /// \return \c true if a factory object for the specified RR type/class
  349. /// pair exists and is removed; \c false if no such object is in the
  350. /// registry.
  351. bool removeRdataFactory(const RRType& rrtype);
  352. //@}
  353. ///
  354. /// \name Parameter Conversion Methods
  355. ///
  356. //@{
  357. /// \brief Convert a textual representation of an RR type to the
  358. /// corresponding 16-bit integer code.
  359. ///
  360. /// This method searches the \c RRParamRegistry for the mapping from
  361. /// the given textual representation of RR type to the corresponding
  362. /// integer code. If a mapping is found, it returns true with the
  363. /// associated type code in \c type_code; otherwise, if the given
  364. /// string is in the form of "TYPEnnnn", it returns true with the
  365. /// corresponding number as the type code in \c type_code;
  366. /// otherwise, it returns false and \c type_code is untouched.
  367. ///
  368. /// It returns \c false and avoids throwing an exception in the case
  369. /// of an error to avoid the exception overhead in some situations.
  370. ///
  371. /// \param type_string The textual representation of the RR type.
  372. /// \param type_code Returns the RR type code in this argument.
  373. /// \return true if conversion is successful, false otherwise.
  374. bool textToTypeCode(const std::string& type_string,
  375. uint16_t& type_code) const;
  376. /// \brief Convert type code into its textual representation.
  377. ///
  378. /// This method searches the \c RRParamRegistry for the mapping from the
  379. /// given RR type code to its textual representation.
  380. /// If a mapping is found, it returns (a copy of) the associated string;
  381. /// otherwise, this method creates a new string in the form of "TYPEnnnn"
  382. /// where "nnnn" is the decimal representation of the type code, and
  383. /// returns the new string.
  384. ///
  385. /// If resource allocation for the returned string fails,
  386. /// a corresponding standard exception will be thrown.
  387. /// This method never fails otherwise.
  388. ///
  389. /// \param type_code The integer code of the RR type.
  390. /// \return A textual representation of the RR type for code \c type_code.
  391. std::string codeToTypeText(uint16_t type_code) const;
  392. /// \brief Convert a textual representation of an RR class to the
  393. /// corresponding 16-bit integer code.
  394. ///
  395. /// This method searches the \c RRParamRegistry for the mapping from
  396. /// the given textual representation of RR class to the
  397. /// corresponding integer code. If a mapping is found, it returns
  398. /// true with the associated class code in \c class_code; otherwise,
  399. /// if the given string is in the form of "CLASSnnnn", it returns
  400. /// true with the corresponding number as the class code in
  401. /// \c class_code; otherwise, it returns false and \c class_code is
  402. /// untouched.
  403. ///
  404. /// It returns \c false and avoids throwing an exception in the case
  405. /// of an error to avoid the exception overhead in some situations.
  406. ///
  407. /// \param class_string The textual representation of the RR class.
  408. /// \param class_code Returns the RR class code in this argument.
  409. /// \return true if conversion is successful, false otherwise.
  410. bool textToClassCode(const std::string& class_string,
  411. uint16_t& class_code) const;
  412. /// \brief Convert class code into its textual representation.
  413. ///
  414. /// This method searches the \c RRParamRegistry for the mapping from the
  415. /// given RR class code to its textual representation.
  416. /// If a mapping is found, it returns (a copy of) the associated string;
  417. /// otherwise, this method creates a new string in the form of "CLASSnnnn"
  418. /// where "nnnn" is the decimal representation of the class code, and
  419. /// returns the new string.
  420. ///
  421. /// If resource allocation for the returned string fails,
  422. /// a corresponding standard exception will be thrown.
  423. /// This method never fails otherwise.
  424. ///
  425. /// \param class_code The integer code of the RR class.
  426. /// \return A textual representation of the RR class for code \c class_code.
  427. std::string codeToClassText(uint16_t class_code) const;
  428. //@}
  429. ///
  430. /// \name RDATA Factories
  431. ///
  432. /// This set of methods provide a unified interface to create an
  433. /// \c rdata::Rdata object in a parameterized polymorphic way,
  434. /// that is, these methods take a pair of \c RRType and \c RRClass
  435. /// objects and data specific to that pair, and create an object of
  436. /// the corresponding concrete derived class of \c rdata::Rdata.
  437. ///
  438. /// These methods first search the \c RRParamRegistry for a factory
  439. /// method (a member of a concrete derived class of
  440. /// \c AbstractRdataFactory) for the given RR type and class pair.
  441. /// If the search fails, they then search for a factory method for
  442. /// the given type ignoring the class, in case a RRClass independent
  443. /// factory method is registered.
  444. /// If it still fails, these methods assume the RDATA is of an "unknown"
  445. /// type, and creates a new object by calling a constructor of the
  446. /// \c rdata::generic::Generic class.
  447. ///
  448. //@{
  449. /// \brief Create RDATA of a given pair of RR type and class from a string.
  450. ///
  451. /// This method creates from a string an \c Rdata object of the given pair
  452. /// of RR type and class.
  453. ///
  454. /// \param rrtype An \c RRType object specifying the type/class pair.
  455. /// \param rrclass An \c RRClass object specifying the type/class pair.
  456. /// \param rdata_string A string of textual representation of the \c Rdata.
  457. /// \return An \c rdata::RdataPtr object pointing to the created \c Rdata
  458. /// object.
  459. rdata::RdataPtr createRdata(const RRType& rrtype, const RRClass& rrclass,
  460. const std::string& rdata_string);
  461. /// \brief Create RDATA of a given pair of RR type and class from
  462. /// wire-format data.
  463. ///
  464. /// This method creates from wire-format binary data an \c Rdata object
  465. /// of the given pair of RR type and class.
  466. ///
  467. /// \param rrtype An \c RRType object specifying the type/class pair.
  468. /// \param rrclass An \c RRClass object specifying the type/class pair.
  469. /// \param buffer A reference to an \c InputBuffer object storing the
  470. /// \c Rdata to parse.
  471. /// \param len The length in buffer of the \c Rdata. In bytes.
  472. /// \return An \c rdata::RdataPtr object pointing to the created \c Rdata
  473. /// object.
  474. rdata::RdataPtr createRdata(const RRType& rrtype, const RRClass& rrclass,
  475. isc::util::InputBuffer& buffer, size_t len);
  476. /// \brief Create RDATA of a given pair of RR type and class, copying
  477. /// of another RDATA of same kind.
  478. ///
  479. /// This method creates an \c Rdata object of the given pair of
  480. /// RR type and class, copying the content of the given \c Rdata,
  481. /// \c source.
  482. ///
  483. /// \c source must be an object of the concrete derived class of
  484. /// \c rdata::Rdata for the given pair of RR type and class;
  485. /// otherwise, an exception of class \c std::bad_cast will be thrown.
  486. /// In case the \c RRParamRegistry doesn't have a factory method for
  487. /// the given pair and it is assumed to be of an "unknown" type,
  488. /// \c source must reference an object of class
  489. /// \c rdata::generic::Generic; otherwise, an exception of class
  490. /// \c std::bad_cast will be thrown.
  491. ///
  492. /// \param rrtype An \c RRType object specifying the type/class pair.
  493. /// \param rrclass An \c RRClass object specifying the type/class pair.
  494. /// \param source A reference to an \c rdata::Rdata object whose content
  495. /// is to be copied to the created \c rdata::Rdata object.
  496. /// \return An \c rdata::RdataPtr object pointing to the created
  497. /// \c rdata::Rdata object.
  498. rdata::RdataPtr createRdata(const RRType& rrtype, const RRClass& rrclass,
  499. const rdata::Rdata& source);
  500. /// \brief Create RDATA using MasterLexer
  501. ///
  502. /// This method is expected to be used as the underlying implementation
  503. /// of the same signature of \c rdata::createRdata(). One main
  504. /// difference is that this method is only responsible for constructing
  505. /// the Rdata; it doesn't update the lexer to reach the end of line or
  506. /// file or doesn't care about whether there's an extra (garbage) token
  507. /// after the textual RDATA representation. Another difference is that
  508. /// this method can throw on error and never returns a NULL pointer.
  509. ///
  510. /// For other details and parameters, see the description of
  511. /// \c rdata::createRdata().
  512. rdata::RdataPtr createRdata(const RRType& rrtype, const RRClass& rrclass,
  513. MasterLexer& lexer, const Name* origin,
  514. MasterLoader::Options options,
  515. MasterLoaderCallbacks& callbacks);
  516. //@}
  517. private:
  518. RRParamRegistryImpl* impl_;
  519. };
  520. }
  521. }
  522. #endif // RRPARAMREGISTRY_H
  523. // Local Variables:
  524. // mode: c++
  525. // End: