indent
[oweals/gnunet.git] / src / abd / abd.h
1 /*
2       This file is part of GNUnet
3       Copyright (C) 2012-2013 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  * @file abd/abd.h
22  * @brief IPC messages between ABD API and ABD service
23  * @author Martin Schanzenbach
24  */
25 #ifndef ABD_H
26 #define ABD_H
27
28 #include "gnunet_abd_service.h"
29
30 GNUNET_NETWORK_STRUCT_BEGIN
31
32 /**
33  * Message from client to Credential service to collect credentials.
34  */
35 struct CollectMessage
36 {
37   /**
38    * Header of type #GNUNET_MESSAGE_TYPE_ABD_VERIFY
39    */
40   struct GNUNET_MessageHeader header;
41
42   /**
43    * Subject public key
44    */
45   struct GNUNET_CRYPTO_EcdsaPrivateKey subject_key;
46
47   /**
48    * Trust anchor
49    */
50   struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
51
52   /**
53    * Length of the issuer attribute
54    */
55   uint16_t issuer_attribute_len;
56
57   /**
58    * Direction of the resolution algo
59    */
60   uint16_t resolution_algo;
61
62   /**
63    * Unique identifier for this request (for key collisions).
64    */
65   uint32_t id GNUNET_PACKED;
66
67   /* Followed by the zero-terminated attribute */
68 };
69
70
71 /**
72  * Message from client to Credential service to verify attributes.
73  */
74 struct VerifyMessage
75 {
76   /**
77    * Header of type #GNUNET_MESSAGE_TYPE_ABD_VERIFY
78    */
79   struct GNUNET_MessageHeader header;
80
81   /**
82    * Subject public key
83    */
84   struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
85
86   /**
87    * Trust anchor
88    */
89   struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
90
91   /**
92    * Number of delegates
93    */
94   uint32_t d_count;
95
96   /**
97    * Length of the issuer attribute
98    */
99   uint16_t issuer_attribute_len;
100
101   /**
102    * Direction of the resolution algo
103    */
104   uint16_t resolution_algo;
105
106   /**
107    * Unique identifier for this request (for key collisions).
108    */
109   uint32_t id GNUNET_PACKED;
110
111   /* Followed by the zero-terminated attribute and credentials to look up */
112 };
113
114
115 /**
116  * Message from ABD service to client: new results.
117  */
118 struct DelegationChainResultMessage
119 {
120   /**
121     * Header of type #GNUNET_MESSAGE_TYPE_ABD_VERIFY_RESULT
122    */
123   struct GNUNET_MessageHeader header;
124
125   /**
126    * Unique identifier for this request (for key collisions).
127    */
128   uint32_t id GNUNET_PACKED;
129
130   /**
131    * Indicates if credential has been found at all
132    */
133   uint32_t del_found GNUNET_PACKED;
134
135   /**
136    * The number of delegations in the response
137    */
138   uint32_t d_count GNUNET_PACKED;
139
140   /**
141    * The number of credentials in the response
142    */
143   uint32_t c_count GNUNET_PACKED;
144
145   /* followed by ad_count GNUNET_ABD_RecordData structs*/
146 };
147
148 /**
149  * Message from ABD service to client: new results.
150  */
151 struct DelegationChainIntermediateMessage
152 {
153   /**
154     * Header of type #GNUNET_MESSAGE_TYPE_ABD_INTERMEDIATE_RESULT
155    */
156   struct GNUNET_MessageHeader header;
157
158   /**
159    * Unique identifier for this request (for key collisions).
160    */
161   uint32_t id GNUNET_PACKED;
162
163   uint16_t is_bw GNUNET_PACKED;
164
165   uint32_t size GNUNET_PACKED;
166 };
167
168 struct DelegationRecordData
169 {
170   /**
171    * Subject key
172    */
173   struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
174
175   /**
176    * Subject attributes
177    */
178   uint32_t subject_attribute_len GNUNET_PACKED;
179 };
180
181
182 struct ChainEntry
183 {
184   /**
185    * Issuer key
186    */
187   struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
188
189   /**
190    * Subject key
191    */
192   struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
193
194   /**
195    * Issuer attributes
196    */
197   uint32_t issuer_attribute_len GNUNET_PACKED;
198
199   /**
200    * Subject attributes
201    */
202   uint32_t subject_attribute_len GNUNET_PACKED;
203 };
204
205
206 struct CredentialEntry
207 {
208
209   /**
210    * The signature for this credential by the issuer
211    */
212   struct GNUNET_CRYPTO_EcdsaSignature signature;
213
214   /**
215    * Signature meta
216    */
217   struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
218
219   /**
220    * Public key of the issuer
221    */
222   struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
223
224   /**
225    * Public key of the subject this credential was issued to
226    */
227   struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
228
229   /**
230    * Expiration time of this credential
231    */
232   uint64_t expiration GNUNET_PACKED;
233
234   /**
235    * Issuer attribute length
236    */
237   uint32_t issuer_attribute_len;
238
239   /**
240    * Followed by the attribute string
241    */
242 };
243
244 struct DelegateEntry
245 {
246
247   /**
248    * The signature for this credential by the issuer
249    */
250   struct GNUNET_CRYPTO_EcdsaSignature signature;
251
252   /**
253    * Signature meta
254    */
255   struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
256
257   /**
258    * Public key of the issuer
259    */
260   struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
261
262   /**
263    * Public key of the subject this credential was issued to
264    */
265   struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
266
267   /**
268    * Expiration time of this credential
269    */
270   uint64_t expiration GNUNET_PACKED;
271
272   /**
273    * Issuer subject attribute length
274    */
275   uint32_t issuer_attribute_len;
276
277   /**
278    * Issuer attribute length
279    */
280   uint32_t subject_attribute_len;
281
282   /**
283    * Followed by the subject attribute string
284    */
285 };
286
287
288 GNUNET_NETWORK_STRUCT_END
289
290 #endif