GNUnet  0.11.x
Data Structures | Macros | Typedefs | Enumerations | Functions
gnunet_common.h File Reference

commonly used definitions; globals in this file are exempt from the rule that the module name ("common") must be part of the symbol name. More...

#include <stdlib.h>
Include dependency graph for gnunet_common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GNUNET_HashCode
 A 512-bit hashcode. More...
 
struct  GNUNET_ShortHashCode
 A 256-bit hashcode. More...
 
struct  GNUNET_Uuid
 A UUID, a 128 bit random value. More...
 
struct  GNUNET_MessageHeader
 Header for all communications. More...
 
struct  GNUNET_OperationResultMessage
 Answer from service to client about last operation. More...
 
struct  GNUNET_AsyncScopeId
 Identifier for an asynchronous execution context. More...
 
struct  GNUNET_AsyncScopeSave
 Saved async scope identifier or root scope. More...
 

Macros

#define GNUNET_UTIL_VERSION   0x000A0103
 Version of the API (for entire gnunetutil.so library). More...
 
#define GNUNET_MIN(a, b)   (((a) < (b)) ? (a) : (b))
 
#define GNUNET_MAX(a, b)   (((a) > (b)) ? (a) : (b))
 
#define GNUNET_VA_ARG_ENUM(va, X)   ((enum X) va_arg (va, int))
 wrap va_arg for enums More...
 
#define GNUNET_EXTRA_LOGGING   0
 define GNUNET_EXTRA_LOGGING if using this header outside the GNUnet source tree where gnunet_config.h is unavailable More...
 
#define GNUNET_htobe16(x)   __bswap_16 (x)
 Endian operations. More...
 
#define GNUNET_htole16(x)   (x)
 
#define GNUNET_be16toh(x)   __bswap_16 (x)
 
#define GNUNET_le16toh(x)   (x)
 
#define GNUNET_htobe32(x)   __bswap_32 (x)
 
#define GNUNET_htole32(x)   (x)
 
#define GNUNET_be32toh(x)   __bswap_32 (x)
 
#define GNUNET_le32toh(x)   (x)
 
#define GNUNET_htobe64(x)   __bswap_64 (x)
 
#define GNUNET_htole64(x)   (x)
 
#define GNUNET_be64toh(x)   __bswap_64 (x)
 
#define GNUNET_le64toh(x)   (x)
 
#define GNUNET_htobe16(x)   (x)
 Endian operations. More...
 
#define GNUNET_htole16(x)   __bswap_16 (x)
 
#define GNUNET_be16toh(x)   (x)
 
#define GNUNET_le16toh(x)   __bswap_16 (x)
 
#define GNUNET_htobe32(x)   (x)
 
#define GNUNET_htole32(x)   __bswap_32 (x)
 
#define GNUNET_be32toh(x)   (x)
 
#define GNUNET_le32toh(x)   __bswap_32 (x)
 
#define GNUNET_htobe64(x)   (x)
 
#define GNUNET_htole64(x)   __bswap_64 (x)
 
#define GNUNET_be64toh(x)   (x)
 
#define GNUNET_le64toh(x)   __bswap_64 (x)
 
#define GNUNET_NZL(l)   GNUNET_MAX (1, l)
 Macro used to avoid using 0 for the length of a variable-size array (Non-Zero-Length). More...
 
#define GNUNET_PACKED   __attribute__ ((packed))
 gcc-ism to get packed structs. More...
 
#define GNUNET_GCC_STRUCT_LAYOUT
 gcc-ism to get gcc bitfield layout when compiling with -mms-bitfields More...
 
#define GNUNET_ALIGN   __attribute__ ((aligned (8)))
 gcc-ism to force alignment; we use this to align char-arrays that may then be cast to 'struct's. More...
 
#define GNUNET_UNUSED   __attribute__ ((unused))
 gcc-ism to document unused arguments More...
 
#define GNUNET_NORETURN   __attribute__ ((noreturn))
 gcc-ism to document functions that don't return More...
 
#define GNUNET_NETWORK_STRUCT_BEGIN
 Define as empty, GNUNET_PACKED should suffice, but this won't work on W32. More...
 
#define GNUNET_NETWORK_STRUCT_END
 Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;. More...
 
#define GN_LIKELY(expr)   (expr)
 
#define GN_UNLIKELY(expr)   (expr)
 
#define GNUNET_LOG_CALL_STATUS   -1
 
#define GNUNET_log_from(kind, comp, ...)
 
#define GNUNET_log(kind, ...)
 
#define GNUNET_assert(cond)
 Use this for fatal errors that cannot be handled. More...
 
#define GNUNET_assert_at(cond, f, l)
 Use this for fatal errors that cannot be handled. More...
 
#define GNUNET_assert_from(cond, comp)
 Use this for fatal errors that cannot be handled. More...
 
#define GNUNET_static_assert(cond)   GNUNET_assert (cond)
 Assertion to be checked (if supported by C compiler) at compile time, otherwise checked at runtime and resulting in an abort() on failure. More...
 
#define GNUNET_break(cond)
 Use this for internal assertion violations that are not fatal (can be handled) but should not occur. More...
 
#define GNUNET_break_op(cond)
 Use this for assertion violations caused by other peers (i.e. More...
 
#define GNUNET_log_strerror(level, cmd)
 Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the message given by strerror(errno). More...
 
#define GNUNET_log_from_strerror(level, component, cmd)
 Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the message given by strerror(errno). More...
 
#define GNUNET_log_strerror_file(level, cmd, filename)
 Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the message given by strerror(errno). More...
 
#define GNUNET_log_from_strerror_file(level, component, cmd, filename)
 Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the message given by strerror(errno). More...
 
#define GNUNET_MAX_MALLOC_CHECKED   (1024 * 1024 * 40)
 Maximum allocation with GNUNET_malloc macro. More...
 
#define GNUNET_new(type)   (type *) GNUNET_malloc (sizeof(type))
 Allocate a struct or union of the given type. More...
 
#define GNUNET_memcmp(a, b)
 Compare memory in a and b, where both must be of the same pointer type. More...
 
#define GNUNET_memcmp_priv(a, b)
 Compare memory in a and b in constant time, suitable for private data. More...
 
#define GNUNET_is_zero(a)   GNUNET_is_zero_ (a, sizeof (*a))
 Check that memory in a is all zeros. More...
 
#define GNUNET_memcpy(dst, src, n)
 Call memcpy() but check for n being 0 first. More...
 
#define GNUNET_new_array(n, type)
 Allocate a size n array with structs or unions of the given type. More...
 
#define GNUNET_new_array_2d(n, m, type)   (type **) GNUNET_xnew_array_2d_ (n, m, sizeof(type), __FILE__, __LINE__)
 Allocate a size n times m array with structs or unions of the given type. More...
 
#define GNUNET_new_array_3d(n, m, o, type)   (type ***) GNUNET_xnew_array_3d_ (n, m, o, sizeof(type), __FILE__, __LINE__)
 Allocate a size n times m times o array with structs or unions of the given type. More...
 
#define GNUNET_malloc(size)   GNUNET_xmalloc_ (size, __FILE__, __LINE__)
 Wrapper around malloc. More...
 
#define GNUNET_memdup(buf, size)   GNUNET_xmemdup_ (buf, size, __FILE__, __LINE__)
 Allocate and initialize a block of memory. More...
 
#define GNUNET_malloc_large(size)   GNUNET_xmalloc_unchecked_ (size, __FILE__, __LINE__)
 Wrapper around malloc. More...
 
#define GNUNET_realloc(ptr, size)   GNUNET_xrealloc_ (ptr, size, __FILE__, __LINE__)
 Wrapper around realloc. More...
 
#define GNUNET_free_nz(ptr)   GNUNET_xfree_ (ptr, __FILE__, __LINE__)
 Wrapper around free. More...
 
#define GNUNET_free(ptr)
 Wrapper around free. More...
 
#define GNUNET_strdup(a)   GNUNET_xstrdup_ (a, __FILE__, __LINE__)
 Wrapper around GNUNET_xstrdup_. More...
 
#define GNUNET_strndup(a, length)   GNUNET_xstrndup_ (a, length, __FILE__, __LINE__)
 Wrapper around GNUNET_xstrndup_. More...
 
#define GNUNET_array_grow(arr, size, tsize)
 Grow a well-typed (!) array. More...
 
#define GNUNET_array_append(arr, len, element)
 Append an element to an array (growing the array by one). More...
 
#define GNUNET_array_concatenate(arr1, len1, arr2, len2)
 Append arr2 to arr1 (growing arr1 as needed). More...
 
#define __func__   "<unknown>"
 

Typedefs

typedef int(* GNUNET_FileNameCallback) (void *cls, const char *filename)
 Function called with a filename. More...
 
typedef void(* GNUNET_ContinuationCallback) (void *cls)
 Generic continuation callback. More...
 
typedef void(* GNUNET_ResultCallback) (void *cls, int64_t result_code, const void *data, uint16_t data_size)
 Function called with the result of an asynchronous operation. More...
 
typedef void(* GNUNET_Logger) (void *cls, enum GNUNET_ErrorType kind, const char *component, const char *date, const char *message)
 User-defined handler for log messages. More...
 

Enumerations

enum  GNUNET_GenericReturnValue { GNUNET_SYSERR = -1, GNUNET_NO = 0, GNUNET_OK = 1, GNUNET_YES = 1 }
 Named constants for return values. More...
 
enum  GNUNET_ErrorType {
  GNUNET_ERROR_TYPE_UNSPECIFIED = -1, GNUNET_ERROR_TYPE_NONE = 0, GNUNET_ERROR_TYPE_ERROR = 1, GNUNET_ERROR_TYPE_WARNING = 2,
  GNUNET_ERROR_TYPE_MESSAGE = 4, GNUNET_ERROR_TYPE_INFO = 8, GNUNET_ERROR_TYPE_DEBUG = 16, GNUNET_ERROR_TYPE_INVALID = 32,
  GNUNET_ERROR_TYPE_BULK = 64
}
 Types of errors. More...
 
enum  GNUNET_SCHEDULER_Priority {
  GNUNET_SCHEDULER_PRIORITY_KEEP = 0, GNUNET_SCHEDULER_PRIORITY_IDLE = 1, GNUNET_SCHEDULER_PRIORITY_BACKGROUND = 2, GNUNET_SCHEDULER_PRIORITY_DEFAULT = 3,
  GNUNET_SCHEDULER_PRIORITY_HIGH = 4, GNUNET_SCHEDULER_PRIORITY_UI = 5, GNUNET_SCHEDULER_PRIORITY_URGENT = 6, GNUNET_SCHEDULER_PRIORITY_SHUTDOWN = 7,
  GNUNET_SCHEDULER_PRIORITY_COUNT = 8
}
 Valid task priorities. More...
 

Functions

int GNUNET_get_log_skip (void)
 Get the number of log calls that are going to be skipped. More...
 
int GNUNET_get_log_call_status (int caller_level, const char *comp, const char *file, const char *function, int line)
 Decides whether a particular logging call should or should not be allowed to be made. More...
 
void GNUNET_log_nocheck (enum GNUNET_ErrorType kind, const char *message,...) __attribute__((format(printf
 Main log function. More...
 
void GNUNET_log_from_nocheck (enum GNUNET_ErrorType kind, const char *comp, const char *message,...)
 Log function that specifies an alternative component. More...
 
void GNUNET_log_config_missing (enum GNUNET_ErrorType kind, const char *section, const char *option)
 Log error message about missing configuration option. More...
 
void GNUNET_log_config_invalid (enum GNUNET_ErrorType kind, const char *section, const char *option, const char *required)
 Log error message about invalid configuration option value. More...
 
void GNUNET_abort_ (void) __attribute__((noreturn))
 Abort the process, generate a core dump if possible. More...
 
void GNUNET_log_skip (int n, int check_reset)
 Ignore the next n calls to the log function. More...
 
int GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile)
 Setup logging. More...
 
void GNUNET_logger_add (GNUNET_Logger logger, void *logger_cls)
 Add a custom logger. More...
 
void GNUNET_logger_remove (GNUNET_Logger logger, void *logger_cls)
 Remove a custom logger. More...
 
const char * GNUNET_sh2s (const struct GNUNET_ShortHashCode *shc)
 Convert a short hash value to a string (for printing debug messages). More...
 
const char * GNUNET_uuid2s (const struct GNUNET_Uuid *uuid)
 Convert a UUID to a string (for printing debug messages). More...
 
const char * GNUNET_h2s (const struct GNUNET_HashCode *hc)
 Convert a hash value to a string (for printing debug messages). More...
 
const char * GNUNET_h2s2 (const struct GNUNET_HashCode *hc)
 Convert a hash value to a string (for printing debug messages). More...
 
const char * GNUNET_h2s_full (const struct GNUNET_HashCode *hc)
 Convert a hash value to a string (for printing debug messages). More...
 
const char * GNUNET_p2s (const struct GNUNET_CRYPTO_EddsaPublicKey *p)
 Convert a public key value to a string (for printing debug messages). More...
 
const char * GNUNET_p2s2 (const struct GNUNET_CRYPTO_EddsaPublicKey *p)
 Convert a public key value to a string (for printing debug messages). More...
 
const char * GNUNET_e2s (const struct GNUNET_CRYPTO_EcdhePublicKey *p)
 Convert a public key value to a string (for printing debug messages). More...
 
const char * GNUNET_e2s2 (const struct GNUNET_CRYPTO_EcdhePublicKey *p)
 Convert a public key value to a string (for printing debug messages). More...
 
const char * GNUNET_i2s (const struct GNUNET_PeerIdentity *pid)
 Convert a peer identity to a string (for printing debug messages). More...
 
const char * GNUNET_i2s2 (const struct GNUNET_PeerIdentity *pid)
 Convert a peer identity to a string (for printing debug messages). More...
 
const char * GNUNET_i2s_full (const struct GNUNET_PeerIdentity *pid)
 Convert a peer identity to a string (for printing debug messages). More...
 
const char * GNUNET_a2s (const struct sockaddr *addr, socklen_t addrlen)
 Convert a "struct sockaddr*" (IPv4 or IPv6 address) to a string (for printing debug messages). More...
 
const char * GNUNET_error_type_to_string (enum GNUNET_ErrorType kind)
 Convert error type to string. More...
 
uint64_t GNUNET_htonll (uint64_t n)
 Convert unsigned 64-bit integer to network byte order. More...
 
uint64_t GNUNET_ntohll (uint64_t n)
 Convert unsigned 64-bit integer to host byte order. More...
 
double GNUNET_hton_double (double d)
 Convert double to network byte order. More...
 
double GNUNET_ntoh_double (double d)
 Convert double to host byte order. More...
 
int GNUNET_memcmp_ct_ (const void *b1, const void *b2, size_t len)
 Compare memory in b1 and b2 in constant time, suitable for private data. More...
 
int GNUNET_is_zero_ (const void *a, size_t n)
 Check that memory in a is all zeros. More...
 
int GNUNET_snprintf (char *buf, size_t size, const char *format,...)
 Like snprintf, just aborts if the buffer is of insufficient size. More...
 
int GNUNET_asprintf (char **buf, const char *format,...)
 Like asprintf, just portable. More...
 
void * GNUNET_xmalloc_ (size_t size, const char *filename, int linenumber)
 Allocate memory. More...
 
void ** GNUNET_xnew_array_2d_ (size_t n, size_t m, size_t elementSize, const char *filename, int linenumber)
 Allocate memory for a two dimensional array in one block and set up pointers. More...
 
void *** GNUNET_xnew_array_3d_ (size_t n, size_t m, size_t o, size_t elementSize, const char *filename, int linenumber)
 Allocate memory for a three dimensional array in one block and set up pointers. More...
 
void * GNUNET_xmemdup_ (const void *buf, size_t size, const char *filename, int linenumber)
 Allocate and initialize memory. More...
 
void * GNUNET_xmalloc_unchecked_ (size_t size, const char *filename, int linenumber)
 Allocate memory. More...
 
void * GNUNET_xrealloc_ (void *ptr, size_t n, const char *filename, int linenumber)
 Reallocate memory. More...
 
void GNUNET_xfree_ (void *ptr, const char *filename, int linenumber)
 Free memory. More...
 
char * GNUNET_xstrdup_ (const char *str, const char *filename, int linenumber)
 Dup a string. More...
 
char * GNUNET_xstrndup_ (const char *str, size_t len, const char *filename, int linenumber)
 Dup partially a string. More...
 
void GNUNET_xgrow_ (void **old, size_t elementSize, unsigned int *oldCount, unsigned int newCount, const char *filename, int linenumber)
 Grow an array, the new elements are zeroed out. More...
 
struct GNUNET_MessageHeaderGNUNET_copy_message (const struct GNUNET_MessageHeader *msg)
 Create a copy of the given message. More...
 
void GNUNET_async_scope_enter (const struct GNUNET_AsyncScopeId *aid, struct GNUNET_AsyncScopeSave *old_scope)
 Set the async scope for the current thread. More...
 
void GNUNET_async_scope_restore (struct GNUNET_AsyncScopeSave *old_scope)
 Clear the current thread's async scope. More...
 
void GNUNET_async_scope_get (struct GNUNET_AsyncScopeSave *scope_ret)
 Get the current async scope. More...
 
void GNUNET_async_scope_fresh (struct GNUNET_AsyncScopeId *aid_ret)
 Generate a fresh async scope identifier. More...
 

Detailed Description

commonly used definitions; globals in this file are exempt from the rule that the module name ("common") must be part of the symbol name.

Author
Christian Grothoff
Nils Durner
Martin Schanzenbach

Definition in file gnunet_common.h.

Macro Definition Documentation

◆ GNUNET_UTIL_VERSION

#define GNUNET_UTIL_VERSION   0x000A0103

Version of the API (for entire gnunetutil.so library).

Definition at line 74 of file gnunet_common.h.

◆ GNUNET_MIN

#define GNUNET_MIN (   a,
 
)    (((a) < (b)) ? (a) : (b))

◆ GNUNET_MAX

#define GNUNET_MAX (   a,
 
)    (((a) > (b)) ? (a) : (b))

◆ GNUNET_VA_ARG_ENUM

#define GNUNET_VA_ARG_ENUM (   va,
 
)    ((enum X) va_arg (va, int))

◆ GNUNET_htobe16 [1/2]

#define GNUNET_htobe16 (   x)    __bswap_16 (x)

Endian operations.

Definition at line 162 of file gnunet_common.h.

◆ GNUNET_htole16 [1/2]

#define GNUNET_htole16 (   x)    (x)

Definition at line 163 of file gnunet_common.h.

Referenced by get_wlan_header(), getWlanHeader(), ogg_init(), and stdin_send_hw().

◆ GNUNET_be16toh [1/2]

#define GNUNET_be16toh (   x)    __bswap_16 (x)

Definition at line 164 of file gnunet_common.h.

◆ GNUNET_le16toh [1/2]

#define GNUNET_le16toh (   x)    (x)

Definition at line 165 of file gnunet_common.h.

Referenced by ieee80211_radiotap_iterator_init(), linux_read(), and process_header().

◆ GNUNET_htobe32 [1/2]

#define GNUNET_htobe32 (   x)    __bswap_32 (x)

Definition at line 167 of file gnunet_common.h.

◆ GNUNET_htole32 [1/2]

#define GNUNET_htole32 (   x)    (x)

Definition at line 168 of file gnunet_common.h.

Referenced by ogg_init().

◆ GNUNET_be32toh [1/2]

#define GNUNET_be32toh (   x)    __bswap_32 (x)

Definition at line 169 of file gnunet_common.h.

◆ GNUNET_le32toh [1/2]

#define GNUNET_le32toh (   x)    (x)

◆ GNUNET_htobe64 [1/2]

#define GNUNET_htobe64 (   x)    __bswap_64 (x)

Definition at line 172 of file gnunet_common.h.

◆ GNUNET_htole64 [1/2]

#define GNUNET_htole64 (   x)    (x)

Definition at line 173 of file gnunet_common.h.

◆ GNUNET_be64toh [1/2]

#define GNUNET_be64toh (   x)    __bswap_64 (x)

Definition at line 174 of file gnunet_common.h.

◆ GNUNET_le64toh [1/2]

#define GNUNET_le64toh (   x)    (x)

Definition at line 175 of file gnunet_common.h.

Referenced by linux_read().

◆ GNUNET_htobe16 [2/2]

#define GNUNET_htobe16 (   x)    (x)

Endian operations.

Definition at line 162 of file gnunet_common.h.

◆ GNUNET_htole16 [2/2]

#define GNUNET_htole16 (   x)    __bswap_16 (x)

Definition at line 163 of file gnunet_common.h.

◆ GNUNET_be16toh [2/2]

#define GNUNET_be16toh (   x)    (x)

Definition at line 164 of file gnunet_common.h.

◆ GNUNET_le16toh [2/2]

#define GNUNET_le16toh (   x)    __bswap_16 (x)

Definition at line 165 of file gnunet_common.h.

◆ GNUNET_htobe32 [2/2]

#define GNUNET_htobe32 (   x)    (x)

Definition at line 167 of file gnunet_common.h.

◆ GNUNET_htole32 [2/2]

#define GNUNET_htole32 (   x)    __bswap_32 (x)

Definition at line 168 of file gnunet_common.h.

◆ GNUNET_be32toh [2/2]

#define GNUNET_be32toh (   x)    (x)

Definition at line 169 of file gnunet_common.h.

◆ GNUNET_le32toh [2/2]

#define GNUNET_le32toh (   x)    __bswap_32 (x)

Definition at line 170 of file gnunet_common.h.

◆ GNUNET_htobe64 [2/2]

#define GNUNET_htobe64 (   x)    (x)

Definition at line 172 of file gnunet_common.h.

◆ GNUNET_htole64 [2/2]

#define GNUNET_htole64 (   x)    __bswap_64 (x)

Definition at line 173 of file gnunet_common.h.

◆ GNUNET_be64toh [2/2]

#define GNUNET_be64toh (   x)    (x)

Definition at line 174 of file gnunet_common.h.

◆ GNUNET_le64toh [2/2]

#define GNUNET_le64toh (   x)    __bswap_64 (x)

Definition at line 175 of file gnunet_common.h.

◆ GNUNET_NZL

#define GNUNET_NZL (   l)    GNUNET_MAX (1, l)

Macro used to avoid using 0 for the length of a variable-size array (Non-Zero-Length).

Basically, C standard says that "int[n] x;" is undefined if n=0. This was supposed to prevent issues with pointer aliasing. However, C compilers may conclude that n!=0 as n=0 would be undefined, and then optimize under the assumption n!=0, which could cause actual issues. Hence, when initializing an array on the stack with a variable-length that might be zero, write "int[GNUNET_NZL(n)] x;" instead of "int[n] x".

Definition at line 191 of file gnunet_common.h.

◆ GNUNET_PACKED

#define GNUNET_PACKED   __attribute__ ((packed))

gcc-ism to get packed structs.

Definition at line 197 of file gnunet_common.h.

◆ GNUNET_GCC_STRUCT_LAYOUT

#define GNUNET_GCC_STRUCT_LAYOUT

gcc-ism to get gcc bitfield layout when compiling with -mms-bitfields

Definition at line 202 of file gnunet_common.h.

◆ GNUNET_ALIGN

#define GNUNET_ALIGN   __attribute__ ((aligned (8)))

◆ GNUNET_UNUSED

#define GNUNET_UNUSED   __attribute__ ((unused))

gcc-ism to document unused arguments

Definition at line 218 of file gnunet_common.h.

Referenced by decode_method(), and stun_msg2str().

◆ GNUNET_NORETURN

#define GNUNET_NORETURN   __attribute__ ((noreturn))

gcc-ism to document functions that don't return

Definition at line 223 of file gnunet_common.h.

◆ GNUNET_NETWORK_STRUCT_BEGIN

#define GNUNET_NETWORK_STRUCT_BEGIN

Define as empty, GNUNET_PACKED should suffice, but this won't work on W32.

Definition at line 228 of file gnunet_common.h.

Referenced by dns_pre_request_handler(), GNUNET_CRYPTO_rsa_public_key_free(), and uri_chk_parse().

◆ GNUNET_NETWORK_STRUCT_END

#define GNUNET_NETWORK_STRUCT_END

Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;.

Definition at line 233 of file gnunet_common.h.

Referenced by dns_pre_request_handler().

◆ GN_LIKELY

#define GN_LIKELY (   expr)    (expr)

Definition at line 468 of file gnunet_common.h.

◆ GN_UNLIKELY

#define GN_UNLIKELY (   expr)    (expr)

Definition at line 469 of file gnunet_common.h.

◆ GNUNET_LOG_CALL_STATUS

#define GNUNET_LOG_CALL_STATUS   -1

Definition at line 473 of file gnunet_common.h.

Referenced by get_nick_record().

◆ GNUNET_log_from

#define GNUNET_log_from (   kind,
  comp,
  ... 
)
Value:
do \
{ \
static int log_call_enabled = GNUNET_LOG_CALL_STATUS; \
if ((GNUNET_EXTRA_LOGGING > 0) || \
((GNUNET_ERROR_TYPE_DEBUG & (kind)) == 0)) \
{ \
if (GN_UNLIKELY (log_call_enabled == -1)) \
log_call_enabled = \
GNUNET_get_log_call_status ((kind) & (~GNUNET_ERROR_TYPE_BULK), \
(comp), \
__FILE__, \
__FUNCTION__, \
__LINE__); \
{ \
GNUNET_log_skip (-1, GNUNET_NO); \
} \
else \
{ \
if (GN_UNLIKELY (log_call_enabled)) \
GNUNET_log_from_nocheck ((kind), comp, __VA_ARGS__); \
} \
} \
} while (0)
#define GN_UNLIKELY(expr)
#define GNUNET_LOG_CALL_STATUS
#define GNUNET_EXTRA_LOGGING
define GNUNET_EXTRA_LOGGING if using this header outside the GNUnet source tree where gnunet_config...
int GNUNET_get_log_skip(void)
Get the number of log calls that are going to be skipped.

Definition at line 494 of file gnunet_common.h.

Referenced by block_plugin_dht_get_key(), create_hostkeys(), create_indices(), database_setup(), database_shutdown(), execute_get(), get_my_cnf_path(), GNUNET_MY_exec_prepared(), GNUNET_MY_extract_result(), GNUNET_NT_scanner_get_type(), GNUNET_PQ_eval_result(), GNUNET_PQ_exec_prepared(), GNUNET_PQ_exec_statements(), GNUNET_PQ_prepare_statements(), GNUNET_PQ_reconnect(), GNUNET_SQ_bind(), GNUNET_SQ_reset(), interface_proc(), libgnunet_plugin_datacache_template_init(), libgnunet_plugin_datastore_heap_init(), libgnunet_plugin_datastore_mysql_init(), libgnunet_plugin_datastore_postgres_init(), libgnunet_plugin_datastore_sqlite_done(), libgnunet_plugin_datastore_sqlite_init(), libgnunet_plugin_datastore_template_init(), namecache_sqlite_cache_block(), namecache_sqlite_expire_blocks(), namestore_flat_store_records(), namestore_postgres_store_records(), namestore_sqlite_store_records(), postgres_plugin_drop(), postgres_plugin_put(), postgres_plugin_remove_key(), pq_notice_processor_cb(), prepare_statement(), process_result(), sq_prepare(), sqlite_plugin_estimate_size(), sqlite_plugin_get_expiration(), sqlite_plugin_get_replication(), and sqlite_plugin_put().

◆ GNUNET_log

#define GNUNET_log (   kind,
  ... 
)
Value:
do \
{ \
static int log_call_enabled = GNUNET_LOG_CALL_STATUS; \
if ((GNUNET_EXTRA_LOGGING > 0) || \
((GNUNET_ERROR_TYPE_DEBUG & (kind)) == 0)) \
{ \
if (GN_UNLIKELY (log_call_enabled == -1)) \
log_call_enabled = \
GNUNET_get_log_call_status ((kind) & (~GNUNET_ERROR_TYPE_BULK), \
NULL, \
__FILE__, \
__FUNCTION__, \
__LINE__); \
{ \
GNUNET_log_skip (-1, GNUNET_NO); \
} \
else \
{ \
if (GN_UNLIKELY (log_call_enabled)) \
GNUNET_log_nocheck ((kind), __VA_ARGS__); \
} \
} \
} while (0)
#define GN_UNLIKELY(expr)
#define GNUNET_LOG_CALL_STATUS
#define GNUNET_EXTRA_LOGGING
define GNUNET_EXTRA_LOGGING if using this header outside the GNUnet source tree where gnunet_config...
int GNUNET_get_log_skip(void)
Get the number of log calls that are going to be skipped.

Definition at line 520 of file gnunet_common.h.

Referenced by __attribute__(), _GSS_operation_destroy(), _GSS_operation_destroy2(), abd_string_to_value(), accept_policy_callback(), access_handler_callback(), action_loop(), activate_core_visible_dv_path(), activate_fs_download(), add_address_to_hello(), add_address_to_uri(), add_attestation_cont(), add_attribute_cont(), add_host_to_known_hosts(), add_key_to_bloomfilter(), add_known_to_bloom(), add_plugin(), add_revocation(), add_services(), add_to_tc(), add_valid_address(), addr_cb(), adjust_running_peers(), adv_transmit(), advertise_dns_exit(), age_values(), allocate_v4_address(), allocate_v6_address(), allocation_cb(), announce_next_regex(), announce_regex(), append_port(), apply_patch(), ats_connect_completion_cb(), ats_perf_connect_adapter(), ats_performance_info_cb(), ats_request_address_change(), ats_reserve_callback(), attempt_connect(), attest_add_cb(), attest_collect(), attest_delete_cont(), attest_error(), attest_iter_cb(), attest_iter_error(), attest_iter_finished(), attest_store_cont(), attest_store_task(), attr_delete_cont(), attr_iter_cb(), attr_iter_error(), attr_iter_finished(), attr_store_cont(), attr_store_task(), audio_write(), authorize_endpoint(), auto_config_cb(), backtalker_monotime_cb(), backtalker_monotime_store_cb(), backward_resolution(), bandwidth_changed_cb(), blacklist_cfg_iter(), block_plugin_dns_evaluate(), block_proc(), broadcast_status(), build_dns_query(), bus_call(), c2i(), cache_answers(), cadet_connect_cb(), cadet_mq_error_handler(), cadet_mq_send_now(), cadet_reply_proc(), cadet_test_run(), cadet_timeout(), calculate_fork_degree(), calculate_put_interval(), call_error_handler(), callback_download(), cancel_pending_req(), cancel_pending_req_rep(), cancel_request(), cb_channel_destruction(), cb_channel_incoming(), cb_intersection_request_alice(), channel_cleaner(), channel_ended(), channel_incoming(), channel_new_cb(), check_edge(), check_feedback(), check_hello(), check_notify_client(), check_ssl_certificate(), check_statistics_collect_completed(), check_timeouts(), check_unique(), check_vl_transmission(), churn(), churn_cb(), churn_test_cb(), clean_peer(), clean_request(), clean_up(), cleaning_task(), cleanup(), cleanup_channel(), cleanup_handle(), cleanup_s5r(), cleanup_task(), client_connect_cb(), client_connect_get(), client_connect_put(), client_disconnect_cb(), client_request_complete_alice(), client_response_handler(), client_run(), client_send_response(), clients_notify_view_update(), collect_stats(), comm_connect_cb(), comm_connect_completion_cb(), comm_disconnect_cb(), comm_schedule_send(), commit_set(), communicator_start(), completed_pending_message(), compute_diversity(), compute_probabilities(), compute_scalar_product(), con_val_iter(), conclude_cb(), conn_status(), connect_adapter(), connect_bl_check_cont(), connect_cb(), connect_check_run(), connect_complete(), connect_completion_callback(), connect_handler(), connect_notify(), consider_for_advertising(), consider_gathering(), consider_sending_fc(), consider_ss_ack(), consume_cont(), consume_result_cb(), consume_ticket_cont(), context_state_callback(), continue_after_remove(), continue_store_activity(), continue_with_gns2dns(), continue_writing(), controller_status_cb(), conversation_string_to_value(), conversation_value_to_string(), cookie_identity_interpretation(), core_connect_adapter(), core_init(), cores_send_connect_info(), cores_send_disconnect_info(), create_channel_to_destination(), create_download_context(), create_download_request(), create_listen_socket(), create_loc_uri(), create_mhd_response_from_s5r(), create_response(), create_set_copy_for_task(), create_unique_cfgs(), cron_clean_data_hosts(), cron_scan_directory_data_hosts(), cummulative_ack(), curl_check_hdr(), curl_download_cb(), curl_download_prepare(), curl_task_download(), curl_upload_cb(), daemon_started(), database_setup(), database_shutdown(), datacache_get_iterator(), deactivate_fs_download(), decode_and_send(), decrypt_cb(), decrypt_conclude(), decrypt_connect_adapter(), decrypt_connect_complete(), decrypt_new_element(), decrypt_session_destroy(), default_reply_handle(), del_attr_finished(), delay_warning(), delayed_disconnect(), delayed_restart_task(), delegate_collection_finished(), delegation_chain_bw_resolution_start(), delegation_chain_fw_resolution_start(), delete_attestation_cont(), delete_attribute_cont(), delete_files(), deliver_message(), demultiplex_with_cmc(), derive_aes_key(), derive_auth_key(), derive_iv(), derive_pong_iv(), deserialize_download_file(), deserialize_file_information(), deserialize_publish_file(), deserialize_search(), deserialize_search_file(), deserialize_search_result(), deserialize_subdownload(), deserialize_unindex_file(), destroy(), destroy_channel_cb(), destroy_line_cadet_channels(), destroy_peer(), dfa_merge_nondistinguishable_states(), dht_connect_cb(), dht_connected(), dht_put_continuation(), diff_insert(), dir_ready_cb(), discard_expired(), disconnect_adapter(), disconnect_all_neighbours(), disconnect_cadet_peers(), disconnect_cb(), disconnect_neighbour(), disconnect_notify(), disk_utilization_change_cb(), dns_post_request_handler(), dns_result_parser(), dns_string_to_value(), do_abort(), do_accept(), do_announce(), do_blacklist_check(), do_comm_connect(), do_connect(), do_connect_ats(), do_connect_peers(), do_consensus(), do_decrypt(), do_delete_entry(), do_disconnect(), do_dns_read(), do_encrypt(), do_flood(), do_reconnect(), do_rekey(), do_restart_typemap_message(), do_s5r_read(), do_shutdown(), do_timeout(), do_udp_read(), do_write(), done(), download_get_url(), download_hostlist(), download_mq_error_handler(), download_prepare(), download_progress_cb(), download_timeout(), dv_setup_key_state_from_km(), dyndns_lookup(), ego_get_all(), ego_get_for_subsystem(), ego_get_response(), ego_get_subsystem(), enable(), enc_notify_cb(), encapsulate_for_dv(), encode_cont(), encrypt_existing_match(), enforce_add_address(), enforce_del_address(), enforce_start_preference(), enforce_start_property(), enforce_start_request(), enforce_stop_preference(), enforce_stop_property(), enforce_stop_request(), episode_done_cb(), error_handler(), evaluate(), evaluate_block_regex(), evaluate_dfa(), evaluate_nfa(), excess_trigger(), execute_add(), execute_delayed_mutations(), execute_remove(), execute_select(), exit_signal_callback(), experiment_done_cb(), expire_channel(), expire_records_continuation(), expired_processor(), extract_address(), extract_box_cb(), extract_port(), fail_intersection_operation(), feed_buffer_to_gst(), filter_all(), filtered_map_initialization(), find_content(), find_proof(), find_string(), find_subsystem_entry(), find_timed_out(), finish_cache_operation(), finish_release_reserve(), finish_request(), finish_reserve(), finish_response(), finish_step(), finish_task(), finished_local_operations(), fip_signal_start(), force_reconnect(), forward_dv_box(), forward_dv_learn(), forward_reply(), forward_resolution(), fragment_message(), free_channel_state(), free_destination_entry(), free_lal(), free_matching_requests(), free_neighbour(), full_recursive_download(), GAS_addresses_add(), GAS_addresses_destroy(), GAS_addresses_destroy_all(), GAS_addresses_done(), GAS_addresses_get_peer_info(), GAS_addresses_update(), GAS_handle_address_add(), GAS_handle_address_destroyed(), GAS_handle_preference_change(), GAS_handle_request_address(), GAS_handle_request_address_cancel(), GAS_handle_request_address_list(), GAS_handle_reservation_request(), GAS_plugin_init(), GAS_scheduling_add_client(), GAS_scheduling_transmit_address_suggestion(), gather_migration_blocks(), GC_u2h(), GDS_DATACACHE_handle_put(), GDS_NEIGHBOURS_handle_get(), GDS_NEIGHBOURS_handle_put(), GDS_NEIGHBOURS_handle_reply(), generate_gns_certificate(), get_app(), get_cadet(), get_delay(), get_delay_randomization(), get_existing_record(), get_idx_of_pid(), get_nick_record(), get_preference(), get_property(), get_records_and_call_iterator(), get_symbol(), get_target_peers(), get_transmit_delay(), GN_request_connection_reversal(), GNS_interceptor_init(), GNS_resolver_init(), GNS_resolver_lookup(), GNS_resolver_lookup_cancel(), gns_string_to_value(), GNUNET_ABD_delegate_deserialize(), GNUNET_ABD_delegate_from_string(), GNUNET_ABD_delegate_serialize(), GNUNET_ABE_cpabe_decrypt(), GNUNET_ATS_solver_generate_preferences_start(), GNUNET_ATS_solver_generate_preferences_stop(), GNUNET_ATS_solver_generate_property_start(), GNUNET_ATS_solver_generate_property_stop(), GNUNET_ATS_solver_logging_now(), GNUNET_ATS_solver_logging_start(), GNUNET_ATS_solver_logging_stop(), GNUNET_ATS_solver_logging_write_to_disk(), GNUNET_ATS_solvers_experimentation_load(), GNUNET_ATS_solvers_load_quotas(), GNUNET_ATS_TEST_generate_preferences_start(), GNUNET_ATS_TEST_generate_traffic_start(), GNUNET_ATS_TEST_logging_now(), GNUNET_ATS_TEST_logging_start(), GNUNET_ATS_TEST_logging_stop(), GNUNET_ATS_TEST_logging_write_to_file(), GNUNET_ATS_TEST_traffic_handle_ping(), GNUNET_ATS_TEST_traffic_handle_pong(), GNUNET_CADET_channel_create(), GNUNET_CADET_channel_destroy(), GNUNET_CADET_drop_message(), GNUNET_CADET_open_port(), GNUNET_CONTAINER_bloomfilter_load(), GNUNET_CONTAINER_multihashmap_create(), GNUNET_CRYPTO_cpabe_decrypt(), GNUNET_CRYPTO_get_peer_identity(), GNUNET_CURL_download_get_result_(), GNUNET_CURL_init(), GNUNET_DISK_directory_create(), GNUNET_DNSPARSER_builder_add_name(), GNUNET_DNSSTUB_add_dns_ip(), GNUNET_DNSSTUB_resolve(), GNUNET_FRIENDS_parse(), GNUNET_FRIENDS_write_start(), GNUNET_FS_add_to_index(), GNUNET_FS_dequeue_(), GNUNET_FS_directory_list_contents(), GNUNET_FS_directory_scan_start(), GNUNET_FS_download_start_downloading_(), GNUNET_FS_download_start_task_(), GNUNET_FS_get_indexed_files(), GNUNET_FS_handle_on_demand_block(), GNUNET_FS_meta_data_suggest_filename(), GNUNET_FS_namespace_list_updateable(), GNUNET_FS_publish_main_(), GNUNET_FS_publish_start(), GNUNET_FS_publish_stop(), GNUNET_FS_publish_ublock_(), GNUNET_FS_queue_(), GNUNET_FS_search_start_probe_(), GNUNET_FS_tree_encoder_create(), GNUNET_FS_tree_encoder_next(), GNUNET_GNSRECORD_block_decrypt(), gnunet_gst_bus_call(), GNUNET_HELLO_iterate_addresses(), GNUNET_HELLO_parse_uri(), GNUNET_HOSTLIST_client_start(), GNUNET_HOSTLIST_client_stop(), GNUNET_HOSTLIST_server_start(), GNUNET_HOSTLIST_server_stop(), GNUNET_JSON_from_gnsrecord(), GNUNET_JSON_post_parser(), GNUNET_log_config_invalid(), GNUNET_log_config_missing(), GNUNET_MQ_send(), GNUNET_MST_from_buffer(), GNUNET_MY_exec_prepared(), GNUNET_MY_extract_result(), GNUNET_NAMESTORE_zone_iteration_stop(), GNUNET_NAT_AUTO_test_start(), GNUNET_NAT_test_start(), GNUNET_NETWORK_shorten_unixpath(), GNUNET_NETWORK_unix_precheck(), GNUNET_OS_check_helper_binary(), GNUNET_PLUGIN_load_all(), GNUNET_PQ_exec_prepared(), GNUNET_PQ_exec_statements(), GNUNET_PQ_reconnect(), GNUNET_PQ_run_sql(), GNUNET_PROGRAM_run2(), gnunet_read(), GNUNET_RECLAIM_attestation_deserialize(), GNUNET_RECLAIM_attestation_list_deserialize(), GNUNET_RECLAIM_attribute_deserialize(), GNUNET_RECLAIM_attribute_list_deserialize(), GNUNET_REGEX_announce(), GNUNET_REGEX_search(), GNUNET_REVOCATION_check_pow(), GNUNET_REVOCATION_pow_round(), GNUNET_SERVER_client_mark_monitor(), GNUNET_SERVICE_client_drop(), GNUNET_SERVICE_run_(), GNUNET_SQ_exec_statements(), GNUNET_SQ_prepare(), GNUNET_STATISTICS_destroy(), GNUNET_STRINGS_base64_decode(), GNUNET_STRINGS_to_address_ipv6(), GNUNET_TESTBED_barrier_wait(), GNUNET_TESTBED_hosts_load_from_file(), GNUNET_TESTING_peer_configure(), GNUNET_TESTING_peer_start(), GNUNET_TIME_absolute_get_monotonic(), GNUNET_TRANSPORT_address_to_string(), GNUNET_TRANSPORT_application_validate(), GNUNET_TRANSPORT_communicator_receive(), GNUNET_TRANSPORT_is_connected(), GNUNET_TRANSPORT_TESTING_init(), GNUNET_TRANSPORT_TESTING_log_connect(), GNUNET_TRANSPORT_TESTING_log_disconnect(), GNUNET_TRANSPORT_TESTING_send(), GNUNET_TRANSPORT_TESTING_transport_communicator_send(), GNUNET_TRANSPORT_TESTING_transport_communicator_service_start(), GPI_plugins_load(), GSC_CLIENTS_deliver_message(), GSC_CLIENTS_notify_client_about_neighbour(), GSC_CLIENTS_solicit_request(), GSC_KX_encrypt_and_transmit(), GSC_KX_init(), GSC_SESSIONS_confirm_typemap(), GSC_SESSIONS_create(), GSC_SESSIONS_end(), GSC_SESSIONS_queue_request(), GSC_SESSIONS_set_typemap(), GSC_SESSIONS_solicit(), GSC_SESSIONS_transmit(), GSC_TYPEMAP_add(), GSF_block_peer_migration_(), GSF_cadet_lookup_(), GSF_cadet_query(), GSF_cadet_query_cancel(), GSF_cadet_release_clients(), GSF_cadet_start_server(), GSF_peer_connect_handler(), GSF_pending_request_create_(), GSF_pending_request_get_message_(), GSF_plan_add_(), GSF_push_start_(), GST_blacklist_add_peer(), GST_blacklist_test_allowed(), GST_clients_broadcast(), GST_hello_modify_addresses(), GST_manipulation_init(), GST_manipulation_recv(), GST_manipulation_send(), GST_manipulation_set_metric(), GST_neighbours_calculate_receive_delay(), GST_neighbours_force_disconnect(), GST_neighbours_handle_disconnect_message(), GST_neighbours_handle_quota_message(), GST_neighbours_handle_session_ack(), GST_neighbours_handle_session_syn(), GST_neighbours_handle_session_syn_ack(), GST_neighbours_keepalive(), GST_neighbours_keepalive_response(), GST_neighbours_send(), GST_neighbours_session_terminated(), GST_neighbours_switch_to_address(), GST_plugins_a2s(), GST_plugins_load(), GST_receive_callback(), GST_stats_init(), GST_validation_handle_address(), GST_validation_handle_hello(), GST_validation_handle_ping(), GST_validation_handle_pong(), GST_validation_start(), handle_ack(), handle_add_address(), handle_add_queue_message(), handle_address_change_notification(), handle_alice_client_message(), handle_alice_client_message_multipart(), handle_alices_computation_request(), handle_alices_cryptodata_message(), handle_announce(), handle_ats_start(), handle_attestation_delete_message(), handle_attestation_iteration_next(), handle_attestation_iteration_start(), handle_attestation_iteration_stop(), handle_attestation_store_message(), handle_attribute_delete_message(), handle_attribute_store_message(), handle_autoconfig_request(), handle_backchannel_encapsulation(), handle_backchannel_incoming(), handle_bidirectional_match(), handle_block_cache(), handle_bob_client_message(), handle_bob_client_message_multipart(), 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_client_address_to_string(), handle_client_audio_message(), handle_client_blacklist_init(), handle_client_blacklist_reply(), handle_client_call_message(), handle_client_cancel(), handle_client_conclude(), handle_client_copy_lazy_connect(), handle_client_copy_lazy_prepare(), handle_client_create_set(), handle_client_decrypt(), handle_client_evaluate(), handle_client_hangup_message(), handle_client_hello(), handle_client_index_start(), handle_client_init(), handle_client_insert(), handle_client_iterate(), handle_client_join(), handle_client_keygen(), handle_client_listen(), handle_client_monitor_peers(), handle_client_mutation(), handle_client_pickup_message(), handle_client_redirect_to_ip(), handle_client_redirect_to_service(), handle_client_register_message(), handle_client_reject(), handle_client_response(), handle_client_resume_message(), handle_client_send(), handle_client_send_request(), handle_client_start(), handle_client_start_search(), handle_client_suspend_message(), handle_client_unindex(), handle_collect(), handle_communicator_available(), handle_communicator_backchannel(), handle_consume_ticket_message(), handle_consume_ticket_result(), handle_core_connect(), handle_core_disconnect(), handle_create(), handle_create_message(), handle_create_queue(), handle_data(), handle_datastore_reply(), handle_del_address(), handle_del_queue_message(), handle_delegate_collection_cb(), handle_delegate_collection_error_cb(), handle_delete_message(), handle_dht_p2p_get(), handle_dht_p2p_put(), handle_dht_reply(), handle_dht_response(), handle_dns_request(), handle_dns_result(), handle_drop(), handle_dv_box(), handle_dv_learn(), handle_encrypted(), handle_ephemeral_key(), handle_estimate(), handle_external_ip(), handle_feedback(), handle_flow_control(), handle_fragment_box(), handle_friend(), handle_get(), handle_get_all(), handle_get_default_message(), handle_get_key(), handle_get_replication(), handle_get_zero_anonymity(), handle_gns2dns_ip(), handle_gns2dns_result(), handle_gns_cname_result(), handle_gns_namecache_resolution_result(), handle_gns_resolution_result(), handle_gns_response(), handle_gns_result(), handle_hello(), handle_hello_for_client(), handle_hello_for_incoming(), handle_icmp_back(), handle_icmp_remote(), handle_icmp_service(), handle_identity_set_default(), handle_incoming_msg(), handle_intersection_p2p_done(), handle_intersection_p2p_element_info(), handle_issue_ticket_message(), handle_iterate(), handle_iteration_next(), handle_iteration_start(), handle_iteration_stop(), handle_local_result(), handle_lookup(), handle_lookup_block(), handle_lookup_block_it(), handle_lookup_by_suffix_message(), handle_lookup_message(), handle_monitor_event(), handle_monitor_next(), handle_monitor_start(), handle_mq_error(), handle_namecache_block_response(), handle_notify(), handle_p2p_estimate(), handle_p2p_get(), handle_p2p_migration_stop(), handle_p2p_put(), handle_p2p_reply(), handle_p2p_revoke(), handle_phone_hangup(), handle_ping(), handle_pong(), handle_put(), handle_query_message(), handle_queue_create_fail(), handle_queue_create_ok(), handle_raw_message(), handle_record_lookup(), handle_record_store(), handle_regex_result(), handle_register(), handle_release_reserve(), handle_reliability_ack(), handle_reliability_box(), handle_remove(), handle_rename_message(), handle_reply(), handle_request(), handle_request_connection_reversal(), handle_reserve(), handle_resolve_result(), handle_resolve_timeout(), handle_result(), handle_revocation_query_response(), handle_revocation_response(), handle_revocation_result(), handle_revocation_union_request(), handle_revoke_message(), handle_revoke_ticket_message(), handle_search(), handle_send_message_ack(), handle_send_msg(), handle_send_transmit_continuation(), handle_set(), handle_set_default_message(), handle_shutdown(), handle_start(), handle_start_message(), handle_status(), handle_stop(), handle_store(), handle_stun(), handle_suggest(), handle_tcp_back(), handle_tcp_data(), handle_tcp_remote(), handle_tcp_service(), handle_test(), handle_ticket_iteration_next(), handle_ticket_iteration_start(), handle_ticket_iteration_stop(), handle_transport_notify_connect(), handle_transport_notify_disconnect(), handle_transport_notify_excess_bw(), handle_udp_back(), handle_udp_remote(), handle_union_p2p_full_done(), handle_union_p2p_ibf(), handle_union_p2p_strata_estimator(), handle_validation_challenge(), handle_validation_response(), handle_verify(), handle_watch(), handle_watch_cancel(), handle_zone_to_name(), handle_zone_to_name_it(), handler_advertisement(), hash_for_index_cb(), hash_for_index_val(), header_iterator(), helper_read(), helper_write(), host_processor(), hosts_directory_scan_callback(), icmp_from_helper(), identity_cb(), iface_proc(), inbound_bw_tracker_update(), inbound_channel(), inbound_end(), incoming_channel(), incoming_destroy(), incoming_timeout_cb(), index_mq_error_handler(), info_cb(), init_callback(), init_cb(), init_socket(), init_socket_resolv(), initialize_map_unfiltered(), insert_decrypt_element(), insert_hostlist(), insert_round2_element(), intersection_accept(), intersection_evaluate(), intersection_op_cancel(), intersection_set_create(), issue_ticket_result_cb(), iterate_initial_edge(), iterate_zones(), iterator_bf_create(), iterator_bf_reduce(), jwt_get_expiration(), jwt_get_issuer(), jwt_parse_attributes(), kb_put_cont(), keygen_round1_new_element(), keygen_round2_conclude(), keygen_round2_new_element(), keygen_session_destroy(), learn_dv_path(), LEGACY_SERVICE_run(), libgnunet_plugin_namecache_flat_done(), libgnunet_plugin_namecache_flat_init(), libgnunet_plugin_namestore_flat_done(), libgnunet_plugin_namestore_flat_init(), libgnunet_plugin_peerstore_flat_done(), libgnunet_plugin_peerstore_flat_init(), libgnunet_plugin_rest_config_done(), libgnunet_plugin_rest_config_init(), libgnunet_plugin_rest_copying_done(), libgnunet_plugin_rest_copying_init(), libgnunet_plugin_rest_gns_done(), libgnunet_plugin_rest_gns_init(), libgnunet_plugin_rest_identity_done(), libgnunet_plugin_rest_identity_init(), libgnunet_plugin_rest_namestore_done(), libgnunet_plugin_rest_namestore_init(), libgnunet_plugin_rest_openid_connect_done(), libgnunet_plugin_rest_openid_connect_init(), libgnunet_plugin_rest_peerinfo_done(), libgnunet_plugin_rest_peerinfo_init(), libgnunet_plugin_rest_reclaim_done(), libgnunet_plugin_rest_reclaim_init(), libgnunet_plugin_transport_http_server_init(), libgnunet_plugin_transport_tcp_init(), list_attestation_cont(), list_attribute_cont(), list_count(), list_tickets_cont(), load(), load_cert_from_file(), load_episode(), load_episodes(), load_etc_hosts(), load_hostlist_file(), load_key_from_file(), load_op_add_address(), load_op_del_address(), load_op_start_set_preference(), load_op_start_set_property(), load_op_stop_set_preference(), load_op_stop_set_property(), load_plugin(), load_quota(), load_quotas(), load_search_strings(), load_state(), loc_mq_error_handler(), login_cont(), lookup_authz_cb(), lookup_communicator(), lookup_diff(), lookup_dns_servers(), lookup_hole_external(), lookup_it_processor(), lookup_redirect_uri_result(), lookup_rfn(), lookup_set(), lookup_ssl_httpd(), lookup_task(), main(), main_init(), main_run(), maint_child_death(), mal_pre(), manage_service_wrapper(), manage_space(), master_task(), match_full_data(), message_token(), mhd_completed_cb(), mhd_connection_cb(), mhd_content_cb(), mhd_log_callback(), move_attr_finished(), move_attrs(), mq_destroy_d(), mq_destroy_kx(), mq_error(), mq_error_handler(), mq_init(), mq_send(), mq_send_d(), mq_send_kx(), multicast_pong(), multirecord_process(), mysql_plugin_estimate_size(), mysql_plugin_get_keys(), mysql_plugin_put(), mysql_plugin_remove_key(), namecache_cache_block(), namecache_cache_continuation(), namecache_lookup_block(), namecache_sqlite_cache_block(), namecache_sqlite_lookup_block(), namestore_flat_zone_to_name(), namestore_list_finished(), nat_address_cb(), nat_register(), nat_server_read(), nat_start(), neighbour_store_dvmono_cb(), neighbours_changed_notification(), neighbours_connect_notification(), neighbours_disconnect_notification(), new_channel(), new_service_channel(), next_phase(), next_rnd(), nfa_add_plus_op(), nfa_add_question_op(), nfa_add_star_op(), nfa_add_states(), nibble_to_regex(), no_more_local_results(), notify_all(), notify_client(), notify_client_connect_info(), notify_client_external_ipv4_change(), ns_lookup_error_cb(), ns_lookup_result_cb(), odc_warn_delay_task(), ogg_demux_and_decode(), ogg_init(), OIDC_build_authz_code(), OIDC_id_token_new(), OIDC_parse_authz_code(), open_socket(), p2_transport_connect(), pa_init(), pack(), packetizer(), parse_attest(), parse_attr(), parse_configuration_file(), parse_expiration(), parse_gnsrecordobject(), parse_ip_options(), parse_jwt(), parse_name(), parse_port_policy(), parse_quota(), parse_record(), parse_record_data(), parse_ticket(), pass_plaintext_to_core(), peer_id_cb(), peer_init_handler(), peerinfo_it(), peerinfo_list_finished(), peerinformation_cb(), peerstore_store_own_cb(), perform_dht_put(), phone_error_handler(), ping(), ping_handler(), plan(), plugin_env_address_change_notification(), plugin_env_session_end(), plugin_env_session_start(), plugin_env_session_start_bl_check_cont(), plugin_session_info_cb(), policy_filename_cb(), pong_handler(), post_data_iter(), post_extract_rsa_public_key(), post_extract_rsa_signature(), post_iterator(), post_profiler(), post_test_op(), post_test_shutdown_ready_cb(), preference_aging(), prepare_client_end_notification(), prepare_ibf(), prepare_ipv4_packet(), prepare_pending_acknowledgement(), primary_task(), print_deleset(), print_view_sizes(), probe_failure_handler(), probe_success_handler(), process(), process_bf(), process_cont(), process_dht_put_content(), process_dns_result(), process_ego_file(), process_external_ip(), process_header(), process_hello_update(), process_helper_messages(), process_if(), process_job_queue(), process_kblock(), process_local_reply(), process_migration_content(), process_notify(), process_parallel_lookup_result(), process_payload(), process_peer(), process_peer_iteration_cb(), process_peerinfo_hello(), process_queue(), process_record(), process_reply(), process_resolved_address(), process_result(), process_result_with_request(), process_sblock(), process_stat(), process_stat_done(), process_stat_in(), process_stun_reply(), process_tickets(), profiler_cb(), profiler_eval(), profiler_init_peer(), profiler_reply_handle(), profiler_reply_handle_info(), progress_cb(), proto_read_kx(), publicize_rm(), publish_cleanup(), publish_content(), publish_fs_connect_complete_cb(), publish_kblocks_cont(), publish_ksk_cont(), publish_progress_cb(), publish_timeout(), publish_zone_dht_start(), put_cb(), put_continuation(), put_gns_record(), put_migration_continuation(), put_set(), put_task(), qc_fragment_sent(), query_mq_error_handler(), queue(), queue_destroy(), queue_read(), queue_read_kx(), queue_send_msg(), queue_timeout(), queue_write(), quota_processor(), read_blacklist_configuration(), read_friends_file(), read_from_file(), read_host_file(), read_index_list(), read_stdio(), read_update_information_graph(), reannounce_regex(), receiver_destroy(), RECLAIM_TICKETS_consume(), RECLAIM_TICKETS_init(), reconnect(), reconnect_later(), reconstruct_cb(), reconstruct_cont(), record(), record_iterator(), recursive_dns_resolution(), recursive_gns2dns_resolution(), recursive_gns_resolution_namecache(), recursive_gns_resolution_revocation(), recursive_resolution(), refresh_block(), refresh_hello_task(), regex_add(), REGEX_BLOCK_check_proof(), regex_combine(), regex_found_handler(), REGEX_INTERNAL_construct_dfa(), REGEX_INTERNAL_construct_nfa(), REGEX_INTERNAL_context_init(), REGEX_INTERNAL_eval(), REGEX_INTERNAL_get_first_key(), REGEX_INTERNAL_iterate_all_edges(), regex_iterator(), REGEX_TEST_automaton_save_graph(), REGEX_TEST_automaton_save_graph_step(), REGEX_TEST_combine(), REGEX_TEST_read_from_file(), reliability_box_message(), remove_by_unique_id(), remove_cont(), remove_continuation(), remove_garbage(), remove_ticket_cont(), repl_proc(), replace_cont(), reply_to_dns(), req_addr_peerinfo_it(), request_callback(), request_peers(), reservations_reserve(), reset_cadet(), resolve_and_cache(), resolver_lookup_get_next_label(), resolver_start(), rest_identity_process_request(), rest_process_request(), restart_nat_server(), restart_task(), result_callback(), result_processor(), return_response(), return_userinfo_response(), revalidate_address(), reversal_cb(), reversal_test(), revocation_mq_error_handler(), revoke_result_cb(), revoke_ticket_cont(), rfn_majority(), route_control_message_without_fc(), route_packet(), route_via_neighbour(), rps_connect_complete_cb(), rps_disconnect_adapter(), run(), run_mhd_start_daemon(), run_no_scheduler(), run_ready_steps(), run_scan(), run_with_zone_pkey(), run_zone_iteration_round(), rvk_move_attr_cb(), save(), save_hostlist_file(), save_state(), schedule_action(), schedule_block_download(), schedule_missing_requests(), schedule_next_hello(), schedule_peer_transmission(), schedule_select_v4(), schedule_select_v6(), schedule_transmit_on_queue(), search_timed_out(), secret_ready_cb(), seed_peers(), select_peer(), select_read_cb(), select_write_cb(), send_add_queue(), send_alices_cryptodata_message(), send_bloomfilter(), send_client_done_and_destroy(), send_client_element(), send_client_removed_element(), send_delete_response(), send_disconnect(), send_element_count(), send_end_msg(), send_icmp_packet_via_tun(), send_keep_alive(), send_keepalive(), send_key(), send_lookup_response(), send_message(), send_outbound_quota_to_clients(), send_peer_information(), send_remaining_elements(), send_reply(), send_response(), send_result_code(), send_session_ack_message(), send_session_syn_ack_cont(), send_session_syn_cont(), send_store_response(), send_syn(), send_syn_ack_message(), send_tcp_packet_via_tun(), send_ticket_result(), send_to_client_iter(), send_udp_packet_via_tun(), send_utilization_data(), server_access_cb(), server_get_addresses(), server_log(), server_session_timeout(), server_start(), server_stop(), service_mq_error_handler(), session_connect_adapter(), session_connect_complete(), set_alternative_address(), set_cont(), set_external_ipv4(), set_feedback_task(), set_incoming_quota(), set_listen_cb(), set_pref_task(), set_primary_address(), set_prop_task(), set_result_cb(), set_state_and_timeout(), setup_data_transfer(), setup_neighbour(), setup_receiver_mq(), setup_service(), setup_state_record(), shutdown_op(), shutdown_task(), sock_read(), solicit_messages(), solver_bandwidth_changed_cb(), solver_info_cb(), sqlite_plugin_estimate_size(), srv_status(), start_address_validation(), start_callback(), start_cb(), start_dv_learn(), start_helper(), start_intersection(), start_job(), start_local_query(), start_p2p_processing(), start_process(), start_task(), start_test(), stat_iterator(), state_add_transition(), statistics_done_cb(), stats_cb(), stats_connect_cb(), stats_cont(), stats_iterator(), step_depend_on(), stop_callback(), stop_job(), stop_stun(), store_cb(), store_completed_cb(), store_pi(), store_prefix_file_name(), store_service(), strata_estimator_create(), stream_read_callback(), stream_state_callback(), stream_write_callback(), suggest_to_connect(), suspend_operation(), switch_address_bl_check_cont(), switch_to_speaker(), task_check(), task_download(), task_download_dispatcher(), task_hostlist_saving(), task_start_apply_round(), task_start_eval_echo(), task_start_reconcile(), task_testing_intervall_reset(), tcp_address_to_sockaddr_numeric_v6(), tcp_address_to_sockaddr_port_only(), tcp_from_helper(), tcp_plugin_address_pretty_printer(), term_callback(), test_blacklisted(), test_exist_cb(), test_icmp_client(), test_icmp_server(), test_master(), test_nat_punched(), test_run(), test_stun(), test_stun_packet(), test_upnpc(), ticket_collect(), ticket_iter(), ticket_iter_cb(), ticket_iter_err(), timeout_cadet_task(), timeout_cb(), tld_iter(), tmain(), tmt_rdy_ping(), tofile_(), token_endpoint(), tokenized_cb(), topology_setup_done(), transmit(), transmit_bobs_cryptodata_message(), transmit_bobs_cryptodata_message_multipart(), transmit_client_response(), transmit_cummulative_ack_cb(), transmit_item(), transmit_lookup_dns_result(), transmit_next(), transmit_on_queue(), transmit_pending(), transmit_ping_if_allowed(), transmit_query(), transmit_send_continuation(), transmit_status(), transmit_task_cb(), transmit_typemap_task(), transport_connect_adapter(), trigger_recursive_download(), trigger_shutdown(), try_anat(), try_cache(), try_finish_step_early(), try_open_exit(), try_reconnect(), try_send_tcp(), try_send_udp(), try_transmission(), try_transmission_to_peer(), udp_address_to_sockaddr(), udp_from_helper(), udp_ipv4_broadcast_send(), udp_ipv6_broadcast_send(), unicast(), unindex_directory_scan_cb(), unindex_finish(), unindex_process(), union_set_create(), unload_plugin(), unset_primary_address(), update_excess(), update_hello(), update_hostlist(), update_meter(), update_ping_data(), update_pm_next_attempt(), update_tickets(), update_velocity(), updateUsage(), upnp_addr_change_cb(), url_iterator(), validate_address_iterator(), validation_start_cb(), validation_transmit_on_queue(), verify_fair(), verify_message_crypto(), verify_revoke_message(), view_update_cb(), vpn_allocation_cb(), warmup(), warn_delay_task(), warn_monitor_slow(), watch_notifier_it(), work(), write_all(), write_bw_gnuplot_script(), write_index_list(), write_item(), write_page(), write_rtt_gnuplot_script(), write_throughput_gnuplot_script(), write_update_information_graph(), zone_iterate_proc(), zone_iteration_error(), zone_iteration_finished(), zone_to_name_cb(), and zone_to_name_error().

◆ GNUNET_static_assert

#define GNUNET_static_assert (   cond)    GNUNET_assert (cond)

Assertion to be checked (if supported by C compiler) at compile time, otherwise checked at runtime and resulting in an abort() on failure.

This is the case where the compiler does not support static assertions.

Parameters
condcondition to test, 0 implies failure

Definition at line 924 of file gnunet_common.h.

◆ GNUNET_memcmp

#define GNUNET_memcmp (   a,
 
)
Value:
({ \
const typeof (*b) * _a = (a); \
const typeof (*a) * _b = (b); \
memcmp (_a, _b, sizeof(*a)); \
})

Compare memory in a and b, where both must be of the same pointer type.

Do NOT use this function on arrays, it would only compare the first element!

Definition at line 1133 of file gnunet_common.h.

Referenced by allocate_v6_address(), attempt_connect(), authorize_endpoint(), block_plugin_gns_evaluate(), cache_nick(), cb_intersection_request_alice(), check_dv_box(), check_dv_learn(), check_info(), check_known_challenge(), check_notify_client(), check_record_result(), check_result(), clean_peer(), code_redirect(), connect_handler(), connect_notify(), consider_for_advertising(), continue_store_activity(), core_init(), core_init_cb(), decrypt_cb(), decrypt_new_element(), disconnect_handler(), dv_neighbour_selection(), dv_neighbour_transmission(), ego_callback(), find_by_message_uuid(), find_ego(), find_partner(), find_peer(), find_peer_by_pid(), find_session(), find_session_id(), GAS_normalization_update_property(), GCC_create_inbound(), GCCH_channel_local_new(), GCCH_handle_channel_open_ack(), GCPP_try_path_from_dht(), GCT_alice_or_betty(), GCT_handle_kx(), GCT_handle_kx_auth(), GDS_am_closest_peer(), get_decrypt_peer_info(), get_keygen_peer_info(), get_next_free_ctn(), get_nick_record(), get_peer_idx(), GNUNET_CONTAINER_multihashmap_contains(), GNUNET_CONTAINER_multihashmap_contains_value(), GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_get_multiple(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_CONTAINER_multihashmap_remove_all(), GNUNET_CONTAINER_multipeermap_contains(), GNUNET_CONTAINER_multipeermap_contains_value(), GNUNET_CONTAINER_multipeermap_get(), GNUNET_CONTAINER_multipeermap_get_multiple(), GNUNET_CONTAINER_multipeermap_put(), GNUNET_CONTAINER_multipeermap_remove(), GNUNET_CONTAINER_multipeermap_remove_all(), GNUNET_CONTAINER_multishortmap_contains(), GNUNET_CONTAINER_multishortmap_contains_value(), GNUNET_CONTAINER_multishortmap_get(), GNUNET_CONTAINER_multishortmap_get_multiple(), GNUNET_CONTAINER_multishortmap_put(), GNUNET_CONTAINER_multishortmap_remove(), GNUNET_CONTAINER_multishortmap_remove_all(), GNUNET_CONTAINER_multiuuidmap_contains(), GNUNET_CONTAINER_multiuuidmap_contains_value(), GNUNET_CONTAINER_multiuuidmap_get(), GNUNET_CONTAINER_multiuuidmap_get_multiple(), GNUNET_CONTAINER_multiuuidmap_put(), GNUNET_CONTAINER_multiuuidmap_remove(), GNUNET_CONTAINER_multiuuidmap_remove_all(), GNUNET_HELLO_equals(), got_hello(), GSF_peer_connect_handler(), handle_add_queue_message(), handle_client_start(), handle_connection_create(), handle_core_connect(), handle_core_disconnect(), handle_del_queue_message(), handle_dht_result(), handle_dv_box(), handle_dv_learn(), handle_friend(), handle_intersection_p2p_done(), handle_matching_ack(), handle_p2p_estimate(), handle_peer_pull_request(), handle_reservation_result(), handle_send_message_ack(), handle_stun(), handle_update_queue_message(), handle_validation_challenge(), hosts_directory_scan_callback(), initialize_session_peer_list(), iterate_zones(), key_cmp(), keygen_round2_conclude(), learn_dv_path(), match_ipv6(), mysql_plugin_get_keys(), notify_monitors(), ns_lookup_result_cb(), OIDC_parse_authz_code(), peer_find(), peer_init_handler(), process_bf(), process_if(), process_peer(), REGEX_BLOCK_check(), rem_from_list(), RPS_sampler_count_id(), RPS_sampler_elem_next(), RPS_sampler_reinitialise_by_value(), secret_ready_cb(), setup_fresh_address(), t_ax_decrypt_and_validate(), tld_iter(), try_combine_recent(), try_old_ax_keys(), update_ax_by_kx(), and zone_to_name().

◆ GNUNET_memcmp_priv

#define GNUNET_memcmp_priv (   a,
 
)
Value:
({ \
const typeof (*b) * _a = (a); \
const typeof (*a) * _b = (b); \
GNUNET_memcmp_ct_ (_a, _b, sizeof(*a)); \
})

Compare memory in a and b in constant time, suitable for private data.

Both a and b must be of the same pointer type.

Do NOT use this function on arrays, it would only compare the first element!

Definition at line 1162 of file gnunet_common.h.

◆ GNUNET_is_zero

#define GNUNET_is_zero (   a)    GNUNET_is_zero_ (a, sizeof (*a))

Check that memory in a is all zeros.

a must be a pointer.

Parameters
apointer to a struct which should be tested for the entire memory being zero'ed out.
Returns
0 if a is zero, non-zero otherwise

Definition at line 1190 of file gnunet_common.h.

Referenced by check_ipv6_listed(), check_result(), GAS_handle_request_address_list(), GCP_2s(), handle_address_list(), monitor_iteration_next(), notify_monitors(), and run_zone_iteration_round().

◆ GNUNET_memcpy

#define GNUNET_memcpy (   dst,
  src,
 
)
Value:
do \
{ \
if (0 != n) \
{ \
(void) memcpy (dst, src, n); \
} \
} while (0)

Call memcpy() but check for n being 0 first.

In the latter case, it is now safe to pass NULL for src or dst. Unlike traditional memcpy(), returns nothing.

Parameters
dstdestination of the copy, may be NULL if n is zero
srcsource of the copy, may be NULL if n is zero
nnumber of bytes to copy

Definition at line 1203 of file gnunet_common.h.

Referenced by abd_value_to_string(), ack_proc(), add_address_to_uri(), add_attestation_cont(), add_attribute_cont(), add_dns_result(), add_record(), add_to_keyword_counter(), add_to_tc(), address_notification(), adv_transmit(), aes_128_cbc_decrypt(), aes_128_cbc_encrypt(), announce_id(), announce_reconnect(), api_connect(), api_create_hello(), api_send(), attest_iter_cb(), attr_iter_cb(), automaton_create_proofs_simplify(), backward_resolution(), block_create(), block_reader(), broadcast_status(), buffer_append(), buffer_init(), build_dns_query(), callback_download(), change_service(), check_local_data(), check_n_peers_ready(), check_notify_client(), check_peer_info_ready(), check_proof_of_work(), client_response_handler(), client_schedule(), client_send_cb(), compose_address_iterate_response_message(), conclude_autoconfig_request(), connect_probe_continuation(), consider_for_advertising(), consume_ticket_cont(), create_address(), create_ats_address(), create_response(), create_session(), create_set_default_message(), create_update_message(), curl_check_hdr(), curl_download_cb(), curl_upload_cb(), database_setup(), decode_and_send(), delegation_chain_bw_resolution_start(), delegation_chain_fw_resolution_start(), dht_get_string_handler(), discard_hosts_helper(), dispatch_buffer(), dns_pre_request_handler(), dns_string_to_value(), do_restart_typemap_message(), do_round(), do_transmit(), download_cb(), ego_create(), ego_edit(), ego_edit_subsystem(), enqueue_fragment(), execute_add(), extract_files(), extract_fixed_blob(), extract_var_blob(), extract_varsize_blob(), file_in_send(), find_full_data(), find_proof(), find_subsystem_entry(), format_help(), forward_dv_learn(), forward_reply(), forward_resolution(), GCCH_handle_channel_plaintext_data(), GCCH_handle_local_data(), GCD_search(), GDS_CLIENTS_process_get(), GDS_CLIENTS_process_get_resp(), GDS_CLIENTS_process_put(), GDS_NEIGHBOURS_handle_get(), GDS_NEIGHBOURS_handle_put(), GDS_NEIGHBOURS_handle_reply(), GDS_ROUTING_add(), get_channel_key_from_ips(), get_existing_record(), get_fair_encryption_challenge(), get_hello_address_size(), get_identity(), get_label(), get_server_addresses(), getopt_set_keywords(), getPRK(), gns_string_to_value(), gns_value_to_string(), GNUNET_ABD_collect(), GNUNET_ABD_delegate_deserialize(), GNUNET_ABD_delegate_from_string(), GNUNET_ABD_delegate_issue(), GNUNET_ABD_delegate_serialize(), GNUNET_ABD_delegates_deserialize(), GNUNET_ABD_delegates_serialize(), GNUNET_ABD_delegation_chain_deserialize(), GNUNET_ABD_delegation_chain_serialize(), GNUNET_ABD_delegation_set_deserialize(), GNUNET_ABD_delegation_set_serialize(), GNUNET_ABD_verify(), GNUNET_CONFIGURATION_expand_dollar(), GNUNET_CONFIGURATION_serialize(), GNUNET_CONNECTION_connect_socket(), GNUNET_CONNECTION_create_from_accept(), GNUNET_CONNECTION_get_address(), GNUNET_CONSENSUS_create(), GNUNET_CONSENSUS_insert(), GNUNET_CONTAINER_bloomfilter_get_raw_data(), GNUNET_CONTAINER_bloomfilter_init(), GNUNET_CONTAINER_meta_data_deserialize(), GNUNET_CONTAINER_meta_data_get_thumbnail(), GNUNET_CONTAINER_meta_data_insert(), GNUNET_CONTAINER_meta_data_serialize(), GNUNET_copy_message(), GNUNET_CRYPTO_eddsa_key_get_public(), GNUNET_CRYPTO_hash_context_finish(), GNUNET_CRYPTO_hkdf_v(), GNUNET_CRYPTO_hmac_raw(), GNUNET_CRYPTO_mpi_print_unsigned(), GNUNET_CRYPTO_symmetric_derive_iv_v(), GNUNET_DATASTORE_put(), GNUNET_DATASTORE_remove(), GNUNET_DEFRAGMENT_process_fragment(), GNUNET_DHT_get_filter_known_results(), GNUNET_DHT_get_start(), GNUNET_DHT_put(), GNUNET_DNS_request_answer(), GNUNET_DNSPARSER_builder_add_cert(), GNUNET_DNSPARSER_builder_add_mx(), GNUNET_DNSPARSER_builder_add_name(), GNUNET_DNSPARSER_builder_add_query(), GNUNET_DNSPARSER_builder_add_soa(), GNUNET_DNSPARSER_builder_add_srv(), GNUNET_DNSPARSER_pack(), GNUNET_DNSPARSER_parse_cert(), GNUNET_DNSPARSER_parse_mx(), GNUNET_DNSPARSER_parse_query(), GNUNET_DNSPARSER_parse_record(), GNUNET_DNSPARSER_parse_soa(), GNUNET_DNSPARSER_parse_srv(), GNUNET_DNSSTUB_add_dns_sa(), GNUNET_FRAGMENT_context_create(), GNUNET_FS_add_to_index(), GNUNET_FS_data_reader_copy_(), GNUNET_FS_directory_builder_add(), GNUNET_FS_directory_builder_finish(), GNUNET_FS_directory_list_contents(), GNUNET_FS_indexing_send_list(), GNUNET_FS_publish_ublock_(), GNUNET_FS_uri_dup(), GNUNET_GNS_lookup_limited(), GNUNET_GNSRECORD_block_decrypt(), GNUNET_GNSRECORD_records_deserialize(), GNUNET_GNSRECORD_records_serialize(), GNUNET_HELLO_add_address(), GNUNET_HELLO_address_allocate(), GNUNET_HELLO_create(), GNUNET_HELLO_iterate_addresses(), GNUNET_HELPER_send(), GNUNET_IDENTITY_create(), GNUNET_IDENTITY_delete(), GNUNET_IDENTITY_get(), GNUNET_IDENTITY_rename(), GNUNET_IDENTITY_set(), GNUNET_MQ_copy_handlers(), GNUNET_MQ_copy_handlers2(), GNUNET_MQ_msg_copy(), GNUNET_MQ_msg_nested_mh_(), GNUNET_MQ_send_copy(), GNUNET_MST_from_buffer(), GNUNET_NAMECACHE_block_cache(), GNUNET_NAMESTORE_records_lookup(), GNUNET_NAMESTORE_records_store(), GNUNET_NAT_AUTO_autoconfig_start(), GNUNET_NAT_register(), GNUNET_NAT_request_reversal(), GNUNET_NAT_stun_handle_packet(), GNUNET_NETWORK_socket_bind(), GNUNET_PROGRAM_run2(), GNUNET_RECLAIM_attestation_deserialize(), GNUNET_RECLAIM_attestation_new(), GNUNET_RECLAIM_attestation_serialize(), GNUNET_RECLAIM_attribute_deserialize(), GNUNET_RECLAIM_attribute_new(), GNUNET_RECLAIM_attribute_serialize(), GNUNET_RESOLVER_hostname_get(), GNUNET_RESOLVER_ip_get(), GNUNET_REVOCATION_check_pow(), GNUNET_REVOCATION_pow_round(), GNUNET_RPS_seed_ids(), GNUNET_SCALARPRODUCT_accept_computation(), GNUNET_SCALARPRODUCT_start_computation(), GNUNET_SECRETSHARING_create_session(), GNUNET_SECRETSHARING_share_read(), GNUNET_SECRETSHARING_share_write(), GNUNET_SERVER_mst_receive(), GNUNET_SET_add_element(), GNUNET_SET_element_dup(), GNUNET_SET_remove_element(), GNUNET_SOCKS_set_handshake_destination(), GNUNET_STRINGS_buffer_fill(), GNUNET_STRINGS_conv(), GNUNET_STRINGS_parse_uri(), GNUNET_STRINGS_to_address_ipv6(), GNUNET_STRINGS_utf8_tolower(), GNUNET_STRINGS_utf8_toupper(), GNUNET_TESTBED_barrier_cancel(), GNUNET_TESTBED_barrier_init_(), GNUNET_TESTBED_barrier_wait(), GNUNET_TESTBED_controller_connect(), GNUNET_TESTBED_create_helper_init_msg_(), GNUNET_TESTBED_forward_operation_msg_(), GNUNET_TESTBED_hosts_load_from_file(), GNUNET_TESTBED_LOGGER_write(), GNUNET_TESTBED_operation_inactivate_(), GNUNET_TESTBED_queue_message_(), GNUNET_TESTBED_register_host(), GNUNET_TESTING_get_testname_from_underscore(), GNUNET_TESTING_hostkey_get(), GNUNET_TESTING_peer_get_identity(), GNUNET_TRANSPORT_address_to_string(), GNUNET_TRANSPORT_core_connect(), GNUNET_TRANSPORT_core_get_mq(), GNUNET_TRANSPORT_TESTING_start_peer(), GNUNET_TUN_compute_service_cadet_port(), GNUNET_VPN_redirect_to_ip(), GNUNET_xfree_(), GNUNET_xgrow_(), GNUNET_xmemdup_(), GNUNET_xrealloc_(), GNUNET_xstrdup_(), GNUNET_xstrndup_(), GSC_CLIENTS_deliver_message(), GSC_KX_encrypt_and_transmit(), GSC_SESSIONS_transmit(), GSC_TYPEMAP_compute_type_map_message(), GSC_TYPEMAP_extend(), GSC_TYPEMAP_get_from_message(), GSF_dht_lookup_(), GSF_pending_request_create_(), GSF_pending_request_get_message_(), GSF_pending_request_update_(), GST_manipulation_send(), GST_neighbours_send(), GST_send_operation_fail_msg(), GST_validation_handle_ping(), handle_add_host(), handle_address_change_notification(), handle_alice_client_message(), handle_alice_client_message_multipart(), handle_alices_cryptodata_message(), handle_barrier_cancel(), handle_barrier_init(), handle_barrier_status(), handle_barrier_wait(), handle_block_cache(), handle_bob_client_message(), handle_bob_client_message_multipart(), handle_bobs_cryptodata_message(), handle_bobs_cryptodata_multipart(), handle_cadet_audio_message(), handle_client_audio_message(), handle_client_insert(), handle_client_redirect_to_ip(), handle_client_response(), handle_collect(), handle_data(), handle_datastore_reply(), handle_dht_local_get(), handle_dht_local_get_result_seen(), handle_dht_local_monitor(), handle_dht_p2p_put(), handle_dht_p2p_result(), handle_dns_request(), handle_gns2dns_ip(), handle_gns2dns_result(), handle_gns_resolution_result(), handle_gns_response(), handle_gns_result(), handle_icmp_back(), handle_intersection_p2p_bf(), handle_link_controllers_result(), handle_lookup_block_it(), handle_lookup_block_response(), handle_p2p_reply(), handle_peer_config(), handle_peer_get_config(), handle_record_lookup(), handle_record_store(), handle_register(), handle_remote_overlay_connect(), handle_request(), handle_request_connection_reversal(), handle_search_result(), handle_set(), handle_slave_get_config(), handle_stream_input(), handle_stun(), handle_tcp_back(), handle_tcp_nat_probe(), handle_tcp_welcome(), handle_udp_back(), handle_union_p2p_demand(), handle_union_p2p_elements(), handle_union_p2p_full_element(), handle_union_p2p_offer(), handle_verify(), handle_watch(), handle_zone_to_name_it(), handler_advertisement(), hash_for_index_cb(), hash_pkey_and_label(), hash_redirect_info(), heap_plugin_put(), hello_update_cb(), host_habitable_cb(), host_processor(), http_client_plugin_send(), http_common_address_from_socket(), http_common_plugin_address_to_string(), http_common_plugin_address_to_url(), http_common_plugin_dnsresult_to_address(), http_common_plugin_string_to_address(), http_server_plugin_send(), ibf_read_slice(), ibf_write_slice(), icmp_from_helper(), idx_of(), iface_proc(), ifc_proc(), init_aes(), initialize_session_peer_list(), interface_proc(), iterate_cb(), LEGACY_SERVICE_get_server_addresses(), LEGACY_SERVICE_start(), libgnunet_plugin_transport_tcp_init(), libgnunet_plugin_transport_unix_done(), linux_read(), load_hostlist_file(), login_cont(), lookup_nick_it(), main(), make_file(), make_info_message(), make_peer(), merge_with_nick_records(), mhd_content_cb(), move_children(), mst_receive(), namecache_cache_block(), namestore_add_or_update(), namestore_flat_store_records(), namestore_postgres_store_records(), namestore_sqlite_store_records(), normalize_metadata(), normalize_peers(), notify_client(), notify_clients_stun_change(), notify_listeners(), notify_send_probe(), ogg_init(), on_appsink_new_sample(), open_device(), open_device_raw(), opstart_manage_service(), opstart_peer_create(), opstart_peer_reconfigure(), packetizer(), PEERSTORE_create_record_mq_envelope(), peerstore_flat_store_record(), PEERSTORE_hash_key(), PEERSTORE_parse_record_message(), play(), plugin_session_info_cb(), post_iterator(), prepare_beacon(), prepare_ipv4_packet(), prepare_ipv6_packet(), print_key(), process_dns_result(), process_external_ip(), process_header(), process_hello(), process_helper_messages(), process_migration_content(), process_payload(), process_reply_with_path(), process_requests(), put_cb(), queue(), read_cpabe(), read_from_buffer(), read_from_file(), read_from_the_socket(), read_index_list(), read_process_fragment(), read_stdio(), reciever(), record(), recursive_pkey_resolution(), regex_add_multiple(), REGEX_BLOCK_create(), remove_epsilon(), request_done(), result_processor(), reversal_callback(), revoke_ticket_cont(), route_packet(), run(), sb_append(), sb_append_cstr(), sb_realloc(), sb_strdup(), sb_strdup_cstr(), search_reconnect(), send_ack(), send_add_address_message(), send_bloomfilter(), send_client_element(), send_client_removed_element(), send_client_reply(), send_client_status_msg(), send_controller_link_response(), send_full_element_iterator(), send_get(), send_get_known_results(), send_hello_beacon(), send_hello_thru_rocc(), send_icmp_packet_via_tun(), send_lookup_response(), send_mac_to_plugin(), send_missing_full_elements_iter(), send_pull_reply(), send_push(), send_remaining_elements(), send_reply(), send_request(), send_request_to_client(), send_result_code(), send_stream_peers(), send_to_client_iter(), send_view(), server_get_addresses(), server_notify_external_hostname(), server_send_callback(), service_task(), set_cont(), stdin_receiver(), stdin_send(), stdin_send_hw(), store_all_states(), strata_estimator_write(), stream_read_callback(), t_hmac(), tcp_from_helper(), tcp_nat_port_map_callback(), tcp_plugin_address_pretty_printer(), tcp_plugin_address_to_string(), tcp_plugin_get_network_for_address(), tcp_plugin_get_session(), tcp_plugin_send(), tmt_rdy_pong(), transmit_address_to_client(), transmit_bobs_cryptodata_message(), transmit_bobs_cryptodata_message_multipart(), transmit_call_audio(), transmit_client_response(), transmit_content(), transmit_fragment(), transmit_item(), transmit_next(), transmit_phone_audio(), transmit_ping_if_allowed(), transmit_ready(), transmit_req_addr(), transmit_status(), try_connect_using_address(), try_transmission(), udp_from_helper(), udp_plugin_get_network_for_address(), udp_plugin_send(), union_accept(), unix_address_to_sockaddr(), unix_plugin_do_read(), unix_plugin_send(), unix_plugin_string_to_address(), update_hello(), uri_chk_parse(), uri_loc_parse(), view_update_cb(), vpn_allocation_callback(), wlan_plugin_send(), write_cpabe(), write_page(), and write_to_file().

◆ __func__

#define __func__   "<unknown>"

Definition at line 1695 of file gnunet_common.h.

Referenced by GNUNET_TESTBED_hosts_load_from_loadleveler().

Typedef Documentation

◆ GNUNET_FileNameCallback

typedef int(* GNUNET_FileNameCallback) (void *cls, const char *filename)

Function called with a filename.

Parameters
clsclosure
filenamecomplete filename (absolute path)
Returns
GNUNET_OK to continue to iterate, GNUNET_NO to stop iteration with no error, GNUNET_SYSERR to abort iteration with error!

Definition at line 349 of file gnunet_common.h.

◆ GNUNET_ContinuationCallback

typedef void(* GNUNET_ContinuationCallback) (void *cls)

Generic continuation callback.

Parameters
clsClosure.

Definition at line 359 of file gnunet_common.h.

◆ GNUNET_ResultCallback

typedef void(* GNUNET_ResultCallback) (void *cls, int64_t result_code, const void *data, uint16_t data_size)

Function called with the result of an asynchronous operation.

Parameters
clsClosure.
result_codeResult code for the operation.
dataData result for the operation.
data_sizeSize of data.

Definition at line 375 of file gnunet_common.h.

Enumeration Type Documentation

◆ GNUNET_GenericReturnValue

Named constants for return values.

The following invariants hold: GNUNET_NO == 0 (to allow if (GNUNET_NO)) GNUNET_OK != GNUNET_SYSERR, GNUNET_OK != GNUNET_NO, GNUNET_NO != GNUNET_SYSERR and finally GNUNET_YES != GNUNET_NO.

Enumerator
GNUNET_SYSERR 
GNUNET_NO 
GNUNET_OK 
GNUNET_YES 

Definition at line 83 of file gnunet_common.h.

84 {
85  GNUNET_SYSERR = -1,
86  GNUNET_NO = 0,
87  GNUNET_OK = 1,
88  /* intentionally identical to #GNUNET_OK! */
89  GNUNET_YES = 1,
90 };

◆ GNUNET_SCHEDULER_Priority

Valid task priorities.

Use these, do not pass random integers! For various reasons (#3862 – building with QT Creator, and our restricted cross-compilation with emscripten) this cannot be in gnunet_scheduler_lib.h, but it works if we declare it here. Naturally, logically this is part of the scheduler.

Enumerator
GNUNET_SCHEDULER_PRIORITY_KEEP 

Run with the same priority as the current job.

GNUNET_SCHEDULER_PRIORITY_IDLE 

Run when otherwise idle.

GNUNET_SCHEDULER_PRIORITY_BACKGROUND 

Run as background job (higher than idle, lower than default).

GNUNET_SCHEDULER_PRIORITY_DEFAULT 

Run with the default priority (normal P2P operations).

Any task that is scheduled without an explicit priority being specified will run with this priority.

GNUNET_SCHEDULER_PRIORITY_HIGH 

Run with high priority (important requests).

Higher than DEFAULT.

GNUNET_SCHEDULER_PRIORITY_UI 

Run with priority for interactive tasks.

Higher than "HIGH".

GNUNET_SCHEDULER_PRIORITY_URGENT 

Run with priority for urgent tasks.

Use for things like aborts and shutdowns that need to preempt "UI"-level tasks. Higher than "UI".

GNUNET_SCHEDULER_PRIORITY_SHUTDOWN 

This is an internal priority level that is only used for tasks that are being triggered due to shutdown (they have automatically highest priority).

User code must not use this priority level directly. Tasks run with this priority level that internally schedule other tasks will see their original priority level be inherited (unless otherwise specified).

GNUNET_SCHEDULER_PRIORITY_COUNT 

Number of priorities (must be the last priority).

This priority must not be used by clients.

Definition at line 1707 of file gnunet_common.h.

1708 {
1713 
1718 
1724 
1732 
1738 
1744 
1752 
1762 
1768 };
Run with high priority (important requests).
Run with the same priority as the current job.
Run as background job (higher than idle, lower than default).
Run with priority for interactive tasks.
Run when otherwise idle.
This is an internal priority level that is only used for tasks that are being triggered due to shutdo...
Run with priority for urgent tasks.
Number of priorities (must be the last priority).
Run with the default priority (normal P2P operations).

Function Documentation

◆ GNUNET_get_log_call_status()

int GNUNET_get_log_call_status ( int  caller_level,
const char *  comp,
const char *  file,
const char *  function,
int  line 
)

Decides whether a particular logging call should or should not be allowed to be made.

Used internally by GNUNET_log*()

Parameters
caller_levelloglevel the caller wants to use
compcomponent name the caller uses (NULL means that global component name is used)
filefile name containing the logging call, usually FILE
functionfunction which tries to make a logging call, usually FUNCTION
lineline at which the call is made, usually LINE
Returns
0 to disallow the call, 1 to allow it

Definition at line 479 of file common_logging.c.

References component_nopid, LogDef::component_regex, LogDef::file_regex, LogDef::force, LogDef::from_line, LogDef::function_regex, GNUNET_ERROR_TYPE_MESSAGE, gnunet_force_log_present, GNUNET_NO, LogDef::level, logdefs_len, min_level, and LogDef::to_line.

Referenced by GCC_debug(), GCCH_debug(), GCT_debug(), and get_nick_record().

484 {
485  struct LogDef *ld;
486  int i;
487  int force_only;
488 
489  if (NULL == comp)
490  /* Use default component */
491  comp = component_nopid;
492 
493  /* We have no definitions to override globally configured log level,
494  * so just use it right away.
495  */
496  if ((min_level >= 0) && (GNUNET_NO == gnunet_force_log_present))
497  return caller_level <= min_level;
498 
499  /* Only look for forced definitions? */
500  force_only = min_level >= 0;
501  for (i = 0; i < logdefs_len; i++)
502  {
503  ld = &logdefs[i];
504  if (((! force_only) || ld->force) &&
505  ((line >= ld->from_line) && (line <= ld->to_line) ) &&
506  (0 == regexec (&ld->component_regex, comp, 0, NULL, 0)) &&
507  (0 == regexec (&ld->file_regex, file, 0, NULL, 0)) &&
508  (0 == regexec (&ld->function_regex, function, 0, NULL, 0)))
509  {
510  /* We're finished */
511  return caller_level <= ld->level;
512  }
513  }
514  /* No matches - use global level, if defined */
515  if (min_level >= 0)
516  return caller_level <= min_level;
517  /* All programs/services previously defaulted to WARNING.
518  * Now *we* default to WARNING, and THEY default to NULL.
519  * Or rather we default to MESSAGE, since things aren't always bad.
520  */
521  return caller_level <= GNUNET_ERROR_TYPE_MESSAGE;
522 }
static int logdefs_len
The number of units used in logdefs array.
static struct LogDef * logdefs
Dynamic array of logging definitions.
int force
1 if this definition comes from GNUNET_FORCE_LOG, which means that it overrides any configuration opt...
int to_line
Highest line at which this definition matches.
int from_line
Lowest line at which this definition matches.
static char * line
Desired phone line (string to be converted to a hash).
static int gnunet_force_log_present
GNUNET_YES if at least one definition with forced == 1 is available.
regex_t function_regex
Function name regex.
regex_t component_regex
Component name regex.
Represents a single logging definition.
regex_t file_regex
File name regex.
static enum GNUNET_ErrorType min_level
Minimum log level.
int level
Maximal log level allowed for calls that match this definition.
static char * component_nopid
Running component (without pid).
Here is the caller graph for this function:

◆ GNUNET_htonll()

uint64_t GNUNET_htonll ( uint64_t  n)

Convert unsigned 64-bit integer to network byte order.

Parameters
nThe value in host byte order.
Returns
The same value in network byte order.

Definition at line 36 of file common_endian.c.

Referenced by abd_string_to_value(), block_proc(), change_service(), commit_set(), consider_sending_fc(), create_loc_uri(), determine_id(), GCCH_handle_channel_plaintext_data_ack(), GNUNET_ABD_delegate_issue(), GNUNET_ABD_delegate_serialize(), GNUNET_ABD_delegates_serialize(), GNUNET_ARM_request_service_list(), GNUNET_BIO_write_int64(), GNUNET_DATASTORE_get_key(), GNUNET_DATASTORE_get_zero_anonymity(), GNUNET_DATASTORE_reserve(), GNUNET_FS_tree_encoder_next(), GNUNET_GNSRECORD_records_serialize(), GNUNET_hton_double(), GNUNET_NAMESTORE_zone_iterator_next(), GNUNET_NAMESTORE_zone_monitor_next(), GNUNET_RECLAIM_attestation_store(), GNUNET_RECLAIM_attribute_store(), GNUNET_REVOCATION_pow_round(), GNUNET_TESTBED_controller_connect(), GNUNET_TESTBED_controller_link(), GNUNET_TESTBED_generate_peergetconfig_msg_(), GNUNET_TESTBED_generate_slavegetconfig_msg_(), GNUNET_TIME_absolute_hton(), GNUNET_TIME_relative_hton(), GST_send_operation_fail_msg(), GST_send_operation_success_msg(), hash_for_index_cb(), notify_change(), opstart_manage_service(), opstart_overlay_connect(), opstart_peer_create(), opstart_peer_destroy(), opstart_peer_reconfigure(), opstart_peer_start(), opstart_peer_stop(), opstart_shutdown_peers(), p2_controller_connect_cb(), qconv_abs_time(), qconv_rel_time(), qconv_uint64(), run(), save(), send_ack(), send_add_queue(), send_channel_data_ack(), send_client_done(), send_client_element(), send_controller_link_response(), send_hello_thru_rocc(), send_overlay_connect_success_msg(), send_update_queue(), signal_result(), transmit(), transmit_item(), transmit_set(), unindex_process(), union_accept(), uri_chk_parse(), and uri_loc_parse().

37 {
38 #if __BYTE_ORDER == __BIG_ENDIAN
39  return n;
40 #elif __BYTE_ORDER == __LITTLE_ENDIAN
41  return (((uint64_t) htonl (n)) << 32) + htonl (n >> 32);
42 #else
43  #error byteorder undefined
44 #endif
45 }

◆ GNUNET_ntohll()

uint64_t GNUNET_ntohll ( uint64_t  n)

Convert unsigned 64-bit integer to host byte order.

Parameters
nThe value in network byte order.
Returns
The same value in host byte order.

Definition at line 53 of file common_endian.c.

Referenced by abd_value_to_string(), backward_resolution(), cb_intersection_element_removed(), cmp_pow_value(), copy_element_cb(), extract_abs_time(), extract_rel_time(), extract_uint64(), find_proof(), forward_overlay_connect(), GNUNET_ABD_delegate_deserialize(), GNUNET_ABD_delegates_deserialize(), GNUNET_BIO_read_int64(), GNUNET_FRAGMENT_print_ack(), GNUNET_FRAGMENT_process_ack(), GNUNET_FS_handle_on_demand_block(), GNUNET_FS_publish_stop(), GNUNET_FS_uri_chk_get_file_size(), GNUNET_GNSRECORD_records_deserialize(), GNUNET_ntoh_double(), GNUNET_REVOCATION_check_pow(), GNUNET_TIME_absolute_ntoh(), GNUNET_TIME_relative_ntoh(), GNUNET_xfree_(), GNUNET_xrealloc_(), handle_add_queue_message(), handle_alice_client_message(), handle_arm_list_result(), handle_arm_result(), handle_attestation_store_message(), handle_attribute_store_message(), handle_bob_client_message(), handle_client_index_start(), handle_client_loc_sign(), handle_data(), handle_flow_control(), handle_get(), handle_get_key(), handle_get_zero_anonymity(), handle_iteration_next(), handle_link_controllers(), handle_link_controllers_result(), handle_manage_peer_service(), handle_monitor_next(), handle_op_fail_event(), handle_opsuccess(), handle_overlay_connect(), handle_peer_conevent(), handle_peer_config(), handle_peer_create(), handle_peer_create_success(), handle_peer_destroy(), handle_peer_event(), handle_peer_get_config(), handle_peer_reconfigure(), handle_peer_start(), handle_peer_stop(), handle_remote_overlay_connect(), handle_reserve(), handle_result(), handle_set(), handle_shutdown_peers(), handle_slave_config(), handle_slave_get_config(), handle_start(), handle_statistics_value(), handle_statistics_watch_value(), handle_stop(), handle_union_p2p_strata_estimator(), handle_update_queue_message(), process_result_with_request(), reconstruct_cb(), set_result_cb(), try_match_block(), uri_chk_to_string(), uri_loc_to_string(), and verify_message_crypto().

54 {
55 #if __BYTE_ORDER == __BIG_ENDIAN
56  return n;
57 #elif __BYTE_ORDER == __LITTLE_ENDIAN
58  return (((uint64_t) ntohl (n)) << 32) + ntohl (n >> 32);
59 #else
60  #error byteorder undefined
61 #endif
62 }

◆ GNUNET_hton_double()

double GNUNET_hton_double ( double  d)

Convert double to network byte order.

Parameters
dThe value in host byte order.
Returns
The same value in network byte order.

Convert double to network byte order.

Parameters
dthe value in network byte order
Returns
the same value in host byte order

Definition at line 74 of file common_endian.c.

References GNUNET_htonll(), and res.

Referenced by setup_estimate_message().

75 {
76  double res;
77  uint64_t *in = (uint64_t *) &d;
78  uint64_t *out = (uint64_t *) &res;
79 
80  out[0] = GNUNET_htonll (in[0]);
81 
82  return res;
83 }
static int res
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
Definition: common_endian.c:36
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ntoh_double()

double GNUNET_ntoh_double ( double  d)

Convert double to host byte order.

Parameters
dThe value in network byte order.
Returns
The same value in host byte order.

Convert double to host byte order.

Parameters
dthe value in network byte order
Returns
the same value in host byte order

Definition at line 92 of file common_endian.c.

References GNUNET_ntohll(), and res.

Referenced by handle_estimate().

93 {
94  double res;
95  uint64_t *in = (uint64_t *) &d;
96  uint64_t *out = (uint64_t *) &res;
97 
98  out[0] = GNUNET_ntohll (in[0]);
99 
100  return res;
101 }
static int res
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:53
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_memcmp_ct_()

int GNUNET_memcmp_ct_ ( const void *  b1,
const void *  b2,
size_t  len 
)

Compare memory in b1 and b2 in constant time, suitable for private data.

Parameters
b1some buffer of size len
b2another buffer of size len
lennumber of bytes in b1 and b2
Returns
0 if buffers are equal,

Definition at line 130 of file consttime_memcmp.c.

References len, and m.

131 {
132  const uint8_t *c1, *c2;
133  uint16_t d, r, m;
134 
135 #if USE_VOLATILE_TEMPORARY
136  volatile uint16_t v;
137 #else
138  uint16_t v;
139 #endif
140 
141  c1 = b1;
142  c2 = b2;
143 
144  r = 0;
145  while (len)
146  {
147  /*
148  * Take the low 8 bits of r (in the range 0x00 to 0xff,
149  * or 0 to 255);
150  * As explained elsewhere, the low 8 bits of r will be zero
151  * if and only if all bytes compared so far were identical;
152  * Zero-extend to a 16-bit type (in the range 0x0000 to
153  * 0x00ff);
154  * Add 255, yielding a result in the range 255 to 510;
155  * Save that in a volatile variable to prevent
156  * the compiler from trying any shortcuts (the
157  * use of a volatile variable depends on "#ifdef
158  * USE_VOLATILE_TEMPORARY", and most compilers won't
159  * need it);
160  * Divide by 256 yielding a result of 1 if the original
161  * value of r was non-zero, or 0 if r was zero;
162  * Subtract 1, yielding 0 if r was non-zero, or -1 if r
163  * was zero;
164  * Convert to uint16_t, yielding 0x0000 if r was
165  * non-zero, or 0xffff if r was zero;
166  * Save in m.
167  */v = ((uint16_t) (uint8_t) r) + 255;
168  m = v / 256 - 1;
169 
170  /*
171  * Get the values from *c1 and *c2 as uint8_t (each will
172  * be in the range 0 to 255, or 0x00 to 0xff);
173  * Convert them to signed int values (still in the
174  * range 0 to 255);
175  * Subtract them using signed arithmetic, yielding a
176  * result in the range -255 to +255;
177  * Convert to uint16_t, yielding a result in the range
178  * 0xff01 to 0xffff (for what was previously -255 to
179  * -1), or 0, or in the range 0x0001 to 0x00ff (for what
180  * was previously +1 to +255).
181  */d = (uint16_t) ((int) *c1 - (int) *c2);
182 
183  /*
184  * If the low 8 bits of r were previously 0, then m
185  * is now 0xffff, so (d & m) is the same as d, so we
186  * effectively copy d to r;
187  * Otherwise, if r was previously non-zero, then m is
188  * now 0, so (d & m) is zero, so leave r unchanged.
189  * Note that the low 8 bits of d will be zero if and
190  * only if d == 0, which happens when *c1 == *c2.
191  * The low 8 bits of r are thus zero if and only if the
192  * entirety of r is zero, which happens if and only if
193  * all bytes compared so far were equal. As soon as a
194  * non-zero value is stored in r, it remains unchanged
195  * for the remainder of the loop.
196  */r |= (d & m);
197 
198  /*
199  * Increment pointers, decrement length, and loop.
200  */
201  ++c1;
202  ++c2;
203  --len;
204  }
205 
206  /*
207  * At this point, r is an unsigned value, which will be 0 if the
208  * final result should be zero, or in the range 0x0001 to 0x00ff
209  * (1 to 255) if the final result should be positive, or in the
210  * range 0xff01 to 0xffff (65281 to 65535) if the final result
211  * should be negative.
212  *
213  * We want to convert the unsigned values in the range 0xff01
214  * to 0xffff to signed values in the range -255 to -1, while
215  * converting the other unsigned values to equivalent signed
216  * values (0, or +1 to +255).
217  *
218  * On a machine with two's complement arithmetic, simply copying
219  * the underlying bits (with sign extension if int is wider than
220  * 16 bits) would do the job, so something like this might work:
221  *
222  * return (int16_t)r;
223  *
224  * However, that invokes implementation-defined behaviour,
225  * because values larger than 32767 can't fit in a signed 16-bit
226  * integer without overflow.
227  *
228  * To avoid any implementation-defined behaviour, we go through
229  * these contortions:
230  *
231  * a. Calculate ((uint32_t)r + 0x8000). The cast to uint32_t
232  * it to prevent problems on platforms where int is narrower
233  * than 32 bits. If int is a larger than 32-bits, then the
234  * usual arithmetic conversions cause this addition to be
235  * done in unsigned int arithmetic. If int is 32 bits
236  * or narrower, then this addition is done in uint32_t
237  * arithmetic. In either case, no overflow or wraparound
238  * occurs, and the result from this step has a value that
239  * will be one of 0x00008000 (32768), or in the range
240  * 0x00008001 to 0x000080ff (32769 to 33023), or in the range
241  * 0x00017f01 to 0x00017fff (98049 to 98303).
242  *
243  * b. Cast the result from (a) to uint16_t. This effectively
244  * discards the high bits of the result, in a way that is
245  * well defined by the C language. The result from this step
246  * will be of type uint16_t, and its value will be one of
247  * 0x8000 (32768), or in the range 0x8001 to 0x80ff (32769 to
248  * 33023), or in the range 0x7f01 to 0x7fff (32513 to
249  * 32767).
250  *
251  * c. Cast the result from (b) to int32_t. We use int32_t
252  * instead of int because we need a type that's strictly
253  * larger than 16 bits, and the C standard allows
254  * implementations where int is only 16 bits. The result
255  * from this step will be of type int32_t, and its value wll
256  * be one of 0x00008000 (32768), or in the range 0x00008001
257  * to 0x000080ff (32769 to 33023), or in the range 0x00007f01
258  * to 0x00007fff (32513 to 32767).
259  *
260  * d. Take the result from (c) and subtract 0x8000 (32768) using
261  * signed int32_t arithmetic. The result from this step will
262  * be of type int32_t and the value will be one of
263  * 0x00000000 (0), or in the range 0x00000001 to 0x000000ff
264  * (+1 to +255), or in the range 0xffffff01 to 0xffffffff
265  * (-255 to -1).
266  *
267  * e. Cast the result from (d) to int. This does nothing
268  * interesting, except to make explicit what would have been
269  * implicit in the return statement. The final result is an
270  * int in the range -255 to +255.
271  *
272  * Unfortunately, compilers don't seem to be good at figuring
273  * out that most of this can be optimised away by careful choice
274  * of register width and sign extension.
275  *
276  */return (/*e*/ int) (/*d*/
277  (/*c*/ int32_t) (/*b*/ uint16_t) (/*a*/ (uint32_t) r + 0x8000)
278  - 0x8000);
279 }
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
Definition: gnunet-arm.c:104
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...

◆ GNUNET_is_zero_()

int GNUNET_is_zero_ ( const void *  a,
size_t  n 
)

Check that memory in a is all zeros.

a must be a pointer.

Parameters
apointer to n bytes which should be tested for the entire memory being zero'ed out.
nnumber of bytes in to be tested
Returns
0 if a is zero, non-zero otherwise

Definition at line 544 of file common_allocation.c.

References testconfigure::b.

546 {
547  const char *b = a;
548 
549  for (size_t i = 0; i < n; i++)
550  if (b[i])
551  return 1;
552  return 0;
553 }

◆ GNUNET_xmalloc_()

void* GNUNET_xmalloc_ ( size_t  size,
const char *  filename,
int  linenumber 
)

Allocate memory.

Checks the return value, aborts if no more memory is available. Don't use GNUNET_xmalloc_ directly. Use the GNUNET_malloc macro. The memory will be zero'ed out.

Parameters
sizenumber of bytes to allocate
filenamewhere is this call being made (for debugging)
linenumberline where this call is being made (for debugging)
Returns
allocated memory, never NULL

Checks the return value, aborts if no more memory is available.

Parameters
sizehow many bytes of memory to allocate, do NOT use this function (or GNUNET_malloc()) to allocate more than several MB of memory, if you are possibly needing a very large chunk use GNUNET_xmalloc_unchecked_() instead.
filenamewhere in the code was the call to GNUNET_malloc()
linenumberwhere in the code was the call to GNUNET_malloc()
Returns
pointer to size bytes of memory

Definition at line 66 of file common_allocation.c.

References GNUNET_assert, GNUNET_assert_at, GNUNET_ERROR_TYPE_ERROR, GNUNET_MAX_MALLOC_CHECKED, GNUNET_xmalloc_unchecked_(), LOG_STRERROR, and ret.

Referenced by GNUNET_xgrow_(), GNUNET_xnew_array_2d_(), GNUNET_xnew_array_3d_(), GNUNET_xstrdup_(), and GNUNET_xstrndup_().

67 {
68  void *ret;
69 
70  /* As a security precaution, we generally do not allow very large
71  * allocations using the default 'GNUNET_malloc()' macro */
73  ret = GNUNET_xmalloc_unchecked_ (size, filename, linenumber);
74  if (NULL == ret)
75  {
77  GNUNET_assert (0);
78  }
79  return ret;
80 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
static char * filename
#define LOG_STRERROR(kind, syscall)
void * GNUNET_xmalloc_unchecked_(size_t size, const char *filename, int linenumber)
Wrapper around malloc().
static unsigned int size
Size of the "table".
Definition: peer.c:67
#define GNUNET_MAX_MALLOC_CHECKED
Maximum allocation with GNUNET_malloc macro.
#define GNUNET_assert_at(cond, f, l)
Use this for fatal errors that cannot be handled.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_xnew_array_2d_()

void** GNUNET_xnew_array_2d_ ( size_t  n,
size_t  m,
size_t  elementSize,
const char *  filename,
int  linenumber 
)

Allocate memory for a two dimensional array in one block and set up pointers.

Aborts if no more memory is available. Don't use GNUNET_xnew_array_2d_ directly. Use the GNUNET_new_array_2d macro. The memory of the elements will be zero'ed out.

Parameters
nsize of the first dimension
msize of the second dimension
elementSizesize of a single element in bytes
filenamewhere is this call being made (for debugging)
linenumberline where this call is being made (for debugging)
Returns
allocated memory, never NULL

Definition at line 98 of file common_allocation.c.

References GNUNET_xmalloc_(), and ret.

103 {
104  /* use char pointer internally to avoid void pointer arithmetic warnings */
105  char **ret = GNUNET_xmalloc_ (n * sizeof(void *) /* 1. dim header */
106  + n * m * elementSize, /* element data */
107  filename,
108  linenumber);
109 
110  for (size_t i = 0; i < n; i++)
111  ret[i] = (char *) ret /* base address */
112  + n * sizeof(void *) /* skip 1. dim header */
113  + i * m * elementSize; /* skip to 2. dim row header */
114  return (void **) ret;
115 }
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
void * GNUNET_xmalloc_(size_t size, const char *filename, int linenumber)
Allocate memory.
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
Definition: gnunet-arm.c:104
static char * filename
Here is the call graph for this function:

◆ GNUNET_xnew_array_3d_()

void*** GNUNET_xnew_array_3d_ ( size_t  n,
size_t  m,
size_t  o,
size_t  elementSize,
const char *  filename,
int  linenumber 
)

Allocate memory for a three dimensional array in one block and set up pointers.

Aborts if no more memory is available. Don't use GNUNET_xnew_array_3d_ directly. Use the GNUNET_new_array_3d macro. The memory of the elements will be zero'ed out.

Parameters
nsize of the first dimension
msize of the second dimension
osize of the third dimension
elementSizesize of a single element in bytes
filenamewhere is this call being made (for debugging)
linenumberline where this call is being made (for debugging)
Returns
allocated memory, never NULL

Definition at line 134 of file common_allocation.c.

References GNUNET_xmalloc_(), m, and ret.

140 {
141  /* use char pointer internally to avoid void pointer arithmetic warnings */
142  char ***ret = GNUNET_xmalloc_ (n * sizeof(void **) /* 1. dim header */
143  + n * m * sizeof(void *) /* 2. dim header */
144  + n * m * o * elementSize, /* element data */
145  filename,
146  linenumber);
147 
148  for (size_t i = 0; i < n; i++)
149  {
150  /* need to cast to (char *) temporarily for byte level acuracy */
151  ret[i] = (char **) ((char *) ret /* base address */
152  + n * sizeof(void **) /* skip 1. dim header */
153  + i * m * sizeof(void *)); /* skip to 2. dim header */
154  for (size_t j = 0; j < m; j++)
155  ret[i][j] = (char *) ret /* base address */
156  + n * sizeof(void **) /* skip 1. dim header */
157  + n * m * sizeof(void *) /* skip 2. dim header */
158  + i * m * o * elementSize /* skip to 2. dim part */
159  + j * o * elementSize; /* skip to 3. dim row data */
160  }
161  return (void ***) ret;
162 }
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
void * GNUNET_xmalloc_(size_t size, const char *filename, int linenumber)
Allocate memory.
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
Definition: gnunet-arm.c:104
static char * filename
Here is the call graph for this function:

◆ GNUNET_xmemdup_()

void* GNUNET_xmemdup_ ( const void *  buf,
size_t  size,
const char *  filename,
int  linenumber 
)

Allocate and initialize memory.

Checks the return value, aborts if no more memory is available. Don't use GNUNET_xmemdup_ directly. Use the GNUNET_memdup macro.

Parameters
bufbuffer to initialize from (must contain size bytes)
sizenumber of bytes to allocate
filenamewhere is this call being made (for debugging)
linenumberline where this call is being made (for debugging)
Returns
allocated memory, never NULL

Checks the return value, aborts if no more memory is available. Don't use GNUNET_xmemdup_() directly. Use the GNUNET_memdup() macro.

Parameters
bufbuffer to initialize from (must contain size bytes)
sizenumber of bytes to allocate
filenamewhere is this call being made (for debugging)
linenumberline where this call is being made (for debugging)
Returns
allocated memory, never NULL

Definition at line 177 of file common_allocation.c.

References GNUNET_assert, GNUNET_assert_at, GNUNET_ERROR_TYPE_ERROR, GNUNET_MAX_MALLOC_CHECKED, GNUNET_memcpy, INT_MAX, LOG_STRERROR, ret, and size.

181 {
182  void *ret;
183 
184  /* As a security precaution, we generally do not allow very large
185  * allocations here */
187 #ifdef W32_MEM_LIMIT
188  size += sizeof(size_t);
189  if (mem_used + size > W32_MEM_LIMIT)
190  return NULL;
191 #endif
192  GNUNET_assert_at (size < INT_MAX, filename, linenumber);
193  ret = malloc (size);
194  if (ret == NULL)
195  {
197  GNUNET_assert (0);
198  }
199 #ifdef W32_MEM_LIMIT
200  *((size_t *) ret) = size;
201  ret = &((size_t *) ret)[1];
202  mem_used += size;
203 #endif
204  GNUNET_memcpy (ret, buf, size);
205  return ret;
206 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
#define INT_MAX
static char buf[2048]
static char * filename
#define LOG_STRERROR(kind, syscall)
static unsigned int size
Size of the "table".
Definition: peer.c:67
#define GNUNET_MAX_MALLOC_CHECKED
Maximum allocation with GNUNET_malloc macro.
#define GNUNET_assert_at(cond, f, l)
Use this for fatal errors that cannot be handled.

◆ GNUNET_xmalloc_unchecked_()

void* GNUNET_xmalloc_unchecked_ ( size_t  size,
const char *  filename,
int  linenumber 
)

Allocate memory.

This function does not check if the allocation request is within reasonable bounds, allowing allocations larger than 40 MB. If you don't expect the possibility of very large allocations, use GNUNET_malloc instead. The memory will be zero'ed out.

Parameters
sizenumber of bytes to allocate
filenamewhere is this call being made (for debugging)
linenumberline where this call is being made (for debugging)
Returns
pointer to size bytes of memory, NULL if we do not have enough memory

Allocate memory.

Allocates size bytes of memory. The memory will be zero'ed out.

Parameters
sizethe number of bytes to allocate
filenamewhere in the code was the call to GNUNET_malloc_unchecked()
linenumberwhere in the code was the call to GNUNET_malloc_unchecked()
Returns
pointer to size bytes of memory, NULL if we do not have enough memory

Definition at line 219 of file common_allocation.c.

References result, and size.

Referenced by GNUNET_xmalloc_().

220 {
221  void *result;
222 
223  (void) filename;
224  (void) linenumber;
225 #ifdef W32_MEM_LIMIT
226  size += sizeof(size_t);
227  if (mem_used + size > W32_MEM_LIMIT)
228  return NULL;
229 #endif
230 
231  result = malloc (size);
232  if (NULL == result)
233  return NULL;
234  memset (result, 0, size);
235 
236 #ifdef W32_MEM_LIMIT
237  *((size_t *) result) = size;
238  result = &((size_t *) result)[1];
239  mem_used += size;
240 #endif
241 
242  return result;
243 }
static char * filename
static int result
Global testing status.
static unsigned int size
Size of the "table".
Definition: peer.c:67
Here is the caller graph for this function:

◆ GNUNET_xrealloc_()

void* GNUNET_xrealloc_ ( void *  ptr,
size_t  n,
const char *  filename,
int  linenumber 
)

Reallocate memory.

Checks the return value, aborts if no more memory is available.

Checks the return value, aborts if no more memory is available. The content of the intersection of the new and old size will be unchanged.

Parameters
ptrthe pointer to reallocate
nhow many bytes of memory to allocate
filenamewhere in the code was the call to GNUNET_realloc()
linenumberwhere in the code was the call to GNUNET_realloc()
Returns
pointer to size bytes of memory

Definition at line 258 of file common_allocation.c.

References GNUNET_assert, GNUNET_ERROR_TYPE_ERROR, GNUNET_memcpy, GNUNET_MIN, GNUNET_ntohll(), and LOG_STRERROR.

259 {
260  (void) filename;
261  (void) linenumber;
262 
263 #ifdef W32_MEM_LIMIT
264  n += sizeof(size_t);
265  ptr = &((size_t *) ptr)[-1];
266  mem_used = mem_used - *((size_t *) ptr) + n;
267 #endif
268 #if defined(M_SIZE)
269 #if ENABLE_POISONING
270  {
271  uint64_t *base = ptr;
272  size_t s = M_SIZE (ptr);
273 
274  if (s > n)
275  {
276  const uint64_t baadfood = GNUNET_ntohll (0xBAADF00DBAADF00DLL);
277  char *cbase = ptr;
278 
279  GNUNET_memcpy (&cbase[n],
280  &baadfood,
281  GNUNET_MIN (8 - (n % 8),
282  s - n));
283  for (size_t i = 1 + (n + 7) / 8; i < s / 8; i++)
284  base[i] = baadfood;
285  GNUNET_memcpy (&base[s / 8],
286  &baadfood,
287  s % 8);
288  }
289  }
290 #endif
291 #endif
292  ptr = realloc (ptr, n);
293  if ((NULL == ptr) && (n > 0))
294  {
296  GNUNET_assert (0);
297  }
298 #ifdef W32_MEM_LIMIT
299  ptr = &((size_t *) ptr)[1];
300 #endif
301  return ptr;
302 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_MIN(a, b)
Definition: gnunet_common.h:93
static char * filename
#define LOG_STRERROR(kind, syscall)
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:53
Here is the call graph for this function:

◆ GNUNET_xfree_()

void GNUNET_xfree_ ( void *  ptr,
const char *  filename,
int  linenumber 
)

Free memory.

Merely a wrapper for the case that we want to keep track of allocations. Don't use GNUNET_xfree_ directly. Use the GNUNET_free macro.

Parameters
ptrpointer to memory to free
filenamewhere is this call being made (for debugging)
linenumberline where this call is being made (for debugging)

Merely a wrapper for the case that we want to keep track of allocations.

Parameters
ptrthe pointer to free
filenamewhere in the code was the call to GNUNET_free()
linenumberwhere in the code was the call to GNUNET_free()

Definition at line 330 of file common_allocation.c.

References GNUNET_memcpy, and GNUNET_ntohll().

Referenced by GNUNET_xgrow_().

331 {
332 #ifdef W32_MEM_LIMIT
333  ptr = &((size_t *) ptr)[-1];
334  mem_used -= *((size_t *) ptr);
335 #endif
336 #if defined(M_SIZE)
337 #if ENABLE_POISONING
338  {
339  const uint64_t baadfood = GNUNET_ntohll (0xBAADF00DBAADF00DLL);
340  uint64_t *base = ptr;
341  size_t s = M_SIZE (ptr);
342 
343  for (size_t i = 0; i < s / 8; i++)
344  base[i] = baadfood;
345  GNUNET_memcpy (&base[s / 8], &baadfood, s % 8);
346  }
347 #endif
348 #endif
349  free (ptr);
350 }
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:53
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_xstrdup_()

char* GNUNET_xstrdup_ ( const char *  str,
const char *  filename,
int  linenumber 
)

Dup a string.

Don't call GNUNET_xstrdup_ directly. Use the GNUNET_strdup macro.

Parameters
strstring to duplicate
filenamewhere is this call being made (for debugging)
linenumberline where this call is being made (for debugging)
Returns
the duplicated string

Dup a string.

Parameters
strthe string to dup
filenamewhere in the code was the call to GNUNET_strdup()
linenumberwhere in the code was the call to GNUNET_strdup()
Returns
strdup(@a str)

Definition at line 362 of file common_allocation.c.

References GNUNET_assert_at, GNUNET_memcpy, GNUNET_xmalloc_(), and res.

363 {
364  char *res;
365  size_t slen;
366 
367  GNUNET_assert_at (str != NULL, filename, linenumber);
368  slen = strlen (str) + 1;
369  res = GNUNET_xmalloc_ (slen, filename, linenumber);
370  GNUNET_memcpy (res, str, slen);
371  return res;
372 }
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
void * GNUNET_xmalloc_(size_t size, const char *filename, int linenumber)
Allocate memory.
static char * filename
static int res
#define GNUNET_assert_at(cond, f, l)
Use this for fatal errors that cannot be handled.
Here is the call graph for this function:

◆ GNUNET_xstrndup_()

char* GNUNET_xstrndup_ ( const char *  str,
size_t  len,
const char *  filename,
int  linenumber 
)

Dup partially a string.

Don't call GNUNET_xstrndup_ directly. Use the GNUNET_strndup macro.

Parameters
strstring to duplicate
lenlength of the string to duplicate
filenamewhere is this call being made (for debugging)
linenumberline where this call is being made (for debugging)
Returns
the duplicated string

Dup partially a string.

Parameters
strthe string to dup
lenthe length of the string to dup
filenamewhere in the code was the call to GNUNET_strndup()
linenumberwhere in the code was the call to GNUNET_strndup()
Returns
strndup(@a str,@a len)

Definition at line 401 of file common_allocation.c.

References GNUNET_assert_at, GNUNET_memcpy, GNUNET_strdup, GNUNET_xmalloc_(), res, and strnlen().

405 {
406  char *res;
407 
408  if (0 == len)
409  return GNUNET_strdup ("");
410  GNUNET_assert_at (NULL != str, filename, linenumber);
411  len = strnlen (str, len);
412  res = GNUNET_xmalloc_ (len + 1, filename, linenumber);
413  GNUNET_memcpy (res, str, len);
414  /* res[len] = '\0'; 'malloc' zeros out anyway */
415  return res;
416 }
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
void * GNUNET_xmalloc_(size_t size, const char *filename, int linenumber)
Allocate memory.
static char * filename
static int res
#define GNUNET_assert_at(cond, f, l)
Use this for fatal errors that cannot be handled.
static size_t strnlen(const char *s, size_t n)
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
Here is the call graph for this function:

◆ GNUNET_xgrow_()

void GNUNET_xgrow_ ( void **  old,
size_t  elementSize,
unsigned int *  oldCount,
unsigned int  newCount,
const char *  filename,
int  linenumber 
)

Grow an array, the new elements are zeroed out.

Grows old by (*oldCount-newCount)*elementSize bytes and sets *oldCount to newCount.

Don't call GNUNET_xgrow_ directly. Use the GNUNET_array_grow macro.

Parameters
oldaddress of the pointer to the array *old may be NULL
elementSizethe size of the elements of the array
oldCountaddress of the number of elements in the *old array
newCountnumber of elements in the new array, may be 0 (then *old will be NULL afterwards)
filenamewhere is this call being made (for debugging)
linenumberline where this call is being made (for debugging)

Grow an array, the new elements are zeroed out.

Grows old by (*oldCount-newCount)*elementSize bytes and sets *oldCount to newCount.

Parameters
oldaddress of the pointer to the array *old may be NULL
elementSizethe size of the elements of the array
oldCountaddress of the number of elements in the *old array
newCountnumber of elements in the new array, may be 0
filenamewhere in the code was the call to GNUNET_array_grow()
linenumberwhere in the code was the call to GNUNET_array_grow()

Definition at line 432 of file common_allocation.c.

References GNUNET_assert_at, GNUNET_memcpy, GNUNET_MIN, GNUNET_xfree_(), GNUNET_xmalloc_(), INT_MAX, and size.

438 {
439  void *tmp;
440  size_t size;
441 
442  GNUNET_assert_at (INT_MAX / elementSize > newCount, filename, linenumber);
443  size = newCount * elementSize;
444  if (0 == size)
445  {
446  tmp = NULL;
447  }
448  else
449  {
450  tmp = GNUNET_xmalloc_ (size, filename, linenumber);
451  if (NULL != *old)
452  {
453  GNUNET_memcpy (tmp, *old, elementSize * GNUNET_MIN (*oldCount, newCount));
454  }
455  }
456 
457  if (NULL != *old)
458  {
459  GNUNET_xfree_ (*old, filename, linenumber);
460  }
461  *old = tmp;
462  *oldCount = newCount;
463 }
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
void * GNUNET_xmalloc_(size_t size, const char *filename, int linenumber)
Allocate memory.
#define INT_MAX
#define GNUNET_MIN(a, b)
Definition: gnunet_common.h:93
void GNUNET_xfree_(void *ptr, const char *filename, int linenumber)
Free memory.
static char * filename
static unsigned int size
Size of the "table".
Definition: peer.c:67
#define GNUNET_assert_at(cond, f, l)
Use this for fatal errors that cannot be handled.
Here is the call graph for this function:

◆ GNUNET_async_scope_enter()

void GNUNET_async_scope_enter ( const struct GNUNET_AsyncScopeId aid,
struct GNUNET_AsyncScopeSave old_scope 
)

Set the async scope for the current thread.

Parameters
aidthe async scope identifier
old_scope[out]location to save the old scope

Definition at line 1499 of file common_logging.c.

References current_async_scope, GNUNET_YES, GNUNET_AsyncScopeSave::have_scope, and GNUNET_AsyncScopeSave::scope_id.

Referenced by GNUNET_SCHEDULER_begin_async_scope(), and GNUNET_SCHEDULER_do_work().

1501 {
1502  *old_scope = current_async_scope;
1505 }
static GNUNET_THREAD_LOCAL struct GNUNET_AsyncScopeSave current_async_scope
Asynchronous scope of the current thread, or NULL if we have not entered an async scope yet...
int have_scope
GNUNET_YES unless this saved scope is the unnamed root scope.
struct GNUNET_AsyncScopeId scope_id
Saved scope.
Here is the caller graph for this function:

◆ GNUNET_async_scope_restore()

void GNUNET_async_scope_restore ( struct GNUNET_AsyncScopeSave old_scope)

Clear the current thread's async scope.

Parameters
old_scopescope to restore

Definition at line 1514 of file common_logging.c.

References current_async_scope.

Referenced by GNUNET_SCHEDULER_do_work().

1515 {
1516  current_async_scope = *old_scope;
1517 }
static GNUNET_THREAD_LOCAL struct GNUNET_AsyncScopeSave current_async_scope
Asynchronous scope of the current thread, or NULL if we have not entered an async scope yet...
Here is the caller graph for this function:

◆ GNUNET_async_scope_get()

void GNUNET_async_scope_get ( struct GNUNET_AsyncScopeSave scope_ret)

Get the current async scope.

Parameters
[out]scope_retpointer to where the result is stored

Definition at line 1540 of file common_logging.c.

References current_async_scope.

Referenced by add_without_sets(), GNUNET_SCHEDULER_add_at_with_priority(), GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_add_select(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_do_work(), and setup_job_headers().

1541 {
1542  *scope_ret = current_async_scope;
1543 }
static GNUNET_THREAD_LOCAL struct GNUNET_AsyncScopeSave current_async_scope
Asynchronous scope of the current thread, or NULL if we have not entered an async scope yet...
Here is the caller graph for this function:

◆ GNUNET_async_scope_fresh()

void GNUNET_async_scope_fresh ( struct GNUNET_AsyncScopeId aid_ret)

Generate a fresh async scope identifier.

Parameters
[out]aid_retpointer to where the result is stored

Definition at line 1526 of file common_logging.c.

References GNUNET_CRYPTO_QUALITY_WEAK, and GNUNET_CRYPTO_random_block().

1527 {
1529  aid_ret,
1530  sizeof(struct GNUNET_AsyncScopeId));
1531 }
Identifier for an asynchronous execution context.
void GNUNET_CRYPTO_random_block(enum GNUNET_CRYPTO_Quality mode, void *buffer, size_t length)
Fill block with a random values.
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
Here is the call graph for this function: