-add ego creation
[oweals/gnunet.git] / src / identity / identity.h
1 /*
2      This file is part of GNUnet.
3      Copyright (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    * (currently not used).
52    */
53   uint32_t result_code GNUNET_PACKED;
54
55   /* followed by 0-terminated error message (on error) */
56
57 };
58
59
60 /**
61  * Service informs client about status of a pseudonym.
62  */
63 struct GNUNET_IDENTITY_UpdateMessage
64 {
65   /**
66    * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE
67    */
68   struct GNUNET_MessageHeader header;
69
70   /**
71    * Number of bytes in ego name string including 0-termination, in NBO;
72    * 0 if the ego was deleted.
73    */
74   uint16_t name_len GNUNET_PACKED;
75
76   /**
77    * Usually #GNUNET_NO, #GNUNET_YES to signal end of list.
78    */
79   uint16_t end_of_list GNUNET_PACKED;
80
81   /**
82    * The private key
83    */
84   struct GNUNET_CRYPTO_EcdsaPrivateKey private_key;
85
86   /* followed by 0-terminated ego name */
87
88 };
89
90
91
92 /**
93  * Client requests knowledge about default identity for
94  * a subsystem from identity service.
95  */
96 struct GNUNET_IDENTITY_GetDefaultMessage
97 {
98   /**
99    * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT
100    */
101   struct GNUNET_MessageHeader header;
102
103   /**
104    * Number of bytes in service name string including 0-termination, in NBO.
105    */
106   uint16_t name_len GNUNET_PACKED;
107
108   /**
109    * Always zero.
110    */
111   uint16_t reserved GNUNET_PACKED;
112
113
114   /* followed by 0-terminated service name */
115
116 };
117
118
119 /**
120  * Used from service to client as a result to the GET_DEFAULT
121  * message, used from client to service to SET_DEFAULT.
122  */
123 struct GNUNET_IDENTITY_SetDefaultMessage
124 {
125   /**
126    * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT
127    */
128   struct GNUNET_MessageHeader header;
129
130   /**
131    * Number of bytes in service name string including 0-termination, in NBO.
132    */
133   uint16_t name_len GNUNET_PACKED;
134
135   /**
136    * Always zero.
137    */
138   uint16_t reserved GNUNET_PACKED;
139
140   /**
141    * The private key
142    */
143   struct GNUNET_CRYPTO_EcdsaPrivateKey private_key;
144
145   /* followed by 0-terminated service name */
146
147 };
148
149
150 /**
151  * Client requests creation of an identity.  Service
152  * will respond with a result code.
153  */
154 struct GNUNET_IDENTITY_CreateRequestMessage
155 {
156   /**
157    * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_CREATE
158    */
159   struct GNUNET_MessageHeader header;
160
161   /**
162    * Number of bytes in identity name string including 0-termination, in NBO.
163    */
164   uint16_t name_len GNUNET_PACKED;
165
166   /**
167    * Always zero.
168    */
169   uint16_t reserved GNUNET_PACKED;
170
171   /**
172    * The private key
173    */
174   struct GNUNET_CRYPTO_EcdsaPrivateKey private_key;
175
176   /* followed by 0-terminated identity name */
177
178 };
179
180
181 /**
182  * Client requests renaming of an identity.  Service
183  * will respond with a result code.
184  */
185 struct GNUNET_IDENTITY_RenameMessage
186 {
187   /**
188    * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_RENAME
189    */
190   struct GNUNET_MessageHeader header;
191
192   /**
193    * Number of characters in the old name including 0-termination, in NBO.
194    */
195   uint16_t old_name_len GNUNET_PACKED;
196
197   /**
198    * Number of characters in the new name including 0-termination, in NBO.
199    */
200   uint16_t new_name_len GNUNET_PACKED;
201
202   /* followed by 0-terminated old name */
203   /* followed by 0-terminated new name */
204 };
205
206
207 /**
208  * Client requests deletion of an identity.  Service
209  * will respond with a result code.
210  */
211 struct GNUNET_IDENTITY_DeleteMessage
212 {
213   /**
214    * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_DELETE
215    */
216   struct GNUNET_MessageHeader header;
217
218   /**
219    * Number of characters in the name including 0-termination, in NBO.
220    */
221   uint16_t name_len GNUNET_PACKED;
222
223   /**
224    * Always zero.
225    */
226   uint16_t reserved GNUNET_PACKED;
227
228   /* followed by 0-terminated name */
229
230 };
231
232
233
234 GNUNET_NETWORK_STRUCT_END
235
236 #endif