aboutsummaryrefslogtreecommitdiff
path: root/src/service/identity/identity.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/service/identity/identity.h')
-rw-r--r--src/service/identity/identity.h226
1 files changed, 226 insertions, 0 deletions
diff --git a/src/service/identity/identity.h b/src/service/identity/identity.h
new file mode 100644
index 000000000..acb403736
--- /dev/null
+++ b/src/service/identity/identity.h
@@ -0,0 +1,226 @@
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 SPDX-License-Identifier: AGPL3.0-or-later
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 * Handle for an ego.
35 */
36struct GNUNET_IDENTITY_Ego
37{
38 /**
39 * Hash of the private key of this ego.
40 */
41 struct GNUNET_HashCode id;
42
43 /**
44 * The identity key pair
45 */
46 struct GNUNET_CRYPTO_PublicKey pub;
47
48 /**
49 * The identity key pair
50 */
51 struct GNUNET_CRYPTO_PrivateKey pk;
52
53 /**
54 * Current name associated with this ego.
55 */
56 char *name;
57
58 /**
59 * Client context associated with this ego.
60 */
61 void *ctx;
62
63 /**
64 * Set to true once @e pub was initialized
65 */
66 bool pub_initialized;
67};
68
69
70
71
72GNUNET_NETWORK_STRUCT_BEGIN
73
74
75/**
76 * Answer from service to client about last operation;
77 * GET_DEFAULT maybe answered with this message on failure;
78 * CREATE and RENAME will always be answered with this message.
79 */
80struct ResultCodeMessage
81{
82 /**
83 * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE
84 */
85 struct GNUNET_MessageHeader header;
86
87 /**
88 * Status code for the last operation, in NBO.
89 * (currently not used).
90 */
91 uint32_t result_code GNUNET_PACKED;
92};
93
94
95/**
96 * Client informs service about desire to lookup a (single) pseudonym.
97 */
98struct LookupMessage
99{
100 /**
101 * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_LOOKUP or
102 * #GNUNET_MESSAGE_TYPE_IDENTITY_LOOKUP_BY_SUFFIX
103 */
104 struct GNUNET_MessageHeader header;
105
106 /* followed by 0-terminated ego name */
107};
108
109
110/**
111 * Service informs client about status of a pseudonym.
112 */
113struct UpdateMessage
114{
115 /**
116 * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE
117 */
118 struct GNUNET_MessageHeader header;
119
120 /**
121 * Number of bytes in ego name string including 0-termination, in NBO;
122 * 0 if the ego was deleted.
123 */
124 uint16_t name_len GNUNET_PACKED;
125
126 /**
127 * Usually #GNUNET_NO, #GNUNET_YES to signal end of list.
128 */
129 uint16_t end_of_list GNUNET_PACKED;
130
131 /**
132 * Key length
133 */
134 uint16_t key_len GNUNET_PACKED;
135
136 /**
137 * Reserved (alignment)
138 */
139 uint16_t reserved GNUNET_PACKED;
140
141 /* followed by 0-terminated ego name */
142 /* followed by the private key */
143};
144
145
146/**
147 * Client requests creation of an identity. Service
148 * will respond with a result code.
149 */
150struct CreateRequestMessage
151{
152 /**
153 * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_CREATE
154 */
155 struct GNUNET_MessageHeader header;
156
157 /**
158 * Number of bytes in identity name string including 0-termination, in NBO.
159 */
160 uint16_t name_len GNUNET_PACKED;
161
162 /**
163 * Key length
164 */
165 uint16_t key_len GNUNET_PACKED;
166
167 /*
168 * Followed by the private key
169 * followed by 0-terminated identity name */
170};
171
172
173/**
174 * Client requests renaming of an identity. Service
175 * will respond with a result code.
176 */
177struct RenameMessage
178{
179 /**
180 * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_RENAME
181 */
182 struct GNUNET_MessageHeader header;
183
184 /**
185 * Number of characters in the old name including 0-termination, in NBO.
186 */
187 uint16_t old_name_len GNUNET_PACKED;
188
189 /**
190 * Number of characters in the new name including 0-termination, in NBO.
191 */
192 uint16_t new_name_len GNUNET_PACKED;
193
194 /* followed by 0-terminated old name */
195 /* followed by 0-terminated new name */
196};
197
198
199/**
200 * Client requests deletion of an identity. Service
201 * will respond with a result code.
202 */
203struct DeleteMessage
204{
205 /**
206 * Type: #GNUNET_MESSAGE_TYPE_IDENTITY_DELETE
207 */
208 struct GNUNET_MessageHeader header;
209
210 /**
211 * Number of characters in the name including 0-termination, in NBO.
212 */
213 uint16_t name_len GNUNET_PACKED;
214
215 /**
216 * Always zero.
217 */
218 uint16_t reserved GNUNET_PACKED;
219
220 /* followed by 0-terminated name */
221};
222
223GNUNET_NETWORK_STRUCT_END
224
225
226#endif