rehash.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /* GNU Guix --- Functional package management for GNU
  2. Copyright © 2020 Maxime Devos <maxime.devos@student.kuleuven.be>
  3. This file is part of GNU Guix.
  4. GNU Guix is free software; you can redistribute it and/or modify it
  5. under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or (at
  7. your option) any later version.
  8. GNU Guix 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
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. */
  14. #ifndef _GNUNET_REHASH_REHASH_H
  15. #define _GNUNET_REHASH_REHASH_H
  16. #include <gnunet/gnunet_time_lib.h>
  17. /* TODO: are response id's required?
  18. See GNUNET_DHT_*.
  19. TODO: replication level? */
  20. GNUNET_NETWORK_STRUCT_BEGIN
  21. /**
  22. * Message from client to rehash service to lookup hash->hash mappings
  23. */
  24. struct GNUNET_REHASH_GetMessage
  25. {
  26. /**
  27. * Header of type #GNUNET_MESSAGE_TYPE_REHASH_GET
  28. */
  29. struct GNUNET_MessageHeader header;
  30. uint32_t options; /* NBO, enum GNUNET_FS_SearchOptions */
  31. /**
  32. * Requested anonymity level, NBO
  33. */
  34. uint32_t anonymity_level;
  35. /**
  36. * Hash type to search with,
  37. * enum GNUNET_REHASH_Hash_Type in NBO.
  38. */
  39. uint32_t in_type;
  40. /**
  41. * Hash type to search for,
  42. * enum GNUNET_REHASH_Hash_Type in NBO.
  43. */
  44. uint32_t out_type;
  45. /**
  46. * Length of input hash, NBO
  47. */
  48. uint32_t input_length;
  49. /* Followed by input_length bytes */
  50. };
  51. /**
  52. * Message from rehash service to client to return hash->hash mappings
  53. */
  54. struct GNUNET_REHASH_ResultMessage
  55. {
  56. /**
  57. * Header of type #GNUNET_MESSAGE_TYPE_REHASH_RESULT
  58. */
  59. struct GNUNET_MessageHeader header;
  60. /**
  61. * When will this mapping expire?
  62. */
  63. struct GNUNET_TIME_AbsoluteNBO exp;
  64. /**
  65. * Length of output hash, in NBO
  66. */
  67. uint32_t output_length;
  68. /* Followed by output_length bytes */
  69. };
  70. /**
  71. * Message from client to rehash service to stop a hash->hash lookup
  72. * request
  73. */
  74. struct GNUNET_REHASH_GetStopMessage
  75. {
  76. /**
  77. * Header of type #GNUNET_MESSAGE_TYPE_REHASH_RESULT
  78. */
  79. struct GNUNET_MessageHeader header;
  80. };
  81. /**
  82. * Message from client to rehash service to insert a hash->hash
  83. * mapping
  84. */
  85. struct GNUNET_REHASH_PutMessage {
  86. struct GNUNET_MessageHeader header;
  87. struct GNUNET_TIME_AbsoluteNBO expiration_time;
  88. /** NBO */
  89. uint32_t anonymity_level;
  90. /** NBO */
  91. uint32_t content_priority;
  92. /** NBO */
  93. uint32_t replication_level;
  94. /**
  95. * Hash type to search with,
  96. * enum GNUNET_REHASH_Hash_Type in NBO.
  97. */
  98. uint32_t in_type;
  99. /**
  100. * Hash type to search for,
  101. * enum GNUNET_REHASH_Hash_Type in NBO.
  102. */
  103. uint32_t out_type;
  104. /**
  105. * Length of hash to search with, NBO
  106. */
  107. uint32_t input_length;
  108. /**
  109. * Length of hash to search for, NBO
  110. */
  111. uint32_t output_length;
  112. /* Followed by input_length bytes
  113. for the input hash, and output_length bytes
  114. for output hash */
  115. };
  116. GNUNET_NETWORK_STRUCT_END
  117. #endif