GNUnet 0.21.1
cadet.h File Reference
#include <stdint.h>
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_core_service.h"
#include "gnunet_cadet_service.h"
#include "gnunet_protocols.h"
Include dependency graph for cadet.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GNUNET_CADET_ClientChannelNumber
 Number uniquely identifying a channel of a client. More...
 
struct  GNUNET_CADET_Channel
 Opaque handle to a channel. More...
 
struct  GNUNET_CADET_PortMessage
 Message for a client to create and destroy channels. More...
 
struct  GNUNET_CADET_LocalChannelCreateMessage
 Message for a client to create channels. More...
 
struct  GNUNET_CADET_LocalChannelDestroyMessage
 Message for or to a client to destroy tunnel. More...
 
struct  GNUNET_CADET_LocalData
 Message for cadet data traffic. More...
 
struct  GNUNET_CADET_LocalAck
 Message to allow the client send more data to the service (always service -> client). More...
 
struct  GNUNET_CADET_LocalInfo
 Message to inform the client about channels in the service. More...
 
struct  GNUNET_CADET_RequestDropCadetMessage
 Message to drop another message of specific type. More...
 
struct  GNUNET_CADET_RequestPathInfoMessage
 Message to inform the client about channels in the service. More...
 
struct  GNUNET_CADET_ChannelInfoMessage
 Message to inform the client about channels in the service. More...
 
struct  GNUNET_CADET_RequestChannelInfoMessage
 Message to as the service about information on a channel. More...
 
struct  GNUNET_CADET_LocalInfoPath
 Message to inform the client about one of the paths known to the service. More...
 
struct  GNUNET_CADET_LocalInfoPeers
 Message to inform the client about one of the peers in the service. More...
 
struct  GNUNET_CADET_LocalInfoTunnel
 Message to inform the client about one of the tunnels in the service. More...
 

Macros

#define CADET_TIMING_START
 
#define CADET_TIMING_END
 
#define GNUNET_CADET_LOCAL_CHANNEL_ID_CLI   0x80000000U
 Minimum value for channel IDs of local clients. More...
 
#define HIGH_PID   0xFF000000
 FIXME. More...
 
#define LOW_PID   0x00FFFFFF
 FIXME. More...
 
#define PID_OVERFLOW(pid, max)   (((pid) > HIGH_PID) && ((max) < LOW_PID))
 Test if the two PIDs (of type uint32_t) are in the range where we have to worry about overflows. More...
 

Functions

GNUNET_NETWORK_STRUCT_END char * GC_f2s (int fwd)
 Translate a fwd variable into a string representation, for logging. More...
 
int GC_is_pid_bigger (uint32_t bigger, uint32_t smaller)
 Check if one pid is bigger than other, accounting for overflow. More...
 
uint32_t GC_max_pid (uint32_t a, uint32_t b)
 Get the higher ACK value out of two values, taking in account overflow. More...
 
uint32_t GC_min_pid (uint32_t a, uint32_t b)
 Get the lower ACK value out of two values, taking in account overflow. More...
 
size_t GC_bin2s (void *bin, unsigned int len, char **output)
 Allocate a string with a hexdump of any binary data. More...
 
const char * GC_m2s (uint16_t m)
 Convert a message type into a string to help debug Generated with: FIND: "#define ([^ ]+)[ ]*([0-9]+)" REPLACE: " case \2: return "\1"; break;". More...
 

Detailed Description

Author
Bartlomiej Polot

Definition in file cadet.h.

Macro Definition Documentation

◆ CADET_TIMING_START

#define CADET_TIMING_START
Value:
struct GNUNET_TIME_Absolute __timestamp; \
__timestamp = GNUNET_TIME_absolute_get ()
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:111
Time for absolute times used by GNUnet, in microseconds.

Definition at line 39 of file cadet.h.

◆ CADET_TIMING_END

#define CADET_TIMING_END
Value:
struct GNUNET_TIME_Relative __duration; \
__duration = GNUNET_TIME_absolute_get_duration (__timestamp); \
" %s duration %s\n", \
__FUNCTION__, \
@ GNUNET_YES
@ GNUNET_ERROR_TYPE_INFO
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_duration(struct GNUNET_TIME_Absolute whence)
Get the duration of an operation as the difference of the current time and the given start time "henc...
Definition: time.c:436
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
Definition: strings.c:570
Time for relative time used by GNUnet, in microseconds.

Definition at line 43 of file cadet.h.

◆ GNUNET_CADET_LOCAL_CHANNEL_ID_CLI

#define GNUNET_CADET_LOCAL_CHANNEL_ID_CLI   0x80000000U

Minimum value for channel IDs of local clients.

Definition at line 70 of file cadet.h.

◆ HIGH_PID

#define HIGH_PID   0xFF000000

FIXME.

Definition at line 75 of file cadet.h.

◆ LOW_PID

#define LOW_PID   0x00FFFFFF

FIXME.

Definition at line 80 of file cadet.h.

◆ PID_OVERFLOW

#define PID_OVERFLOW (   pid,
  max 
)    (((pid) > HIGH_PID) && ((max) < LOW_PID))

Test if the two PIDs (of type uint32_t) are in the range where we have to worry about overflows.

This is the case when pid is large and max is small, useful when comparing pid smaller than max.

Definition at line 89 of file cadet.h.

Function Documentation

◆ GC_f2s()

GNUNET_NETWORK_STRUCT_END char * GC_f2s ( int  fwd)

Translate a fwd variable into a string representation, for logging.

Parameters
fwdIs FWD? (GNUNET_YES or GNUNET_NO)
Returns
String representing FWD or BCK.

◆ GC_is_pid_bigger()

int GC_is_pid_bigger ( uint32_t  bigger,
uint32_t  smaller 
)

Check if one pid is bigger than other, accounting for overflow.

Parameters
biggerArgument that should be bigger.
smallerArgument that should be smaller.
Returns
True if bigger (arg1) has a higher value than smaller (arg 2).

◆ GC_max_pid()

uint32_t GC_max_pid ( uint32_t  a,
uint32_t  b 
)

Get the higher ACK value out of two values, taking in account overflow.

Parameters
aFirst ACK value.
bSecond ACK value.
Returns
Highest ACK value from the two.

◆ GC_min_pid()

uint32_t GC_min_pid ( uint32_t  a,
uint32_t  b 
)

Get the lower ACK value out of two values, taking in account overflow.

Parameters
aFirst ACK value.
bSecond ACK value.
Returns
Lowest ACK value from the two.

◆ GC_bin2s()

size_t GC_bin2s ( void *  bin,
unsigned int  len,
char **  output 
)

Allocate a string with a hexdump of any binary data.

Parameters
binArbitrary binary data.
lenLength of bin in bytes.
outputWhere to write the output (if *output be NULL it's allocated).
Returns
The size of the output.

◆ GC_m2s()

const char * GC_m2s ( uint16_t  m)

Convert a message type into a string to help debug Generated with: FIND: "#define ([^ ]+)[ ]*([0-9]+)" REPLACE: " case \2: return "\1"; break;".

Parameters
mMessage type.
Returns
Human readable string description.