tolerate additional IPv4 address now available for gnunet.org
[oweals/gnunet.git] / src / reclaim / reclaim.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2016 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
18      SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21 /**
22  * @author Martin Schanzenbach
23  * @file reclaim/reclaim.h
24  *
25  * @brief Common type definitions for the identity provider
26  *        service and API.
27  */
28 #ifndef RECLAIM_H
29 #define RECLAIM_H
30
31 #include "gnunet_common.h"
32
33
34 GNUNET_NETWORK_STRUCT_BEGIN
35
36
37 /**
38  * Use to store an identity attribute
39  */
40 struct AttributeStoreMessage
41 {
42   /**
43    * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT
44    */
45   struct GNUNET_MessageHeader header;
46
47   /**
48    * Unique identifier for this request (for key collisions).
49    */
50   uint32_t id GNUNET_PACKED;
51
52   /**
53    * The length of the attribute
54    */
55   uint32_t attr_len GNUNET_PACKED;
56
57   /**
58    * The expiration interval of the attribute
59    */
60   uint64_t exp GNUNET_PACKED;
61
62   /**
63    * Identity
64    */
65   struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
66
67   /* followed by the serialized attribute */
68 };
69
70
71 /**
72  * Use to delete an identity attribute
73  */
74 struct AttributeDeleteMessage
75 {
76   /**
77    * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT
78    */
79   struct GNUNET_MessageHeader header;
80
81   /**
82    * Unique identifier for this request (for key collisions).
83    */
84   uint32_t id GNUNET_PACKED;
85
86   /**
87    * The length of the attribute
88    */
89   uint32_t attr_len GNUNET_PACKED;
90
91   /**
92    * Identity
93    */
94   struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
95
96   /* followed by the serialized attribute */
97 };
98
99
100 /**
101  * Attribute store/delete response message
102  */
103 struct SuccessResultMessage
104 {
105   /**
106    * Message header
107    */
108   struct GNUNET_MessageHeader header;
109
110   /**
111    * Unique identifier for this request (for key collisions).
112    */
113   uint32_t id GNUNET_PACKED;
114
115   /**
116    * #GNUNET_SYSERR on failure, #GNUNET_OK on success
117    */
118   int32_t op_result GNUNET_PACKED;
119 };
120
121 /**
122  * Attribute is returned from the idp.
123  */
124 struct AttributeResultMessage
125 {
126   /**
127    * Message header
128    */
129   struct GNUNET_MessageHeader header;
130
131   /**
132    * Unique identifier for this request (for key collisions).
133    */
134   uint32_t id GNUNET_PACKED;
135
136   /**
137    * Length of serialized attribute data
138    */
139   uint16_t attr_len GNUNET_PACKED;
140
141   /**
142    * always zero (for alignment)
143    */
144   uint16_t reserved GNUNET_PACKED;
145
146   /**
147    * The public key of the identity.
148    */
149   struct GNUNET_CRYPTO_EcdsaPublicKey identity;
150
151   /* followed by:
152    * serialized attribute data
153    */
154 };
155
156
157 /**
158  * Start a attribute iteration for the given identity
159  */
160 struct AttributeIterationStartMessage
161 {
162   /**
163    * Message
164    */
165   struct GNUNET_MessageHeader header;
166
167   /**
168    * Unique identifier for this request (for key collisions).
169    */
170   uint32_t id GNUNET_PACKED;
171
172   /**
173    * Identity.
174    */
175   struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
176 };
177
178
179 /**
180  * Ask for next result of attribute iteration for the given operation
181  */
182 struct AttributeIterationNextMessage
183 {
184   /**
185    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT
186    */
187   struct GNUNET_MessageHeader header;
188
189   /**
190    * Unique identifier for this request (for key collisions).
191    */
192   uint32_t id GNUNET_PACKED;
193 };
194
195
196 /**
197  * Stop attribute iteration for the given operation
198  */
199 struct AttributeIterationStopMessage
200 {
201   /**
202    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP
203    */
204   struct GNUNET_MessageHeader header;
205
206   /**
207    * Unique identifier for this request (for key collisions).
208    */
209   uint32_t id GNUNET_PACKED;
210 };
211
212 /**
213  * Start a ticket iteration for the given identity
214  */
215 struct TicketIterationStartMessage
216 {
217   /**
218    * Message
219    */
220   struct GNUNET_MessageHeader header;
221
222   /**
223    * Unique identifier for this request (for key collisions).
224    */
225   uint32_t id GNUNET_PACKED;
226
227   /**
228    * Identity.
229    */
230   struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
231 };
232
233
234 /**
235  * Ask for next result of ticket iteration for the given operation
236  */
237 struct TicketIterationNextMessage
238 {
239   /**
240    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT
241    */
242   struct GNUNET_MessageHeader header;
243
244   /**
245    * Unique identifier for this request (for key collisions).
246    */
247   uint32_t id GNUNET_PACKED;
248 };
249
250
251 /**
252  * Stop ticket iteration for the given operation
253  */
254 struct TicketIterationStopMessage
255 {
256   /**
257    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP
258    */
259   struct GNUNET_MessageHeader header;
260
261   /**
262    * Unique identifier for this request (for key collisions).
263    */
264   uint32_t id GNUNET_PACKED;
265 };
266
267
268 /**
269  * Ticket issue message
270  */
271 struct IssueTicketMessage
272 {
273   /**
274    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET
275    */
276   struct GNUNET_MessageHeader header;
277
278   /**
279    * Unique identifier for this request (for key collisions).
280    */
281   uint32_t id GNUNET_PACKED;
282
283   /**
284    * Identity.
285    */
286   struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
287
288   /**
289    * Requesting party.
290    */
291   struct GNUNET_CRYPTO_EcdsaPublicKey rp;
292
293   /**
294    * length of serialized attribute list
295    */
296   uint32_t attr_len GNUNET_PACKED;
297
298   // Followed by a serialized attribute list
299 };
300
301 /**
302  * Ticket revoke message
303  */
304 struct RevokeTicketMessage
305 {
306   /**
307    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET
308    */
309   struct GNUNET_MessageHeader header;
310
311   /**
312    * Unique identifier for this request (for key collisions).
313    */
314   uint32_t id GNUNET_PACKED;
315
316   /**
317    * Identity.
318    */
319   struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
320
321   /**
322    * length of serialized attribute list
323    */
324   uint32_t attrs_len GNUNET_PACKED;
325
326   // Followed by a ticket and serialized attribute list
327 };
328
329 /**
330  * Ticket revoke message
331  */
332 struct RevokeTicketResultMessage
333 {
334   /**
335    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT
336    */
337   struct GNUNET_MessageHeader header;
338
339   /**
340    * Unique identifier for this request (for key collisions).
341    */
342   uint32_t id GNUNET_PACKED;
343
344   /**
345    * Revocation result
346    */
347   uint32_t success GNUNET_PACKED;
348 };
349
350
351 /**
352  * Ticket result message
353  */
354 struct TicketResultMessage
355 {
356   /**
357    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT
358    */
359   struct GNUNET_MessageHeader header;
360
361   /**
362    * Unique identifier for this request (for key collisions).
363    */
364   uint32_t id GNUNET_PACKED;
365 };
366
367 /**
368  * Ticket consume message
369  */
370 struct ConsumeTicketMessage
371 {
372   /**
373    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET
374    */
375   struct GNUNET_MessageHeader header;
376
377   /**
378    * Unique identifier for this request (for key collisions).
379    */
380   uint32_t id GNUNET_PACKED;
381
382   /**
383    * Identity.
384    */
385   struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
386
387   // Followed by a serialized ticket
388 };
389
390 /**
391  * Attribute list is returned from the idp.
392  */
393 struct ConsumeTicketResultMessage
394 {
395   /**
396    * Message header
397    */
398   struct GNUNET_MessageHeader header;
399
400   /**
401    * Unique identifier for this request (for key collisions).
402    */
403   uint32_t id GNUNET_PACKED;
404
405   /**
406    * Result
407    */
408   uint32_t result GNUNET_PACKED;
409
410   /**
411    * Length of serialized attribute data
412    */
413   uint16_t attrs_len GNUNET_PACKED;
414
415   /**
416    * always zero (for alignment)
417    */
418   uint16_t reserved GNUNET_PACKED;
419
420   /**
421    * The public key of the identity.
422    */
423   struct GNUNET_CRYPTO_EcdsaPublicKey identity;
424
425   /* followed by:
426    * serialized attributes data
427    */
428 };
429
430
431 GNUNET_NETWORK_STRUCT_END
432
433 #endif