/contrib/bind9/lib/dns/rdata/generic/proforma.c

https://bitbucket.org/freebsd/freebsd-head/ · C · 190 lines · 122 code · 49 blank · 19 comment · 41 complexity · 165896952f86269e49a4bc49f8844108 MD5 · raw file

  1. /*
  2. * Copyright (C) 2004, 2007, 2009 Internet Systems Consortium, Inc. ("ISC")
  3. * Copyright (C) 1998-2002 Internet Software Consortium.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  10. * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  11. * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  12. * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  13. * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  14. * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. * PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. /* $Id: proforma.c,v 1.38 2009/12/04 22:06:37 tbox Exp $ */
  18. #ifndef RDATA_GENERIC_#_#_C
  19. #define RDATA_GENERIC_#_#_C
  20. #define RRTYPE_#_ATTRIBUTES (0)
  21. static inline isc_result_t
  22. fromtext_#(ARGS_FROMTEXT) {
  23. isc_token_t token;
  24. REQUIRE(type == #);
  25. REQUIRE(rdclass == #);
  26. RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
  27. ISC_FALSE));
  28. return (ISC_R_NOTIMPLEMENTED);
  29. }
  30. static inline isc_result_t
  31. totext_#(ARGS_TOTEXT) {
  32. REQUIRE(rdata->type == #);
  33. REQUIRE(rdata->rdclass == #);
  34. REQUIRE(rdata->length != 0); /* XXX */
  35. return (ISC_R_NOTIMPLEMENTED);
  36. }
  37. static inline isc_result_t
  38. fromwire_#(ARGS_FROMWIRE) {
  39. REQUIRE(type == #);
  40. REQUIRE(rdclass == #);
  41. /* NONE or GLOBAL14 */
  42. dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
  43. return (ISC_R_NOTIMPLEMENTED);
  44. }
  45. static inline isc_result_t
  46. towire_#(ARGS_TOWIRE) {
  47. REQUIRE(rdata->type == #);
  48. REQUIRE(rdata->rdclass == #);
  49. REQUIRE(rdata->length != 0); /* XXX */
  50. /* NONE or GLOBAL14 */
  51. dns_compress_setmethods(cctx, DNS_COMPRESS_NONE);
  52. return (ISC_R_NOTIMPLEMENTED);
  53. }
  54. static inline int
  55. compare_#(ARGS_COMPARE) {
  56. isc_region_t r1;
  57. isc_region_t r2;
  58. REQUIRE(rdata1->type == rdata2->type);
  59. REQUIRE(rdata1->rdclass == rdata2->rdclass);
  60. REQUIRE(rdata1->type == #);
  61. REQUIRE(rdata1->rdclass == #);
  62. REQUIRE(rdata1->length != 0); /* XXX */
  63. REQUIRE(rdata2->length != 0); /* XXX */
  64. dns_rdata_toregion(rdata1, &r1);
  65. dns_rdata_toregion(rdata2, &r2);
  66. return (isc_region_compare(&r1, &r2));
  67. }
  68. static inline isc_result_t
  69. fromstruct_#(ARGS_FROMSTRUCT) {
  70. dns_rdata_#_t *# = source;
  71. REQUIRE(type == #);
  72. REQUIRE(rdclass == #);
  73. REQUIRE(source != NULL);
  74. REQUIRE(#->common.rdtype == type);
  75. REQUIRE(#->common.rdclass == rdclass);
  76. return (ISC_R_NOTIMPLEMENTED);
  77. }
  78. static inline isc_result_t
  79. tostruct_#(ARGS_TOSTRUCT) {
  80. REQUIRE(rdata->type == #);
  81. REQUIRE(rdata->rdclass == #);
  82. REQUIRE(rdata->length != 0); /* XXX */
  83. return (ISC_R_NOTIMPLEMENTED);
  84. }
  85. static inline void
  86. freestruct_#(ARGS_FREESTRUCT) {
  87. dns_rdata_#_t *# = source;
  88. REQUIRE(source != NULL);
  89. REQUIRE(#->common.rdtype == #);
  90. REQUIRE(#->common.rdclass == #);
  91. }
  92. static inline isc_result_t
  93. additionaldata_#(ARGS_ADDLDATA) {
  94. REQUIRE(rdata->type == #);
  95. REQUIRE(rdata->rdclass == #);
  96. (void)add;
  97. (void)arg;
  98. return (ISC_R_SUCCESS);
  99. }
  100. static inline isc_result_t
  101. digest_#(ARGS_DIGEST) {
  102. isc_region_t r;
  103. REQUIRE(rdata->type == #);
  104. REQUIRE(rdata->rdclass == #);
  105. dns_rdata_toregion(rdata, &r);
  106. return ((digest)(arg, &r));
  107. }
  108. static inline isc_boolean_t
  109. checkowner_#(ARGS_CHECKOWNER) {
  110. REQUIRE(type == #);
  111. REQUIRE(rdclass == #);
  112. UNUSED(name);
  113. UNUSED(type);
  114. UNUSED(rdclass);
  115. UNUSED(wildcard);
  116. return (ISC_TRUE);
  117. }
  118. static inline isc_boolean_t
  119. checknames_#(ARGS_CHECKNAMES) {
  120. REQUIRE(rdata->type == #);
  121. REQUIRE(rdata->rdclass == #);
  122. UNUSED(rdata);
  123. UNUSED(owner);
  124. UNUSED(bad);
  125. return (ISC_TRUE);
  126. }
  127. static inline int
  128. casecompare_#(ARGS_COMPARE) {
  129. isc_region_t r1;
  130. isc_region_t r2;
  131. REQUIRE(rdata1->type == rdata2->type);
  132. REQUIRE(rdata1->rdclass == rdata2->rdclass);
  133. REQUIRE(rdata1->type == #);
  134. REQUIRE(rdata1->rdclass == #);
  135. REQUIRE(rdata1->length != 0); /* XXX */
  136. REQUIRE(rdata2->length != 0); /* XXX */
  137. dns_rdata_toregion(rdata1, &r1);
  138. dns_rdata_toregion(rdata2, &r2);
  139. return (isc_region_compare(&r1, &r2));
  140. }
  141. #endif /* RDATA_GENERIC_#_#_C */