GNUnet 0.22.2
gnunet-service-messenger_message_kind.c File Reference
Include dependency graph for gnunet-service-messenger_message_kind.c:

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 struct GNUNET_MESSENGER_Message *message;
36
37 if (! service)
38 return NULL;
39
41
42 if (! message)
43 return NULL;
44
46
47 return message;
48}
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 52 of file gnunet-service-messenger_message_kind.c.

53{
54 struct GNUNET_MESSENGER_Message *message;
55
56 if (! service)
57 return NULL;
58
60
61 if (! message)
62 return NULL;
63
65 &(message->body.peer.peer)))
66 return message;
67 else
68 {
69 destroy_message (message);
70 return NULL;
71 }
72}
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 76 of file gnunet-service-messenger_message_kind.c.

77{
78 struct GNUNET_MESSENGER_Message *message;
79
80 if (! peer)
81 return NULL;
82
84
85 if (! message)
86 {
87 return NULL;
88 }
89
90 GNUNET_memcpy (&(message->body.miss.peer), peer, sizeof(struct
92
93 return message;
94}
#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_tunnel_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 98 of file gnunet-service-messenger_message_kind.c.

99{
100 struct GNUNET_MESSENGER_Message *message;
101
102 if (! previous)
103 return NULL;
104
106
107 if (! message)
108 return NULL;
109
110 GNUNET_memcpy (&(message->body.merge.previous), previous, sizeof(struct
112
113 return message;
114}
@ 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_operation(), 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 118 of file gnunet-service-messenger_message_kind.c.

119{
120 struct GNUNET_MESSENGER_Message *message;
121
122 if (! room)
123 return NULL;
124
126
127 if (! message)
128 return NULL;
129
132
133 return message;
134}
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: