GNUnet 0.21.1
gnunet-service-messenger_basement.c File Reference
Include dependency graph for gnunet-service-messenger_basement.c:

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...
 
enum GNUNET_GenericReturnValue 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...
 
enum GNUNET_GenericReturnValue 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...
 

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 29 of file gnunet-service-messenger_basement.c.

30{
31 GNUNET_assert (tunnels);
32
33 const struct GNUNET_MESSENGER_ListTunnel *element;
34 size_t count = 0;
35
36 for (element = tunnels->head; element; element = element->next)
37 count++;
38
39 return count;
40}
#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(), and recv_message_miss().

Here is the caller graph for this function:

◆ should_connect_tunnel_to()

enum GNUNET_GenericReturnValue 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()

enum GNUNET_GenericReturnValue 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 56 of file gnunet-service-messenger_basement.c.

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