nsec_bitmap.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright (C) 2011 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. #include <stdint.h>
  15. #include <vector>
  16. namespace isc {
  17. namespace dns {
  18. namespace rdata {
  19. namespace generic {
  20. namespace detail {
  21. namespace nsec {
  22. /// Check if a given "type bitmap" for NSEC/NSEC3 is valid.
  23. ///
  24. /// This helper function checks given wire format data (stored in a
  25. /// \c std::vector) is a valid type bitmaps used for the NSEC and NSEC3 RRs
  26. /// according to RFC4034 and RFC5155. The validation logic is the same
  27. /// for these two RRs, so a unified check function is provided.
  28. /// This function is essentially private and is only expected to be called
  29. /// from the \c NSEC and \c NSEC3 class implementations.
  30. ///
  31. /// \exception DNSMessageFORMERR The bitmap is not valid.
  32. ///
  33. /// \param rrtype_name Either "NSEC" or "NSEC3"; used as part of exception
  34. /// messages.
  35. /// \param typebits The type bitmaps in wire format. The size of vector
  36. /// is the total length of the bitmaps.
  37. void checkRRTypeBitmaps(const char* const rrtype_name,
  38. const std::vector<uint8_t>& typebits);
  39. }
  40. }
  41. }
  42. }
  43. }
  44. }
  45. // Local Variables:
  46. // mode: c++
  47. // End: