GNUnet  0.11.x
gnunet_messenger_service.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2020 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  */
32 #ifndef GNUNET_MESSENGER_SERVICE_H
33 #define GNUNET_MESSENGER_SERVICE_H
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #if 0 /* keep Emacsens' auto-indent happy */
38 }
39 #endif
40 #endif
41 
42 #include "platform.h"
44 #include "gnunet_crypto_lib.h"
46 #include "gnunet_mq_lib.h"
47 #include "gnunet_protocols.h"
48 #include "gnunet_scheduler_lib.h"
49 #include "gnunet_time_lib.h"
50 
51 #define GNUNET_MESSENGER_SERVICE_NAME "messenger"
52 
57 
62 
67 
72 {
77 
82 
87 
92 
97 
102 
107 
112 
117 
122 
127 
132 
137 
142 
147 };
148 
155 const char*
157 
162 {
167 
172 
177 
182 
187 };
188 
193 {
197  struct GNUNET_IDENTITY_PublicKey host_key;
198 
202  struct GNUNET_ShortHashCode unique_id;
203 };
204 
209 {
214 };
215 
220 {
221 };
222 
227 {
231  char *name;
232 };
233 
238 {
243 };
244 
249 {
254 };
255 
260 {
265 };
266 
271 {
275  struct GNUNET_PeerIdentity peer;
276 };
277 
282 {
287 };
288 
293 {
297  struct GNUNET_HashCode hash;
298 };
299 
304 {
308  struct GNUNET_PeerIdentity door;
309 
313  struct GNUNET_HashCode key;
314 };
315 
320 {
324  char *text;
325 };
326 
331 {
336 
340  struct GNUNET_HashCode hash;
341 
345  char name[NAME_MAX];
346 
350  char *uri;
351 };
352 
357 {
362 
366  uint16_t length;
367 
371  char *data;
372 };
373 
378 {
379  union
380  {
395  };
396 };
397 
402 {
407 
412 };
413 
421 typedef void
423 
432 typedef void
433 (*GNUNET_MESSENGER_MessageCallback) (void *cls, const struct GNUNET_MESSENGER_Room *room,
434  const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
435 
452 
464 int
466 
472 void
474 
481 const char*
483 
493 int
495 
502 const struct GNUNET_IDENTITY_PublicKey*
504 
521 struct GNUNET_MESSENGER_Room*
523 
542 struct GNUNET_MESSENGER_Room*
544  const struct GNUNET_HashCode *key);
545 
555 void
557 
568 GNUNET_MESSENGER_get_member (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_ShortHashCode *id);
569 
576 const char*
578 
585 const struct GNUNET_IDENTITY_PublicKey*
587 
599 void
601 
609 const struct GNUNET_MESSENGER_Message*
610 GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash);
611 
612 #if 0 /* keep Emacsens' auto-indent happy */
613 {
614 #endif
615 #ifdef __cplusplus
616 }
617 #endif
618 
619 #endif //GNUNET_MESSENGER_SERVICE_H
620 /* end of group */
const struct GNUNET_MESSENGER_Message * GNUNET_MESSENGER_get_message(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Get the message in a room identified by its hash.
const struct GNUNET_IDENTITY_PublicKey * GNUNET_MESSENGER_get_key(const struct GNUNET_MESSENGER_Handle *handle)
Get the public key used by the messenger.
void GNUNET_MESSENGER_send_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message)
Send a message into a room.
struct GNUNET_ShortHashCode sender_id
The senders id inside of the room the message was sent in.
static struct GNUNET_VPN_RedirectionRequest * request
Opaque redirection request handle.
Definition: gnunet-vpn.c:41
struct GNUNET_MESSENGER_Room * GNUNET_MESSENGER_open_room(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key)
Open a room to send and receive messages.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
struct GNUNET_TIME_AbsoluteNBO timestamp
The timestamp of the message.
The header of a GNUNET_MESSENGER_Message.
void GNUNET_MESSENGER_close_room(struct GNUNET_MESSENGER_Room *room)
Close a room which was entered, opened or both in various order and variety.
char * uri
The uri of the encrypted file.
const char * GNUNET_MESSENGER_contact_get_name(const struct GNUNET_MESSENGER_Contact *contact)
Get the name used by the contact.
int GNUNET_MESSENGER_set_name(struct GNUNET_MESSENGER_Handle *handle, const char *name)
Set the name for the messenger.
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
char * text
The containing text.
Time for absolute time used by GNUnet, in microseconds and in network byte order. ...
A 256-bit hashcode.
cryptographic primitives for GNUnet
The unified body of a GNUNET_MESSENGER_Message.
void(* GNUNET_MESSENGER_MessageCallback)(void *cls, const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Method called whenever a message is sent or received from a room.
GNUNET_MESSENGER_MessageCallback msg_callback
struct GNUNET_MESSENGER_Room * GNUNET_MESSENGER_entry_room(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key)
Enter a room to send and receive messages through a door opened using GNUNET_MESSENGER_open_room(...).
An identity signature as per LSD0001.
const char * GNUNET_MESSENGER_name_of_kind(enum GNUNET_MESSENGER_MessageKind kind)
Get the name of a message kind.
Definition: messenger_api.c:34
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
int GNUNET_MESSENGER_update(struct GNUNET_MESSENGER_Handle *handle)
Update a handle of the messenger to use a different ego key and replace the old one with a newly gene...
uint16_t length
The length of the encrypted message.
struct GNUNET_IDENTITY_Signature signature
The signature of the senders private key.
A 512-bit hashcode.
struct GNUNET_HashCode previous
The hash of the previous message from the senders perspective.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
struct GNUNET_HashCode key
The key used in the DHT.
void(* GNUNET_MESSENGER_IdentityCallback)(void *cls, struct GNUNET_MESSENGER_Handle *handle)
Method called whenever the EGO of a handle changes or if the first connection fails to load a valid E...
The identity of the host (wraps the signing key of the peer).
struct GNUNET_MESSENGER_Handle * GNUNET_MESSENGER_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, GNUNET_MESSENGER_IdentityCallback identity_callback, void *identity_cls, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls)
Set up a handle for the messenger related functions and connects to all necessary services...
An identity key as per LSD0001.
char * data
The data of the encrypted message.
configuration data
Definition: configuration.c:84
const char * name
void GNUNET_MESSENGER_disconnect(struct GNUNET_MESSENGER_Handle *handle)
Disconnect all of the messengers used services and clears up its used memory.
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and encr...
const char * GNUNET_MESSENGER_get_name(const struct GNUNET_MESSENGER_Handle *handle)
Get the name (if specified, otherwise NULL) used by the messenger.
const struct GNUNET_IDENTITY_PublicKey * GNUNET_MESSENGER_contact_get_key(const struct GNUNET_MESSENGER_Contact *contact)
Get the public key used by the contact.
GNUNET_MESSENGER_MessageKind
Enum for the different supported kinds of messages.
char * name
The new name which replaces the current senders name.
GNUNET_MESSENGER_IdentityCallback identity_callback
struct GNUNET_MESSENGER_Contact * GNUNET_MESSENGER_get_member(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_ShortHashCode *id)
Get the contact of a member in a room identified by their id.
enum GNUNET_MESSENGER_MessageKind kind
The kind of the message.