You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

179 lines
3.6 KiB

  1. /*
  2. * This file is part of GNUnet
  3. * Copyright (C) 2013 GNUnet e.V.
  4. *
  5. * GNUnet is free software: you can redistribute it and/or modify it
  6. * under the terms of the GNU Affero General Public License as published
  7. * by the Free Software Foundation, either version 3 of the License,
  8. * or (at your option) any later version.
  9. *
  10. * GNUnet is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Affero General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Affero General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. SPDX-License-Identifier: AGPL3.0-or-later
  18. */
  19. /**
  20. * @file psyc/psyc.h
  21. * @brief Common type definitions for the PSYC service and API.
  22. * @author Gabor X Toth
  23. */
  24. #ifndef PSYC_H
  25. #define PSYC_H
  26. #include "platform.h"
  27. #include "gnunet_psyc_service.h"
  28. int
  29. GNUNET_PSYC_check_message_parts (uint16_t data_size, const char *data,
  30. uint16_t *first_ptype, uint16_t *last_ptype);
  31. void
  32. GNUNET_PSYC_log_message (enum GNUNET_ErrorType kind,
  33. const struct GNUNET_MessageHeader *msg);
  34. enum MessageState
  35. {
  36. MSG_STATE_START = 0,
  37. MSG_STATE_HEADER = 1,
  38. MSG_STATE_METHOD = 2,
  39. MSG_STATE_MODIFIER = 3,
  40. MSG_STATE_MOD_CONT = 4,
  41. MSG_STATE_DATA = 5,
  42. MSG_STATE_END = 6,
  43. MSG_STATE_CANCEL = 7,
  44. MSG_STATE_ERROR = 8,
  45. };
  46. enum MessageFragmentState
  47. {
  48. MSG_FRAG_STATE_START = 0,
  49. MSG_FRAG_STATE_HEADER = 1,
  50. MSG_FRAG_STATE_DATA = 2,
  51. MSG_FRAG_STATE_END = 3,
  52. MSG_FRAG_STATE_CANCEL = 4,
  53. MSG_FRAG_STATE_DROP = 5,
  54. };
  55. GNUNET_NETWORK_STRUCT_BEGIN
  56. /**** library -> service ****/
  57. struct MasterStartRequest
  58. {
  59. /**
  60. * Type: GNUNET_MESSAGE_TYPE_PSYC_MASTER_START
  61. */
  62. struct GNUNET_MessageHeader header;
  63. uint32_t policy GNUNET_PACKED;
  64. struct GNUNET_CRYPTO_EddsaPrivateKey channel_key;
  65. };
  66. struct SlaveJoinRequest
  67. {
  68. /**
  69. * Type: GNUNET_MESSAGE_TYPE_PSYC_SLAVE_JOIN
  70. */
  71. struct GNUNET_MessageHeader header;
  72. uint32_t relay_count GNUNET_PACKED;
  73. struct GNUNET_CRYPTO_EddsaPublicKey channel_pub_key;
  74. struct GNUNET_CRYPTO_EcdsaPrivateKey slave_key;
  75. struct GNUNET_PeerIdentity origin;
  76. uint32_t flags GNUNET_PACKED;
  77. /* Followed by struct GNUNET_PeerIdentity relays[relay_count] */
  78. /* Followed by struct GNUNET_MessageHeader join_msg */
  79. };
  80. struct ChannelMembershipStoreRequest
  81. {
  82. /**
  83. * Type: GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_MEMBERSHIP_STORE
  84. */
  85. struct GNUNET_MessageHeader header;
  86. uint32_t reserved GNUNET_PACKED;
  87. uint64_t op_id GNUNET_PACKED;
  88. struct GNUNET_CRYPTO_EcdsaPublicKey slave_pub_key;
  89. uint64_t announced_at GNUNET_PACKED;
  90. uint64_t effective_since GNUNET_PACKED;
  91. uint8_t did_join;
  92. };
  93. struct HistoryRequest
  94. {
  95. /**
  96. * Type: GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_HISTORY_REQUEST
  97. */
  98. struct GNUNET_MessageHeader header;
  99. uint32_t reserved GNUNET_PACKED;
  100. /**
  101. * ID for this operation.
  102. */
  103. uint64_t op_id GNUNET_PACKED;
  104. uint64_t start_message_id GNUNET_PACKED;
  105. uint64_t end_message_id GNUNET_PACKED;
  106. uint64_t message_limit GNUNET_PACKED;
  107. };
  108. struct StateRequest
  109. {
  110. /**
  111. * Types:
  112. * - GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_STATE_GET
  113. * - GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_STATE_GET_PREFIX
  114. */
  115. struct GNUNET_MessageHeader header;
  116. uint32_t reserved GNUNET_PACKED;
  117. /**
  118. * ID for this operation.
  119. */
  120. uint64_t op_id GNUNET_PACKED;
  121. /* Followed by NUL-terminated name. */
  122. };
  123. /**** service -> library ****/
  124. GNUNET_NETWORK_STRUCT_END
  125. #endif