-proper support for initial listing vs. monitor mode
[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    * (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 identity name string including 0-termination, in NBO;
72    * 0 if the identity was deleted.
73    */
74   uint16_t name_len GNUNET_PACKED;
75
76   /**
77    * Number of bytes of private key data that follow, in NBO.
78    */
79   uint16_t pk_len GNUNET_PACKED;
80
81   /* followed by private key */
82
83   /* followed by 0-terminated identity name */
84
85 };
86
87
88
89 /**
90  * Client requests knowledge about default identity for
91  * a subsystem from identity service.
92  */
93 struct GNUNET_IDENTITY_GetDefaultMessage
94 {
95   /**
96    * Type: GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT
97    */
98   struct GNUNET_MessageHeader header;
99
100   /**
101    * Number of bytes in service name string including 0-termination, in NBO.
102    */
103   uint16_t name_len GNUNET_PACKED;
104
105   /**
106    * Always zero.
107    */
108   uint16_t reserved GNUNET_PACKED;
109
110
111   /* followed by 0-terminated service name */
112
113 };
114
115
116 /**
117  * Used from service to client as a result to the GET_DEFAULT
118  * message, used from client to service to SET_DEFAULT.
119  */
120 struct GNUNET_IDENTITY_SetDefaultMessage
121 {
122   /**
123    * Type: GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT
124    */
125   struct GNUNET_MessageHeader header;
126
127   /**
128    * Number of bytes in service name string including 0-termination, in NBO.
129    */
130   uint16_t name_len GNUNET_PACKED;
131
132   /**
133    * Number of bytes of private key data that follow, in NBO.
134    */
135   uint16_t pk_len GNUNET_PACKED;
136
137   /* followed by private key */
138
139   /* followed by 0-terminated service name */
140
141 };
142
143
144 /**
145  * Client requests creation of an identity.  Service
146  * will respond with a result code.  
147  */
148 struct GNUNET_IDENTITY_CreateRequestMessage
149 {
150   /**
151    * Type: GNUNET_MESSAGE_TYPE_IDENTITY_CREATE
152    */
153   struct GNUNET_MessageHeader header;
154
155   /**
156    * Number of bytes in identity name string including 0-termination, in NBO.
157    */
158   uint16_t name_len GNUNET_PACKED;
159
160   /**
161    * Number of bytes of private key data that follow, in NBO.
162    */
163   uint16_t pk_len GNUNET_PACKED;
164
165   /* followed by private key */
166
167   /* followed by 0-terminated identity name */
168
169 };
170
171
172 /**
173  * Client requests renaming of an identity.  Service
174  * will respond with a result code.
175  */
176 struct GNUNET_IDENTITY_RenameMessage
177 {
178   /**
179    * Type: GNUNET_MESSAGE_TYPE_IDENTITY_RENAME
180    */
181   struct GNUNET_MessageHeader header;
182
183   /**
184    * Number of characters in the old name including 0-termination, in NBO.
185    */
186   uint16_t old_name_len GNUNET_PACKED;
187
188   /**
189    * Number of characters in the new name including 0-termination, in NBO.
190    */
191   uint16_t new_name_len GNUNET_PACKED;
192
193   /* followed by 0-terminated old name */
194   /* followed by 0-terminated new name */
195 };
196
197
198 /**
199  * Client requests deletion of an identity.  Service
200  * will respond with a result code.
201  */
202 struct GNUNET_IDENTITY_DeleteMessage
203 {
204   /**
205    * Type: GNUNET_MESSAGE_TYPE_IDENTITY_DELETE
206    */
207   struct GNUNET_MessageHeader header;
208
209   /**
210    * Number of characters in the name including 0-termination, in NBO.
211    */
212   uint16_t name_len GNUNET_PACKED;
213
214   /**
215    * Always zero.
216    */
217   uint16_t reserved GNUNET_PACKED;
218
219   /* followed by 0-terminated name */
220
221 };
222
223
224
225 GNUNET_NETWORK_STRUCT_END
226
227 #endif