GNUnet  0.20.0
CADET service

Confidential Ad-hoc Decentralized End-to-End Transport. More...

Collaboration diagram for CADET service:

Data Structures

struct  GNUNET_CADET_ConnectionTunnelIdentifier
 Hash uniquely identifying a connection below a tunnel. More...
 
struct  GNUNET_CADET_ChannelTunnelNumber
 Number identifying a CADET channel within a tunnel. More...
 
union  GNUNET_CADET_ChannelInfo
 Union to retrieve info about a channel. More...
 
struct  GNUNET_CADET_ChannelInternals
 Internal details about a channel. More...
 
struct  GNUNET_CADET_PeerListEntry
 Information we return per peer. More...
 
struct  GNUNET_CADET_PeerPathDetail
 Detailed information we return per peer. More...
 
struct  GNUNET_CADET_TunnelDetails
 Details about a tunnel managed by CADET. More...
 

Macros

#define GNUNET_CADET_VERSION   0x00000005
 Version number of GNUnet-cadet API. More...
 

Typedefs

typedef void *(* GNUNET_CADET_ConnectEventHandler) (void *cls, struct GNUNET_CADET_Channel *channel, const struct GNUNET_PeerIdentity *source)
 Method called whenever a peer connects to a port in MQ-based CADET. More...
 
typedef void(* GNUNET_CADET_DisconnectEventHandler) (void *cls, const struct GNUNET_CADET_Channel *channel)
 Function called whenever an MQ-channel is destroyed, unless the destruction was requested by GNUNET_CADET_channel_destroy. More...
 
typedef void(* GNUNET_CADET_WindowSizeEventHandler) (void *cls, const struct GNUNET_CADET_Channel *channel, int window_size)
 Function called whenever an MQ-channel's transmission window size changes. More...
 
typedef void(* GNUNET_CADET_ChannelCB) (void *cls, const struct GNUNET_CADET_ChannelInternals *info)
 Method called to retrieve information about a specific channel the cadet peer is aware of, including all transit nodes. More...
 
typedef void(* GNUNET_CADET_PeersCB) (void *cls, const struct GNUNET_CADET_PeerListEntry *ple)
 Method called to retrieve information about all peers in CADET, called once per peer. More...
 
typedef void(* GNUNET_CADET_PathCB) (void *cls, const struct GNUNET_CADET_PeerPathDetail *ppd)
 Method called to retrieve information about a specific path known to the service. More...
 
typedef void(* GNUNET_CADET_TunnelsCB) (void *cls, const struct GNUNET_CADET_TunnelDetails *td)
 Method called to retrieve information about all tunnels in CADET, called once per tunnel. More...
 

Enumerations

enum  GNUNET_CADET_ChannelInfoOption { GNUNET_CADET_OPTION_PEER = 0x0 }
 

Functions

struct GNUNET_CADET_HandleGNUNET_CADET_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
 Connect to the MQ-based cadet service. More...
 
void GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle)
 Disconnect from the cadet service. 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...
 
void GNUNET_CADET_close_port (struct GNUNET_CADET_Port *p)
 Close a port opened with GNUNET_CADET_open_port. 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...
 
void GNUNET_CADET_channel_destroy (struct GNUNET_CADET_Channel *channel)
 Destroy an existing channel. More...
 
struct GNUNET_MQ_HandleGNUNET_CADET_get_mq (const struct GNUNET_CADET_Channel *channel)
 Obtain the message queue for a connected channel. More...
 
void GNUNET_CADET_receive_done (struct GNUNET_CADET_Channel *channel)
 Indicate readiness to receive the next message on a channel. More...
 
const struct GNUNET_HashCodeGC_u2h (uint32_t port)
 Transitional function to convert an unsigned int port to a hash value. 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...
 
struct GNUNET_CADET_ChannelMonitorGNUNET_CADET_get_channel (const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_PeerIdentity *peer, GNUNET_CADET_ChannelCB callback, void *callback_cls)
 Request information about channels to peer from the local peer. More...
 
void * GNUNET_CADET_get_channel_cancel (struct GNUNET_CADET_ChannelMonitor *cm)
 Cancel a channel monitor request. More...
 
struct GNUNET_CADET_PeersListerGNUNET_CADET_list_peers (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_CADET_PeersCB callback, void *callback_cls)
 Request information about peers known to the running cadet service. More...
 
void * GNUNET_CADET_list_peers_cancel (struct GNUNET_CADET_PeersLister *pl)
 Cancel a peer info request. More...
 
struct GNUNET_CADET_GetPathGNUNET_CADET_get_path (const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_PeerIdentity *id, GNUNET_CADET_PathCB callback, void *callback_cls)
 Request information about a peer known to the running cadet peer. More...
 
void * GNUNET_CADET_get_path_cancel (struct GNUNET_CADET_GetPath *gp)
 Cancel gp operation. More...
 
struct GNUNET_CADET_ListTunnelsGNUNET_CADET_list_tunnels (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_CADET_TunnelsCB callback, void *callback_cls)
 Request information about tunnels of the running cadet peer. More...
 
void * GNUNET_CADET_list_tunnels_cancel (struct GNUNET_CADET_ListTunnels *lt)
 Cancel a monitor request. More...
 

Detailed Description

Confidential Ad-hoc Decentralized End-to-End Transport.

See also
Documentation
Paper

Macro Definition Documentation

◆ GNUNET_CADET_VERSION

#define GNUNET_CADET_VERSION   0x00000005

Version number of GNUnet-cadet API.

Definition at line 55 of file gnunet_cadet_service.h.

Typedef Documentation

◆ GNUNET_CADET_ConnectEventHandler

typedef void*(* GNUNET_CADET_ConnectEventHandler) (void *cls, struct GNUNET_CADET_Channel *channel, const struct GNUNET_PeerIdentity *source)

Method called whenever a peer connects to a port in MQ-based CADET.

Parameters
clsClosure from GNUNET_CADET_open_port.
channelNew handle to the channel.
sourcePeer that started this channel.
Returns
Closure for the incoming channel. It's given to:

Definition at line 112 of file gnunet_cadet_service.h.

◆ GNUNET_CADET_DisconnectEventHandler

typedef void(* GNUNET_CADET_DisconnectEventHandler) (void *cls, const struct GNUNET_CADET_Channel *channel)

Function called whenever an MQ-channel is destroyed, unless the destruction was requested by GNUNET_CADET_channel_destroy.

It must NOT call GNUNET_CADET_channel_destroy on the channel.

It should clean up any associated state, including cancelling any pending transmission on this channel.

Parameters
clsChannel closure.
channelConnection to the other end (henceforth invalid).

Definition at line 129 of file gnunet_cadet_service.h.

◆ GNUNET_CADET_WindowSizeEventHandler

typedef void(* GNUNET_CADET_WindowSizeEventHandler) (void *cls, const struct GNUNET_CADET_Channel *channel, int window_size)

Function called whenever an MQ-channel's transmission window size changes.

The first callback in an outgoing channel will be with a non-zero value and will mean the channel is connected to the destination.

For an incoming channel it will be called immediately after the GNUNET_CADET_ConnectEventHandler, also with a non-zero value.

Parameters
clsChannel closure.
channelConnection to the other end — FIXME: drop?
window_sizeNew window size. If the is more messages than buffer size this value will be negative. – FIXME: make unsigned, we never call negative?

Definition at line 148 of file gnunet_cadet_service.h.

◆ GNUNET_CADET_ChannelCB

typedef void(* GNUNET_CADET_ChannelCB) (void *cls, const struct GNUNET_CADET_ChannelInternals *info)

Method called to retrieve information about a specific channel the cadet peer is aware of, including all transit nodes.

Parameters
clsClosure.
infointernal details, NULL for end of list

Definition at line 364 of file gnunet_cadet_service.h.

◆ GNUNET_CADET_PeersCB

typedef void(* GNUNET_CADET_PeersCB) (void *cls, const struct GNUNET_CADET_PeerListEntry *ple)

Method called to retrieve information about all peers in CADET, called once per peer.

After last peer has been reported, an additional call with NULL is done.

Parameters
clsClosure.
pleinformation about a peer, or NULL on "EOF".

Definition at line 436 of file gnunet_cadet_service.h.

◆ GNUNET_CADET_PathCB

typedef void(* GNUNET_CADET_PathCB) (void *cls, const struct GNUNET_CADET_PeerPathDetail *ppd)

Method called to retrieve information about a specific path known to the service.

Parameters
clsClosure.
ppddetails about a path to the peer, NULL for end of information

Definition at line 509 of file gnunet_cadet_service.h.

◆ GNUNET_CADET_TunnelsCB

typedef void(* GNUNET_CADET_TunnelsCB) (void *cls, const struct GNUNET_CADET_TunnelDetails *td)

Method called to retrieve information about all tunnels in CADET, called once per tunnel.

After last tunnel has been reported, an additional call with NULL is done.

Parameters
clsClosure.
tdtunnel details, NULL for end of list

Definition at line 587 of file gnunet_cadet_service.h.

Enumeration Type Documentation

◆ GNUNET_CADET_ChannelInfoOption

Enumerator
GNUNET_CADET_OPTION_PEER 

Who is the peer at the other end of the channel.

Only for use in GNUNET_CADET_channel_get_info struct GNUNET_PeerIdentity *peer

Definition at line 285 of file gnunet_cadet_service.h.

286 {
293 };
@ GNUNET_CADET_OPTION_PEER
Who is the peer at the other end of the channel.

Function Documentation

◆ GNUNET_CADET_connect()

struct GNUNET_CADET_Handle* GNUNET_CADET_connect ( const struct GNUNET_CONFIGURATION_Handle cfg)

Connect to the MQ-based cadet service.

Parameters
cfgConfiguration to use.
Returns
Handle to the cadet service NULL on error.

Definition at line 894 of file cadet_api.c.

895 {
896  struct GNUNET_CADET_Handle *h;
897 
898  LOG (GNUNET_ERROR_TYPE_DEBUG, "GNUNET_CADET_connect()\n");
899  h = GNUNET_new (struct GNUNET_CADET_Handle);
900  h->cfg = cfg;
903  reconnect (h);
904  if (NULL == h->mq)
905  {
906  GNUNET_break (0);
908  return NULL;
909  }
910  h->next_ccn.channel_of_client = htonl (GNUNET_CADET_LOCAL_CHANNEL_ID_CLI);
911  return h;
912 }
#define GNUNET_CADET_LOCAL_CHANNEL_ID_CLI
Minimum value for channel IDs of local clients.
Definition: cadet.h:70
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
#define LOG(kind,...)
Definition: cadet_api.c:33
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
void GNUNET_CADET_disconnect(struct GNUNET_CADET_Handle *handle)
Disconnect from the cadet service.
Definition: cadet_api.c:774
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
struct GNUNET_CONTAINER_MultiHashMap32 * GNUNET_CONTAINER_multihashmap32_create(unsigned int len)
Create a 32-bit key multi hash map.
@ GNUNET_YES
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_new(type)
Allocate a struct or union of the given type.
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
Opaque handle to the service.
Definition: cadet_api.c:39

References cfg, GNUNET_ARM_Handle::cfg, GNUNET_break, GNUNET_CADET_disconnect(), GNUNET_CADET_LOCAL_CHANNEL_ID_CLI, GNUNET_CONTAINER_multihashmap32_create(), GNUNET_CONTAINER_multihashmap_create(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_new, GNUNET_YES, h, LOG, GNUNET_ARM_Handle::mq, and reconnect().

Referenced by cadet_connect_adapter(), create_service(), GSF_cadet_start_server(), and run().

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

◆ GNUNET_CADET_disconnect()

void GNUNET_CADET_disconnect ( struct GNUNET_CADET_Handle handle)

Disconnect from the cadet service.

All channels will be destroyed. All channel disconnect callbacks will be called on any still connected peers, notifying about their disconnection. The registered inbound channel cleaner will be called should any inbound channels still exist.

Parameters
handleconnection to cadet to disconnect

Definition at line 774 of file cadet_api.c.

775 {
778  handle);
780  handle->ports = NULL;
783  handle);
785  handle->channels = NULL;
786  if (NULL != handle->mq)
787  {
789  handle->mq = NULL;
790  }
791  if (NULL != handle->reconnect_task)
792  {
794  handle->reconnect_task = NULL;
795  }
797 }
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
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.
Definition: cadet_api.c:751
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
void GNUNET_CONTAINER_multihashmap32_destroy(struct GNUNET_CONTAINER_MultiHashMap32 *map)
Destroy a 32-bit key hash map.
int GNUNET_CONTAINER_multihashmap32_iterate(struct GNUNET_CONTAINER_MultiHashMap32 *map, GNUNET_CONTAINER_MultiHashMapIterator32Callback it, void *it_cls)
Iterate over all entries in the map.
#define GNUNET_free(ptr)
Wrapper around free.
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:975
struct GNUNET_SCHEDULER_Task * reconnect_task
Task to reconnect to the service.
Definition: dns_api.c:81
struct GNUNET_MQ_Handle * mq
Connection to DNS service, or NULL.
Definition: dns_api.c:61

References destroy_channel_cb(), destroy_port_cb(), GNUNET_CONTAINER_multihashmap32_destroy(), GNUNET_CONTAINER_multihashmap32_iterate(), GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), handle, GNUNET_DNS_Handle::mq, and GNUNET_DNS_Handle::reconnect_task.

Referenced by cadet_disconnect_adapter(), cleanup(), client_disconnect_cb(), destroy_service(), do_shutdown(), GNUNET_CADET_connect(), GSF_cadet_stop_server(), and shutdown_task().

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

◆ GNUNET_CADET_open_port()

struct GNUNET_CADET_Port* GNUNET_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.

Parameters
hCADET handle.
portHash identifying the port.
connectsFunction called when an incoming channel is connected.
connects_clsClosure for the connects handler.
window_changesFunction called when the transmit window size changes. Can be NULL.
disconnectsFunction called when a channel is disconnected.
handlersCallbacks for messages we care about, NULL-terminated.
Returns
Port handle, NULL if port is in use
Parameters
hCADET handle.
portHash identifying the port.
connectsFunction called when an incoming channel is connected.
connects_clsClosure for the connects handler.
window_changesFunction called when the transmit window size changes.
disconnectsFunction called when a channel is disconnected.
handlersCallbacks for messages we care about, NULL-terminated.
Returns
Port handle, NULL if port is in use

Definition at line 954 of file cadet_api.c.

961 {
962  struct GNUNET_CADET_Port *p;
964 
965  GNUNET_assert (NULL != connects);
966  GNUNET_assert (NULL != disconnects);
968  "Listening to CADET port %s\n",
969  GNUNET_h2s (port));
970 
971  p = GNUNET_new (struct GNUNET_CADET_Port);
972  p->cadet = h;
973  p->id = *port;
975  h->ports,
976  &p->id,
977  p,
979  {
980  GNUNET_free (p);
981  return NULL;
982  }
983  p->connects = connects;
984  p->cls = connects_cls;
985  p->window_changes = window_changes;
986  p->disconnects = disconnects;
987  p->handlers = (NULL == pd->agpl_url)
990 
991  GNUNET_assert (GNUNET_OK == open_port_cb (h, &p->id, p));
992  return p;
993 }
void * connects(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq)
Definition: 010.c:2
void disconnects(void *cls, const struct GNUNET_PeerIdentity *peer)
Definition: 011.c:2
static void return_agpl(void *cls, const struct GNUNET_MessageHeader *msg)
Function to return link to AGPL source upon request.
Definition: cadet_api.c:922
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
static uint16_t port
Port number.
Definition: gnunet-bcd.c:147
static struct GNUNET_CADET_MessageHandler handlers[]
Handlers, for diverse services.
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-uri.c:38
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_put(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *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...
#define GNUNET_log(kind,...)
@ GNUNET_OK
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
struct GNUNET_MQ_MessageHandler * GNUNET_MQ_copy_handlers2(const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_MessageCallback agpl_handler, void *agpl_cls)
Copy an array of handlers, appending AGPL handler.
Definition: mq.c:975
struct GNUNET_MQ_MessageHandler * GNUNET_MQ_copy_handlers(const struct GNUNET_MQ_MessageHandler *handlers)
Copy an array of handlers.
Definition: mq.c:957
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_get(void)
Opaque handle to a port.
Definition: cadet_api.c:80
Project-specific data used to help the OS subsystem find installation paths.
char * agpl_url
URL pointing to the source code of the application.

References GNUNET_OS_ProjectData::agpl_url, connects(), disconnects(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_h2s(), GNUNET_log, GNUNET_MQ_copy_handlers(), GNUNET_MQ_copy_handlers2(), GNUNET_new, GNUNET_OK, GNUNET_OS_project_data_get(), h, handlers, open_port_cb(), p, port, and return_agpl().

Referenced by advertise_dns_exit(), cadet_connect_adapter(), GSF_cadet_start_server(), handle_bob_client_message(), handle_client_listen(), handle_client_register_message(), new_sub(), open_srv_room(), run(), and store_service().

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

◆ GNUNET_CADET_close_port()

void GNUNET_CADET_close_port ( struct GNUNET_CADET_Port p)

Close a port opened with GNUNET_CADET_open_port.

The new_channel callback will no longer be called.

Parameters
pPort handle.

Definition at line 801 of file cadet_api.c.

802 {
803  GNUNET_assert (
804  GNUNET_YES ==
805  GNUNET_CONTAINER_multihashmap_remove (p->cadet->ports, &p->id, p));
806  if (NULL != p->cadet->mq)
807  {
809  struct GNUNET_MQ_Envelope *env;
810 
812  msg->port = p->id;
813  GNUNET_MQ_send (p->cadet->mq, env);
814  }
815  GNUNET_free (p->handlers);
816  GNUNET_free (p);
817 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_remove(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, const void *value)
Remove the given key-value pair from the map.
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:78
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE
Stop listening on a port.
Message for a client to create and destroy channels.
Definition: cadet.h:181

References env, GNUNET_assert, GNUNET_CONTAINER_multihashmap_remove(), GNUNET_free, GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_YES, msg, and p.

Referenced by cadet_disconnect_adapter(), cb_channel_incoming(), channel_incoming(), cleanup(), client_disconnect_cb(), destroy_port_cb(), destroy_service_session(), destroy_srv_room(), destroy_sub(), free_service_record(), GSF_cadet_stop_server(), open_srv_room(), shutdown_task(), and store_service().

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

◆ GNUNET_CADET_channel_create()

struct GNUNET_CADET_Channel* GNUNET_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.

If the destination peer closes the channel after accepting it, disconnects will be called for this channel (unless GNUNET_CADET_channel_destroy() was called on this end first).

Parameters
hCADET handle.
channel_clsClosure for the channel. It's given to:
  • The management handler window_changes.
  • The disconnect handler disconnects
  • Each message type callback in handlers
destinationPeer identity the channel should go to.
portIdentification of the destination port.
window_changesFunction called when the transmit window size changes. Can be NULL if this data is of no interest.
disconnectsFunction called when the channel is disconnected.
handlersCallbacks for messages we care about, NULL-terminated.
Returns
Handle to the channel.

If the destination peer closes the channel after accepting it, disconnects will be called for this channel (unless GNUNET_CADET_channel_destroy() was called on this end first).

Parameters
hCADET handle.
channel_clsClosure for the channel. It's given to:
  • The disconnect handler disconnects
  • Each message type callback in handlers
destinationPeer identity the channel should go to.
portIdentification of the destination port.
window_changesFunction called when the transmit window size changes.
disconnectsFunction called when the channel is disconnected.
handlersCallbacks for messages we care about, NULL-terminated.
Returns
Handle to the channel.

Definition at line 1015 of file cadet_api.c.

1022 {
1023  struct GNUNET_CADET_Channel *ch;
1025  struct GNUNET_MQ_Envelope *env;
1026 
1027  GNUNET_assert (NULL != disconnects);
1029  "Creating channel to peer %s at port %s\n",
1030  GNUNET_i2s (destination),
1031  GNUNET_h2s (port));
1032  ch = create_channel (h, NULL);
1033  ch->ctx = channel_cls;
1034  ch->peer = *destination;
1035  ch->window_changes = window_changes;
1037 
1038  /* Create MQ for channel */
1042  ch,
1043  handlers,
1045  ch);
1046  GNUNET_MQ_set_handlers_closure (ch->mq, channel_cls);
1047 
1048  /* Request channel creation to service */
1050  msg->ccn = ch->ccn;
1051  msg->port = *port;
1052  msg->peer = *destination;
1053  GNUNET_MQ_send (h->mq, env);
1054  return ch;
1055 }
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_Channel * ch
Channel handle.
Definition: gnunet-cadet.c:117
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity 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
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_CREATE
Ask the cadet service to create a new channel.
Opaque handle to a channel.
Definition: cadet.h:116
void * ctx
Any data the caller wants to put in here, used for the various callbacks (disconnects,...
Definition: cadet.h:137
struct GNUNET_PeerIdentity peer
Other end of the channel.
Definition: cadet.h:121
GNUNET_CADET_WindowSizeEventHandler window_changes
Window change handler.
Definition: cadet.h:159
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
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
Message for a client to create channels.
Definition: cadet.h:201

References cadet_mq_cancel_impl(), cadet_mq_destroy_impl(), cadet_mq_error_handler(), cadet_mq_send_impl(), GNUNET_CADET_Channel::ccn, ch, create_channel(), GNUNET_CADET_Channel::ctx, disconnects(), GNUNET_CADET_Channel::disconnects, env, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_i2s(), GNUNET_log, GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_CREATE, GNUNET_MQ_msg, GNUNET_MQ_queue_for_callbacks(), GNUNET_MQ_send(), GNUNET_MQ_set_handlers_closure(), h, handlers, GNUNET_ARM_Handle::mq, GNUNET_CADET_Channel::mq, msg, GNUNET_CADET_Channel::peer, port, and GNUNET_CADET_Channel::window_changes.

Referenced by client_request_complete_alice(), connect_tunnel(), create_channel(), get_cadet(), get_channel(), handle_client_call_message(), handle_client_evaluate(), reset_cadet(), run(), start_test(), try_open_exit(), and warmup().

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

◆ GNUNET_CADET_channel_destroy()

void GNUNET_CADET_channel_destroy ( struct GNUNET_CADET_Channel channel)

Destroy an existing channel.

The existing end callback for the channel will NOT be called. Any pending outgoing messages will be sent but no incoming messages will be accepted and no data callbacks will be called.

Parameters
channelChannel handle, becomes invalid after this call.

Definition at line 830 of file cadet_api.c.

831 {
832  struct GNUNET_CADET_Handle *h = channel->cadet;
834  struct GNUNET_MQ_Envelope *env;
835 
836  if (NULL != h->mq)
837  {
839  msg->ccn = channel->ccn;
840  GNUNET_MQ_send (h->mq, env);
841  }
843  "Destroying channel due to GNUNET_CADET_channel_destroy()\n");
844  channel->disconnects = NULL;
845  destroy_channel (channel);
846 }
static void destroy_channel(struct GNUNET_CADET_Channel *ch)
Destroy the specified channel.
Definition: cadet_api.c:203
@ GNUNET_ERROR_TYPE_INFO
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_DESTROY
Tell client that a channel was destroyed.
struct GNUNET_CADET_Handle * cadet
Handle to the cadet this channel belongs to.
Definition: cadet.h:126
Message for or to a client to destroy tunnel.
Definition: cadet.h:235

References GNUNET_CADET_Channel::cadet, GNUNET_CADET_Channel::ccn, destroy_channel(), GNUNET_CADET_Channel::disconnects, env, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_DESTROY, GNUNET_MQ_msg, GNUNET_MQ_send(), h, GNUNET_ARM_Handle::mq, and msg.

Referenced by _GSS_operation_destroy(), _GSS_operation_destroy2(), adjust_running_peers(), cadet_mq_error_handler(), cadet_timeout(), callback_close_channel(), cleanup(), client_request_complete_alice(), connect_cb(), destroy_channel(), destroy_line_cadet_channels(), destroy_service_session(), destroy_tunnel(), disconnect_cadet_peers(), free_channel_state(), GSF_cadet_release_clients(), reset_cadet(), setup_state_record(), shutdown_task(), timeout_cadet_task(), timeout_request(), and transmit_cryptographic_reply().

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

◆ GNUNET_CADET_get_mq()

struct GNUNET_MQ_Handle* GNUNET_CADET_get_mq ( const struct GNUNET_CADET_Channel channel)

Obtain the message queue for a connected channel.

Parameters
channelThe channel handle from which to get the MQ.
Returns
The message queue of the channel.

Obtain the message queue for a connected channel.

Parameters
channelThe channel handle from which to get the MQ.
Returns
NULL if channel is not yet connected.

Definition at line 1066 of file cadet_api.c.

1067 {
1068  return channel->mq;
1069 }

References GNUNET_CADET_Channel::mq.

Referenced by cadet_channel_end_cb(), cb_channel_incoming(), channel_new_cb(), client_request_complete_alice(), continue_writing(), dns_pre_request_handler(), get_mq(), handle_client_call_message(), handle_client_evaluate(), handle_data(), handle_datastore_reply(), inbound_channel(), process_dns_result(), read_stdio(), send_echo(), send_packet_to_cadet_channel(), send_to_channel(), send_tunnel_envelope(), and transmit_pending().

Here is the caller graph for this function:

◆ GNUNET_CADET_receive_done()

void GNUNET_CADET_receive_done ( struct GNUNET_CADET_Channel channel)

Indicate readiness to receive the next message on a channel.

Should only be called once per handler called.

Parameters
channelChannel that will be allowed to call another handler.

Indicate readiness to receive the next message on a channel.

Parameters
chChannel on which to send the ACK.

Definition at line 872 of file cadet_api.c.

873 {
874  struct GNUNET_CADET_LocalAck *msg;
875  struct GNUNET_MQ_Envelope *env;
876 
879  "Sending ACK on channel %X\n",
880  ntohl (channel->ccn.channel_of_client));
881  msg->ccn = channel->ccn;
882  GNUNET_MQ_send (channel->cadet->mq, env);
883 }
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK
Local ACK for data.
uint32_t channel_of_client
Values for channel numbering.
Definition: cadet.h:109
struct GNUNET_MQ_Handle * mq
Message queue.
Definition: cadet_api.c:43
Message to allow the client send more data to the service (always service -> client).
Definition: cadet.h:280

References GNUNET_CADET_Channel::cadet, GNUNET_CADET_Channel::ccn, GNUNET_CADET_ClientChannelNumber::channel_of_client, env, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK, GNUNET_MQ_msg, GNUNET_MQ_send(), LOG, GNUNET_CADET_Handle::mq, and msg.

Referenced by cadet_mq_error_handler(), cb_intersection_element_removed(), compute_rand_delay(), continue_writing(), handle_alices_cryptodata_message(), handle_bobs_cryptodata_message(), handle_bobs_cryptodata_multipart(), handle_cadet_audio_message(), handle_cadet_hangup_message(), handle_cadet_pickup_message(), handle_cadet_resume_message(), handle_cadet_ring_message(), handle_cadet_suspend_message(), handle_client_accept(), handle_data(), handle_dns_request(), handle_icmp_back(), handle_icmp_remote(), handle_icmp_service(), handle_intersection_p2p_bf(), handle_intersection_p2p_done(), handle_intersection_p2p_element_info(), handle_peer_check(), handle_peer_pull_request(), handle_peer_push(), handle_reply(), handle_tcp_back(), handle_tcp_data(), handle_tcp_remote(), handle_tcp_service(), handle_tunnel_message(), handle_udp_back(), handle_udp_remote(), handle_udp_service(), handle_union_p2p_demand(), handle_union_p2p_done(), handle_union_p2p_elements(), handle_union_p2p_full_done(), handle_union_p2p_full_element(), handle_union_p2p_ibf(), handle_union_p2p_inquiry(), handle_union_p2p_offer(), handle_union_p2p_request_full(), handle_union_p2p_strata_estimator(), and ping_handler().

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

◆ GC_u2h()

const struct GNUNET_HashCode* GC_u2h ( uint32_t  port)

Transitional function to convert an unsigned int port to a hash value.

WARNING: local static value returned, NOT reentrant! WARNING: do not use this function for new code!

Parameters
portNumerical port (unsigned int format).
Returns
A GNUNET_HashCode usable for the new CADET API.

Definition at line 44 of file cadet_api_helper.c.

45 {
46  static struct GNUNET_HashCode hash;
47 
49  "This is a transitional function, use proper crypto hashes as CADET ports\n");
51  sizeof(port),
52  &hash);
53  return &hash;
54 }
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition: crypto_hash.c:41
@ GNUNET_ERROR_TYPE_WARNING
A 512-bit hashcode.

References GNUNET_CRYPTO_hash(), GNUNET_ERROR_TYPE_WARNING, GNUNET_log, and port.

Referenced by start_test(), and warmup().

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

◆ GNUNET_CADET_channel_get_info()

const union GNUNET_CADET_ChannelInfo* GNUNET_CADET_channel_get_info ( struct GNUNET_CADET_Channel channel,
enum GNUNET_CADET_ChannelInfoOption  option,
  ... 
)

Get information about a channel.

Parameters
channelChannel handle.
optionQuery (GNUNET_CADET_OPTION_*)
...dependent on option, currently not used
Returns
Union with an answer to the query.

Definition at line 850 of file cadet_api.c.

853 {
854  switch (option)
855  {
857  return (const union GNUNET_CADET_ChannelInfo *) &channel->peer;
858 
859  default:
860  GNUNET_break (0);
861  return NULL;
862  }
863 }
Union to retrieve info about a channel.

References GNUNET_break, GNUNET_CADET_OPTION_PEER, and GNUNET_CADET_Channel::peer.

◆ GNUNET_CADET_get_channel()

struct GNUNET_CADET_ChannelMonitor* GNUNET_CADET_get_channel ( const struct GNUNET_CONFIGURATION_Handle cfg,
struct GNUNET_PeerIdentity peer,
GNUNET_CADET_ChannelCB  callback,
void *  callback_cls 
)

Request information about channels to peer from the local peer.

Parameters
cfgconfiguration to use
peerID of the other end of the channel.
callbackFunction to call with the requested data.
callback_clsClosure for callback.

Request information about channels to peer from the local peer.

Parameters
cfgconfiguration to use
peerID of the other end of the channel.
callbackFunction to call with the requested data.
callback_clsClosure for callback.
Returns
NULL on error

Definition at line 213 of file cadet_api_get_channel.c.

217 {
218  struct GNUNET_CADET_ChannelMonitor *cm;
219 
220  if (NULL == callback)
221  {
222  GNUNET_break (0);
223  return NULL;
224  }
226  cm->channel_cb = callback;
227  cm->channel_cb_cls = callback_cls;
228  cm->cfg = cfg;
229  cm->peer = *peer;
230  reconnect (cm);
231  if (NULL == cm->mq)
232  {
233  GNUNET_free (cm);
234  return NULL;
235  }
236  return cm;
237 }
static void reconnect(void *cls)
Reconnect to the service and try again.
struct GNUNET_PeerIdentity peer
Peer we want information about.
void * channel_cb_cls
Info callback closure for channel_cb.
GNUNET_CADET_ChannelCB channel_cb
Channel callback.
struct GNUNET_MQ_Handle * mq
Message queue to talk to CADET service.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we use.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.

References cfg, GNUNET_CADET_ChannelMonitor::cfg, GNUNET_CADET_ChannelMonitor::channel_cb, GNUNET_CADET_ChannelMonitor::channel_cb_cls, GNUNET_break, GNUNET_free, GNUNET_new, GNUNET_CADET_ChannelMonitor::mq, GNUNET_CADET_ChannelMonitor::peer, peer, and reconnect().

Here is the call graph for this function:

◆ GNUNET_CADET_get_channel_cancel()

void* GNUNET_CADET_get_channel_cancel ( struct GNUNET_CADET_ChannelMonitor cm)

Cancel a channel monitor request.

The callback will not be called (anymore).

Parameters
hCadet handle.
Returns
Closure that was given to GNUNET_CADET_get_channel().

Definition at line 247 of file cadet_api_get_channel.c.

248 {
249  void *ret = cm->channel_cb_cls;
250 
251  if (NULL != cm->mq)
252  GNUNET_MQ_destroy (cm->mq);
253  if (NULL != cm->reconnect_task)
255  GNUNET_free (cm);
256  return ret;
257 }
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
struct GNUNET_SCHEDULER_Task * reconnect_task
Task to reconnect.

References GNUNET_CADET_ChannelMonitor::channel_cb_cls, GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), GNUNET_CADET_ChannelMonitor::mq, GNUNET_CADET_ChannelMonitor::reconnect_task, and ret.

Referenced by handle_channel_info(), and handle_channel_info_end().

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

◆ GNUNET_CADET_list_peers()

struct GNUNET_CADET_PeersLister* GNUNET_CADET_list_peers ( const struct GNUNET_CONFIGURATION_Handle cfg,
GNUNET_CADET_PeersCB  callback,
void *  callback_cls 
)

Request information about peers known to the running cadet service.

The callback will be called for every peer known to the service. Only one info request (of any kind) can be active at once.

Parameters
cfgconfiguration to use
callbackFunction to call with the requested data.
callback_clsClosure for callback.
Returns
NULL on error

Definition at line 193 of file cadet_api_list_peers.c.

196 {
197  struct GNUNET_CADET_PeersLister *pl;
198 
199  if (NULL == callback)
200  {
201  GNUNET_break (0);
202  return NULL;
203  }
204  pl = GNUNET_new (struct GNUNET_CADET_PeersLister);
205  pl->peers_cb = callback;
206  pl->peers_cb_cls = callback_cls;
207  pl->cfg = cfg;
208  reconnect (pl);
209  if (NULL == pl->mq)
210  {
211  GNUNET_free (pl);
212  return NULL;
213  }
214  return pl;
215 }
static void reconnect(void *cls)
Reconnect to the service and try again.
void * peers_cb_cls
Info callback closure for info_cb.
struct GNUNET_MQ_Handle * mq
Message queue to talk to CADET service.
GNUNET_CADET_PeersCB peers_cb
Monitor callback.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we use.

References cfg, GNUNET_CADET_PeersLister::cfg, GNUNET_break, GNUNET_free, GNUNET_new, GNUNET_CADET_PeersLister::mq, GNUNET_CADET_PeersLister::peers_cb, GNUNET_CADET_PeersLister::peers_cb_cls, and reconnect().

Referenced by get_peers().

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

◆ GNUNET_CADET_list_peers_cancel()

void* GNUNET_CADET_list_peers_cancel ( struct GNUNET_CADET_PeersLister pl)

Cancel a peer info request.

The callback will not be called (anymore).

Parameters
ploperation handle
Returns
Closure that was given to GNUNET_CADET_list_peers().

The callback will not be called (anymore).

Parameters
ploperation handle
Returns
Closure given to GNUNET_CADET_get_peers().

Definition at line 225 of file cadet_api_list_peers.c.

226 {
227  void *ret = pl->peers_cb_cls;
228 
229  if (NULL != pl->mq)
230  GNUNET_MQ_destroy (pl->mq);
231  if (NULL != pl->reconnect_task)
233  GNUNET_free (pl);
234  return ret;
235 }
struct GNUNET_SCHEDULER_Task * reconnect_task
Task to reconnect.

References GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), GNUNET_CADET_PeersLister::mq, GNUNET_CADET_PeersLister::peers_cb_cls, GNUNET_CADET_PeersLister::reconnect_task, and ret.

Referenced by handle_get_peers_end(), and shutdown_task().

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

◆ GNUNET_CADET_get_path()

struct GNUNET_CADET_GetPath* GNUNET_CADET_get_path ( const struct GNUNET_CONFIGURATION_Handle cfg,
const struct GNUNET_PeerIdentity id,
GNUNET_CADET_PathCB  callback,
void *  callback_cls 
)

Request information about a peer known to the running cadet peer.

Parameters
cfgconfiguration to use
idPeer whose paths we want to examine.
callbackFunction to call with the requested data.
callback_clsClosure for callback.
Returns
NULL on error

Definition at line 220 of file cadet_api_get_path.c.

224 {
225  struct GNUNET_CADET_GetPath *gp;
226 
227  if (NULL == callback)
228  {
229  GNUNET_break (0);
230  return NULL;
231  }
232  gp = GNUNET_new (struct GNUNET_CADET_GetPath);
233  gp->path_cb = callback;
234  gp->path_cb_cls = callback_cls;
235  gp->cfg = cfg;
236  gp->id = *id;
237  reconnect (gp);
238  if (NULL == gp->mq)
239  {
240  GNUNET_free (gp);
241  return NULL;
242  }
243  return gp;
244 }
static void reconnect(void *cls)
Reconnect to the service and try again.
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
Operation handle.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we use.
GNUNET_CADET_PathCB path_cb
Monitor callback.
struct GNUNET_MQ_Handle * mq
Message queue to talk to CADET service.
void * path_cb_cls
Closure for path_cb.
struct GNUNET_PeerIdentity id
Peer we want information about.

References cfg, GNUNET_CADET_GetPath::cfg, GNUNET_break, GNUNET_free, GNUNET_new, GNUNET_CADET_GetPath::id, id, GNUNET_CADET_GetPath::mq, GNUNET_CADET_GetPath::path_cb, GNUNET_CADET_GetPath::path_cb_cls, and reconnect().

Referenced by show_peer().

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

◆ GNUNET_CADET_get_path_cancel()

void* GNUNET_CADET_get_path_cancel ( struct GNUNET_CADET_GetPath gp)

Cancel gp operation.

Parameters
gpoperation to cancel
Returns
closure from GNUNET_CADET_get_path().

Definition at line 254 of file cadet_api_get_path.c.

255 {
256  void *ret = gp->path_cb_cls;
257 
258  if (NULL != gp->mq)
259  GNUNET_MQ_destroy (gp->mq);
260  if (NULL != gp->reconnect_task)
262  GNUNET_free (gp);
263  return ret;
264 }
struct GNUNET_SCHEDULER_Task * reconnect_task
Task to reconnect.

References GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), GNUNET_CADET_GetPath::mq, GNUNET_CADET_GetPath::path_cb_cls, GNUNET_CADET_GetPath::reconnect_task, and ret.

Referenced by handle_get_path_end(), and shutdown_task().

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

◆ GNUNET_CADET_list_tunnels()

struct GNUNET_CADET_ListTunnels* GNUNET_CADET_list_tunnels ( const struct GNUNET_CONFIGURATION_Handle cfg,
GNUNET_CADET_TunnelsCB  callback,
void *  callback_cls 
)

Request information about tunnels of the running cadet peer.

The callback will be called for every tunnel of the service. Only one info request (of any kind) can be active at once.

Parameters
cfgconfiguration to use
callbackFunction to call with the requested data.
callback_clsClosure for callback.
Returns
NULL on error

Definition at line 194 of file cadet_api_list_tunnels.c.

197 {
198  struct GNUNET_CADET_ListTunnels *lt;
199 
200  if (NULL == callback)
201  {
202  GNUNET_break (0);
203  return NULL;
204  }
205  lt = GNUNET_new (struct GNUNET_CADET_ListTunnels);
206  lt->tunnels_cb = callback;
207  lt->tunnels_cb_cls = callback_cls;
208  lt->cfg = cfg;
209  reconnect (lt);
210  if (NULL == lt->mq)
211  {
212  GNUNET_free (lt);
213  return NULL;
214  }
215  return lt;
216 }
static void reconnect(void *cls)
Reconnect to the service and try again.
struct GNUNET_MQ_Handle * mq
Message queue to talk to CADET service.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we use.
void * tunnels_cb_cls
Info callback closure for tunnels_cb.
GNUNET_CADET_TunnelsCB tunnels_cb
Monitor callback.

References cfg, GNUNET_CADET_ListTunnels::cfg, GNUNET_break, GNUNET_free, GNUNET_new, GNUNET_CADET_ListTunnels::mq, reconnect(), GNUNET_CADET_ListTunnels::tunnels_cb, and GNUNET_CADET_ListTunnels::tunnels_cb_cls.

Referenced by get_tunnels().

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

◆ GNUNET_CADET_list_tunnels_cancel()

void* GNUNET_CADET_list_tunnels_cancel ( struct GNUNET_CADET_ListTunnels lt)

Cancel a monitor request.

The monitor callback will not be called.

Parameters
ltoperation handle
Returns
Closure given to GNUNET_CADET_list_tunnels(), if any.

The monitor callback will not be called.

Parameters
ltoperation handle
Returns
Closure given to GNUNET_CADET_list_tunnels().

Definition at line 226 of file cadet_api_list_tunnels.c.

227 {
228  void *ret = lt->tunnels_cb_cls;
229 
230  if (NULL != lt->mq)
231  GNUNET_MQ_destroy (lt->mq);
232  if (NULL != lt->reconnect_task)
234  GNUNET_free (lt);
235  return ret;
236 }
struct GNUNET_SCHEDULER_Task * reconnect_task
Task to reconnect.

References GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), GNUNET_CADET_ListTunnels::mq, GNUNET_CADET_ListTunnels::reconnect_task, ret, and GNUNET_CADET_ListTunnels::tunnels_cb_cls.

Referenced by handle_get_tunnels_end(), and shutdown_task().

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