GNUnet  0.19.4
Transport Next Generation service

Low-level communication with other peers. More...

Collaboration diagram for Transport Next Generation service:

Data Structures

struct  GNUNET_TRANSPORT_MonitorInformation
 Information about another peer's address. More...
 

Macros

#define GNUNET_TRANSPORT_COMMUNICATION_VERSION   0x00000000
 Version number of the transport communication API. More...
 
#define GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED   UINT64_MAX
 Queue length. More...
 
#define GNUNET_TRANSPORT_CORE_VERSION   0x00000000
 Version number of the transport API. More...
 
#define GNUNET_TRANSPORT_MONITOR_VERSION   0x00000000
 Version number of the transport API. More...
 

Typedefs

typedef int(* GNUNET_TRANSPORT_CommunicatorMqInit) (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
 Function called by the transport service to initialize a message queue given address information about another peer. More...
 
typedef void(* GNUNET_TRANSPORT_CommunicatorNotify) (void *cls, const struct GNUNET_PeerIdentity *sender, const struct GNUNET_MessageHeader *msg)
 Function called when the transport service has received a backchannel message for this communicator (!) via a different return path. More...
 
typedef void(* GNUNET_TRANSPORT_MessageCompletedCallback) (void *cls, int success)
 Function called to notify communicator that we have received and processed the message. More...
 
typedef void *(* GNUNET_TRANSPORT_NotifyConnect) (void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq)
 Function called to notify transport users that another peer connected to us. More...
 
typedef void(* GNUNET_TRANSPORT_NotifyDisconnect) (void *cls, const struct GNUNET_PeerIdentity *peer, void *handler_cls)
 Function called to notify transport users that another peer disconnected from us. More...
 
typedef void(* GNUNET_TRANSPORT_MonitorCallback) (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_TRANSPORT_MonitorInformation *mi)
 Function to call with information about a peer. More...
 

Enumerations

enum  GNUNET_TRANSPORT_CommunicatorCharacteristics { GNUNET_TRANSPORT_CC_UNKNOWN = 0 , GNUNET_TRANSPORT_CC_RELIABLE = 1 , GNUNET_TRANSPORT_CC_UNRELIABLE = 2 }
 What characteristics does this communicator have? More...
 
enum  GNUNET_TRANSPORT_ConnectionStatus { GNUNET_TRANSPORT_CS_DOWN = -1 , GNUNET_TRANSPORT_CS_OUTBOUND = 0 , GNUNET_TRANSPORT_CS_INBOUND = 1 }
 Possible states of a connection. More...
 

Functions

struct GNUNET_TRANSPORT_ApplicationHandleGNUNET_TRANSPORT_application_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
 Initialize the TRANSPORT application client handle. More...
 
void GNUNET_TRANSPORT_application_done (struct GNUNET_TRANSPORT_ApplicationHandle *ch)
 Shutdown TRANSPORT application client. More...
 
struct GNUNET_TRANSPORT_ApplicationSuggestHandleGNUNET_TRANSPORT_application_suggest (struct GNUNET_TRANSPORT_ApplicationHandle *ch, const struct GNUNET_PeerIdentity *peer, enum GNUNET_MQ_PriorityPreferences pk, struct GNUNET_BANDWIDTH_Value32NBO bw)
 An application would like TRANSPORT to connect to a peer. More...
 
void GNUNET_TRANSPORT_application_suggest_cancel (struct GNUNET_TRANSPORT_ApplicationSuggestHandle *sh)
 We no longer care about being connected to a peer. More...
 
void GNUNET_TRANSPORT_application_validate (struct GNUNET_TRANSPORT_ApplicationHandle *ch, const struct GNUNET_PeerIdentity *peer, enum GNUNET_NetworkType nt, const char *addr)
 An application (or a communicator) has received a HELLO (or other address data of another peer) and wants TRANSPORT to validate that the address is correct. More...
 
struct GNUNET_TRANSPORT_CommunicatorHandleGNUNET_TRANSPORT_communicator_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *config_section_name, const char *addr_prefix, enum GNUNET_TRANSPORT_CommunicatorCharacteristics cc, GNUNET_TRANSPORT_CommunicatorMqInit mq_init, void *mq_init_cls, GNUNET_TRANSPORT_CommunicatorNotify notify_cb, void *notify_cb_cls)
 Connect to the transport service. More...
 
void GNUNET_TRANSPORT_communicator_disconnect (struct GNUNET_TRANSPORT_CommunicatorHandle *ch)
 Disconnect from the transport service. More...
 
int GNUNET_TRANSPORT_communicator_receive (struct GNUNET_TRANSPORT_CommunicatorHandle *handle, const struct GNUNET_PeerIdentity *sender, const struct GNUNET_MessageHeader *msg, struct GNUNET_TIME_Relative expected_addr_validity, GNUNET_TRANSPORT_MessageCompletedCallback cb, void *cb_cls)
 Notify transport service that the communicator has received a message. More...
 
struct GNUNET_TRANSPORT_QueueHandleGNUNET_TRANSPORT_communicator_mq_add (struct GNUNET_TRANSPORT_CommunicatorHandle *ch, const struct GNUNET_PeerIdentity *peer, const char *address, uint32_t mtu, uint64_t q_len, uint32_t priority, enum GNUNET_NetworkType nt, enum GNUNET_TRANSPORT_ConnectionStatus cs, struct GNUNET_MQ_Handle *mq)
 Notify transport service that a MQ became available due to an "inbound" connection or because the communicator discovered the presence of another peer. More...
 
void GNUNET_TRANSPORT_communicator_mq_update (struct GNUNET_TRANSPORT_CommunicatorHandle *ch, const struct GNUNET_TRANSPORT_QueueHandle *u_qh, uint64_t q_len, uint32_t priority)
 Notify transport service that an MQ was updated. More...
 
void GNUNET_TRANSPORT_communicator_mq_del (struct GNUNET_TRANSPORT_QueueHandle *qh)
 Notify transport service that an MQ became unavailable due to a disconnect or timeout. More...
 
struct GNUNET_TRANSPORT_AddressIdentifierGNUNET_TRANSPORT_communicator_address_add (struct GNUNET_TRANSPORT_CommunicatorHandle *ch, const char *address, enum GNUNET_NetworkType nt, struct GNUNET_TIME_Relative expiration)
 Notify transport service about an address that this communicator provides for this peer. More...
 
void GNUNET_TRANSPORT_communicator_address_remove (struct GNUNET_TRANSPORT_AddressIdentifier *ai)
 Notify transport service about an address that this communicator no longer provides for this peer. More...
 
void GNUNET_TRANSPORT_communicator_address_remove_all (struct GNUNET_TRANSPORT_CommunicatorHandle *ch)
 Notify transport service that this communicator no longer provides all its addresses for this peer. More...
 
void GNUNET_TRANSPORT_communicator_notify (struct GNUNET_TRANSPORT_CommunicatorHandle *ch, const struct GNUNET_PeerIdentity *pid, const char *comm, const struct GNUNET_MessageHeader *header)
 The communicator asks the transport service to route a message via a different path to another communicator service at another peer. More...
 
struct GNUNET_TRANSPORT_CoreHandleGNUNET_TRANSPORT_core_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_PeerIdentity *self, const struct GNUNET_MQ_MessageHandler *handlers, void *cls, GNUNET_TRANSPORT_NotifyConnect nc, GNUNET_TRANSPORT_NotifyDisconnect nd)
 Connect to the transport service. More...
 
void GNUNET_TRANSPORT_core_disconnect (struct GNUNET_TRANSPORT_CoreHandle *handle)
 Disconnect from the transport service. More...
 
struct GNUNET_TRANSPORT_MonitorContextGNUNET_TRANSPORT_monitor (const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_PeerIdentity *peer, int one_shot, GNUNET_TRANSPORT_MonitorCallback cb, void *cb_cls)
 Return information about a specific peer or all peers currently known to transport service once or in monitoring mode. More...
 
void GNUNET_TRANSPORT_monitor_cancel (struct GNUNET_TRANSPORT_MonitorContext *mc)
 Cancel request to monitor peers. More...
 

Detailed Description

Low-level communication with other peers.

Communication with other peers.

See also
Documentation

Macro Definition Documentation

◆ GNUNET_TRANSPORT_COMMUNICATION_VERSION

#define GNUNET_TRANSPORT_COMMUNICATION_VERSION   0x00000000

Version number of the transport communication API.

Definition at line 55 of file gnunet_transport_communication_service.h.

◆ GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED

#define GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED   UINT64_MAX

Queue length.

Definition at line 60 of file gnunet_transport_communication_service.h.

◆ GNUNET_TRANSPORT_CORE_VERSION

#define GNUNET_TRANSPORT_CORE_VERSION   0x00000000

Version number of the transport API.

Definition at line 52 of file gnunet_transport_core_service.h.

◆ GNUNET_TRANSPORT_MONITOR_VERSION

#define GNUNET_TRANSPORT_MONITOR_VERSION   0x00000000

Version number of the transport API.

Definition at line 57 of file gnunet_transport_monitor_service.h.

Typedef Documentation

◆ GNUNET_TRANSPORT_CommunicatorMqInit

typedef int(* GNUNET_TRANSPORT_CommunicatorMqInit) (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)

Function called by the transport service to initialize a message queue given address information about another peer.

If and when the communication channel is established, the communicator must call GNUNET_TRANSPORT_communicator_mq_add() to notify the service that the channel is now up. It is the responsibility of the communicator to manage sane retries and timeouts for any peer/address combination provided by the transport service. Timeouts and retries do not need to be signalled to the transport service.

Parameters
clsclosure
peeridentity of the other peer
addresswhere to send the message, human-readable communicator-specific format, 0-terminated, UTF-8
Returns
GNUNET_OK on success, GNUNET_SYSERR if the provided address is invalid

Definition at line 80 of file gnunet_transport_communication_service.h.

◆ GNUNET_TRANSPORT_CommunicatorNotify

typedef void(* GNUNET_TRANSPORT_CommunicatorNotify) (void *cls, const struct GNUNET_PeerIdentity *sender, const struct GNUNET_MessageHeader *msg)

Function called when the transport service has received a backchannel message for this communicator (!) via a different return path.

Typically used to receive messages of type GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_FC_LIMITS or GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_KX_CONFIRMATION as well as communicator-specific messages to assist with NAT traversal.

Parameters
clsclosure
senderwhich peer sent the notification
msgpayload

Definition at line 132 of file gnunet_transport_communication_service.h.

◆ GNUNET_TRANSPORT_MessageCompletedCallback

typedef void(* GNUNET_TRANSPORT_MessageCompletedCallback) (void *cls, int success)

Function called to notify communicator that we have received and processed the message.

Used for flow control (if supported by the communicator).

Parameters
clsclosure
successGNUNET_SYSERR on failure (try to disconnect/reset connection) GNUNET_OK on success

Definition at line 188 of file gnunet_transport_communication_service.h.

◆ GNUNET_TRANSPORT_NotifyConnect

typedef void*(* GNUNET_TRANSPORT_NotifyConnect) (void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq)

Function called to notify transport users that another peer connected to us.

Parameters
clsclosure
peerthe identity of the peer that connected; this pointer will remain valid until the disconnect, hence applications do not necessarily have to make a copy of the value if they only need it until disconnect
mqmessage queue to use to transmit to peer
Returns
closure to use in MQ handlers

Definition at line 73 of file gnunet_transport_core_service.h.

◆ GNUNET_TRANSPORT_NotifyDisconnect

typedef void(* GNUNET_TRANSPORT_NotifyDisconnect) (void *cls, const struct GNUNET_PeerIdentity *peer, void *handler_cls)

Function called to notify transport users that another peer disconnected from us.

The message queue that was given to the connect notification will be destroyed and must not be used henceforth.

Parameters
clsclosure from GNUNET_TRANSPORT_core_connect
peerthe peer that disconnected
handlers_clsclosure of the handlers, was returned from the connect notification callback

Definition at line 90 of file gnunet_transport_core_service.h.

◆ GNUNET_TRANSPORT_MonitorCallback

typedef void(* GNUNET_TRANSPORT_MonitorCallback) (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_TRANSPORT_MonitorInformation *mi)

Function to call with information about a peer.

If one_shot was set to GNUNET_YES to iterate over all peers once, a final call with NULL for peer and address will follow when done. In this case state and timeout do not contain valid values.

The GNUNET_TRANSPORT_monitor_peers_cancel() call MUST not be called from within this function!

Parameters
clsclosure
peerpeer this update is about, NULL if this is the final last callback for a iteration operation
mimonitoring data on the peer

Definition at line 128 of file gnunet_transport_monitor_service.h.

Enumeration Type Documentation

◆ GNUNET_TRANSPORT_CommunicatorCharacteristics

What characteristics does this communicator have?

FIXME: may want to distinguish bi-directional as well, should we define a bit for that? Needed in DV logic (handle_dv_learn)!

Enumerator
GNUNET_TRANSPORT_CC_UNKNOWN 

Characteristics are unknown (e.g.

DV).

GNUNET_TRANSPORT_CC_RELIABLE 

Transmission is reliabile (with ACKs), e.g.

TCP/HTTP/HTTPS.

GNUNET_TRANSPORT_CC_UNRELIABLE 

Transmission is unreliable (e.g.

UDP)

Definition at line 98 of file gnunet_transport_communication_service.h.

99 {
104 
109 
114 };
@ GNUNET_TRANSPORT_CC_RELIABLE
Transmission is reliabile (with ACKs), e.g.
@ GNUNET_TRANSPORT_CC_UNRELIABLE
Transmission is unreliable (e.g.
@ GNUNET_TRANSPORT_CC_UNKNOWN
Characteristics are unknown (e.g.

◆ GNUNET_TRANSPORT_ConnectionStatus

Possible states of a connection.

Enumerator
GNUNET_TRANSPORT_CS_DOWN 

Connection is down.

GNUNET_TRANSPORT_CS_OUTBOUND 

this is an outbound connection (transport initiated)

GNUNET_TRANSPORT_CS_INBOUND 

this is an inbound connection (communicator initiated)

Definition at line 235 of file gnunet_transport_communication_service.h.

236 {
241 
246 
251 };
@ GNUNET_TRANSPORT_CS_INBOUND
this is an inbound connection (communicator initiated)
@ GNUNET_TRANSPORT_CS_DOWN
Connection is down.
@ GNUNET_TRANSPORT_CS_OUTBOUND
this is an outbound connection (transport initiated)

Function Documentation

◆ GNUNET_TRANSPORT_application_init()

struct GNUNET_TRANSPORT_ApplicationHandle* GNUNET_TRANSPORT_application_init ( const struct GNUNET_CONFIGURATION_Handle cfg)

Initialize the TRANSPORT application client handle.

Parameters
cfgconfiguration to use
Returns
ats application handle, NULL on error

Initialize the TRANSPORT application client handle.

Parameters
cfgconfiguration to use
Returns
transport application handle, NULL on error

Definition at line 219 of file transport_api2_application.c.

221 {
223 
225  ch->cfg = cfg;
226  ch->sug_requests = GNUNET_CONTAINER_multipeermap_create (32, GNUNET_YES);
227  reconnect (ch);
228  return ch;
229 }
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static struct GNUNET_CADET_Channel * ch
Channel handle.
Definition: gnunet-cadet.c:117
struct GNUNET_CONTAINER_MultiPeerMap * GNUNET_CONTAINER_multipeermap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
@ GNUNET_YES
#define GNUNET_new(type)
Allocate a struct or union of the given type.
Handle to the TRANSPORT subsystem for application management.
static void reconnect(struct GNUNET_TRANSPORT_ApplicationHandle *ch)
Re-establish the connection to the TRANSPORT service.

References cfg, ch, GNUNET_CONTAINER_multipeermap_create(), GNUNET_new, GNUNET_YES, and reconnect().

Referenced by GNUNET_TRANSPORT_TESTING_start_peer(), run(), and start_peer_run().

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

◆ GNUNET_TRANSPORT_application_done()

void GNUNET_TRANSPORT_application_done ( struct GNUNET_TRANSPORT_ApplicationHandle ch)

Shutdown TRANSPORT application client.

Parameters
chhandle to destroy

Shutdown TRANSPORT application client.

Parameters
chhandle to release

Definition at line 257 of file transport_api2_application.c.

259 {
260  if (NULL != ch->mq)
261  {
263  ch->mq = NULL;
264  }
265  if (NULL != ch->task)
266  {
267  GNUNET_SCHEDULER_cancel (ch->task);
268  ch->task = NULL;
269  }
272  NULL);
274  GNUNET_free (ch);
275 }
void GNUNET_CONTAINER_multipeermap_destroy(struct GNUNET_CONTAINER_MultiPeerMap *map)
Destroy a hash map.
int GNUNET_CONTAINER_multipeermap_iterate(struct GNUNET_CONTAINER_MultiPeerMap *map, GNUNET_CONTAINER_PeerMapIterator 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_MQ_Handle * mq
Message Queue for the channel (which we are implementing).
Definition: cadet.h:142
static int free_sug_handle(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Function called to free all struct GNUNET_TRANSPORT_ApplicationSuggestHandles in the map.

References ch, free_sug_handle(), GNUNET_CONTAINER_multipeermap_destroy(), GNUNET_CONTAINER_multipeermap_iterate(), GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), and GNUNET_CADET_Channel::mq.

Referenced by do_shutdown(), GNUNET_TRANSPORT_TESTING_stop_peer(), and stop_peer_run().

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

◆ GNUNET_TRANSPORT_application_suggest()

struct GNUNET_TRANSPORT_ApplicationSuggestHandle* GNUNET_TRANSPORT_application_suggest ( struct GNUNET_TRANSPORT_ApplicationHandle ch,
const struct GNUNET_PeerIdentity peer,
enum GNUNET_MQ_PriorityPreferences  pk,
struct GNUNET_BANDWIDTH_Value32NBO  bw 
)

An application would like TRANSPORT to connect to a peer.

Parameters
chhandle
peeridentity of the peer we need an address for
pkwhat kind of application will the application require (can be GNUNET_MQ_PRIO_BACKGROUND, we will still try to connect)
bwdesired bandwidth, can be zero (we will still try to connect)
Returns
suggest handle, NULL if a request is already pending

Definition at line 289 of file transport_api2_application.c.

294 {
296 
298  s->ch = ch;
299  s->id = *peer;
300  s->pk = pk;
301  s->bw = bw;
303  ch->sug_requests,
304  &s->id,
305  s,
308  "Requesting TRANSPORT to suggest address for `%s'\n",
309  GNUNET_i2s (peer));
310  if (NULL == ch->mq)
311  return s;
313  return s;
314 }
struct GNUNET_IDENTITY_PrivateKey pk
Private key from command line option, or NULL.
struct GNUNET_BIO_WriteHandle * bw
handle to the file to write the load statistics to
int GNUNET_CONTAINER_multipeermap_put(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE
Allow multiple values with the same key.
@ GNUNET_OK
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
@ GNUNET_ERROR_TYPE_DEBUG
Handle for TRANSPORT address suggestion requests.
enum GNUNET_MQ_PriorityPreferences pk
What preference is being expressed?
struct GNUNET_TRANSPORT_ApplicationHandle * ch
Connecitivity handle this suggestion handle belongs to.
struct GNUNET_BANDWIDTH_Value32NBO bw
How much bandwidth does the client expect?
struct GNUNET_PeerIdentity id
ID of the peer for which address suggestion was requested.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
static int transmit_suggestion(void *cls, const struct GNUNET_PeerIdentity *peer, void *value)
Transmit request for an address suggestion.
#define LOG(kind,...)

References bw, GNUNET_TRANSPORT_ApplicationSuggestHandle::bw, ch, GNUNET_TRANSPORT_ApplicationSuggestHandle::ch, GNUNET_assert, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_multipeermap_put(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_new, GNUNET_OK, GNUNET_TRANSPORT_ApplicationSuggestHandle::id, LOG, GNUNET_CADET_Channel::mq, peer, pk, GNUNET_TRANSPORT_ApplicationSuggestHandle::pk, and transmit_suggestion().

Here is the call graph for this function:

◆ GNUNET_TRANSPORT_application_suggest_cancel()

void GNUNET_TRANSPORT_application_suggest_cancel ( struct GNUNET_TRANSPORT_ApplicationSuggestHandle sh)

We no longer care about being connected to a peer.

Parameters
shhandle to stop

Definition at line 323 of file transport_api2_application.c.

325 {
327  struct GNUNET_MQ_Envelope *ev;
328  struct ExpressPreferenceMessage *m;
329 
331  "Telling TRANSPORT we no longer care for an address for `%s'\n",
332  GNUNET_i2s (&sh->id));
333  GNUNET_assert (
334  GNUNET_OK ==
335  GNUNET_CONTAINER_multipeermap_remove (ch->sug_requests, &sh->id, sh));
336  if (NULL == ch->mq)
337  {
338  GNUNET_free (sh);
339  return;
340  }
342  m->pk = htonl ((uint32_t) sh->pk);
343  m->bw = sh->bw;
344  m->peer = sh->id;
345  GNUNET_MQ_send (ch->mq, ev);
346  GNUNET_free (sh);
347 }
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
Definition: gnunet-arm.c:104
static struct SolverHandle * sh
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multipeermap_remove(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *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:77
#define GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST_CANCEL
Type of the 'struct ExpressPreferenceMessage' send by clients to TRANSPORT to abandon bandwidth prefe...

References ch, GNUNET_assert, GNUNET_CONTAINER_multipeermap_remove(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_i2s(), GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST_CANCEL, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_OK, LOG, m, GNUNET_CADET_Channel::mq, and sh.

Here is the call graph for this function:

◆ GNUNET_TRANSPORT_application_validate()

void GNUNET_TRANSPORT_application_validate ( struct GNUNET_TRANSPORT_ApplicationHandle ch,
const struct GNUNET_PeerIdentity peer,
enum GNUNET_NetworkType  nt,
const char *  addr 
)

An application (or a communicator) has received a HELLO (or other address data of another peer) and wants TRANSPORT to validate that the address is correct.

The result is NOT returned, in fact TRANSPORT may do nothing (i.e. if it has too many active validations or recently tried this one already). If the addr validates, TRANSPORT will persist the address with PEERSTORE.

Parameters
chhandle
peeridentity of the peer we have an address for
ntnetwork type of addr (as claimed by the other peer); used by TRANSPORT to avoid trying addr's that really cannot work due to network type mismatches
addraddress to validate

Definition at line 366 of file transport_api2_application.c.

371 {
372  struct GNUNET_MQ_Envelope *ev;
373  struct RequestHelloValidationMessage *m;
374  size_t alen;
375 
376  if (NULL == ch->mq)
377  {
378  GNUNET_log (
380  "Address validation for %s:%s skipped as transport is not connected\n",
381  GNUNET_i2s (peer),
382  addr);
383  return;
384  }
385  alen = strlen (addr) + 1;
386  ev =
388  alen,
390  m->peer = *peer;
391  m->nt = htonl ((uint32_t) nt);
392  memcpy (&m[1], addr, alen);
393  GNUNET_MQ_send (ch->mq, ev);
394 }
static struct GNUNET_NAT_AUTO_Test * nt
Handle to a NAT test operation.
#define GNUNET_log(kind,...)
@ GNUNET_ERROR_TYPE_WARNING
#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
#define GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_HELLO_VALIDATION
Type of the 'struct RequestHelloValidationMessage' send by clients to TRANSPORT to trigger validation...

Referenced by connect_peers_run(), offer_hello(), and sock_read().

Here is the caller graph for this function:

◆ GNUNET_TRANSPORT_communicator_connect()

struct GNUNET_TRANSPORT_CommunicatorHandle* GNUNET_TRANSPORT_communicator_connect ( const struct GNUNET_CONFIGURATION_Handle cfg,
const char *  config_section_name,
const char *  addr_prefix,
enum GNUNET_TRANSPORT_CommunicatorCharacteristics  cc,
GNUNET_TRANSPORT_CommunicatorMqInit  mq_init,
void *  mq_init_cls,
GNUNET_TRANSPORT_CommunicatorNotify  notify_cb,
void *  notify_cb_cls 
)

Connect to the transport service.

Parameters
cfgconfiguration to use
config_section_namesection of the configuration to use for options
addr_prefixaddress prefix for addresses supported by this communicator, could be NULL for incoming-only communicators
ccwhat characteristics does the communicator have?
mq_initfunction to call to initialize a message queue given the address of another peer, can be NULL if the communicator only supports receiving messages
mq_init_clsclosure for mq_init
notify_cbfunction to pass backchannel messages to communicator
notify_cb_clsclosure for notify_cb
Returns
NULL on error

Definition at line 816 of file transport_api2_communication.c.

825 {
827 
829  ch->cfg = cfg;
830  ch->config_section = config_section;
831  ch->addr_prefix = addr_prefix;
832  ch->mq_init = mq_init;
833  ch->mq_init_cls = mq_init_cls;
834  ch->notify_cb = notify_cb;
835  ch->notify_cb_cls = notify_cb_cls;
836  ch->cc = cc;
837  reconnect (ch);
838  if (GNUNET_OK !=
841  "MAX_QUEUE_LENGTH",
842  &ch->max_queue_length))
843  ch->max_queue_length = DEFAULT_MAX_QUEUE_LENGTH;
844  if (NULL == ch->mq)
845  {
846  GNUNET_free (ch);
847  return NULL;
848  }
849  return ch;
850 }
static int mq_init(void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
Function called by the transport service to initialize a message queue given address information abou...
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
Opaque handle to the transport service for communicators.
enum GNUNET_TRANSPORT_CommunicatorCharacteristics cc
Characteristics of the communicator.
const char * addr_prefix
Address prefix to use.
GNUNET_TRANSPORT_CommunicatorNotify notify_cb
Function to call when the transport service receives messages for a communicator (i....
const char * config_section
Config section to use.
static void reconnect(struct GNUNET_TRANSPORT_CommunicatorHandle *ch)
(re)connect our communicator to the transport service
#define DEFAULT_MAX_QUEUE_LENGTH
How many messages do we keep at most in the queue to the transport service before we start to drop (d...

References GNUNET_TRANSPORT_CommunicatorHandle::addr_prefix, GNUNET_TRANSPORT_CommunicatorHandle::cc, cfg, ch, GNUNET_TRANSPORT_CommunicatorHandle::config_section, DEFAULT_MAX_QUEUE_LENGTH, GNUNET_CONFIGURATION_get_value_number(), GNUNET_free, GNUNET_new, GNUNET_OK, GNUNET_CADET_Channel::mq, mq_init(), GNUNET_TRANSPORT_CommunicatorHandle::mq_init_cls, GNUNET_TRANSPORT_CommunicatorHandle::notify_cb, GNUNET_TRANSPORT_CommunicatorHandle::notify_cb_cls, and reconnect().

Referenced by init_socket(), and run().

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

◆ GNUNET_TRANSPORT_communicator_disconnect()

void GNUNET_TRANSPORT_communicator_disconnect ( struct GNUNET_TRANSPORT_CommunicatorHandle ch)

Disconnect from the transport service.

Parameters
chhandle returned from connect

Definition at line 859 of file transport_api2_communication.c.

861 {
862  disconnect (ch);
863  while (NULL != ch->ai_head)
864  {
865  GNUNET_break (0); /* communicator forgot to remove address, warn! */
867  }
868  GNUNET_free (ch);
869 }
void GNUNET_TRANSPORT_communicator_address_remove(struct GNUNET_TRANSPORT_AddressIdentifier *ai)
Notify transport service about an address that this communicator no longer provides for this peer.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
static void disconnect(struct GNUNET_TRANSPORT_CommunicatorHandle *ch)
Disconnect from the transport service.

References ch, disconnect(), GNUNET_break, GNUNET_free, and GNUNET_TRANSPORT_communicator_address_remove().

Referenced by do_shutdown().

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

◆ GNUNET_TRANSPORT_communicator_receive()

int GNUNET_TRANSPORT_communicator_receive ( struct GNUNET_TRANSPORT_CommunicatorHandle handle,
const struct GNUNET_PeerIdentity sender,
const struct GNUNET_MessageHeader msg,
struct GNUNET_TIME_Relative  expected_addr_validity,
GNUNET_TRANSPORT_MessageCompletedCallback  cb,
void *  cb_cls 
)

Notify transport service that the communicator has received a message.

Parameters
handleconnection to transport service
senderpresumed sender of the message (details to be checked by higher layers)
msgthe message
expected_addr_validityhow long does the communicator believe it will continue to be able to receive messages from the same address on which it received this message?
cbfunction to call once handling the message is done, NULL if flow control is not supported by this communicator
cb_clsclosure for cb
Returns
GNUNET_OK if all is well, GNUNET_NO if the message was immediately dropped due to memory limitations (communicator should try to apply back pressure), GNUNET_SYSERR if the message could not be delivered because the transport service is not yet up

Definition at line 876 of file transport_api2_communication.c.

883 {
884  struct GNUNET_MQ_Envelope *env;
885  struct GNUNET_TRANSPORT_IncomingMessage *im;
886  uint16_t msize;
887 
888 
890  "communicator receive\n");
891 
892  if (NULL == ch->mq)
893  return GNUNET_SYSERR;
894  if ((NULL == cb) && (GNUNET_MQ_get_length (ch->mq) >= ch->max_queue_length))
895  {
896  GNUNET_log (
898  "Dropping message: transport is too slow, queue length %llu exceeded\n",
899  ch->max_queue_length);
900  return GNUNET_NO;
901  }
902 
903  msize = ntohs (msg->size);
904  env =
906  if (NULL == env)
907  {
908  GNUNET_break (0);
909  return GNUNET_SYSERR;
910  }
911  im->expected_address_validity =
912  GNUNET_TIME_relative_hton (expected_addr_validity);
913  im->sender = *sender;
914  // FIXME: this is expensive, would be better if we would
915  // re-design the API to allow us to create the envelope first,
916  // and then have the application fill in the body so we do
917  // not have to memcpy()
918  memcpy (&im[1], msg, msize);
919  im->fc_on = htonl (GNUNET_NO);
920  if (NULL != cb)
921  {
922  struct FlowControl *fc;
923 
924  im->fc_on = htonl (GNUNET_YES);
925  im->fc_id = ch->fc_gen++;
926  fc = GNUNET_new (struct FlowControl);
927  fc->sender = *sender;
928  fc->id = im->fc_id;
929  fc->cb = cb;
930  fc->cb_cls = cb_cls;
931  GNUNET_CONTAINER_DLL_insert (ch->fc_head, ch->fc_tail, fc);
933  "Created flow control id %" PRIu64 " for sender %s\n",
934  fc->id,
935  GNUNET_i2s (&fc->sender));
936  }
937  GNUNET_MQ_send (ch->mq, env);
938  return GNUNET_OK;
939 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
@ GNUNET_NO
@ GNUNET_SYSERR
unsigned int GNUNET_MQ_get_length(struct GNUNET_MQ_Handle *mq)
Obtain the current length of the message queue.
Definition: mq.c:293
#define GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG
inform transport about an incoming message
struct GNUNET_TIME_RelativeNBO GNUNET_TIME_relative_hton(struct GNUNET_TIME_Relative a)
Convert relative time to network byte order.
Definition: time.c:618
Information we track per packet to enable flow control.
GNUNET_TRANSPORT_MessageCompletedCallback cb
Function to call once the message was processed.
struct GNUNET_PeerIdentity sender
Which peer is this about?
uint64_t id
More-or-less unique ID for the message.
void * cb_cls
Closure for cb.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.

References FlowControl::cb, FlowControl::cb_cls, ch, env, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_i2s(), GNUNET_log, GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG, GNUNET_MQ_get_length(), GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_relative_hton(), GNUNET_YES, FlowControl::id, GNUNET_CADET_Channel::mq, msg, FlowControl::sender, and GNUNET_MessageHeader::size.

Referenced by pass_plaintext_to_core(), and select_read_cb().

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

◆ GNUNET_TRANSPORT_communicator_mq_add()

struct GNUNET_TRANSPORT_QueueHandle* GNUNET_TRANSPORT_communicator_mq_add ( struct GNUNET_TRANSPORT_CommunicatorHandle ch,
const struct GNUNET_PeerIdentity peer,
const char *  address,
uint32_t  mtu,
uint64_t  q_len,
uint32_t  priority,
enum GNUNET_NetworkType  nt,
enum GNUNET_TRANSPORT_ConnectionStatus  cs,
struct GNUNET_MQ_Handle mq 
)

Notify transport service that a MQ became available due to an "inbound" connection or because the communicator discovered the presence of another peer.

Parameters
chconnection to transport service
peerpeer with which we can now communicate
addressaddress in human-readable format, 0-terminated, UTF-8
mtumaximum message size supported by queue, 0 if sending is not supported, SIZE_MAX for no MTU
q_lennumber of messages that can be send through this queue
priorityqueue priority. Queues with highest priority should be used
ntwhich network type does the address belong to?
cswhat is the connection status of the queue?
mqmessage queue of the peer
Returns
API handle identifying the new MQ

Definition at line 946 of file transport_api2_communication.c.

956 {
957  struct GNUNET_TRANSPORT_QueueHandle *qh;
958 
959  // Do not notify the service if there is no intial capacity.
960  GNUNET_assert (0 < q_len);
961 
963  qh->ch = ch;
964  qh->peer = *peer;
965  qh->address = GNUNET_strdup (address);
966  qh->nt = nt;
967  qh->mtu = mtu;
968  qh->q_len = q_len;
969  qh->priority = priority;
970  qh->cs = cs;
971  qh->mq = mq;
972  qh->queue_id = ch->queue_gen++;
973  GNUNET_CONTAINER_DLL_insert (ch->queue_head, ch->queue_tail, qh);
974  send_add_queue (qh);
975  return qh;
976 }
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
static char * address
GNS address for this phone.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
Handle returned to identify the internal data structure the transport API has created to manage a mes...
enum GNUNET_TRANSPORT_ConnectionStatus cs
Communication status of the queue.
struct GNUNET_MQ_Handle * mq
The queue itself.
uint32_t queue_id
ID for this queue when talking to the transport service.
uint32_t mtu
Maximum transmission unit for the queue.
char * address
Address used by the communication queue.
enum GNUNET_NetworkType nt
Network type of the communication queue.
struct GNUNET_PeerIdentity peer
Which peer we can communciate with.
struct GNUNET_TRANSPORT_CommunicatorHandle * ch
Handle this queue belongs to.
static void send_add_queue(struct GNUNET_TRANSPORT_QueueHandle *qh)
Send message to the transport service about queue qh being now available.

References address, GNUNET_TRANSPORT_QueueHandle::address, ch, GNUNET_TRANSPORT_QueueHandle::ch, GNUNET_TRANSPORT_QueueHandle::cs, GNUNET_assert, GNUNET_CONTAINER_DLL_insert, GNUNET_new, GNUNET_strdup, mq, GNUNET_TRANSPORT_QueueHandle::mq, GNUNET_TRANSPORT_QueueHandle::mtu, nt, GNUNET_TRANSPORT_QueueHandle::nt, peer, GNUNET_TRANSPORT_QueueHandle::peer, GNUNET_TRANSPORT_QueueHandle::priority, GNUNET_TRANSPORT_QueueHandle::q_len, GNUNET_TRANSPORT_QueueHandle::queue_id, and send_add_queue().

Referenced by add_acks(), setup_queue(), setup_receiver_mq(), and try_handle_plaintext().

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

◆ GNUNET_TRANSPORT_communicator_mq_update()

void GNUNET_TRANSPORT_communicator_mq_update ( struct GNUNET_TRANSPORT_CommunicatorHandle ch,
const struct GNUNET_TRANSPORT_QueueHandle u_qh,
uint64_t  q_len,
uint32_t  priority 
)

Notify transport service that an MQ was updated.

Parameters
chconnection to transport service
u_qhthe queue to update
q_lennumber of messages that can be send through this queue
priorityqueue priority. Queues with highest priority should be used

Definition at line 980 of file transport_api2_communication.c.

985 {
986  struct GNUNET_TRANSPORT_QueueHandle *qh;
987 
988  for (qh = ch->queue_head; NULL != qh; qh = qh->next)
989  {
990  if (u_qh == qh)
991  break;
992  }
993  GNUNET_assert (NULL != qh);
994  qh->q_len = q_len;
995  qh->priority = priority;
996  send_update_queue (qh);
997 }
struct GNUNET_TRANSPORT_QueueHandle * next
Kept in a DLL.
static void send_update_queue(struct GNUNET_TRANSPORT_QueueHandle *qh)
Send message to the transport service about queue qh updated.

References ch, GNUNET_assert, GNUNET_TRANSPORT_QueueHandle::next, GNUNET_TRANSPORT_QueueHandle::priority, GNUNET_TRANSPORT_QueueHandle::q_len, and send_update_queue().

Referenced by add_acks().

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

◆ GNUNET_TRANSPORT_communicator_mq_del()

void GNUNET_TRANSPORT_communicator_mq_del ( struct GNUNET_TRANSPORT_QueueHandle qh)

Notify transport service that an MQ became unavailable due to a disconnect or timeout.

Parameters
qhhandle for the queue that must be invalidated

Definition at line 1007 of file transport_api2_communication.c.

1008 {
1010 
1011  send_del_queue (qh);
1012  GNUNET_CONTAINER_DLL_remove (ch->queue_head, ch->queue_tail, qh);
1013  GNUNET_MQ_destroy (qh->mq);
1014  GNUNET_free (qh->address);
1015  GNUNET_free (qh);
1016 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
static void send_del_queue(struct GNUNET_TRANSPORT_QueueHandle *qh)
Send message to the transport service about queue qh being no longer available.

References GNUNET_TRANSPORT_QueueHandle::address, ch, GNUNET_TRANSPORT_QueueHandle::ch, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_MQ_destroy(), GNUNET_TRANSPORT_QueueHandle::mq, and send_del_queue().

Referenced by queue_destroy(), and receiver_destroy().

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

◆ GNUNET_TRANSPORT_communicator_address_add()

struct GNUNET_TRANSPORT_AddressIdentifier* GNUNET_TRANSPORT_communicator_address_add ( struct GNUNET_TRANSPORT_CommunicatorHandle ch,
const char *  address,
enum GNUNET_NetworkType  nt,
struct GNUNET_TIME_Relative  expiration 
)

Notify transport service about an address that this communicator provides for this peer.

Parameters
chconnection to transport service
addressour address in human-readable format, 0-terminated, UTF-8
ntwhich network type does the address belong to?
expirationwhen does the communicator forsee this address expiring?

Definition at line 1029 of file transport_api2_communication.c.

1034 {
1036 
1038  ai->ch = ch;
1040  ai->nt = nt;
1042  ai->aid = ch->aid_gen++;
1043  GNUNET_CONTAINER_DLL_insert (ch->ai_head, ch->ai_tail, ai);
1044  send_add_address (ai);
1045  return ai;
1046 }
static char * expiration
Credential TTL.
Definition: gnunet-abd.c:96
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
Internal representation of an address a communicator is currently providing for the transport service...
struct GNUNET_TIME_Relative expiration
When does the address expire? (Expected lifetime of the address.)
enum GNUNET_NetworkType nt
Network type for the address.
uint32_t aid
Internal UUID for the address used in communication with the transport service.
struct GNUNET_TRANSPORT_CommunicatorHandle * ch
Transport handle where the address was added.
static void send_add_address(struct GNUNET_TRANSPORT_AddressIdentifier *ai)
Send message to the transport service about address ai being now available.

References address, GNUNET_TRANSPORT_AddressIdentifier::address, ai, GNUNET_TRANSPORT_AddressIdentifier::aid, ch, GNUNET_TRANSPORT_AddressIdentifier::ch, expiration, GNUNET_TRANSPORT_AddressIdentifier::expiration, GNUNET_CONTAINER_DLL_insert, GNUNET_new, GNUNET_strdup, nt, GNUNET_TRANSPORT_AddressIdentifier::nt, and send_add_address().

Referenced by nat_address_cb(), and run().

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

◆ GNUNET_TRANSPORT_communicator_address_remove()

void GNUNET_TRANSPORT_communicator_address_remove ( struct GNUNET_TRANSPORT_AddressIdentifier ai)

Notify transport service about an address that this communicator no longer provides for this peer.

Parameters
aiaddress that is no longer provided

Definition at line 1056 of file transport_api2_communication.c.

1058 {
1060 
1061  send_del_address (ai);
1062  GNUNET_CONTAINER_DLL_remove (ch->ai_head, ch->ai_tail, ai);
1063  GNUNET_free (ai->address);
1064  GNUNET_free (ai);
1065  ai = NULL;
1066 }
static void send_del_address(struct GNUNET_TRANSPORT_AddressIdentifier *ai)
Send message to the transport service about address ai being no longer available.

References GNUNET_TRANSPORT_AddressIdentifier::address, ai, ch, GNUNET_TRANSPORT_AddressIdentifier::ch, GNUNET_CONTAINER_DLL_remove, GNUNET_free, and send_del_address().

Referenced by do_shutdown(), GNUNET_TRANSPORT_communicator_address_remove_all(), GNUNET_TRANSPORT_communicator_disconnect(), and nat_address_cb().

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

◆ GNUNET_TRANSPORT_communicator_address_remove_all()

void GNUNET_TRANSPORT_communicator_address_remove_all ( struct GNUNET_TRANSPORT_CommunicatorHandle ch)

Notify transport service that this communicator no longer provides all its addresses for this peer.

Parameters
chThe communicator handle.

Definition at line 1075 of file transport_api2_communication.c.

1077 {
1078  struct GNUNET_TRANSPORT_AddressIdentifier *ai = ch->ai_head;
1079  while (NULL != ai)
1080  {
1081  struct GNUNET_TRANSPORT_AddressIdentifier *ai_next = ai->next;
1083  ai = ai_next;
1084  }
1085 }
struct GNUNET_TRANSPORT_AddressIdentifier * next
Kept in a DLL.

References ai, ch, GNUNET_TRANSPORT_communicator_address_remove(), and GNUNET_TRANSPORT_AddressIdentifier::next.

Referenced by do_shutdown().

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

◆ GNUNET_TRANSPORT_communicator_notify()

void GNUNET_TRANSPORT_communicator_notify ( struct GNUNET_TRANSPORT_CommunicatorHandle ch,
const struct GNUNET_PeerIdentity pid,
const char *  comm,
const struct GNUNET_MessageHeader header 
)

The communicator asks the transport service to route a message via a different path to another communicator service at another peer.

This must only be done for special control traffic (as there is no flow control for this API), such as acknowledgements, and generally only be done if the communicator is uni-directional (i.e. cannot send the message back itself).

While backchannel messages are signed and encrypted, communicators must protect against replay attacks when using this backchannel communication!

Parameters
chhandle of this communicator
pidpeer to send the message to
commname of the communicator to send the message to
headerheader of the message to transmit and pass via the notify-API to pid's communicator comm

Definition at line 1092 of file transport_api2_communication.c.

1097 {
1098  struct GNUNET_MQ_Envelope *env;
1099  struct GNUNET_TRANSPORT_CommunicatorBackchannel *cb;
1100  size_t slen = strlen (comm) + 1;
1101  uint16_t mlen = ntohs (header->size);
1102 
1103  GNUNET_assert (mlen + slen + sizeof(*cb) < UINT16_MAX);
1104  env =
1105  GNUNET_MQ_msg_extra (cb,
1106  slen + mlen,
1108  cb->pid = *pid;
1109  memcpy (&cb[1], header, mlen);
1110  memcpy (((char *) &cb[1]) + mlen, comm, slen);
1111  GNUNET_MQ_send (ch->mq, env);
1112 }
static struct GNUNET_PeerIdentity pid
Identity of the peer we transmit to / connect to.
#define GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL
Tell transport that it should assist with exchanging a message between communicators.

References ch, env, GNUNET_assert, GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_CADET_Channel::mq, pid, and GNUNET_MessageHeader::size.

Referenced by consider_ss_ack().

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

◆ GNUNET_TRANSPORT_core_connect()

struct GNUNET_TRANSPORT_CoreHandle* GNUNET_TRANSPORT_core_connect ( const struct GNUNET_CONFIGURATION_Handle cfg,
const struct GNUNET_PeerIdentity self,
const struct GNUNET_MQ_MessageHandler handlers,
void *  cls,
GNUNET_TRANSPORT_NotifyConnect  nc,
GNUNET_TRANSPORT_NotifyDisconnect  nd 
)

Connect to the transport service.

Note that the connection may complete (or fail) asynchronously.

Parameters
cfgconfiguration to use
selfour own identity (API should check that it matches the identity found by transport), or NULL (no check)
handlersarray of message handlers; note that the closures provided will be ignored and replaced with the respective return value from nc
handlersarray with handlers to call when we receive messages, or NULL
clsclosure for the nc, nd and neb callbacks
ncfunction to call on connect events, or NULL
ndfunction to call on disconnect events, or NULL
nebfunction to call if we have excess bandwidth to a peer, or NULL
Returns
NULL on error

Referenced by GNUNET_TRANSPORT_TESTING_restart_peer(), GNUNET_TRANSPORT_TESTING_start_peer(), GSC_KX_init(), opstart_get_handle_transport(), run(), and start_peer_run().

Here is the caller graph for this function:

◆ GNUNET_TRANSPORT_core_disconnect()

void GNUNET_TRANSPORT_core_disconnect ( struct GNUNET_TRANSPORT_CoreHandle handle)

Disconnect from the transport service.

Parameters
handlehandle returned from connect
handlehandle to the service as returned from GNUNET_TRANSPORT_core_connect()

Definition at line 912 of file transport_api_core.c.

913 {
914  LOG (GNUNET_ERROR_TYPE_DEBUG, "Transport disconnect called!\n");
915  /* this disconnects all neighbours... */
916  if (NULL == handle->reconnect_task)
918  /* and now we stop trying to connect again... */
919  if (NULL != handle->reconnect_task)
920  {
922  handle->reconnect_task = NULL;
923  }
925  handle->neighbours = NULL;
926  GNUNET_free (handle->handlers);
927  handle->handlers = NULL;
929 }
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
struct GNUNET_SCHEDULER_Task * reconnect_task
Task to reconnect to the service.
Definition: dns_api.c:81
static void disconnect_and_schedule_reconnect(struct GNUNET_TRANSPORT_CoreHandle *h)
Function that will schedule the job that will try to connect us again to the client.
#define LOG(kind,...)

References disconnect_and_schedule_reconnect(), GNUNET_CONTAINER_multipeermap_destroy(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_SCHEDULER_cancel(), handle, LOG, and GNUNET_DNS_Handle::reconnect_task.

Referenced by GNUNET_TRANSPORT_TESTING_restart_peer(), GNUNET_TRANSPORT_TESTING_stop_peer(), GSC_KX_done(), oprelease_get_handle_transport(), shutdown_task(), and stop_peer_run().

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

◆ GNUNET_TRANSPORT_monitor()

struct GNUNET_TRANSPORT_MonitorContext* GNUNET_TRANSPORT_monitor ( const struct GNUNET_CONFIGURATION_Handle cfg,
const struct GNUNET_PeerIdentity peer,
int  one_shot,
GNUNET_TRANSPORT_MonitorCallback  cb,
void *  cb_cls 
)

Return information about a specific peer or all peers currently known to transport service once or in monitoring mode.

To obtain information about a specific peer, a peer identity can be passed. To obtain information about all peers currently known to transport service, NULL can be passed as peer identity.

For each peer, the callback is called with information about the address used to communicate with this peer, the state this peer is currently in and the the current timeout for this state.

Upon completion, the GNUNET_TRANSPORT_PeerIterateCallback is called one more time with NULL. After this, the operation must no longer be explicitly canceled.

The GNUNET_TRANSPORT_monitor_peers_cancel call MUST not be called in the the peer_callback!

Parameters
cfgconfiguration to use
peera specific peer identity to obtain information for, NULL for all peers
one_shotGNUNET_YES to return the current state and then end (with NULL+NULL), GNUNET_NO to monitor peers continuously
cbfunction to call with the results
cb_clsclosure for mc

Definition at line 254 of file transport_api2_monitor.c.

259 {
261 
263  mc->cfg = cfg;
264  if (NULL != peer)
265  mc->peer = *peer;
266  mc->one_shot = one_shot;
267  mc->cb = cb;
268  mc->cb_cls = cb_cls;
269  reconnect (mc);
270  if (NULL == mc->mq)
271  {
272  GNUNET_free (mc);
273  return NULL;
274  }
275  return mc;
276 }
static struct GNUNET_TESTBED_Controller * mc
Handle to the master controller.
struct GNUNET_MQ_Handle * mq
The message queue to the controller service.
Definition: testbed_api.h:218
struct GNUNET_CONFIGURATION_Handle * cfg
The configuration to use while connecting to controller.
Definition: testbed_api.h:213
Opaque handle to the transport service for monitors.
GNUNET_TRANSPORT_MonitorCallback cb
Function to call with monitor data.
int one_shot
GNUNET_YES to return the current state and then end.
static void reconnect(struct GNUNET_TRANSPORT_MonitorContext *mc)
(re)connect our monitor to the transport service

References GNUNET_TRANSPORT_MonitorContext::cb, GNUNET_TRANSPORT_MonitorContext::cb_cls, cfg, GNUNET_TESTBED_Controller::cfg, GNUNET_free, GNUNET_new, mc, GNUNET_TESTBED_Controller::mq, GNUNET_TRANSPORT_MonitorContext::one_shot, peer, and reconnect().

Here is the call graph for this function:

◆ GNUNET_TRANSPORT_monitor_cancel()

void GNUNET_TRANSPORT_monitor_cancel ( struct GNUNET_TRANSPORT_MonitorContext mc)

Cancel request to monitor peers.

Parameters
mchandle for the request to cancel
pmchandle for the request to cancel

Definition at line 285 of file transport_api2_monitor.c.

286 {
287  disconnect (mc);
288  GNUNET_free (mc);
289 }
static void disconnect(struct GNUNET_TRANSPORT_MonitorContext *mc)
Disconnect from the transport service.

References disconnect(), GNUNET_free, and mc.

Referenced by handle_monitor_end().

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