-bad style, die
[oweals/gnunet.git] / src / identity / identity.h
1 /*
2      This file is part of GNUnet.
3      (C) 2013 Christian Grothoff (and other contributing authors)
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., 59 Temple Place - Suite 330,
18      Boston, MA 02111-1307, USA.
19 */
20
21 /**
22  * @author Christian Grothoff
23  * @file identity/identity.h
24  *
25  * @brief Common type definitions for the identity
26  *        service and API.
27  */
28 #ifndef IDENTITY_H
29 #define IDENTITY_H
30
31 #include "gnunet_common.h"
32
33
34 GNUNET_NETWORK_STRUCT_BEGIN
35
36
37 /**
38  * Answer from service to client about last operation;
39  * GET_DEFAULT maybe answered with this message on failure;
40  * CREATE and RENAME will always be answered with this message.
41  */
42 struct GNUNET_IDENTITY_ResultCodeMessage
43 {
44   /**
45    * Type: GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE
46    */
47   struct GNUNET_MessageHeader header;
48
49   /**
50    * Status code for the last operation, in NBO.
51    */
52   uint32_t result_code GNUNET_PACKED;
53
54   /* followed by 0-terminated error message (on error) */
55
56 };
57
58
59 /**
60  * Service informs client about status of a pseudonym.
61  */
62 struct GNUNET_IDENTITY_UpdateMessage
63 {
64   /**
65    * Type: GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE
66    */
67   struct GNUNET_MessageHeader header;
68
69   /**
70    * Number of bytes in identity name string including 0-termination, in NBO;
71    * 0 if the identity was deleted.
72    */
73   uint16_t name_len GNUNET_PACKED;
74
75   /**
76    * Always zero.
77    */
78   uint16_t reserved GNUNET_PACKED;
79
80   /**
81    * Public key of the identity that we provide an update about.
82    */
83   struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded private_key;
84
85   /* followed by 0-terminated identity name */
86
87 };
88
89
90
91 /**
92  * Client requests knowledge about default identity for
93  * a subsystem from identity service.
94  */
95 struct GNUNET_IDENTITY_GetDefaultMessage
96 {
97   /**
98    * Type: GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT
99    */
100   struct GNUNET_MessageHeader header;
101
102   /**
103    * Number of bytes in service name string including 0-termination, in NBO.
104    */
105   uint16_t name_len GNUNET_PACKED;
106
107   /**
108    * Always zero.
109    */
110   uint16_t reserved GNUNET_PACKED;
111
112
113   /* followed by 0-terminated service name */
114
115 };
116
117
118 /**
119  * Used from service to client as a result to the GET_DEFAULT
120  * message, used from client to service to SET_DEFAULT.
121  */
122 struct GNUNET_IDENTITY_SetDefaultMessage
123 {
124   /**
125    * Type: GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT
126    */
127   struct GNUNET_MessageHeader header;
128
129   /**
130    * Number of bytes in service name string including 0-termination, in NBO.
131    */
132   uint16_t name_len GNUNET_PACKED;
133
134   /**
135    * Always zero.
136    */
137   uint16_t reserved GNUNET_PACKED;
138
139   /**
140    * Public key of the identity to use.
141    */
142   struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded private_key;
143
144   /* followed by 0-terminated service name */
145
146 };
147
148
149 /**
150  * Client requests creation of an identity.  Service
151  * will respond with a result code.  
152  */
153 struct GNUNET_IDENTITY_CreateRequestMessage
154 {
155   /**
156    * Type: GNUNET_MESSAGE_TYPE_IDENTITY_CREATE
157    */
158   struct GNUNET_MessageHeader header;
159
160   /**
161    * Number of bytes in identity name string including 0-termination, in NBO.
162    */
163   uint16_t name_len GNUNET_PACKED;
164
165   /**
166    * Always zero.
167    */
168   uint16_t reserved GNUNET_PACKED;
169
170   /**
171    * Public key of the identity to use.
172    */
173   struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded private_key;
174
175   /* followed by 0-terminated identity name */
176
177 };
178
179
180 /**
181  * Client requests renaming of an identity.  Service
182  * will respond with a result code.
183  */
184 struct GNUNET_IDENTITY_RenameMessage
185 {
186   /**
187    * Type: GNUNET_MESSAGE_TYPE_IDENTITY_RENAME
188    */
189   struct GNUNET_MessageHeader header;
190
191   /**
192    * Number of characters in the old name including 0-termination, in NBO.
193    */
194   uint16_t old_name_len GNUNET_PACKED;
195
196   /**
197    * Number of characters in the new name including 0-termination, in NBO.
198    */
199   uint16_t new_name_len GNUNET_PACKED;
200
201   /* followed by 0-terminated old name */
202   /* followed by 0-terminated new name */
203 };
204
205
206 /**
207  * Client requests deletion of an identity.  Service
208  * will respond with a result code.
209  */
210 struct GNUNET_IDENTITY_DeleteMessage
211 {
212   /**
213    * Type: GNUNET_MESSAGE_TYPE_IDENTITY_DELETE
214    */
215   struct GNUNET_MessageHeader header;
216
217   /**
218    * Number of characters in the name including 0-termination, in NBO.
219    */
220   uint16_t name_len GNUNET_PACKED;
221
222   /**
223    * Always zero.
224    */
225   uint16_t reserved GNUNET_PACKED;
226
227   /* followed by 0-terminated name */
228
229 };
230
231
232
233 GNUNET_NETWORK_STRUCT_END
234
235 #endif