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