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