GNUnet  0.20.0
gnunet-service-messenger_basement.h File Reference

GNUnet MESSENGER service. More...

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
[in]tunnelsList of peer identities
Returns
Count of the entries in the list

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

31 {
32  GNUNET_assert(tunnels);
33 
34  const struct GNUNET_MESSENGER_ListTunnel *element;
35  size_t count = 0;
36 
37  for (element = tunnels->head; element; element = element->next)
38  count++;
39 
40  return count;
41 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_MESSENGER_ListTunnel * next
struct GNUNET_MESSENGER_ListTunnel * head

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

Referenced by rebuild_srv_room_basement_structure().

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
[in]countCount of peers
[in]srcSource index
[in]dstDestination index
Returns
GNUNET_YES or GNUNET_NO based on topologic requirement

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

47 {
48  if ((src + 1) % count == dst % count)
49  return GNUNET_YES;
50 
51  return GNUNET_NO;
52 }
@ GNUNET_YES
@ GNUNET_NO

References GNUNET_NO, and GNUNET_YES.

Referenced by required_connection_between().

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
[in]countCount of peers
[in]srcSource index
[in]dstDestination index
Returns
GNUNET_YES or GNUNET_NO based on topologic requirement

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

58 {
59  if (GNUNET_YES == should_connect_tunnel_to (count, src, dst))
60  return GNUNET_YES;
61  if (GNUNET_YES == should_connect_tunnel_to (count, dst, src))
62  return GNUNET_YES;
63 
64  return GNUNET_NO;
65 }
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...

References GNUNET_NO, GNUNET_YES, and should_connect_tunnel_to().

Referenced by rebuild_srv_room_basement_structure().

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