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