resolver.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. This file is part of GNUnet.
  3. Copyright (C) 2009, 2012 GNUnet e.V.
  4. GNUnet is free software: you can redistribute it and/or modify it
  5. under the terms of the GNU Affero General Public License as published
  6. by the Free Software Foundation, either version 3 of the License,
  7. or (at your option) any later version.
  8. GNUnet is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Affero General Public License for more details.
  12. You should have received a copy of the GNU Affero General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. SPDX-License-Identifier: AGPL3.0-or-later
  15. */
  16. /**
  17. * @author Christian Grothoff
  18. * @file util/resolver.h
  19. */
  20. #ifndef RESOLVER_H
  21. #define RESOLVER_H
  22. #include "gnunet_common.h"
  23. GNUNET_NETWORK_STRUCT_BEGIN
  24. /**
  25. * Request for the resolver. Followed by either the "struct sockaddr"
  26. * or the 0-terminated hostname.
  27. *
  28. * The response will be one or more messages of type
  29. * RESOLVER_RESPONSE, each with the message header immediately
  30. * followed by the requested data (0-terminated hostname or struct
  31. * in[6]_addr, depending on direction). The last RESOLVER_RESPONSE
  32. * will just be a header without any data (used to indicate the end of
  33. * the list).
  34. */
  35. struct GNUNET_RESOLVER_GetMessage
  36. {
  37. /**
  38. * Type: #GNUNET_MESSAGE_TYPE_RESOLVER_REQUEST
  39. */
  40. struct GNUNET_MessageHeader header;
  41. /**
  42. * GNUNET_YES to get hostname from IP,
  43. * GNUNET_NO to get IP from hostname.
  44. */
  45. int32_t direction GNUNET_PACKED;
  46. /**
  47. * Address family to use (AF_INET, AF_INET6 or AF_UNSPEC).
  48. */
  49. int32_t af GNUNET_PACKED;
  50. /**
  51. * identifies the request and is contained in the response message. The
  52. * client has to match response to request by this identifier.
  53. */
  54. uint32_t client_id GNUNET_PACKED;
  55. /* followed by 0-terminated string for A/AAAA-lookup or
  56. by 'struct in_addr' / 'struct in6_addr' for reverse lookup */
  57. };
  58. struct GNUNET_RESOLVER_ResponseMessage
  59. {
  60. /**
  61. * Type: #GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE
  62. */
  63. struct GNUNET_MessageHeader header;
  64. /**
  65. * identifies the request this message responds to. The client
  66. * has to match response to request by this identifier.
  67. */
  68. uint32_t client_id GNUNET_PACKED;
  69. /* followed by 0-terminated string for response to a reverse lookup
  70. * or by 'struct in_addr' / 'struct in6_addr' for response to
  71. * A/AAAA-lookup
  72. */
  73. };
  74. GNUNET_NETWORK_STRUCT_END
  75. #endif