GNUnet 0.26.2-114-g7c6b613e3
 
Loading...
Searching...
No Matches
Collaboration diagram for Logging:

Macros

#define GNUNET_EXTRA_LOGGING   1
 define GNUNET_EXTRA_LOGGING if using this header outside the GNUnet source tree where gnunet_config.h is unavailable
 
#define GNUNET_assert(cond)
 Use this for fatal errors that cannot be handled.
 
#define GNUNET_assert_at(cond, f, l)
 Use this for fatal errors that cannot be handled.
 
#define GNUNET_assert_from(cond, comp)
 Use this for fatal errors that cannot be handled.
 
#define GNUNET_break(cond)
 Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
 
#define GNUNET_break_op(cond)
 Use this for assertion violations caused by other peers (i.e.
 
#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).
 
#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).
 
#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).
 
#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).
 

Typedefs

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.
 

Enumerations

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...
 

Functions

int GNUNET_get_log_skip (void)
 Get the number of log calls that are going to be skipped.
 
void GNUNET_log_nocheck (enum GNUNET_ErrorType kind, const char *message,...) __attribute__((format(printf
 Main log function.
 
void GNUNET_log_from_nocheck (enum GNUNET_ErrorType kind, const char *comp, const char *message,...) __attribute__((format(printf
 Log function that specifies an alternative component.
 
void GNUNET_log_config_missing (enum GNUNET_ErrorType kind, const char *section, const char *option)
 Log error message about missing configuration option.
 
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.
 
void GNUNET_abort_ (void) __attribute__((noreturn))
 Abort the process, generate a core dump if possible.
 
void GNUNET_log_skip (int n, int check_reset)
 Ignore the next n calls to the log function.
 
enum GNUNET_GenericReturnValue GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile)
 Setup logging.
 
void GNUNET_logger_add (GNUNET_Logger logger, void *logger_cls)
 Add a custom logger.
 
void GNUNET_logger_remove (GNUNET_Logger logger, void *logger_cls)
 Remove a custom logger.
 
const char * GNUNET_sh2s (const struct GNUNET_ShortHashCode *shc)
 Convert a short hash value to a string (for printing debug messages).
 
const char * GNUNET_uuid2s (const struct GNUNET_Uuid *uuid)
 Convert a UUID to a string (for printing debug messages).
 
const char * GNUNET_h2s (const struct GNUNET_HashCode *hc)
 Convert a hash value to a string (for printing debug messages).
 
const char * GNUNET_h2s2 (const struct GNUNET_HashCode *hc)
 Convert a hash value to a string (for printing debug messages).
 
const char * GNUNET_h2s_full (const struct GNUNET_HashCode *hc)
 Convert a hash value to a string (for printing debug messages).
 
const char * GNUNET_p2s (const struct GNUNET_CRYPTO_EddsaPublicKey *p)
 Convert a public key value to a string (for printing debug messages).
 
const char * GNUNET_p2s2 (const struct GNUNET_CRYPTO_EddsaPublicKey *p)
 Convert a public key value to a string (for printing debug messages).
 
const char * GNUNET_e2s (const struct GNUNET_CRYPTO_EcdhePublicKey *p)
 Convert a public key value to a string (for printing debug messages).
 
const char * GNUNET_e2s2 (const struct GNUNET_CRYPTO_EcdhePublicKey *p)
 Convert a public key value to a string (for printing debug messages).
 
const char * GNUNET_i2s (const struct GNUNET_PeerIdentity *pid)
 Convert a peer identity to a string (for printing debug messages).
 
const char * GNUNET_i2s2 (const struct GNUNET_PeerIdentity *pid)
 Convert a peer identity to a string (for printing debug messages).
 
const char * GNUNET_i2s_full (const struct GNUNET_PeerIdentity *pid)
 Convert a peer identity to a string (for printing debug messages).
 
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).
 
size_t GNUNET_hex2b (const char *src, void *dst, size_t dstlen, int invert)
 Parse an ascii-encoded hexadecimal string into the buffer.
 
void GNUNET_print_bytes (const void *buf, size_t buf_len, int fold, int in_be)
 Print a byte string in hexadecimal ascii notation.
 
const char * GNUNET_error_type_to_string (enum GNUNET_ErrorType kind)
 Convert error type to string.
 

Detailed Description

See also
Documentation

Macro Definition Documentation

◆ GNUNET_EXTRA_LOGGING

#define GNUNET_EXTRA_LOGGING   1

define GNUNET_EXTRA_LOGGING if using this header outside the GNUnet source tree where gnunet_config.h is unavailable

Definition at line 159 of file gnunet_common.h.

◆ GNUNET_assert

#define GNUNET_assert (   cond)
Value:
do \
{ \
if (! (cond)) \
{ \
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
dgettext ("gnunet", \
"Assertion failed at %s:%d. Aborting.\n"), \
__FILE__, \
__LINE__); \
GNUNET_abort_ (); \
} \
} while (0)
#define dgettext(Domainname, Msgid)
Definition gettext.h:51
@ GNUNET_ERROR_TYPE_ERROR

Use this for fatal errors that cannot be handled.

Definition at line 960 of file gnunet_common.h.

962 { \
963 if (! (cond)) \
964 { \
965 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
966 dgettext ("gnunet", \
967 "Assertion failed at %s:%d. Aborting.\n"), \
968 __FILE__, \
969 __LINE__); \
970 GNUNET_abort_ (); \
971 } \
972 } while (0)

◆ GNUNET_assert_at

#define GNUNET_assert_at (   cond,
  f,
 
)
Value:
do \
{ \
if (! (cond)) \
{ \
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
dgettext ("gnunet", \
"Assertion failed at %s:%d. Aborting.\n"), \
f, \
l); \
GNUNET_abort_ (); \
} \
} while (0)

Use this for fatal errors that cannot be handled.

Definition at line 979 of file gnunet_common.h.

981 { \
982 if (! (cond)) \
983 { \
984 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
985 dgettext ("gnunet", \
986 "Assertion failed at %s:%d. Aborting.\n"), \
987 f, \
988 l); \
989 GNUNET_abort_ (); \
990 } \
991 } while (0)

◆ GNUNET_assert_from

#define GNUNET_assert_from (   cond,
  comp 
)
Value:
do \
{ \
if (! (cond)) \
{ \
GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, \
comp, \
dgettext ("gnunet", \
"Assertion failed at %s:%d. Aborting.\n") \
, \
__FILE__, \
__LINE__); \
GNUNET_abort_ (); \
} \
} while (0)

Use this for fatal errors that cannot be handled.

Parameters
condCondition to evaluate
compComponent string to use for logging

Definition at line 1001 of file gnunet_common.h.

1003 { \
1004 if (! (cond)) \
1005 { \
1006 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, \
1007 comp, \
1008 dgettext ("gnunet", \
1009 "Assertion failed at %s:%d. Aborting.\n") \
1010 , \
1011 __FILE__, \
1012 __LINE__); \
1013 GNUNET_abort_ (); \
1014 } \
1015 } while (0)

◆ GNUNET_break

#define GNUNET_break (   cond)
Value:
do \
{ \
if (! (cond)) \
{ \
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
dgettext ("gnunet", "Assertion failed at %s:%d.\n"), \
__FILE__, \
__LINE__); \
} \
} while (0)

Use this for internal assertion violations that are not fatal (can be handled) but should not occur.

Definition at line 1045 of file gnunet_common.h.

1047 { \
1048 if (! (cond)) \
1049 { \
1050 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
1051 dgettext ("gnunet", "Assertion failed at %s:%d.\n"), \
1052 __FILE__, \
1053 __LINE__); \
1054 } \
1055 } while (0)

◆ GNUNET_break_op

#define GNUNET_break_op (   cond)
Value:
do \
{ \
if (! (cond)) \
{ \
dgettext ("gnunet", \
"External protocol violation detected at %s:%d.\n"), \
__FILE__, \
__LINE__); \
} \
} while (0)
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_BULK

Use this for assertion violations caused by other peers (i.e.

protocol violations). We do not want to confuse end-users (say, some other peer runs an older, broken or incompatible GNUnet version), but we still want to see these problems during development and testing. "OP == other peer".

Definition at line 1067 of file gnunet_common.h.

1069 { \
1070 if (! (cond)) \
1071 { \
1073 dgettext ("gnunet", \
1074 "External protocol violation detected at %s:%d.\n"), \
1075 __FILE__, \
1076 __LINE__); \
1077 } \
1078 } while (0)

◆ GNUNET_log_strerror

#define GNUNET_log_strerror (   level,
  cmd 
)
Value:
do \
{ \
GNUNET_log (level, \
dgettext ("gnunet", \
"`%s' failed at %s:%d with error: %s\n"), \
cmd, \
__FILE__, \
__LINE__, \
strerror (errno)); \
} while (0)

Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the message given by strerror(errno).

Definition at line 1087 of file gnunet_common.h.

1089 { \
1090 GNUNET_log (level, \
1091 dgettext ("gnunet", \
1092 "`%s' failed at %s:%d with error: %s\n"), \
1093 cmd, \
1094 __FILE__, \
1095 __LINE__, \
1096 strerror (errno)); \
1097 } while (0)

◆ GNUNET_log_from_strerror

#define GNUNET_log_from_strerror (   level,
  component,
  cmd 
)
Value:
do \
{ \
GNUNET_log_from (level, \
dgettext ("gnunet", \
"`%s' failed at %s:%d with error: %s\n"), \
cmd, \
__FILE__, \
__LINE__, \
strerror (errno)); \
} while (0)
static char * component
Running component.

Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the message given by strerror(errno).

Definition at line 1106 of file gnunet_common.h.

1108 { \
1109 GNUNET_log_from (level, \
1110 component, \
1111 dgettext ("gnunet", \
1112 "`%s' failed at %s:%d with error: %s\n"), \
1113 cmd, \
1114 __FILE__, \
1115 __LINE__, \
1116 strerror (errno)); \
1117 } while (0)

◆ GNUNET_log_strerror_file

#define GNUNET_log_strerror_file (   level,
  cmd,
  filename 
)
Value:
do \
{ \
GNUNET_log (level, \
dgettext ("gnunet", \
"`%s' failed on file `%s' at %s:%d with error: %s\n"), \
cmd, \
__FILE__, \
__LINE__, \
strerror (errno)); \
} while (0)
static char * filename

Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the message given by strerror(errno).

Definition at line 1126 of file gnunet_common.h.

1128 { \
1129 GNUNET_log (level, \
1130 dgettext ("gnunet", \
1131 "`%s' failed on file `%s' at %s:%d with error: %s\n"), \
1132 cmd, \
1133 filename, \
1134 __FILE__, \
1135 __LINE__, \
1136 strerror (errno)); \
1137 } while (0)

◆ GNUNET_log_from_strerror_file

#define GNUNET_log_from_strerror_file (   level,
  component,
  cmd,
  filename 
)
Value:
do \
{ \
GNUNET_log_from (level, \
dgettext ("gnunet", \
"`%s' failed on file `%s' at %s:%d with error: %s\n"), \
cmd, \
__FILE__, \
__LINE__, \
strerror (errno)); \
} while (0)

Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the message given by strerror(errno).

Definition at line 1146 of file gnunet_common.h.

1148 { \
1149 GNUNET_log_from (level, \
1150 component, \
1151 dgettext ("gnunet", \
1152 "`%s' failed on file `%s' at %s:%d with error: %s\n"), \
1153 cmd, \
1154 filename, \
1155 __FILE__, \
1156 __LINE__, \
1157 strerror (errno)); \
1158 } while (0)

Typedef Documentation

◆ GNUNET_Logger

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.

Parameters
clsclosure
kindsevereity
componentwhat component is issuing the message?
datewhen was the message logged?
messagewhat is the message

Definition at line 440 of file gnunet_common.h.

Enumeration Type Documentation

◆ GNUNET_ErrorType

Types of errors.

Enumerator
GNUNET_ERROR_TYPE_UNSPECIFIED 
GNUNET_ERROR_TYPE_NONE 
GNUNET_ERROR_TYPE_ERROR 
GNUNET_ERROR_TYPE_WARNING 
GNUNET_ERROR_TYPE_MESSAGE 
GNUNET_ERROR_TYPE_INFO 
GNUNET_ERROR_TYPE_DEBUG 
GNUNET_ERROR_TYPE_INVALID 
GNUNET_ERROR_TYPE_BULK 

Definition at line 413 of file gnunet_common.h.

414{
419 /* UX: We need a message type that is output by
420 * default without looking like there is a problem.
421 */
427};
@ GNUNET_ERROR_TYPE_UNSPECIFIED
@ GNUNET_ERROR_TYPE_NONE
@ GNUNET_ERROR_TYPE_INVALID
@ GNUNET_ERROR_TYPE_MESSAGE
@ GNUNET_ERROR_TYPE_DEBUG
@ GNUNET_ERROR_TYPE_INFO

Function Documentation

◆ GNUNET_get_log_skip()

int GNUNET_get_log_skip ( void  )

Get the number of log calls that are going to be skipped.

Returns
number of log calls to be ignored

Definition at line 997 of file common_logging.c.

998{
999 return skip_log;
1000}
static GNUNET_THREAD_LOCAL int skip_log
Number of log calls to ignore.

References skip_log.

◆ GNUNET_log_nocheck()

void GNUNET_log_nocheck ( enum GNUNET_ErrorType  kind,
const char *  message,
  ... 
)

Main log function.

Parameters
kindhow serious is the error?
messagewhat is the message (format string)
...arguments for format string

◆ GNUNET_log_from_nocheck()

void GNUNET_log_from_nocheck ( enum GNUNET_ErrorType  kind,
const char *  comp,
const char *  message,
  ... 
)

Log function that specifies an alternative component.

This function should be used by plugins.

Parameters
kindhow serious is the error?
compcomponent responsible for generating the message
messagewhat is the message (format string)
...arguments for format string

Referenced by main(), run(), run(), and run().

Here is the caller graph for this function:

◆ GNUNET_log_config_missing()

void GNUNET_log_config_missing ( enum GNUNET_ErrorType  kind,
const char *  section,
const char *  option 
)

Log error message about missing configuration option.

Parameters
kindlog level
sectionsection with missing option
optionname of missing option

Definition at line 1509 of file common_logging.c.

1512{
1513 GNUNET_log (kind,
1514 _ (
1515 "Configuration fails to specify option `%s' in section `%s'!\n")
1516 ,
1517 option,
1518 section);
1519}
#define GNUNET_log(kind,...)
#define _(String)
GNU gettext support macro.
Definition platform.h:179

References _, and GNUNET_log.

Referenced by database_connect(), database_setup(), database_setup(), database_setup(), database_setup(), database_setup(), DHTU_ip_init(), get_bootstrap_server(), get_update_information_directory(), GNUNET_CLIENT_test(), GNUNET_CONFIGURATION_config_tool_run(), GNUNET_CONVERSATION_phone_create(), GNUNET_DATACACHE_create(), GNUNET_PILS_create_key_ring(), GNUNET_PQ_connect_with_cfg2(), GNUNET_RPS_connect(), GSF_pending_request_init_(), load(), load_hostlist_file(), load_ikm(), mq_init(), mq_init(), new_sub(), purge_cfg_dir(), read_index_list(), run(), run(), run(), run(), run(), run(), run(), run(), run(), run(), run(), run(), run(), run(), run(), run(), run(), run(), run(), run(), save(), save_hostlist_file(), setup_exit_helper_args(), sock_read(), sock_read(), start_arm_service(), and write_index_list().

◆ GNUNET_log_config_invalid()

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.

Parameters
kindlog level
sectionsection with invalid option
optionname of invalid option
requiredwhat is required that is invalid about the option

Definition at line 1523 of file common_logging.c.

1527{
1528 GNUNET_log (
1529 kind,
1530 _ (
1531 "Configuration specifies invalid value for option `%s' in section `%s': %s\n"),
1532 option,
1533 section,
1534 required);
1535}

References _, and GNUNET_log.

Referenced by advertise_dns_exit(), DHTU_ip_init(), GCD_init(), GNUNET_CLIENT_test(), GNUNET_CONFIGURATION_get_value_time(), GNUNET_GNS_lookup_with_tld(), GSF_push_init_(), read_service_conf(), run(), run(), run(), run(), run(), run(), setup_exit_helper_args(), setup_service(), and test_service_configuration().

Here is the caller graph for this function:

◆ GNUNET_abort_()

void GNUNET_abort_ ( void  )

Abort the process, generate a core dump if possible.

Most code should use GNUNET_assert (0) instead to first log the location of the failure.

Definition at line 278 of file common_logging.c.

279{
280 abort ();
281}

◆ GNUNET_log_skip()

void GNUNET_log_skip ( int  n,
int  check_reset 
)

Ignore the next n calls to the log function.

Parameters
nnumber of log calls to ignore (could be negative)
check_resetGNUNET_YES to assert that the log skip counter is currently zero

Definition at line 973 of file common_logging.c.

974{
975 int ok;
976
977 if (0 == n)
978 {
979 ok = (0 == skip_log);
980 skip_log = 0;
981 if (check_reset)
982 GNUNET_break (ok);
983 }
984 else
985 {
986 skip_log += n;
987 }
988}
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.

References GNUNET_break, and skip_log.

◆ GNUNET_log_setup()

enum GNUNET_GenericReturnValue GNUNET_log_setup ( const char *  comp,
const char *  loglevel,
const char *  logfile 
)

Setup logging.

Parameters
compdefault component to use
loglevelwhat types of messages should be logged
logfilechange logging to logfile (use NULL to keep stderr)
Returns
GNUNET_OK on success, GNUNET_SYSERR if logfile could not be opened
Parameters
compdefault component to use
loglevelwhat types of messages should be logged
logfilewhich file to write log messages to (can be NULL)
Returns
GNUNET_OK on success

Definition at line 729 of file common_logging.c.

732{
733 const char *env_logfile;
734
735 min_level = get_type (loglevel);
736#if ! defined(GNUNET_CULL_LOGGING)
738#endif
741 "%s-%d",
742 comp,
743 getpid ());
746
747 env_logfile = getenv ("GNUNET_FORCE_LOGFILE");
748 if ((NULL != env_logfile) && (strlen (env_logfile) > 0))
749 logfile = env_logfile;
750 if (NULL == logfile)
751 return GNUNET_OK;
754 if (NULL == log_file_name)
755 return GNUNET_SYSERR;
756#if defined(GNUNET_CULL_LOGGING)
757 /* log file option not allowed for wallet logic */
758 GNUNET_assert (NULL == logfile);
759 return GNUNET_OK;
760#else
761 {
762 time_t t;
763 const struct tm *tm;
764
765 t = time (NULL);
766 tm = gmtime (&t);
767 return setup_log_file (tm);
768 }
769#endif
770}
static void parse_all_definitions()
Utility function - parses GNUNET_LOG and GNUNET_FORCE_LOG.
static char * log_file_name
Format string describing the name of the log file.
static char * component_nopid
Running component (without pid).
static enum GNUNET_ErrorType get_type(const char *log)
Convert a textual description of a loglevel to the respective enumeration type.
static enum GNUNET_GenericReturnValue setup_log_file(const struct tm *tm)
Setup the log file.
static enum GNUNET_ErrorType min_level
Minimum log level.
char * getenv()
static struct GNUNET_SCHEDULER_Task * t
Main task.
@ GNUNET_OK
@ GNUNET_SYSERR
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_free(ptr)
Wrapper around free.
char * GNUNET_STRINGS_filename_expand(const char *fil)
Complete filename (a la shell) from abbrevition.
Definition strings.c:525

References component, component_nopid, get_type(), getenv(), GNUNET_asprintf(), GNUNET_assert, GNUNET_free, GNUNET_OK, GNUNET_strdup, GNUNET_STRINGS_filename_expand(), GNUNET_SYSERR, log_file_name, min_level, parse_all_definitions(), setup_log_file(), and t.

Referenced by get_app(), GNUNET_PROGRAM_conf_and_options(), GNUNET_PROGRAM_run2(), GNUNET_SERVICE_run_(), GNUNET_TRANSPORT_TESTING_main_(), libgnunet_test_transport_plugin_cmd_just_run_init(), libgnunet_test_transport_plugin_cmd_nat_mapping_init(), libgnunet_test_transport_plugin_cmd_nat_upnp_init(), libgnunet_test_transport_plugin_cmd_simple_send_broadcast_init(), libgnunet_test_transport_plugin_cmd_simple_send_dv_init(), libgnunet_test_transport_plugin_cmd_simple_send_init(), libgnunet_test_transport_plugin_cmd_simple_send_performance_init(), main(), main(), main(), and run().

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

◆ GNUNET_logger_add()

void GNUNET_logger_add ( GNUNET_Logger  logger,
void *  logger_cls 
)

Add a custom logger.

Note that installing any custom logger will disable the standard logger. When multiple custom loggers are installed, all will be called. The standard logger will only be used if no custom loggers are present.

Parameters
loggerlog function
logger_clsclosure for logger

Definition at line 774 of file common_logging.c.

776{
777 struct CustomLogger *entry;
778
779 entry = GNUNET_new (struct CustomLogger);
780 entry->logger = logger;
781 entry->logger_cls = logger_cls;
782 entry->next = loggers;
783 loggers = entry;
784}
static struct CustomLogger * loggers
Linked list of our custom loggres.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
Linked list of active loggers.
void * logger_cls
Closure for logger.
struct CustomLogger * next
This is a linked list.
GNUNET_Logger logger
Log function.

References GNUNET_new, CustomLogger::logger, CustomLogger::logger_cls, loggers, and CustomLogger::next.

◆ GNUNET_logger_remove()

void GNUNET_logger_remove ( GNUNET_Logger  logger,
void *  logger_cls 
)

Remove a custom logger.

Parameters
loggerlog function
logger_clsclosure for logger

Definition at line 788 of file common_logging.c.

790{
791 struct CustomLogger *pos;
792 struct CustomLogger *prev;
793
794 prev = NULL;
795 pos = loggers;
796 while ( (NULL != pos) &&
797 ( (pos->logger != logger) ||
798 (pos->logger_cls != logger_cls) ) )
799 {
800 prev = pos;
801 pos = pos->next;
802 }
803 GNUNET_assert (NULL != pos);
804 if (NULL == prev)
805 loggers = pos->next;
806 else
807 prev->next = pos->next;
808 GNUNET_free (pos);
809}

References GNUNET_assert, GNUNET_free, CustomLogger::logger, CustomLogger::logger_cls, loggers, and CustomLogger::next.

◆ GNUNET_sh2s()

const char * GNUNET_sh2s ( const struct GNUNET_ShortHashCode shc)

Convert a short hash value to a string (for printing debug messages).

This is one of the very few calls in the entire API that is NOT reentrant!

Parameters
shcthe hash code
Returns
string

Definition at line 1313 of file common_logging.c.

1314{
1315 static GNUNET_THREAD_LOCAL char buf[64];
1316
1318 sizeof(*shc),
1319 buf,
1320 sizeof(buf));
1321 buf[6] = '\0';
1322 return (const char *) buf;
1323}
static struct GNUNET_PEERSTORE_StoreHelloContext * shc
HELLO store context handle.
char * GNUNET_STRINGS_data_to_string(const void *data, size_t size, char *out, size_t out_size)
Convert binary data to ASCII encoding using CrockfordBase32.
Definition strings.c:757
#define GNUNET_THREAD_LOCAL
Definition platform.h:248

References GNUNET_STRINGS_data_to_string(), GNUNET_THREAD_LOCAL, and shc.

Referenced by add_member_subscription(), add_peer_store_entry(), add_store_member(), change_srv_handle_member_id(), check_member_session_completion(), consider_ss_ack(), create_handle_member_id(), create_member(), create_rekey(), create_subscription(), decrypt_box(), delete_srv_room_message(), destroy_member(), destroy_route(), destroy_subscription(), discard_all_from_rung_tail(), dv_setup_key_state_from_km(), find_member_session_in_room(), GCC_2s(), GCC_handle_kx(), GCC_handle_kx_auth(), get_store_peer_of(), handle_ack(), handle_announcement_message(), handle_appeal_message(), handle_connection_broken(), handle_connection_create(), handle_connection_create_ack(), handle_connection_destroy(), handle_dv_learn(), handle_get_message(), handle_message_join(), handle_message_leave(), handle_revolution_message(), handle_send_message(), handle_tunnel_kx(), handle_validation_challenge(), handle_validation_response(), iterate_destroy_peers(), iterate_epoch_session_members(), iterate_load_next_member_sessions(), iterate_next_member_ids(), iterate_notify_about_members(), iterate_save_members(), iterate_save_peers(), iterate_srv_handle_sync_finished(), join_room(), kce_generate_cb(), mq_send_d(), mqm_execute(), notify_about_members(), notify_srv_handle_member_id(), notify_srv_handle_message(), on_message(), pack_message(), remove_member_subscription(), remove_room_member_session(), request_room_message_step(), route_message(), secret_destroy(), send_broken(), send_kx(), send_kx_auth(), send_message_join(), send_srv_handle_message(), setup_initial_shared_secret_dec(), setup_initial_shared_secret_ephemeral(), sign_srv_room_message(), sock_read(), start_address_validation(), start_dv_learn(), store_handle_epoch_key(), switch_member_session(), traverse_epoch_session_message(), try_handle_plaintext(), update_member_session_history(), update_store_peer(), validation_start_cb(), and validation_transmit_on_queue().

Here is the call graph for this function:

◆ GNUNET_uuid2s()

const char * GNUNET_uuid2s ( const struct GNUNET_Uuid uuid)

Convert a UUID to a string (for printing debug messages).

This is one of the very few calls in the entire API that is NOT reentrant!

Parameters
uuidthe UUID
Returns
string

Definition at line 1336 of file common_logging.c.

1337{
1338 static GNUNET_THREAD_LOCAL char buf[32];
1339
1340 GNUNET_STRINGS_data_to_string (uuid, sizeof(*uuid), buf, sizeof(buf));
1341 buf[6] = '\0';
1342 return (const char *) buf;
1343}

References GNUNET_STRINGS_data_to_string(), and GNUNET_THREAD_LOCAL.

Referenced by cummulative_ack(), free_pending_acknowledgement(), handle_reliability_ack(), handle_reliability_box(), and prepare_pending_acknowledgement().

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

◆ GNUNET_h2s()

const char * GNUNET_h2s ( const struct GNUNET_HashCode hc)

Convert a hash value to a string (for printing debug messages).

This is one of the very few calls in the entire API that is NOT reentrant!

Parameters
hcthe hash code
Returns
string

Convert a hash value to a string (for printing debug messages).

Parameters
hcthe hash code
Returns
string form; will be overwritten by next call to GNUNET_h2s.

Definition at line 1206 of file common_logging.c.

1207{
1209
1211 &ret);
1212 ret.encoding[8] = '\0';
1213 return (const char *) ret.encoding;
1214}
static int ret
Final status code.
Definition gnunet-arm.c:93
void GNUNET_CRYPTO_hash_to_enc(const struct GNUNET_HashCode *block, struct GNUNET_CRYPTO_HashAsciiEncoded *result)
Convert hash to ASCII encoding.
Definition crypto_hash.c:55
0-terminated ASCII encoding of a struct GNUNET_HashCode.

References GNUNET_CRYPTO_hash_to_enc(), GNUNET_THREAD_LOCAL, and ret.

Referenced by add_get_request_to_pending(), add_member_session(), add_to_list_messages(), advertise_dns_exit(), automaton_save_graph_step(), block_proc(), callback_found_message(), callback_operation(), callback_room_connect(), callback_room_handle_message(), callback_srv_room_message_signed(), callback_srv_room_sign_result(), callback_tunnel_disconnect(), callback_tunnel_message_signed(), cancel_store_operation(), cb_channel_destruction(), cb_channel_destruction(), cb_channel_destruction(), cb_channel_destruction(), cb_handle_dht_p2p_get_local_hello(), cb_intersection_element_removed(), cb_intersection_element_removed(), cb_intersection_element_removed(), cb_intersection_element_removed(), cb_path_signed(), cb_routing_put_message(), change_srv_handle_member_id(), check_edge(), check_send_message(), clean_request(), clear_member_store(), clear_operation_store(), client_release_ports(), client_request_complete_alice(), client_request_complete_alice(), client_response_handler(), close_service_room(), close_srv_room(), create_channel_to_destination(), create_handle_member_id(), create_operation(), create_rekey(), create_srv_room(), create_subscription(), datacache_get_iterator(), delayed_get(), delayed_put(), delete_srv_room_message(), delete_store_message(), destroy_operation(), destroy_srv_room(), destroy_subscription(), dht_get_string_accept_handler(), dht_get_string_handler(), do_generate_pid(), env_delete_notify(), execute_add(), expired_processor(), filter_all(), filter_all(), filtered_map_initialization(), filtered_map_initialization(), forward_reply(), forward_tunnel_message(), free_validation_state(), GCCH_2s(), GCCH_bind(), GCCH_channel_incoming_new(), GCCH_channel_local_new(), GCCH_hash_port(), GDS_CLIENTS_handle_reply(), GDS_DATACACHE_get_closest(), GDS_DATACACHE_handle_get(), GDS_DATACACHE_handle_put(), GDS_NEIGHBOURS_handle_get(), GDS_NEIGHBOURS_handle_put(), GDS_NEIGHBOURS_handle_reply(), get_any(), get_cb(), get_handle_member_session(), get_room_data_subdir(), get_store_message(), get_target_peers(), get_typed(), get_valid_encryption_key_for_room(), GNUNET_CADET_channel_create(), GNUNET_CADET_open_port(), GNUNET_DATACACHE_get(), GNUNET_DATACACHE_get_closest(), GNUNET_DATACACHE_put(), GNUNET_DATASTORE_get_key(), GNUNET_DATASTORE_put(), GNUNET_DATASTORE_remove(), GNUNET_DHT_get_start(), GNUNET_DHT_get_stop(), GNUNET_DHT_put(), GNUNET_FS_add_to_index(), GNUNET_FS_handle_on_demand_block(), GNUNET_FS_tree_encoder_next(), GNUNET_NAMECACHE_lookup_block(), GNUNET_SET_listen(), GNUNET_SET_listen_cancel(), GNUNET_SETI_listen(), GNUNET_SETI_listen_cancel(), GNUNET_SETU_listen(), GNUNET_SETU_listen_cancel(), GSC_bind(), GSF_cadet_query(), GSF_cadet_query_cancel(), GSF_pending_request_create_(), GSF_pending_request_get_message_(), GSF_plan_add_(), handle_ack(), handle_announcement_message(), handle_bob_client_message(), handle_channel_create(), handle_channel_created(), handle_client_evaluate(), handle_client_evaluate(), handle_client_evaluate(), handle_client_join(), handle_client_listen(), handle_client_listen(), handle_client_listen(), handle_client_redirect_to_service(), handle_client_register_message(), handle_client_reject(), handle_client_reject(), handle_client_reject(), handle_client_set_add(), handle_client_set_add(), handle_client_start_search(), handle_client_unindex(), handle_data(), handle_datastore_reply(), handle_dht_local_get(), handle_dht_local_get_stop(), handle_dht_local_put(), handle_dht_p2p_get(), handle_dht_p2p_put(), handle_dht_reply(), handle_find_local_hello(), handle_find_my_hello(), handle_get_key(), handle_get_message(), handle_icmp_service(), handle_incoming_msg(), handle_incoming_msg(), handle_incoming_msg(), handle_initiator_done(), handle_initiator_hello_cont(), handle_local_result(), handle_member_id(), handle_message_join(), handle_message_leave(), handle_miss_message(), handle_name_message(), handle_namecache_block_response(), handle_p2p_get(), handle_p2p_put(), handle_p2p_reply(), handle_plaintext_channel_open(), handle_port_close(), handle_port_open(), handle_put(), handle_put(), handle_query_message(), handle_recv_message(), handle_remove(), handle_reply(), handle_request(), handle_responder_hello(), handle_responder_hello_cont(), handle_revolution_message(), handle_room_close(), handle_room_close(), handle_room_entry(), handle_room_entry(), handle_room_messages(), handle_room_open(), handle_room_open(), handle_room_sync(), handle_send_message(), handle_service_message(), handle_tcp_service(), handle_tunnel_message(), handle_udp_service(), handle_union_p2p_demand(), handle_union_p2p_demand(), handle_union_p2p_elements(), handle_union_p2p_elements(), handle_union_p2p_full_element(), handle_union_p2p_full_element(), handle_union_p2p_offer(), handle_union_p2p_offer(), handle_validation_response(), hash_for_index_cb(), hash_for_index_val(), heap_plugin_put(), initialize_map_unfiltered(), initialize_map_unfiltered(), initiate_put_from_pipe_trigger(), iterate_initial_edge(), iterate_load_next_session(), iterate_next_member_ids(), iterate_save_entries(), iterate_save_messages(), iterate_save_operations(), iterate_save_session(), iterate_service_miss_rooms(), iterate_service_update_rooms(), iterate_srv_handle_sync_finished(), iterator_bf_create(), iterator_bf_create(), iterator_bf_reduce(), iterator_bf_reduce(), join_room(), load_message_store_entries(), load_state(), lookup_task(), merge_srv_handle_room_to_sync(), merge_srv_room_last_messages(), namecache_sqlite_cache_block(), notify_srv_handle_member_id(), notify_srv_handle_message(), on_message(), open_srv_room(), pid_change_cb(), plan(), prepare_client_end_notification(), prepare_client_end_notification(), prepare_client_end_notification(), prepare_client_end_notification(), prepare_ibf_iterator(), prepare_ibf_iterator(), print_channel_destination(), print_edge(), print_indexed(), process(), process_client_result(), process_dht_put_content(), process_local_reply(), process_migration_content(), process_reply(), process_result_with_request(), put_cb(), put_continuation(), put_store_message(), quota_processor(), read_handle_encryption_key(), read_handle_epoch_key(), recv_message_request(), regex_find_path(), REGEX_INTERNAL_iterate_all_edges(), REGEX_INTERNAL_search(), regex_iterator(), regex_next_edge(), remove_by_unique_id(), remove_continuation(), remove_from_list_messages(), remove_member_session(), remove_room_member_session(), remove_store_contact(), request_message_from_room(), request_room_message_step(), requester_callback(), responder_callback(), revalidate_map_it(), route_packet(), run(), schedule_block_download(), select_peer(), send_close_room(), send_enter_room(), send_full_element_iterator(), send_full_element_iterator(), send_message_peer(), send_message_to_room(), send_message_to_room_with_key(), send_offers_iterator(), send_offers_iterator(), send_open_room(), send_remaining_elements(), send_remaining_elements(), send_responder_hello(), send_srv_handle_message(), send_srv_room_message(), send_sync_room(), send_tunnel_message(), set_room_sender_id(), sign_hello_cb(), sign_message(), sign_message_by_peer(), sign_srv_room_message(), sqlite_plugin_get_closest(), sqlite_plugin_put(), sqlite_plugin_put(), start_intersection(), start_intersection(), start_local_query(), start_p2p_processing(), store_handle_encryption_key(), store_handle_epoch_key(), store_service(), sync_srv_handle_room(), timeout_closed_cb(), transmit_client_response(), transmit_client_response(), transmit_item(), transmit_pending(), transmit_request(), traverse_epoch_session_message(), try_handle_plaintext(), update_member_session_history(), update_room_message(), update_store_contact(), validation_transmit_on_queue(), verify_member_session_as_sender(), and write_item().

Here is the call graph for this function:

◆ GNUNET_h2s2()

const char * GNUNET_h2s2 ( const struct GNUNET_HashCode hc)

Convert a hash value to a string (for printing debug messages).

This is one of the very few calls in the entire API that is NOT reentrant! Identical to GNUNET_h2s(), except that another buffer is used so both GNUNET_h2s() and GNUNET_h2s2() can be used within the same log statement.

Parameters
hcthe hash code
Returns
string

Convert a hash value to a string (for printing debug messages).

This is one of the very few calls in the entire API that is NOT reentrant! Identical to GNUNET_h2s(), except that another buffer is used so both GNUNET_h2s() and GNUNET_h2s2() can be used within the same log statement.

Parameters
hcthe hash code
Returns
string form; will be overwritten by next call to GNUNET_h2s.

Definition at line 1228 of file common_logging.c.

1229{
1231
1233 &ret);
1234 ret.encoding[8] = '\0';
1235 return (const char *) ret.encoding;
1236}

References GNUNET_CRYPTO_hash_to_enc(), GNUNET_THREAD_LOCAL, and ret.

Here is the call graph for this function:

◆ GNUNET_h2s_full()

const char * GNUNET_h2s_full ( const struct GNUNET_HashCode hc)

Convert a hash value to a string (for printing debug messages).

This prints all 104 characters of a hashcode! This is one of the very few calls in the entire API that is NOT reentrant!

Parameters
hcthe hash code
Returns
string

Convert a hash value to a string (for printing debug messages).

This is one of the very few calls in the entire API that is NOT reentrant!

Parameters
hcthe hash code
Returns
string form; will be overwritten by next call to GNUNET_h2s_full.

Definition at line 1355 of file common_logging.c.

1356{
1358
1360 ret.encoding[sizeof(ret) - 1] = '\0';
1361 return (const char *) ret.encoding;
1362}

References GNUNET_CRYPTO_hash_to_enc(), GNUNET_THREAD_LOCAL, and ret.

Referenced by forward_reply(), get_callback(), get_resp_callback(), GNUNET_PILS_sign_hello(), handle_dht_local_get(), handle_dht_local_put(), handle_recv_message(), namecache_cache_block(), namecache_lookup_block(), namecache_sqlite_cache_block(), namecache_sqlite_lookup_block(), new_sub(), on_message(), put_callback(), and run().

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

◆ GNUNET_p2s()

const char * GNUNET_p2s ( const struct GNUNET_CRYPTO_EddsaPublicKey p)

Convert a public key value to a string (for printing debug messages).

This is one of the very few calls in the entire API that is NOT reentrant!

Parameters
hcthe hash code
Returns
string

Definition at line 1240 of file common_logging.c.

1241{
1243 struct GNUNET_HashCode hc;
1244
1246 sizeof(*p),
1247 &hc);
1249 &ret);
1250 ret.encoding[6] = '\0';
1251 return (const char *) ret.encoding;
1252}
static struct GNUNET_Process * p
Helper process we started.
Definition gnunet-uri.c:38
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition crypto_hash.c:41
A 512-bit hashcode.

References GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_hash_to_enc(), GNUNET_THREAD_LOCAL, p, and ret.

Referenced by do_generate_pid(), do_rekey(), do_rekey(), inject_rekey(), and inject_rekey().

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

◆ GNUNET_p2s2()

const char * GNUNET_p2s2 ( const struct GNUNET_CRYPTO_EddsaPublicKey p)

Convert a public key value to a string (for printing debug messages).

This is one of the very few calls in the entire API that is NOT reentrant!

Parameters
hcthe hash code
Returns
string

Definition at line 1256 of file common_logging.c.

1257{
1259 struct GNUNET_HashCode hc;
1260
1262 sizeof(*p),
1263 &hc);
1265 &ret);
1266 ret.encoding[6] = '\0';
1267 return (const char *) ret.encoding;
1268}

References GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_hash_to_enc(), GNUNET_THREAD_LOCAL, p, and ret.

Here is the call graph for this function:

◆ GNUNET_e2s()

const char * GNUNET_e2s ( const struct GNUNET_CRYPTO_EcdhePublicKey p)

Convert a public key value to a string (for printing debug messages).

This is one of the very few calls in the entire API that is NOT reentrant!

Parameters
hcthe hash code
Returns
string

Definition at line 1272 of file common_logging.c.

1273{
1275 struct GNUNET_HashCode hc;
1276
1278 sizeof(*p),
1279 &hc);
1281 &ret);
1282 ret.encoding[6] = '\0';
1283 return (const char *) ret.encoding;
1284}

References GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_hash_to_enc(), GNUNET_THREAD_LOCAL, p, and ret.

Referenced by cont_GCT_handle_kx_auth(), do_rekey(), do_rekey(), GCC_handle_kx(), GCC_handle_kx_auth(), GCT_handle_kx(), GCT_handle_kx_auth(), handle_tunnel_kx(), inject_rekey(), inject_rekey(), mqm_execute(), send_kx(), send_kx_auth(), and update_ax_by_kx().

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

◆ GNUNET_e2s2()

const char * GNUNET_e2s2 ( const struct GNUNET_CRYPTO_EcdhePublicKey p)

Convert a public key value to a string (for printing debug messages).

This is one of the very few calls in the entire API that is NOT reentrant!

Parameters
hcthe hash code
Returns
string

Definition at line 1288 of file common_logging.c.

1289{
1291 struct GNUNET_HashCode hc;
1292
1294 sizeof(*p),
1295 &hc);
1297 &ret);
1298 ret.encoding[6] = '\0';
1299 return (const char *) ret.encoding;
1300}

References GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_hash_to_enc(), GNUNET_THREAD_LOCAL, p, and ret.

Here is the call graph for this function:

◆ GNUNET_i2s()

const char * GNUNET_i2s ( const struct GNUNET_PeerIdentity pid)

Convert a peer identity to a string (for printing debug messages).

This is one of the very few calls in the entire API that is NOT reentrant!

Parameters
pidthe peer identity
Returns
string form of the pid; will be overwritten by next call to GNUNET_i2s().
Parameters
pidthe peer identity
Returns
string form of the pid; will be overwritten by next call to GNUNET_i2s.

Definition at line 1373 of file common_logging.c.

1374{
1375 static GNUNET_THREAD_LOCAL char buf[5];
1376 char *ret;
1377
1378 if (NULL == pid)
1379 return "NULL";
1381 GNUNET_strlcpy (buf, ret, sizeof(buf));
1382 GNUNET_free (ret);
1383 return buf;
1384}
static struct GNUNET_PeerIdentity pid
Identity of the peer we transmit to / connect to.
char * GNUNET_CRYPTO_eddsa_public_key_to_string(const struct GNUNET_CRYPTO_EddsaPublicKey *pub)
Convert a public key to a string.
Definition crypto_ecc.c:255
size_t GNUNET_strlcpy(char *dst, const char *src, size_t n)
Like strlcpy but portable.
Definition strings.c:137
struct GNUNET_CRYPTO_EddsaPublicKey public_key

References GNUNET_CRYPTO_eddsa_public_key_to_string(), GNUNET_free, GNUNET_strlcpy(), GNUNET_THREAD_LOCAL, pid, GNUNET_PeerIdentity::public_key, and ret.

Referenced by activate_core_visible_dv_path(), add_known_to_bloom(), add_peer_store_entry(), add_revocation(), add_search_string(), attempt_connect(), backtalker_monotime_cb(), cadet_mq_send_now(), cadet_timeout(), callback_room_connect(), callback_srv_room_sign_result(), callback_tunnel_disconnect(), cb_channel_destruction(), cb_channel_destruction(), cb_channel_destruction(), cb_channel_destruction(), cb_channel_incoming(), cb_channel_incoming(), cb_intersection_request_alice(), cb_routing_put_message(), check_and_remove_pending_reversal(), check_and_remove_pending_reversal(), check_for_burst_address(), check_peer_online(), check_peer_pull_reply(), check_validation_request_pending(), check_vl_transmission(), clean_peer(), client_disconnect_cb(), client_disconnect_cb(), client_disconnect_cb(), client_send_response(), clients_notify_stream_peer(), connect_cb(), connect_cb(), connect_cb(), connect_handler(), connect_notify(), connect_peers_run(), connect_peers_run(), connect_peers_run(), consider_for_advertising(), consider_sending_fc(), cont_GCT_handle_kx(), core_connect_cb(), core_disconnect_cb(), core_init(), core_mq_send_impl(), cores_send_connect_info(), cores_send_disconnect_info(), create_channel_to_destination(), create_tunnel(), cummulative_ack(), decaps_dv_box_cb(), decrypt_new_element(), deliver_message(), destroy_peer(), destroy_route(), disconnect_cb(), disconnect_notify(), do_connect(), do_flood(), do_round(), do_send(), dv_neighbour_transmission(), encapsulate_for_dv(), extract_box_cb(), finish_handling_raw_message(), forward_dv_box(), forward_dv_learn(), fragment_message(), free_backtalker(), free_queue_entry(), GCCH_2s(), GCD_search(), GCPP_2s(), GCT_2s(), GCT_handle_kx(), GDS_NEIGHBOURS_handle_get(), GDS_NEIGHBOURS_handle_put(), GDS_NEIGHBOURS_handle_reply(), GDS_try_connect(), GDS_u_connect(), GDS_u_disconnect(), GDS_u_receive(), get_cadet(), get_channel(), get_result_iterator(), GNUNET_CADET_channel_create(), GNUNET_CRYPTO_ecc_dlog(), GNUNET_CRYPTO_ecc_dlog_prepare(), GNUNET_DHT_pp2s(), GNUNET_DHT_verify_path(), GNUNET_PEERSTORE_hello_add(), GNUNET_PEERSTORE_store(), GNUNET_RPS_seed_ids(), GNUNET_TRANSPORT_application_suggest(), GNUNET_TRANSPORT_application_suggest_cancel(), GNUNET_TRANSPORT_application_validate(), GNUNET_TRANSPORT_communicator_receive(), GNUNET_TRANSPORT_TESTING_log_connect(), GNUNET_TRANSPORT_TESTING_log_disconnect(), GNUNET_TRANSPORT_TESTING_restart_peer(), GNUNET_TRANSPORT_TESTING_send(), GNUNET_TRANSPORT_TESTING_stop_peer(), got_hello(), GSC_CLIENTS_deliver_message(), GSC_CLIENTS_notify_client_about_neighbour(), GSC_CLIENTS_solicit_request(), GSC_complete_initialization_cb(), GSC_SESSIONS_create(), GSC_SESSIONS_end(), GSC_SESSIONS_solicit(), GSF_cadet_query(), GSF_cadet_query_cancel(), GSF_cadet_release_clients(), GSF_peer_connect_handler(), GSF_plan_add_(), GSF_push_start_(), handle_add_queue_message(), handle_backchannel_encapsulation(), handle_channel_create(), handle_client_redirect_to_service(), handle_client_seed(), handle_client_send(), handle_client_send(), handle_client_send_request(), handle_client_start(), handle_communicator_available(), handle_communicator_backchannel(), handle_connect(), handle_connect_notify(), handle_connection_create(), handle_core_connect(), handle_core_connect(), handle_core_disconnect(), handle_core_disconnect(), handle_del_queue_message(), handle_dht_p2p_get(), handle_dht_p2p_put(), handle_dht_p2p_result(), handle_disconnect(), handle_disconnect_notify(), handle_dv_box(), handle_dv_learn(), handle_flow_control(), handle_fragment_box(), handle_hello(), handle_hello_for_client(), handle_icmp_remote(), handle_icmp_service(), handle_inbound_channel(), handle_incoming_ack(), handle_incoming_msg(), handle_init_reply(), handle_initiator_hello_cont(), handle_iterate_start(), handle_local_ack(), handle_local_data(), handle_monitor_start(), handle_notify_inbound(), handle_p2p_estimate(), handle_p2p_get(), handle_p2p_migration_stop(), handle_p2p_put(), handle_peer_check(), handle_peer_pull_reply(), handle_peer_pull_request(), handle_peer_push(), handle_raw_message(), handle_recv(), handle_regex_result(), handle_reliability_ack(), handle_reliability_box(), handle_reply(), handle_revocation_union_request(), handle_room_entry(), handle_search_response(), handle_send_message_ack(), handle_send_ok(), handle_send_ready(), handle_store(), handle_suggest(), handle_tcp_data(), handle_tcp_remote(), handle_tcp_service(), handle_test(), handle_test(), handle_transport_notify_connect(), handle_transport_notify_disconnect(), handle_udp_remote(), handle_udp_service(), handle_validation_response(), handshake_ack_monotime_cb(), handshake_ack_monotime_cb(), handshake_monotime_cb(), handshake_monotime_cb(), hello_add_iter(), hello_iter(), hello_iter_cb(), host_processor(), hosts_directory_scan_callback(), ifc_broadcast(), init_cb(), init_peer_cb(), insert_in_sampler(), iterate_destroy_peers(), keygen_round1_new_element(), keygen_round2_new_element(), learn_dv_path(), monitor_cb(), monitor_notify_connect(), monitor_notify_disconnect(), mq_error(), mq_error(), mq_error(), mq_error(), mq_error(), mq_error(), mq_init(), mq_init(), mq_init(), mq_online_check_successful(), mq_send_impl(), neighbour_delete(), new_channel(), new_service_channel(), notify_client_connect_info(), notify_connect(), notify_connect(), notify_connect(), notify_connect(), notify_connect(), notify_disconnect(), notify_disconnect(), notify_disconnect(), operation_timeout(), pass_plaintext_to_core(), pass_plaintext_to_core(), path_callback(), peer_destroy(), print_channel_destination(), print_info(), print_peer_list(), print_plugin_event_info(), process_migration_content(), process_notify(), process_peer(), process_peer_iteration_cb(), process_peer_string(), process_peerinfo_peers(), proto_read_kx(), proto_read_kx(), queue_destroy(), queue_destroy(), queue_destroy(), queue_send_msg(), receiver_destroy(), rekey_monotime_cb(), rekey_monotime_cb(), reliability_box_message(), rem_from_list(), requester_callback(), reschedule_hellos(), reset_cadet(), restart_kx(), result_processor(), route_control_message_without_fc(), route_message(), route_packet(), route_via_neighbour(), RPS_sampler_elem_next(), run(), run(), schedule_next_hello(), schedule_transmit_on_queue(), select_peer(), select_write_cb(), send_broken(), send_enter_room(), send_heartbeat(), send_message(), send_messages(), send_msg_from_cache(), send_pull_reply(), send_pull_request(), send_push(), set_peer_online(), sign_srv_room_message(), sock_read(), start_address_validation(), start_cb(), stop_peer_run(), suggest_to_connect(), tokenized_cb(), transmit_cummulative_ack_cb(), transmit_on_queue(), transmit_pending(), transmit_task_cb(), transmit_task_cb(), try_transmission(), valid_peers_iterator(), and validation_transmit_on_queue().

Here is the call graph for this function:

◆ GNUNET_i2s2()

const char * GNUNET_i2s2 ( const struct GNUNET_PeerIdentity pid)

Convert a peer identity to a string (for printing debug messages).

This is one of the very few calls in the entire API that is NOT reentrant! Identical to GNUNET_i2s(), except that another buffer is used so both GNUNET_i2s() and GNUNET_i2s2() can be used within the same log statement.

Parameters
pidthe peer identity
Returns
string form of the pid; will be overwritten by next call to GNUNET_i2s().

Identical to GNUNET_i2s(), except that another buffer is used so both GNUNET_i2s() and GNUNET_i2s2() can be used within the same log statement.

Parameters
pidthe peer identity
Returns
string form of the pid; will be overwritten by next call to GNUNET_i2s.

Definition at line 1398 of file common_logging.c.

1399{
1400 static GNUNET_THREAD_LOCAL char buf[5];
1401 char *ret;
1402
1403 if (NULL == pid)
1404 return "NULL";
1406 GNUNET_strlcpy (buf, ret, sizeof(buf));
1407 GNUNET_free (ret);
1408 return buf;
1409}

References GNUNET_CRYPTO_eddsa_public_key_to_string(), GNUNET_free, GNUNET_strlcpy(), GNUNET_THREAD_LOCAL, pid, GNUNET_PeerIdentity::public_key, and ret.

Referenced by decaps_dv_box_cb(), destroy_route(), forward_dv_learn(), send_broken(), and send_msg_from_cache().

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

◆ GNUNET_i2s_full()

const char * GNUNET_i2s_full ( const struct GNUNET_PeerIdentity pid)

Convert a peer identity to a string (for printing debug messages).

This is one of the very few calls in the entire API that is NOT reentrant!

Parameters
pidthe peer identity
Returns
string form of the pid; will be overwritten by next call to GNUNET_i2s_full().
Parameters
pidthe peer identity
Returns
string form of the pid; will be overwritten by next call to GNUNET_i2s_full.

Definition at line 1420 of file common_logging.c.

1421{
1422 static GNUNET_THREAD_LOCAL char buf[256];
1423 char *ret;
1424
1426 strcpy (buf, ret);
1427 GNUNET_free (ret);
1428 return buf;
1429}

References GNUNET_CRYPTO_eddsa_public_key_to_string(), GNUNET_free, GNUNET_THREAD_LOCAL, pid, GNUNET_PeerIdentity::public_key, and ret.

Referenced by channel_incoming(), consider_ss_ack(), create_receiver(), do_round(), enc_notify_cb(), gns_value_to_string(), GNUNET_TRANSPORT_TESTING_start_peer(), hist_update(), on_message(), operation_timeout(), peers_callback(), pid_change_cb(), pils_pid_change_cb(), regex_found(), reply_handle(), restore_valid_peers(), run(), start_peer_run(), store_peer_presistently_iterator(), stream_input_handle(), tunnels_callback(), and view_update_handle().

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

◆ GNUNET_a2s()

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).

This is one of the very few calls in the entire API that is NOT reentrant!

Parameters
addrthe address
addrlenthe length of the addr
Returns
nicely formatted string for the address will be overwritten by next call to GNUNET_a2s().

This is one of the very few calls in the entire API that is NOT reentrant!

Parameters
addrthe address
addrlenthe length of the address in addr
Returns
nicely formatted string for the address will be overwritten by next call to GNUNET_a2s.

Definition at line 1443 of file common_logging.c.

1445{
1446#define LEN \
1447 GNUNET_MAX ((INET6_ADDRSTRLEN + 8), \
1448 (1 + sizeof(struct sockaddr_un) - sizeof(sa_family_t)))
1449 static GNUNET_THREAD_LOCAL char buf[LEN];
1450#undef LEN
1451 static GNUNET_THREAD_LOCAL char b2[6];
1452 const struct sockaddr_in *v4;
1453 const struct sockaddr_un *un;
1454 const struct sockaddr_in6 *v6;
1455 unsigned int off;
1456
1457 if (addr == NULL)
1458 return _ ("unknown address");
1459 switch (addr->sa_family)
1460 {
1461 case AF_INET:
1462 if (addrlen != sizeof(struct sockaddr_in))
1463 return "<invalid v4 address>";
1464 v4 = (const struct sockaddr_in *) addr;
1465 inet_ntop (AF_INET, &v4->sin_addr, buf, INET_ADDRSTRLEN);
1466 if (0 == ntohs (v4->sin_port))
1467 return buf;
1468 strcat (buf, ":");
1469 GNUNET_snprintf (b2, sizeof(b2), "%u", ntohs (v4->sin_port));
1470 strcat (buf, b2);
1471 return buf;
1472
1473 case AF_INET6:
1474 if (addrlen != sizeof(struct sockaddr_in6))
1475 return "<invalid v6 address>";
1476 v6 = (const struct sockaddr_in6 *) addr;
1477 buf[0] = '[';
1478 inet_ntop (AF_INET6, &v6->sin6_addr, &buf[1], INET6_ADDRSTRLEN);
1479 if (0 == ntohs (v6->sin6_port))
1480 return &buf[1];
1481 strcat (buf, "]:");
1482 GNUNET_snprintf (b2, sizeof(b2), "%u", ntohs (v6->sin6_port));
1483 strcat (buf, b2);
1484 return buf;
1485
1486 case AF_UNIX:
1487 if (addrlen <= sizeof(sa_family_t))
1488 return "<unbound UNIX client>";
1489 un = (const struct sockaddr_un *) addr;
1490 off = 0;
1491 if ('\0' == un->sun_path[0])
1492 off++;
1493 memset (buf, 0, sizeof(buf));
1494 GNUNET_snprintf (buf,
1495 sizeof(buf),
1496 "%s%.*s",
1497 (1 == off) ? "@" : "",
1498 (int) (addrlen - sizeof(sa_family_t) - off),
1499 &un->sun_path[off]);
1500 return buf;
1501
1502 default:
1503 return _ ("invalid address");
1504 }
1505}
#define LEN
int GNUNET_snprintf(char *buf, size_t size, const char *format,...) __attribute__((format(printf
Like snprintf, just aborts if the buffer is of insufficient size.

References _, GNUNET_snprintf(), GNUNET_THREAD_LOCAL, and LEN.

Referenced by accept_client(), add_addr(), add_addr(), addr_cb(), addr_cb(), address_cb(), check_and_remove_pending_reversal(), check_and_remove_pending_reversal(), create_listen_socket(), create_proto_queue(), create_proto_queue(), create_udp_socket(), free_lal(), get_server_addresses(), get_server_addresses(), GNUNET_get_udp_socket(), GNUNET_NAT_AUTO_test_start(), GNUNET_NAT_test_start(), GNUNET_NETWORK_socket_accept(), GNUNET_NT_scanner_get_type(), handle_request(), handle_response(), iface_proc(), ifc_broadcast(), init_socket(), init_socket(), interface_proc(), mq_init(), mq_init(), mq_send_d(), nat_address_cb(), nat_address_cb(), nat_address_cb(), nat_address_cb(), nat_register(), notify_client(), notify_client_external_ipv4_change(), open_listen_socket(), pending_reversal_timeout(), pending_reversal_timeout(), print_sockaddr(), process_external_ip(), proto_read_kx(), proto_read_kx(), queue_read_kx(), queue_read_kx(), read_send(), reversal_cb(), run(), run(), run(), run(), run(), run(), run_scan(), send_msg_with_kx(), sock_read(), sock_read(), sock_read(), sockaddr_to_udpaddr_string(), sockaddr_to_udpaddr_string(), sockaddr_to_udpaddr_string(), submit_get_request(), submit_post_request(), transmit_query(), try_connect_using_address(), try_handle_plaintext(), try_handle_plaintext(), try_send_tcp(), try_send_udp(), and upnp_addr_change_cb().

Here is the call graph for this function:

◆ GNUNET_hex2b()

size_t GNUNET_hex2b ( const char *  src,
void *  dst,
size_t  dstlen,
int  invert 
)

Parse an ascii-encoded hexadecimal string into the buffer.

The buffer must be (strlen (src) / 2) bytes in length.

Parameters
srcthe string
dstthe destination buffer
dst_lenthe length of the dst buffer
invertread from src in inverted direction.
Returns
number of bytes written.

Definition at line 1593 of file common_logging.c.

1597{
1598 const char *line = src;
1599 const char *data = line;
1600 uint8_t *buf = dst;
1601 int off;
1602 int read_byte;
1603 int data_len = 0;
1604
1605 while ((data_len < dstlen) &&
1606 (sscanf (data, " %02x%n", &read_byte, &off) == 1))
1607 {
1608 if (invert)
1609 buf[dstlen - 1 - data_len++] = read_byte;
1610 else
1611 buf[data_len++] = read_byte;
1612 data += off;
1613 }
1614 return data_len;
1615}
static char * line
Desired phone line (string to be converted to a hash).
static char * data
The data to insert into the dht.

References data, and line.

Referenced by run(), and run().

Here is the caller graph for this function:

◆ GNUNET_print_bytes()

void GNUNET_print_bytes ( const void *  buf,
size_t  buf_len,
int  fold,
int  in_be 
)

Print a byte string in hexadecimal ascii notation.

Parameters
bufthe byte string
buf_lenthe length of the buf buffer
foldinsert newline after this number of bytes (0 for no folding)
in_beOutput byte string in NBO

Definition at line 1619 of file common_logging.c.

1623{
1624 int i;
1625
1626 for (i = 0; i < buf_len; i++)
1627 {
1628 if (0 != i)
1629 {
1630 if ((0 != fold) && (i % fold == 0))
1631 printf ("\n");
1632 }
1633 if (in_be)
1634 printf ("%02x", ((unsigned char*) buf)[buf_len - 1 - i]);
1635 else
1636 printf ("%02x", ((unsigned char*) buf)[i]);
1637 }
1638 printf ("\n");
1639}

Referenced by cb_print_put_message(), GSC_KX_encrypt_and_transmit(), handle_encrypted_message(), main(), run(), and run().

Here is the caller graph for this function:

◆ GNUNET_error_type_to_string()

const char * GNUNET_error_type_to_string ( enum GNUNET_ErrorType  kind)

Convert error type to string.

Parameters
kindtype to convert
Returns
string corresponding to the type

Definition at line 1181 of file common_logging.c.

1182{
1183 if ((kind & GNUNET_ERROR_TYPE_ERROR) > 0)
1184 return _ ("ERROR");
1185 if ((kind & GNUNET_ERROR_TYPE_WARNING) > 0)
1186 return _ ("WARNING");
1187 if ((kind & GNUNET_ERROR_TYPE_MESSAGE) > 0)
1188 return _ ("MESSAGE");
1189 if ((kind & GNUNET_ERROR_TYPE_INFO) > 0)
1190 return _ ("INFO");
1191 if ((kind & GNUNET_ERROR_TYPE_DEBUG) > 0)
1192 return _ ("DEBUG");
1193 if ((kind & ~GNUNET_ERROR_TYPE_BULK) == 0)
1194 return _ ("NONE");
1195 return _ ("INVALID");
1196}

References _, GNUNET_ERROR_TYPE_BULK, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_ERROR_TYPE_MESSAGE, and GNUNET_ERROR_TYPE_WARNING.

Referenced by output_message(), and run().

Here is the caller graph for this function: