cache_entry_key.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 CACHE_ENTRY_KEY_H
  15. #define CACHE_ENTRY_KEY_H
  16. #include <string>
  17. #include <dns/name.h>
  18. #include <dns/rrtype.h>
  19. namespace isc {
  20. namespace cache {
  21. /// \brief Entry Name Generation Functions
  22. ///
  23. /// Generate the name for message/rrset entries.
  24. ///
  25. /// Concatenates the string representation of the Name and the
  26. /// string representation of the type number.
  27. ///
  28. /// Note: the returned name is a text string, not wire format.
  29. /// eg. if name is 'example.com.', type is 'A', the return
  30. /// value is 'example.com.1'
  31. ///
  32. /// \param name The Name to create a text entry for
  33. /// \param type The RRType to create a text entry for
  34. /// \return return the entry name.
  35. const std::string
  36. genCacheEntryName(const isc::dns::Name& name, const isc::dns::RRType& type);
  37. ///
  38. /// \overload
  39. ///
  40. /// \param namestr A string representation of a DNS Name
  41. /// \param type The value of a DNS RRType
  42. const std::string
  43. genCacheEntryName(const std::string& namestr, const uint16_t type);
  44. } // namespace cache
  45. } // namespace isc
  46. #endif // CACHE_ENTRY_KEY_H