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