/contrib/bind9/lib/dns/include/dns/portlist.h

https://bitbucket.org/freebsd/freebsd-head/ · C Header · 101 lines · 18 code · 12 blank · 71 comment · 0 complexity · 19de1cc0a0a5838903ee4957a8402f09 MD5 · raw file

  1. /*
  2. * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
  3. * Copyright (C) 2003 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: portlist.h,v 1.9 2007/06/19 23:47:17 tbox Exp $ */
  18. /*! \file dns/portlist.h */
  19. #include <isc/lang.h>
  20. #include <isc/net.h>
  21. #include <isc/types.h>
  22. #include <dns/types.h>
  23. ISC_LANG_BEGINDECLS
  24. isc_result_t
  25. dns_portlist_create(isc_mem_t *mctx, dns_portlist_t **portlistp);
  26. /*%<
  27. * Create a port list.
  28. *
  29. * Requires:
  30. *\li 'mctx' to be valid.
  31. *\li 'portlistp' to be non NULL and '*portlistp' to be NULL;
  32. *
  33. * Returns:
  34. *\li #ISC_R_SUCCESS
  35. *\li #ISC_R_NOMEMORY
  36. *\li #ISC_R_UNEXPECTED
  37. */
  38. isc_result_t
  39. dns_portlist_add(dns_portlist_t *portlist, int af, in_port_t port);
  40. /*%<
  41. * Add the given <port,af> tuple to the portlist.
  42. *
  43. * Requires:
  44. *\li 'portlist' to be valid.
  45. *\li 'af' to be AF_INET or AF_INET6
  46. *
  47. * Returns:
  48. *\li #ISC_R_SUCCESS
  49. *\li #ISC_R_NOMEMORY
  50. */
  51. void
  52. dns_portlist_remove(dns_portlist_t *portlist, int af, in_port_t port);
  53. /*%<
  54. * Remove the given <port,af> tuple to the portlist.
  55. *
  56. * Requires:
  57. *\li 'portlist' to be valid.
  58. *\li 'af' to be AF_INET or AF_INET6
  59. */
  60. isc_boolean_t
  61. dns_portlist_match(dns_portlist_t *portlist, int af, in_port_t port);
  62. /*%<
  63. * Find the given <port,af> tuple to the portlist.
  64. *
  65. * Requires:
  66. *\li 'portlist' to be valid.
  67. *\li 'af' to be AF_INET or AF_INET6
  68. *
  69. * Returns
  70. * \li #ISC_TRUE if the tuple is found, ISC_FALSE otherwise.
  71. */
  72. void
  73. dns_portlist_attach(dns_portlist_t *portlist, dns_portlist_t **portlistp);
  74. /*%<
  75. * Attach to a port list.
  76. *
  77. * Requires:
  78. *\li 'portlist' to be valid.
  79. *\li 'portlistp' to be non NULL and '*portlistp' to be NULL;
  80. */
  81. void
  82. dns_portlist_detach(dns_portlist_t **portlistp);
  83. /*%<
  84. * Detach from a port list.
  85. *
  86. * Requires:
  87. *\li '*portlistp' to be valid.
  88. */
  89. ISC_LANG_ENDDECLS