global reindent, now with uncrustify hook enabled
[oweals/gnunet.git] / src / credential / credential.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 credential/credential.h
22  * @brief IPC messages between CREDENTIAL API and CREDENTIAL service
23  * @author Martin Schanzenbach
24  */
25 #ifndef CREDENTIAL_H
26 #define CREDENTIAL_H
27
28 #include "gnunet_credential_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_CREDENTIAL_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    * Unique identifier for this request (for key collisions).
59    */
60   uint32_t id GNUNET_PACKED;
61
62   /* Followed by the zero-terminated attribute */
63 };
64
65
66 /**
67  * Message from client to Credential service to verify attributes.
68  */
69 struct VerifyMessage
70 {
71   /**
72    * Header of type #GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY
73    */
74   struct GNUNET_MessageHeader header;
75
76   /**
77    * Subject public key
78    */
79   struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
80
81   /**
82    * Trust anchor
83    */
84   struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
85
86   /**
87    * Number of credentials
88    */
89   uint32_t c_count;
90
91   /**
92    * Length of the issuer attribute
93    */
94   uint16_t issuer_attribute_len;
95
96   /**
97    * Unique identifier for this request (for key collisions).
98    */
99   uint32_t id GNUNET_PACKED;
100
101   /* Followed by the zero-terminated attribute and credentials to look up */
102 };
103
104
105 /**
106  * Message from CREDENTIAL service to client: new results.
107  */
108 struct DelegationChainResultMessage
109 {
110   /**
111    * Header of type #GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY_RESULT
112    */
113   struct GNUNET_MessageHeader header;
114
115   /**
116    * Unique identifier for this request (for key collisions).
117    */
118   uint32_t id GNUNET_PACKED;
119
120   /**
121    * Indicates if credential has been found at all
122    */
123   uint32_t cred_found GNUNET_PACKED;
124
125   /**
126    * The number of delegations in the response
127    */
128   uint32_t d_count GNUNET_PACKED;
129
130   /**
131    * The number of credentials in the response
132    */
133   uint32_t c_count GNUNET_PACKED;
134
135   /* followed by ad_count GNUNET_CREDENTIAL_RecordData structs*/
136 };
137
138 struct DelegationRecordData
139 {
140   /**
141    * Subject key
142    */
143   struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
144
145   /**
146    * Subject attributes
147    */
148   uint32_t subject_attribute_len GNUNET_PACKED;
149 };
150
151
152 struct ChainEntry
153 {
154   /**
155    * Issuer key
156    */
157   struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
158
159   /**
160    * Subject key
161    */
162   struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
163
164   /**
165    * Issuer attributes
166    */
167   uint32_t issuer_attribute_len GNUNET_PACKED;
168
169   /**
170    * Subject attributes
171    */
172   uint32_t subject_attribute_len GNUNET_PACKED;
173 };
174
175
176 struct CredentialEntry
177 {
178   /**
179    * The signature for this credential by the issuer
180    */
181   struct GNUNET_CRYPTO_EcdsaSignature signature;
182
183   /**
184    * Signature meta
185    */
186   struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
187
188   /**
189    * Public key of the issuer
190    */
191   struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
192
193   /**
194    * Public key of the subject this credential was issued to
195    */
196   struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
197
198   /**
199    * Expiration time of this credential
200    */
201   uint64_t expiration GNUNET_PACKED;
202
203   /**
204    * Issuer attribute length
205    */
206   uint32_t issuer_attribute_len;
207
208   /**
209    * Followed by the attribute string
210    */
211 };
212
213
214 GNUNET_NETWORK_STRUCT_END
215
216 #endif