GNUnet  0.19.3
cadet_api.c File Reference

cadet api: client implementation of cadet service More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_constants.h"
#include "gnunet_cadet_service.h"
#include "cadet.h"
#include "cadet_protocol.h"
Include dependency graph for cadet_api.c:

Go to the source code of this file.

Data Structures

struct  GNUNET_CADET_Handle
 Opaque handle to the service. More...
 
struct  GNUNET_CADET_Port
 Opaque handle to a port. More...
 

Macros

#define LOG(kind, ...)   GNUNET_log_from (kind, "cadet-api", __VA_ARGS__)
 

Functions

static struct GNUNET_CADET_Portfind_port (const struct GNUNET_CADET_Handle *h, const struct GNUNET_HashCode *hash)
 Find the Port struct for a hash. More...
 
static struct GNUNET_CADET_Channelfind_channel (struct GNUNET_CADET_Handle *h, struct GNUNET_CADET_ClientChannelNumber ccn)
 Get the channel handler for the channel specified by id from the given handle. More...
 
static struct GNUNET_CADET_Channelcreate_channel (struct GNUNET_CADET_Handle *h, const struct GNUNET_CADET_ClientChannelNumber *ccnp)
 Create a new channel and insert it in the channel list of the cadet handle. More...
 
static void destroy_channel (struct GNUNET_CADET_Channel *ch)
 Destroy the specified channel. More...
 
static void reconnect (struct GNUNET_CADET_Handle *h)
 Reconnect to the service, retransmit all information to try to restore the original state. More...
 
static int open_port_cb (void *cls, const struct GNUNET_HashCode *id, void *value)
 Function called during reconnect_cbk() to (re)open all ports that are still open. More...
 
static void reconnect_cbk (void *cls)
 Reconnect callback: tries to reconnect again after a failed previous connection. More...
 
static void notify_window_size (struct GNUNET_CADET_Channel *ch)
 Notify the application about a change in the window size (if needed). More...
 
static void cadet_mq_send_now (void *cls)
 Transmit the next message from our queue. More...
 
static void cadet_mq_send_impl (struct GNUNET_MQ_Handle *mq, const struct GNUNET_MessageHeader *msg, void *impl_state)
 Implement sending functionality of a message queue for us sending messages to a peer. More...
 
static void cadet_mq_destroy_impl (struct GNUNET_MQ_Handle *mq, void *impl_state)
 Handle destruction of a message queue. More...
 
static void cadet_mq_error_handler (void *cls, enum GNUNET_MQ_Error error)
 We had an error processing a message we forwarded from a peer to the CADET service. More...
 
static void cadet_mq_cancel_impl (struct GNUNET_MQ_Handle *mq, void *impl_state)
 Implementation function that cancels the currently sent message. More...
 
static void handle_channel_created (void *cls, const struct GNUNET_CADET_LocalChannelCreateMessage *msg)
 Process the new channel notification and add it to the channels in the handle. More...
 
static void handle_channel_destroy (void *cls, const struct GNUNET_CADET_LocalChannelDestroyMessage *msg)
 Process the channel destroy notification and free associated resources. More...
 
static int check_local_data (void *cls, const struct GNUNET_CADET_LocalData *message)
 Check that message received from CADET service is well-formed. More...
 
static void handle_local_data (void *cls, const struct GNUNET_CADET_LocalData *message)
 Process the incoming data packets, call appropriate handlers. More...
 
static void handle_local_ack (void *cls, const struct GNUNET_CADET_LocalAck *message)
 Process a local ACK message, enabling the client to send more data to the service. More...
 
static int destroy_channel_cb (void *cls, uint32_t cid, void *value)
 Function called during GNUNET_CADET_disconnect() to destroy all channels that are still open. More...
 
static void handle_mq_error (void *cls, enum GNUNET_MQ_Error error)
 Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue. More...
 
static int destroy_port_cb (void *cls, const struct GNUNET_HashCode *id, void *value)
 Function called during GNUNET_CADET_disconnect() to destroy all ports that are still open. More...
 
void GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle)
 Disconnect from the cadet service. More...
 
void GNUNET_CADET_close_port (struct GNUNET_CADET_Port *p)
 Close a port opened with GNUNET_CADET_open_port. More...
 
void GNUNET_CADET_channel_destroy (struct GNUNET_CADET_Channel *channel)
 Destroy an existing channel. More...
 
const union GNUNET_CADET_ChannelInfoGNUNET_CADET_channel_get_info (struct GNUNET_CADET_Channel *channel, enum GNUNET_CADET_ChannelInfoOption option,...)
 Get information about a channel. More...
 
void GNUNET_CADET_receive_done (struct GNUNET_CADET_Channel *channel)
 Send an ack on the channel to confirm the processing of a message. More...
 
struct GNUNET_CADET_HandleGNUNET_CADET_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
 Connect to the MQ-based cadet service. More...
 
static void return_agpl (void *cls, const struct GNUNET_MessageHeader *msg)
 Function to return link to AGPL source upon request. More...
 
struct GNUNET_CADET_PortGNUNET_CADET_open_port (struct GNUNET_CADET_Handle *h, const struct GNUNET_HashCode *port, GNUNET_CADET_ConnectEventHandler connects, void *connects_cls, GNUNET_CADET_WindowSizeEventHandler window_changes, GNUNET_CADET_DisconnectEventHandler disconnects, const struct GNUNET_MQ_MessageHandler *handlers)
 Open a port to receive incoming MQ-based channels. More...
 
struct GNUNET_CADET_ChannelGNUNET_CADET_channel_create (struct GNUNET_CADET_Handle *h, void *channel_cls, const struct GNUNET_PeerIdentity *destination, const struct GNUNET_HashCode *port, GNUNET_CADET_WindowSizeEventHandler window_changes, GNUNET_CADET_DisconnectEventHandler disconnects, const struct GNUNET_MQ_MessageHandler *handlers)
 Create a new channel towards a remote peer. More...
 
struct GNUNET_MQ_HandleGNUNET_CADET_get_mq (const struct GNUNET_CADET_Channel *channel)
 Obtain the message queue for a connected peer. More...
 

Detailed Description

cadet api: client implementation of cadet service

Author
Bartlomiej Polot
Christian Grothoff

Definition in file cadet_api.c.

Macro Definition Documentation

◆ LOG

#define LOG (   kind,
  ... 
)    GNUNET_log_from (kind, "cadet-api", __VA_ARGS__)

Definition at line 33 of file cadet_api.c.

Function Documentation

◆ find_port()

static struct GNUNET_CADET_Port* find_port ( const struct GNUNET_CADET_Handle h,
const struct GNUNET_HashCode hash 
)
static

Find the Port struct for a hash.

Parameters
hCADET handle.
hashHashCode for the port number.
Returns
The port handle if known, NULL otherwise.

Definition at line 131 of file cadet_api.c.

133 {
134  return GNUNET_CONTAINER_multihashmap_get (h->ports, hash);
135 }
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
void * GNUNET_CONTAINER_multihashmap_get(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Given a key find a value in the map matching the key.

References GNUNET_CONTAINER_multihashmap_get(), and h.

Referenced by handle_channel_created().

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

◆ find_channel()

static struct GNUNET_CADET_Channel* find_channel ( struct GNUNET_CADET_Handle h,
struct GNUNET_CADET_ClientChannelNumber  ccn 
)
static

Get the channel handler for the channel specified by id from the given handle.

Parameters
hCadet handle
ccnID of the wanted channel
Returns
handle to the required channel or NULL if not found

Definition at line 146 of file cadet_api.c.

148 {
149  return GNUNET_CONTAINER_multihashmap32_get (h->channels,
150  ntohl (ccn.channel_of_client));
151 }
void * GNUNET_CONTAINER_multihashmap32_get(const struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key)
Given a key find a value in the map matching the key.
uint32_t channel_of_client
Values for channel numbering.
Definition: cadet.h:109

References GNUNET_CADET_Channel::ccn, GNUNET_CADET_ClientChannelNumber::channel_of_client, GNUNET_CONTAINER_multihashmap32_get(), and h.

Referenced by create_channel(), handle_channel_destroy(), handle_local_ack(), and handle_local_data().

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

◆ create_channel()

static struct GNUNET_CADET_Channel* create_channel ( struct GNUNET_CADET_Handle h,
const struct GNUNET_CADET_ClientChannelNumber ccnp 
)
static

Create a new channel and insert it in the channel list of the cadet handle.

Parameters
hCadet handle
ccnppointer to desired ccn of the channel, NULL to assign one automatically.
Returns
Handle to the created channel.

Definition at line 162 of file cadet_api.c.

164 {
165  struct GNUNET_CADET_Channel *ch;
167 
169  ch->cadet = h;
170  if (NULL == ccnp)
171  {
172  while (NULL != find_channel (h, h->next_ccn))
173  h->next_ccn.channel_of_client =
175  | (1 + ntohl (h->next_ccn.channel_of_client)));
176  ccn = h->next_ccn;
177  }
178  else
179  {
180  ccn = *ccnp;
181  }
182  ch->ccn = ccn;
185  h->channels,
186  ntohl (ch->ccn.channel_of_client),
187  ch,
189  return ch;
190 }
#define GNUNET_CADET_LOCAL_CHANNEL_ID_CLI
Minimum value for channel IDs of local clients.
Definition: cadet.h:70
static struct GNUNET_CADET_Channel * find_channel(struct GNUNET_CADET_Handle *h, struct GNUNET_CADET_ClientChannelNumber ccn)
Get the channel handler for the channel specified by id from the given handle.
Definition: cadet_api.c:146
static struct GNUNET_CADET_Channel * ch
Channel handle.
Definition: gnunet-cadet.c:117
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap32_put(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY
There must only be one value per key; storing a value should fail if a value under the same key alrea...
@ GNUNET_OK
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
Opaque handle to a channel.
Definition: cadet.h:116
struct GNUNET_CADET_Handle * cadet
Handle to the cadet this channel belongs to.
Definition: cadet.h:126
struct GNUNET_CADET_ClientChannelNumber ccn
Local ID of the channel, GNUNET_CADET_LOCAL_CHANNEL_ID_CLI bit is set if outbound.
Definition: cadet.h:169
Number uniquely identifying a channel of a client.
Definition: cadet.h:101

References GNUNET_CADET_Channel::cadet, GNUNET_CADET_Channel::ccn, ch, GNUNET_CADET_ClientChannelNumber::channel_of_client, find_channel(), GNUNET_assert, GNUNET_CADET_LOCAL_CHANNEL_ID_CLI, GNUNET_CONTAINER_multihashmap32_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_new, GNUNET_OK, and h.

Referenced by GNUNET_CADET_channel_create(), and handle_channel_created().

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

◆ destroy_channel()

static void destroy_channel ( struct GNUNET_CADET_Channel ch)
static

Destroy the specified channel.

  • Destroys all peers, calling the disconnect callback on each if needed
  • Cancels all outgoing traffic for that channel, calling respective notifys
  • Calls cleaner if channel was inbound
  • Frees all memory used
Parameters
chPointer to the channel.

Definition at line 203 of file cadet_api.c.

204 {
205  struct GNUNET_CADET_Handle *h = ch->cadet;
206 
208  "Destroying channel %X of %p\n",
209  htonl (ch->ccn.channel_of_client),
210  h);
211  GNUNET_assert (
212  GNUNET_YES ==
214  ntohl (ch->ccn.channel_of_client),
215  ch));
216  if (NULL != ch->mq_cont)
217  {
219  ch->mq_cont = NULL;
220  }
221  /* signal channel destruction */
222  if (NULL != ch->disconnects)
223  ch->disconnects (ch->ctx, ch);
224  if (NULL != ch->pending_env)
227  GNUNET_free (ch);
228 }
#define LOG(kind,...)
Definition: cadet_api.c:33
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap32_remove(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, const void *value)
Remove the given key-value pair from the map.
@ GNUNET_YES
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_MQ_discard(struct GNUNET_MQ_Envelope *mqm)
Discard the message queue message, free all allocated resources.
Definition: mq.c:285
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition: mq.c:683
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:944
void * ctx
Any data the caller wants to put in here, used for the various callbacks (disconnects,...
Definition: cadet.h:137
struct GNUNET_SCHEDULER_Task * mq_cont
Task to allow mq to send more traffic.
Definition: cadet.h:147
GNUNET_CADET_DisconnectEventHandler disconnects
Disconnect handler.
Definition: cadet.h:164
struct GNUNET_MQ_Handle * mq
Message Queue for the channel (which we are implementing).
Definition: cadet.h:142
struct GNUNET_MQ_Envelope * pending_env
Pending envelope with a message to be transmitted to the service as soon as we are allowed to.
Definition: cadet.h:154
Opaque handle to the service.
Definition: cadet_api.c:39

References GNUNET_CADET_Channel::cadet, GNUNET_CADET_Channel::ccn, ch, GNUNET_CADET_ClientChannelNumber::channel_of_client, GNUNET_CADET_Channel::ctx, GNUNET_CADET_Channel::disconnects, GNUNET_assert, GNUNET_CONTAINER_multihashmap32_remove(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_MQ_destroy(), GNUNET_MQ_discard(), GNUNET_SCHEDULER_cancel(), GNUNET_YES, h, LOG, GNUNET_CADET_Channel::mq, GNUNET_CADET_Channel::mq_cont, and GNUNET_CADET_Channel::pending_env.

Referenced by destroy_channel_cb(), GNUNET_CADET_channel_destroy(), and handle_channel_destroy().

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

◆ reconnect()

static void reconnect ( struct GNUNET_CADET_Handle h)
static

Reconnect to the service, retransmit all information to try to restore the original state.

Parameters
hhandle to the cadet

Definition at line 714 of file cadet_api.c.

715 {
717  { GNUNET_MQ_hd_fixed_size (channel_created,
720  h),
724  h),
725  GNUNET_MQ_hd_var_size (local_data,
727  struct GNUNET_CADET_LocalData,
728  h),
729  GNUNET_MQ_hd_fixed_size (local_ack,
731  struct GNUNET_CADET_LocalAck,
732  h),
734 
735  GNUNET_assert (NULL == h->mq);
736  h->mq =
738 }
static void handle_mq_error(void *cls, enum GNUNET_MQ_Error error)
Generic error handler, called with the appropriate error code and the same closure specified at the c...
Definition: cadet_api.c:693
static struct GNUNET_CADET_MessageHandler handlers[]
Handlers, for diverse services.
static void channel_destroy(struct CadetChannel *ch)
Destroy the given channel.
struct GNUNET_MQ_Handle * GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls)
Create a message queue to connect to a GNUnet service.
Definition: client.c:1057
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_CREATE
Ask the cadet service to create a new channel.
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK
Local ACK for data.
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA
Payload client <-> service.
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_DESTROY
Tell client that a channel was destroyed.
struct GNUNET_MQ_Handle * mq
Our connection to the ARM service.
Definition: arm_api.c:107
const struct GNUNET_CONFIGURATION_Handle * cfg
The configuration that we are using.
Definition: arm_api.c:112
Message to allow the client send more data to the service (always service -> client).
Definition: cadet.h:280
Message for a client to create channels.
Definition: cadet.h:201
Message for or to a client to destroy tunnel.
Definition: cadet.h:235
Message for cadet data traffic.
Definition: cadet.h:252
Message handler for a specific message type.

References GNUNET_ARM_Handle::cfg, channel_destroy(), GNUNET_assert, GNUNET_CLIENT_connect(), GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK, GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_CREATE, GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_DESTROY, GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, h, handle_mq_error(), handlers, and GNUNET_ARM_Handle::mq.

Referenced by GNUNET_CADET_connect(), and reconnect_cbk().

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

◆ open_port_cb()

static int open_port_cb ( void *  cls,
const struct GNUNET_HashCode id,
void *  value 
)
static

Function called during reconnect_cbk() to (re)open all ports that are still open.

Parameters
clsthe struct GNUNET_CADET_Handle
idport ID
valuea struct GNUNET_CADET_Channel to open
Returns
GNUNET_OK (continue to iterate)

Definition at line 251 of file cadet_api.c.

252 {
253  struct GNUNET_CADET_Handle *h = cls;
254  struct GNUNET_CADET_Port *port = value;
256  struct GNUNET_MQ_Envelope *env;
257 
258  (void) id;
260  msg->port = port->id;
261  GNUNET_MQ_send (h->mq, env);
262  return GNUNET_OK;
263 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
static uint16_t port
Port number.
Definition: gnunet-bcd.c:147
static char * value
Value of the record to add/remove.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:304
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:77
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_OPEN
Start listening on a port.
Message for a client to create and destroy channels.
Definition: cadet.h:181
Opaque handle to a port.
Definition: cadet_api.c:80

References env, GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_OPEN, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_OK, h, GNUNET_ARM_Handle::mq, msg, port, and value.

Referenced by GNUNET_CADET_open_port(), and reconnect_cbk().

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

◆ reconnect_cbk()

static void reconnect_cbk ( void *  cls)
static

Reconnect callback: tries to reconnect again after a failed previous connection.

Parameters
clsclosure (cadet handle)

Definition at line 273 of file cadet_api.c.

274 {
275  struct GNUNET_CADET_Handle *h = cls;
276 
277  h->reconnect_task = NULL;
278  h->reconnect_time = GNUNET_TIME_STD_BACKOFF (h->reconnect_time);
279  reconnect (h);
281 }
static void reconnect(struct GNUNET_CADET_Handle *h)
Reconnect to the service, retransmit all information to try to restore the original state.
Definition: cadet_api.c:714
static int open_port_cb(void *cls, const struct GNUNET_HashCode *id, void *value)
Function called during reconnect_cbk() to (re)open all ports that are still open.
Definition: cadet_api.c:251
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
#define GNUNET_TIME_STD_BACKOFF(r)
Perform our standard exponential back-off calculation, starting at 1 ms and then going by a factor of...
struct GNUNET_SCHEDULER_Task * reconnect_task
ID of the reconnect task (if any).
Definition: arm_api.c:147

References GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_TIME_STD_BACKOFF, h, open_port_cb(), reconnect(), and GNUNET_ARM_Handle::reconnect_task.

Referenced by handle_mq_error().

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

◆ notify_window_size()

static void notify_window_size ( struct GNUNET_CADET_Channel ch)
static

Notify the application about a change in the window size (if needed).

Parameters
chChannel to notify about.

Definition at line 290 of file cadet_api.c.

291 {
292  if (NULL != ch->window_changes)
293  ch->window_changes (ch->ctx,
294  ch, /* FIXME: remove 'ch'? */
295  ch->allow_send);
296 }
unsigned int allow_send
How many messages are we allowed to send to the service right now?
Definition: cadet.h:174
GNUNET_CADET_WindowSizeEventHandler window_changes
Window change handler.
Definition: cadet.h:159

References GNUNET_CADET_Channel::allow_send, ch, GNUNET_CADET_Channel::ctx, and GNUNET_CADET_Channel::window_changes.

Referenced by handle_local_ack().

Here is the caller graph for this function:

◆ cadet_mq_send_now()

static void cadet_mq_send_now ( void *  cls)
static

Transmit the next message from our queue.

Parameters
clsClosure (channel whose mq to activate).

Definition at line 305 of file cadet_api.c.

306 {
307  struct GNUNET_CADET_Channel *ch = cls;
309 
310  ch->mq_cont = NULL;
311  if (0 == ch->allow_send)
312  {
313  /* how did we get here? */
314  GNUNET_break (0);
315  return;
316  }
317  if (NULL == env)
318  {
319  /* how did we get here? */
320  GNUNET_break (0);
321  return;
322  }
323  ch->allow_send--;
324  ch->pending_env = NULL;
326  "Sending message on channel %s to CADET, new window size is %u\n",
327  GNUNET_i2s (&ch->peer),
328  ch->allow_send);
331 }
#define GNUNET_log(kind,...)
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.
void GNUNET_MQ_impl_send_continue(struct GNUNET_MQ_Handle *mq)
Call the send implementation for the next queued message, if any.
Definition: mq.c:421
struct GNUNET_PeerIdentity peer
Other end of the channel.
Definition: cadet.h:121
struct GNUNET_MQ_Handle * mq
Message queue.
Definition: cadet_api.c:43

References GNUNET_CADET_Channel::allow_send, GNUNET_CADET_Channel::cadet, ch, env, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_log, GNUNET_MQ_impl_send_continue(), GNUNET_MQ_send(), GNUNET_CADET_Channel::mq, GNUNET_CADET_Handle::mq, GNUNET_CADET_Channel::mq_cont, GNUNET_CADET_Channel::peer, and GNUNET_CADET_Channel::pending_env.

Referenced by cadet_mq_send_impl(), and handle_local_ack().

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

◆ cadet_mq_send_impl()

static void cadet_mq_send_impl ( struct GNUNET_MQ_Handle mq,
const struct GNUNET_MessageHeader msg,
void *  impl_state 
)
static

Implement sending functionality of a message queue for us sending messages to a peer.

Encapsulates the payload message in a GNUNET_CADET_LocalData message in order to label the message with the channel ID and send the encapsulated message to the service.

Parameters
mqthe message queue
msgthe message to send
impl_statestate of the implementation

Definition at line 347 of file cadet_api.c.

350 {
351  struct GNUNET_CADET_Channel *ch = impl_state;
352  struct GNUNET_CADET_Handle *h = ch->cadet;
353  uint16_t msize;
354  struct GNUNET_MQ_Envelope *orig_env;
355  struct GNUNET_MQ_Envelope *env;
356  struct GNUNET_CADET_LocalData *cadet_msg;
358 
359  if (NULL == h->mq)
360  {
361  /* We're currently reconnecting, pretend this worked */
363  return;
364  }
365  orig_env = GNUNET_MQ_get_current_envelope (mq);
366  pp = GNUNET_MQ_env_get_options (orig_env);
367 
368  /* check message size for sanity */
369  msize = ntohs (msg->size);
371  {
372  GNUNET_break (0);
374  return;
375  }
376  env = GNUNET_MQ_msg_nested_mh (cadet_msg,
378  msg);
379  cadet_msg->ccn = ch->ccn;
380  cadet_msg->pp = htonl ((uint32_t) pp);
381  GNUNET_assert (NULL == ch->pending_env);
382  ch->pending_env = env;
383  if (0 < ch->allow_send)
385 }
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
static void cadet_mq_send_now(void *cls)
Transmit the next message from our queue.
Definition: cadet_api.c:305
#define GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE
Maximum message size that can be sent on CADET.
#define GNUNET_MQ_msg_nested_mh(mvar, type, mh)
Allocate a GNUNET_MQ_Envelope, and append a payload message after the given message struct.
GNUNET_MQ_PriorityPreferences
Per envelope preferences and priorities.
enum GNUNET_MQ_PriorityPreferences GNUNET_MQ_env_get_options(struct GNUNET_MQ_Envelope *env)
Get performance preferences set for this envelope.
Definition: mq.c:839
struct GNUNET_MQ_Envelope * GNUNET_MQ_get_current_envelope(struct GNUNET_MQ_Handle *mq)
Function to obtain the current envelope from within GNUNET_MQ_SendImpl implementations.
Definition: mq.c:813
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1268
struct GNUNET_CADET_ClientChannelNumber ccn
ID of the channel.
Definition: cadet.h:261
uint32_t pp
Priority and preferences (an enum GNUNET_MQ_PriorityPreferences) of the message in NBO.
Definition: cadet.h:267
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.

References GNUNET_CADET_Channel::allow_send, GNUNET_CADET_Channel::cadet, cadet_mq_send_now(), GNUNET_CADET_Channel::ccn, GNUNET_CADET_LocalData::ccn, ch, env, GNUNET_assert, GNUNET_break, GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE, GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA, GNUNET_MQ_env_get_options(), GNUNET_MQ_get_current_envelope(), GNUNET_MQ_impl_send_continue(), GNUNET_MQ_msg_nested_mh, GNUNET_SCHEDULER_add_now(), h, mq, GNUNET_ARM_Handle::mq, GNUNET_CADET_Channel::mq_cont, msg, GNUNET_CADET_Channel::pending_env, GNUNET_CADET_LocalData::pp, and GNUNET_MessageHeader::size.

Referenced by GNUNET_CADET_channel_create(), and handle_channel_created().

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

◆ cadet_mq_destroy_impl()

static void cadet_mq_destroy_impl ( struct GNUNET_MQ_Handle mq,
void *  impl_state 
)
static

Handle destruction of a message queue.

Implementations must not free mq, but should take care of impl_state.

Parameters
mqthe message queue to destroy
impl_statestate of the implementation

Definition at line 396 of file cadet_api.c.

397 {
398  struct GNUNET_CADET_Channel *ch = impl_state;
399 
400  GNUNET_assert (mq == ch->mq);
401  ch->mq = NULL;
402 }

References ch, GNUNET_assert, mq, and GNUNET_CADET_Channel::mq.

Referenced by GNUNET_CADET_channel_create(), and handle_channel_created().

Here is the caller graph for this function:

◆ cadet_mq_error_handler()

static void cadet_mq_error_handler ( void *  cls,
enum GNUNET_MQ_Error  error 
)
static

We had an error processing a message we forwarded from a peer to the CADET service.

We should just complain about it but otherwise continue processing.

Parameters
clsclosure with our struct GNUNET_CADET_Channel
errorerror code

Definition at line 414 of file cadet_api.c.

415 {
416  struct GNUNET_CADET_Channel *ch = cls;
417 
418  if (GNUNET_MQ_ERROR_NO_MATCH == error)
419  {
420  /* Got a message we did not understand, still try to continue! */
421  GNUNET_break_op (0);
423  }
424  else
425  {
427  "MQ error in communication with CADET: %d\n",
428  error);
429  if (NULL != ch->disconnects)
430  ch->disconnects (ch->ctx, ch);
432  }
433 }
void GNUNET_CADET_receive_done(struct GNUNET_CADET_Channel *channel)
Send an ack on the channel to confirm the processing of a message.
Definition: cadet_api.c:872
void GNUNET_CADET_channel_destroy(struct GNUNET_CADET_Channel *channel)
Destroy an existing channel.
Definition: cadet_api.c:830
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_MQ_ERROR_NO_MATCH
We received a message for which we have no matching handler.

References ch, GNUNET_CADET_Channel::ctx, GNUNET_CADET_Channel::disconnects, GNUNET_break_op, GNUNET_CADET_channel_destroy(), GNUNET_CADET_receive_done(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, and GNUNET_MQ_ERROR_NO_MATCH.

Referenced by GNUNET_CADET_channel_create(), and handle_channel_created().

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

◆ cadet_mq_cancel_impl()

static void cadet_mq_cancel_impl ( struct GNUNET_MQ_Handle mq,
void *  impl_state 
)
static

Implementation function that cancels the currently sent message.

Should basically undo whatever mq_send_impl() did.

Parameters
mqmessage queue
impl_statestate specific to the implementation

Definition at line 444 of file cadet_api.c.

445 {
446  struct GNUNET_CADET_Channel *ch = impl_state;
447 
448  (void) mq;
449  GNUNET_assert (NULL != ch->pending_env);
451  ch->pending_env = NULL;
452  if (NULL != ch->mq_cont)
453  {
455  ch->mq_cont = NULL;
456  }
457 }

References ch, GNUNET_assert, GNUNET_MQ_discard(), GNUNET_SCHEDULER_cancel(), mq, GNUNET_CADET_Channel::mq_cont, and GNUNET_CADET_Channel::pending_env.

Referenced by GNUNET_CADET_channel_create(), and handle_channel_created().

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

◆ handle_channel_created()

static void handle_channel_created ( void *  cls,
const struct GNUNET_CADET_LocalChannelCreateMessage msg 
)
static

Process the new channel notification and add it to the channels in the handle.

Parameters
clsThe cadet handle
msgA message with the details of the new incoming channel

Definition at line 467 of file cadet_api.c.

470 {
471  struct GNUNET_CADET_Handle *h = cls;
472  struct GNUNET_CADET_Channel *ch;
473  struct GNUNET_CADET_Port *port;
474  const struct GNUNET_HashCode *port_number;
476 
477  ccn = msg->ccn;
478  port_number = &msg->port;
479  if (ntohl (ccn.channel_of_client) >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI)
480  {
481  GNUNET_break (0);
482  return;
483  }
484  port = find_port (h, port_number);
485  if (NULL == port)
486  {
487  /* We could have closed the port but the service didn't know about it yet
488  * This is not an error.
489  */
491  struct GNUNET_MQ_Envelope *env;
492 
494  "No handler for incoming channel %X (on port %s, recently closed?)\n",
495  ntohl (ccn.channel_of_client),
496  GNUNET_h2s (port_number));
497  env =
499  d_msg->ccn = msg->ccn;
500  GNUNET_MQ_send (h->mq, env);
501  return;
502  }
503 
504  ch = create_channel (h, &ccn);
505  ch->peer = msg->peer;
506  ch->incoming_port = port;
508  "Creating incoming channel %X [%s] %p\n",
509  ntohl (ccn.channel_of_client),
510  GNUNET_h2s (port_number),
511  ch);
512 
513  GNUNET_assert (NULL != port->connects);
514  ch->window_changes = port->window_changes;
515  ch->disconnects = port->disconnects;
519  ch,
520  port->handlers,
522  ch);
523  ch->ctx = port->connects (port->cls, ch, &msg->peer);
525 }
static struct GNUNET_CADET_Channel * create_channel(struct GNUNET_CADET_Handle *h, const struct GNUNET_CADET_ClientChannelNumber *ccnp)
Create a new channel and insert it in the channel list of the cadet handle.
Definition: cadet_api.c:162
static void cadet_mq_send_impl(struct GNUNET_MQ_Handle *mq, const struct GNUNET_MessageHeader *msg, void *impl_state)
Implement sending functionality of a message queue for us sending messages to a peer.
Definition: cadet_api.c:347
static void cadet_mq_destroy_impl(struct GNUNET_MQ_Handle *mq, void *impl_state)
Handle destruction of a message queue.
Definition: cadet_api.c:396
static void cadet_mq_cancel_impl(struct GNUNET_MQ_Handle *mq, void *impl_state)
Implementation function that cancels the currently sent message.
Definition: cadet_api.c:444
static void cadet_mq_error_handler(void *cls, enum GNUNET_MQ_Error error)
We had an error processing a message we forwarded from a peer to the CADET service.
Definition: cadet_api.c:414
static struct GNUNET_CADET_Port * find_port(const struct GNUNET_CADET_Handle *h, const struct GNUNET_HashCode *hash)
Find the Port struct for a hash.
Definition: cadet_api.c:131
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
struct GNUNET_MQ_Handle * GNUNET_MQ_queue_for_callbacks(GNUNET_MQ_SendImpl send, GNUNET_MQ_DestroyImpl destroy, GNUNET_MQ_CancelImpl cancel, void *impl_state, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *cls)
Create a message queue for the specified handlers.
Definition: mq.c:465
void GNUNET_MQ_set_handlers_closure(struct GNUNET_MQ_Handle *mq, void *handlers_cls)
Change the closure argument in all of the handlers of the mq.
Definition: mq.c:489
struct GNUNET_CADET_Port * incoming_port
Channel's port, if incoming.
Definition: cadet.h:131
struct GNUNET_CADET_ClientChannelNumber ccn
ID of a channel controlled by this client.
Definition: cadet.h:244
A 512-bit hashcode.

References cadet_mq_cancel_impl(), cadet_mq_destroy_impl(), cadet_mq_error_handler(), cadet_mq_send_impl(), GNUNET_CADET_LocalChannelDestroyMessage::ccn, ch, GNUNET_CADET_ClientChannelNumber::channel_of_client, create_channel(), GNUNET_CADET_Channel::ctx, GNUNET_CADET_Channel::disconnects, env, find_port(), GNUNET_assert, GNUNET_break, GNUNET_CADET_LOCAL_CHANNEL_ID_CLI, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_DESTROY, GNUNET_MQ_msg, GNUNET_MQ_queue_for_callbacks(), GNUNET_MQ_send(), GNUNET_MQ_set_handlers_closure(), h, GNUNET_CADET_Channel::incoming_port, LOG, GNUNET_ARM_Handle::mq, GNUNET_CADET_Channel::mq, msg, GNUNET_CADET_Channel::peer, port, and GNUNET_CADET_Channel::window_changes.

Here is the call graph for this function:

◆ handle_channel_destroy()

static void handle_channel_destroy ( void *  cls,
const struct GNUNET_CADET_LocalChannelDestroyMessage msg 
)
static

Process the channel destroy notification and free associated resources.

Parameters
clsThe cadet handle
msgA message with the details of the channel being destroyed

Definition at line 535 of file cadet_api.c.

538 {
539  struct GNUNET_CADET_Handle *h = cls;
540  struct GNUNET_CADET_Channel *ch;
541 
542  ch = find_channel (h, msg->ccn);
543  if (NULL == ch)
544  {
546  "Received channel destroy for unknown channel %X from CADET service (recently close?)\n",
547  ntohl (msg->ccn.channel_of_client));
548  return;
549  }
551  "Received channel destroy for channel %X from CADET service\n",
552  ntohl (msg->ccn.channel_of_client));
554 }
static void destroy_channel(struct GNUNET_CADET_Channel *ch)
Destroy the specified channel.
Definition: cadet_api.c:203

References ch, destroy_channel(), find_channel(), GNUNET_ERROR_TYPE_DEBUG, h, LOG, and msg.

Here is the call graph for this function:

◆ check_local_data()

static int check_local_data ( void *  cls,
const struct GNUNET_CADET_LocalData message 
)
static

Check that message received from CADET service is well-formed.

Parameters
clsthe struct GNUNET_CADET_Handle
messagethe message we got
Returns
GNUNET_OK if the message is well-formed, GNUNET_SYSERR otherwise

Definition at line 566 of file cadet_api.c.

567 {
568  uint16_t size;
569 
570  (void) cls;
571  size = ntohs (message->header.size);
572  if (sizeof(*message) + sizeof(struct GNUNET_MessageHeader) > size)
573  {
574  GNUNET_break (0);
575  return GNUNET_SYSERR;
576  }
577  return GNUNET_OK;
578 }
@ GNUNET_SYSERR
static unsigned int size
Size of the "table".
Definition: peer.c:68
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA.
Definition: cadet.h:256
Header for all communications.

References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, GNUNET_CADET_LocalData::header, GNUNET_MessageHeader::size, and size.

◆ handle_local_data()

static void handle_local_data ( void *  cls,
const struct GNUNET_CADET_LocalData message 
)
static

Process the incoming data packets, call appropriate handlers.

Parameters
clsThe cadet handle
messageA message encapsulating the data

Definition at line 588 of file cadet_api.c.

589 {
590  struct GNUNET_CADET_Handle *h = cls;
591  const struct GNUNET_MessageHeader *payload;
592  struct GNUNET_CADET_Channel *ch;
593  uint16_t type;
594  int fwd;
595 
596  ch = find_channel (h, message->ccn);
597  if (NULL == ch)
598  {
600  "Unknown channel %X for incoming data (recently closed?)\n",
601  ntohl (message->ccn.channel_of_client));
602  return;
603  }
604 
605  payload = (const struct GNUNET_MessageHeader *) &message[1];
606  type = ntohs (payload->type);
609  "Got a %s data on channel %s [%X] of type %u\n",
610  fwd ? "FWD" : "BWD",
611  GNUNET_i2s (&ch->peer),
612  ntohl (message->ccn.channel_of_client),
613  type);
615 }
static unsigned long long payload
How much data are we currently storing in the database?
void GNUNET_MQ_inject_message(struct GNUNET_MQ_Handle *mq, const struct GNUNET_MessageHeader *mh)
Call the message message handler that was registered for the type of the given message in the given m...
Definition: mq.c:187
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model

References GNUNET_CADET_Channel::ccn, GNUNET_CADET_LocalData::ccn, ch, GNUNET_CADET_ClientChannelNumber::channel_of_client, find_channel(), GNUNET_CADET_LOCAL_CHANNEL_ID_CLI, GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_MQ_inject_message(), h, LOG, GNUNET_CADET_Channel::mq, payload, GNUNET_CADET_Channel::peer, and type.

Here is the call graph for this function:

◆ handle_local_ack()

static void handle_local_ack ( void *  cls,
const struct GNUNET_CADET_LocalAck message 
)
static

Process a local ACK message, enabling the client to send more data to the service.

Parameters
clsCadet handle.
messageMessage itself.

Definition at line 626 of file cadet_api.c.

627 {
628  struct GNUNET_CADET_Handle *h = cls;
629  struct GNUNET_CADET_Channel *ch;
630 
631  ch = find_channel (h, message->ccn);
632  if (NULL == ch)
633  {
635  "ACK on unknown channel %X\n",
636  ntohl (message->ccn.channel_of_client));
637  return;
638  }
639  ch->allow_send++;
641  "Got an ACK on mq channel %X (peer %s); new window size is %u!\n",
642  ntohl (ch->ccn.channel_of_client),
643  GNUNET_i2s (&ch->peer),
644  ch->allow_send);
645  if (NULL == ch->pending_env)
646  {
648  "Got an ACK on mq channel %X, allow send now %u!\n",
649  ntohl (ch->ccn.channel_of_client),
650  ch->allow_send);
652  return;
653  }
654  if (NULL != ch->mq_cont)
655  return; /* already working on it! */
657 }
static void notify_window_size(struct GNUNET_CADET_Channel *ch)
Notify the application about a change in the window size (if needed).
Definition: cadet_api.c:290
struct GNUNET_CADET_ClientChannelNumber ccn
ID of the channel allowed to send more data.
Definition: cadet.h:289

References GNUNET_CADET_Channel::allow_send, cadet_mq_send_now(), GNUNET_CADET_Channel::ccn, GNUNET_CADET_LocalAck::ccn, ch, GNUNET_CADET_ClientChannelNumber::channel_of_client, find_channel(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_SCHEDULER_add_now(), h, LOG, GNUNET_CADET_Channel::mq_cont, notify_window_size(), GNUNET_CADET_Channel::peer, and GNUNET_CADET_Channel::pending_env.

Here is the call graph for this function:

◆ destroy_channel_cb()

static int destroy_channel_cb ( void *  cls,
uint32_t  cid,
void *  value 
)
static

Function called during GNUNET_CADET_disconnect() to destroy all channels that are still open.

Parameters
clsthe struct GNUNET_CADET_Handle
cidchanenl ID
valuea struct GNUNET_CADET_Channel to destroy
Returns
GNUNET_OK (continue to iterate)

Definition at line 670 of file cadet_api.c.

671 {
672  /* struct GNUNET_CADET_Handle *handle = cls; */
673  struct GNUNET_CADET_Channel *ch = value;
674 
675  (void) cls;
676  (void) cid;
678  "Destroying channel due to GNUNET_CADET_disconnect()\n");
680  return GNUNET_OK;
681 }
@ GNUNET_ERROR_TYPE_INFO

References ch, destroy_channel(), GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_OK, and value.

Referenced by GNUNET_CADET_disconnect(), and handle_mq_error().

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

◆ handle_mq_error()

static void handle_mq_error ( void *  cls,
enum GNUNET_MQ_Error  error 
)
static

Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue.

Not every message queue implementation supports an error handler.

Parameters
clsclosure, a struct GNUNET_CORE_Handle *
errorerror code

Definition at line 693 of file cadet_api.c.

694 {
695  struct GNUNET_CADET_Handle *h = cls;
696 
697  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MQ ERROR: %u\n", error);
700  h->mq = NULL;
701  GNUNET_assert (NULL == h->reconnect_task);
702  h->reconnect_task =
703  GNUNET_SCHEDULER_add_delayed (h->reconnect_time, &reconnect_cbk, h);
704 }
static void reconnect_cbk(void *cls)
Reconnect callback: tries to reconnect again after a failed previous connection.
Definition: cadet_api.c:273
static int destroy_channel_cb(void *cls, uint32_t cid, void *value)
Function called during GNUNET_CADET_disconnect() to destroy all channels that are still open.
Definition: cadet_api.c:670
int GNUNET_CONTAINER_multihashmap32_iterate(struct GNUNET_CONTAINER_MultiHashMap32 *map, GNUNET_CONTAINER_MultiHashMapIterator32Callback it, void *it_cls)
Iterate over all entries in the map.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1241

References destroy_channel_cb(), GNUNET_assert, GNUNET_CONTAINER_multihashmap32_iterate(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_add_delayed(), h, GNUNET_ARM_Handle::mq, reconnect_cbk(), and GNUNET_ARM_Handle::reconnect_task.

Referenced by reconnect().

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

◆ destroy_port_cb()

static int destroy_port_cb ( void *  cls,
const struct GNUNET_HashCode id,
void *  value 
)
static

Function called during GNUNET_CADET_disconnect() to destroy all ports that are still open.

Parameters
clsthe struct GNUNET_CADET_Handle
idport ID
valuea struct GNUNET_CADET_Channel to destroy
Returns
GNUNET_OK (continue to iterate)

Definition at line 751 of file cadet_api.c.

752 {
753  /* struct GNUNET_CADET_Handle *handle = cls; */
754  struct GNUNET_CADET_Port *port = value;
755 
756  (void) cls;
757  (void) id;
758  /* This is a warning, the app should have cleanly closed all open ports */
759  GNUNET_break (0);
761  return GNUNET_OK;
762 }
void GNUNET_CADET_close_port(struct GNUNET_CADET_Port *p)
Close a port opened with GNUNET_CADET_open_port.
Definition: cadet_api.c:801
void * cls
Closure for handler.
Definition: cadet_api.c:94

References GNUNET_CADET_Port::cls, GNUNET_break, GNUNET_CADET_close_port(), GNUNET_OK, port, and value.

Referenced by GNUNET_CADET_disconnect().

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

◆ return_agpl()

static void return_agpl ( void *  cls,
const struct GNUNET_MessageHeader msg 
)
static

Function to return link to AGPL source upon request.

Parameters
clsclosure with the identification of the client
msgAGPL request

Definition at line 922 of file cadet_api.c.

923 {
924  struct GNUNET_SERVICE_Client *client = cls;
925  struct GNUNET_MQ_Handle *mq;
926  struct GNUNET_MQ_Envelope *env;
927  struct GNUNET_MessageHeader *res;
928  size_t slen;
930 
931  (void) msg;
932  slen = strlen (pd->agpl_url) + 1;
934  memcpy (&res[1], GNUNET_AGPL_URL, slen);
935  mq = GNUNET_SERVICE_client_get_mq (client);
936  GNUNET_MQ_send (mq, env);
938 }
static int res
#define GNUNET_AGPL_URL
NOTE: You MUST adjust this URL to point to the location of a publicly accessible repository (or TGZ) ...
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
Definition: gnunet_mq_lib.h:62
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_get(void)
#define GNUNET_MESSAGE_TYPE_RESPONSE_AGPL
Source code link.
struct GNUNET_MQ_Handle * GNUNET_SERVICE_client_get_mq(struct GNUNET_SERVICE_Client *c)
Obtain the message queue of c.
Definition: service.c:2443
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2249
Handle to a message queue.
Definition: mq.c:87
Project-specific data used to help the OS subsystem find installation paths.
char * agpl_url
URL pointing to the source code of the application.
Handle to a client that is connected to a service.
Definition: service.c:252

References GNUNET_OS_ProjectData::agpl_url, env, GNUNET_AGPL_URL, GNUNET_MESSAGE_TYPE_RESPONSE_AGPL, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_OS_project_data_get(), GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_get_mq(), mq, msg, and res.

Referenced by GNUNET_CADET_open_port().

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