GNUnet  0.10.x
Functions
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.

References GNUNET_CONTAINER_multipeermap_contains().

Referenced by GAS_plugin_init().

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.
int 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)...
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
messagethe request message

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

References ConnectionRequest::client, GAS_plugin_request_connect_start(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_multipeermap_put(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_new, and RequestAddressMessage::peer.

Referenced by handle_request_address().

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 }
static struct GNUNET_CONTAINER_MultiPeerMap * connection_requests
Address suggestion requests by peer.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
Active connection requests.
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. ...
Allow multiple values with the same key.
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.
#define GNUNET_log(kind,...)
struct GNUNET_SERVICE_Client * client
Client that made the request.
struct GNUNET_PeerIdentity peer
Peer to get address suggestions for.
Definition: ats.h:105
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.

References free_matching_requests(), GNUNET_break, GNUNET_CONTAINER_multipeermap_get_multiple(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_log, RequestAddressMessage::peer, and RequestAddressMessage::strength.

Referenced by handle_request_address_cancel().

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.
static struct GNUNET_CONTAINER_MultiPeerMap * connection_requests
Address suggestion requests by peer.
uint32_t strength
How "strong" is our need for an address for this peer?
Definition: ats.h:100
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
#define GNUNET_log(kind,...)
struct GNUNET_PeerIdentity peer
Peer to get address suggestions for.
Definition: ats.h:105
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
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.
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.

References free_matching_requests(), and GNUNET_CONTAINER_multipeermap_iterate().

Referenced by client_disconnect_cb().

164 {
167  client);
168 }
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.
static struct GNUNET_CONTAINER_MultiPeerMap * connection_requests
Address suggestion requests by peer.
int GNUNET_CONTAINER_multipeermap_iterate(struct GNUNET_CONTAINER_MultiPeerMap *map, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
Iterate over all entries in the map.
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 175 of file gnunet-service-ats_connectivity.c.

References GNUNET_CONTAINER_multipeermap_create(), and GNUNET_NO.

Referenced by run().

176 {
179  GNUNET_NO);
180 }
static struct GNUNET_CONTAINER_MultiPeerMap * connection_requests
Address suggestion requests by peer.
#define GNUNET_NO
Definition: gnunet_common.h:81
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).
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 209 of file gnunet-service-ats_connectivity.c.

References 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().

210 {
213  &free_request,
214  NULL);
217  connection_requests = NULL;
218 }
void GAS_plugin_solver_lock()
Stop instant solving, there are many state updates happening in bulk right now.
static struct GNUNET_CONTAINER_MultiPeerMap * connection_requests
Address suggestion requests by peer.
void GNUNET_CONTAINER_multipeermap_destroy(struct GNUNET_CONTAINER_MultiPeerMap *map)
Destroy a hash map.
void GAS_plugin_solver_unlock()
Resume instant solving, we are done with the bulk state updates.
int GNUNET_CONTAINER_multipeermap_iterate(struct GNUNET_CONTAINER_MultiPeerMap *map, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
Iterate over all entries in the map.
static int free_request(void *cls, const struct GNUNET_PeerIdentity *pid, void *value)
Free the connection request from the map.
Here is the call graph for this function:
Here is the caller graph for this function: