NULL pointer fix
[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   /**
327    * The ticket to revoke
328    */
329   struct GNUNET_RECLAIM_Ticket ticket;
330 };
331
332 /**
333  * Ticket revoke message
334  */
335 struct RevokeTicketResultMessage
336 {
337   /**
338    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT
339    */
340   struct GNUNET_MessageHeader header;
341
342   /**
343    * Unique identifier for this request (for key collisions).
344    */
345   uint32_t id GNUNET_PACKED;
346
347   /**
348    * Revocation result
349    */
350   uint32_t success GNUNET_PACKED;
351 };
352
353
354 /**
355  * Ticket result message
356  */
357 struct TicketResultMessage
358 {
359   /**
360    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT
361    */
362   struct GNUNET_MessageHeader header;
363
364   /**
365    * Unique identifier for this request (for key collisions).
366    */
367   uint32_t id GNUNET_PACKED;
368
369   /**
370    * The new ticket
371    */
372   struct GNUNET_RECLAIM_Ticket ticket;
373 };
374
375 /**
376  * Ticket consume message
377  */
378 struct ConsumeTicketMessage
379 {
380   /**
381    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET
382    */
383   struct GNUNET_MessageHeader header;
384
385   /**
386    * Unique identifier for this request (for key collisions).
387    */
388   uint32_t id GNUNET_PACKED;
389
390   /**
391    * Identity.
392    */
393   struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
394
395   /**
396    * The ticket to consume
397    */
398   struct GNUNET_RECLAIM_Ticket ticket;
399 };
400
401 /**
402  * Attribute list is returned from the idp.
403  */
404 struct ConsumeTicketResultMessage
405 {
406   /**
407    * Message header
408    */
409   struct GNUNET_MessageHeader header;
410
411   /**
412    * Unique identifier for this request (for key collisions).
413    */
414   uint32_t id GNUNET_PACKED;
415
416   /**
417    * Result
418    */
419   uint32_t result GNUNET_PACKED;
420
421   /**
422    * Length of serialized attribute data
423    */
424   uint16_t attrs_len GNUNET_PACKED;
425
426   /**
427    * always zero (for alignment)
428    */
429   uint16_t reserved GNUNET_PACKED;
430
431   /**
432    * The public key of the identity.
433    */
434   struct GNUNET_CRYPTO_EcdsaPublicKey identity;
435
436   /* followed by:
437    * serialized attributes data
438    */
439 };
440
441
442 GNUNET_NETWORK_STRUCT_END
443
444 #endif