GNUnet 0.22.2
gnunet-service-messenger_basement.h File Reference
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...
 
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 const struct GNUNET_MESSENGER_ListTunnel *element;
32 size_t count;
33
34 GNUNET_assert (tunnels);
35
36 count = 0;
37
38 for (element = tunnels->head; element; element = element->next)
39 count++;
40
41 return count;
42}
#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 46 of file gnunet-service-messenger_basement.c.

49{
50 if ((src + 1) % count == dst % count)
51 return GNUNET_YES;
52
53 return GNUNET_NO;
54}
@ 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 58 of file gnunet-service-messenger_basement.c.

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