gns.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. This file is part of GNUnet
  3. Copyright (C) 2012-2020 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. * @file gns/gns.h
  18. * @brief IPC messages between GNS API and GNS service
  19. * @author Martin Schanzenbach
  20. */
  21. #ifndef GNS_H
  22. #define GNS_H
  23. #include "gnunet_gns_service.h"
  24. GNUNET_NETWORK_STRUCT_BEGIN
  25. /**
  26. * Message from client to GNS service to lookup records.
  27. */
  28. struct LookupMessage
  29. {
  30. /**
  31. * Header of type #GNUNET_MESSAGE_TYPE_GNS_LOOKUP
  32. */
  33. struct GNUNET_MessageHeader header;
  34. /**
  35. * Unique identifier for this request (for key collisions).
  36. */
  37. uint32_t id GNUNET_PACKED;
  38. /**
  39. * Zone that is to be used for lookup
  40. */
  41. struct GNUNET_IDENTITY_PublicKey zone;
  42. /**
  43. * Local options for where to look for results
  44. * (an `enum GNUNET_GNS_LocalOptions` in NBO).
  45. */
  46. int16_t options GNUNET_PACKED;
  47. /**
  48. * Recursion depth limit, i.e. how many more
  49. * GNS zones may be traversed during the resolution
  50. * of this name.
  51. */
  52. uint16_t recursion_depth_limit GNUNET_PACKED;
  53. /**
  54. * the type of record to look up
  55. */
  56. int32_t type GNUNET_PACKED;
  57. /* Followed by the zero-terminated name to look up */
  58. };
  59. /**
  60. * Message from GNS service to client: new results.
  61. */
  62. struct LookupResultMessage
  63. {
  64. /**
  65. * Header of type #GNUNET_MESSAGE_TYPE_GNS_LOOKUP_RESULT
  66. */
  67. struct GNUNET_MessageHeader header;
  68. /**
  69. * Unique identifier for this request (for key collisions).
  70. */
  71. uint32_t id GNUNET_PACKED;
  72. /**
  73. * The number of records contained in response. Zero for
  74. * NXDOMAIN (as GNS always returns all records, there is
  75. * no "NO DATA" case).
  76. */
  77. uint32_t rd_count GNUNET_PACKED;
  78. /* followed by rd_count GNUNET_GNSRECORD_Data structs*/
  79. };
  80. GNUNET_NETWORK_STRUCT_END
  81. #endif