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