peerstore.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. This file is part of GNUnet
  3. Copyright (C) 2012-2013 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 peerstore/peerstore.h
  18. * @brief IPC messages
  19. * @author Omar Tarabai
  20. */
  21. #ifndef PEERSTORE_H_
  22. #define PEERSTORE_H_
  23. #include "gnunet_peerstore_service.h"
  24. GNUNET_NETWORK_STRUCT_BEGIN
  25. /**
  26. * Message carrying a PEERSTORE record message
  27. */
  28. struct StoreRecordMessage
  29. {
  30. /**
  31. * GNUnet message header
  32. */
  33. struct GNUNET_MessageHeader header;
  34. /**
  35. * #GNUNET_YES if peer id value set, #GNUNET_NO otherwise
  36. */
  37. uint16_t peer_set GNUNET_PACKED;
  38. /**
  39. * Size of the sub_system string
  40. * Allocated at position 0 after this struct
  41. */
  42. uint16_t sub_system_size GNUNET_PACKED;
  43. /**
  44. * Peer Identity
  45. */
  46. struct GNUNET_PeerIdentity peer;
  47. /**
  48. * Expiry time of entry
  49. */
  50. struct GNUNET_TIME_AbsoluteNBO expiry;
  51. /**
  52. * Size of the key string
  53. * Allocated at position 1 after this struct
  54. */
  55. uint16_t key_size GNUNET_PACKED;
  56. /**
  57. * Size of value blob
  58. * Allocated at position 2 after this struct
  59. */
  60. uint16_t value_size GNUNET_PACKED;
  61. /**
  62. * Options, needed only in case of a
  63. * store operation
  64. */
  65. uint32_t /* enum GNUNET_PEERSTORE_StoreOption */ options GNUNET_PACKED;
  66. /* Followed by key and value */
  67. };
  68. /**
  69. * Message carrying record key hash
  70. */
  71. struct StoreKeyHashMessage
  72. {
  73. /**
  74. * GNUnet message header
  75. */
  76. struct GNUNET_MessageHeader header;
  77. /**
  78. * Always 0, for alignment.
  79. */
  80. uint32_t reserved GNUNET_PACKED;
  81. /**
  82. * Hash of a record key
  83. */
  84. struct GNUNET_HashCode keyhash;
  85. };
  86. GNUNET_NETWORK_STRUCT_END
  87. #endif