psyc/social: local join flag; social service: leave place, save _file
[oweals/gnunet.git] / src / social / social.h
1 /*
2  * This file is part of GNUnet
3  * Copyright (C) 2013 Christian Grothoff (and other contributing authors)
4  *
5  * GNUnet is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published
7  * by the Free Software Foundation; either version 3, or (at your
8  * 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  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with GNUnet; see the file COPYING.  If not, write to the
17  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20
21 /**
22  * @file social/social.h
23  * @brief Common type definitions for the Social service and API.
24  * @author Gabor X Toth
25  */
26
27 #ifndef SOCIAL_H
28 #define SOCIAL_H
29
30 #include "platform.h"
31 #include "gnunet_social_service.h"
32
33 enum MessageState
34 {
35   MSG_STATE_START    = 0,
36   MSG_STATE_HEADER   = 1,
37   MSG_STATE_METHOD   = 2,
38   MSG_STATE_MODIFIER = 3,
39   MSG_STATE_MOD_CONT = 4,
40   MSG_STATE_DATA     = 5,
41   MSG_STATE_END      = 6,
42   MSG_STATE_CANCEL   = 7,
43   MSG_STATE_ERROR    = 8,
44 };
45
46
47 GNUNET_NETWORK_STRUCT_BEGIN
48
49 /**** library -> service ****/
50
51
52 struct AppConnectRequest
53 {
54   /**
55    * Type: GNUNET_MESSAGE_TYPE_SOCIAL_APP_CONNECT
56    */
57   struct GNUNET_MessageHeader header;
58
59   /* Followed by char *app_id */
60 };
61
62
63 struct AppDetachRequest
64 {
65   /**
66    * Type: GNUNET_MESSAGE_TYPE_SOCIAL_APP_DETACH
67    */
68   struct GNUNET_MessageHeader header;
69
70   /**
71    * Public key of place.
72    */
73   struct GNUNET_CRYPTO_EddsaPublicKey place_pub_key;
74
75   /**
76    * Operation ID.
77    */
78   uint64_t op_id GNUNET_PACKED;
79
80 };
81
82
83 struct HostEnterRequest
84 {
85   /**
86    * Type: GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER
87    */
88   struct GNUNET_MessageHeader header;
89
90   uint32_t policy GNUNET_PACKED;
91
92   struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key;
93
94   struct GNUNET_CRYPTO_EddsaPublicKey place_pub_key;
95
96   struct GNUNET_CRYPTO_EddsaPrivateKey place_key;
97
98   /* Followed by char *app_id */
99 };
100
101
102 struct GuestEnterRequest
103 {
104   /**
105    * Type: GNUNET_MESSAGE_TYPE_SOCIAL_GUEST_ENTER
106    */
107   struct GNUNET_MessageHeader header;
108
109   uint32_t relay_count GNUNET_PACKED;
110
111   struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key;
112
113   struct GNUNET_CRYPTO_EddsaPublicKey place_pub_key;
114
115   struct GNUNET_PeerIdentity origin;
116
117   uint32_t flags GNUNET_PACKED;
118
119   /* Followed by char *app_id */
120   /* Followed by struct GNUNET_PeerIdentity relays[relay_count] */
121   /* Followed by struct GNUNET_MessageHeader *join_msg */
122 };
123
124
125 /** Compatible parts of HostEnterRequest and GuestEnterRequest */
126 struct PlaceEnterRequest
127 {
128   struct GNUNET_MessageHeader header;
129
130   uint32_t reserved GNUNET_PACKED;
131
132   struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key;
133
134   struct GNUNET_CRYPTO_EddsaPublicKey place_pub_key;
135 };
136
137
138 struct EgoPlacePublicKey
139 {
140   struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key;
141   struct GNUNET_CRYPTO_EddsaPublicKey place_pub_key;
142 };
143
144
145 struct GuestEnterByNameRequest
146 {
147   /**
148    * Type: GNUNET_MESSAGE_TYPE_SOCIAL_GUEST_ENTER_BY_NAME
149    */
150   struct GNUNET_MessageHeader header;
151
152   struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key;
153
154   /* Followed by char *app_id */
155   /* Followed by char *gns_name */
156   /* Followed by char *password */
157   /* Followed by struct GNUNET_MessageHeader *join_msg */
158 };
159
160
161 struct ZoneAddPlaceRequest
162 {
163   struct GNUNET_MessageHeader header;
164
165   uint32_t relay_count GNUNET_PACKED;
166
167   /**
168    * Operation ID.
169    */
170   uint64_t op_id;
171
172   /**
173    * Expiration time: absolute value in us.
174    */
175   uint64_t expiration_time;
176
177   struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key;
178
179   struct GNUNET_CRYPTO_EddsaPublicKey place_pub_key;
180
181   struct GNUNET_PeerIdentity origin;
182
183   /* Followed by const char *name */
184   /* Followed by const char *password */
185   /* Followed by  struct GNUNET_PeerIdentity *relays[relay_count] */
186 };
187
188
189 struct ZoneAddNymRequest
190 {
191   struct GNUNET_MessageHeader header;
192
193   /**
194    * Operation ID.
195    */
196   uint64_t op_id;
197
198   /**
199    * Expiration time: absolute value in us.
200    */
201   uint64_t expiration_time;
202
203   struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key;
204
205   struct GNUNET_CRYPTO_EcdsaPublicKey nym_pub_key;
206
207   /* Followed by const char *name */
208 };
209
210 /**** service -> library ****/
211
212
213 struct AppEgoMessage
214 {
215   /**
216    * Type: GNUNET_MESSAGE_TYPE_SOCIAL_APP_EGO
217    */
218   struct GNUNET_MessageHeader header;
219
220   /**
221    * Public key of ego.
222    */
223   struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key;
224
225   /* Followed by char *name */
226 };
227
228
229 struct AppPlaceMessage
230 {
231   /**
232    * Type: GNUNET_MESSAGE_TYPE_SOCIAL_APP_PLACE
233    */
234   struct GNUNET_MessageHeader header;
235
236   struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key;
237
238   struct GNUNET_CRYPTO_EddsaPublicKey place_pub_key;
239
240   uint8_t is_host;
241
242   uint8_t place_state;
243 };
244
245
246 struct HostEnterAck {
247   /**
248    * Type: GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER_ACK
249    */
250   struct GNUNET_MessageHeader header;
251
252   /**
253    * Status code for the operation.
254    */
255   uint32_t result_code GNUNET_PACKED;
256
257   /**
258    * Last message ID sent to the channel.
259    */
260   uint64_t max_message_id GNUNET_PACKED;
261
262   /**
263    * Public key of the place.
264    */
265   struct GNUNET_CRYPTO_EddsaPublicKey place_pub_key;
266 };
267
268
269 #if REMOVE
270 struct NymEnterRequest
271 {
272   /**
273    * Type: GNUNET_MESSAGE_TYPE_SOCIAL_NYM_ENTER
274    */
275   struct GNUNET_MessageHeader header;
276
277   /**
278    * Public key of the joining slave.
279    */
280   struct GNUNET_CRYPTO_EcdsaPublicKey nym_key;
281
282   /* Followed by struct GNUNET_MessageHeader join_request */
283 };
284 #endif
285
286
287 GNUNET_NETWORK_STRUCT_END
288
289 #endif