GNUnet 0.26.2-16-ge86b66bd5
 
Loading...
Searching...
No Matches
MESSENGER service

Instant messaging based on the CADET subsystem. More...

Data Structures

struct  GNUNET_MESSENGER_RoomKeyCode
 A room key code specifies an identifier of a room and its individual properties. More...
 
union  GNUNET_MESSENGER_RoomKey
 A room key unifies a room key code and its 512bit hash representation. More...
 
struct  GNUNET_MESSENGER_RoomEntryRecord
 A room entry record specifies which peer is hosting a given room and may also specify the key to enter it. More...
 
struct  GNUNET_MESSENGER_RoomDetailsRecord
 A room details record specifies a custom name for a given room and some additional space for flags. More...
 
struct  GNUNET_MESSENGER_EpochIdentifierCode
 An epoch identifier code specifies an epoch or group key inside a room and it provides the information about its group size. More...
 
union  GNUNET_MESSENGER_EpochIdentifier
 An epoch identifier unifies an epoch identifier code and its 256bit hash representation. More...
 
struct  GNUNET_MESSENGER_RoomEpochKeyRecord
 A room epoch key record specifies an epoch key for a given room that can be identified via a given key to enter it and an epoch identifier. More...
 
struct  GNUNET_MESSENGER_EpochNonceData
 Struct to store a unique epoch nonce for message data encryption. More...
 
union  GNUNET_MESSENGER_EpochNonce
 An epoch nonce unifies the epoch nonce data and its 256bit hash representation. More...
 
struct  GNUNET_MESSENGER_EncryptionKeyRecord
 An encryption key record specifies an encryption key for a given room that can be identified via a given key to enter it. More...
 
struct  GNUNET_MESSENGER_MessageHeader
 The header of a GNUNET_MESSENGER_Message. More...
 
struct  GNUNET_MESSENGER_MessageInfo
 An info message body. More...
 
struct  GNUNET_MESSENGER_MessageJoin
 A join message body. More...
 
struct  GNUNET_MESSENGER_MessageLeave
 A leave message body. More...
 
struct  GNUNET_MESSENGER_MessageName
 A name message body. More...
 
struct  GNUNET_MESSENGER_MessageKey
 A key message body. More...
 
struct  GNUNET_MESSENGER_MessagePeer
 A peer message body. More...
 
struct  GNUNET_MESSENGER_MessageId
 An id message body. More...
 
struct  GNUNET_MESSENGER_MessageMiss
 A miss message body. More...
 
struct  GNUNET_MESSENGER_MessageMerge
 A merge message body. More...
 
struct  GNUNET_MESSENGER_MessageRequest
 A request message body. More...
 
struct  GNUNET_MESSENGER_MessageInvite
 An invite message body. More...
 
struct  GNUNET_MESSENGER_MessageText
 A text message body. More...
 
struct  GNUNET_MESSENGER_MessageFile
 A file message body. More...
 
struct  GNUNET_MESSENGER_MessagePrivate
 A private message body. More...
 
struct  GNUNET_MESSENGER_MessageDeletion
 A deletion message body This allows deletion of an own previous message with any custom automatic delay. More...
 
struct  GNUNET_MESSENGER_MessageConnection
 A connection message body This allows to tell others about connection information about a peer. More...
 
struct  GNUNET_MESSENGER_MessageTicket
 A ticket message body This allows to exchange ticket identifiers with an audience. More...
 
struct  GNUNET_MESSENGER_MessageTranscript
 A transcript message body This allows reading the content of a sent private message. More...
 
struct  GNUNET_MESSENGER_MessageTag
 A tag message body This allows tagging a message with a custom tag. More...
 
struct  GNUNET_MESSENGER_MessageSubscribtion
 A subscription message body This allows subscribing to a discourse. More...
 
struct  GNUNET_MESSENGER_MessageTalk
 A talk message body This allows talking in a discourse. More...
 
struct  GNUNET_MESSENGER_MessageAnnouncement
 An announcement message body This allows announcing group and epoch keys. More...
 
struct  GNUNET_MESSENGER_MessageSecret
 A secret message body This allows exchanging encrypted messages. More...
 
struct  GNUNET_MESSENGER_MessageAppeal
 An appeal message body This allows appealing to receive an epoch key. More...
 
struct  GNUNET_MESSENGER_MessageAccess
 An access message body This allows providing access to a group or an epoch key using a public key. More...
 
struct  GNUNET_MESSENGER_MessageRevolution
 A revolution message body This allows revolutionizing a group or epoch. More...
 
struct  GNUNET_MESSENGER_MessageGroup
 A group message body This allows forming an epoch group. More...
 
struct  GNUNET_MESSENGER_MessageAuthorization
 An authorization message body This allows providing access to a group or an epoch key using an established shared key. More...
 
struct  GNUNET_MESSENGER_MessageBody
 The unified body of a GNUNET_MESSENGER_Message. More...
 
struct  GNUNET_MESSENGER_Message
 Struct to a message. More...
 

Macros

#define GNUNET_MESSENGER_VERSION   0x00000007
 Version number of GNUnet Messenger API.
 
#define GNUNET_MESSENGER_SERVICE_NAME   "messenger"
 Identifier of GNUnet MESSENGER Service.
 
#define GNUNET_MESSENGER_EPOCH_NONCE_BYTES    sizeof (struct GNUNET_ShortHashCode)
 
#define GNUNET_MESSENGER_ENCRYPTION_KEY_NONCE_BYTES    (sizeof (struct GNUNET_ShortHashCode))
 
#define GNUNET_MESSENGER_ENCRYPTION_KEY_DATA_BYTES    (sizeof (uint32_t) + 4096 / 8)
 
#define GNUNET_MESSENGER_KIND_MAX   (GNUNET_MESSENGER_KIND_TALK)
 
#define GNUNET_MESSENGER_SECRET_IV_BYTES    sizeof (struct GNUNET_CRYPTO_SymmetricInitializationVector)
 
#define GNUNET_MESSENGER_ACCESS_KEY_BYTES
 
#define GNUNET_MESSENGER_AUTHORIZATION_KEY_BYTES    sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey)
 

Typedefs

typedef void(* GNUNET_MESSENGER_MessageCallback) (void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *sender, const struct GNUNET_MESSENGER_Contact *recipient, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, enum GNUNET_MESSENGER_MessageFlags flags)
 Method called whenever a message is sent or received from a room.
 
typedef enum GNUNET_GenericReturnValue(* GNUNET_MESSENGER_MemberCallback) (void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact)
 Method called for each member in a room during iteration.
 

Enumerations

enum  GNUNET_MESSENGER_MessageKind {
  GNUNET_MESSENGER_KIND_INFO = 1 , GNUNET_MESSENGER_KIND_JOIN = 2 , GNUNET_MESSENGER_KIND_LEAVE = 3 , GNUNET_MESSENGER_KIND_NAME = 4 ,
  GNUNET_MESSENGER_KIND_KEY = 5 , GNUNET_MESSENGER_KIND_PEER = 6 , GNUNET_MESSENGER_KIND_ID = 7 , GNUNET_MESSENGER_KIND_MISS = 8 ,
  GNUNET_MESSENGER_KIND_MERGE = 9 , GNUNET_MESSENGER_KIND_REQUEST = 10 , GNUNET_MESSENGER_KIND_INVITE = 11 , GNUNET_MESSENGER_KIND_TEXT = 12 ,
  GNUNET_MESSENGER_KIND_FILE = 13 , GNUNET_MESSENGER_KIND_PRIVATE = 14 , GNUNET_MESSENGER_KIND_DELETION = 15 , GNUNET_MESSENGER_KIND_CONNECTION = 16 ,
  GNUNET_MESSENGER_KIND_TICKET = 17 , GNUNET_MESSENGER_KIND_TRANSCRIPT = 18 , GNUNET_MESSENGER_KIND_TAG = 19 , GNUNET_MESSENGER_KIND_SUBSCRIBTION = 20 ,
  GNUNET_MESSENGER_KIND_TALK = 21 , GNUNET_MESSENGER_KIND_ANNOUNCEMENT = 22 , GNUNET_MESSENGER_KIND_SECRET = 23 , GNUNET_MESSENGER_KIND_APPEAL = 24 ,
  GNUNET_MESSENGER_KIND_ACCESS = 25 , GNUNET_MESSENGER_KIND_REVOLUTION = 26 , GNUNET_MESSENGER_KIND_GROUP = 27 , GNUNET_MESSENGER_KIND_AUTHORIZATION = 28 ,
  GNUNET_MESSENGER_KIND_UNKNOWN = 0
}
 Enum for the different supported kinds of messages. More...
 
enum  GNUNET_MESSENGER_MessageFlags {
  GNUNET_MESSENGER_FLAG_NONE = 0 , GNUNET_MESSENGER_FLAG_SENT = 1 , GNUNET_MESSENGER_FLAG_PRIVATE = 2 , GNUNET_MESSENGER_FLAG_PEER = 4 ,
  GNUNET_MESSENGER_FLAG_RECENT = 8 , GNUNET_MESSENGER_FLAG_UPDATE = 16 , GNUNET_MESSENGER_FLAG_DELETE = 32 , GNUNET_MESSENGER_FLAG_SECRET = 64 ,
  GNUNET_MESSENGER_FLAG_MEMBER = 128
}
 Enum for the different supported flags used by message handling. More...
 
enum  GNUNET_MESSENGER_ConnectionFlags { GNUNET_MESSENGER_FLAG_CONNECTION_NONE = 0 , GNUNET_MESSENGER_FLAG_CONNECTION_AUTO = 1 }
 Enum for the different supported flags used to specify connection handling. More...
 
enum  GNUNET_MESSENGER_SubscriptionFlags { GNUNET_MESSENGER_FLAG_SUBSCRIPTION_NONE = 0 , GNUNET_MESSENGER_FLAG_SUBSCRIPTION_UNSUBSCRIBE = 1 , GNUNET_MESSENGER_FLAG_SUBSCRIPTION_KEEP_ALIVE = 2 }
 Enum for the different supported flags used to specify subscription handling. More...
 
enum  GNUNET_MESSENGER_EpochFlags { GNUNET_MESSENGER_FLAG_EPOCH_NONE = 0 , GNUNET_MESSENGER_FLAG_EPOCH_VALID = 1 }
 

Functions

const char * GNUNET_MESSENGER_name_of_kind (enum GNUNET_MESSENGER_MessageKind kind)
 Get the name of a message kind.
 
void GNUNET_MESSENGER_create_room_key (union GNUNET_MESSENGER_RoomKey *key, const char *input, enum GNUNET_GenericReturnValue is_public, enum GNUNET_GenericReturnValue is_group, enum GNUNET_GenericReturnValue is_feed)
 Creates a room key from given optional input string using certain properties for this targeted room.
 
struct GNUNET_MESSENGER_HandleGNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, const struct GNUNET_CRYPTO_BlindablePrivateKey *key, const struct GNUNET_HashCode *secret, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls)
 Set up a handle for the messenger related functions and connects to all necessary services.
 
void GNUNET_MESSENGER_disconnect (struct GNUNET_MESSENGER_Handle *handle)
 Disconnect all of the messengers used services and clears up its used memory.
 
const char * GNUNET_MESSENGER_get_name (const struct GNUNET_MESSENGER_Handle *handle)
 Get the name (if specified, otherwise NULL) used by the messenger.
 
enum GNUNET_GenericReturnValue GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, const char *name)
 Set the name for the messenger handle and sends messages renaming your contact in currently open rooms.
 
const struct GNUNET_CRYPTO_BlindablePublicKeyGNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle)
 Get the public key used by the messenger or NULL if the anonymous key was used.
 
enum GNUNET_GenericReturnValue GNUNET_MESSENGER_set_key (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_CRYPTO_BlindablePrivateKey *key)
 Set the private key used by the messenger or NULL if the anonymous key should be used instead.
 
struct GNUNET_MESSENGER_RoomGNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const union GNUNET_MESSENGER_RoomKey *key)
 Open a room to send and receive messages.
 
struct GNUNET_MESSENGER_RoomGNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, const union GNUNET_MESSENGER_RoomKey *key)
 Enter a room to send and receive messages through a door opened using GNUNET_MESSENGER_open_room.
 
void GNUNET_MESSENGER_close_room (struct GNUNET_MESSENGER_Room *room)
 Close a room which was entered, opened or both in various order and variety.
 
int GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_MESSENGER_Contact *contact, GNUNET_MESSENGER_MemberCallback callback, void *cls)
 Searches for a specific contact in a given room and calls a selected callback with a given closure for each of them containing the contact as a member.
 
const struct GNUNET_HashCodeGNUNET_MESSENGER_room_get_key (const struct GNUNET_MESSENGER_Room *room)
 Get the key of a given room.
 
const struct GNUNET_MESSENGER_ContactGNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
 Get the contact of a member in a room which sent a specific message identified with a given hash.
 
const struct GNUNET_MESSENGER_ContactGNUNET_MESSENGER_get_recipient (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
 Get the contact of a member in a room which has been targeted as recipient of a specific message identified with a given hash.
 
const char * GNUNET_MESSENGER_contact_get_name (const struct GNUNET_MESSENGER_Contact *contact)
 Get the name used by the contact.
 
const struct GNUNET_CRYPTO_BlindablePublicKeyGNUNET_MESSENGER_contact_get_key (const struct GNUNET_MESSENGER_Contact *contact)
 Get the public key used by the contact or NULL if the anonymous key was used.
 
size_t GNUNET_MESSENGER_contact_get_id (const struct GNUNET_MESSENGER_Contact *contact)
 Get the locally unique id of the contact.
 
void GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_MESSENGER_Contact *contact)
 Send a message into a room.
 
void GNUNET_MESSENGER_delete_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay)
 Delete a message identified by its hash from a room.
 
const struct GNUNET_MESSENGER_MessageGNUNET_MESSENGER_get_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
 Get the message in a room identified by its hash and requests it if necessary.
 
int GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, void *cls)
 Iterates through all members of a given room and calls a selected callback for each of them with a provided closure.
 

Detailed Description

Instant messaging based on the CADET subsystem.

Macro Definition Documentation

◆ GNUNET_MESSENGER_VERSION

#define GNUNET_MESSENGER_VERSION   0x00000007

Version number of GNUnet Messenger API.

Current version of the Messenger: 0.7

Definition at line 49 of file gnunet_messenger_service.h.

◆ GNUNET_MESSENGER_SERVICE_NAME

#define GNUNET_MESSENGER_SERVICE_NAME   "messenger"

Identifier of GNUnet MESSENGER Service.

Definition at line 54 of file gnunet_messenger_service.h.

◆ GNUNET_MESSENGER_EPOCH_NONCE_BYTES

#define GNUNET_MESSENGER_EPOCH_NONCE_BYTES    sizeof (struct GNUNET_ShortHashCode)

Definition at line 203 of file gnunet_messenger_service.h.

211{
213};
214
222{
225};
226
227#define GNUNET_MESSENGER_ENCRYPTION_KEY_NONCE_BYTES \
228 (sizeof (struct GNUNET_ShortHashCode))
229#define GNUNET_MESSENGER_ENCRYPTION_KEY_DATA_BYTES \
230 (sizeof (uint32_t) + 4096 / 8)
231
239{
244
250
254 uint32_t encrypted_key_length;
255
260
265};
266
268
273{
278
283
288
293
298
303
308
313
318
323
328
333
338
343
348
353
358
363
368
373
378
383
388
393
398
403
408
413
418};
419
420#define GNUNET_MESSENGER_KIND_MAX (GNUNET_MESSENGER_KIND_TALK)
421
428const char*
430
441void
443 const char *input,
445 enum GNUNET_GenericReturnValue is_group,
446 enum GNUNET_GenericReturnValue is_feed);
447
455{
460
465
470
475
480};
481
489{
497 uint32_t messenger_version;
498};
499
507{
511 struct GNUNET_HashCode epoch;
512
517
522};
523
531{
535 struct GNUNET_HashCode epoch;
536};
537
545{
549 char *name;
550};
551
559{
564
569};
570
578{
583};
584
592{
597};
598
606{
611};
612
620{
624 struct GNUNET_HashCode epochs[2];
625
630};
631
639{
643 struct GNUNET_HashCode hash;
644};
645
653{
658
663};
664
672{
676 char *text;
677};
678
686{
691
695 struct GNUNET_HashCode hash;
696
700 char name[NAME_MAX];
701
705 char *uri;
706};
707
715{
719 uint16_t length;
720
724 char *data;
725};
726
734{
738 struct GNUNET_HashCode hash;
739
744};
745
753{
757 uint32_t amount;
758
762 uint32_t flags;
763};
764
772{
776 char *identifier;
777};
778
786{
790 struct GNUNET_HashCode hash;
791
796
800 uint16_t length;
801
805 char *data;
806};
807
815{
819 struct GNUNET_HashCode hash;
820
824 char *tag;
825};
826
834{
839
844
848 uint32_t flags;
849};
850
858{
863
867 uint16_t length;
868
872 char *data;
873};
874
882{
887
892
897
902
906 struct GNUNET_HashCode hmac;
907};
908
909#define GNUNET_MESSENGER_SECRET_IV_BYTES \
910 sizeof (struct GNUNET_CRYPTO_SymmetricInitializationVector)
911
919{
924
929
933 struct GNUNET_HashCode hmac;
934
938 uint16_t length;
939
943 char *data;
944};
945
953{
957 struct GNUNET_HashCode event;
958
963
968};
969
970#define GNUNET_MESSENGER_ACCESS_KEY_BYTES \
971 sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey) + \
972 GNUNET_CRYPTO_HPKE_SEAL_ONESHOT_OVERHEAD_BYTES
973
981{
985 struct GNUNET_HashCode event;
986
991
995 struct GNUNET_HashCode hmac;
996};
997
1005{
1010
1015
1019 struct GNUNET_HashCode hmac;
1020};
1021
1029{
1034
1039
1043 struct GNUNET_HashCode partner;
1044
1049};
1050
1051#define GNUNET_MESSENGER_AUTHORIZATION_KEY_BYTES \
1052 sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey)
1053
1061{
1066
1070 struct GNUNET_HashCode event;
1071
1076
1080 struct GNUNET_HashCode hmac;
1081};
1082
1087{
1088 union
1089 {
1118 };
1119};
1120
1125{
1130
1135};
1136
1142{
1147
1152
1157
1162
1167
1172
1177
1182
1187};
1188
1194{
1204};
1205
1211{
1216
1221
1226};
1227
1229{
1235
1240};
1241
1256typedef void
1258 struct GNUNET_MESSENGER_Room *room,
1259 const struct
1261 const struct
1262 GNUNET_MESSENGER_Contact *recipient,
1263 const struct
1264 GNUNET_MESSENGER_Message *message,
1265 const struct GNUNET_HashCode *hash,
1267
1276typedef enum GNUNET_GenericReturnValue
1278 struct GNUNET_MESSENGER_Room *room,
1279 const struct
1280 GNUNET_MESSENGER_Contact *contact);
1281
1297 const char *name,
1299 const struct GNUNET_HashCode *secret,
1301 void *msg_cls);
1302
1308void
1310
1317const char*
1319
1330 const char *name);
1331
1340
1353
1372 const union GNUNET_MESSENGER_RoomKey *key);
1373
1394 const struct GNUNET_PeerIdentity *door,
1395 const union GNUNET_MESSENGER_RoomKey *key);
1396
1406void
1408
1420int
1422 const struct GNUNET_MESSENGER_Contact *contact,
1424 void *cls);
1425
1432const struct GNUNET_HashCode*
1434
1444const struct GNUNET_MESSENGER_Contact*
1446 const struct GNUNET_HashCode *hash);
1447
1458const struct GNUNET_MESSENGER_Contact*
1460 const struct GNUNET_HashCode *hash);
1461
1468const char*
1470 GNUNET_MESSENGER_Contact *contact);
1471
1480 GNUNET_MESSENGER_Contact *contact);
1481
1488size_t
1490 GNUNET_MESSENGER_Contact *contact);
1491
1510void
1512 const struct GNUNET_MESSENGER_Message *message,
1513 const struct GNUNET_MESSENGER_Contact *contact);
1514
1526void
1528 const struct GNUNET_HashCode *hash,
1529 const struct GNUNET_TIME_Relative delay);
1530
1538const struct GNUNET_MESSENGER_Message*
1540 const struct GNUNET_HashCode *hash);
1541
1552int
1555 void *cls);
1556
1557#if 0 /* keep Emacsens' auto-indent happy */
1558{
1559#endif
1560#ifdef __cplusplus
1561}
1562#endif
1563
1564#endif // GNUNET_MESSENGER_SERVICE_H
1565
/* end of group */
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition gnunet-arm.c:108
struct GNUNET_HashCode key
The key used in the DHT.
static char * name
Name (label) of the records to list.
static int is_public
Is record public (opposite of GNUNET_GNSRECORD_RF_PRIVATE)
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
Definition gnunet-vpn.c:35
#define GNUNET_NETWORK_STRUCT_END
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;.
GNUNET_GenericReturnValue
Named constants for return values.
#define GNUNET_PACKED
gcc-ism to get packed structs.
void GNUNET_MESSENGER_delete_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay)
Delete a message identified by its hash from a room.
#define GNUNET_MESSENGER_ENCRYPTION_KEY_DATA_BYTES
struct GNUNET_MESSENGER_Handle * GNUNET_MESSENGER_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, const struct GNUNET_CRYPTO_BlindablePrivateKey *key, const struct GNUNET_HashCode *secret, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls)
Set up a handle for the messenger related functions and connects to all necessary services.
#define GNUNET_MESSENGER_AUTHORIZATION_KEY_BYTES
#define GNUNET_MESSENGER_ACCESS_KEY_BYTES
int GNUNET_MESSENGER_iterate_members(struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, void *cls)
Iterates through all members of a given room and calls a selected callback for each of them with a pr...
int GNUNET_MESSENGER_find_rooms(const struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_MESSENGER_Contact *contact, GNUNET_MESSENGER_MemberCallback callback, void *cls)
Searches for a specific contact in a given room and calls a selected callback with a given closure fo...
const struct GNUNET_HashCode * GNUNET_MESSENGER_room_get_key(const struct GNUNET_MESSENGER_Room *room)
Get the key of a given room.
GNUNET_MESSENGER_MessageKind
Enum for the different supported kinds of messages.
const struct GNUNET_MESSENGER_Contact * GNUNET_MESSENGER_get_recipient(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Get the contact of a member in a room which has been targeted as recipient of a specific message iden...
const char * GNUNET_MESSENGER_name_of_kind(enum GNUNET_MESSENGER_MessageKind kind)
Get the name of a message kind.
GNUNET_MESSENGER_MessageFlags
Enum for the different supported flags used by message handling.
#define GNUNET_MESSENGER_EPOCH_NONCE_BYTES
void(* GNUNET_MESSENGER_MessageCallback)(void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *sender, const struct GNUNET_MESSENGER_Contact *recipient, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, enum GNUNET_MESSENGER_MessageFlags flags)
Method called whenever a message is sent or received from a room.
const char * GNUNET_MESSENGER_contact_get_name(const struct GNUNET_MESSENGER_Contact *contact)
Get the name used by the contact.
const struct GNUNET_MESSENGER_Contact * GNUNET_MESSENGER_get_sender(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Get the contact of a member in a room which sent a specific message identified with a given hash.
#define GNUNET_MESSENGER_ENCRYPTION_KEY_NONCE_BYTES
#define GNUNET_MESSENGER_SECRET_IV_BYTES
struct GNUNET_MESSENGER_Room * GNUNET_MESSENGER_enter_room(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, const union GNUNET_MESSENGER_RoomKey *key)
Enter a room to send and receive messages through a door opened using GNUNET_MESSENGER_open_room.
const struct GNUNET_CRYPTO_BlindablePublicKey * GNUNET_MESSENGER_contact_get_key(const struct GNUNET_MESSENGER_Contact *contact)
Get the public key used by the contact or NULL if the anonymous key was used.
enum GNUNET_GenericReturnValue GNUNET_MESSENGER_set_key(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_CRYPTO_BlindablePrivateKey *key)
Set the private key used by the messenger or NULL if the anonymous key should be used instead.
struct GNUNET_MESSENGER_Room * GNUNET_MESSENGER_open_room(struct GNUNET_MESSENGER_Handle *handle, const union GNUNET_MESSENGER_RoomKey *key)
Open a room to send and receive messages.
GNUNET_MESSENGER_SubscriptionFlags
Enum for the different supported flags used to specify subscription handling.
GNUNET_MESSENGER_ConnectionFlags
Enum for the different supported flags used to specify connection handling.
const struct GNUNET_MESSENGER_Message * GNUNET_MESSENGER_get_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Get the message in a room identified by its hash and requests it if necessary.
void GNUNET_MESSENGER_disconnect(struct GNUNET_MESSENGER_Handle *handle)
Disconnect all of the messengers used services and clears up its used memory.
const struct GNUNET_CRYPTO_BlindablePublicKey * GNUNET_MESSENGER_get_key(const struct GNUNET_MESSENGER_Handle *handle)
Get the public key used by the messenger or NULL if the anonymous key was used.
size_t GNUNET_MESSENGER_contact_get_id(const struct GNUNET_MESSENGER_Contact *contact)
Get the locally unique id of the contact.
enum GNUNET_GenericReturnValue(* GNUNET_MESSENGER_MemberCallback)(void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact)
Method called for each member in a room during iteration.
const char * GNUNET_MESSENGER_get_name(const struct GNUNET_MESSENGER_Handle *handle)
Get the name (if specified, otherwise NULL) used by the messenger.
enum GNUNET_GenericReturnValue GNUNET_MESSENGER_set_name(struct GNUNET_MESSENGER_Handle *handle, const char *name)
Set the name for the messenger handle and sends messages renaming your contact in currently open room...
void GNUNET_MESSENGER_close_room(struct GNUNET_MESSENGER_Room *room)
Close a room which was entered, opened or both in various order and variety.
void GNUNET_MESSENGER_send_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_MESSENGER_Contact *contact)
Send a message into a room.
void GNUNET_MESSENGER_create_room_key(union GNUNET_MESSENGER_RoomKey *key, const char *input, enum GNUNET_GenericReturnValue is_public, enum GNUNET_GenericReturnValue is_group, enum GNUNET_GenericReturnValue is_feed)
Creates a room key from given optional input string using certain properties for this targeted room.
@ GNUNET_MESSENGER_KIND_INFO
The info kind.
@ GNUNET_MESSENGER_KIND_MISS
The miss kind.
@ GNUNET_MESSENGER_KIND_INVITE
The invite kind.
@ GNUNET_MESSENGER_KIND_AUTHORIZATION
The authorization kind.
@ GNUNET_MESSENGER_KIND_ANNOUNCEMENT
The announcement kind.
@ GNUNET_MESSENGER_KIND_PRIVATE
The private kind.
@ GNUNET_MESSENGER_KIND_TAG
The tag kind.
@ GNUNET_MESSENGER_KIND_FILE
The file kind.
@ GNUNET_MESSENGER_KIND_APPEAL
The appeal kind.
@ GNUNET_MESSENGER_KIND_REQUEST
The request kind.
@ GNUNET_MESSENGER_KIND_NAME
The name kind.
@ GNUNET_MESSENGER_KIND_ACCESS
The access kind.
@ GNUNET_MESSENGER_KIND_LEAVE
The leave kind.
@ GNUNET_MESSENGER_KIND_TALK
The talk kind.
@ GNUNET_MESSENGER_KIND_REVOLUTION
The revolution kind.
@ GNUNET_MESSENGER_KIND_PEER
The peer kind.
@ GNUNET_MESSENGER_KIND_UNKNOWN
The unknown kind.
@ GNUNET_MESSENGER_KIND_TRANSCRIPT
The transcript kind.
@ GNUNET_MESSENGER_KIND_KEY
The key kind.
@ GNUNET_MESSENGER_KIND_TEXT
The text kind.
@ GNUNET_MESSENGER_KIND_SECRET
The secret kind.
@ GNUNET_MESSENGER_KIND_JOIN
The join kind.
@ GNUNET_MESSENGER_KIND_SUBSCRIBTION
The subscription kind.
@ GNUNET_MESSENGER_KIND_DELETION
The deletion kind.
@ GNUNET_MESSENGER_KIND_CONNECTION
The connection kind.
@ GNUNET_MESSENGER_KIND_TICKET
The ticket kind.
@ GNUNET_MESSENGER_KIND_MERGE
The merge kind.
@ GNUNET_MESSENGER_KIND_GROUP
The group kind.
@ GNUNET_MESSENGER_KIND_ID
The id kind.
@ GNUNET_MESSENGER_FLAG_SECRET
The secret flag.
@ GNUNET_MESSENGER_FLAG_PRIVATE
The private flag.
@ GNUNET_MESSENGER_FLAG_SENT
The sent flag.
@ GNUNET_MESSENGER_FLAG_UPDATE
The update flag.
@ GNUNET_MESSENGER_FLAG_NONE
The none flag.
@ GNUNET_MESSENGER_FLAG_MEMBER
The member flag.
@ GNUNET_MESSENGER_FLAG_DELETE
The delete flag.
@ GNUNET_MESSENGER_FLAG_PEER
The peer flag.
@ GNUNET_MESSENGER_FLAG_RECENT
The recent flag.
@ GNUNET_MESSENGER_FLAG_SUBSCRIPTION_KEEP_ALIVE
The keep alive flag.
@ GNUNET_MESSENGER_FLAG_SUBSCRIPTION_UNSUBSCRIBE
The unsubscribe flag.
@ GNUNET_MESSENGER_FLAG_SUBSCRIPTION_NONE
The none flag.
@ GNUNET_MESSENGER_FLAG_CONNECTION_AUTO
The auto flag.
@ GNUNET_MESSENGER_FLAG_CONNECTION_NONE
The none flag.
@ GNUNET_MESSENGER_FLAG_EPOCH_NONE
The none flag.
@ GNUNET_MESSENGER_FLAG_EPOCH_VALID
The valid flag.
An identity signature as per LSD0001.
A private key for an identity as per LSD0001.
An identity key as per LSD0001.
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and encr...
A public key used for encryption.
A 512-bit hashcode.
An encryption key record specifies an encryption key for a given room that can be identified via a gi...
int32_t encrypted_key_checksum
The encrypted checksum of the HPKE private key.
uint8_t nonce_data[(sizeof(struct GNUNET_ShortHashCode))]
The unique nonce data to derive the secret for encryption/decryption of the HPKE private key.
uint32_t encrypted_key_length
The length of the raw HPKE private key data.
uint8_t encrypted_key_data[(sizeof(uint32_t)+4096/8)]
The encrypted data from the HPKE private key.
struct GNUNET_HashCode key
The hash identifying the port of the room.
Struct to store a unique epoch nonce for message data encryption.
GNUNET_MESSENGER_MessageCallback msg_callback
struct GNUNET_HashCode secret
An access message body This allows providing access to a group or an epoch key using a public key.
struct GNUNET_HashCode hmac
The hmac of the access.
struct GNUNET_HashCode event
The hash of the linked announcement or group message event.
uint8_t key[sizeof(struct GNUNET_CRYPTO_SymmetricSessionKey)+16+sizeof(struct GNUNET_CRYPTO_HpkeEncapsulation)]
The encrypted group or epoch key.
An announcement message body This allows announcing group and epoch keys.
union GNUNET_MESSENGER_EpochNonce nonce
The nonce of the announcement.
struct GNUNET_HashCode hmac
The hmac of the announcement.
struct GNUNET_TIME_RelativeNBO timeout
The timeout of the announcement.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the announcement in an epoch.
struct GNUNET_CRYPTO_EcdhePublicKey key
The public key to appeal access.
An appeal message body This allows appealing to receive an epoch key.
struct GNUNET_CRYPTO_EcdhePublicKey key
The public key to receive access.
struct GNUNET_TIME_RelativeNBO timeout
The timeout of the appeal.
struct GNUNET_HashCode event
The hash of the linked announcement message event.
An authorization message body This allows providing access to a group or an epoch key using an establ...
struct GNUNET_HashCode event
The hash of the linked group message event.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the group in an epoch.
struct GNUNET_HashCode hmac
The hmac of the authorization.
uint8_t key[sizeof(struct GNUNET_CRYPTO_SymmetricSessionKey)]
The encrypted group or epoch key.
The unified body of a GNUNET_MESSENGER_Message.
struct GNUNET_MESSENGER_MessageAnnouncement announcement
struct GNUNET_MESSENGER_MessageGroup group
struct GNUNET_MESSENGER_MessageSecret secret
struct GNUNET_MESSENGER_MessageDeletion deletion
struct GNUNET_MESSENGER_MessagePrivate privacy
struct GNUNET_MESSENGER_MessageConnection connection
struct GNUNET_MESSENGER_MessageText text
struct GNUNET_MESSENGER_MessageRequest request
struct GNUNET_MESSENGER_MessageMerge merge
struct GNUNET_MESSENGER_MessageId id
struct GNUNET_MESSENGER_MessageName name
struct GNUNET_MESSENGER_MessageLeave leave
struct GNUNET_MESSENGER_MessageTranscript transcript
struct GNUNET_MESSENGER_MessageRevolution revolution
struct GNUNET_MESSENGER_MessageTalk talk
struct GNUNET_MESSENGER_MessageFile file
struct GNUNET_MESSENGER_MessageTag tag
struct GNUNET_MESSENGER_MessageKey key
struct GNUNET_MESSENGER_MessageInvite invite
struct GNUNET_MESSENGER_MessageAccess access
struct GNUNET_MESSENGER_MessageSubscribtion subscription
struct GNUNET_MESSENGER_MessageAuthorization authorization
struct GNUNET_MESSENGER_MessageAppeal appeal
struct GNUNET_MESSENGER_MessageMiss miss
struct GNUNET_MESSENGER_MessagePeer peer
struct GNUNET_MESSENGER_MessageJoin join
struct GNUNET_MESSENGER_MessageTicket ticket
struct GNUNET_MESSENGER_MessageInfo info
A connection message body This allows to tell others about connection information about a peer.
uint32_t amount
The amount of connections of a peer.
uint32_t flags
The flags about the connections of a peer.
A deletion message body This allows deletion of an own previous message with any custom automatic del...
struct GNUNET_HashCode hash
The hash of the message to delete.
struct GNUNET_TIME_RelativeNBO delay
The delay of the delete operation to get processed.
char * uri
The uri of the encrypted file.
struct GNUNET_HashCode hash
The hash of the original file.
struct GNUNET_CRYPTO_SymmetricSessionKey key
The symmetric key to decrypt the file.
char name[NAME_MAX]
The name of the original file.
A group message body This allows forming an epoch group.
struct GNUNET_TIME_RelativeNBO timeout
The timeout of the group formation.
struct GNUNET_HashCode initiator
The hash of the initiator group announcement.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the group in an epoch.
struct GNUNET_HashCode partner
The hash of the partner group announcement.
The header of a GNUNET_MESSENGER_Message.
struct GNUNET_HashCode previous
The hash of the previous message from the senders perspective.
struct GNUNET_CRYPTO_BlindableKeySignature signature
The signature of the senders private key.
enum GNUNET_MESSENGER_MessageKind kind
The kind of the message.
struct GNUNET_TIME_AbsoluteNBO timestamp
The timestamp of the message.
struct GNUNET_ShortHashCode sender_id
The senders id inside of the room the message was sent in.
struct GNUNET_ShortHashCode id
The new id which will replace the senders id in a room.
uint32_t messenger_version
The version of GNUnet Messenger API.
union GNUNET_MESSENGER_RoomKey key
The hash identifying the port of the room.
struct GNUNET_PeerIdentity door
The peer identity of an open door to a room.
struct GNUNET_CRYPTO_BlindablePublicKey key
The senders blindable public key to verify its signatures.
struct GNUNET_HashCode epoch
The previous epoch the message was sent from.
struct GNUNET_CRYPTO_HpkePublicKey hpke_key
The senders HPKE public key to encrypt private messages with.
struct GNUNET_CRYPTO_BlindablePublicKey key
The new blindable public key which replaces the current senders public key.
struct GNUNET_CRYPTO_HpkePublicKey hpke_key
The new HPKE public key which replaces the current senders HPKE public key.
struct GNUNET_HashCode epoch
The previous epoch the message was sent from.
struct GNUNET_HashCode previous
The hash of a second previous message.
struct GNUNET_HashCode epochs[2]
The previous epochs the message was sent from.
struct GNUNET_PeerIdentity peer
The peer identity of a disconnected door to a room.
char * name
The new name which replaces the current senders name.
struct GNUNET_PeerIdentity peer
The peer identity of the sender opening a room.
uint16_t length
The length of the encrypted message.
char * data
The data of the encrypted message.
struct GNUNET_HashCode hash
The hash of the requested message.
A revolution message body This allows revolutionizing a group or epoch.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the announcement in an epoch.
union GNUNET_MESSENGER_EpochNonce nonce
The nonce of the revolution.
struct GNUNET_HashCode hmac
The hmac of the revolution.
A secret message body This allows exchanging encrypted messages.
uint8_t iv[sizeof(struct GNUNET_CRYPTO_SymmetricInitializationVector)]
The IV of the secret message.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the announcement in an epoch.
char * data
The data of the encrypted message.
struct GNUNET_HashCode hmac
The hmac of the encrypted message.
uint16_t length
The length of the encrypted message.
A subscription message body This allows subscribing to a discourse.
uint32_t flags
The flags about the subscription to a discourse.
struct GNUNET_TIME_RelativeNBO time
The time window of the subscription.
struct GNUNET_ShortHashCode discourse
The hash of the discourse to subscription.
A tag message body This allows tagging a message with a custom tag.
struct GNUNET_HashCode hash
The hash of the message to tag.
A talk message body This allows talking in a discourse.
uint16_t length
The length of the talk message data.
char * data
The data of the talk message.
struct GNUNET_ShortHashCode discourse
The hash of the discourse to talk.
A ticket message body This allows to exchange ticket identifiers with an audience.
char * identifier
The identifier of a ticket.
A transcript message body This allows reading the content of a sent private message.
uint16_t length
The length of the transcribed message.
struct GNUNET_HashCode hash
The hash of the original message.
struct GNUNET_CRYPTO_BlindablePublicKey key
The key from the recipient of the original message.
char * data
The data of the transcribed message.
struct GNUNET_MESSENGER_MessageHeader header
Header.
struct GNUNET_MESSENGER_MessageBody body
Body.
The identity of the host (wraps the signing key of the peer).
A 256-bit hashcode.
Time for absolute time used by GNUnet, in microseconds and in network byte order.
Time for relative time used by GNUnet, in microseconds and in network byte order.
Time for relative time used by GNUnet, in microseconds.
An epoch identifier unifies an epoch identifier code and its 256bit hash representation.
An epoch nonce unifies the epoch nonce data and its 256bit hash representation.
struct GNUNET_ShortHashCode hash
struct GNUNET_MESSENGER_EpochNonceData data
A room key unifies a room key code and its 512bit hash representation.

◆ GNUNET_MESSENGER_ENCRYPTION_KEY_NONCE_BYTES

#define GNUNET_MESSENGER_ENCRYPTION_KEY_NONCE_BYTES    (sizeof (struct GNUNET_ShortHashCode))

Definition at line 228 of file gnunet_messenger_service.h.

◆ GNUNET_MESSENGER_ENCRYPTION_KEY_DATA_BYTES

#define GNUNET_MESSENGER_ENCRYPTION_KEY_DATA_BYTES    (sizeof (uint32_t) + 4096 / 8)

Definition at line 230 of file gnunet_messenger_service.h.

◆ GNUNET_MESSENGER_KIND_MAX

#define GNUNET_MESSENGER_KIND_MAX   (GNUNET_MESSENGER_KIND_TALK)

Definition at line 421 of file gnunet_messenger_service.h.

◆ GNUNET_MESSENGER_SECRET_IV_BYTES

#define GNUNET_MESSENGER_SECRET_IV_BYTES    sizeof (struct GNUNET_CRYPTO_SymmetricInitializationVector)

Definition at line 910 of file gnunet_messenger_service.h.

◆ GNUNET_MESSENGER_ACCESS_KEY_BYTES

#define GNUNET_MESSENGER_ACCESS_KEY_BYTES
Value:

Definition at line 971 of file gnunet_messenger_service.h.

◆ GNUNET_MESSENGER_AUTHORIZATION_KEY_BYTES

#define GNUNET_MESSENGER_AUTHORIZATION_KEY_BYTES    sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey)

Definition at line 1052 of file gnunet_messenger_service.h.

Typedef Documentation

◆ GNUNET_MESSENGER_MessageCallback

typedef void(* GNUNET_MESSENGER_MessageCallback) (void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *sender, const struct GNUNET_MESSENGER_Contact *recipient, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, enum GNUNET_MESSENGER_MessageFlags flags)

Method called whenever a message is sent or received from a room.

The flags will indicate with a bitmask if a message was received privately or if the message was sent by the client.

Parameters
[in/out]cls Closure from GNUNET_MESSENGER_connect
[in]roomRoom handle
[in]senderSender of message
[in]recipientRecipient of message
[in]messageNewly received or sent message
[in]hashHash identifying the message
[in]flagsFlags of the message

Definition at line 1257 of file gnunet_messenger_service.h.

◆ GNUNET_MESSENGER_MemberCallback

typedef enum GNUNET_GenericReturnValue(* GNUNET_MESSENGER_MemberCallback) (void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact)

Method called for each member in a room during iteration.

If the method returns GNUNET_YES the iteration continues, otherwise it will quit the iteration.

Parameters
[in/out]cls Closure from GNUNET_MESSENGER_iterate_members
[in]roomRoom handle
[in]contactContact handle

Definition at line 1257 of file gnunet_messenger_service.h.

Enumeration Type Documentation

◆ GNUNET_MESSENGER_MessageKind

Enum for the different supported kinds of messages.

Enumerator
GNUNET_MESSENGER_KIND_INFO 

The info kind.

The message contains a GNUNET_MESSENGER_MessageInfo body.

GNUNET_MESSENGER_KIND_JOIN 

The join kind.

The message contains a GNUNET_MESSENGER_MessageJoin body.

GNUNET_MESSENGER_KIND_LEAVE 

The leave kind.

The message contains a GNUNET_MESSENGER_MessageLeave body.

GNUNET_MESSENGER_KIND_NAME 

The name kind.

The message contains a GNUNET_MESSENGER_MessageName body.

GNUNET_MESSENGER_KIND_KEY 

The key kind.

The message contains a GNUNET_MESSENGER_MessageKey body.

GNUNET_MESSENGER_KIND_PEER 

The peer kind.

The message contains a GNUNET_MESSENGER_MessagePeer body.

GNUNET_MESSENGER_KIND_ID 

The id kind.

The message contains a GNUNET_MESSENGER_MessageId body.

GNUNET_MESSENGER_KIND_MISS 

The miss kind.

The message contains a GNUNET_MESSENGER_MessageMiss body.

GNUNET_MESSENGER_KIND_MERGE 

The merge kind.

The message contains a GNUNET_MESSENGER_MessageMerge body.

GNUNET_MESSENGER_KIND_REQUEST 

The request kind.

The message contains a GNUNET_MESSENGER_MessageRequest body.

GNUNET_MESSENGER_KIND_INVITE 

The invite kind.

The message contains a GNUNET_MESSENGER_MessageInvite body.

GNUNET_MESSENGER_KIND_TEXT 

The text kind.

The message contains a GNUNET_MESSENGER_MessageText body.

GNUNET_MESSENGER_KIND_FILE 

The file kind.

The message contains a GNUNET_MESSENGER_MessageFile body.

GNUNET_MESSENGER_KIND_PRIVATE 

The private kind.

The message contains a GNUNET_MESSENGER_MessagePrivate body.

GNUNET_MESSENGER_KIND_DELETION 

The deletion kind.

The message contains a GNUNET_MESSENGER_MessageDeletion body.

GNUNET_MESSENGER_KIND_CONNECTION 

The connection kind.

The message contains a GNUNET_MESSENGER_MessageConnection body.

GNUNET_MESSENGER_KIND_TICKET 

The ticket kind.

The message contains a GNUNET_MESSENGER_MessageTicket body.

GNUNET_MESSENGER_KIND_TRANSCRIPT 

The transcript kind.

The message contains a GNUNET_MESSENGER_MessageTranscript body.

GNUNET_MESSENGER_KIND_TAG 

The tag kind.

The message contains a GNUNET_MESSENGER_MessageTag body.

GNUNET_MESSENGER_KIND_SUBSCRIBTION 

The subscription kind.

The message contains a GNUNET_MESSENGER_MessageSubscribtion body.

GNUNET_MESSENGER_KIND_TALK 

The talk kind.

The message contains a GNUNET_MESSENGER_MessageTalk body.

GNUNET_MESSENGER_KIND_ANNOUNCEMENT 

The announcement kind.

The message contains a GNUNET_MESSENGER_MessageAnnouncement body.

GNUNET_MESSENGER_KIND_SECRET 

The secret kind.

The message contains a GNUNET_MESSENGER_MessageSecret body.

GNUNET_MESSENGER_KIND_APPEAL 

The appeal kind.

The message contains a GNUNET_MESSENGER_MessageAppeal body.

GNUNET_MESSENGER_KIND_ACCESS 

The access kind.

The message contains a GNUNET_MESSENGER_MessageAccess body.

GNUNET_MESSENGER_KIND_REVOLUTION 

The revolution kind.

The message contains a GNUNET_MESSENGER_MessageRevolution body.

GNUNET_MESSENGER_KIND_GROUP 

The group kind.

The message contains a GNUNET_MESSENGER_MessageGroup body.

GNUNET_MESSENGER_KIND_AUTHORIZATION 

The authorization kind.

The message contains a GNUNET_MESSENGER_MessageAuthorization body.

GNUNET_MESSENGER_KIND_UNKNOWN 

The unknown kind.

The message contains an unknown body.

Definition at line 273 of file gnunet_messenger_service.h.

◆ GNUNET_MESSENGER_MessageFlags

Enum for the different supported flags used by message handling.

Compatible flags can be OR'ed together.

Enumerator
GNUNET_MESSENGER_FLAG_NONE 

The none flag.

The flag indicates that the message is not affected by any special context.

GNUNET_MESSENGER_FLAG_SENT 

The sent flag.

The flag indicates that the message was sent by the client.

GNUNET_MESSENGER_FLAG_PRIVATE 

The private flag.

The flag indicates that the message was privately encrypted.

GNUNET_MESSENGER_FLAG_PEER 

The peer flag.

The flag indicates that the message was sent by a peer and not a member.

GNUNET_MESSENGER_FLAG_RECENT 

The recent flag.

The flag indicates that the message was recently handled by the service.

GNUNET_MESSENGER_FLAG_UPDATE 

The update flag.

The flag indicates that the message was updated by the client.

GNUNET_MESSENGER_FLAG_DELETE 

The delete flag.

The flag indicates that the message was deleted by the service.

GNUNET_MESSENGER_FLAG_SECRET 

The secret flag.

The flag indicates that the message was encrypted as epoch secret.

GNUNET_MESSENGER_FLAG_MEMBER 

The member flag.

The flag indicates that the message introduces a new member to the client.

Definition at line 1142 of file gnunet_messenger_service.h.

◆ GNUNET_MESSENGER_ConnectionFlags

Enum for the different supported flags used to specify connection handling.

Compatible flags can be OR'ed together.

Enumerator
GNUNET_MESSENGER_FLAG_CONNECTION_NONE 

The none flag.

The flag indicates that the connection is not affected by any modifications. GNUNET_MESSENGER_FLAG_CONNECTION_NONE

GNUNET_MESSENGER_FLAG_CONNECTION_AUTO 

The auto flag.

The flag indicates that a peer will automatically handle routing. GNUNET_MESSENGER_FLAG_CONNECTION_AUTO

Definition at line 1194 of file gnunet_messenger_service.h.

◆ GNUNET_MESSENGER_SubscriptionFlags

Enum for the different supported flags used to specify subscription handling.

Compatible flags can be OR'ed together.

Enumerator
GNUNET_MESSENGER_FLAG_SUBSCRIPTION_NONE 

The none flag.

The flag indicates that the subscription is not affected by any modifications.

GNUNET_MESSENGER_FLAG_SUBSCRIPTION_UNSUBSCRIBE 

The unsubscribe flag.

The flag indicates that a member will unsubscribe a discourse.

GNUNET_MESSENGER_FLAG_SUBSCRIPTION_KEEP_ALIVE 

The keep alive flag.

The flag indicates that a member keeps a subscription alive implicitly.

Definition at line 1211 of file gnunet_messenger_service.h.

◆ GNUNET_MESSENGER_EpochFlags

Enumerator
GNUNET_MESSENGER_FLAG_EPOCH_NONE 

The none flag.

This flag indicates that the epoch or group key is not affected by any modifications.

GNUNET_MESSENGER_FLAG_EPOCH_VALID 

The valid flag.

This flag indicates whether an epoch or group key is still valid.

Definition at line 1229 of file gnunet_messenger_service.h.

Function Documentation

◆ GNUNET_MESSENGER_name_of_kind()

const char * GNUNET_MESSENGER_name_of_kind ( enum GNUNET_MESSENGER_MessageKind  kind)

Get the name of a message kind.

Parameters
[in]kindKind of a message
Returns
Name of that kind

Definition at line 46 of file messenger_api.c.

47{
48 switch (kind)
49 {
51 return "INFO";
53 return "JOIN";
55 return "LEAVE";
57 return "NAME";
59 return "KEY";
61 return "PEER";
63 return "ID";
65 return "MISS";
67 return "MERGE";
69 return "REQUEST";
71 return "INVITE";
73 return "TEXT";
75 return "FILE";
77 return "PRIVATE";
79 return "DELETION";
81 return "CONNECTION";
83 return "TICKET";
85 return "TRANSCRIPT";
87 return "TAG";
89 return "SUBSCRIPTION";
91 return "TALK";
93 return "ANNOUNCEMENT";
95 return "SECRET";
97 return "APPEAL";
99 return "ACCESS";
101 return "REVOLUTION";
103 return "GROUP";
105 return "AUTHORIZATION";
106 default:
107 return "UNKNOWN";
108 }
109}

References GNUNET_MESSENGER_KIND_ACCESS, GNUNET_MESSENGER_KIND_ANNOUNCEMENT, GNUNET_MESSENGER_KIND_APPEAL, GNUNET_MESSENGER_KIND_AUTHORIZATION, GNUNET_MESSENGER_KIND_CONNECTION, GNUNET_MESSENGER_KIND_DELETION, GNUNET_MESSENGER_KIND_FILE, GNUNET_MESSENGER_KIND_GROUP, GNUNET_MESSENGER_KIND_ID, GNUNET_MESSENGER_KIND_INFO, GNUNET_MESSENGER_KIND_INVITE, GNUNET_MESSENGER_KIND_JOIN, GNUNET_MESSENGER_KIND_KEY, GNUNET_MESSENGER_KIND_LEAVE, GNUNET_MESSENGER_KIND_MERGE, GNUNET_MESSENGER_KIND_MISS, GNUNET_MESSENGER_KIND_NAME, GNUNET_MESSENGER_KIND_PEER, GNUNET_MESSENGER_KIND_PRIVATE, GNUNET_MESSENGER_KIND_REQUEST, GNUNET_MESSENGER_KIND_REVOLUTION, GNUNET_MESSENGER_KIND_SECRET, GNUNET_MESSENGER_KIND_SUBSCRIBTION, GNUNET_MESSENGER_KIND_TAG, GNUNET_MESSENGER_KIND_TALK, GNUNET_MESSENGER_KIND_TEXT, GNUNET_MESSENGER_KIND_TICKET, and GNUNET_MESSENGER_KIND_TRANSCRIPT.

Referenced by check_send_message(), handle_recv_message(), handle_send_message(), handle_service_message(), handle_tunnel_message(), notify_srv_handle_message(), on_message(), send_srv_room_message(), and verify_tunnel_message().

Here is the caller graph for this function:

◆ GNUNET_MESSENGER_create_room_key()

void GNUNET_MESSENGER_create_room_key ( union GNUNET_MESSENGER_RoomKey key,
const char *  input,
enum GNUNET_GenericReturnValue  is_public,
enum GNUNET_GenericReturnValue  is_group,
enum GNUNET_GenericReturnValue  is_feed 
)

Creates a room key from given optional input string using certain properties for this targeted room.

Parameters
[out]keyRoom key
[in]inputInput string or NULL
[in]is_publicPublic property
[in]is_groupGroup property
[in]is_feedFeed property

Definition at line 113 of file messenger_api.c.

118{
120
121 if (input)
123 input, strlen (input), &(key->hash));
124 else
127 &(key->hash), sizeof (key->hash));
128
129 key->code.public_bit = GNUNET_YES == is_public? 1 : 0;
130 key->code.group_bit = GNUNET_YES == is_group? 1 : 0;
131 key->code.feed_bit = GNUNET_YES == is_feed? 1 : 0;
132 key->code.unused_bits = 0;
133}
void GNUNET_CRYPTO_random_block(enum GNUNET_CRYPTO_Quality mode, void *buffer, size_t length)
Fill block with a random values.
@ GNUNET_CRYPTO_QUALITY_STRONG
High-quality operations are desired.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition crypto_hash.c:41
@ GNUNET_YES
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.

References GNUNET_assert, GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_QUALITY_STRONG, GNUNET_CRYPTO_random_block(), GNUNET_YES, is_public, and key.

Referenced by on_identity().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_MESSENGER_connect()

struct GNUNET_MESSENGER_Handle * GNUNET_MESSENGER_connect ( const struct GNUNET_CONFIGURATION_Handle cfg,
const char *  name,
const struct GNUNET_CRYPTO_BlindablePrivateKey key,
const struct GNUNET_HashCode secret,
GNUNET_MESSENGER_MessageCallback  msg_callback,
void *  msg_cls 
)

Set up a handle for the messenger related functions and connects to all necessary services.

It will use the a custom name in combination of a private key provided for signing all messages from the handle and a secret that is used to encrypt/decrypt locally stored keys.

Parameters
[in]cfgConfiguration to use
[in]nameName or NULL
[in]keyPrivate key or NULL to stay anonymous
[in]secretPrivate secret for local key storage or NULL
[in]msg_callbackFunction called when a new message is sent or received
[in,out]msg_clsClosure for the msg_callback handler
Returns
Messenger handle to use, NULL on error

Definition at line 763 of file messenger_api.c.

769{
771
773
775
777
778 if (handle->mq)
779 {
781 struct GNUNET_MQ_Envelope *env;
782
784
787
788 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connect handle!\n");
789
792 return handle;
793 }
794 else
795 {
797 return NULL;
798 }
799}
struct GNUNET_MessageHeader * msg
Definition 005.c:2
struct GNUNET_MQ_Envelope * env
Definition 005.c:1
#define GNUNET_log(kind,...)
ssize_t GNUNET_CRYPTO_blindable_sk_get_length(const struct GNUNET_CRYPTO_BlindablePrivateKey *key)
Get the compacted length of a GNUNET_CRYPTO_BlindablePrivateKey.
Definition crypto_pkey.c:64
@ GNUNET_ERROR_TYPE_DEBUG
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition mq.c:305
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
#define GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_CREATE
void destroy_handle(struct GNUNET_MESSENGER_Handle *handle)
Destroys a handle and frees its memory fully from the client API.
struct GNUNET_MESSENGER_Handle * create_handle(const struct GNUNET_CONFIGURATION_Handle *config, const struct GNUNET_HashCode *secret, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls)
Creates and allocates a new handle using a given configuration, a secret and a custom message callbac...
void set_handle_name(struct GNUNET_MESSENGER_Handle *handle, const char *name)
Sets the name of a handle to a specific name.
void set_handle_key(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_CRYPTO_BlindablePrivateKey *key)
Sets the keypair of a given handle to the keypair of a specific private key.
static void reconnect(void)
Adjust exponential back-off and reconnect to the service.
Message to create a handle for a client.
struct GNUNET_MQ_Handle * mq
Connection to VPN service.
Definition vpn_api.c:44

References cfg, create_handle(), destroy_handle(), env, GNUNET_assert, GNUNET_CRYPTO_blindable_sk_get_length(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_CREATE, GNUNET_MQ_msg, GNUNET_MQ_send(), handle, key, GNUNET_VPN_Handle::mq, msg, GNUNET_MESSENGER_Handle::msg_callback, GNUNET_MESSENGER_Handle::msg_cls, name, reconnect(), GNUNET_MESSENGER_Handle::secret, set_handle_key(), and set_handle_name().

Referenced by on_ego_lookup(), run(), and start_service_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_MESSENGER_disconnect()

void GNUNET_MESSENGER_disconnect ( struct GNUNET_MESSENGER_Handle handle)

Disconnect all of the messengers used services and clears up its used memory.

Parameters
[in,out]handleMessenger handle to use

Definition at line 803 of file messenger_api.c.

804{
806 struct GNUNET_MQ_Envelope *env;
807
808 if (! handle)
809 return;
810
811 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnect handle!\n");
812
815
817}
#define GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_DESTROY
Message to destroy the handle for a client.

References destroy_handle(), env, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_DESTROY, GNUNET_MQ_msg, GNUNET_MQ_send(), handle, GNUNET_VPN_Handle::mq, and msg.

Referenced by shutdown_hook(), and stop_service_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_MESSENGER_get_name()

const char * GNUNET_MESSENGER_get_name ( const struct GNUNET_MESSENGER_Handle handle)

Get the name (if specified, otherwise NULL) used by the messenger.

Parameters
[in]handleMessenger handle to use
Returns
Name used by the messenger or NULL

Definition at line 1233 of file messenger_api.c.

1234{
1235 if (! handle)
1236 return NULL;
1237
1238 return get_handle_name (handle);
1239}
const char * get_handle_name(const struct GNUNET_MESSENGER_Handle *handle)
Returns the current name of a given handle or NULL if no valid name was assigned yet.

References get_handle_name(), and handle.

Referenced by on_identity(), and on_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_MESSENGER_set_name()

enum GNUNET_GenericReturnValue GNUNET_MESSENGER_set_name ( struct GNUNET_MESSENGER_Handle handle,
const char *  name 
)

Set the name for the messenger handle and sends messages renaming your contact in currently open rooms.

Parameters
[in,out]handleMessenger handle to use
[in]nameName for the messenger to change to
Returns
GNUNET_YES on success, GNUNET_NO on failure and GNUNET_SYSERR if handle is NULL

Definition at line 1272 of file messenger_api.c.

1274{
1275 if (! handle)
1276 return GNUNET_SYSERR;
1277
1278 set_handle_name (handle, strlen (name) > 0 ? name : NULL);
1280 return GNUNET_YES;
1281}
@ GNUNET_SYSERR
static enum GNUNET_GenericReturnValue iterate_send_name_to_room(void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact)

References GNUNET_MESSENGER_find_rooms(), GNUNET_SYSERR, GNUNET_YES, handle, iterate_send_name_to_room(), name, and set_handle_name().

Here is the call graph for this function:

◆ GNUNET_MESSENGER_get_key()

const struct GNUNET_CRYPTO_BlindablePublicKey * GNUNET_MESSENGER_get_key ( const struct GNUNET_MESSENGER_Handle handle)

Get the public key used by the messenger or NULL if the anonymous key was used.

Parameters
[in]handleMessenger handle to use
Returns
Used public key or NULL

Definition at line 1296 of file messenger_api.c.

1297{
1298 if (! handle)
1299 return NULL;
1300
1302}
static const struct GNUNET_CRYPTO_BlindablePublicKey * get_non_anonymous_key(const struct GNUNET_CRYPTO_BlindablePublicKey *public_key)
const struct GNUNET_CRYPTO_BlindablePublicKey * get_handle_pubkey(const struct GNUNET_MESSENGER_Handle *handle)
Returns the public key of a given handle.

References get_handle_pubkey(), get_non_anonymous_key(), and handle.

Here is the call graph for this function:

◆ GNUNET_MESSENGER_set_key()

enum GNUNET_GenericReturnValue GNUNET_MESSENGER_set_key ( struct GNUNET_MESSENGER_Handle handle,
const struct GNUNET_CRYPTO_BlindablePrivateKey key 
)

Set the private key used by the messenger or NULL if the anonymous key should be used instead.

The currently used key will be replaced and the change will get signed accordingly to be verified by all contacts.

Parameters
[in,out]handleMessenger handle to use
[in]keyPrivate key to change to or NULL
Returns
GNUNET_YES on success, GNUNET_NO on failure and GNUNET_SYSERR if handle is NULL

Definition at line 1329 of file messenger_api.c.

1331{
1332 if (! handle)
1333 return GNUNET_SYSERR;
1334
1335 if (! key)
1336 {
1338 set_handle_key (handle, NULL);
1339 return GNUNET_YES;
1340 }
1341
1343 return GNUNET_SYSERR;
1344
1345 {
1347 GNUNET_memcpy (&priv, key, sizeof (priv));
1348
1351 }
1352
1354 return GNUNET_YES;
1355}
void GNUNET_CRYPTO_private_key_clear(struct GNUNET_CRYPTO_BlindablePrivateKey *pk)
Clear memory that was used to store a private key.
Definition crypto_pkey.c:47
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
static enum GNUNET_GenericReturnValue iterate_send_key_to_room(void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact)

References GNUNET_CRYPTO_blindable_sk_get_length(), GNUNET_CRYPTO_private_key_clear(), GNUNET_memcpy, GNUNET_MESSENGER_find_rooms(), GNUNET_SYSERR, GNUNET_YES, handle, iterate_send_key_to_room(), key, and set_handle_key().

Here is the call graph for this function:

◆ GNUNET_MESSENGER_open_room()

struct GNUNET_MESSENGER_Room * GNUNET_MESSENGER_open_room ( struct GNUNET_MESSENGER_Handle handle,
const union GNUNET_MESSENGER_RoomKey key 
)

Open a room to send and receive messages.

The room will use the specified key as port for the underlying cadet service. Opening a room results in opening the port for incoming connections as possible door.

Notice that there can only be one room related to a specific key. So trying to open two rooms with the same key will result in opening the room once but returning the handle both times because the room stays open.

You can also open a room after entering it through a door using GNUNET_MESSENGER_enter_room. This will notify all entered doors to list you as new door.

( All doors form a ring structured network to shorten the latency sending and receiving messages. )

Parameters
[in,out]handleMessenger handle to use
[in]keyHash identifying the port
Returns
Room handle, NULL on error

Definition at line 1359 of file messenger_api.c.

1361{
1362 struct GNUNET_MESSENGER_Room *room;
1363
1364 if ((! handle) || (! key))
1365 return NULL;
1366
1367 if ((key->code.feed_bit) && (! key->code.group_bit))
1368 {
1370 "Personal rooms containing private feeds should not be opened!")
1371 ;
1372 return NULL;
1373 }
1374
1375 room = get_handle_room (handle, &(key->hash), GNUNET_YES);
1376
1377 if (! room)
1378 return NULL;
1379
1380 send_open_room (handle, room);
1381 return room;
1382}
@ GNUNET_ERROR_TYPE_WARNING
static void send_open_room(struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room)
struct GNUNET_MESSENGER_Room * get_handle_room(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key, enum GNUNET_GenericReturnValue init)
Returns the room known to a handle identified by a given key.

References get_handle_room(), GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_YES, handle, key, and send_open_room().

Referenced by join_room_run(), and on_identity().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_MESSENGER_enter_room()

struct GNUNET_MESSENGER_Room * GNUNET_MESSENGER_enter_room ( struct GNUNET_MESSENGER_Handle handle,
const struct GNUNET_PeerIdentity door,
const union GNUNET_MESSENGER_RoomKey key 
)

Enter a room to send and receive messages through a door opened using GNUNET_MESSENGER_open_room.

Notice that there can only be one room related to a specific key. So trying to enter two rooms with the same key will result in entering the room once but returning the handle both times because the room stays entered. You can however enter a room through multiple doors in parallel which results in connecting both ends. But entering the room through the same door won't have any effect after the first time.

You can also enter a room through a door after opening it using GNUNET_MESSENGER_open_room. But the door may not be your own peer identity.

( All doors form a ring structured network to shorten the latency sending and receiving messages. )

Parameters
[in,out]handleMessenger handle to use
[in]doorPeer identity of an open door
[in]keyHash identifying the port
Returns
Room handle, NULL on error

Definition at line 1386 of file messenger_api.c.

1389{
1390 struct GNUNET_MESSENGER_Room *room;
1391
1392 if ((! handle) || (! door) || (! key))
1393 return NULL;
1394
1395 room = get_handle_room (handle, &(key->hash), GNUNET_YES);
1396
1397 if (! room)
1398 return NULL;
1399
1400 send_enter_room (handle, room, door);
1401 return room;
1402}
static void send_enter_room(struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_PeerIdentity *door)

References get_handle_room(), GNUNET_YES, handle, key, and send_enter_room().

Referenced by join_room_run(), and on_identity().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_MESSENGER_close_room()

void GNUNET_MESSENGER_close_room ( struct GNUNET_MESSENGER_Room room)

Close a room which was entered, opened or both in various order and variety.

Closing a room will destroy all connections from your peer to another and the other way around.

( After a member closes a door, all members entered through that specific door have to use another one or open the room on their own. )

Parameters
[in,out]roomRoom handle

Definition at line 1406 of file messenger_api.c.

1407{
1408 struct GNUNET_MESSENGER_Message *message;
1409
1410 if (! room)
1411 return;
1412
1413 message = create_message_leave ();
1414
1415 if (! message)
1416 return;
1417
1418 enqueue_message_to_room (room, NULL, message, NULL, GNUNET_YES);
1419}
void enqueue_message_to_room(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *epoch, struct GNUNET_MESSENGER_Message *message, struct GNUNET_MESSENGER_Message *transcript, enum GNUNET_GenericReturnValue sync)
Enqueus a message and its optional transcript for sending it to a given room and epoch.
struct GNUNET_MESSENGER_Message * create_message_leave(void)
Creates and allocates a new leave message.

References create_message_leave(), enqueue_message_to_room(), and GNUNET_YES.

Referenced by shutdown_hook().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_MESSENGER_find_rooms()

int GNUNET_MESSENGER_find_rooms ( const struct GNUNET_MESSENGER_Handle handle,
const struct GNUNET_MESSENGER_Contact contact,
GNUNET_MESSENGER_MemberCallback  callback,
void *  cls 
)

Searches for a specific contact in a given room and calls a selected callback with a given closure for each of them containing the contact as a member.

The callback will receive a room matching the condition and the given contact. The function returns the amount of rooms iterated with the given callback.

Parameters
[in]handleMessenger handle to use
[in]contactContact handle
[in]callbackFunction called for each room
[in]clsClosure for the callback handler
Returns
Amount of rooms iterated

Definition at line 1460 of file messenger_api.c.

1464{
1465 struct GNUNET_MESSENGER_RoomFind find;
1466
1467 if (! handle)
1468 return GNUNET_SYSERR;
1469
1470 find.contact = contact;
1471 find.callback = callback;
1472 find.counter = (contact? contact->rc : SIZE_MAX);
1473 find.cls = cls;
1474
1475 if (find.counter <= 0)
1476 return 0;
1477
1479 iterate_find_room, &find);
1480}
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
static enum GNUNET_GenericReturnValue iterate_find_room(void *cls, const struct GNUNET_HashCode *key, void *value)
#define SIZE_MAX
Definition platform.h:209
GNUNET_MESSENGER_MemberCallback callback
const struct GNUNET_MESSENGER_Contact * contact

References GNUNET_MESSENGER_RoomFind::callback, GNUNET_MESSENGER_RoomFind::cls, GNUNET_MESSENGER_RoomFind::contact, GNUNET_MESSENGER_RoomFind::counter, GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_SYSERR, handle, iterate_find_room(), GNUNET_MESSENGER_Contact::rc, and SIZE_MAX.

Referenced by GNUNET_MESSENGER_set_key(), and GNUNET_MESSENGER_set_name().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_MESSENGER_room_get_key()

const struct GNUNET_HashCode * GNUNET_MESSENGER_room_get_key ( const struct GNUNET_MESSENGER_Room room)

Get the key of a given room.

Parameters
[in]roomRoom handle
Returns
Hash identifying the port or NULL on failure

Definition at line 1484 of file messenger_api.c.

1485{
1486 if (! room)
1487 return NULL;
1488
1489 return get_room_key (room);
1490}
const struct GNUNET_HashCode * get_room_key(const struct GNUNET_MESSENGER_Room *room)
Return a the hash representation of a given room.

References get_room_key().

Referenced by on_message_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_MESSENGER_get_sender()

const struct GNUNET_MESSENGER_Contact * GNUNET_MESSENGER_get_sender ( const struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash 
)

Get the contact of a member in a room which sent a specific message identified with a given hash.

Notice that contacts are independent of rooms but will be removed if all rooms containing these contacts get closed.

Parameters
[in]roomRoom handle
[in]hashHash identifying a message
Returns
Contact handle, NULL otherwise

Definition at line 1494 of file messenger_api.c.

1496{
1497 if ((! room) || (! hash))
1498 return NULL;
1499
1500 return get_room_sender (room, hash);
1501}
struct GNUNET_MESSENGER_Contact * get_room_sender(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Returns a messages sender locally stored from a map for a given hash in a room.

References get_room_sender().

Here is the call graph for this function:

◆ GNUNET_MESSENGER_get_recipient()

const struct GNUNET_MESSENGER_Contact * GNUNET_MESSENGER_get_recipient ( const struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash 
)

Get the contact of a member in a room which has been targeted as recipient of a specific message identified with a given hash.

Notice that contacts are independent of rooms but will be removed if all rooms containing these contacts get closed.

Parameters
[in]roomRoom handle
[in]hashHash identifying a message
Returns
Contact handle, NULL otherwise

Definition at line 1505 of file messenger_api.c.

1507{
1508 if ((! room) || (! hash))
1509 return NULL;
1510
1511 return get_room_recipient (room, hash);
1512}
struct GNUNET_MESSENGER_Contact * get_room_recipient(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Returns a messages recipient locally stored from a map for a given hash in a room.

References get_room_recipient().

Here is the call graph for this function:

◆ GNUNET_MESSENGER_contact_get_name()

const char * GNUNET_MESSENGER_contact_get_name ( const struct GNUNET_MESSENGER_Contact contact)

Get the name used by the contact.

Parameters
[in]contactContact handle
Returns
Name of contact or NULL

Definition at line 1516 of file messenger_api.c.

1518{
1519 if (! contact)
1520 return NULL;
1521
1522 return get_contact_name (contact);
1523}
const char * get_contact_name(const struct GNUNET_MESSENGER_Contact *contact)
Returns the current name of a given contact or NULL if no valid name was assigned yet.

References get_contact_name().

Referenced by on_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_MESSENGER_contact_get_key()

const struct GNUNET_CRYPTO_BlindablePublicKey * GNUNET_MESSENGER_contact_get_key ( const struct GNUNET_MESSENGER_Contact contact)

Get the public key used by the contact or NULL if the anonymous key was used.

Parameters
[in]contactContact handle
Returns
Public key used by contact or NULL

Definition at line 1527 of file messenger_api.c.

1529{
1530 if (! contact)
1531 return NULL;
1532
1533 return get_non_anonymous_key (get_contact_key (contact));
1534}
const struct GNUNET_CRYPTO_BlindablePublicKey * get_contact_key(const struct GNUNET_MESSENGER_Contact *contact)
Returns the blindable public key of a given contact.

References get_contact_key(), and get_non_anonymous_key().

Referenced by iterate_send_private_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_MESSENGER_contact_get_id()

size_t GNUNET_MESSENGER_contact_get_id ( const struct GNUNET_MESSENGER_Contact contact)

Get the locally unique id of the contact.

Parameters
[in]contactContact handle
Returns
Locally unique contact id or zero

Definition at line 1538 of file messenger_api.c.

1540{
1541 if (! contact)
1542 return 0;
1543
1544 return get_contact_id (contact);
1545}
size_t get_contact_id(const struct GNUNET_MESSENGER_Contact *contact)
Returns the locally unique identifier of a given contact.

References get_contact_id().

Here is the call graph for this function:

◆ GNUNET_MESSENGER_send_message()

void GNUNET_MESSENGER_send_message ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_MESSENGER_Message message,
const struct GNUNET_MESSENGER_Contact contact 
)

Send a message into a room.

If you opened the room all entered members will receive the message. If you entered the room through a door all so entered doors will receive the message as well. All members receiving the message will also propagate this message recursively as long as the message is unknown to them.

Notice that all messages sent and received are also stored and can be propagated to new members entering the room.

If you provide a specific contact as receiver of the given message, the message will automatically be encrypted and sent as a private message (see GNUNET_MESSENGER_MessagePrivate). Therefore the selected contact will be the only member receiving the actual message.

Sending a message to all members in a given room can be done by providing NULL as contact.

Parameters
[in,out]roomRoom handle
[in,out]messageNew message to send
[in]contactContact or NULL

Definition at line 1612 of file messenger_api.c.

1615{
1616 const struct GNUNET_CRYPTO_BlindablePublicKey *public_key;
1617 const struct GNUNET_CRYPTO_HpkePublicKey *encryption_key;
1618
1619 if ((! room) || (! message))
1620 return;
1621
1622 switch (filter_message_sending (message))
1623 {
1624 case GNUNET_SYSERR:
1626 "Sending message aborted: This kind of message is reserved for the service!\n");
1627 return;
1628 case GNUNET_NO:
1630 "Sending message aborted: This kind of message could cause issues!\n");
1631 return;
1632 default:
1633 break;
1634 }
1635
1636 if (contact)
1637 {
1638 public_key = get_non_anonymous_key (
1639 get_contact_key (contact));
1640
1641 if (! public_key)
1642 {
1644 "Sending message aborted: Invalid key!\n");
1645 return;
1646 }
1647
1648 encryption_key = get_contact_encryption_key (
1649 contact, get_room_key (room));
1650
1651 if (! encryption_key)
1652 {
1654 "Sending message aborted: Missing encryption key!\n");
1655 return;
1656 }
1657 }
1658 else
1659 {
1660 public_key = NULL;
1661 encryption_key = NULL;
1662 }
1663
1665 room, copy_message (message), public_key, encryption_key);
1666}
@ GNUNET_NO
@ GNUNET_ERROR_TYPE_ERROR
static void send_message_to_room_with_key(struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_CRYPTO_BlindablePublicKey *public_key, const struct GNUNET_CRYPTO_HpkePublicKey *encryption_key)
const struct GNUNET_CRYPTO_HpkePublicKey * get_contact_encryption_key(const struct GNUNET_MESSENGER_Contact *contact, const struct GNUNET_HashCode *key)
Returns the HPKE public key of a given contact for a specific room that is identified via its own roo...
struct GNUNET_MESSENGER_Message * copy_message(const struct GNUNET_MESSENGER_Message *message)
Creates and allocates a copy of a given message.
enum GNUNET_GenericReturnValue filter_message_sending(const struct GNUNET_MESSENGER_Message *message)
Returns whether a specific kind of message should be sent by a client.

References copy_message(), filter_message_sending(), get_contact_encryption_key(), get_contact_key(), get_non_anonymous_key(), get_room_key(), GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_NO, GNUNET_SYSERR, and send_message_to_room_with_key().

Referenced by iterate_send_private_message(), on_message(), and read_stdio().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_MESSENGER_delete_message()

void GNUNET_MESSENGER_delete_message ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
const struct GNUNET_TIME_Relative  delay 
)

Delete a message identified by its hash from a room.

A deletion will be propagated to all members of the room as with any other sent message. Notice that a deletion will only request other members of the room to delete the selected message. If you are not permitted to delete the message, the deletion will be ignored.

Depending on the implementation other clients may also ignore your deletion request in other circumstances.

Parameters
[in,out]roomRoom handle
[in]messageMessage to delete
[in]delayDelay to delete the message

Definition at line 1670 of file messenger_api.c.

1673{
1674 const struct GNUNET_MESSENGER_Message *message;
1675
1676 if ((! room) || (! hash))
1677 return;
1678
1679 message = get_room_message (room, hash);
1680
1681 if ((message) && (GNUNET_YES == is_epoch_message (message)))
1682 {
1684 "Deletion of message is not allowed!\n");
1685 return;
1686 }
1687
1688 delete_room_message (room, hash, delay);
1689}
enum GNUNET_GenericReturnValue is_epoch_message(const struct GNUNET_MESSENGER_Message *message)
Returns whether a certain kind of message from storage contains some specific details that might be r...
const struct GNUNET_MESSENGER_Message * get_room_message(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Returns a message locally stored from a map for a given hash in a room.
void delete_room_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay)
Deletes a message with a given hash inside a room under a specific delay.

References delete_room_message(), get_room_message(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_YES, and is_epoch_message().

Here is the call graph for this function:

◆ GNUNET_MESSENGER_get_message()

const struct GNUNET_MESSENGER_Message * GNUNET_MESSENGER_get_message ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash 
)

Get the message in a room identified by its hash and requests it if necessary.

Parameters
[in,out]roomRoom handle
[in]hashHash identifying a message
Returns
Message struct or NULL if no message with that hash is known

Definition at line 1715 of file messenger_api.c.

1717{
1718 const struct GNUNET_MESSENGER_Message *message;
1719
1720 if ((! room) || (! hash) || (GNUNET_is_zero (hash)))
1721 return NULL;
1722
1723 message = get_room_message (room, hash);
1724
1725 if (! message)
1726 {
1727 if ((GNUNET_YES == room->joined) && (get_room_sender_id (room)))
1728 request_message_from_room (room, hash);
1729 else
1730 require_message_from_room (room, hash);
1731 }
1732
1733 return message;
1734}
#define GNUNET_is_zero(a)
Check that memory in a is all zeros.
void request_message_from_room(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Requests a specific message from a given room which can be identified by its hash.
void require_message_from_room(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Requires a specific message in a given room which can be identified by its hash.
const struct GNUNET_ShortHashCode * get_room_sender_id(const struct GNUNET_MESSENGER_Room *room)
Returns the member id of the room's sender.
enum GNUNET_GenericReturnValue joined

References get_room_message(), get_room_sender_id(), GNUNET_is_zero, GNUNET_YES, GNUNET_MESSENGER_Room::joined, request_message_from_room(), and require_message_from_room().

Referenced by on_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_MESSENGER_iterate_members()

int GNUNET_MESSENGER_iterate_members ( struct GNUNET_MESSENGER_Room room,
GNUNET_MESSENGER_MemberCallback  callback,
void *  cls 
)

Iterates through all members of a given room and calls a selected callback for each of them with a provided closure.

The callback will receive the contact of each member. The function returns the amount of members iterated with the given callback.

Parameters
[in]roomRoom handle
[in]callbackFunction called for each member
[in]clsClosure for the callback handler
Returns
Amount of members iterated

Definition at line 1738 of file messenger_api.c.

1741{
1742 if (! room)
1743 return GNUNET_SYSERR;
1744
1745 return iterate_room_members (room, callback, cls);
1746}
int iterate_room_members(struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, void *cls)
Iterates through all members of a given room to forward each of them to a selected callback with a cu...

References GNUNET_SYSERR, and iterate_room_members().

Referenced by read_stdio().

Here is the call graph for this function:
Here is the caller graph for this function: