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