GNUnet  0.11.x
Functions
gnunet-service-messenger_message_send.c File Reference

GNUnet MESSENGER service. More...

#include "gnunet-service-messenger_message_send.h"
#include "gnunet-service-messenger_message_handle.h"
Include dependency graph for gnunet-service-messenger_message_send.c:

Go to the source code of this file.

Functions

void send_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
 Handles a sent info message to setup a tunnels linked member id. More...
 
void send_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
 Handles a sent join message to ensure growth of the decentralized room structure. More...
 
void send_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
 Handles a sent leave message. More...
 
void send_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
 Handles a sent name message. More...
 
void send_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
 Handles a sent key message. More...
 
void send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
 Handles a sent peer message to update the rooms peer message of this service. More...
 
void send_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
 Handles a sent id message. More...
 
void send_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
 Handles a sent miss message. More...
 

Detailed Description

GNUnet MESSENGER service.

Author
Tobias Frisch

Definition in file gnunet-service-messenger_message_send.c.

Function Documentation

◆ send_message_info()

void send_message_info ( struct GNUNET_MESSENGER_SrvRoom room,
struct GNUNET_MESSENGER_SrvHandle handle,
struct GNUNET_MESSENGER_SrvTunnel tunnel,
struct GNUNET_MESSENGER_Message message,
const struct GNUNET_HashCode hash 
)

Handles a sent info message to setup a tunnels linked member id.

(if a tunnel has already got a member id linked to it, the connection will be closed)

Parameters
roomRoom of the message
handleSending handle
tunnelSending connection (may be NULL)
messageINFO-Message
hashHash of the message

Definition at line 30 of file gnunet-service-messenger_message_send.c.

References GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_SrvTunnel::contact_id, disconnect_tunnel(), GNUNET_memcpy, GNUNET_new, GNUNET_MESSENGER_MessageBody::info, and GNUNET_MESSENGER_MessageInfo::unique_id.

Referenced by callback_room_sent().

33 {
34  if (!tunnel->contact_id)
35  {
36  tunnel->contact_id = GNUNET_new(struct GNUNET_ShortHashCode);
37 
38  GNUNET_memcpy(tunnel->contact_id, &(message->body.info.unique_id), sizeof(struct GNUNET_ShortHashCode));
39  }
40  else
41  {
42  disconnect_tunnel (tunnel);
43  }
44 }
struct GNUNET_ShortHashCode unique_id
The new unique id for the receiver in a room.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
A 256-bit hashcode.
struct GNUNET_MESSENGER_MessageBody body
Body.
struct GNUNET_MESSENGER_MessageInfo info
void disconnect_tunnel(struct GNUNET_MESSENGER_SrvTunnel *tunnel)
Disconnects and unbinds a channel from a tunnel.
struct GNUNET_ShortHashCode * contact_id
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_message_join()

void send_message_join ( struct GNUNET_MESSENGER_SrvRoom room,
struct GNUNET_MESSENGER_SrvHandle handle,
struct GNUNET_MESSENGER_SrvTunnel tunnel,
struct GNUNET_MESSENGER_Message message,
const struct GNUNET_HashCode hash 
)

Handles a sent join message to ensure growth of the decentralized room structure.

(if the service provides a peer message for this room currently, it will be forwarded)

Parameters
roomRoom of the message
handleSending handle
tunnelSending connection (may be NULL)
messageJOIN-Message
hashHash of the message

Definition at line 47 of file gnunet-service-messenger_message_send.c.

References forward_tunnel_message(), get_room_message(), GNUNET_NO, handle_message_join(), and GNUNET_MESSENGER_SrvRoom::peer_message.

Referenced by callback_room_sent().

50 {
51  handle_message_join (room, tunnel, message, hash);
52 
53  if (room->peer_message)
54  {
55  const struct GNUNET_MESSENGER_Message *peer_message = get_room_message (room, handle, room->peer_message,
56  GNUNET_NO);
57 
58  if ((peer_message) && (tunnel))
59  {
60  forward_tunnel_message (tunnel, peer_message, room->peer_message);
61  }
62  }
63 }
struct GNUNET_HashCode * peer_message
const struct GNUNET_MESSENGER_Message * get_room_message(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *hash, int request)
Returns a message from a room identified by a given hash.
void forward_tunnel_message(struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Forwards a given message with a known hash through a tunnel.
void handle_message_join(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Handles a received or sent join message to make changes of current member information.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_message_leave()

void send_message_leave ( struct GNUNET_MESSENGER_SrvRoom room,
struct GNUNET_MESSENGER_SrvHandle handle,
struct GNUNET_MESSENGER_SrvTunnel tunnel,
struct GNUNET_MESSENGER_Message message,
const struct GNUNET_HashCode hash 
)

Handles a sent leave message.

See also
handle_message_leave()
Parameters
roomRoom of the message
handleSending handle
tunnelSending connection (may be NULL)
messageLEAVE-Message
hashHash of the message

Definition at line 66 of file gnunet-service-messenger_message_send.c.

References handle_message_leave().

Referenced by callback_room_sent().

69 {
70  handle_message_leave (room, tunnel, message, hash);
71 }
void handle_message_leave(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Handles a received or sent leave message to make changes of current member information.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_message_name()

void send_message_name ( struct GNUNET_MESSENGER_SrvRoom room,
struct GNUNET_MESSENGER_SrvHandle handle,
struct GNUNET_MESSENGER_SrvTunnel tunnel,
struct GNUNET_MESSENGER_Message message,
const struct GNUNET_HashCode hash 
)

Handles a sent name message.

See also
handle_message_name()
Parameters
roomRoom of the message
handleSending handle
tunnelSending connection (may be NULL)
messageNAME-Message
hashHash of the message

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

References handle_message_name().

Referenced by callback_room_sent().

77 {
78  handle_message_name (room, tunnel, message, hash);
79 }
void handle_message_name(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Handles a received or sent name message to rename a current member.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_message_key()

void send_message_key ( struct GNUNET_MESSENGER_SrvRoom room,
struct GNUNET_MESSENGER_SrvHandle handle,
struct GNUNET_MESSENGER_SrvTunnel tunnel,
struct GNUNET_MESSENGER_Message message,
const struct GNUNET_HashCode hash 
)

Handles a sent key message.

See also
handle_message_key()
Parameters
roomRoom of the message
handleSending handle
tunnelSending connection (may be NULL)
messageKEY-Message
hashHash of the message

Definition at line 82 of file gnunet-service-messenger_message_send.c.

References handle_message_key().

Referenced by callback_room_sent().

85 {
86  handle_message_key (room, tunnel, message, hash);
87 }
void handle_message_key(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Handles a received or sent key message to change the key of a member and rearrange the contacts accor...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_message_peer()

void send_message_peer ( struct GNUNET_MESSENGER_SrvRoom room,
struct GNUNET_MESSENGER_SrvHandle handle,
struct GNUNET_MESSENGER_SrvTunnel tunnel,
struct GNUNET_MESSENGER_Message message,
const struct GNUNET_HashCode hash 
)

Handles a sent peer message to update the rooms peer message of this service.

(a set peer message indicates this service being a part of the decentralized room structure)

Parameters
roomRoom of the message
handleSending handle
tunnelSending connection (may be NULL)
messagePEER-Message
hashHash of the message

Definition at line 90 of file gnunet-service-messenger_message_send.c.

References GNUNET_memcpy, GNUNET_new, handle_message_peer(), and GNUNET_MESSENGER_SrvRoom::peer_message.

Referenced by callback_room_sent().

93 {
94  if (!room->peer_message)
95  {
96  room->peer_message = GNUNET_new(struct GNUNET_HashCode);
97  }
98 
99  GNUNET_memcpy(room->peer_message, hash, sizeof(struct GNUNET_HashCode));
100 
101  handle_message_peer (room, tunnel, message, hash);
102 }
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
void handle_message_peer(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Handles a received or sent peer message to make changes of the basement in the room.
struct GNUNET_HashCode * peer_message
A 512-bit hashcode.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_message_id()

void send_message_id ( struct GNUNET_MESSENGER_SrvRoom room,
struct GNUNET_MESSENGER_SrvHandle handle,
struct GNUNET_MESSENGER_SrvTunnel tunnel,
struct GNUNET_MESSENGER_Message message,
const struct GNUNET_HashCode hash 
)

Handles a sent id message.

See also
handle_message_id()
Parameters
roomRoom of the message
handleSending handle
tunnelSending connection (may be NULL)
messageID-Message
hashHash of the message

Definition at line 105 of file gnunet-service-messenger_message_send.c.

References handle_message_id().

Referenced by callback_room_sent().

108 {
109  handle_message_id (room, tunnel, message, hash);
110 }
void handle_message_id(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Handles a received or sent id message to change a members id.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_message_miss()

void send_message_miss ( struct GNUNET_MESSENGER_SrvRoom room,
struct GNUNET_MESSENGER_SrvHandle handle,
struct GNUNET_MESSENGER_SrvTunnel tunnel,
struct GNUNET_MESSENGER_Message message,
const struct GNUNET_HashCode hash 
)

Handles a sent miss message.

See also
handle_message_miss()
Parameters
roomRoom of the message
handleSending handle
tunnelSending connection (may be NULL)
messageMISS-Message
hashHash of the message

Definition at line 113 of file gnunet-service-messenger_message_send.c.

References handle_message_miss().

Referenced by callback_room_sent().

116 {
117  handle_message_miss (room, tunnel, message, hash);
118 }
void handle_message_miss(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Handles a received or sent miss message to drop a peer from the basement in the room.
Here is the call graph for this function:
Here is the caller graph for this function: