GNUnet  0.11.x
Functions
gnunet-service-messenger_basement.h File Reference

GNUnet MESSENGER service. More...

#include "messenger_api_list_tunnels.h"
Include dependency graph for gnunet-service-messenger_basement.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

size_t count_of_tunnels (const struct GNUNET_MESSENGER_ListTunnels *tunnels)
 Returns the count of peers in a list (typically from the basement of a room). More...
 
int should_connect_tunnel_to (size_t count, size_t src, size_t dst)
 Returns GNUNET_YES or GNUNET_NO to determine if the peer at index src should or should not connect outgoing to the peer at index dst to construct a complete basement with a given count of peers. More...
 
int required_connection_between (size_t count, size_t src, size_t dst)
 Returns GNUNET_YES or GNUNET_NO to determine if the peers of index src and index dst should be connected in any direction to construct a complete basement with a given count of peers. More...
 

Detailed Description

GNUnet MESSENGER service.

Author
Tobias Frisch

Definition in file gnunet-service-messenger_basement.h.

Function Documentation

◆ count_of_tunnels()

size_t count_of_tunnels ( const struct GNUNET_MESSENGER_ListTunnels tunnels)

Returns the count of peers in a list (typically from the basement of a room).

Parameters
tunnelsList of peer identities
Returns
Count of the entries in the list

Definition at line 29 of file gnunet-service-messenger_basement.c.

References GNUNET_MESSENGER_ListTunnels::head, and GNUNET_MESSENGER_ListTunnel::next.

Referenced by rebuild_room_basement_structure().

30 {
31  const struct GNUNET_MESSENGER_ListTunnel *element;
32  size_t count = 0;
33 
34  for (element = tunnels->head; element; element = element->next)
35  count++;
36 
37  return count;
38 }
struct GNUNET_MESSENGER_ListTunnel * head
struct GNUNET_MESSENGER_ListTunnel * next
Here is the caller graph for this function:

◆ should_connect_tunnel_to()

int should_connect_tunnel_to ( size_t  count,
size_t  src,
size_t  dst 
)

Returns GNUNET_YES or GNUNET_NO to determine if the peer at index src should or should not connect outgoing to the peer at index dst to construct a complete basement with a given count of peers.

Parameters
countCount of peers
srcSource index
dstDestination index
Returns
GNUNET_YES or GNUNET_NO based on topologic requirement

Definition at line 41 of file gnunet-service-messenger_basement.c.

References GNUNET_NO, and GNUNET_YES.

Referenced by required_connection_between().

42 {
43  if ((src + 1) % count == dst % count)
44  return GNUNET_YES;
45 
46  return GNUNET_NO;
47 }
Here is the caller graph for this function:

◆ required_connection_between()

int required_connection_between ( size_t  count,
size_t  src,
size_t  dst 
)

Returns GNUNET_YES or GNUNET_NO to determine if the peers of index src and index dst should be connected in any direction to construct a complete basement with a given count of peers.

Parameters
countCount of peers
srcSource index
dstDestination index
Returns
GNUNET_YES or GNUNET_NO based on topologic requirement

Definition at line 50 of file gnunet-service-messenger_basement.c.

References GNUNET_NO, GNUNET_YES, and should_connect_tunnel_to().

Referenced by rebuild_room_basement_structure().

51 {
52  if (GNUNET_YES == should_connect_tunnel_to (count, src, dst))
53  return GNUNET_YES;
54  if (GNUNET_YES == should_connect_tunnel_to (count, dst, src))
55  return GNUNET_YES;
56 
57  return GNUNET_NO;
58 }
int should_connect_tunnel_to(size_t count, size_t src, size_t dst)
Returns GNUNET_YES or GNUNET_NO to determine if the peer at index src should or should not connect ou...
Here is the call graph for this function:
Here is the caller graph for this function: