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.
 
 
 
 

293 lines
5.5 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 social/social.h
  21. * @brief Common type definitions for the Social service and API.
  22. * @author Gabor X Toth
  23. */
  24. #ifndef SOCIAL_H
  25. #define SOCIAL_H
  26. #include <gnunet/platform.h>
  27. #include "gnunet_social_service.h"
  28. enum MessageState
  29. {
  30. MSG_STATE_START = 0,
  31. MSG_STATE_HEADER = 1,
  32. MSG_STATE_METHOD = 2,
  33. MSG_STATE_MODIFIER = 3,
  34. MSG_STATE_MOD_CONT = 4,
  35. MSG_STATE_DATA = 5,
  36. MSG_STATE_END = 6,
  37. MSG_STATE_CANCEL = 7,
  38. MSG_STATE_ERROR = 8,
  39. };
  40. GNUNET_NETWORK_STRUCT_BEGIN
  41. /**** library -> service ****/
  42. struct AppConnectRequest
  43. {
  44. /**
  45. * Type: GNUNET_MESSAGE_TYPE_SOCIAL_APP_CONNECT
  46. */
  47. struct GNUNET_MessageHeader header;
  48. /* Followed by char *app_id */
  49. };
  50. struct AppDetachRequest
  51. {
  52. /**
  53. * Type: GNUNET_MESSAGE_TYPE_SOCIAL_APP_DETACH
  54. */
  55. struct GNUNET_MessageHeader header;
  56. /**
  57. * Public key of place.
  58. */
  59. struct GNUNET_CRYPTO_EddsaPublicKey place_pub_key;
  60. /**
  61. * Public key of ego.
  62. */
  63. struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key;
  64. /**
  65. * Operation ID.
  66. */
  67. uint64_t op_id GNUNET_PACKED;
  68. };
  69. struct MsgProcRequest
  70. {
  71. /**
  72. * Type: GNUNET_MESSAGE_TYPE_SOCIAL_MSG_PROC_SET
  73. */
  74. struct GNUNET_MessageHeader header;
  75. /**
  76. * @see enum GNUNET_SOCIAL_MsgProcFlags
  77. */
  78. uint32_t flags;
  79. /* Followed by char *method_prefix */
  80. };
  81. struct HostEnterRequest
  82. {
  83. /**
  84. * Type: GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER
  85. */
  86. struct GNUNET_MessageHeader header;
  87. uint32_t policy GNUNET_PACKED;
  88. struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key;
  89. struct GNUNET_CRYPTO_EddsaPublicKey place_pub_key;
  90. struct GNUNET_CRYPTO_EddsaPrivateKey place_key;
  91. /* Followed by char *app_id */
  92. };
  93. struct GuestEnterRequest
  94. {
  95. /**
  96. * Type: GNUNET_MESSAGE_TYPE_SOCIAL_GUEST_ENTER
  97. */
  98. struct GNUNET_MessageHeader header;
  99. uint32_t relay_count GNUNET_PACKED;
  100. struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key;
  101. struct GNUNET_CRYPTO_EddsaPublicKey place_pub_key;
  102. struct GNUNET_PeerIdentity origin;
  103. uint32_t flags GNUNET_PACKED;
  104. /* Followed by char *app_id */
  105. /* Followed by struct GNUNET_PeerIdentity relays[relay_count] */
  106. /* Followed by struct GNUNET_MessageHeader *join_msg */
  107. };
  108. /** Compatible parts of HostEnterRequest and GuestEnterRequest */
  109. struct PlaceEnterRequest
  110. {
  111. struct GNUNET_MessageHeader header;
  112. uint32_t reserved GNUNET_PACKED;
  113. struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key;
  114. struct GNUNET_CRYPTO_EddsaPublicKey place_pub_key;
  115. };
  116. struct EgoPlacePublicKey
  117. {
  118. struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key;
  119. struct GNUNET_CRYPTO_EddsaPublicKey place_pub_key;
  120. };
  121. struct GuestEnterByNameRequest
  122. {
  123. /**
  124. * Type: GNUNET_MESSAGE_TYPE_SOCIAL_GUEST_ENTER_BY_NAME
  125. */
  126. struct GNUNET_MessageHeader header;
  127. struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key;
  128. /* Followed by char *app_id */
  129. /* Followed by char *gns_name */
  130. /* Followed by char *password */
  131. /* Followed by struct GNUNET_MessageHeader *join_msg */
  132. };
  133. struct ZoneAddPlaceRequest
  134. {
  135. struct GNUNET_MessageHeader header;
  136. uint32_t relay_count GNUNET_PACKED;
  137. /**
  138. * Operation ID.
  139. */
  140. uint64_t op_id;
  141. /**
  142. * Expiration time: absolute value in us.
  143. */
  144. uint64_t expiration_time;
  145. struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key;
  146. struct GNUNET_CRYPTO_EddsaPublicKey place_pub_key;
  147. struct GNUNET_PeerIdentity origin;
  148. /* Followed by const char *name */
  149. /* Followed by const char *password */
  150. /* Followed by struct GNUNET_PeerIdentity *relays[relay_count] */
  151. };
  152. struct ZoneAddNymRequest
  153. {
  154. struct GNUNET_MessageHeader header;
  155. /**
  156. * Operation ID.
  157. */
  158. uint64_t op_id;
  159. /**
  160. * Expiration time: absolute value in us.
  161. */
  162. uint64_t expiration_time;
  163. struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key;
  164. struct GNUNET_CRYPTO_EcdsaPublicKey nym_pub_key;
  165. /* Followed by const char *name */
  166. };
  167. /**** service -> library ****/
  168. struct AppEgoMessage
  169. {
  170. /**
  171. * Type: GNUNET_MESSAGE_TYPE_SOCIAL_APP_EGO
  172. */
  173. struct GNUNET_MessageHeader header;
  174. /**
  175. * Public key of ego.
  176. */
  177. struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key;
  178. /* Followed by char *name */
  179. };
  180. struct AppPlaceMessage
  181. {
  182. /**
  183. * Type: GNUNET_MESSAGE_TYPE_SOCIAL_APP_PLACE
  184. */
  185. struct GNUNET_MessageHeader header;
  186. struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key;
  187. struct GNUNET_CRYPTO_EddsaPublicKey place_pub_key;
  188. uint8_t is_host;
  189. uint8_t place_state;
  190. };
  191. struct HostEnterAck {
  192. /**
  193. * Type: GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER_ACK
  194. */
  195. struct GNUNET_MessageHeader header;
  196. /**
  197. * Status code for the operation.
  198. */
  199. uint32_t result_code GNUNET_PACKED;
  200. /**
  201. * Last message ID sent to the channel.
  202. */
  203. uint64_t max_message_id GNUNET_PACKED;
  204. /**
  205. * Public key of the place.
  206. */
  207. struct GNUNET_CRYPTO_EddsaPublicKey place_pub_key;
  208. };
  209. GNUNET_NETWORK_STRUCT_END
  210. #endif