GNUnet  0.20.0
gnunet-service-ats_connectivity.h File Reference

ats service, interaction with 'connecivity' API More...

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

Go to the source code of this file.

Functions

unsigned int GAS_connectivity_has_peer (void *cls, const struct GNUNET_PeerIdentity *peer)
 Is the given peer in the list of peers for which we have an address request? More...
 
void GAS_handle_request_address (struct GNUNET_SERVICE_Client *client, const struct RequestAddressMessage *msg)
 Handle 'request address' messages from clients. More...
 
void GAS_handle_request_address_cancel (struct GNUNET_SERVICE_Client *client, const struct RequestAddressMessage *msg)
 Cancel 'request address' messages from clients. More...
 
void GAS_connectivity_remove_client (struct GNUNET_SERVICE_Client *client)
 Unregister a client (which may have been a connectivity client, but this is not assured). More...
 
void GAS_connectivity_init (void)
 Initialize connectivity subsystem. More...
 
void GAS_connectivity_done (void)
 Shutdown connectivity subsystem. More...
 

Detailed Description

ats service, interaction with 'connecivity' API

Author
Matthias Wachs
Christian Grothoff

Definition in file gnunet-service-ats_connectivity.h.

Function Documentation

◆ GAS_connectivity_has_peer()

unsigned int GAS_connectivity_has_peer ( void *  cls,
const struct GNUNET_PeerIdentity peer 
)

Is the given peer in the list of peers for which we have an address request?

Parameters
clsunused, NULL
peerpeer to query for
Returns
GNUNET_YES if so, GNUNET_NO if not

Definition at line 64 of file gnunet-service-ats_connectivity.c.

66 {
67  if (NULL == connection_requests)
68  return 0;
69  /* TODO: return sum of 'strength's of connectivity requests */
71  peer);
72 }
static struct GNUNET_CONTAINER_MultiPeerMap * connection_requests
Address suggestion requests by peer.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multipeermap_contains(const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key)
Check if the map contains any value under the given key (including values that are NULL).
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.

References connection_requests, GNUNET_CONTAINER_multipeermap_contains(), and peer.

Referenced by GAS_plugin_init().

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

◆ GAS_handle_request_address()

void GAS_handle_request_address ( struct GNUNET_SERVICE_Client client,
const struct RequestAddressMessage msg 
)

Handle 'request address' messages from clients.

Parameters
clientclient that sent the request
msgthe request message

Handle 'request address' messages from clients.

Parameters
clientclient that sent the request
msgthe request message

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

84 {
85  struct ConnectionRequest *cr;
86 
88  "Received `%s' message\n",
89  "GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS");
90  /* FIXME: should not ignore "msg->strength" */
91  cr = GNUNET_new (struct ConnectionRequest);
92  cr->client = client;
94  &msg->peer,
95  cr,
98 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
void GAS_plugin_request_connect_start(const struct GNUNET_PeerIdentity *pid)
Notify the plugin that a request to connect to a particular peer was given to us.
int GNUNET_CONTAINER_multipeermap_put(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE
Allow multiple values with the same key.
#define GNUNET_log(kind,...)
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_new(type)
Allocate a struct or union of the given type.
Active connection requests.
struct GNUNET_SERVICE_Client * client
Client that made the request.

References ConnectionRequest::client, connection_requests, GAS_plugin_request_connect_start(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_multipeermap_put(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_new, and msg.

Referenced by handle_request_address().

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

◆ GAS_handle_request_address_cancel()

void GAS_handle_request_address_cancel ( struct GNUNET_SERVICE_Client client,
const struct RequestAddressMessage msg 
)

Cancel 'request address' messages from clients.

Parameters
clientclient that sent the request
msgthe request message

Cancel 'request address' messages from clients.

Parameters
clientthe client that sent the request
msgthe request message

Definition at line 142 of file gnunet-service-ats_connectivity.c.

144 {
146  "Received GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL message for peer %s\n",
147  GNUNET_i2s (&msg->peer));
148  GNUNET_break (0 == ntohl (msg->strength));
150  &msg->peer,
152  client);
153 }
static int free_matching_requests(void *cls, const struct GNUNET_PeerIdentity *pid, void *value)
Free the connection request from the map if the closure matches the client.
int GNUNET_CONTAINER_multipeermap_get_multiple(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
Iterate over all entries in the map that match a particular key.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.

References ConnectionRequest::client, connection_requests, free_matching_requests(), GNUNET_break, GNUNET_CONTAINER_multipeermap_get_multiple(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_log, and msg.

Referenced by handle_request_address_cancel().

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

◆ GAS_connectivity_remove_client()

void GAS_connectivity_remove_client ( struct GNUNET_SERVICE_Client client)

Unregister a client (which may have been a connectivity client, but this is not assured).

Parameters
clienthandle of the (now dead) client

Definition at line 163 of file gnunet-service-ats_connectivity.c.

164 {
165  if (NULL != connection_requests)
168  client);
169 }
int GNUNET_CONTAINER_multipeermap_iterate(struct GNUNET_CONTAINER_MultiPeerMap *map, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
Iterate over all entries in the map.

References ConnectionRequest::client, connection_requests, free_matching_requests(), and GNUNET_CONTAINER_multipeermap_iterate().

Referenced by client_disconnect_cb().

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

◆ GAS_connectivity_init()

void GAS_connectivity_init ( void  )

Initialize connectivity subsystem.

Initialize connectivity subsystem.

Definition at line 176 of file gnunet-service-ats_connectivity.c.

177 {
180  GNUNET_NO);
181 }
struct GNUNET_CONTAINER_MultiPeerMap * GNUNET_CONTAINER_multipeermap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
@ GNUNET_NO

References connection_requests, GNUNET_CONTAINER_multipeermap_create(), and GNUNET_NO.

Referenced by run().

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

◆ GAS_connectivity_done()

void GAS_connectivity_done ( void  )

Shutdown connectivity subsystem.

Definition at line 210 of file gnunet-service-ats_connectivity.c.

211 {
214  &free_request,
215  NULL);
218  connection_requests = NULL;
219 }
static int free_request(void *cls, const struct GNUNET_PeerIdentity *pid, void *value)
Free the connection request from the map.
void GAS_plugin_solver_unlock()
Resume instant solving, we are done with the bulk state updates.
void GAS_plugin_solver_lock()
Stop instant solving, there are many state updates happening in bulk right now.
void GNUNET_CONTAINER_multipeermap_destroy(struct GNUNET_CONTAINER_MultiPeerMap *map)
Destroy a hash map.

References connection_requests, free_request(), GAS_plugin_solver_lock(), GAS_plugin_solver_unlock(), GNUNET_CONTAINER_multipeermap_destroy(), and GNUNET_CONTAINER_multipeermap_iterate().

Referenced by cleanup_task(), and run().

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