-remove debug message
[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    * Length of serialized attestation data
143    */
144   uint16_t attestation_len GNUNET_PACKED;
145
146   /**
147    * always zero (for alignment)
148    */
149   uint16_t reserved GNUNET_PACKED;
150
151   /**
152    * The public key of the identity.
153    */
154   struct GNUNET_CRYPTO_EcdsaPublicKey identity;
155
156   /* followed by:
157    * serialized attribute data
158    */
159 };
160
161 /**
162  * Attestation is returned from the idp.
163  */
164 struct AttestationResultMessage
165 {
166   /**
167    * Message header
168    */
169   struct GNUNET_MessageHeader header;
170
171   /**
172    * Unique identifier for this request (for key collisions).
173    */
174   uint32_t id GNUNET_PACKED;
175
176   /**
177    * Length of serialized attribute data
178    */
179   uint16_t attestation_len GNUNET_PACKED;
180
181   /**
182    * always zero (for alignment)
183    */
184   uint16_t reserved GNUNET_PACKED;
185
186   /**
187    * The public key of the identity.
188    */
189   struct GNUNET_CRYPTO_EcdsaPublicKey identity;
190
191   /* followed by:
192    * serialized attestation data
193    */
194 };
195
196
197 /**
198  * Start a attribute iteration for the given identity
199  */
200 struct AttributeIterationStartMessage
201 {
202   /**
203    * Message
204    */
205   struct GNUNET_MessageHeader header;
206
207   /**
208    * Unique identifier for this request (for key collisions).
209    */
210   uint32_t id GNUNET_PACKED;
211
212   /**
213    * Identity.
214    */
215   struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
216 };
217
218
219 /**
220  * Ask for next result of attribute iteration for the given operation
221  */
222 struct AttributeIterationNextMessage
223 {
224   /**
225    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT
226    */
227   struct GNUNET_MessageHeader header;
228
229   /**
230    * Unique identifier for this request (for key collisions).
231    */
232   uint32_t id GNUNET_PACKED;
233 };
234
235
236 /**
237  * Start a attestation iteration for the given identity
238  */
239 struct AttestationIterationStartMessage
240 {
241   /**
242    * Message
243    */
244   struct GNUNET_MessageHeader header;
245
246   /**
247    * Unique identifier for this request (for key collisions).
248    */
249   uint32_t id GNUNET_PACKED;
250
251   /**
252    * Identity.
253    */
254   struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
255 };
256
257
258 /**
259  * Ask for next result of attestation iteration for the given operation
260  */
261 struct AttestationIterationNextMessage
262 {
263   /**
264    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT
265    */
266   struct GNUNET_MessageHeader header;
267
268   /**
269    * Unique identifier for this request (for key collisions).
270    */
271   uint32_t id GNUNET_PACKED;
272 };
273
274
275 /**
276  * Stop attestation iteration for the given operation
277  */
278 struct AttestationIterationStopMessage
279 {
280   /**
281    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP
282    */
283   struct GNUNET_MessageHeader header;
284
285   /**
286    * Unique identifier for this request (for key collisions).
287    */
288   uint32_t id GNUNET_PACKED;
289 };
290
291
292 /**
293  * Stop attribute iteration for the given operation
294  */
295 struct AttributeIterationStopMessage
296 {
297   /**
298    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP
299    */
300   struct GNUNET_MessageHeader header;
301
302   /**
303    * Unique identifier for this request (for key collisions).
304    */
305   uint32_t id GNUNET_PACKED;
306 };
307
308 /**
309  * Start a ticket iteration for the given identity
310  */
311 struct TicketIterationStartMessage
312 {
313   /**
314    * Message
315    */
316   struct GNUNET_MessageHeader header;
317
318   /**
319    * Unique identifier for this request (for key collisions).
320    */
321   uint32_t id GNUNET_PACKED;
322
323   /**
324    * Identity.
325    */
326   struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
327 };
328
329
330 /**
331  * Ask for next result of ticket iteration for the given operation
332  */
333 struct TicketIterationNextMessage
334 {
335   /**
336    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT
337    */
338   struct GNUNET_MessageHeader header;
339
340   /**
341    * Unique identifier for this request (for key collisions).
342    */
343   uint32_t id GNUNET_PACKED;
344 };
345
346
347 /**
348  * Stop ticket iteration for the given operation
349  */
350 struct TicketIterationStopMessage
351 {
352   /**
353    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP
354    */
355   struct GNUNET_MessageHeader header;
356
357   /**
358    * Unique identifier for this request (for key collisions).
359    */
360   uint32_t id GNUNET_PACKED;
361 };
362
363
364 /**
365  * Ticket issue message
366  */
367 struct IssueTicketMessage
368 {
369   /**
370    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET
371    */
372   struct GNUNET_MessageHeader header;
373
374   /**
375    * Unique identifier for this request (for key collisions).
376    */
377   uint32_t id GNUNET_PACKED;
378
379   /**
380    * Identity.
381    */
382   struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
383
384   /**
385    * Requesting party.
386    */
387   struct GNUNET_CRYPTO_EcdsaPublicKey rp;
388
389   /**
390    * length of serialized attribute list
391    */
392   uint32_t attr_len GNUNET_PACKED;
393
394   // Followed by a serialized attribute list
395 };
396
397 /**
398  * Ticket revoke message
399  */
400 struct RevokeTicketMessage
401 {
402   /**
403    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET
404    */
405   struct GNUNET_MessageHeader header;
406
407   /**
408    * Unique identifier for this request (for key collisions).
409    */
410   uint32_t id GNUNET_PACKED;
411
412   /**
413    * Identity.
414    */
415   struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
416
417   /**
418    * length of serialized attribute list
419    */
420   uint32_t attrs_len GNUNET_PACKED;
421
422   /**
423    * The ticket to revoke
424    */
425   struct GNUNET_RECLAIM_Ticket ticket;
426 };
427
428 /**
429  * Ticket revoke message
430  */
431 struct RevokeTicketResultMessage
432 {
433   /**
434    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT
435    */
436   struct GNUNET_MessageHeader header;
437
438   /**
439    * Unique identifier for this request (for key collisions).
440    */
441   uint32_t id GNUNET_PACKED;
442
443   /**
444    * Revocation result
445    */
446   uint32_t success GNUNET_PACKED;
447 };
448
449
450 /**
451  * Ticket result message
452  */
453 struct TicketResultMessage
454 {
455   /**
456    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT
457    */
458   struct GNUNET_MessageHeader header;
459
460   /**
461    * Unique identifier for this request (for key collisions).
462    */
463   uint32_t id GNUNET_PACKED;
464
465   /**
466    * The new ticket
467    */
468   struct GNUNET_RECLAIM_Ticket ticket;
469 };
470
471 /**
472  * Ticket consume message
473  */
474 struct ConsumeTicketMessage
475 {
476   /**
477    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET
478    */
479   struct GNUNET_MessageHeader header;
480
481   /**
482    * Unique identifier for this request (for key collisions).
483    */
484   uint32_t id GNUNET_PACKED;
485
486   /**
487    * Identity.
488    */
489   struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
490
491   /**
492    * The ticket to consume
493    */
494   struct GNUNET_RECLAIM_Ticket ticket;
495 };
496
497 /**
498  * Attribute list is returned from the idp.
499  */
500 struct ConsumeTicketResultMessage
501 {
502   /**
503    * Message header
504    */
505   struct GNUNET_MessageHeader header;
506
507   /**
508    * Unique identifier for this request (for key collisions).
509    */
510   uint32_t id GNUNET_PACKED;
511
512   /**
513    * Result
514    */
515   uint32_t result GNUNET_PACKED;
516
517   /**
518    * Length of serialized attribute data
519    */
520   uint16_t attrs_len GNUNET_PACKED;
521
522   /**
523    * Length of attestation data
524    */
525   uint16_t attestations_len;
526
527   /**
528    * always zero (for alignment)
529    */
530   uint16_t reserved GNUNET_PACKED;
531
532   /**
533    * The public key of the identity.
534    */
535   struct GNUNET_CRYPTO_EcdsaPublicKey identity;
536
537   /* followed by:
538    * serialized attributes data
539    */
540 };
541
542
543 GNUNET_NETWORK_STRUCT_END
544
545 #endif