GNUnet 0.21.1
gnunet-service-messenger_message_kind.h File Reference
Include dependency graph for gnunet-service-messenger_message_kind.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

struct GNUNET_MESSENGER_Messagecreate_message_info (struct GNUNET_MESSENGER_Service *service)
 Creates and allocates a new info message containing the hosts service peer identity and version. More...
 
struct GNUNET_MESSENGER_Messagecreate_message_peer (struct GNUNET_MESSENGER_Service *service)
 Creates and allocates a new peer message containing a services peer identity. More...
 
struct GNUNET_MESSENGER_Messagecreate_message_miss (const struct GNUNET_PeerIdentity *peer)
 Creates and allocates a new miss message containing the missing peer identity. More...
 
struct GNUNET_MESSENGER_Messagecreate_message_merge (const struct GNUNET_HashCode *previous)
 Creates and allocates a new merge message containing the hash of a second previous message besides the regular previous message mentioned in a messages header. More...
 
struct GNUNET_MESSENGER_Messagecreate_message_connection (const struct GNUNET_MESSENGER_SrvRoom *room)
 Creates and allocates a new connection message containing the amount of the peer's connections in a given room as well as flags from the peer about its connections. More...
 

Function Documentation

◆ create_message_info()

struct GNUNET_MESSENGER_Message * create_message_info ( struct GNUNET_MESSENGER_Service service)

Creates and allocates a new info message containing the hosts service peer identity and version.

(all values are stored as copy)

Parameters
[in,out]serviceService
Returns
New message

Definition at line 33 of file gnunet-service-messenger_message_kind.c.

34{
35 if (! service)
36 return NULL;
37
40
41 if (! message)
42 return NULL;
43
45
46 return message;
47}
static struct GNUNET_SERVICE_Handle * service
Handle to our service instance.
#define GNUNET_MESSENGER_VERSION
Version number of GNUnet Messenger API.
@ GNUNET_MESSENGER_KIND_INFO
The info kind.
struct GNUNET_MESSENGER_Message * create_message(enum GNUNET_MESSENGER_MessageKind kind)
Creates and allocates a new message with a specific kind.
struct GNUNET_MESSENGER_MessageInfo info
uint32_t messenger_version
The version of GNUnet Messenger API.
struct GNUNET_MESSENGER_MessageBody body
Body.

References GNUNET_MESSENGER_Message::body, create_message(), GNUNET_MESSENGER_KIND_INFO, GNUNET_MESSENGER_VERSION, GNUNET_MESSENGER_MessageBody::info, GNUNET_MESSENGER_MessageInfo::messenger_version, and service.

Referenced by recv_message_info(), and send_room_info().

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

◆ create_message_peer()

struct GNUNET_MESSENGER_Message * create_message_peer ( struct GNUNET_MESSENGER_Service service)

Creates and allocates a new peer message containing a services peer identity.

(all values are stored as copy)

Parameters
[in,out]serviceService
Returns
New message

Definition at line 51 of file gnunet-service-messenger_message_kind.c.

52{
53 if (! service)
54 return NULL;
55
58
59 if (! message)
60 return NULL;
61
63 &(message->body.peer.peer)))
64 return message;
65 else
66 {
67 destroy_message (message);
68 return NULL;
69 }
70}
enum GNUNET_GenericReturnValue get_service_peer_identity(struct GNUNET_MESSENGER_Service *service, struct GNUNET_PeerIdentity *peer)
Tries to write the peer identity of the peer running a service on to the peer parameter.
@ GNUNET_OK
@ GNUNET_MESSENGER_KIND_PEER
The peer kind.
void destroy_message(struct GNUNET_MESSENGER_Message *message)
Destroys a message and frees its memory fully.
struct GNUNET_MESSENGER_MessagePeer peer
struct GNUNET_PeerIdentity peer
The peer identity of the sender opening a room.

References GNUNET_MESSENGER_Message::body, create_message(), destroy_message(), get_service_peer_identity(), GNUNET_MESSENGER_KIND_PEER, GNUNET_OK, GNUNET_MESSENGER_MessagePeer::peer, GNUNET_MESSENGER_MessageBody::peer, and service.

Referenced by open_srv_room().

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

◆ create_message_miss()

struct GNUNET_MESSENGER_Message * create_message_miss ( const struct GNUNET_PeerIdentity peer)

Creates and allocates a new miss message containing the missing peer identity.

(all values are stored as copy)

Parameters
[in]peerMissing peer identity
Returns
New message

Definition at line 74 of file gnunet-service-messenger_message_kind.c.

75{
76 if (! peer)
77 return NULL;
78
81
82 if (! message)
83 {
84 return NULL;
85 }
86
87 GNUNET_memcpy (&(message->body.miss.peer), peer, sizeof(struct
89
90 return message;
91}
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
@ GNUNET_MESSENGER_KIND_MISS
The miss kind.
struct GNUNET_MESSENGER_MessageMiss miss
struct GNUNET_PeerIdentity peer
The peer identity of a disconnected door to a room.
The identity of the host (wraps the signing key of the peer).

References GNUNET_MESSENGER_Message::body, create_message(), GNUNET_memcpy, GNUNET_MESSENGER_KIND_MISS, GNUNET_MESSENGER_MessageBody::miss, and GNUNET_MESSENGER_MessageMiss::peer.

Referenced by callback_room_disconnect(), and close_srv_room().

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

◆ create_message_merge()

struct GNUNET_MESSENGER_Message * create_message_merge ( const struct GNUNET_HashCode previous)

Creates and allocates a new merge message containing the hash of a second previous message besides the regular previous message mentioned in a messages header.

(all values are stored as copy)

Parameters
[in]previousHash of message
Returns
New message

Definition at line 95 of file gnunet-service-messenger_message_kind.c.

96{
97 if (! previous)
98 return NULL;
99
100 struct GNUNET_MESSENGER_Message *message = create_message (
102
103 if (! message)
104 return NULL;
105
106 GNUNET_memcpy (&(message->body.merge.previous), previous, sizeof(struct
108
109 return message;
110}
@ GNUNET_MESSENGER_KIND_MERGE
The merge kind.
A 512-bit hashcode.
struct GNUNET_MESSENGER_MessageMerge merge
struct GNUNET_HashCode previous
The hash of a second previous message.

References GNUNET_MESSENGER_Message::body, create_message(), GNUNET_memcpy, GNUNET_MESSENGER_KIND_MERGE, GNUNET_MESSENGER_MessageBody::merge, and GNUNET_MESSENGER_MessageMerge::previous.

Referenced by callback_room_merge(), and merge_srv_room_last_messages().

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

◆ create_message_connection()

struct GNUNET_MESSENGER_Message * create_message_connection ( const struct GNUNET_MESSENGER_SrvRoom room)

Creates and allocates a new connection message containing the amount of the peer's connections in a given room as well as flags from the peer about its connections.

(all values are stored as copy)

Parameters
[in]roomRoom
Returns
New message

Definition at line 114 of file gnunet-service-messenger_message_kind.c.

115{
116 if (! room)
117 return NULL;
118
119 struct GNUNET_MESSENGER_Message *message = create_message (
121
122 if (! message)
123 return NULL;
124
127
128 return message;
129}
uint32_t get_srv_room_amount_of_tunnels(const struct GNUNET_MESSENGER_SrvRoom *room)
Returns the amount of active tunnels of a given room.
uint32_t get_srv_room_connection_flags(const struct GNUNET_MESSENGER_SrvRoom *room)
Returns connection flags about connection information of a given room and the service managing it.
@ GNUNET_MESSENGER_KIND_CONNECTION
The connection kind.
struct GNUNET_MESSENGER_MessageConnection connection
uint32_t amount
The amount of connections of a peer.
uint32_t flags
The flags about the connections of a peer.

References GNUNET_MESSENGER_MessageConnection::amount, GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_MessageBody::connection, create_message(), GNUNET_MESSENGER_MessageConnection::flags, get_srv_room_amount_of_tunnels(), get_srv_room_connection_flags(), and GNUNET_MESSENGER_KIND_CONNECTION.

Referenced by close_service_room(), and send_message_peer().

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