RECLAIM: Refactoring
[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_EcdsaPrivateKey identity;
205
206 };
207
208
209 /**
210  * Ask for next result of ticket iteration for the given operation
211  */
212 struct TicketIterationNextMessage
213 {
214   /**
215    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT
216    */
217   struct GNUNET_MessageHeader header;
218
219   /**
220    * Unique identifier for this request (for key collisions).
221    */
222   uint32_t id GNUNET_PACKED;
223
224 };
225
226
227 /**
228  * Stop ticket iteration for the given operation
229  */
230 struct TicketIterationStopMessage
231 {
232   /**
233    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP
234    */
235   struct GNUNET_MessageHeader header;
236
237   /**
238    * Unique identifier for this request (for key collisions).
239    */
240   uint32_t id GNUNET_PACKED;
241
242 };
243
244
245
246 /**
247  * Ticket issue message
248  */
249 struct IssueTicketMessage
250 {
251   /**
252    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET
253    */
254   struct GNUNET_MessageHeader header;
255
256   /**
257    * Unique identifier for this request (for key collisions).
258    */
259   uint32_t id GNUNET_PACKED;
260
261   /**
262    * Identity.
263    */
264   struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
265
266   /**
267    * Requesting party.
268    */
269   struct GNUNET_CRYPTO_EcdsaPublicKey rp;
270
271   /**
272    * length of serialized attribute list
273    */
274   uint32_t attr_len GNUNET_PACKED;
275
276   //Followed by a serialized attribute list
277 };
278
279 /**
280  * Ticket revoke message
281  */
282 struct RevokeTicketMessage
283 {
284   /**
285    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET
286    */
287   struct GNUNET_MessageHeader header;
288
289   /**
290    * Unique identifier for this request (for key collisions).
291    */
292   uint32_t id GNUNET_PACKED;
293
294   /**
295    * Identity.
296    */
297   struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
298
299   /**
300    * length of serialized attribute list
301    */
302   uint32_t attrs_len GNUNET_PACKED;
303
304   //Followed by a ticket and serialized attribute list
305 };
306
307 /**
308  * Ticket revoke message
309  */
310 struct RevokeTicketResultMessage
311 {
312   /**
313    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT
314    */
315   struct GNUNET_MessageHeader header;
316
317   /**
318    * Unique identifier for this request (for key collisions).
319    */
320   uint32_t id GNUNET_PACKED;
321
322   /**
323    * Revocation result
324    */
325   uint32_t success GNUNET_PACKED;
326 };
327
328
329 /**
330  * Ticket result message
331  */
332 struct TicketResultMessage
333 {
334   /**
335    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_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
346 /**
347  * Ticket consume message
348  */
349 struct ConsumeTicketMessage
350 {
351   /**
352    * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET
353    */
354   struct GNUNET_MessageHeader header;
355
356   /**
357    * Unique identifier for this request (for key collisions).
358    */
359   uint32_t id GNUNET_PACKED;
360
361   /**
362    * Identity.
363    */
364   struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
365
366   //Followed by a serialized ticket
367 };
368
369 /**
370  * Attribute list is returned from the idp.
371  */
372 struct ConsumeTicketResultMessage
373 {
374   /**
375    * Message header
376    */
377   struct GNUNET_MessageHeader header;
378
379    /**
380    * Unique identifier for this request (for key collisions).
381    */
382   uint32_t id GNUNET_PACKED;
383
384   /**
385    * Result
386    */
387   uint32_t result GNUNET_PACKED;
388
389   /**
390    * Length of serialized attribute data
391    */
392   uint16_t attrs_len GNUNET_PACKED;
393
394   /**
395    * always zero (for alignment)
396    */
397   uint16_t reserved GNUNET_PACKED;
398
399   /**
400    * The public key of the identity.
401    */
402   struct GNUNET_CRYPTO_EcdsaPublicKey identity;
403
404   /* followed by:
405    * serialized attributes data
406    */
407 };
408
409
410
411 GNUNET_NETWORK_STRUCT_END
412
413 #endif