diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2020-11-12 21:47:52 +0100 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2020-11-12 21:47:52 +0100 |
commit | 99e61479aec983fca8c835fdeb24c9c840513f63 (patch) | |
tree | ee5ca4c5f1284b0abbb9ebfd5f0ba6649109d777 /src/include | |
parent | 96d7027e6b31acca9106a61d0495c88829dc4c85 (diff) | |
download | gnunet-99e61479aec983fca8c835fdeb24c9c840513f63.tar.gz gnunet-99e61479aec983fca8c835fdeb24c9c840513f63.zip |
-added more docs for messenger
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_messenger_service.h | 197 |
1 files changed, 191 insertions, 6 deletions
diff --git a/src/include/gnunet_messenger_service.h b/src/include/gnunet_messenger_service.h index 8f5315c30..96d308a01 100644 --- a/src/include/gnunet_messenger_service.h +++ b/src/include/gnunet_messenger_service.h | |||
@@ -70,28 +70,81 @@ struct GNUNET_MESSENGER_Contact; | |||
70 | */ | 70 | */ |
71 | enum GNUNET_MESSENGER_MessageKind | 71 | enum GNUNET_MESSENGER_MessageKind |
72 | { | 72 | { |
73 | /** | ||
74 | * The info kind. The message contains a #GNUNET_MESSENGER_MessageInfo body. | ||
75 | */ | ||
73 | GNUNET_MESSENGER_KIND_INFO = 1, | 76 | GNUNET_MESSENGER_KIND_INFO = 1, |
74 | 77 | ||
78 | /** | ||
79 | * The join kind. The message contains a #GNUNET_MESSENGER_MessageJoin body. | ||
80 | */ | ||
75 | GNUNET_MESSENGER_KIND_JOIN = 2, | 81 | GNUNET_MESSENGER_KIND_JOIN = 2, |
82 | |||
83 | /** | ||
84 | * The leave kind. The message contains a #GNUNET_MESSENGER_MessageLeave body. | ||
85 | */ | ||
76 | GNUNET_MESSENGER_KIND_LEAVE = 3, | 86 | GNUNET_MESSENGER_KIND_LEAVE = 3, |
77 | 87 | ||
88 | /** | ||
89 | * The name kind. The message contains a #GNUNET_MESSENGER_MessageName body. | ||
90 | */ | ||
78 | GNUNET_MESSENGER_KIND_NAME = 4, | 91 | GNUNET_MESSENGER_KIND_NAME = 4, |
92 | |||
93 | /** | ||
94 | * The key kind. The message contains a #GNUNET_MESSENGER_MessageKey body. | ||
95 | */ | ||
79 | GNUNET_MESSENGER_KIND_KEY = 5, | 96 | GNUNET_MESSENGER_KIND_KEY = 5, |
97 | |||
98 | /** | ||
99 | * The peer kind. The message contains a #GNUNET_MESSENGER_MessagePeer body. | ||
100 | */ | ||
80 | GNUNET_MESSENGER_KIND_PEER = 6, | 101 | GNUNET_MESSENGER_KIND_PEER = 6, |
102 | |||
103 | /** | ||
104 | * The id kind. The message contains a #GNUNET_MESSENGER_MessageId body. | ||
105 | */ | ||
81 | GNUNET_MESSENGER_KIND_ID = 7, | 106 | GNUNET_MESSENGER_KIND_ID = 7, |
82 | 107 | ||
108 | /** | ||
109 | * The miss kind. The message contains a #GNUNET_MESSENGER_MessageMiss body. | ||
110 | */ | ||
83 | GNUNET_MESSENGER_KIND_MISS = 8, | 111 | GNUNET_MESSENGER_KIND_MISS = 8, |
112 | |||
113 | /** | ||
114 | * The merge kind. The message contains a #GNUNET_MESSENGER_MessageMerge body. | ||
115 | */ | ||
84 | GNUNET_MESSENGER_KIND_MERGE = 9, | 116 | GNUNET_MESSENGER_KIND_MERGE = 9, |
117 | |||
118 | /** | ||
119 | * The request kind. The message contains a #GNUNET_MESSENGER_MessageRequest body. | ||
120 | */ | ||
85 | GNUNET_MESSENGER_KIND_REQUEST = 10, | 121 | GNUNET_MESSENGER_KIND_REQUEST = 10, |
86 | 122 | ||
123 | /** | ||
124 | * The invite kind. The message contains a #GNUNET_MESSENGER_MessageInvite body. | ||
125 | */ | ||
87 | GNUNET_MESSENGER_KIND_INVITE = 11, | 126 | GNUNET_MESSENGER_KIND_INVITE = 11, |
127 | |||
128 | /** | ||
129 | * The text kind. The message contains a #GNUNET_MESSENGER_MessageText body. | ||
130 | */ | ||
88 | GNUNET_MESSENGER_KIND_TEXT = 12, | 131 | GNUNET_MESSENGER_KIND_TEXT = 12, |
132 | |||
133 | /** | ||
134 | * The file kind. The message contains a #GNUNET_MESSENGER_MessageFile body. | ||
135 | */ | ||
89 | GNUNET_MESSENGER_KIND_FILE = 13, | 136 | GNUNET_MESSENGER_KIND_FILE = 13, |
90 | 137 | ||
138 | /** | ||
139 | * The private kind. The message contains a #GNUNET_MESSENGER_MessagePrivate body. | ||
140 | */ | ||
91 | GNUNET_MESSENGER_KIND_PRIVATE = 14, | 141 | GNUNET_MESSENGER_KIND_PRIVATE = 14, |
92 | 142 | ||
143 | /** | ||
144 | * The unknown kind. The message contains an unknown body. | ||
145 | */ | ||
93 | GNUNET_MESSENGER_KIND_UNKNOWN = 0 | 146 | GNUNET_MESSENGER_KIND_UNKNOWN = 0 |
94 | }__attribute__((__packed__)); | 147 | }; |
95 | 148 | ||
96 | /** | 149 | /** |
97 | * Get the name of a message <i>kind</i>. | 150 | * Get the name of a message <i>kind</i>. |
@@ -102,117 +155,242 @@ enum GNUNET_MESSENGER_MessageKind | |||
102 | const char* | 155 | const char* |
103 | GNUNET_MESSENGER_name_of_kind (enum GNUNET_MESSENGER_MessageKind kind); | 156 | GNUNET_MESSENGER_name_of_kind (enum GNUNET_MESSENGER_MessageKind kind); |
104 | 157 | ||
158 | /** | ||
159 | * The header of a #GNUNET_MESSENGER_Message. | ||
160 | */ | ||
105 | struct GNUNET_MESSENGER_MessageHeader | 161 | struct GNUNET_MESSENGER_MessageHeader |
106 | { | 162 | { |
163 | /** | ||
164 | * The signature of the senders private key. | ||
165 | */ | ||
107 | struct GNUNET_IDENTITY_Signature signature; | 166 | struct GNUNET_IDENTITY_Signature signature; |
108 | 167 | ||
168 | /** | ||
169 | * The timestamp of the message. | ||
170 | */ | ||
109 | struct GNUNET_TIME_AbsoluteNBO timestamp; | 171 | struct GNUNET_TIME_AbsoluteNBO timestamp; |
110 | 172 | ||
173 | /** | ||
174 | * The senders id inside of the room the message was sent in. | ||
175 | */ | ||
111 | struct GNUNET_ShortHashCode sender_id; | 176 | struct GNUNET_ShortHashCode sender_id; |
177 | |||
178 | /** | ||
179 | * The hash of the previous message from the senders perspective. | ||
180 | */ | ||
112 | struct GNUNET_HashCode previous; | 181 | struct GNUNET_HashCode previous; |
113 | 182 | ||
183 | /** | ||
184 | * The kind of the message. | ||
185 | */ | ||
114 | enum GNUNET_MESSENGER_MessageKind kind; | 186 | enum GNUNET_MESSENGER_MessageKind kind; |
115 | }; | 187 | }; |
116 | 188 | ||
189 | /** | ||
190 | * An info message body. | ||
191 | */ | ||
117 | struct GNUNET_MESSENGER_MessageInfo | 192 | struct GNUNET_MESSENGER_MessageInfo |
118 | { | 193 | { |
194 | /** | ||
195 | * The senders key to verify its signatures. | ||
196 | */ | ||
119 | struct GNUNET_IDENTITY_PublicKey host_key; | 197 | struct GNUNET_IDENTITY_PublicKey host_key; |
198 | |||
199 | /** | ||
200 | * The new unique id for the receiver in a room. | ||
201 | */ | ||
120 | struct GNUNET_ShortHashCode unique_id; | 202 | struct GNUNET_ShortHashCode unique_id; |
121 | }; | 203 | }; |
122 | 204 | ||
205 | /** | ||
206 | * A join message body. | ||
207 | */ | ||
123 | struct GNUNET_MESSENGER_MessageJoin | 208 | struct GNUNET_MESSENGER_MessageJoin |
124 | { | 209 | { |
210 | /** | ||
211 | * The senders public key to verify its signatures. | ||
212 | */ | ||
125 | struct GNUNET_IDENTITY_PublicKey key; | 213 | struct GNUNET_IDENTITY_PublicKey key; |
126 | }; | 214 | }; |
127 | 215 | ||
216 | /** | ||
217 | * A leave message body. | ||
218 | */ | ||
128 | struct GNUNET_MESSENGER_MessageLeave | 219 | struct GNUNET_MESSENGER_MessageLeave |
129 | { | 220 | { |
130 | }; | 221 | }; |
131 | 222 | ||
223 | /** | ||
224 | * A name message body. | ||
225 | */ | ||
132 | struct GNUNET_MESSENGER_MessageName | 226 | struct GNUNET_MESSENGER_MessageName |
133 | { | 227 | { |
228 | /** | ||
229 | * The new name which replaces the current senders name. | ||
230 | */ | ||
134 | char *name; | 231 | char *name; |
135 | }; | 232 | }; |
136 | 233 | ||
234 | /** | ||
235 | * A key message body. | ||
236 | */ | ||
137 | struct GNUNET_MESSENGER_MessageKey | 237 | struct GNUNET_MESSENGER_MessageKey |
138 | { | 238 | { |
239 | /** | ||
240 | * The new public key which replaces the current senders public key. | ||
241 | */ | ||
139 | struct GNUNET_IDENTITY_PublicKey key; | 242 | struct GNUNET_IDENTITY_PublicKey key; |
140 | }; | 243 | }; |
141 | 244 | ||
245 | /** | ||
246 | * A peer message body. | ||
247 | */ | ||
142 | struct GNUNET_MESSENGER_MessagePeer | 248 | struct GNUNET_MESSENGER_MessagePeer |
143 | { | 249 | { |
250 | /** | ||
251 | * The peer identity of the sender opening a room. | ||
252 | */ | ||
144 | struct GNUNET_PeerIdentity peer; | 253 | struct GNUNET_PeerIdentity peer; |
145 | }; | 254 | }; |
146 | 255 | ||
256 | /** | ||
257 | * An id message body. | ||
258 | */ | ||
147 | struct GNUNET_MESSENGER_MessageId | 259 | struct GNUNET_MESSENGER_MessageId |
148 | { | 260 | { |
261 | /** | ||
262 | * The new id which will replace the senders id in a room. | ||
263 | */ | ||
149 | struct GNUNET_ShortHashCode id; | 264 | struct GNUNET_ShortHashCode id; |
150 | }; | 265 | }; |
151 | 266 | ||
267 | /** | ||
268 | * A miss message body. | ||
269 | */ | ||
152 | struct GNUNET_MESSENGER_MessageMiss | 270 | struct GNUNET_MESSENGER_MessageMiss |
153 | { | 271 | { |
272 | /** | ||
273 | * The peer identity of a disconnected door to a room. | ||
274 | */ | ||
154 | struct GNUNET_PeerIdentity peer; | 275 | struct GNUNET_PeerIdentity peer; |
155 | }; | 276 | }; |
156 | 277 | ||
278 | /** | ||
279 | * A merge message body. | ||
280 | */ | ||
157 | struct GNUNET_MESSENGER_MessageMerge | 281 | struct GNUNET_MESSENGER_MessageMerge |
158 | { | 282 | { |
283 | /** | ||
284 | * The hash of a second previous message. | ||
285 | */ | ||
159 | struct GNUNET_HashCode previous; | 286 | struct GNUNET_HashCode previous; |
160 | }; | 287 | }; |
161 | 288 | ||
289 | /** | ||
290 | * A request message body. | ||
291 | */ | ||
162 | struct GNUNET_MESSENGER_MessageRequest | 292 | struct GNUNET_MESSENGER_MessageRequest |
163 | { | 293 | { |
294 | /** | ||
295 | * The hash of the requested message. | ||
296 | */ | ||
164 | struct GNUNET_HashCode hash; | 297 | struct GNUNET_HashCode hash; |
165 | }; | 298 | }; |
166 | 299 | ||
300 | /** | ||
301 | * An invite message body. | ||
302 | */ | ||
167 | struct GNUNET_MESSENGER_MessageInvite | 303 | struct GNUNET_MESSENGER_MessageInvite |
168 | { | 304 | { |
305 | /** | ||
306 | * The peer identity of an open door to a room. | ||
307 | */ | ||
169 | struct GNUNET_PeerIdentity door; | 308 | struct GNUNET_PeerIdentity door; |
309 | |||
310 | /** | ||
311 | * The hash identifying the port of the room. | ||
312 | */ | ||
170 | struct GNUNET_HashCode key; | 313 | struct GNUNET_HashCode key; |
171 | }; | 314 | }; |
172 | 315 | ||
316 | /** | ||
317 | * A text message body. | ||
318 | */ | ||
173 | struct GNUNET_MESSENGER_MessageText | 319 | struct GNUNET_MESSENGER_MessageText |
174 | { | 320 | { |
321 | /** | ||
322 | * The containing text. | ||
323 | */ | ||
175 | char *text; | 324 | char *text; |
176 | }; | 325 | }; |
177 | 326 | ||
327 | /** | ||
328 | * A file message body. | ||
329 | */ | ||
178 | struct GNUNET_MESSENGER_MessageFile | 330 | struct GNUNET_MESSENGER_MessageFile |
179 | { | 331 | { |
332 | /** | ||
333 | * The symmetric key to decrypt the file. | ||
334 | */ | ||
180 | struct GNUNET_CRYPTO_SymmetricSessionKey key; | 335 | struct GNUNET_CRYPTO_SymmetricSessionKey key; |
336 | |||
337 | /** | ||
338 | * The hash of the original file. | ||
339 | */ | ||
181 | struct GNUNET_HashCode hash; | 340 | struct GNUNET_HashCode hash; |
341 | |||
342 | /** | ||
343 | * The name of the original file. | ||
344 | */ | ||
182 | char name[NAME_MAX]; | 345 | char name[NAME_MAX]; |
346 | |||
347 | /** | ||
348 | * The uri of the encrypted file. | ||
349 | */ | ||
183 | char *uri; | 350 | char *uri; |
184 | }; | 351 | }; |
185 | 352 | ||
353 | /** | ||
354 | * A private message body. | ||
355 | */ | ||
186 | struct GNUNET_MESSENGER_MessagePrivate | 356 | struct GNUNET_MESSENGER_MessagePrivate |
187 | { | 357 | { |
358 | /** | ||
359 | * The ECDH key to decrypt the message. | ||
360 | */ | ||
188 | struct GNUNET_CRYPTO_EcdhePublicKey key; | 361 | struct GNUNET_CRYPTO_EcdhePublicKey key; |
189 | 362 | ||
363 | /** | ||
364 | * The length of the encrypted message. | ||
365 | */ | ||
190 | uint16_t length; | 366 | uint16_t length; |
367 | |||
368 | /** | ||
369 | * The data of the encrypted message. | ||
370 | */ | ||
191 | char *data; | 371 | char *data; |
192 | }; | 372 | }; |
193 | 373 | ||
374 | /** | ||
375 | * The unified body of a #GNUNET_MESSENGER_Message. | ||
376 | */ | ||
194 | struct GNUNET_MESSENGER_MessageBody | 377 | struct GNUNET_MESSENGER_MessageBody |
195 | { | 378 | { |
196 | union | 379 | union |
197 | { | 380 | { |
198 | struct GNUNET_MESSENGER_MessageInfo info; | 381 | struct GNUNET_MESSENGER_MessageInfo info; |
199 | |||
200 | struct GNUNET_MESSENGER_MessageJoin join; | 382 | struct GNUNET_MESSENGER_MessageJoin join; |
201 | struct GNUNET_MESSENGER_MessageLeave leave; | 383 | struct GNUNET_MESSENGER_MessageLeave leave; |
202 | |||
203 | struct GNUNET_MESSENGER_MessageName name; | 384 | struct GNUNET_MESSENGER_MessageName name; |
204 | struct GNUNET_MESSENGER_MessageKey key; | 385 | struct GNUNET_MESSENGER_MessageKey key; |
205 | struct GNUNET_MESSENGER_MessagePeer peer; | 386 | struct GNUNET_MESSENGER_MessagePeer peer; |
206 | struct GNUNET_MESSENGER_MessageId id; | 387 | struct GNUNET_MESSENGER_MessageId id; |
207 | |||
208 | struct GNUNET_MESSENGER_MessageMiss miss; | 388 | struct GNUNET_MESSENGER_MessageMiss miss; |
209 | struct GNUNET_MESSENGER_MessageMerge merge; | 389 | struct GNUNET_MESSENGER_MessageMerge merge; |
210 | struct GNUNET_MESSENGER_MessageRequest request; | 390 | struct GNUNET_MESSENGER_MessageRequest request; |
211 | |||
212 | struct GNUNET_MESSENGER_MessageInvite invite; | 391 | struct GNUNET_MESSENGER_MessageInvite invite; |
213 | struct GNUNET_MESSENGER_MessageText text; | 392 | struct GNUNET_MESSENGER_MessageText text; |
214 | struct GNUNET_MESSENGER_MessageFile file; | 393 | struct GNUNET_MESSENGER_MessageFile file; |
215 | |||
216 | struct GNUNET_MESSENGER_MessagePrivate private; | 394 | struct GNUNET_MESSENGER_MessagePrivate private; |
217 | }; | 395 | }; |
218 | }; | 396 | }; |
@@ -222,7 +400,14 @@ struct GNUNET_MESSENGER_MessageBody | |||
222 | */ | 400 | */ |
223 | struct GNUNET_MESSENGER_Message | 401 | struct GNUNET_MESSENGER_Message |
224 | { | 402 | { |
403 | /** | ||
404 | * Header. | ||
405 | */ | ||
225 | struct GNUNET_MESSENGER_MessageHeader header; | 406 | struct GNUNET_MESSENGER_MessageHeader header; |
407 | |||
408 | /** | ||
409 | * Body | ||
410 | */ | ||
226 | struct GNUNET_MESSENGER_MessageBody body; | 411 | struct GNUNET_MESSENGER_MessageBody body; |
227 | }; | 412 | }; |
228 | 413 | ||