| gnunet_common.h | | gnunet_common.h | |
| | | | |
| skipping to change at line 49 | | skipping to change at line 49 | |
| #ifdef MINGW | | #ifdef MINGW | |
| #include "winproc.h" | | #include "winproc.h" | |
| #endif | | #endif | |
| #ifdef HAVE_STDINT_H | | #ifdef HAVE_STDINT_H | |
| #include <stdint.h> | | #include <stdint.h> | |
| #endif | | #endif | |
| #ifdef HAVE_STDARG_H | | #ifdef HAVE_STDARG_H | |
| #include <stdarg.h> | | #include <stdarg.h> | |
| #endif | | #endif | |
| | | | |
|
| | | #ifdef __cplusplus | |
| | | extern "C" | |
| | | { | |
| | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| | | } | |
| | | #endif | |
| | | #endif | |
| | | | |
| /** | | /** | |
| * Version of the API (for entire gnunetutil.so library). | | * Version of the API (for entire gnunetutil.so library). | |
| */ | | */ | |
|
| #define GNUNET_UTIL_VERSION 0x00090200 | | #define GNUNET_UTIL_VERSION 0x00090400 | |
| | | | |
| /** | | /** | |
| * Named constants for return values. The following | | * Named constants for return values. The following | |
| * invariants hold: "GNUNET_NO == 0" (to allow "if (GNUNET_NO)") | | * invariants hold: "GNUNET_NO == 0" (to allow "if (GNUNET_NO)") | |
| * "GNUNET_OK != GNUNET_SYSERR", "GNUNET_OK != GNUNET_NO", "GNUNET_NO != GN
UNET_SYSERR" | | * "GNUNET_OK != GNUNET_SYSERR", "GNUNET_OK != GNUNET_NO", "GNUNET_NO != GN
UNET_SYSERR" | |
| * and finally "GNUNET_YES != GNUNET_NO". | | * and finally "GNUNET_YES != GNUNET_NO". | |
| */ | | */ | |
| #define GNUNET_OK 1 | | #define GNUNET_OK 1 | |
| #define GNUNET_SYSERR -1 | | #define GNUNET_SYSERR -1 | |
| #define GNUNET_YES 1 | | #define GNUNET_YES 1 | |
| | | | |
| skipping to change at line 170 | | skipping to change at line 178 | |
| /** | | /** | |
| * gcc-ism to document unused arguments | | * gcc-ism to document unused arguments | |
| */ | | */ | |
| #define GNUNET_UNUSED __attribute__((unused)) | | #define GNUNET_UNUSED __attribute__((unused)) | |
| | | | |
| /** | | /** | |
| * gcc-ism to document functions that don't return | | * gcc-ism to document functions that don't return | |
| */ | | */ | |
| #define GNUNET_NORETURN __attribute__((noreturn)) | | #define GNUNET_NORETURN __attribute__((noreturn)) | |
| | | | |
|
| | | #if MINGW | |
| #if __GNUC__ > 3 | | #if __GNUC__ > 3 | |
| /** | | /** | |
|
| * gcc 4.x-ism to pack structures even on W32 (to be used before structs) | | * gcc 4.x-ism to pack structures even on W32 (to be used before structs); | |
| | | * Using this would cause structs to be unaligned on the stack on Sparc, | |
| | | * so we *only* use this on W32 (see #670578 from Debian); fortunately, | |
| | | * W32 doesn't run on sparc anyway. | |
| */ | | */ | |
| #define GNUNET_NETWORK_STRUCT_BEGIN \ | | #define GNUNET_NETWORK_STRUCT_BEGIN \ | |
| _Pragma("pack(push)") \ | | _Pragma("pack(push)") \ | |
| _Pragma("pack(1)") | | _Pragma("pack(1)") | |
| | | | |
| /** | | /** | |
| * gcc 4.x-ism to pack structures even on W32 (to be used after structs) | | * gcc 4.x-ism to pack structures even on W32 (to be used after structs) | |
|
| | | * Using this would cause structs to be unaligned on the stack on Sparc, | |
| | | * so we *only* use this on W32 (see #670578 from Debian); fortunately, | |
| | | * W32 doesn't run on sparc anyway. | |
| */ | | */ | |
| #define GNUNET_NETWORK_STRUCT_END _Pragma("pack(pop)") | | #define GNUNET_NETWORK_STRUCT_END _Pragma("pack(pop)") | |
|
| | | | |
| #else | | #else | |
|
| #ifdef MINGW | | | |
| #error gcc 4.x or higher required on W32 systems | | #error gcc 4.x or higher required on W32 systems | |
| #endif | | #endif | |
|
| | | #else | |
| /** | | /** | |
|
| * Good luck, GNUNET_PACKED should suffice, but this won't work on W32 | | * Define as empty, GNUNET_PACKED should suffice, but this won't work on W3
2 | |
| */ | | */ | |
| #define GNUNET_NETWORK_STRUCT_BEGIN | | #define GNUNET_NETWORK_STRUCT_BEGIN | |
| | | | |
| /** | | /** | |
|
| * Good luck, GNUNET_PACKED should suffice, but this won't work on W32 | | * Define as empty, GNUNET_PACKED should suffice, but this won't work on W3
2; | |
| */ | | */ | |
| #define GNUNET_NETWORK_STRUCT_END | | #define GNUNET_NETWORK_STRUCT_END | |
| #endif | | #endif | |
| | | | |
| /* ************************ super-general types *********************** */ | | /* ************************ super-general types *********************** */ | |
| | | | |
| GNUNET_NETWORK_STRUCT_BEGIN | | GNUNET_NETWORK_STRUCT_BEGIN | |
| | | | |
| /** | | /** | |
| * Header for all communications. | | * Header for all communications. | |
| | | | |
| skipping to change at line 221 | | skipping to change at line 237 | |
| uint16_t size GNUNET_PACKED; | | uint16_t size GNUNET_PACKED; | |
| | | | |
| /** | | /** | |
| * The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian form
at. | | * The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian form
at. | |
| */ | | */ | |
| uint16_t type GNUNET_PACKED; | | uint16_t type GNUNET_PACKED; | |
| | | | |
| }; | | }; | |
| | | | |
| /** | | /** | |
|
| * @brief 512-bit hashcode | | * @brief A SHA-512 hashcode | |
| */ | | */ | |
|
| typedef struct GNUNET_HashCode | | struct GNUNET_HashCode | |
| { | | { | |
| uint32_t bits[512 / 8 / sizeof (uint32_t)]; /* = 16 */ | | uint32_t bits[512 / 8 / sizeof (uint32_t)]; /* = 16 */ | |
|
| } | | }; | |
| GNUNET_HashCode; | | | |
| | | /** | |
| | | * @brief A SHA-256 hashcode | |
| | | */ | |
| | | struct GNUNET_CRYPTO_ShortHashCode | |
| | | { | |
| | | uint32_t bits[256 / 8 / sizeof (uint32_t)]; /* = 8 */ | |
| | | }; | |
| | | | |
| /** | | /** | |
| * The identity of the host (basically the SHA-512 hashcode of | | * The identity of the host (basically the SHA-512 hashcode of | |
| * it's public key). | | * it's public key). | |
| */ | | */ | |
| struct GNUNET_PeerIdentity | | struct GNUNET_PeerIdentity | |
| { | | { | |
|
| GNUNET_HashCode hashPubKey; | | struct GNUNET_HashCode hashPubKey; | |
| }; | | }; | |
| GNUNET_NETWORK_STRUCT_END | | GNUNET_NETWORK_STRUCT_END | |
| | | | |
| /** | | /** | |
| * Function called with a filename. | | * Function called with a filename. | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param filename complete filename (absolute path) | | * @param filename complete filename (absolute path) | |
| * @return GNUNET_OK to continue to iterate, | | * @return GNUNET_OK to continue to iterate, | |
| * GNUNET_SYSERR to abort iteration with error! | | * GNUNET_SYSERR to abort iteration with error! | |
| | | | |
| skipping to change at line 280 | | skipping to change at line 303 | |
| * @param kind severeity | | * @param kind severeity | |
| * @param component what component is issuing the message? | | * @param component what component is issuing the message? | |
| * @param date when was the message logged? | | * @param date when was the message logged? | |
| * @param message what is the message | | * @param message what is the message | |
| */ | | */ | |
| typedef void (*GNUNET_Logger) (void *cls, enum GNUNET_ErrorType kind, | | typedef void (*GNUNET_Logger) (void *cls, enum GNUNET_ErrorType kind, | |
| const char *component, const char *date, | | const char *component, const char *date, | |
| const char *message); | | const char *message); | |
| | | | |
| /** | | /** | |
|
| * Number of log calls to ignore. | | * Get the number of log calls that are going to be skipped | |
| | | * | |
| | | * @return number of log calls to be ignored | |
| */ | | */ | |
|
| extern unsigned int skip_log; | | int | |
| | | GNUNET_get_log_skip (); | |
| | | | |
| #if !defined(GNUNET_CULL_LOGGING) | | #if !defined(GNUNET_CULL_LOGGING) | |
| int | | int | |
| GNUNET_get_log_call_status (int caller_level, const char *comp, | | GNUNET_get_log_call_status (int caller_level, const char *comp, | |
| const char *file, const char *function, int lin
e); | | const char *file, const char *function, int lin
e); | |
| #endif | | #endif | |
|
| | | | |
| /** | | /** | |
| * Main log function. | | * Main log function. | |
| * | | * | |
| * @param kind how serious is the error? | | * @param kind how serious is the error? | |
| * @param message what is the message (format string) | | * @param message what is the message (format string) | |
| * @param ... arguments for format string | | * @param ... arguments for format string | |
| */ | | */ | |
| void | | void | |
| GNUNET_log_nocheck (enum GNUNET_ErrorType kind, const char *message, ...); | | GNUNET_log_nocheck (enum GNUNET_ErrorType kind, const char *message, ...); | |
| | | | |
| | | | |
| skipping to change at line 340 | | skipping to change at line 367 | |
| void | | void | |
| GNUNET_log_from_nocheck (enum GNUNET_ErrorType kind, const char *comp, | | GNUNET_log_from_nocheck (enum GNUNET_ErrorType kind, const char *comp, | |
| const char *message, ...); | | const char *message, ...); | |
| | | | |
| #if !defined(GNUNET_CULL_LOGGING) | | #if !defined(GNUNET_CULL_LOGGING) | |
| #define GNUNET_log_from(kind,comp,...) do { int log_line = __LINE__;\ | | #define GNUNET_log_from(kind,comp,...) do { int log_line = __LINE__;\ | |
| static int log_call_enabled = GNUNET_LOG_CALL_STATUS;\ | | static int log_call_enabled = GNUNET_LOG_CALL_STATUS;\ | |
| if ((GNUNET_EXTRA_LOGGING > 0) || ((GNUNET_ERROR_TYPE_DEBUG & (kind)) ==
0)) { \ | | if ((GNUNET_EXTRA_LOGGING > 0) || ((GNUNET_ERROR_TYPE_DEBUG & (kind)) ==
0)) { \ | |
| if (GN_UNLIKELY(log_call_enabled == -1))\ | | if (GN_UNLIKELY(log_call_enabled == -1))\ | |
| log_call_enabled = GNUNET_get_log_call_status ((kind) & (~GNUNET_ERRO
R_TYPE_BULK), (comp), __FILE__, __FUNCTION__, log_line); \ | | log_call_enabled = GNUNET_get_log_call_status ((kind) & (~GNUNET_ERRO
R_TYPE_BULK), (comp), __FILE__, __FUNCTION__, log_line); \ | |
|
| if (GN_UNLIKELY(skip_log > 0)) {skip_log--;}\ | | if (GN_UNLIKELY(GNUNET_get_log_skip () > 0)) { GNUNET_log_skip (-1, GNU
NET_NO); }\ | |
| else {\ | | else {\ | |
| if (GN_UNLIKELY(log_call_enabled))\ | | if (GN_UNLIKELY(log_call_enabled))\ | |
| GNUNET_log_from_nocheck ((kind), comp, __VA_ARGS__); \ | | GNUNET_log_from_nocheck ((kind), comp, __VA_ARGS__); \ | |
| }\ | | }\ | |
| }\ | | }\ | |
| } while (0) | | } while (0) | |
| | | | |
| #define GNUNET_log(kind,...) do { int log_line = __LINE__;\ | | #define GNUNET_log(kind,...) do { int log_line = __LINE__;\ | |
| static int log_call_enabled = GNUNET_LOG_CALL_STATUS;\ | | static int log_call_enabled = GNUNET_LOG_CALL_STATUS;\ | |
| if ((GNUNET_EXTRA_LOGGING > 0) || ((GNUNET_ERROR_TYPE_DEBUG & (kind)) ==
0)) { \ | | if ((GNUNET_EXTRA_LOGGING > 0) || ((GNUNET_ERROR_TYPE_DEBUG & (kind)) ==
0)) { \ | |
| if (GN_UNLIKELY(log_call_enabled == -1))\ | | if (GN_UNLIKELY(log_call_enabled == -1))\ | |
| log_call_enabled = GNUNET_get_log_call_status ((kind) & (~GNUNET_ERRO
R_TYPE_BULK), NULL, __FILE__, __FUNCTION__, log_line);\ | | log_call_enabled = GNUNET_get_log_call_status ((kind) & (~GNUNET_ERRO
R_TYPE_BULK), NULL, __FILE__, __FUNCTION__, log_line);\ | |
|
| if (GN_UNLIKELY(skip_log > 0)) {skip_log--;}\ | | if (GN_UNLIKELY(GNUNET_get_log_skip () > 0)) { GNUNET_log_skip (-1, GNU
NET_NO); }\ | |
| else {\ | | else {\ | |
| if (GN_UNLIKELY(log_call_enabled))\ | | if (GN_UNLIKELY(log_call_enabled))\ | |
| GNUNET_log_nocheck ((kind), __VA_ARGS__); \ | | GNUNET_log_nocheck ((kind), __VA_ARGS__); \ | |
| }\ | | }\ | |
| }\ | | }\ | |
| } while (0) | | } while (0) | |
| #else | | #else | |
| #define GNUNET_log(...) | | #define GNUNET_log(...) | |
| #define GNUNET_log_from(...) | | #define GNUNET_log_from(...) | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
|
| | | * Log error message about missing configuration option. | |
| | | * | |
| | | * @param kind log level | |
| | | * @param section section with missing option | |
| | | * @param option name of missing option | |
| | | */ | |
| | | void | |
| | | GNUNET_log_config_missing (enum GNUNET_ErrorType kind, | |
| | | const char *section, | |
| | | const char *option); | |
| | | | |
| | | /** | |
| | | * Log error message about invalid configuration option value. | |
| | | * | |
| | | * @param kind log level | |
| | | * @param section section with invalid option | |
| | | * @param option name of invalid option | |
| | | * @param required what is required that is invalid about the option | |
| | | */ | |
| | | void | |
| | | GNUNET_log_config_invalid (enum GNUNET_ErrorType kind, | |
| | | const char *section, | |
| | | const char *option, | |
| | | const char *required); | |
| | | | |
| | | /** | |
| * Abort the process, generate a core dump if possible. | | * Abort the process, generate a core dump if possible. | |
| */ | | */ | |
| void | | void | |
| GNUNET_abort (void) GNUNET_NORETURN; | | GNUNET_abort (void) GNUNET_NORETURN; | |
| | | | |
| /** | | /** | |
| * Ignore the next n calls to the log function. | | * Ignore the next n calls to the log function. | |
| * | | * | |
|
| * @param n number of log calls to ignore | | * @param n number of log calls to ignore (could be negative) | |
| * @param check_reset GNUNET_YES to assert that the log skip counter is cur
rently zero | | * @param check_reset GNUNET_YES to assert that the log skip counter is cur
rently zero | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_log_skip (unsigned int n, int check_reset); | | GNUNET_log_skip (int n, int check_reset); | |
| | | | |
| /** | | /** | |
| * Setup logging. | | * Setup logging. | |
| * | | * | |
| * @param comp default component to use | | * @param comp default component to use | |
| * @param loglevel what types of messages should be logged | | * @param loglevel what types of messages should be logged | |
| * @param logfile change logging to logfile (use NULL to keep stderr) | | * @param logfile change logging to logfile (use NULL to keep stderr) | |
| * @return GNUNET_OK on success, GNUNET_SYSERR if logfile could not be open
ed | | * @return GNUNET_OK on success, GNUNET_SYSERR if logfile could not be open
ed | |
| */ | | */ | |
| int | | int | |
| | | | |
| skipping to change at line 410 | | skipping to change at line 463 | |
| /** | | /** | |
| * Remove a custom logger. | | * Remove a custom logger. | |
| * | | * | |
| * @param logger log function | | * @param logger log function | |
| * @param logger_cls closure for logger | | * @param logger_cls closure for logger | |
| */ | | */ | |
| void | | void | |
| GNUNET_logger_remove (GNUNET_Logger logger, void *logger_cls); | | GNUNET_logger_remove (GNUNET_Logger logger, void *logger_cls); | |
| | | | |
| /** | | /** | |
|
| | | * 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! | |
| | | * | |
| | | * @param hc the short hash code | |
| | | * @return string | |
| | | */ | |
| | | const char * | |
| | | GNUNET_short_h2s (const struct GNUNET_CRYPTO_ShortHashCode * hc); | |
| | | | |
| | | /** | |
| | | * Convert a short 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! | |
| | | * | |
| | | * @param hc the short hash code | |
| | | * @return string | |
| | | */ | |
| | | const char * | |
| | | GNUNET_short_h2s_full (const struct GNUNET_CRYPTO_ShortHashCode * hc); | |
| | | | |
| | | /** | |
| * Convert a hash value to a string (for printing debug messages). | | * 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 | | * This is one of the very few calls in the entire API that is | |
| * NOT reentrant! | | * NOT reentrant! | |
| * | | * | |
| * @param hc the hash code | | * @param hc the hash code | |
| * @return string | | * @return string | |
| */ | | */ | |
| const char * | | const char * | |
|
| GNUNET_h2s (const GNUNET_HashCode * hc); | | GNUNET_h2s (const struct GNUNET_HashCode * hc); | |
| | | | |
| /** | | /** | |
| * Convert a hash value to a string (for printing debug messages). | | * Convert a hash value to a string (for printing debug messages). | |
| * This prints all 104 characters of a hashcode! | | * This prints all 104 characters of a hashcode! | |
| * This is one of the very few calls in the entire API that is | | * This is one of the very few calls in the entire API that is | |
| * NOT reentrant! | | * NOT reentrant! | |
| * | | * | |
| * @param hc the hash code | | * @param hc the hash code | |
| * @return string | | * @return string | |
| */ | | */ | |
| const char * | | const char * | |
|
| GNUNET_h2s_full (const GNUNET_HashCode * hc); | | GNUNET_h2s_full (const struct GNUNET_HashCode * hc); | |
| | | | |
| /** | | /** | |
| * Convert a peer identity to a string (for printing debug messages). | | * 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 | | * This is one of the very few calls in the entire API that is | |
| * NOT reentrant! | | * NOT reentrant! | |
| * | | * | |
| * @param pid the peer identity | | * @param pid the peer identity | |
| * @return string form of the pid; will be overwritten by next | | * @return string form of the pid; will be overwritten by next | |
| * call to GNUNET_i2s. | | * call to GNUNET_i2s. | |
| */ | | */ | |
| | | | |
| skipping to change at line 835 | | skipping to change at line 911 | |
| GNUNET_copy_message (const struct GNUNET_MessageHeader *msg); | | GNUNET_copy_message (const struct GNUNET_MessageHeader *msg); | |
| | | | |
| #if __STDC_VERSION__ < 199901L | | #if __STDC_VERSION__ < 199901L | |
| #if __GNUC__ >= 2 | | #if __GNUC__ >= 2 | |
| #define __func__ __FUNCTION__ | | #define __func__ __FUNCTION__ | |
| #else | | #else | |
| #define __func__ "<unknown>" | | #define __func__ "<unknown>" | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
|
| | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| | | { | |
| | | #endif | |
| | | #ifdef __cplusplus | |
| | | } | |
| | | #endif | |
| | | | |
| #endif /*GNUNET_COMMON_H_ */ | | #endif /*GNUNET_COMMON_H_ */ | |
| | | | |
End of changes. 26 change blocks. |
| 18 lines changed or deleted | | 101 lines changed or added | |
|
| gnunet_config.h | | gnunet_config.h | |
| | | | |
| skipping to change at line 15 | | skipping to change at line 15 | |
| | | | |
| /* Define to 1 if the `closedir' function returns void instead of `int'. */ | | /* Define to 1 if the `closedir' function returns void instead of `int'. */ | |
| /* #undef CLOSEDIR_VOID */ | | /* #undef CLOSEDIR_VOID */ | |
| | | | |
| /* This is a Cygwin system */ | | /* This is a Cygwin system */ | |
| /* #undef CYGWIN */ | | /* #undef CYGWIN */ | |
| | | | |
| /* This is an Apple Darwin system */ | | /* This is an Apple Darwin system */ | |
| /* #undef DARWIN */ | | /* #undef DARWIN */ | |
| | | | |
|
| | | /* enable expensive heap statistics */ | |
| | | #define ENABLE_HEAP_STATISTICS 0 | |
| | | | |
| /* Define to 1 if translation of program messages to the user's native | | /* Define to 1 if translation of program messages to the user's native | |
| language is requested. */ | | language is requested. */ | |
| #define ENABLE_NLS 1 | | #define ENABLE_NLS 1 | |
| | | | |
|
| | | /* 1 if freed memory should be poisoned, 0 otherwise */ | |
| | | #define ENABLE_POISONING 0 | |
| | | | |
| /* enable workarounds used on Windows (only useful for test cases) */ | | /* enable workarounds used on Windows (only useful for test cases) */ | |
| #define ENABLE_WINDOWS_WORKAROUNDS 0 | | #define ENABLE_WINDOWS_WORKAROUNDS 0 | |
| | | | |
| /* Build a Mac OS X Framework */ | | /* Build a Mac OS X Framework */ | |
| /* #undef FRAMEWORK_BUILD */ | | /* #undef FRAMEWORK_BUILD */ | |
| | | | |
| /* This is a FreeBSD system */ | | /* This is a FreeBSD system */ | |
| /* #undef FREEBSD */ | | /* #undef FREEBSD */ | |
| | | | |
|
| | | /* This is a GNU system */ | |
| | | /* #undef GNU */ | |
| | | | |
| /* Define to cull all logging calls */ | | /* Define to cull all logging calls */ | |
| /* #undef GNUNET_CULL_LOGGING */ | | /* #undef GNUNET_CULL_LOGGING */ | |
| | | | |
| /* This should be the default choice for the name of the first network | | /* This should be the default choice for the name of the first network | |
| interface */ | | interface */ | |
| #define GNUNET_DEFAULT_INTERFACE "eth0" | | #define GNUNET_DEFAULT_INTERFACE "eth0" | |
| | | | |
| /* 1 if extra logging is enabled, 2 for very verbose extra logging, 0 | | /* 1 if extra logging is enabled, 2 for very verbose extra logging, 0 | |
| otherwise */ | | otherwise */ | |
| #define GNUNET_EXTRA_LOGGING GNUNET_NO | | #define GNUNET_EXTRA_LOGGING GNUNET_NO | |
| | | | |
| skipping to change at line 80 | | skipping to change at line 89 | |
| CoreFoundation framework. */ | | CoreFoundation framework. */ | |
| /* #undef HAVE_CFLOCALECOPYCURRENT */ | | /* #undef HAVE_CFLOCALECOPYCURRENT */ | |
| | | | |
| /* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue i
n | | /* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue i
n | |
| the CoreFoundation framework. */ | | the CoreFoundation framework. */ | |
| /* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ | | /* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ | |
| | | | |
| /* Define to 1 if your system has a working `chown' function. */ | | /* Define to 1 if your system has a working `chown' function. */ | |
| #define HAVE_CHOWN 1 | | #define HAVE_CHOWN 1 | |
| | | | |
|
| /* Define to 1 if you have the `clock_gettime' function. */ | | | |
| /* #undef HAVE_CLOCK_GETTIME */ | | | |
| | | | |
| /* Define to 1 if you have the `closedir' function. */ | | /* Define to 1 if you have the `closedir' function. */ | |
| #define HAVE_CLOSEDIR 1 | | #define HAVE_CLOSEDIR 1 | |
| | | | |
| /* Define to 1 if you have the <ctype.h> header file. */ | | /* Define to 1 if you have the <ctype.h> header file. */ | |
| #define HAVE_CTYPE_H 1 | | #define HAVE_CTYPE_H 1 | |
| | | | |
| /* Define if the GNU dcgettext() function is already present or preinstalle
d. | | /* Define if the GNU dcgettext() function is already present or preinstalle
d. | |
| */ | | */ | |
| #define HAVE_DCGETTEXT 1 | | #define HAVE_DCGETTEXT 1 | |
| | | | |
| | | | |
| skipping to change at line 123 | | skipping to change at line 129 | |
| | | | |
| /* Define to 1 if you have the <dlfcn.h> header file. */ | | /* Define to 1 if you have the <dlfcn.h> header file. */ | |
| #define HAVE_DLFCN_H 1 | | #define HAVE_DLFCN_H 1 | |
| | | | |
| /* Define to 1 if you have the <dl.h> header file. */ | | /* Define to 1 if you have the <dl.h> header file. */ | |
| /* #undef HAVE_DL_H */ | | /* #undef HAVE_DL_H */ | |
| | | | |
| /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ | | /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ | |
| /* #undef HAVE_DOPRNT */ | | /* #undef HAVE_DOPRNT */ | |
| | | | |
|
| /* Define to 1 if you have the `dup2' function. */ | | | |
| #define HAVE_DUP2 1 | | | |
| | | | |
| /* Define if you have the _dyld_func_lookup function. */ | | /* Define if you have the _dyld_func_lookup function. */ | |
| /* #undef HAVE_DYLD */ | | /* #undef HAVE_DYLD */ | |
| | | | |
| /* Define to 1 if you have the <endian.h> header file. */ | | /* Define to 1 if you have the <endian.h> header file. */ | |
| #define HAVE_ENDIAN_H 1 | | #define HAVE_ENDIAN_H 1 | |
| | | | |
| /* Define to 1 if you have the <errno.h> header file. */ | | /* Define to 1 if you have the <errno.h> header file. */ | |
| #define HAVE_ERRNO_H 1 | | #define HAVE_ERRNO_H 1 | |
| | | | |
| /* Define to 1 if the system has the type `error_t'. */ | | /* Define to 1 if the system has the type `error_t'. */ | |
| #define HAVE_ERROR_T 1 | | #define HAVE_ERROR_T 1 | |
| | | | |
|
| | | /* Define to 1 if you have the <execinfo.h> header file. */ | |
| | | #define HAVE_EXECINFO_H 1 | |
| | | | |
| /* Define to 1 if you have the <extractor.h> header file. */ | | /* Define to 1 if you have the <extractor.h> header file. */ | |
| #define HAVE_EXTRACTOR_H 1 | | #define HAVE_EXTRACTOR_H 1 | |
| | | | |
| /* Define to 1 if you have the <fcntl.h> header file. */ | | /* Define to 1 if you have the <fcntl.h> header file. */ | |
| #define HAVE_FCNTL_H 1 | | #define HAVE_FCNTL_H 1 | |
| | | | |
|
| /* Define to 1 if you have the `fdatasync' function. */ | | | |
| #define HAVE_FDATASYNC 1 | | | |
| | | | |
| /* Define to 1 if you have the `floor' function. */ | | | |
| #define HAVE_FLOOR 1 | | | |
| | | | |
| /* Define to 1 if you have the `fork' function. */ | | /* Define to 1 if you have the `fork' function. */ | |
| #define HAVE_FORK 1 | | #define HAVE_FORK 1 | |
| | | | |
| /* Define to 1 if you have the `freeifaddrs' function. */ | | /* Define to 1 if you have the `freeifaddrs' function. */ | |
| #define HAVE_FREEIFADDRS 1 | | #define HAVE_FREEIFADDRS 1 | |
| | | | |
| /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ | | /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ | |
| #define HAVE_FSEEKO 1 | | #define HAVE_FSEEKO 1 | |
| | | | |
|
| /* Define to 1 if you have the `ftruncate' function. */ | | | |
| #define HAVE_FTRUNCATE 1 | | | |
| | | | |
| /* Define this if getaddrinfo() is available */ | | /* Define this if getaddrinfo() is available */ | |
| #define HAVE_GETADDRINFO 1 | | #define HAVE_GETADDRINFO 1 | |
| | | | |
|
| /* Define to 1 if you have the `getcwd' function. */ | | | |
| #define HAVE_GETCWD 1 | | | |
| | | | |
| /* Define this if gethostbyaddr() is available */ | | /* Define this if gethostbyaddr() is available */ | |
| #define HAVE_GETHOSTBYADDR 1 | | #define HAVE_GETHOSTBYADDR 1 | |
| | | | |
| /* Define this if gethostbyname() is available */ | | /* Define this if gethostbyname() is available */ | |
| #define HAVE_GETHOSTBYNAME 1 | | #define HAVE_GETHOSTBYNAME 1 | |
| | | | |
| /* Define to 1 if you have the `gethostbyname2' function. */ | | /* Define to 1 if you have the `gethostbyname2' function. */ | |
| #define HAVE_GETHOSTBYNAME2 1 | | #define HAVE_GETHOSTBYNAME2 1 | |
| | | | |
| /* Define this if gethostname() is available */ | | /* Define this if gethostname() is available */ | |
| | | | |
| skipping to change at line 195 | | skipping to change at line 189 | |
| | | | |
| /* Define this if getnameinfo() is available */ | | /* Define this if getnameinfo() is available */ | |
| #define HAVE_GETNAMEINFO 1 | | #define HAVE_GETNAMEINFO 1 | |
| | | | |
| /* Define to 1 if you have the `getpeereid' function. */ | | /* Define to 1 if you have the `getpeereid' function. */ | |
| /* #undef HAVE_GETPEEREID */ | | /* #undef HAVE_GETPEEREID */ | |
| | | | |
| /* Define to 1 if you have the `getpeerucred' function. */ | | /* Define to 1 if you have the `getpeerucred' function. */ | |
| /* #undef HAVE_GETPEERUCRED */ | | /* #undef HAVE_GETPEERUCRED */ | |
| | | | |
|
| | | /* Define to 1 if you have the `getresgid' function. */ | |
| | | #define HAVE_GETRESGID 1 | |
| | | | |
| /* Define to 1 if you have the `getrusage' function. */ | | /* Define to 1 if you have the `getrusage' function. */ | |
| #define HAVE_GETRUSAGE 1 | | #define HAVE_GETRUSAGE 1 | |
| | | | |
| /* Define if the GNU gettext() function is already present or preinstalled.
*/ | | /* Define if the GNU gettext() function is already present or preinstalled.
*/ | |
| #define HAVE_GETTEXT 1 | | #define HAVE_GETTEXT 1 | |
| | | | |
|
| /* Define to 1 if you have the `gettimeofday' function. */ | | | |
| #define HAVE_GETTIMEOFDAY 1 | | | |
| | | | |
| /* Define to 1 if you have the <glpk.h> header file. */ | | /* Define to 1 if you have the <glpk.h> header file. */ | |
| #define HAVE_GLPK_H 1 | | #define HAVE_GLPK_H 1 | |
| | | | |
| /* Define to 1 if `presolve' is a member of `glp_iocp'. */ | | /* Define to 1 if `presolve' is a member of `glp_iocp'. */ | |
| #define HAVE_GLP_IOCP_PRESOLVE 1 | | #define HAVE_GLP_IOCP_PRESOLVE 1 | |
| | | | |
|
| /* Define to 1 if you have the `gmtime' function. */ | | /* We have gnutls */ | |
| #define HAVE_GMTIME 1 | | #define HAVE_GNUTLS true | |
| | | | |
|
| /* Define to 1 if you have the `gmtime_r' function. */ | | /* Define to 1 if you have the <gnutls/abstract.h> header file. */ | |
| #define HAVE_GMTIME_R 1 | | #define HAVE_GNUTLS_ABSTRACT_H 1 | |
| | | | |
| /* Define if you have the iconv() function. */ | | /* Define if you have the iconv() function. */ | |
| #define HAVE_ICONV 1 | | #define HAVE_ICONV 1 | |
| | | | |
| /* Define to 1 if you have the <ifaddrs.h> header file. */ | | /* Define to 1 if you have the <ifaddrs.h> header file. */ | |
| #define HAVE_IFADDRS_H 1 | | #define HAVE_IFADDRS_H 1 | |
| | | | |
| /* Define this if inet_ntoa() is available */ | | /* Define this if inet_ntoa() is available */ | |
|
| #define HAVE_INET_NTOA 1 | | /* #undef HAVE_INET_NTOA */ | |
| | | | |
| /* Define to 1 if you have the `initgroups' function. */ | | /* Define to 1 if you have the `initgroups' function. */ | |
| #define HAVE_INITGROUPS 1 | | #define HAVE_INITGROUPS 1 | |
| | | | |
| /* Define to 1 if you have the <inttypes.h> header file. */ | | /* Define to 1 if you have the <inttypes.h> header file. */ | |
| #define HAVE_INTTYPES_H 1 | | #define HAVE_INTTYPES_H 1 | |
| | | | |
| /* Define to 1 if you have the <kstat.h> header file. */ | | /* Define to 1 if you have the <kstat.h> header file. */ | |
| /* #undef HAVE_KSTAT_H */ | | /* #undef HAVE_KSTAT_H */ | |
| | | | |
| /* Define to 1 if you have the <kvm.h> header file. */ | | /* Define to 1 if you have the <kvm.h> header file. */ | |
| /* #undef HAVE_KVM_H */ | | /* #undef HAVE_KVM_H */ | |
| | | | |
| /* Define to 1 if you have the <langinfo.h> header file. */ | | /* Define to 1 if you have the <langinfo.h> header file. */ | |
| #define HAVE_LANGINFO_H 1 | | #define HAVE_LANGINFO_H 1 | |
| | | | |
|
| /* Define to 1 if you have a functional curl library. */ | | /* Have libcurl */ | |
| #define HAVE_LIBCURL 1 | | #define HAVE_LIBCURL 1 | |
| | | | |
| /* Define if you have the libdl library or equivalent. */ | | /* Define if you have the libdl library or equivalent. */ | |
| #define HAVE_LIBDL 1 | | #define HAVE_LIBDL 1 | |
| | | | |
| /* Define if libdlloader will be built on this platform */ | | /* Define if libdlloader will be built on this platform */ | |
| #define HAVE_LIBDLLOADER 1 | | #define HAVE_LIBDLLOADER 1 | |
| | | | |
| /* Have GLPK */ | | /* Have GLPK */ | |
| #define HAVE_LIBGLPK 1 | | #define HAVE_LIBGLPK 1 | |
| | | | |
| skipping to change at line 288 | | skipping to change at line 282 | |
| | | | |
| /* Define to 1 if you have the `z' library (-lz). */ | | /* Define to 1 if you have the `z' library (-lz). */ | |
| #define HAVE_LIBZ 1 | | #define HAVE_LIBZ 1 | |
| | | | |
| /* Define to 1 if you have the <limits.h> header file. */ | | /* Define to 1 if you have the <limits.h> header file. */ | |
| #define HAVE_LIMITS_H 1 | | #define HAVE_LIMITS_H 1 | |
| | | | |
| /* Define to 1 if you have the <locale.h> header file. */ | | /* Define to 1 if you have the <locale.h> header file. */ | |
| #define HAVE_LOCALE_H 1 | | #define HAVE_LOCALE_H 1 | |
| | | | |
|
| /* Define to 1 if you have the `localtime_r' function. */ | | | |
| #define HAVE_LOCALTIME_R 1 | | | |
| | | | |
| /* Define this if a modern libltdl is already installed */ | | /* Define this if a modern libltdl is already installed */ | |
| #define HAVE_LTDL 1 | | #define HAVE_LTDL 1 | |
| | | | |
| /* Define to 1 if you have the <mach/mach.h> header file. */ | | /* Define to 1 if you have the <mach/mach.h> header file. */ | |
| /* #undef HAVE_MACH_MACH_H */ | | /* #undef HAVE_MACH_MACH_H */ | |
| | | | |
| /* Define to 1 if you have the <mach-o/dyld.h> header file. */ | | /* Define to 1 if you have the <mach-o/dyld.h> header file. */ | |
| /* #undef HAVE_MACH_O_DYLD_H */ | | /* #undef HAVE_MACH_O_DYLD_H */ | |
| | | | |
|
| | | /* Define to 1 if you have the `mallinfo' function. */ | |
| | | #define HAVE_MALLINFO 1 | |
| | | | |
| | | /* Define to 1 if you have the <malloc.h> header file. */ | |
| | | #define HAVE_MALLOC_H 1 | |
| | | | |
| | | /* Define to 1 if you have the <malloc/malloc.h> header file. */ | |
| | | /* #undef HAVE_MALLOC_MALLOC_H */ | |
| | | | |
| | | /* Define to 1 if you have the `malloc_size' function. */ | |
| | | /* #undef HAVE_MALLOC_SIZE */ | |
| | | | |
| | | /* Define to 1 if you have the `malloc_usable_size' function. */ | |
| | | #define HAVE_MALLOC_USABLE_SIZE 1 | |
| | | | |
| /* Define to 1 if you have the <math.h> header file. */ | | /* Define to 1 if you have the <math.h> header file. */ | |
| #define HAVE_MATH_H 1 | | #define HAVE_MATH_H 1 | |
| | | | |
|
| /* Define to 1 if you have the `memmove' function. */ | | | |
| #define HAVE_MEMMOVE 1 | | | |
| | | | |
| /* Define to 1 if you have the <memory.h> header file. */ | | /* Define to 1 if you have the <memory.h> header file. */ | |
| #define HAVE_MEMORY_H 1 | | #define HAVE_MEMORY_H 1 | |
| | | | |
|
| /* Define to 1 if you have the `memset' function. */ | | | |
| #define HAVE_MEMSET 1 | | | |
| | | | |
| /* We have libmicrohttpd */ | | /* We have libmicrohttpd */ | |
| #define HAVE_MHD 1 | | #define HAVE_MHD 1 | |
| | | | |
| /* Define to 1 if you have the <microhttpd.h> header file. */ | | /* Define to 1 if you have the <microhttpd.h> header file. */ | |
| #define HAVE_MICROHTTPD_H 1 | | #define HAVE_MICROHTTPD_H 1 | |
| | | | |
|
| /* Define to 1 if you have the `mkdir' function. */ | | | |
| #define HAVE_MKDIR 1 | | | |
| | | | |
| /* Define to 1 if you have the `mkfifo' function. */ | | | |
| #define HAVE_MKFIFO 1 | | | |
| | | | |
| /* Define to 1 if you have the `mktime' function. */ | | | |
| #define HAVE_MKTIME 1 | | | |
| | | | |
| /* Define to 1 if you have the `mmap' function. */ | | | |
| #define HAVE_MMAP 1 | | | |
| | | | |
| /* Define to 1 if you have the `mremap' function. */ | | /* Define to 1 if you have the `mremap' function. */ | |
| #define HAVE_MREMAP 1 | | #define HAVE_MREMAP 1 | |
| | | | |
| /* Define to 1 if you have the <mysql/mysql.h> header file. */ | | /* Define to 1 if you have the <mysql/mysql.h> header file. */ | |
| #define HAVE_MYSQL_MYSQL_H 1 | | #define HAVE_MYSQL_MYSQL_H 1 | |
| | | | |
| /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'.
*/ | | /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'.
*/ | |
| /* #undef HAVE_NDIR_H */ | | /* #undef HAVE_NDIR_H */ | |
| | | | |
| /* Define to 1 if you have the <netdb.h> header file. */ | | /* Define to 1 if you have the <netdb.h> header file. */ | |
| #define HAVE_NETDB_H 1 | | #define HAVE_NETDB_H 1 | |
| | | | |
| /* Define to 1 if you have the <netinet/in.h> header file. */ | | /* Define to 1 if you have the <netinet/in.h> header file. */ | |
| #define HAVE_NETINET_IN_H 1 | | #define HAVE_NETINET_IN_H 1 | |
| | | | |
| /* Define to 1 if you have the <netinet/in_systm.h> header file. */ | | /* Define to 1 if you have the <netinet/in_systm.h> header file. */ | |
| #define HAVE_NETINET_IN_SYSTM_H 1 | | #define HAVE_NETINET_IN_SYSTM_H 1 | |
| | | | |
|
| /* Define to 1 if you have the `nl_langinfo' function. */ | | | |
| #define HAVE_NL_LANGINFO 1 | | | |
| | | | |
| /* Define to 1 if you have the <nss.h> header file. */ | | /* Define to 1 if you have the <nss.h> header file. */ | |
| #define HAVE_NSS_H 1 | | #define HAVE_NSS_H 1 | |
| | | | |
| /* Define to 1 if the system has the type `off_t'. */ | | /* Define to 1 if the system has the type `off_t'. */ | |
| #define HAVE_OFF_T 1 | | #define HAVE_OFF_T 1 | |
| | | | |
| /* Define to 1 if you have the `opendir' function. */ | | /* Define to 1 if you have the `opendir' function. */ | |
| #define HAVE_OPENDIR 1 | | #define HAVE_OPENDIR 1 | |
| | | | |
| /* Define to 1 if you have the <postgresql/libpq-fe.h> header file. */ | | /* Define to 1 if you have the <postgresql/libpq-fe.h> header file. */ | |
| /* #undef HAVE_POSTGRESQL_LIBPQ_FE_H */ | | /* #undef HAVE_POSTGRESQL_LIBPQ_FE_H */ | |
| | | | |
| /* Define if libtool can extract symbol lists from object files. */ | | /* Define if libtool can extract symbol lists from object files. */ | |
| #define HAVE_PRELOADED_SYMBOLS 1 | | #define HAVE_PRELOADED_SYMBOLS 1 | |
| | | | |
|
| /* Define to 1 if you have the `putenv' function. */ | | | |
| #define HAVE_PUTENV 1 | | | |
| | | | |
| /* Define to 1 if you have the `rand' function. */ | | | |
| #define HAVE_RAND 1 | | | |
| | | | |
| /* Define to 1 if you have the `readdir' function. */ | | /* Define to 1 if you have the `readdir' function. */ | |
| #define HAVE_READDIR 1 | | #define HAVE_READDIR 1 | |
| | | | |
|
| /* Define to 1 if you have the `realpath' function. */ | | | |
| #define HAVE_REALPATH 1 | | | |
| | | | |
| /* Define to 1 if you have the `rmdir' function. */ | | | |
| #define HAVE_RMDIR 1 | | | |
| | | | |
| /* Define to 1 if you have the `sbrk' function. */ | | | |
| #define HAVE_SBRK 1 | | | |
| | | | |
| /* Define this if select() is available */ | | /* Define this if select() is available */ | |
|
| #define HAVE_SELECT 1 | | /* #undef HAVE_SELECT */ | |
| | | | |
| /* Define to 1 if you have the `setlocale' function. */ | | | |
| #define HAVE_SETLOCALE 1 | | | |
| | | | |
| /* Define to 1 if you have the `setresuid' function. */ | | /* Define to 1 if you have the `setresuid' function. */ | |
| #define HAVE_SETRESUID 1 | | #define HAVE_SETRESUID 1 | |
| | | | |
| /* Define to 1 if you have the `setrlimit' function. */ | | /* Define to 1 if you have the `setrlimit' function. */ | |
| #define HAVE_SETRLIMIT 1 | | #define HAVE_SETRLIMIT 1 | |
| | | | |
| /* Define if you have the shl_load function. */ | | /* Define if you have the shl_load function. */ | |
| /* #undef HAVE_SHL_LOAD */ | | /* #undef HAVE_SHL_LOAD */ | |
| | | | |
| | | | |
| skipping to change at line 412 | | skipping to change at line 379 | |
| /* Define to 1 if the system has the type `sigset_t'. */ | | /* Define to 1 if the system has the type `sigset_t'. */ | |
| #define HAVE_SIGSET_T 1 | | #define HAVE_SIGSET_T 1 | |
| | | | |
| /* Define to 1 if the system has the type `size_t'. */ | | /* Define to 1 if the system has the type `size_t'. */ | |
| #define HAVE_SIZE_T 1 | | #define HAVE_SIZE_T 1 | |
| | | | |
| /* Do we have sockaddr_in.sin_len? */ | | /* Do we have sockaddr_in.sin_len? */ | |
| /* #undef HAVE_SOCKADDR_IN_SIN_LEN */ | | /* #undef HAVE_SOCKADDR_IN_SIN_LEN */ | |
| | | | |
| /* Define this if socket() is available */ | | /* Define this if socket() is available */ | |
|
| #define HAVE_SOCKET 1 | | /* #undef HAVE_SOCKET */ | |
| | | | |
| /* Define to 1 if you have the <sockLib.h> header file. */ | | /* Define to 1 if you have the <sockLib.h> header file. */ | |
| /* #undef HAVE_SOCKLIB_H */ | | /* #undef HAVE_SOCKLIB_H */ | |
| | | | |
| /* Define to 1 if you have the <sqlite3.h> header file. */ | | /* Define to 1 if you have the <sqlite3.h> header file. */ | |
| #define HAVE_SQLITE3_H 1 | | #define HAVE_SQLITE3_H 1 | |
| | | | |
| /* Define to 1 if you have the `stat64' function. */ | | /* Define to 1 if you have the `stat64' function. */ | |
| #define HAVE_STAT64 1 | | #define HAVE_STAT64 1 | |
| | | | |
| | | | |
| skipping to change at line 445 | | skipping to change at line 412 | |
| | | | |
| /* Define to 1 if you have the <stdint.h> header file. */ | | /* Define to 1 if you have the <stdint.h> header file. */ | |
| #define HAVE_STDINT_H 1 | | #define HAVE_STDINT_H 1 | |
| | | | |
| /* Define to 1 if you have the <stdio.h> header file. */ | | /* Define to 1 if you have the <stdio.h> header file. */ | |
| #define HAVE_STDIO_H 1 | | #define HAVE_STDIO_H 1 | |
| | | | |
| /* Define to 1 if you have the <stdlib.h> header file. */ | | /* Define to 1 if you have the <stdlib.h> header file. */ | |
| #define HAVE_STDLIB_H 1 | | #define HAVE_STDLIB_H 1 | |
| | | | |
|
| /* Define to 1 if you have the `strcasecmp' function. */ | | | |
| #define HAVE_STRCASECMP 1 | | | |
| | | | |
| /* Define to 1 if you have the `strchr' function. */ | | | |
| #define HAVE_STRCHR 1 | | | |
| | | | |
| /* Define to 1 if you have the `strdup' function. */ | | | |
| #define HAVE_STRDUP 1 | | | |
| | | | |
| /* Define to 1 if you have the `strerror' function. */ | | | |
| #define HAVE_STRERROR 1 | | | |
| | | | |
| /* Define to 1 if you have the `strftime' function. */ | | /* Define to 1 if you have the `strftime' function. */ | |
| #define HAVE_STRFTIME 1 | | #define HAVE_STRFTIME 1 | |
| | | | |
| /* Define to 1 if you have the <strings.h> header file. */ | | /* Define to 1 if you have the <strings.h> header file. */ | |
| #define HAVE_STRINGS_H 1 | | #define HAVE_STRINGS_H 1 | |
| | | | |
| /* Define to 1 if you have the <string.h> header file. */ | | /* Define to 1 if you have the <string.h> header file. */ | |
| #define HAVE_STRING_H 1 | | #define HAVE_STRING_H 1 | |
| | | | |
| /* Define to 1 if you have the `strlcat' function. */ | | /* Define to 1 if you have the `strlcat' function. */ | |
| /* #undef HAVE_STRLCAT */ | | /* #undef HAVE_STRLCAT */ | |
| | | | |
| /* Define to 1 if you have the `strlcpy' function. */ | | /* Define to 1 if you have the `strlcpy' function. */ | |
| /* #undef HAVE_STRLCPY */ | | /* #undef HAVE_STRLCPY */ | |
| | | | |
|
| /* Define to 1 if you have the `strncasecmp' function. */ | | | |
| #define HAVE_STRNCASECMP 1 | | | |
| | | | |
| /* Define to 1 if you have the `strndup' function. */ | | /* Define to 1 if you have the `strndup' function. */ | |
| #define HAVE_STRNDUP 1 | | #define HAVE_STRNDUP 1 | |
| | | | |
|
| /* Define to 1 if you have the `strrchr' function. */ | | /* Define to 1 if you have the `strnlen' function. */ | |
| #define HAVE_STRRCHR 1 | | #define HAVE_STRNLEN 1 | |
| | | | |
| /* Define to 1 if you have the `strstr' function. */ | | | |
| #define HAVE_STRSTR 1 | | | |
| | | | |
| /* Define to 1 if you have the `strtol' function. */ | | | |
| #define HAVE_STRTOL 1 | | | |
| | | | |
| /* Define to 1 if you have the `sysconf' function. */ | | /* Define to 1 if you have the `sysconf' function. */ | |
| #define HAVE_SYSCONF 1 | | #define HAVE_SYSCONF 1 | |
| | | | |
| /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR
'. | | /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR
'. | |
| */ | | */ | |
| /* #undef HAVE_SYS_DIR_H */ | | /* #undef HAVE_SYS_DIR_H */ | |
| | | | |
| /* Define to 1 if you have the <sys/dl.h> header file. */ | | /* Define to 1 if you have the <sys/dl.h> header file. */ | |
| /* #undef HAVE_SYS_DL_H */ | | /* #undef HAVE_SYS_DL_H */ | |
| | | | |
| skipping to change at line 564 | | skipping to change at line 510 | |
| | | | |
| /* Define to 1 if you have the <terminos.h> header file. */ | | /* Define to 1 if you have the <terminos.h> header file. */ | |
| /* #undef HAVE_TERMINOS_H */ | | /* #undef HAVE_TERMINOS_H */ | |
| | | | |
| /* Define to 1 if you have the <ucred.h> header file. */ | | /* Define to 1 if you have the <ucred.h> header file. */ | |
| /* #undef HAVE_UCRED_H */ | | /* #undef HAVE_UCRED_H */ | |
| | | | |
| /* We can access-64 bit values that are only 32-bit aligned */ | | /* We can access-64 bit values that are only 32-bit aligned */ | |
| #define HAVE_UNALIGNED_64_ACCESS 0 | | #define HAVE_UNALIGNED_64_ACCESS 0 | |
| | | | |
|
| /* Define to 1 if you have the `uname' function. */ | | | |
| #define HAVE_UNAME 1 | | | |
| | | | |
| /* Define to 1 if you have the <unistd.h> header file. */ | | /* Define to 1 if you have the <unistd.h> header file. */ | |
| #define HAVE_UNISTD_H 1 | | #define HAVE_UNISTD_H 1 | |
| | | | |
| /* Define to 1 if you have the `vfork' function. */ | | /* Define to 1 if you have the `vfork' function. */ | |
| #define HAVE_VFORK 1 | | #define HAVE_VFORK 1 | |
| | | | |
| /* Define to 1 if you have the <vfork.h> header file. */ | | /* Define to 1 if you have the <vfork.h> header file. */ | |
| /* #undef HAVE_VFORK_H */ | | /* #undef HAVE_VFORK_H */ | |
| | | | |
| /* Define to 1 if you have the `vprintf' function. */ | | /* Define to 1 if you have the `vprintf' function. */ | |
| | | | |
| skipping to change at line 657 | | skipping to change at line 600 | |
| | | | |
| /* Defined if libcurl supports SMTP */ | | /* Defined if libcurl supports SMTP */ | |
| #define LIBCURL_PROTOCOL_SMTP 1 | | #define LIBCURL_PROTOCOL_SMTP 1 | |
| | | | |
| /* Defined if libcurl supports TELNET */ | | /* Defined if libcurl supports TELNET */ | |
| #define LIBCURL_PROTOCOL_TELNET 1 | | #define LIBCURL_PROTOCOL_TELNET 1 | |
| | | | |
| /* Defined if libcurl supports TFTP */ | | /* Defined if libcurl supports TFTP */ | |
| #define LIBCURL_PROTOCOL_TFTP 1 | | #define LIBCURL_PROTOCOL_TFTP 1 | |
| | | | |
|
| /* This is a Linux system */ | | /* Define to 1 if you want IDN support. */ | |
| | | #define LIBIDN 1 | |
| | | | |
| | | /* This is a Linux kernel */ | |
| #define LINUX 1 | | #define LINUX 1 | |
| | | | |
| /* Define to 1 if `lstat' dereferences a symlink specified with a trailing | | /* Define to 1 if `lstat' dereferences a symlink specified with a trailing | |
| slash. */ | | slash. */ | |
| #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 | | #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 | |
| | | | |
| /* Define if the OS needs help to load dependent libraries for dlopen(). */ | | /* Define if the OS needs help to load dependent libraries for dlopen(). */ | |
| /* #undef LTDL_DLOPEN_DEPLIBS */ | | /* #undef LTDL_DLOPEN_DEPLIBS */ | |
| | | | |
| /* Define to the system default library search path. */ | | /* Define to the system default library search path. */ | |
| #define LT_DLSEARCH_PATH "/lib:/usr/lib:/usr/lib/atlas-sse:/usr/lib/atlas-s
se3:/usr/lib/atlas:/usr/lib/paraview-mpi" | | #define LT_DLSEARCH_PATH "/lib:/usr/lib:/usr/lib/atlas-sse:/usr/lib/atlas-s
se3:/usr/lib/atlas:/usr/lib/paraview-mpi" | |
| | | | |
| /* The archive extension */ | | /* The archive extension */ | |
| #define LT_LIBEXT "a" | | #define LT_LIBEXT "a" | |
| | | | |
|
| | | /* The archive prefix */ | |
| | | #define LT_LIBPREFIX "lib" | |
| | | | |
| /* Define to the extension used for runtime loadable modules, say, ".so". *
/ | | /* Define to the extension used for runtime loadable modules, say, ".so". *
/ | |
| #define LT_MODULE_EXT ".so" | | #define LT_MODULE_EXT ".so" | |
| | | | |
| /* Define to the name of the environment variable that determines the run-t
ime | | /* Define to the name of the environment variable that determines the run-t
ime | |
| module search path. */ | | module search path. */ | |
| #define LT_MODULE_PATH_VAR "LD_LIBRARY_PATH" | | #define LT_MODULE_PATH_VAR "LD_LIBRARY_PATH" | |
| | | | |
| /* Define to the sub-directory in which libtool stores uninstalled librarie
s. | | /* Define to the sub-directory in which libtool stores uninstalled librarie
s. | |
| */ | | */ | |
| #define LT_OBJDIR ".libs/" | | #define LT_OBJDIR ".libs/" | |
| | | | |
|
| | | /* Define to the shared library suffix, say, ".dylib". */ | |
| | | /* #undef LT_SHARED_EXT */ | |
| | | | |
| /* This is a MinGW system */ | | /* This is a MinGW system */ | |
| /* #undef MINGW */ | | /* #undef MINGW */ | |
| | | | |
|
| | | /* required libgcrypt version */ | |
| | | #define NEED_LIBGCRYPT_VERSION "1.4.2" | |
| | | | |
| /* Define if dlsym() requires a leading underscore in symbol names. */ | | /* Define if dlsym() requires a leading underscore in symbol names. */ | |
| /* #undef NEED_USCORE */ | | /* #undef NEED_USCORE */ | |
| | | | |
| /* This is a NetBSD system */ | | /* This is a NetBSD system */ | |
| /* #undef NETBSD */ | | /* #undef NETBSD */ | |
| | | | |
| /* Define to 1 if your C compiler doesn't accept -c and -o together. */ | | /* Define to 1 if your C compiler doesn't accept -c and -o together. */ | |
| /* #undef NO_MINUS_C_MINUS_O */ | | /* #undef NO_MINUS_C_MINUS_O */ | |
| | | | |
| /* This is an OpenBSD system */ | | /* This is an OpenBSD system */ | |
| | | | |
| skipping to change at line 712 | | skipping to change at line 667 | |
| /* Name of package */ | | /* Name of package */ | |
| #define PACKAGE "gnunet" | | #define PACKAGE "gnunet" | |
| | | | |
| /* Define to the address where bug reports for this package should be sent.
*/ | | /* Define to the address where bug reports for this package should be sent.
*/ | |
| #define PACKAGE_BUGREPORT "bug-gnunet@gnu.org" | | #define PACKAGE_BUGREPORT "bug-gnunet@gnu.org" | |
| | | | |
| /* Define to the full name of this package. */ | | /* Define to the full name of this package. */ | |
| #define PACKAGE_NAME "gnunet" | | #define PACKAGE_NAME "gnunet" | |
| | | | |
| /* Define to the full name and version of this package. */ | | /* Define to the full name and version of this package. */ | |
|
| #define PACKAGE_STRING "gnunet 0.9.3" | | #define PACKAGE_STRING "gnunet 0.9.4" | |
| | | | |
| /* Define to the one symbol short name of this package. */ | | /* Define to the one symbol short name of this package. */ | |
| #define PACKAGE_TARNAME "gnunet" | | #define PACKAGE_TARNAME "gnunet" | |
| | | | |
| /* Define to the home page for this package. */ | | /* Define to the home page for this package. */ | |
| #define PACKAGE_URL "" | | #define PACKAGE_URL "" | |
| | | | |
| /* Define to the version of this package. */ | | /* Define to the version of this package. */ | |
|
| #define PACKAGE_VERSION "0.9.3" | | #define PACKAGE_VERSION "0.9.4" | |
| | | | |
| /* Define as the return type of signal handlers (`int' or `void'). */ | | /* Define as the return type of signal handlers (`int' or `void'). */ | |
| #define RETSIGTYPE void | | #define RETSIGTYPE void | |
| | | | |
| /* Define to the type of arg 1 for `select'. */ | | /* Define to the type of arg 1 for `select'. */ | |
| #define SELECT_TYPE_ARG1 int | | #define SELECT_TYPE_ARG1 int | |
| | | | |
| /* Define to the type of args 2, 3 and 4 for `select'. */ | | /* Define to the type of args 2, 3 and 4 for `select'. */ | |
| #define SELECT_TYPE_ARG234 (fd_set *) | | #define SELECT_TYPE_ARG234 (fd_set *) | |
| | | | |
| | | | |
| skipping to change at line 754 | | skipping to change at line 709 | |
| /* Define to 1 if you have the ANSI C header files. */ | | /* Define to 1 if you have the ANSI C header files. */ | |
| #define STDC_HEADERS 1 | | #define STDC_HEADERS 1 | |
| | | | |
| /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ | | /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ | |
| #define TIME_WITH_SYS_TIME 1 | | #define TIME_WITH_SYS_TIME 1 | |
| | | | |
| /* Define to 1 if your <sys/time.h> declares `struct tm'. */ | | /* Define to 1 if your <sys/time.h> declares `struct tm'. */ | |
| /* #undef TM_IN_SYS_TIME */ | | /* #undef TM_IN_SYS_TIME */ | |
| | | | |
| /* Version number of package */ | | /* Version number of package */ | |
|
| #define VERSION "0.9.3" | | #define VERSION "0.9.4" | |
| | | | |
| /* This is a Windows system */ | | /* This is a Windows system */ | |
| /* #undef WINDOWS */ | | /* #undef WINDOWS */ | |
| | | | |
| /* Define to 1 if the X Window System is missing or not being used. */ | | /* Define to 1 if the X Window System is missing or not being used. */ | |
| /* #undef X_DISPLAY_MISSING */ | | /* #undef X_DISPLAY_MISSING */ | |
| | | | |
|
| | | /* Enable large inode numbers on Mac OS X 10.5. */ | |
| | | #ifndef _DARWIN_USE_64_BIT_INODE | |
| | | # define _DARWIN_USE_64_BIT_INODE 1 | |
| | | #endif | |
| | | | |
| /* Number of bits in a file offset, on hosts where this is settable. */ | | /* Number of bits in a file offset, on hosts where this is settable. */ | |
| #define _FILE_OFFSET_BITS 64 | | #define _FILE_OFFSET_BITS 64 | |
| | | | |
| /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ | | /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ | |
| /* #undef _LARGEFILE_SOURCE */ | | /* #undef _LARGEFILE_SOURCE */ | |
| | | | |
| /* Define for large files, on AIX-style hosts. */ | | /* Define for large files, on AIX-style hosts. */ | |
| /* #undef _LARGE_FILES */ | | /* #undef _LARGE_FILES */ | |
| | | | |
| /* Need with solaris or errno doesnt work */ | | /* Need with solaris or errno doesnt work */ | |
| | | | |
End of changes. 37 change blocks. |
| 101 lines changed or deleted | | 61 lines changed or added | |
|
| gnunet_container_lib.h | | gnunet_container_lib.h | |
| | | | |
| skipping to change at line 64 | | skipping to change at line 64 | |
| struct GNUNET_CONTAINER_BloomFilter; | | struct GNUNET_CONTAINER_BloomFilter; | |
| | | | |
| /** | | /** | |
| * Iterator over HashCodes. | | * Iterator over HashCodes. | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param next set to the next hash code | | * @param next set to the next hash code | |
| * @return GNUNET_YES if next was updated | | * @return GNUNET_YES if next was updated | |
| * GNUNET_NO if there are no more entries | | * GNUNET_NO if there are no more entries | |
| */ | | */ | |
|
| typedef int (*GNUNET_HashCodeIterator) (void *cls, GNUNET_HashCode * next); | | typedef int (*GNUNET_HashCodeIterator) (void *cls, struct GNUNET_HashCode *
next); | |
| | | | |
| /** | | /** | |
| * Load a bloom-filter from a file. | | * Load a bloom-filter from a file. | |
| * | | * | |
| * @param filename the name of the file (or the prefix) | | * @param filename the name of the file (or the prefix) | |
| * @param size the size of the bloom-filter (number of | | * @param size the size of the bloom-filter (number of | |
| * bytes of storage space to use); will be rounded up | | * bytes of storage space to use); will be rounded up | |
| * to next power of 2 | | * to next power of 2 | |
| * @param k the number of GNUNET_CRYPTO_hash-functions to apply per | | * @param k the number of GNUNET_CRYPTO_hash-functions to apply per | |
| * element (number of bits set per element in the set) | | * element (number of bits set per element in the set) | |
| | | | |
| skipping to change at line 119 | | skipping to change at line 119 | |
| char *data, size_t size); | | char *data, size_t size); | |
| | | | |
| /** | | /** | |
| * Test if an element is in the filter. | | * Test if an element is in the filter. | |
| * @param e the element | | * @param e the element | |
| * @param bf the filter | | * @param bf the filter | |
| * @return GNUNET_YES if the element is in the filter, GNUNET_NO if not | | * @return GNUNET_YES if the element is in the filter, GNUNET_NO if not | |
| */ | | */ | |
| int | | int | |
| GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilte
r | | GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilte
r | |
|
| *bf, const GNUNET_HashCode * e); | | *bf, const struct GNUNET_HashCode * e); | |
| | | | |
| /** | | /** | |
| * Add an element to the filter | | * Add an element to the filter | |
| * @param bf the filter | | * @param bf the filter | |
| * @param e the element | | * @param e the element | |
| */ | | */ | |
| void | | void | |
| GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter *bf, | | GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter *bf, | |
|
| const GNUNET_HashCode * e); | | const struct GNUNET_HashCode * e); | |
| | | | |
| /** | | /** | |
| * Remove an element from the filter. | | * Remove an element from the filter. | |
| * @param bf the filter | | * @param bf the filter | |
| * @param e the element to remove | | * @param e the element to remove | |
| */ | | */ | |
| void | | void | |
| GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter *b
f, | | GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter *b
f, | |
|
| const GNUNET_HashCode * e); | | const struct GNUNET_HashCode * e); | |
| | | | |
| /** | | /** | |
| * Create a copy of a bloomfilter. | | * Create a copy of a bloomfilter. | |
| * | | * | |
| * @param bf the filter | | * @param bf the filter | |
| * @return copy of bf | | * @return copy of bf | |
| */ | | */ | |
| struct GNUNET_CONTAINER_BloomFilter * | | struct GNUNET_CONTAINER_BloomFilter * | |
| GNUNET_CONTAINER_bloomfilter_copy (const struct GNUNET_CONTAINER_BloomFilte
r | | GNUNET_CONTAINER_bloomfilter_copy (const struct GNUNET_CONTAINER_BloomFilte
r | |
| *bf); | | *bf); | |
| | | | |
| skipping to change at line 284 | | skipping to change at line 284 | |
| * @param md metadata to extend | | * @param md metadata to extend | |
| * @param plugin_name name of the plugin that produced this value; | | * @param plugin_name name of the plugin that produced this value; | |
| * special values can be used (i.e. '<zlib>' for zlib being | | * special values can be used (i.e. '<zlib>' for zlib being | |
| * used in the main libextractor library and yielding | | * used in the main libextractor library and yielding | |
| * meta data). | | * meta data). | |
| * @param type libextractor-type describing the meta data | | * @param type libextractor-type describing the meta data | |
| * @param format basic format information about data | | * @param format basic format information about data | |
| * @param data_mime_type mime-type of data (not of the original file); | | * @param data_mime_type mime-type of data (not of the original file); | |
| * can be NULL (if mime-type is not known) | | * can be NULL (if mime-type is not known) | |
| * @param data actual meta-data found | | * @param data actual meta-data found | |
|
| * @param data_len number of bytes in data | | * @param data_size number of bytes in data | |
| * @return GNUNET_OK on success, GNUNET_SYSERR if this entry already exists | | * @return GNUNET_OK on success, GNUNET_SYSERR if this entry already exists | |
| * data_mime_type and plugin_name are not considered for "exists" c
hecks | | * data_mime_type and plugin_name are not considered for "exists" c
hecks | |
| */ | | */ | |
| int | | int | |
| GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md, | | GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md, | |
| const char *plugin_name, | | const char *plugin_name, | |
| enum EXTRACTOR_MetaType type, | | enum EXTRACTOR_MetaType type, | |
| enum EXTRACTOR_MetaFormat format, | | enum EXTRACTOR_MetaFormat format, | |
| const char *data_mime_type, const char *
data, | | const char *data_mime_type, const char *
data, | |
|
| size_t data_len); | | size_t data_size); | |
| | | | |
| /** | | /** | |
| * Extend metadata. Merges the meta data from the second argument | | * Extend metadata. Merges the meta data from the second argument | |
| * into the first, discarding duplicate key-value pairs. | | * into the first, discarding duplicate key-value pairs. | |
| * | | * | |
| * @param md metadata to extend | | * @param md metadata to extend | |
| * @param in metadata to merge | | * @param in metadata to merge | |
| */ | | */ | |
| void | | void | |
| GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md, | | GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md, | |
| const struct GNUNET_CONTAINER_MetaData *i
n); | | const struct GNUNET_CONTAINER_MetaData *i
n); | |
| | | | |
| /** | | /** | |
| * Remove an item. | | * Remove an item. | |
| * | | * | |
| * @param md metadata to manipulate | | * @param md metadata to manipulate | |
| * @param type type of the item to remove | | * @param type type of the item to remove | |
| * @param data specific value to remove, NULL to remove all | | * @param data specific value to remove, NULL to remove all | |
| * entries of the given type | | * entries of the given type | |
|
| * @param data_len number of bytes in data | | * @param data_size number of bytes in data | |
| * @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist i
n md | | * @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist i
n md | |
| */ | | */ | |
| int | | int | |
| GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md, | | GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md, | |
| enum EXTRACTOR_MetaType type, | | enum EXTRACTOR_MetaType type, | |
|
| const char *data, size_t data_len); | | const char *data, size_t data_size); | |
| | | | |
| /** | | /** | |
| * Remove all items in the container. | | * Remove all items in the container. | |
| * | | * | |
| * @param md metadata to manipulate | | * @param md metadata to manipulate | |
| */ | | */ | |
| void | | void | |
| GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md); | | GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md); | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 511 | | skipping to change at line 511 | |
| * Iterator over hash map entries. | | * Iterator over hash map entries. | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param key current key code | | * @param key current key code | |
| * @param value value in the hash map | | * @param value value in the hash map | |
| * @return GNUNET_YES if we should continue to | | * @return GNUNET_YES if we should continue to | |
| * iterate, | | * iterate, | |
| * GNUNET_NO if not. | | * GNUNET_NO if not. | |
| */ | | */ | |
| typedef int (*GNUNET_CONTAINER_HashMapIterator) (void *cls, | | typedef int (*GNUNET_CONTAINER_HashMapIterator) (void *cls, | |
|
| const GNUNET_HashCode * ke
y, | | const struct GNUNET_HashCo
de * key, | |
| void *value); | | void *value); | |
| | | | |
| /** | | /** | |
| * Create a multi hash map. | | * Create a multi hash map. | |
| * | | * | |
| * @param len initial size (map will grow as needed) | | * @param len initial size (map will grow as needed) | |
|
| | | * @param do_not_copy_keys GNUNET_NO is always safe and should be used by d | |
| | | efault; | |
| | | * GNUNET_YES means that on 'put', the 'key' does n | |
| | | ot have | |
| | | * to be copied as the destination of the pointer i | |
| | | s | |
| | | * guaranteed to be life as long as the value is st | |
| | | ored in | |
| | | * the hashmap. This can significantly reduce memo | |
| | | ry | |
| | | * consumption, but of course is also a recipie for | |
| | | * heap corruption if the assumption is not true. | |
| | | Only | |
| | | * use this if (1) memory use is important in this | |
| | | case and | |
| | | * (2) you have triple-checked that the invariant h | |
| | | olds | |
| * @return NULL on error | | * @return NULL on error | |
| */ | | */ | |
| struct GNUNET_CONTAINER_MultiHashMap * | | struct GNUNET_CONTAINER_MultiHashMap * | |
|
| GNUNET_CONTAINER_multihashmap_create (unsigned int len); | | GNUNET_CONTAINER_multihashmap_create (unsigned int len, | |
| | | int do_not_copy_keys); | |
| | | | |
| /** | | /** | |
| * Destroy a hash map. Will not free any values | | * Destroy a hash map. Will not free any values | |
| * stored in the hash map! | | * stored in the hash map! | |
| * | | * | |
| * @param map the map | | * @param map the map | |
| */ | | */ | |
| void | | void | |
| GNUNET_CONTAINER_multihashmap_destroy (struct GNUNET_CONTAINER_MultiHashMap | | GNUNET_CONTAINER_multihashmap_destroy (struct GNUNET_CONTAINER_MultiHashMap | |
| *map); | | *map); | |
| | | | |
| skipping to change at line 545 | | skipping to change at line 555 | |
| * | | * | |
| * @param map the map | | * @param map the map | |
| * @param key what to look for | | * @param key what to look for | |
| * @return NULL if no value was found; note that | | * @return NULL if no value was found; note that | |
| * this is indistinguishable from values that just | | * this is indistinguishable from values that just | |
| * happen to be NULL; use "contains" to test for | | * happen to be NULL; use "contains" to test for | |
| * key-value pairs with value NULL | | * key-value pairs with value NULL | |
| */ | | */ | |
| void * | | void * | |
| GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashM
ap | | GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashM
ap | |
|
| *map, const GNUNET_HashCode * key); | | *map, const struct GNUNET_HashCode * key
); | |
| | | | |
| /** | | /** | |
| * Remove the given key-value pair from the map. Note that if the | | * Remove the given key-value pair from the map. Note that if the | |
| * key-value pair is in the map multiple times, only one of the pairs | | * key-value pair is in the map multiple times, only one of the pairs | |
| * will be removed. | | * will be removed. | |
| * | | * | |
| * @param map the map | | * @param map the map | |
| * @param key key of the key-value pair | | * @param key key of the key-value pair | |
| * @param value value of the key-value pair | | * @param value value of the key-value pair | |
| * @return GNUNET_YES on success, GNUNET_NO if the key-value pair | | * @return GNUNET_YES on success, GNUNET_NO if the key-value pair | |
| * is not in the map | | * is not in the map | |
| */ | | */ | |
| int | | int | |
| GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap
*map, | | GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap
*map, | |
|
| const GNUNET_HashCode * key, void *va
lue); | | const struct GNUNET_HashCode * key, v
oid *value); | |
| | | | |
| /** | | /** | |
| * Remove all entries for the given key from the map. | | * Remove all entries for the given key from the map. | |
| * Note that the values would not be "freed". | | * Note that the values would not be "freed". | |
| * | | * | |
| * @param map the map | | * @param map the map | |
| * @param key identifies values to be removed | | * @param key identifies values to be removed | |
| * @return number of values removed | | * @return number of values removed | |
| */ | | */ | |
| int | | int | |
| GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHash
Map | | GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHash
Map | |
|
| *map, const GNUNET_HashCode * key
); | | *map, const struct GNUNET_HashCod
e * key); | |
| | | | |
| /** | | /** | |
| * Check if the map contains any value under the given | | * Check if the map contains any value under the given | |
| * key (including values that are NULL). | | * key (including values that are NULL). | |
| * | | * | |
| * @param map the map | | * @param map the map | |
| * @param key the key to test if a value exists for it | | * @param key the key to test if a value exists for it | |
| * @return GNUNET_YES if such a value exists, | | * @return GNUNET_YES if such a value exists, | |
| * GNUNET_NO if not | | * GNUNET_NO if not | |
| */ | | */ | |
| int | | int | |
| GNUNET_CONTAINER_multihashmap_contains (const struct | | GNUNET_CONTAINER_multihashmap_contains (const struct | |
| GNUNET_CONTAINER_MultiHashMap *map, | | GNUNET_CONTAINER_MultiHashMap *map, | |
|
| const GNUNET_HashCode * key); | | const struct GNUNET_HashCode * key)
; | |
| | | | |
| /** | | /** | |
| * Check if the map contains the given value under the given | | * Check if the map contains the given value under the given | |
| * key. | | * key. | |
| * | | * | |
| * @param map the map | | * @param map the map | |
| * @param key the key to test if a value exists for it | | * @param key the key to test if a value exists for it | |
| * @param value value to test for | | * @param value value to test for | |
| * @return GNUNET_YES if such a value exists, | | * @return GNUNET_YES if such a value exists, | |
| * GNUNET_NO if not | | * GNUNET_NO if not | |
| */ | | */ | |
| int | | int | |
| GNUNET_CONTAINER_multihashmap_contains_value (const struct | | GNUNET_CONTAINER_multihashmap_contains_value (const struct | |
| GNUNET_CONTAINER_MultiHashMap | | GNUNET_CONTAINER_MultiHashMap | |
|
| *map, const GNUNET_HashCode *
key, | | *map, const struct GNUNET_Has
hCode * key, | |
| const void *value); | | const void *value); | |
| | | | |
| /** | | /** | |
| * Store a key-value pair in the map. | | * Store a key-value pair in the map. | |
| * | | * | |
| * @param map the map | | * @param map the map | |
| * @param key key to use | | * @param key key to use | |
| * @param value value to use | | * @param value value to use | |
| * @param opt options for put | | * @param opt options for put | |
| * @return GNUNET_OK on success, | | * @return GNUNET_OK on success, | |
| * GNUNET_NO if a value was replaced (with REPLACE) | | * GNUNET_NO if a value was replaced (with REPLACE) | |
| * GNUNET_SYSERR if UNIQUE_ONLY was the option and the | | * GNUNET_SYSERR if UNIQUE_ONLY was the option and the | |
| * value already exists | | * value already exists | |
| */ | | */ | |
| int | | int | |
| GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *ma
p, | | GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *ma
p, | |
|
| const GNUNET_HashCode * key, void *value
, | | const struct GNUNET_HashCode * key, void
*value, | |
| enum GNUNET_CONTAINER_MultiHashMapOption | | enum GNUNET_CONTAINER_MultiHashMapOption | |
| opt); | | opt); | |
| | | | |
| /** | | /** | |
| * Get the number of key-value pairs in the map. | | * Get the number of key-value pairs in the map. | |
| * | | * | |
| * @param map the map | | * @param map the map | |
| * @return the number of key value pairs | | * @return the number of key value pairs | |
| */ | | */ | |
| unsigned int | | unsigned int | |
| | | | |
| skipping to change at line 660 | | skipping to change at line 670 | |
| * @param map the map | | * @param map the map | |
| * @param key key that the entries must correspond to | | * @param key key that the entries must correspond to | |
| * @param it function to call on each entry | | * @param it function to call on each entry | |
| * @param it_cls extra argument to it | | * @param it_cls extra argument to it | |
| * @return the number of key value pairs processed, | | * @return the number of key value pairs processed, | |
| * GNUNET_SYSERR if it aborted iteration | | * GNUNET_SYSERR if it aborted iteration | |
| */ | | */ | |
| int | | int | |
| GNUNET_CONTAINER_multihashmap_get_multiple (const struct | | GNUNET_CONTAINER_multihashmap_get_multiple (const struct | |
| GNUNET_CONTAINER_MultiHashMap *
map, | | GNUNET_CONTAINER_MultiHashMap *
map, | |
|
| const GNUNET_HashCode * key, | | const struct GNUNET_HashCode *
key, | |
| GNUNET_CONTAINER_HashMapIterato
r it, | | GNUNET_CONTAINER_HashMapIterato
r it, | |
| void *it_cls); | | void *it_cls); | |
| | | | |
| /* ******************** doubly-linked list *************** */ | | /* ******************** doubly-linked list *************** */ | |
| /* To avoid mistakes: head->prev == tail->next == NULL */ | | /* To avoid mistakes: head->prev == tail->next == NULL */ | |
| | | | |
| /** | | /** | |
| * Insert an element at the head of a DLL. Assumes that head, tail and | | * Insert an element at the head of a DLL. Assumes that head, tail and | |
| * element are structs with prev and next fields. | | * element are structs with prev and next fields. | |
| * | | * | |
| | | | |
| skipping to change at line 784 | | skipping to change at line 794 | |
| (head) = (element)->next; \ | | (head) = (element)->next; \ | |
| else \ | | else \ | |
| (element)->prev->next = (element)->next; \ | | (element)->prev->next = (element)->next; \ | |
| if ((element)->next == NULL) \ | | if ((element)->next == NULL) \ | |
| (tail) = (element)->prev; \ | | (tail) = (element)->prev; \ | |
| else \ | | else \ | |
| (element)->next->prev = (element)->prev; \ | | (element)->next->prev = (element)->prev; \ | |
| (element)->next = NULL; \ | | (element)->next = NULL; \ | |
| (element)->prev = NULL; } while (0) | | (element)->prev = NULL; } while (0) | |
| | | | |
|
| | | /* ************ Multi-DLL interface, allows DLL elements to be | |
| | | in multiple lists at the same time *********************** */ | |
| | | | |
| | | /** | |
| | | * Insert an element at the head of a MDLL. Assumes that head, tail and | |
| | | * element are structs with prev and next fields. | |
| | | * | |
| | | * @param mdll suffix name for the next and prev pointers in the element | |
| | | * @param head pointer to the head of the MDLL | |
| | | * @param tail pointer to the tail of the MDLL | |
| | | * @param element element to insert | |
| | | */ | |
| | | #define GNUNET_CONTAINER_MDLL_insert(mdll,head,tail,element) do { \ | |
| | | GNUNET_assert ( ( (element)->prev_##mdll == NULL) && ((head) != (element) | |
| | | )); \ | |
| | | GNUNET_assert ( ( (element)->next_##mdll == NULL) && ((tail) != (element) | |
| | | )); \ | |
| | | (element)->next_##mdll = (head); \ | |
| | | (element)->prev_##mdll = NULL; \ | |
| | | if ((tail) == NULL) \ | |
| | | (tail) = element; \ | |
| | | else \ | |
| | | (head)->prev_##mdll = element; \ | |
| | | (head) = (element); } while (0) | |
| | | | |
| | | /** | |
| | | * Insert an element at the tail of a MDLL. Assumes that head, tail and | |
| | | * element are structs with prev and next fields. | |
| | | * | |
| | | * @param mdll suffix name for the next and prev pointers in the element | |
| | | * @param head pointer to the head of the MDLL | |
| | | * @param tail pointer to the tail of the MDLL | |
| | | * @param element element to insert | |
| | | */ | |
| | | #define GNUNET_CONTAINER_MDLL_insert_tail(mdll,head,tail,element) do { \ | |
| | | GNUNET_assert ( ( (element)->prev_##mdll == NULL) && ((head) != (element) | |
| | | )); \ | |
| | | GNUNET_assert ( ( (element)->next_##mdll == NULL) && ((tail) != (element) | |
| | | )); \ | |
| | | (element)->prev_##mdll = (tail); \ | |
| | | (element)->next_##mdll = NULL; \ | |
| | | if ((head) == NULL) \ | |
| | | (head) = element; \ | |
| | | else \ | |
| | | (tail)->next_##mdll = element; \ | |
| | | (tail) = (element); } while (0) | |
| | | | |
| | | /** | |
| | | * Insert an element into a MDLL after the given other element. Insert | |
| | | * at the head if the other element is NULL. | |
| | | * | |
| | | * @param mdll suffix name for the next and prev pointers in the element | |
| | | * @param head pointer to the head of the MDLL | |
| | | * @param tail pointer to the tail of the MDLL | |
| | | * @param other prior element, NULL for insertion at head of MDLL | |
| | | * @param element element to insert | |
| | | */ | |
| | | #define GNUNET_CONTAINER_MDLL_insert_after(mdll,head,tail,other,element) do | |
| | | { \ | |
| | | GNUNET_assert ( ( (element)->prev_##mdll == NULL) && ((head) != (element) | |
| | | )); \ | |
| | | GNUNET_assert ( ( (element)->next_##mdll == NULL) && ((tail) != (element) | |
| | | )); \ | |
| | | (element)->prev_##mdll = (other); \ | |
| | | if (NULL == other) \ | |
| | | { \ | |
| | | (element)->next_##mdll = (head); \ | |
| | | (head) = (element); \ | |
| | | } \ | |
| | | else \ | |
| | | { \ | |
| | | (element)->next_##mdll = (other)->next_##mdll; \ | |
| | | (other)->next_##mdll = (element); \ | |
| | | } \ | |
| | | if (NULL == (element)->next_##mdll) \ | |
| | | (tail) = (element); \ | |
| | | else \ | |
| | | (element)->next->prev_##mdll = (element); } while (0) | |
| | | | |
| | | /** | |
| | | * Insert an element into a MDLL before the given other element. Insert | |
| | | * at the tail if the other element is NULL. | |
| | | * | |
| | | * @param mdll suffix name for the next and prev pointers in the element | |
| | | * @param head pointer to the head of the MDLL | |
| | | * @param tail pointer to the tail of the MDLL | |
| | | * @param other prior element, NULL for insertion at head of MDLL | |
| | | * @param element element to insert | |
| | | */ | |
| | | #define GNUNET_CONTAINER_MDLL_insert_before(mdll,head,tail,other,element) d | |
| | | o { \ | |
| | | GNUNET_assert ( ( (element)->prev_##mdll == NULL) && ((head) != (element) | |
| | | )); \ | |
| | | GNUNET_assert ( ( (element)->next_##mdll == NULL) && ((tail) != (element) | |
| | | )); \ | |
| | | (element)->next_##mdll = (other); \ | |
| | | if (NULL == other) \ | |
| | | { \ | |
| | | (element)->prev = (tail); \ | |
| | | (tail) = (element); \ | |
| | | } \ | |
| | | else \ | |
| | | { \ | |
| | | (element)->prev_##mdll = (other)->prev_##mdll; \ | |
| | | (other)->prev_##mdll = (element); \ | |
| | | } \ | |
| | | if (NULL == (element)->prev_##mdll) \ | |
| | | (head) = (element); \ | |
| | | else \ | |
| | | (element)->prev_##mdll->next_##mdll = (element); } while (0) | |
| | | | |
| | | /** | |
| | | * Remove an element from a MDLL. Assumes | |
| | | * that head, tail and element are structs | |
| | | * with prev and next fields. | |
| | | * | |
| | | * @param mdll suffix name for the next and prev pointers in the element | |
| | | * @param head pointer to the head of the MDLL | |
| | | * @param tail pointer to the tail of the MDLL | |
| | | * @param element element to remove | |
| | | */ | |
| | | #define GNUNET_CONTAINER_MDLL_remove(mdll,head,tail,element) do { \ | |
| | | GNUNET_assert ( ( (element)->prev_##mdll != NULL) || ((head) == (element) | |
| | | )); \ | |
| | | GNUNET_assert ( ( (element)->next_##mdll != NULL) || ((tail) == (element) | |
| | | )); \ | |
| | | if ((element)->prev_##mdll == NULL) \ | |
| | | (head) = (element)->next_##mdll; \ | |
| | | else \ | |
| | | (element)->prev_##mdll->next_##mdll = (element)->next_##mdll; \ | |
| | | if ((element)->next_##mdll == NULL) \ | |
| | | (tail) = (element)->prev_##mdll; \ | |
| | | else \ | |
| | | (element)->next_##mdll->prev_##mdll = (element)->prev_##mdll; \ | |
| | | (element)->next_##mdll = NULL; \ | |
| | | (element)->prev_##mdll = NULL; } while (0) | |
| | | | |
| /* ******************** Heap *************** */ | | /* ******************** Heap *************** */ | |
| | | | |
| /** | | /** | |
| * Cost by which elements in a heap can be ordered. | | * Cost by which elements in a heap can be ordered. | |
| */ | | */ | |
| typedef uint64_t GNUNET_CONTAINER_HeapCostType; | | typedef uint64_t GNUNET_CONTAINER_HeapCostType; | |
| | | | |
| /* | | /* | |
| * Heap type, either max or min. Hopefully makes the | | * Heap type, either max or min. Hopefully makes the | |
| * implementation more useful. | | * implementation more useful. | |
| | | | |
End of changes. 19 change blocks. |
| 17 lines changed or deleted | | 172 lines changed or added | |
|
| gnunet_crypto_lib.h | | gnunet_crypto_lib.h | |
| | | | |
| skipping to change at line 93 | | skipping to change at line 93 | |
| #define GNUNET_CRYPTO_RSA_DATA_ENCODING_LENGTH 256 | | #define GNUNET_CRYPTO_RSA_DATA_ENCODING_LENGTH 256 | |
| | | | |
| /** | | /** | |
| * Length of an RSA KEY (n,e,len), 2048 bit (=256 octests) key n, 2 byte e | | * Length of an RSA KEY (n,e,len), 2048 bit (=256 octests) key n, 2 byte e | |
| */ | | */ | |
| #define GNUNET_CRYPTO_RSA_KEY_LENGTH 258 | | #define GNUNET_CRYPTO_RSA_KEY_LENGTH 258 | |
| | | | |
| /** | | /** | |
| * Length of a hash value | | * Length of a hash value | |
| */ | | */ | |
|
| #define GNUNET_CRYPTO_HASH_LENGTH 512/8 | | #define GNUNET_CRYPTO_HASH_LENGTH (512/8) | |
| | | | |
| | | /** | |
| | | * Maximum length of an ECC signature. | |
| | | * Note: round up to multiple of 8 minus 2 for alignment. | |
| | | */ | |
| | | #define GNUNET_CRYPTO_ECC_SIGNATURE_DATA_ENCODING_LENGTH 190 | |
| | | | |
| | | /** | |
| | | * Maximum length of the public key (q-point, Q = dP) when encoded. | |
| | | */ | |
| | | #define GNUNET_CRYPTO_ECC_MAX_PUBLIC_KEY_LENGTH 140 | |
| | | | |
| /** | | /** | |
| * The private information of an RSA key pair. | | * The private information of an RSA key pair. | |
| */ | | */ | |
| struct GNUNET_CRYPTO_RsaPrivateKey; | | struct GNUNET_CRYPTO_RsaPrivateKey; | |
| | | | |
|
| | | /** | |
| | | * The private information of an ECC private key. | |
| | | */ | |
| | | struct GNUNET_CRYPTO_EccPrivateKey; | |
| | | | |
| GNUNET_NETWORK_STRUCT_BEGIN | | GNUNET_NETWORK_STRUCT_BEGIN | |
| | | | |
| /** | | /** | |
| * GNUnet mandates a certain format for the encoding | | * GNUnet mandates a certain format for the encoding | |
| * of private RSA key information that is provided | | * of private RSA key information that is provided | |
| * by the RSA implementations. This format is used | | * by the RSA implementations. This format is used | |
| * to serialize a private RSA key (typically when | | * to serialize a private RSA key (typically when | |
| * writing it to disk). | | * writing it to disk). | |
| */ | | */ | |
| struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded | | struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded | |
| | | | |
| skipping to change at line 127 | | skipping to change at line 143 | |
| uint16_t sized GNUNET_PACKED; /* in big-endian! */ | | uint16_t sized GNUNET_PACKED; /* in big-endian! */ | |
| uint16_t sizep GNUNET_PACKED; /* in big-endian! */ | | uint16_t sizep GNUNET_PACKED; /* in big-endian! */ | |
| uint16_t sizeq GNUNET_PACKED; /* in big-endian! */ | | uint16_t sizeq GNUNET_PACKED; /* in big-endian! */ | |
| uint16_t sizedmp1 GNUNET_PACKED; /* in big-endian! */ | | uint16_t sizedmp1 GNUNET_PACKED; /* in big-endian! */ | |
| uint16_t sizedmq1 GNUNET_PACKED; /* in big-endian! */ | | uint16_t sizedmq1 GNUNET_PACKED; /* in big-endian! */ | |
| /* followed by the actual values */ | | /* followed by the actual values */ | |
| }; | | }; | |
| GNUNET_NETWORK_STRUCT_END | | GNUNET_NETWORK_STRUCT_END | |
| | | | |
| /** | | /** | |
|
| * @brief 0-terminated ASCII encoding of a GNUNET_HashCode. | | * @brief 0-terminated ASCII encoding of a struct GNUNET_HashCode. | |
| */ | | */ | |
| struct GNUNET_CRYPTO_HashAsciiEncoded | | struct GNUNET_CRYPTO_HashAsciiEncoded | |
| { | | { | |
| unsigned char encoding[104]; | | unsigned char encoding[104]; | |
| }; | | }; | |
| | | | |
| /** | | /** | |
|
| * @brief 256-bit hashcode | | | |
| */ | | | |
| struct GNUNET_CRYPTO_ShortHashCode | | | |
| { | | | |
| uint32_t bits[256 / 8 / sizeof (uint32_t)]; /* = 8 */ | | | |
| }; | | | |
| | | | |
| /** | | | |
| * @brief 0-terminated ASCII encoding of a 'struct GNUNET_ShortHashCode'. | | * @brief 0-terminated ASCII encoding of a 'struct GNUNET_ShortHashCode'. | |
| */ | | */ | |
| struct GNUNET_CRYPTO_ShortHashAsciiEncoded | | struct GNUNET_CRYPTO_ShortHashAsciiEncoded | |
| { | | { | |
| unsigned char short_encoding[53]; | | unsigned char short_encoding[53]; | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * @brief an RSA signature | | * @brief an RSA signature | |
| */ | | */ | |
| | | | |
| skipping to change at line 219 | | skipping to change at line 227 | |
| | | | |
| /** | | /** | |
| * RSA Encrypted data. | | * RSA Encrypted data. | |
| */ | | */ | |
| struct GNUNET_CRYPTO_RsaEncryptedData | | struct GNUNET_CRYPTO_RsaEncryptedData | |
| { | | { | |
| unsigned char encoding[GNUNET_CRYPTO_RSA_DATA_ENCODING_LENGTH]; | | unsigned char encoding[GNUNET_CRYPTO_RSA_DATA_ENCODING_LENGTH]; | |
| }; | | }; | |
| | | | |
| /** | | /** | |
|
| | | * @brief header of what an ECC signature signs | |
| | | * this must be followed by "size - 8" bytes of | |
| | | * the actual signed data | |
| | | */ | |
| | | struct GNUNET_CRYPTO_EccSignaturePurpose | |
| | | { | |
| | | /** | |
| | | * How many bytes does this signature sign? | |
| | | * (including this purpose header); in network | |
| | | * byte order (!). | |
| | | */ | |
| | | uint32_t size GNUNET_PACKED; | |
| | | | |
| | | /** | |
| | | * What does this signature vouch for? This | |
| | | * must contain a GNUNET_SIGNATURE_PURPOSE_XXX | |
| | | * constant (from gnunet_signatures.h). In | |
| | | * network byte order! | |
| | | */ | |
| | | uint32_t purpose GNUNET_PACKED; | |
| | | | |
| | | }; | |
| | | | |
| | | /** | |
| | | * @brief an ECC signature | |
| | | */ | |
| | | struct GNUNET_CRYPTO_EccSignature | |
| | | { | |
| | | /** | |
| | | * Overall size of the signature data. | |
| | | */ | |
| | | uint16_t size; | |
| | | | |
| | | /** | |
| | | * S-expression, padded with zeros. | |
| | | */ | |
| | | char sexpr[GNUNET_CRYPTO_ECC_SIGNATURE_DATA_ENCODING_LENGTH]; | |
| | | }; | |
| | | | |
| | | /** | |
| | | * Public ECC key (always for NIST P-521) encoded in a format suitable | |
| | | * for network transmission as created using 'gcry_sexp_sprint'. | |
| | | */ | |
| | | struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded | |
| | | { | |
| | | /** | |
| | | * Size of the encoding, in network byte order. | |
| | | */ | |
| | | uint16_t size; | |
| | | | |
| | | /** | |
| | | * Actual length of the q-point binary encoding. | |
| | | */ | |
| | | uint16_t len; | |
| | | | |
| | | /** | |
| | | * 0-padded q-point in binary encoding (GCRYPT_MPI_FMT_USG). | |
| | | */ | |
| | | unsigned char key[GNUNET_CRYPTO_ECC_MAX_PUBLIC_KEY_LENGTH]; | |
| | | }; | |
| | | | |
| | | struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded | |
| | | { | |
| | | /** | |
| | | * Overall size of the private key. | |
| | | */ | |
| | | uint16_t size; | |
| | | | |
| | | /* followd by S-expression, opaque to applications */ | |
| | | | |
| | | /* FIXME: consider defining padding to make this a fixed-size struct */ | |
| | | | |
| | | }; | |
| | | | |
| | | /** | |
| * @brief type for session keys | | * @brief type for session keys | |
| */ | | */ | |
| struct GNUNET_CRYPTO_AesSessionKey | | struct GNUNET_CRYPTO_AesSessionKey | |
| { | | { | |
| /** | | /** | |
| * Actual key. | | * Actual key. | |
| */ | | */ | |
| unsigned char key[GNUNET_CRYPTO_AES_KEY_LENGTH]; | | unsigned char key[GNUNET_CRYPTO_AES_KEY_LENGTH]; | |
| | | | |
| /** | | /** | |
| * checksum! | | * checksum! | |
| */ | | */ | |
| uint32_t crc32 GNUNET_PACKED; | | uint32_t crc32 GNUNET_PACKED; | |
| }; | | }; | |
| GNUNET_NETWORK_STRUCT_END | | GNUNET_NETWORK_STRUCT_END | |
| | | | |
| /** | | /** | |
| * @brief IV for sym cipher | | * @brief IV for sym cipher | |
| * | | * | |
| * NOTE: must be smaller (!) in size than the | | * NOTE: must be smaller (!) in size than the | |
|
| * GNUNET_HashCode. | | * struct GNUNET_HashCode. | |
| */ | | */ | |
| struct GNUNET_CRYPTO_AesInitializationVector | | struct GNUNET_CRYPTO_AesInitializationVector | |
| { | | { | |
| unsigned char iv[GNUNET_CRYPTO_AES_KEY_LENGTH / 2]; | | unsigned char iv[GNUNET_CRYPTO_AES_KEY_LENGTH / 2]; | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * @brief type for (message) authentication keys | | * @brief type for (message) authentication keys | |
| */ | | */ | |
| struct GNUNET_CRYPTO_AuthKey | | struct GNUNET_CRYPTO_AuthKey | |
| | | | |
| skipping to change at line 420 | | skipping to change at line 503 | |
| const struct GNUNET_CRYPTO_AesSessionKey *sk
ey, | | const struct GNUNET_CRYPTO_AesSessionKey *sk
ey, | |
| const void *salt, size_t salt_len, va_list a
rgp); | | const void *salt, size_t salt_len, va_list a
rgp); | |
| | | | |
| /** | | /** | |
| * Convert hash to ASCII encoding. | | * Convert hash to ASCII encoding. | |
| * @param block the hash code | | * @param block the hash code | |
| * @param result where to store the encoding (struct GNUNET_CRYPTO_HashAsci
iEncoded can be | | * @param result where to store the encoding (struct GNUNET_CRYPTO_HashAsci
iEncoded can be | |
| * safely cast to char*, a '\\0' termination is set). | | * safely cast to char*, a '\\0' termination is set). | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_CRYPTO_hash_to_enc (const GNUNET_HashCode * block, | | GNUNET_CRYPTO_hash_to_enc (const struct GNUNET_HashCode * block, | |
| struct GNUNET_CRYPTO_HashAsciiEncoded *result); | | struct GNUNET_CRYPTO_HashAsciiEncoded *result); | |
| | | | |
| /** | | /** | |
| * Convert short hash to ASCII encoding. | | * Convert short hash to ASCII encoding. | |
| * | | * | |
| * @param block the hash code | | * @param block the hash code | |
| * @param result where to store the encoding (struct GNUNET_CRYPTO_ShortHas
hAsciiEncoded can be | | * @param result where to store the encoding (struct GNUNET_CRYPTO_ShortHas
hAsciiEncoded can be | |
| * safely cast to char*, a '\\0' termination is set). | | * safely cast to char*, a '\\0' termination is set). | |
| */ | | */ | |
| void | | void | |
| GNUNET_CRYPTO_short_hash_to_enc (const struct GNUNET_CRYPTO_ShortHashCode *
block, | | GNUNET_CRYPTO_short_hash_to_enc (const struct GNUNET_CRYPTO_ShortHashCode *
block, | |
| struct GNUNET_CRYPTO_ShortHashAsciiEncoded
*result); | | struct GNUNET_CRYPTO_ShortHashAsciiEncoded
*result); | |
| | | | |
| /** | | /** | |
|
| * Convert ASCII encoding back to a 'GNUNET_HashCode' | | * Convert ASCII encoding back to a 'struct GNUNET_HashCode' | |
| * | | * | |
| * @param enc the encoding | | * @param enc the encoding | |
| * @param enclen number of characters in 'enc' (without 0-terminator, which
can be missing) | | * @param enclen number of characters in 'enc' (without 0-terminator, which
can be missing) | |
| * @param result where to store the GNUNET_CRYPTO_hash code | | * @param result where to store the GNUNET_CRYPTO_hash code | |
| * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco
ding | | * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco
ding | |
| */ | | */ | |
| int | | int | |
| GNUNET_CRYPTO_hash_from_string2 (const char *enc, size_t enclen, | | GNUNET_CRYPTO_hash_from_string2 (const char *enc, size_t enclen, | |
|
| GNUNET_HashCode * result); | | struct GNUNET_HashCode * result); | |
| | | | |
| /** | | /** | |
| * Convert ASCII encoding back to a 'struct GNUNET_CRYPTO_ShortHash' | | * Convert ASCII encoding back to a 'struct GNUNET_CRYPTO_ShortHash' | |
| * | | * | |
| * @param enc the encoding | | * @param enc the encoding | |
| * @param enclen number of characters in 'enc' (without 0-terminator, which
can be missing) | | * @param enclen number of characters in 'enc' (without 0-terminator, which
can be missing) | |
| * @param result where to store the GNUNET_CRYPTO_hash code | | * @param result where to store the GNUNET_CRYPTO_hash code | |
| * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco
ding | | * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco
ding | |
| */ | | */ | |
| int | | int | |
| GNUNET_CRYPTO_short_hash_from_string2 (const char *enc, size_t enclen, | | GNUNET_CRYPTO_short_hash_from_string2 (const char *enc, size_t enclen, | |
| struct GNUNET_CRYPTO_ShortHashCode *
result); | | struct GNUNET_CRYPTO_ShortHashCode *
result); | |
| | | | |
| /** | | /** | |
|
| * Convert ASCII encoding back to GNUNET_HashCode | | * Convert ASCII encoding back to struct GNUNET_HashCode | |
| * | | * | |
| * @param enc the encoding | | * @param enc the encoding | |
| * @param result where to store the hash code | | * @param result where to store the hash code | |
| * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco
ding | | * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco
ding | |
| */ | | */ | |
| #define GNUNET_CRYPTO_hash_from_string(enc, result) \ | | #define GNUNET_CRYPTO_hash_from_string(enc, result) \ | |
| GNUNET_CRYPTO_hash_from_string2 (enc, strlen(enc), result) | | GNUNET_CRYPTO_hash_from_string2 (enc, strlen(enc), result) | |
| | | | |
| /** | | /** | |
| * Convert ASCII encoding back to a 'struct GNUNET_CRYPTO_ShortHash' | | * Convert ASCII encoding back to a 'struct GNUNET_CRYPTO_ShortHash' | |
| | | | |
| skipping to change at line 502 | | skipping to change at line 585 | |
| * The computation must be fast, not involve | | * The computation must be fast, not involve | |
| * a.a or a.e (they're used elsewhere), and | | * a.a or a.e (they're used elsewhere), and | |
| * be somewhat consistent. And of course, the | | * be somewhat consistent. And of course, the | |
| * result should be a positive number. | | * result should be a positive number. | |
| * | | * | |
| * @param a some hash code | | * @param a some hash code | |
| * @param b some hash code | | * @param b some hash code | |
| * @return number between 0 and UINT32_MAX | | * @return number between 0 and UINT32_MAX | |
| */ | | */ | |
| uint32_t | | uint32_t | |
|
| GNUNET_CRYPTO_hash_distance_u32 (const GNUNET_HashCode * a, | | GNUNET_CRYPTO_hash_distance_u32 (const struct GNUNET_HashCode * a, | |
| const GNUNET_HashCode * b); | | const struct GNUNET_HashCode * b); | |
| | | | |
| /** | | /** | |
| * Compute hash of a given block. | | * Compute hash of a given block. | |
| * | | * | |
| * @param block the data to hash | | * @param block the data to hash | |
| * @param size size of the block | | * @param size size of the block | |
| * @param ret pointer to where to write the hashcode | | * @param ret pointer to where to write the hashcode | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_CRYPTO_hash (const void *block, size_t size, GNUNET_HashCode * ret); | | GNUNET_CRYPTO_hash (const void *block, size_t size, struct GNUNET_HashCode
* ret); | |
| | | | |
| /** | | /** | |
| * Compute short (256-bit) hash of a given block. | | * Compute short (256-bit) hash of a given block. | |
| * | | * | |
| * @param block the data to hash | | * @param block the data to hash | |
| * @param size size of the block | | * @param size size of the block | |
| * @param ret pointer to where to write the hashcode | | * @param ret pointer to where to write the hashcode | |
| */ | | */ | |
| void | | void | |
| GNUNET_CRYPTO_short_hash (const void *block, size_t size, | | GNUNET_CRYPTO_short_hash (const void *block, size_t size, | |
| | | | |
| skipping to change at line 559 | | skipping to change at line 642 | |
| * Calculate HMAC of a message (RFC 2104) | | * Calculate HMAC of a message (RFC 2104) | |
| * | | * | |
| * @param key secret key | | * @param key secret key | |
| * @param plaintext input plaintext | | * @param plaintext input plaintext | |
| * @param plaintext_len length of plaintext | | * @param plaintext_len length of plaintext | |
| * @param hmac where to store the hmac | | * @param hmac where to store the hmac | |
| */ | | */ | |
| void | | void | |
| GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key, | | GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key, | |
| const void *plaintext, size_t plaintext_len, | | const void *plaintext, size_t plaintext_len, | |
|
| GNUNET_HashCode * hmac); | | struct GNUNET_HashCode * hmac); | |
| | | | |
| /** | | /** | |
| * Function called once the hash computation over the | | * Function called once the hash computation over the | |
| * specified file has completed. | | * specified file has completed. | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param res resulting hash, NULL on error | | * @param res resulting hash, NULL on error | |
| */ | | */ | |
| typedef void (*GNUNET_CRYPTO_HashCompletedCallback) (void *cls, | | typedef void (*GNUNET_CRYPTO_HashCompletedCallback) (void *cls, | |
|
| const GNUNET_HashCode
* | | const struct GNUNET_Ha
shCode * | |
| res); | | res); | |
| | | | |
| /** | | /** | |
| * Handle to file hashing operation. | | * Handle to file hashing operation. | |
| */ | | */ | |
| struct GNUNET_CRYPTO_FileHashContext; | | struct GNUNET_CRYPTO_FileHashContext; | |
| | | | |
| /** | | /** | |
| * Compute the hash of an entire file. | | * Compute the hash of an entire file. | |
| * | | * | |
| | | | |
| skipping to change at line 609 | | skipping to change at line 692 | |
| GNUNET_CRYPTO_hash_file_cancel (struct GNUNET_CRYPTO_FileHashContext *fhc); | | GNUNET_CRYPTO_hash_file_cancel (struct GNUNET_CRYPTO_FileHashContext *fhc); | |
| | | | |
| /** | | /** | |
| * Create a random hash code. | | * Create a random hash code. | |
| * | | * | |
| * @param mode desired quality level | | * @param mode desired quality level | |
| * @param result hash code that is randomized | | * @param result hash code that is randomized | |
| */ | | */ | |
| void | | void | |
| GNUNET_CRYPTO_hash_create_random (enum GNUNET_CRYPTO_Quality mode, | | GNUNET_CRYPTO_hash_create_random (enum GNUNET_CRYPTO_Quality mode, | |
|
| GNUNET_HashCode * result); | | struct GNUNET_HashCode * result); | |
| | | | |
| /** | | /** | |
| * compute result(delta) = b - a | | * compute result(delta) = b - a | |
| * | | * | |
| * @param a some hash code | | * @param a some hash code | |
| * @param b some hash code | | * @param b some hash code | |
| * @param result set to b - a | | * @param result set to b - a | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_CRYPTO_hash_difference (const GNUNET_HashCode * a, | | GNUNET_CRYPTO_hash_difference (const struct GNUNET_HashCode * a, | |
| const GNUNET_HashCode * b, | | const struct GNUNET_HashCode * b, | |
| GNUNET_HashCode * result); | | struct GNUNET_HashCode * result); | |
| | | | |
| /** | | /** | |
| * compute result(b) = a + delta | | * compute result(b) = a + delta | |
| * | | * | |
| * @param a some hash code | | * @param a some hash code | |
| * @param delta some hash code | | * @param delta some hash code | |
| * @param result set to a + delta | | * @param result set to a + delta | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_CRYPTO_hash_sum (const GNUNET_HashCode * a, | | GNUNET_CRYPTO_hash_sum (const struct GNUNET_HashCode * a, | |
| const GNUNET_HashCode * delta, | | const struct GNUNET_HashCode * delta, | |
| GNUNET_HashCode * result); | | struct GNUNET_HashCode * result); | |
| | | | |
| /** | | /** | |
| * compute result = a ^ b | | * compute result = a ^ b | |
| * | | * | |
| * @param a some hash code | | * @param a some hash code | |
| * @param b some hash code | | * @param b some hash code | |
| * @param result set to a ^ b | | * @param result set to a ^ b | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_CRYPTO_hash_xor (const GNUNET_HashCode * a, const GNUNET_HashCode * | | GNUNET_CRYPTO_hash_xor (const struct GNUNET_HashCode * a, const struct GNUN | |
| b, | | ET_HashCode * b, | |
| GNUNET_HashCode * result); | | struct GNUNET_HashCode * result); | |
| | | | |
| /** | | /** | |
| * Convert a hashcode into a key. | | * Convert a hashcode into a key. | |
| * | | * | |
| * @param hc hash code that serves to generate the key | | * @param hc hash code that serves to generate the key | |
| * @param skey set to a valid session key | | * @param skey set to a valid session key | |
| * @param iv set to a valid initialization vector | | * @param iv set to a valid initialization vector | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_CRYPTO_hash_to_aes_key (const GNUNET_HashCode * hc, | | GNUNET_CRYPTO_hash_to_aes_key (const struct GNUNET_HashCode * hc, | |
| struct GNUNET_CRYPTO_AesSessionKey *skey, | | struct GNUNET_CRYPTO_AesSessionKey *skey, | |
| struct GNUNET_CRYPTO_AesInitializationVector | | struct GNUNET_CRYPTO_AesInitializationVector | |
| *iv); | | *iv); | |
| | | | |
| /** | | /** | |
| * Obtain a bit from a hashcode. | | * Obtain a bit from a hashcode. | |
| * | | * | |
| * @param code the GNUNET_CRYPTO_hash to index bit-wise | | * @param code the GNUNET_CRYPTO_hash to index bit-wise | |
| * @param bit index into the hashcode, [0...159] | | * @param bit index into the hashcode, [0...159] | |
| * @return Bit \a bit from hashcode \a code, -1 for invalid index | | * @return Bit \a bit from hashcode \a code, -1 for invalid index | |
| */ | | */ | |
| int | | int | |
|
| GNUNET_CRYPTO_hash_get_bit (const GNUNET_HashCode * code, unsigned int bit)
; | | GNUNET_CRYPTO_hash_get_bit (const struct GNUNET_HashCode * code, unsigned i
nt bit); | |
| | | | |
| /** | | /** | |
| * Determine how many low order bits match in two | | * Determine how many low order bits match in two | |
|
| * GNUNET_HashCodes. i.e. - 010011 and 011111 share | | * struct GNUNET_HashCodes. i.e. - 010011 and 011111 share | |
| * the first two lowest order bits, and therefore the | | * the first two lowest order bits, and therefore the | |
| * return value is two (NOT XOR distance, nor how many | | * return value is two (NOT XOR distance, nor how many | |
| * bits match absolutely!). | | * bits match absolutely!). | |
| * | | * | |
| * @param first the first hashcode | | * @param first the first hashcode | |
| * @param second the hashcode to compare first to | | * @param second the hashcode to compare first to | |
| * | | * | |
| * @return the number of bits that match | | * @return the number of bits that match | |
| */ | | */ | |
| unsigned int | | unsigned int | |
|
| GNUNET_CRYPTO_hash_matching_bits (const GNUNET_HashCode * first, | | GNUNET_CRYPTO_hash_matching_bits (const struct GNUNET_HashCode * first, | |
| const GNUNET_HashCode * second); | | const struct GNUNET_HashCode * second); | |
| | | | |
| /** | | /** | |
| * Compare function for HashCodes, producing a total ordering | | * Compare function for HashCodes, producing a total ordering | |
| * of all hashcodes. | | * of all hashcodes. | |
| * | | * | |
| * @param h1 some hash code | | * @param h1 some hash code | |
| * @param h2 some hash code | | * @param h2 some hash code | |
| * @return 1 if h1 > h2, -1 if h1 < h2 and 0 if h1 == h2. | | * @return 1 if h1 > h2, -1 if h1 < h2 and 0 if h1 == h2. | |
| */ | | */ | |
| int | | int | |
|
| GNUNET_CRYPTO_hash_cmp (const GNUNET_HashCode * h1, const GNUNET_HashCode *
h2); | | GNUNET_CRYPTO_hash_cmp (const struct GNUNET_HashCode * h1, const struct GNU
NET_HashCode * h2); | |
| | | | |
| /** | | /** | |
| * Find out which of the two GNUNET_CRYPTO_hash codes is closer to target | | * Find out which of the two GNUNET_CRYPTO_hash codes is closer to target | |
| * in the XOR metric (Kademlia). | | * in the XOR metric (Kademlia). | |
| * | | * | |
| * @param h1 some hash code | | * @param h1 some hash code | |
| * @param h2 some hash code | | * @param h2 some hash code | |
| * @param target some hash code | | * @param target some hash code | |
| * @return -1 if h1 is closer, 1 if h2 is closer and 0 if h1==h2. | | * @return -1 if h1 is closer, 1 if h2 is closer and 0 if h1==h2. | |
| */ | | */ | |
| int | | int | |
|
| GNUNET_CRYPTO_hash_xorcmp (const GNUNET_HashCode * h1, | | GNUNET_CRYPTO_hash_xorcmp (const struct GNUNET_HashCode * h1, | |
| const GNUNET_HashCode * h2, | | const struct GNUNET_HashCode * h2, | |
| const GNUNET_HashCode * target); | | const struct GNUNET_HashCode * target); | |
| | | | |
| /** | | /** | |
| * @brief Derive an authentication key | | * @brief Derive an authentication key | |
| * @param key authentication key | | * @param key authentication key | |
| * @param rkey root key | | * @param rkey root key | |
| * @param salt salt | | * @param salt salt | |
| * @param salt_len size of the salt | | * @param salt_len size of the salt | |
| * @param argp pair of void * & size_t for context chunks, terminated by NU
LL | | * @param argp pair of void * & size_t for context chunks, terminated by NU
LL | |
| */ | | */ | |
| void | | void | |
| | | | |
| skipping to change at line 804 | | skipping to change at line 887 | |
| * @param skm source key material | | * @param skm source key material | |
| * @param skm_len length of skm | | * @param skm_len length of skm | |
| * @param ... void * & size_t pairs for context chunks | | * @param ... void * & size_t pairs for context chunks | |
| * @return GNUNET_YES on success | | * @return GNUNET_YES on success | |
| */ | | */ | |
| int | | int | |
| GNUNET_CRYPTO_kdf (void *result, size_t out_len, const void *xts, | | GNUNET_CRYPTO_kdf (void *result, size_t out_len, const void *xts, | |
| size_t xts_len, const void *skm, size_t skm_len, ...); | | size_t xts_len, const void *skm, size_t skm_len, ...); | |
| | | | |
| /** | | /** | |
|
| * Create a new private key. Caller must free return value. | | | |
| * | | | |
| * @return fresh private key | | | |
| */ | | | |
| struct GNUNET_CRYPTO_RsaPrivateKey * | | | |
| GNUNET_CRYPTO_rsa_key_create (void); | | | |
| | | | |
| /** | | | |
| * Convert a public key to a string. | | * Convert a public key to a string. | |
| * | | * | |
| * @param pub key to convert | | * @param pub key to convert | |
| * @return string representing 'pub' | | * @return string representing 'pub' | |
| */ | | */ | |
| char * | | char * | |
| GNUNET_CRYPTO_rsa_public_key_to_string (struct GNUNET_CRYPTO_RsaPublicKeyBi
naryEncoded *pub); | | GNUNET_CRYPTO_rsa_public_key_to_string (struct GNUNET_CRYPTO_RsaPublicKeyBi
naryEncoded *pub); | |
| | | | |
| /** | | /** | |
| * Convert a string representing a public key to a public key. | | * Convert a string representing a public key to a public key. | |
| | | | |
| skipping to change at line 836 | | skipping to change at line 911 | |
| * @return GNUNET_OK on success | | * @return GNUNET_OK on success | |
| */ | | */ | |
| int | | int | |
| GNUNET_CRYPTO_rsa_public_key_from_string (const char *enc, | | GNUNET_CRYPTO_rsa_public_key_from_string (const char *enc, | |
| size_t enclen, | | size_t enclen, | |
| struct GNUNET_CRYPTO_RsaPublicKeyB
inaryEncoded *pub); | | struct GNUNET_CRYPTO_RsaPublicKeyB
inaryEncoded *pub); | |
| | | | |
| /** | | /** | |
| * Encode the private key in a format suitable for | | * Encode the private key in a format suitable for | |
| * storing it into a file. | | * storing it into a file. | |
|
| * @returns encoding of the private key. | | * @return encoding of the private key | |
| * The first 4 bytes give the size of the array, as usual. | | | |
| */ | | */ | |
| struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded * | | struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded * | |
| GNUNET_CRYPTO_rsa_encode_key (const struct GNUNET_CRYPTO_RsaPrivateKey *hos
tkey); | | GNUNET_CRYPTO_rsa_encode_key (const struct GNUNET_CRYPTO_RsaPrivateKey *hos
tkey); | |
| | | | |
| /** | | /** | |
| * Decode the private key from the data-format back | | * Decode the private key from the data-format back | |
| * to the "normal", internal format. | | * to the "normal", internal format. | |
| * | | * | |
| * @param buf the buffer where the private key data is stored | | * @param buf the buffer where the private key data is stored | |
| * @param len the length of the data in 'buffer' | | * @param len the length of the data in 'buffer' | |
|
| | | * @return NULL on error | |
| */ | | */ | |
| struct GNUNET_CRYPTO_RsaPrivateKey * | | struct GNUNET_CRYPTO_RsaPrivateKey * | |
| GNUNET_CRYPTO_rsa_decode_key (const char *buf, uint16_t len); | | GNUNET_CRYPTO_rsa_decode_key (const char *buf, uint16_t len); | |
| | | | |
| /** | | /** | |
| * Create a new private key by reading it from a file. If the | | * Create a new private key by reading it from a file. If the | |
| * files does not exist, create a new key and write it to the | | * files does not exist, create a new key and write it to the | |
| * file. Caller must free return value. Note that this function | | * file. Caller must free return value. Note that this function | |
| * can not guarantee that another process might not be trying | | * can not guarantee that another process might not be trying | |
| * the same operation on the same file at the same time. | | * the same operation on the same file at the same time. | |
| * If the contents of the file | | * If the contents of the file | |
| * are invalid the old file is deleted and a fresh key is | | * are invalid the old file is deleted and a fresh key is | |
| * created. | | * created. | |
| * | | * | |
| * @param filename name of file to use for storage | | * @param filename name of file to use for storage | |
| * @return new private key, NULL on error (for example, | | * @return new private key, NULL on error (for example, | |
| * permission denied) | | * permission denied) | |
|
| | | * @deprecated use 'GNUNET_CRYPTO_rsa_key_create_start' instead | |
| */ | | */ | |
| struct GNUNET_CRYPTO_RsaPrivateKey * | | struct GNUNET_CRYPTO_RsaPrivateKey * | |
| GNUNET_CRYPTO_rsa_key_create_from_file (const char *filename); | | GNUNET_CRYPTO_rsa_key_create_from_file (const char *filename); | |
| | | | |
| /** | | /** | |
|
| | | * Handle to cancel private key generation. | |
| | | */ | |
| | | struct GNUNET_CRYPTO_RsaKeyGenerationContext; | |
| | | | |
| | | /** | |
| | | * Function called upon completion of 'GNUNET_CRYPTO_rsa_key_create_async'. | |
| | | * | |
| | | * @param cls closure | |
| | | * @param pk NULL on error, otherwise the private key (which must be free'd | |
| | | by the callee) | |
| | | * @param emsg NULL on success, otherwise an error message | |
| | | */ | |
| | | typedef void (*GNUNET_CRYPTO_RsaKeyCallback)(void *cls, | |
| | | struct GNUNET_CRYPTO_RsaPrivate | |
| | | Key *pk, | |
| | | const char *emsg); | |
| | | | |
| | | /** | |
| | | * Create a new private key by reading it from a file. If the files | |
| | | * does not exist, create a new key and write it to the file. If the | |
| | | * contents of the file are invalid the old file is deleted and a | |
| | | * fresh key is created. | |
| | | * | |
| | | * @param filename name of file to use for storage | |
| | | * @param cont function to call when done (or on errors) | |
| | | * @param cont_cls closure for 'cont' | |
| | | * @return handle to abort operation, NULL on fatal errors (cont will not b | |
| | | e called if NULL is returned) | |
| | | */ | |
| | | struct GNUNET_CRYPTO_RsaKeyGenerationContext * | |
| | | GNUNET_CRYPTO_rsa_key_create_start (const char *filename, | |
| | | GNUNET_CRYPTO_RsaKeyCallback cont, | |
| | | void *cont_cls); | |
| | | | |
| | | /** | |
| | | * Abort RSA key generation. | |
| | | * | |
| | | * @param gc key generation context to abort | |
| | | */ | |
| | | void | |
| | | GNUNET_CRYPTO_rsa_key_create_stop (struct GNUNET_CRYPTO_RsaKeyGenerationCon | |
| | | text *gc); | |
| | | | |
| | | /** | |
| * Setup a hostkey file for a peer given the name of the | | * Setup a hostkey file for a peer given the name of the | |
| * configuration file (!). This function is used so that | | * configuration file (!). This function is used so that | |
| * at a later point code can be certain that reading a | | * at a later point code can be certain that reading a | |
| * hostkey is fast (for example in time-dependent testcases). | | * hostkey is fast (for example in time-dependent testcases). | |
| * | | * | |
| * @param cfg_name name of the configuration file to use | | * @param cfg_name name of the configuration file to use | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_CRYPTO_setup_hostkey (const char *cfg_name); | | GNUNET_CRYPTO_rsa_setup_hostkey (const char *cfg_name); | |
| | | | |
| /** | | /** | |
| * Deterministically (!) create a private key using only the | | * Deterministically (!) create a private key using only the | |
| * given HashCode as input to the PRNG. | | * given HashCode as input to the PRNG. | |
| * | | * | |
| * @param hc "random" input to PRNG | | * @param hc "random" input to PRNG | |
| * @return some private key purely dependent on input | | * @return some private key purely dependent on input | |
| */ | | */ | |
| struct GNUNET_CRYPTO_RsaPrivateKey * | | struct GNUNET_CRYPTO_RsaPrivateKey * | |
|
| GNUNET_CRYPTO_rsa_key_create_from_hash (const GNUNET_HashCode * hc); | | GNUNET_CRYPTO_rsa_key_create_from_hash (const struct GNUNET_HashCode *hc); | |
| | | | |
| /** | | /** | |
| * Free memory occupied by the private key. | | * Free memory occupied by the private key. | |
|
| * @param hostkey pointer to the memory to free | | * | |
| | | * @param key pointer to the memory to free | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_CRYPTO_rsa_key_free (struct GNUNET_CRYPTO_RsaPrivateKey *hostkey); | | GNUNET_CRYPTO_rsa_key_free (struct GNUNET_CRYPTO_RsaPrivateKey *key); | |
| | | | |
| /** | | /** | |
| * Extract the public key of the host. | | * Extract the public key of the host. | |
| * | | * | |
| * @param priv the private key | | * @param priv the private key | |
| * @param pub where to write the public key | | * @param pub where to write the public key | |
| */ | | */ | |
| void | | void | |
| GNUNET_CRYPTO_rsa_key_get_public (const struct GNUNET_CRYPTO_RsaPrivateKey | | GNUNET_CRYPTO_rsa_key_get_public (const struct GNUNET_CRYPTO_RsaPrivateKey | |
| *priv, | | *priv, | |
| | | | |
| skipping to change at line 971 | | skipping to change at line 1088 | |
| */ | | */ | |
| int | | int | |
| GNUNET_CRYPTO_rsa_verify (uint32_t purpose, | | GNUNET_CRYPTO_rsa_verify (uint32_t purpose, | |
| const struct GNUNET_CRYPTO_RsaSignaturePurpose | | const struct GNUNET_CRYPTO_RsaSignaturePurpose | |
| *validate, | | *validate, | |
| const struct GNUNET_CRYPTO_RsaSignature *sig, | | const struct GNUNET_CRYPTO_RsaSignature *sig, | |
| const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEnco
ded | | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEnco
ded | |
| *publicKey); | | *publicKey); | |
| | | | |
| /** | | /** | |
|
| | | * Function called upon completion of 'GNUNET_CRYPTO_ecc_key_create_async'. | |
| | | * | |
| | | * @param cls closure | |
| | | * @param pk NULL on error, otherwise the private key (which must be free'd | |
| | | by the callee) | |
| | | * @param emsg NULL on success, otherwise an error message | |
| | | */ | |
| | | typedef void (*GNUNET_CRYPTO_EccKeyCallback)(void *cls, | |
| | | struct GNUNET_CRYPTO_EccPrivate | |
| | | Key *pk, | |
| | | const char *emsg); | |
| | | | |
| | | /** | |
| | | * Free memory occupied by ECC key | |
| | | * | |
| | | * @param privatekey pointer to the memory to free | |
| | | */ | |
| | | void | |
| | | GNUNET_CRYPTO_ecc_key_free (struct GNUNET_CRYPTO_EccPrivateKey *privatekey) | |
| | | ; | |
| | | | |
| | | /** | |
| | | * Extract the public key for the given private key. | |
| | | * | |
| | | * @param priv the private key | |
| | | * @param pub where to write the public key | |
| | | */ | |
| | | void | |
| | | GNUNET_CRYPTO_ecc_key_get_public (const struct GNUNET_CRYPTO_EccPrivateKey | |
| | | *priv, | |
| | | struct GNUNET_CRYPTO_EccPublicKeyBinaryEn | |
| | | coded *pub); | |
| | | | |
| | | /** | |
| | | * Convert a public key to a string. | |
| | | * | |
| | | * @param pub key to convert | |
| | | * @return string representing 'pub' | |
| | | */ | |
| | | char * | |
| | | GNUNET_CRYPTO_ecc_public_key_to_string (struct GNUNET_CRYPTO_EccPublicKeyBi | |
| | | naryEncoded *pub); | |
| | | | |
| | | /** | |
| | | * Convert a string representing a public key to a public key. | |
| | | * | |
| | | * @param enc encoded public key | |
| | | * @param enclen number of bytes in enc (without 0-terminator) | |
| | | * @param pub where to store the public key | |
| | | * @return GNUNET_OK on success | |
| | | */ | |
| | | int | |
| | | GNUNET_CRYPTO_ecc_public_key_from_string (const char *enc, | |
| | | size_t enclen, | |
| | | struct GNUNET_CRYPTO_EccPublicKeyB | |
| | | inaryEncoded *pub); | |
| | | | |
| | | /** | |
| | | * Encode the private key in a format suitable for | |
| | | * storing it into a file. | |
| | | * | |
| | | * @param key key to encode | |
| | | * @return encoding of the private key. | |
| | | * The first 4 bytes give the size of the array, as usual. | |
| | | */ | |
| | | struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded * | |
| | | GNUNET_CRYPTO_ecc_encode_key (const struct GNUNET_CRYPTO_EccPrivateKey *key | |
| | | ); | |
| | | | |
| | | /** | |
| | | * Decode the private key from the file-format back | |
| | | * to the "normal", internal format. | |
| | | * | |
| | | * @param buf the buffer where the private key data is stored | |
| | | * @param len the length of the data in 'buffer' | |
| | | * @return NULL on error | |
| | | */ | |
| | | struct GNUNET_CRYPTO_EccPrivateKey * | |
| | | GNUNET_CRYPTO_ecc_decode_key (const char *buf, | |
| | | size_t len); | |
| | | | |
| | | /** | |
| | | * Create a new private key by reading it from a file. If the | |
| | | * files does not exist, create a new key and write it to the | |
| | | * file. Caller must free return value. Note that this function | |
| | | * can not guarantee that another process might not be trying | |
| | | * the same operation on the same file at the same time. | |
| | | * If the contents of the file | |
| | | * are invalid the old file is deleted and a fresh key is | |
| | | * created. | |
| | | * | |
| | | * @return new private key, NULL on error (for example, | |
| | | * permission denied) | |
| | | */ | |
| | | struct GNUNET_CRYPTO_EccPrivateKey * | |
| | | GNUNET_CRYPTO_ecc_key_create_from_file (const char *filename); | |
| | | | |
| | | /** | |
| | | * Handle to cancel private key generation and state for the | |
| | | * key generation operation. | |
| | | */ | |
| | | struct GNUNET_CRYPTO_EccKeyGenerationContext; | |
| | | | |
| | | /** | |
| | | * Create a new private key by reading it from a file. If the files | |
| | | * does not exist, create a new key and write it to the file. If the | |
| | | * contents of the file are invalid the old file is deleted and a | |
| | | * fresh key is created. | |
| | | * | |
| | | * @param filename name of file to use for storage | |
| | | * @param cont function to call when done (or on errors) | |
| | | * @param cont_cls closure for 'cont' | |
| | | * @return handle to abort operation, NULL on fatal errors (cont will not b | |
| | | e called if NULL is returned) | |
| | | */ | |
| | | struct GNUNET_CRYPTO_EccKeyGenerationContext * | |
| | | GNUNET_CRYPTO_ecc_key_create_start (const char *filename, | |
| | | GNUNET_CRYPTO_EccKeyCallback cont, | |
| | | void *cont_cls); | |
| | | | |
| | | /** | |
| | | * Abort ECC key generation. | |
| | | * | |
| | | * @param gc key generation context to abort | |
| | | */ | |
| | | void | |
| | | GNUNET_CRYPTO_ecc_key_create_stop (struct GNUNET_CRYPTO_EccKeyGenerationCon | |
| | | text *gc); | |
| | | | |
| | | /** | |
| | | * Setup a hostkey file for a peer given the name of the | |
| | | * configuration file (!). This function is used so that | |
| | | * at a later point code can be certain that reading a | |
| | | * hostkey is fast (for example in time-dependent testcases). | |
| | | * | |
| | | * @param cfg_name name of the configuration file to use | |
| | | */ | |
| | | void | |
| | | GNUNET_CRYPTO_ecc_setup_hostkey (const char *cfg_name); | |
| | | | |
| | | /** | |
| | | * Sign a given block. | |
| | | * | |
| | | * @param key private key to use for the signing | |
| | | * @param purpose what to sign (size, purpose) | |
| | | * @param sig where to write the signature | |
| | | * @return GNUNET_SYSERR on error, GNUNET_OK on success | |
| | | */ | |
| | | int | |
| | | GNUNET_CRYPTO_ecc_sign (const struct GNUNET_CRYPTO_EccPrivateKey *key, | |
| | | const struct GNUNET_CRYPTO_EccSignaturePurpose *pur | |
| | | pose, | |
| | | struct GNUNET_CRYPTO_EccSignature *sig); | |
| | | | |
| | | /** | |
| | | * Verify signature. | |
| | | * | |
| | | * @param purpose what is the purpose that the signature should have? | |
| | | * @param validate block to validate (size, purpose, data) | |
| | | * @param sig signature that is being validated | |
| | | * @param publicKey public key of the signer | |
| | | * @returns GNUNET_OK if ok, GNUNET_SYSERR if invalid | |
| | | */ | |
| | | int | |
| | | GNUNET_CRYPTO_ecc_verify (uint32_t purpose, | |
| | | const struct GNUNET_CRYPTO_EccSignaturePurpose | |
| | | *validate, | |
| | | const struct GNUNET_CRYPTO_EccSignature *sig, | |
| | | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEnco | |
| | | ded | |
| | | *publicKey); | |
| | | | |
| | | /** | |
| * This function should only be called in testcases | | * This function should only be called in testcases | |
| * where strong entropy gathering is not desired | | * where strong entropy gathering is not desired | |
| * (for example, for hostkey generation). | | * (for example, for hostkey generation). | |
| */ | | */ | |
| void | | void | |
| GNUNET_CRYPTO_random_disable_entropy_gathering (void); | | GNUNET_CRYPTO_random_disable_entropy_gathering (void); | |
| | | | |
|
| | | /** | |
| | | * Check if we are using weak random number generation. | |
| | | * | |
| | | * @return GNUNET_YES if weak number generation is on | |
| | | * (thus will return YES if 'GNUNET_CRYPTO_random_disable_entropy_g | |
| | | athering' | |
| | | * was called previously). | |
| | | */ | |
| | | int | |
| | | GNUNET_CRYPTO_random_is_weak (void); | |
| | | | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| { | | { | |
| #endif | | #endif | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| /* ifndef GNUNET_CRYPTO_LIB_H */ | | /* ifndef GNUNET_CRYPTO_LIB_H */ | |
| #endif | | #endif | |
| /* end of gnunet_crypto_lib.h */ | | /* end of gnunet_crypto_lib.h */ | |
| | | | |
End of changes. 35 change blocks. |
| 53 lines changed or deleted | | 358 lines changed or added | |
|
| gnunet_dht_service.h | | gnunet_dht_service.h | |
| | | | |
| skipping to change at line 156 | | skipping to change at line 156 | |
| * @param data the data to store | | * @param data the data to store | |
| * @param exp desired expiration time for the value | | * @param exp desired expiration time for the value | |
| * @param timeout how long to wait for transmission of this request | | * @param timeout how long to wait for transmission of this request | |
| * @param cont continuation to call when done (transmitting request to serv
ice) | | * @param cont continuation to call when done (transmitting request to serv
ice) | |
| * You must not call "GNUNET_DHT_disconnect" in this continuation | | * You must not call "GNUNET_DHT_disconnect" in this continuation | |
| * @param cont_cls closure for cont | | * @param cont_cls closure for cont | |
| * @return handle to cancel the "PUT" operation, NULL on error | | * @return handle to cancel the "PUT" operation, NULL on error | |
| * (size too big) | | * (size too big) | |
| */ | | */ | |
| struct GNUNET_DHT_PutHandle * | | struct GNUNET_DHT_PutHandle * | |
|
| GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, const GNUNET_HashCode * k | | GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, | |
| ey, | | const struct GNUNET_HashCode * key, | |
| uint32_t desired_replication_level, | | uint32_t desired_replication_level, | |
| enum GNUNET_DHT_RouteOption options, | | enum GNUNET_DHT_RouteOption options, | |
|
| enum GNUNET_BLOCK_Type type, size_t size, const char *data, | | enum GNUNET_BLOCK_Type type, | |
| | | size_t size, const void *data, | |
| struct GNUNET_TIME_Absolute exp, | | struct GNUNET_TIME_Absolute exp, | |
| struct GNUNET_TIME_Relative timeout, | | struct GNUNET_TIME_Relative timeout, | |
| GNUNET_DHT_PutContinuation cont, | | GNUNET_DHT_PutContinuation cont, | |
| void *cont_cls); | | void *cont_cls); | |
| | | | |
| /** | | /** | |
| * Cancels a DHT PUT operation. Note that the PUT request may still | | * Cancels a DHT PUT operation. Note that the PUT request may still | |
| * go out over the network (we can't stop that); However, if the PUT | | * go out over the network (we can't stop that); However, if the PUT | |
| * has not yet been sent to the service, cancelling the PUT will stop | | * has not yet been sent to the service, cancelling the PUT will stop | |
| * this from happening (but there is no way for the user of this API | | * this from happening (but there is no way for the user of this API | |
| | | | |
| skipping to change at line 196 | | skipping to change at line 198 | |
| * @param get_path peers on reply path (or NULL if not recorded) | | * @param get_path peers on reply path (or NULL if not recorded) | |
| * @param get_path_length number of entries in get_path | | * @param get_path_length number of entries in get_path | |
| * @param put_path peers on the PUT path (or NULL if not recorded) | | * @param put_path peers on the PUT path (or NULL if not recorded) | |
| * @param put_path_length number of entries in get_path | | * @param put_path_length number of entries in get_path | |
| * @param type type of the result | | * @param type type of the result | |
| * @param size number of bytes in data | | * @param size number of bytes in data | |
| * @param data pointer to the result data | | * @param data pointer to the result data | |
| */ | | */ | |
| typedef void (*GNUNET_DHT_GetIterator) (void *cls, | | typedef void (*GNUNET_DHT_GetIterator) (void *cls, | |
| struct GNUNET_TIME_Absolute exp, | | struct GNUNET_TIME_Absolute exp, | |
|
| const GNUNET_HashCode * key, | | const struct GNUNET_HashCode * key, | |
| const struct GNUNET_PeerIdentity * | | const struct GNUNET_PeerIdentity * | |
| get_path, unsigned int get_path_len
gth, | | get_path, unsigned int get_path_len
gth, | |
| const struct GNUNET_PeerIdentity * | | const struct GNUNET_PeerIdentity * | |
| put_path, unsigned int put_path_len
gth, | | put_path, unsigned int put_path_len
gth, | |
| enum GNUNET_BLOCK_Type type, | | enum GNUNET_BLOCK_Type type, | |
| size_t size, const void *data); | | size_t size, const void *data); | |
| | | | |
| /** | | /** | |
| * Perform an asynchronous GET operation on the DHT identified. See | | * Perform an asynchronous GET operation on the DHT identified. See | |
| * also "GNUNET_BLOCK_evaluate". | | * also "GNUNET_BLOCK_evaluate". | |
| | | | |
| skipping to change at line 223 | | skipping to change at line 225 | |
| * @param options routing options for this message | | * @param options routing options for this message | |
| * @param xquery extended query data (can be NULL, depending on type) | | * @param xquery extended query data (can be NULL, depending on type) | |
| * @param xquery_size number of bytes in xquery | | * @param xquery_size number of bytes in xquery | |
| * @param iter function to call on each result | | * @param iter function to call on each result | |
| * @param iter_cls closure for iter | | * @param iter_cls closure for iter | |
| * | | * | |
| * @return handle to stop the async get | | * @return handle to stop the async get | |
| */ | | */ | |
| struct GNUNET_DHT_GetHandle * | | struct GNUNET_DHT_GetHandle * | |
| GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, | | GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, | |
|
| enum GNUNET_BLOCK_Type type, const GNUNET_HashCode *
key, | | enum GNUNET_BLOCK_Type type, const struct GNUNET_Hash
Code * key, | |
| uint32_t desired_replication_level, | | uint32_t desired_replication_level, | |
| enum GNUNET_DHT_RouteOption options, const void *xque
ry, | | enum GNUNET_DHT_RouteOption options, const void *xque
ry, | |
| size_t xquery_size, GNUNET_DHT_GetIterator iter, | | size_t xquery_size, GNUNET_DHT_GetIterator iter, | |
| void *iter_cls); | | void *iter_cls); | |
| | | | |
| /** | | /** | |
| * Stop async DHT-get. Frees associated resources. | | * Stop async DHT-get. Frees associated resources. | |
| * | | * | |
| * @param get_handle GET operation to stop. | | * @param get_handle GET operation to stop. | |
| * | | * | |
| | | | |
| skipping to change at line 266 | | skipping to change at line 268 | |
| * @param desired_replication_level Desired replication level. | | * @param desired_replication_level Desired replication level. | |
| * @param key Key of the requested data. | | * @param key Key of the requested data. | |
| */ | | */ | |
| typedef void (*GNUNET_DHT_MonitorGetCB) (void *cls, | | typedef void (*GNUNET_DHT_MonitorGetCB) (void *cls, | |
| enum GNUNET_DHT_RouteOption option
s, | | enum GNUNET_DHT_RouteOption option
s, | |
| enum GNUNET_BLOCK_Type type, | | enum GNUNET_BLOCK_Type type, | |
| uint32_t hop_count, | | uint32_t hop_count, | |
| uint32_t desired_replication_level
, | | uint32_t desired_replication_level
, | |
| unsigned int path_length, | | unsigned int path_length, | |
| const struct GNUNET_PeerIdentity *
path, | | const struct GNUNET_PeerIdentity *
path, | |
|
| const GNUNET_HashCode * key); | | const struct GNUNET_HashCode * key
); | |
| | | | |
| /** | | /** | |
| * Callback called on each GET reply going through the DHT. | | * Callback called on each GET reply going through the DHT. | |
| * | | * | |
| * @param cls Closure. | | * @param cls Closure. | |
| * @param type The type of data in the result. | | * @param type The type of data in the result. | |
| * @param get_path Peers on GET path (or NULL if not recorded). | | * @param get_path Peers on GET path (or NULL if not recorded). | |
| * @param get_path_length number of entries in get_path. | | * @param get_path_length number of entries in get_path. | |
| * @param put_path peers on the PUT path (or NULL if not recorded). | | * @param put_path peers on the PUT path (or NULL if not recorded). | |
| * @param put_path_length number of entries in get_path. | | * @param put_path_length number of entries in get_path. | |
| | | | |
| skipping to change at line 291 | | skipping to change at line 293 | |
| */ | | */ | |
| typedef void (*GNUNET_DHT_MonitorGetRespCB) (void *cls, | | typedef void (*GNUNET_DHT_MonitorGetRespCB) (void *cls, | |
| enum GNUNET_BLOCK_Type type, | | enum GNUNET_BLOCK_Type type, | |
| const struct GNUNET_PeerIdenti
ty | | const struct GNUNET_PeerIdenti
ty | |
| *get_path, | | *get_path, | |
| unsigned int get_path_length, | | unsigned int get_path_length, | |
| const struct GNUNET_PeerIdenti
ty | | const struct GNUNET_PeerIdenti
ty | |
| * put_path, | | * put_path, | |
| unsigned int put_path_length, | | unsigned int put_path_length, | |
| struct GNUNET_TIME_Absolute ex
p, | | struct GNUNET_TIME_Absolute ex
p, | |
|
| const GNUNET_HashCode * key, | | const struct GNUNET_HashCode *
key, | |
| const void *data, | | const void *data, | |
| size_t size); | | size_t size); | |
| | | | |
| /** | | /** | |
| * Callback called on each PUT request going through the DHT. | | * Callback called on each PUT request going through the DHT. | |
| * | | * | |
| * @param cls Closure. | | * @param cls Closure. | |
| * @param options Options, for instance RecordRoute, DemultiplexEverywhere. | | * @param options Options, for instance RecordRoute, DemultiplexEverywhere. | |
| * @param type The type of data in the request. | | * @param type The type of data in the request. | |
| * @param hop_count Hop count so far. | | * @param hop_count Hop count so far. | |
| | | | |
| skipping to change at line 318 | | skipping to change at line 320 | |
| * @param size Number of bytes in data. | | * @param size Number of bytes in data. | |
| */ | | */ | |
| typedef void (*GNUNET_DHT_MonitorPutCB) (void *cls, | | typedef void (*GNUNET_DHT_MonitorPutCB) (void *cls, | |
| enum GNUNET_DHT_RouteOption option
s, | | enum GNUNET_DHT_RouteOption option
s, | |
| enum GNUNET_BLOCK_Type type, | | enum GNUNET_BLOCK_Type type, | |
| uint32_t hop_count, | | uint32_t hop_count, | |
| uint32_t desired_replication_level
, | | uint32_t desired_replication_level
, | |
| unsigned int path_length, | | unsigned int path_length, | |
| const struct GNUNET_PeerIdentity *
path, | | const struct GNUNET_PeerIdentity *
path, | |
| struct GNUNET_TIME_Absolute exp, | | struct GNUNET_TIME_Absolute exp, | |
|
| const GNUNET_HashCode * key, | | const struct GNUNET_HashCode * key
, | |
| const void *data, | | const void *data, | |
| size_t size); | | size_t size); | |
| | | | |
| /** | | /** | |
| * Start monitoring the local DHT service. | | * Start monitoring the local DHT service. | |
| * | | * | |
| * @param handle Handle to the DHT service. | | * @param handle Handle to the DHT service. | |
| * @param type Type of blocks that are of interest. | | * @param type Type of blocks that are of interest. | |
| * @param key Key of data of interest, NULL for all. | | * @param key Key of data of interest, NULL for all. | |
| * @param get_cb Callback to process monitored get messages. | | * @param get_cb Callback to process monitored get messages. | |
| * @param get_resp_cb Callback to process monitored get response messages. | | * @param get_resp_cb Callback to process monitored get response messages. | |
| * @param put_cb Callback to process monitored put messages. | | * @param put_cb Callback to process monitored put messages. | |
| * @param cb_cls Closure for cb. | | * @param cb_cls Closure for cb. | |
| * | | * | |
| * @return Handle to stop monitoring. | | * @return Handle to stop monitoring. | |
| */ | | */ | |
| struct GNUNET_DHT_MonitorHandle * | | struct GNUNET_DHT_MonitorHandle * | |
| GNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle, | | GNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle, | |
| enum GNUNET_BLOCK_Type type, | | enum GNUNET_BLOCK_Type type, | |
|
| const GNUNET_HashCode *key, | | const struct GNUNET_HashCode *key, | |
| GNUNET_DHT_MonitorGetCB get_cb, | | GNUNET_DHT_MonitorGetCB get_cb, | |
| GNUNET_DHT_MonitorGetRespCB get_resp_cb, | | GNUNET_DHT_MonitorGetRespCB get_resp_cb, | |
| GNUNET_DHT_MonitorPutCB put_cb, | | GNUNET_DHT_MonitorPutCB put_cb, | |
| void *cb_cls); | | void *cb_cls); | |
| | | | |
| /** | | /** | |
| * Stop monitoring. | | * Stop monitoring. | |
| * | | * | |
| * @param handle The handle to the monitor request returned by monitor_star
t. | | * @param handle The handle to the monitor request returned by monitor_star
t. | |
| * | | * | |
| | | | |
End of changes. 8 change blocks. |
| 9 lines changed or deleted | | 10 lines changed or added | |
|
| gnunet_dnsparser_lib.h | | gnunet_dnsparser_lib.h | |
| | | | |
| skipping to change at line 34 | | skipping to change at line 34 | |
| * @author Philipp Toelke | | * @author Philipp Toelke | |
| * @author Christian Grothoff | | * @author Christian Grothoff | |
| */ | | */ | |
| #ifndef GNUNET_DNSPARSER_LIB_H | | #ifndef GNUNET_DNSPARSER_LIB_H | |
| #define GNUNET_DNSPARSER_LIB_H | | #define GNUNET_DNSPARSER_LIB_H | |
| | | | |
| #include "platform.h" | | #include "platform.h" | |
| #include "gnunet_common.h" | | #include "gnunet_common.h" | |
| | | | |
| /** | | /** | |
|
| | | * Maximum length of a label in DNS. | |
| | | */ | |
| | | #define GNUNET_DNSPARSER_MAX_LABEL_LENGTH 63 | |
| | | | |
| | | /** | |
| | | * Maximum length of a name in DNS. | |
| | | */ | |
| | | #define GNUNET_DNSPARSER_MAX_NAME_LENGTH 253 | |
| | | | |
| | | /** | |
| * A few common DNS types. | | * A few common DNS types. | |
| */ | | */ | |
| #define GNUNET_DNSPARSER_TYPE_A 1 | | #define GNUNET_DNSPARSER_TYPE_A 1 | |
| #define GNUNET_DNSPARSER_TYPE_NS 2 | | #define GNUNET_DNSPARSER_TYPE_NS 2 | |
| #define GNUNET_DNSPARSER_TYPE_CNAME 5 | | #define GNUNET_DNSPARSER_TYPE_CNAME 5 | |
| #define GNUNET_DNSPARSER_TYPE_SOA 6 | | #define GNUNET_DNSPARSER_TYPE_SOA 6 | |
| #define GNUNET_DNSPARSER_TYPE_PTR 12 | | #define GNUNET_DNSPARSER_TYPE_PTR 12 | |
| #define GNUNET_DNSPARSER_TYPE_MX 15 | | #define GNUNET_DNSPARSER_TYPE_MX 15 | |
| #define GNUNET_DNSPARSER_TYPE_TXT 16 | | #define GNUNET_DNSPARSER_TYPE_TXT 16 | |
| #define GNUNET_DNSPARSER_TYPE_AAAA 28 | | #define GNUNET_DNSPARSER_TYPE_AAAA 28 | |
|
| | | #define GNUNET_DNSPARSER_TYPE_SRV 33 | |
| | | #define GNUNET_DNSPARSER_TYPE_TLSA 52 | |
| | | | |
| /** | | /** | |
| * A few common DNS classes (ok, only one is common, but I list a | | * A few common DNS classes (ok, only one is common, but I list a | |
| * couple more to make it clear what we're talking about here). | | * couple more to make it clear what we're talking about here). | |
| */ | | */ | |
| #define GNUNET_DNSPARSER_CLASS_INTERNET 1 | | #define GNUNET_DNSPARSER_CLASS_INTERNET 1 | |
| #define GNUNET_DNSPARSER_CLASS_CHAOS 3 | | #define GNUNET_DNSPARSER_CLASS_CHAOS 3 | |
| #define GNUNET_DNSPARSER_CLASS_HESIOD 4 | | #define GNUNET_DNSPARSER_CLASS_HESIOD 4 | |
| | | | |
| #define GNUNET_DNSPARSER_OPCODE_QUERY 0 | | #define GNUNET_DNSPARSER_OPCODE_QUERY 0 | |
| | | | |
| skipping to change at line 81 | | skipping to change at line 93 | |
| #define GNUNET_DNSPARSER_RETURN_CODE_YXRRSET 7 | | #define GNUNET_DNSPARSER_RETURN_CODE_YXRRSET 7 | |
| #define GNUNET_DNSPARSER_RETURN_CODE_NXRRSET 8 | | #define GNUNET_DNSPARSER_RETURN_CODE_NXRRSET 8 | |
| #define GNUNET_DNSPARSER_RETURN_CODE_NOT_AUTH 9 | | #define GNUNET_DNSPARSER_RETURN_CODE_NOT_AUTH 9 | |
| #define GNUNET_DNSPARSER_RETURN_CODE_NOT_ZONE 10 | | #define GNUNET_DNSPARSER_RETURN_CODE_NOT_ZONE 10 | |
| | | | |
| /** | | /** | |
| * DNS flags (largely RFC 1035 / RFC 2136). | | * DNS flags (largely RFC 1035 / RFC 2136). | |
| */ | | */ | |
| struct GNUNET_DNSPARSER_Flags | | struct GNUNET_DNSPARSER_Flags | |
| { | | { | |
|
| | | #if __BYTE_ORDER == __LITTLE_ENDIAN | |
| /** | | /** | |
| * Set to 1 if recursion is desired (client -> server) | | * Set to 1 if recursion is desired (client -> server) | |
| */ | | */ | |
| unsigned int recursion_desired : 1 GNUNET_PACKED; | | unsigned int recursion_desired : 1 GNUNET_PACKED; | |
| | | | |
| /** | | /** | |
| * Set to 1 if message is truncated | | * Set to 1 if message is truncated | |
| */ | | */ | |
| unsigned int message_truncated : 1 GNUNET_PACKED; | | unsigned int message_truncated : 1 GNUNET_PACKED; | |
| | | | |
| | | | |
| skipping to change at line 130 | | skipping to change at line 143 | |
| | | | |
| /** | | /** | |
| * Always zero. | | * Always zero. | |
| */ | | */ | |
| unsigned int zero : 1 GNUNET_PACKED; | | unsigned int zero : 1 GNUNET_PACKED; | |
| | | | |
| /** | | /** | |
| * Set to 1 if recursion is available (server -> client) | | * Set to 1 if recursion is available (server -> client) | |
| */ | | */ | |
| unsigned int recursion_available : 1 GNUNET_PACKED; | | unsigned int recursion_available : 1 GNUNET_PACKED; | |
|
| | | #elif __BYTE_ORDER == __BIG_ENDIAN | |
| | | | |
| | | /** | |
| | | * query:0, response:1 | |
| | | */ | |
| | | unsigned int query_or_response : 1 GNUNET_PACKED; | |
| | | | |
| | | /** | |
| | | * See GNUNET_DNSPARSER_OPCODE_ defines. | |
| | | */ | |
| | | unsigned int opcode : 4 GNUNET_PACKED; | |
| | | | |
| | | /** | |
| | | * Set to 1 if this is an authoritative answer | |
| | | */ | |
| | | unsigned int authoritative_answer : 1 GNUNET_PACKED; | |
| | | | |
| | | /** | |
| | | * Set to 1 if message is truncated | |
| | | */ | |
| | | unsigned int message_truncated : 1 GNUNET_PACKED; | |
| | | | |
| | | /** | |
| | | * Set to 1 if recursion is desired (client -> server) | |
| | | */ | |
| | | unsigned int recursion_desired : 1 GNUNET_PACKED; | |
| | | | |
| | | /** | |
| | | * Set to 1 if recursion is available (server -> client) | |
| | | */ | |
| | | unsigned int recursion_available : 1 GNUNET_PACKED; | |
| | | | |
| | | /** | |
| | | * Always zero. | |
| | | */ | |
| | | unsigned int zero : 1 GNUNET_PACKED; | |
| | | | |
| | | /** | |
| | | * Response has been cryptographically verified, RFC 4035. | |
| | | */ | |
| | | unsigned int authenticated_data : 1 GNUNET_PACKED; | |
| | | | |
| | | /** | |
| | | * See RFC 4035. | |
| | | */ | |
| | | unsigned int checking_disabled : 1 GNUNET_PACKED; | |
| | | | |
| | | /** | |
| | | * See GNUNET_DNSPARSER_RETURN_CODE_ defines. | |
| | | */ | |
| | | unsigned int return_code : 4 GNUNET_PACKED; | |
| | | #else | |
| | | #error byteorder undefined | |
| | | #endif | |
| | | | |
| } GNUNET_GCC_STRUCT_LAYOUT; | | } GNUNET_GCC_STRUCT_LAYOUT; | |
| | | | |
| /** | | /** | |
| * A DNS query. | | * A DNS query. | |
| */ | | */ | |
| struct GNUNET_DNSPARSER_Query | | struct GNUNET_DNSPARSER_Query | |
| { | | { | |
| | | | |
| /** | | /** | |
| * Name of the record that the query is for (0-terminated). | | * Name of the record that the query is for (0-terminated). | |
|
| | | * In UTF-8 format. The library will convert from and to DNS-IDNA | |
| | | * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an | |
| | | * individual label is well-formed. If a given name is not well-formed, | |
| | | * creating the DNS packet will fail. | |
| */ | | */ | |
| char *name; | | char *name; | |
| | | | |
| /** | | /** | |
| * See GNUNET_DNSPARSER_TYPE_*. | | * See GNUNET_DNSPARSER_TYPE_*. | |
| */ | | */ | |
| uint16_t type; | | uint16_t type; | |
| | | | |
| /** | | /** | |
| * See GNUNET_DNSPARSER_CLASS_*. | | * See GNUNET_DNSPARSER_CLASS_*. | |
| | | | |
| skipping to change at line 169 | | skipping to change at line 240 | |
| struct GNUNET_DNSPARSER_MxRecord | | struct GNUNET_DNSPARSER_MxRecord | |
| { | | { | |
| | | | |
| /** | | /** | |
| * Preference for this entry (lower value is higher preference). | | * Preference for this entry (lower value is higher preference). | |
| */ | | */ | |
| uint16_t preference; | | uint16_t preference; | |
| | | | |
| /** | | /** | |
| * Name of the mail server. | | * Name of the mail server. | |
|
| | | * In UTF-8 format. The library will convert from and to DNS-IDNA | |
| | | * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an | |
| | | * individual label is well-formed. If a given name is not well-formed, | |
| | | * creating the DNS packet will fail. | |
| */ | | */ | |
| char *mxhost; | | char *mxhost; | |
| | | | |
| }; | | }; | |
| | | | |
| /** | | /** | |
|
| | | * Information from SRV records (RFC 2782). The 'service', 'proto' | |
| | | * and 'domain_name' fields together give the DNS-name which for SRV | |
| | | * records is of the form "_$SERVICE._$PROTO.$DOMAIN_NAME". The DNS | |
| | | * parser provides the full name in 'struct DNSPARSER_Record' and the | |
| | | * individual components in the respective fields of this struct. | |
| | | * When serializing, you CAN set the 'name' field of 'struct | |
| | | * GNUNET_DNSPARSER_Record' to NULL, in which case the DNSPARSER code | |
| | | * will populate 'name' from the 'service', 'proto' and 'domain_name' | |
| | | * fields in this struct. | |
| | | */ | |
| | | struct GNUNET_DNSPARSER_SrvRecord | |
| | | { | |
| | | | |
| | | /** | |
| | | * Service name without the underscore (!). Note that RFC 6335 clarifies | |
| | | the | |
| | | * set of legal characters for service names. | |
| | | * In UTF-8 format. The library will convert from and to DNS-IDNA | |
| | | * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an | |
| | | * individual label is well-formed. If a given name is not well-formed, | |
| | | * creating the DNS packet will fail. | |
| | | */ | |
| | | char *service; | |
| | | | |
| | | /** | |
| | | * Transport protocol (typcially "tcp" or "udp", but others might be allo | |
| | | wed). | |
| | | * Without the underscore (!). | |
| | | */ | |
| | | char *proto; | |
| | | | |
| | | /** | |
| | | * Domain name for which the record is valid | |
| | | * In UTF-8 format. The library will convert from and to DNS-IDNA | |
| | | * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an | |
| | | * individual label is well-formed. If a given name is not well-formed, | |
| | | * creating the DNS packet will fail. | |
| | | */ | |
| | | char *domain_name; | |
| | | | |
| | | /** | |
| | | * Hostname offering the service. | |
| | | * In UTF-8 format. The library will convert from and to DNS-IDNA | |
| | | * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an | |
| | | * individual label is well-formed. If a given name is not well-formed, | |
| | | * creating the DNS packet will fail. | |
| | | */ | |
| | | char *target; | |
| | | | |
| | | /** | |
| | | * Preference for this entry (lower value is higher preference). Clients | |
| | | * will contact hosts from the lowest-priority group first and fall back | |
| | | * to higher priorities if the low-priority entries are unavailable. | |
| | | */ | |
| | | uint16_t priority; | |
| | | | |
| | | /** | |
| | | * Relative weight for records with the same priority. Clients will use | |
| | | * the hosts of the same (lowest) priority with a probability proportiona | |
| | | l | |
| | | * to the weight given. | |
| | | */ | |
| | | uint16_t weight; | |
| | | | |
| | | /** | |
| | | * TCP or UDP port of the service. | |
| | | */ | |
| | | uint16_t port; | |
| | | | |
| | | }; | |
| | | | |
| | | /** | |
| * Information from SOA records (RFC 1035). | | * Information from SOA records (RFC 1035). | |
| */ | | */ | |
| struct GNUNET_DNSPARSER_SoaRecord | | struct GNUNET_DNSPARSER_SoaRecord | |
| { | | { | |
| | | | |
| /** | | /** | |
| *The domainname of the name server that was the | | *The domainname of the name server that was the | |
| * original or primary source of data for this zone. | | * original or primary source of data for this zone. | |
|
| | | * In UTF-8 format. The library will convert from and to DNS-IDNA | |
| | | * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an | |
| | | * individual label is well-formed. If a given name is not well-formed, | |
| | | * creating the DNS packet will fail. | |
| */ | | */ | |
| char *mname; | | char *mname; | |
| | | | |
| /** | | /** | |
| * A domainname which specifies the mailbox of the | | * A domainname which specifies the mailbox of the | |
| * person responsible for this zone. | | * person responsible for this zone. | |
|
| | | * In UTF-8 format. The library will convert from and to DNS-IDNA | |
| | | * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an | |
| | | * individual label is well-formed. If a given name is not well-formed, | |
| | | * creating the DNS packet will fail. | |
| */ | | */ | |
| char *rname; | | char *rname; | |
| | | | |
| /** | | /** | |
| * The version number of the original copy of the zone. | | * The version number of the original copy of the zone. | |
| */ | | */ | |
| uint32_t serial; | | uint32_t serial; | |
| | | | |
| /** | | /** | |
| * Time interval before the zone should be refreshed. | | * Time interval before the zone should be refreshed. | |
| | | | |
| skipping to change at line 247 | | skipping to change at line 399 | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * A DNS response record. | | * A DNS response record. | |
| */ | | */ | |
| struct GNUNET_DNSPARSER_Record | | struct GNUNET_DNSPARSER_Record | |
| { | | { | |
| | | | |
| /** | | /** | |
| * Name of the record that the query is for (0-terminated). | | * Name of the record that the query is for (0-terminated). | |
|
| | | * In UTF-8 format. The library will convert from and to DNS-IDNA | |
| | | * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an | |
| | | * individual label is well-formed. If a given name is not well-formed, | |
| | | * creating the DNS packet will fail. | |
| */ | | */ | |
| char *name; | | char *name; | |
| | | | |
|
| | | /** | |
| | | * Payload of the record (which one of these is valid depends on the 'typ | |
| | | e'). | |
| | | */ | |
| union | | union | |
| { | | { | |
| | | | |
| /** | | /** | |
| * For NS, CNAME and PTR records, this is the uncompressed 0-terminated
hostname. | | * For NS, CNAME and PTR records, this is the uncompressed 0-terminated
hostname. | |
|
| | | * In UTF-8 format. The library will convert from and to DNS-IDNA | |
| | | * as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an | |
| | | * individual label is well-formed. If a given name is not well-formed, | |
| | | * creating the DNS packet will fail. | |
| */ | | */ | |
| char *hostname; | | char *hostname; | |
| | | | |
| /** | | /** | |
| * SOA data for SOA records. | | * SOA data for SOA records. | |
| */ | | */ | |
| struct GNUNET_DNSPARSER_SoaRecord *soa; | | struct GNUNET_DNSPARSER_SoaRecord *soa; | |
| | | | |
| /** | | /** | |
| * MX data for MX records. | | * MX data for MX records. | |
| */ | | */ | |
| struct GNUNET_DNSPARSER_MxRecord *mx; | | struct GNUNET_DNSPARSER_MxRecord *mx; | |
| | | | |
| /** | | /** | |
|
| | | * SRV data for SRV records. | |
| | | */ | |
| | | struct GNUNET_DNSPARSER_SrvRecord *srv; | |
| | | | |
| | | /** | |
| * Raw data for all other types. | | * Raw data for all other types. | |
| */ | | */ | |
| struct GNUNET_DNSPARSER_RawRecord raw; | | struct GNUNET_DNSPARSER_RawRecord raw; | |
| | | | |
| } data; | | } data; | |
| | | | |
| /** | | /** | |
| * When does the record expire? | | * When does the record expire? | |
| */ | | */ | |
| struct GNUNET_TIME_Absolute expiration_time; | | struct GNUNET_TIME_Absolute expiration_time; | |
| | | | |
| skipping to change at line 350 | | skipping to change at line 518 | |
| struct GNUNET_DNSPARSER_Flags flags; | | struct GNUNET_DNSPARSER_Flags flags; | |
| | | | |
| /** | | /** | |
| * DNS ID (to match replies to requests). | | * DNS ID (to match replies to requests). | |
| */ | | */ | |
| uint16_t id; | | uint16_t id; | |
| | | | |
| }; | | }; | |
| | | | |
| /** | | /** | |
|
| | | * Check if a label in UTF-8 format can be coded into valid IDNA. | |
| | | * This can fail if the ASCII-conversion becomes longer than 63 characters. | |
| | | * | |
| | | * @param label label to check (UTF-8 string) | |
| | | * @return GNUNET_OK if the label can be converted to IDNA, | |
| | | * GNUNET_SYSERR if the label is not valid for DNS names | |
| | | */ | |
| | | int | |
| | | GNUNET_DNSPARSER_check_label (const char *label); | |
| | | | |
| | | /** | |
| * Parse a UDP payload of a DNS packet in to a nice struct for further | | * Parse a UDP payload of a DNS packet in to a nice struct for further | |
| * processing and manipulation. | | * processing and manipulation. | |
| * | | * | |
| * @param udp_payload wire-format of the DNS packet | | * @param udp_payload wire-format of the DNS packet | |
| * @param udp_payload_length number of bytes in udp_payload | | * @param udp_payload_length number of bytes in udp_payload | |
| * @return NULL on error, otherwise the parsed packet | | * @return NULL on error, otherwise the parsed packet | |
| */ | | */ | |
| struct GNUNET_DNSPARSER_Packet * | | struct GNUNET_DNSPARSER_Packet * | |
| GNUNET_DNSPARSER_parse (const char *udp_payload, | | GNUNET_DNSPARSER_parse (const char *udp_payload, | |
| size_t udp_payload_length); | | size_t udp_payload_length); | |
| | | | |
End of changes. 14 change blocks. |
| 0 lines changed or deleted | | 183 lines changed or added | |
|
| gnunet_fs_service.h | | gnunet_fs_service.h | |
| | | | |
| skipping to change at line 58 | | skipping to change at line 58 | |
| * 3.1.x: with namespace meta-data | | * 3.1.x: with namespace meta-data | |
| * 3.2.x: with collections | | * 3.2.x: with collections | |
| * 4.0.x: with expiration, variable meta-data, kblocks | | * 4.0.x: with expiration, variable meta-data, kblocks | |
| * 4.1.x: with new error and configuration handling | | * 4.1.x: with new error and configuration handling | |
| * 5.0.x: with location URIs | | * 5.0.x: with location URIs | |
| * 6.0.0: with support for OR in KSKs | | * 6.0.0: with support for OR in KSKs | |
| * 6.1.x: with simplified namespace support | | * 6.1.x: with simplified namespace support | |
| * 9.0.0: CPS-style integrated API | | * 9.0.0: CPS-style integrated API | |
| * 9.1.1: asynchronous directory scanning | | * 9.1.1: asynchronous directory scanning | |
| */ | | */ | |
|
| #define GNUNET_FS_VERSION 0x00090102 | | #define GNUNET_FS_VERSION 0x00090103 | |
| | | | |
| /* ******************** URI API *********************** */ | | /* ******************** URI API *********************** */ | |
| | | | |
| #define GNUNET_FS_URI_PREFIX "gnunet://fs/" | | #define GNUNET_FS_URI_PREFIX "gnunet://fs/" | |
| #define GNUNET_FS_URI_KSK_INFIX "ksk/" | | #define GNUNET_FS_URI_KSK_INFIX "ksk/" | |
| #define GNUNET_FS_URI_SKS_INFIX "sks/" | | #define GNUNET_FS_URI_SKS_INFIX "sks/" | |
| #define GNUNET_FS_URI_CHK_INFIX "chk/" | | #define GNUNET_FS_URI_CHK_INFIX "chk/" | |
| #define GNUNET_FS_URI_LOC_INFIX "loc/" | | #define GNUNET_FS_URI_LOC_INFIX "loc/" | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 92 | | skipping to change at line 92 | |
| int is_mandatory); | | int is_mandatory); | |
| | | | |
| /** | | /** | |
| * Get a unique key from a URI. This is for putting URIs | | * Get a unique key from a URI. This is for putting URIs | |
| * into HashMaps. The key may change between FS implementations. | | * into HashMaps. The key may change between FS implementations. | |
| * | | * | |
| * @param uri uri to convert to a unique key | | * @param uri uri to convert to a unique key | |
| * @param key wherer to store the unique key | | * @param key wherer to store the unique key | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, GNUNET_HashCode * ke
y); | | GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, struct GNUNET_HashCo
de * key); | |
| | | | |
| /** | | /** | |
| * Convert a URI to a UTF-8 String. | | * Convert a URI to a UTF-8 String. | |
| * | | * | |
| * @param uri uri to convert to a string | | * @param uri uri to convert to a string | |
| * @return the UTF-8 string | | * @return the UTF-8 string | |
| */ | | */ | |
| char * | | char * | |
| GNUNET_FS_uri_to_string (const struct GNUNET_FS_Uri *uri); | | GNUNET_FS_uri_to_string (const struct GNUNET_FS_Uri *uri); | |
| | | | |
| | | | |
| skipping to change at line 324 | | skipping to change at line 324 | |
| char **emsg); | | char **emsg); | |
| | | | |
| /** | | /** | |
| * Create an SKS URI from a namespace ID and an identifier. | | * Create an SKS URI from a namespace ID and an identifier. | |
| * | | * | |
| * @param nsid namespace ID | | * @param nsid namespace ID | |
| * @param id identifier | | * @param id identifier | |
| * @return an FS URI for the given namespace and identifier | | * @return an FS URI for the given namespace and identifier | |
| */ | | */ | |
| struct GNUNET_FS_Uri * | | struct GNUNET_FS_Uri * | |
|
| GNUNET_FS_uri_sks_create_from_nsid (GNUNET_HashCode * nsid, const char *id)
; | | GNUNET_FS_uri_sks_create_from_nsid (struct GNUNET_HashCode * nsid, const ch
ar *id); | |
| | | | |
| /** | | /** | |
| * Get the ID of a namespace from the given | | * Get the ID of a namespace from the given | |
| * namespace URI. | | * namespace URI. | |
| * | | * | |
| * @param uri the uri to get the namespace ID from | | * @param uri the uri to get the namespace ID from | |
| * @param nsid where to store the ID of the namespace | | * @param nsid where to store the ID of the namespace | |
| * @return GNUNET_OK on success | | * @return GNUNET_OK on success | |
| */ | | */ | |
| int | | int | |
| GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri, | | GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri, | |
|
| GNUNET_HashCode * nsid); | | struct GNUNET_HashCode * nsid); | |
| | | | |
| /** | | /** | |
| * Get the content identifier of an SKS URI. | | * Get the content identifier of an SKS URI. | |
| * | | * | |
| * @param uri the sks uri | | * @param uri the sks uri | |
| * @return NULL on error (not a valid SKS URI) | | * @return NULL on error (not a valid SKS URI) | |
| */ | | */ | |
| char * | | char * | |
| GNUNET_FS_uri_sks_get_content_id (const struct GNUNET_FS_Uri *uri); | | GNUNET_FS_uri_sks_get_content_id (const struct GNUNET_FS_Uri *uri); | |
| | | | |
| | | | |
| skipping to change at line 980 | | skipping to change at line 980 | |
| * At what offset in the file is "data"? | | * At what offset in the file is "data"? | |
| */ | | */ | |
| uint64_t offset; | | uint64_t offset; | |
| | | | |
| /** | | /** | |
| * Length of the data block. | | * Length of the data block. | |
| */ | | */ | |
| uint64_t data_len; | | uint64_t data_len; | |
| | | | |
| /** | | /** | |
|
| | | * How much time passed between us asking for this block and | |
| | | * actually getting it? GNUNET_TIME_UNIT_FOREVER_REL if unknown. | |
| | | */ | |
| | | struct GNUNET_TIME_Relative block_download_duration; | |
| | | | |
| | | /** | |
| * Depth of the given block in the tree; | | * Depth of the given block in the tree; | |
| * 0 would be the lowest level (DBLOCKS). | | * 0 would be the lowest level (DBLOCKS). | |
| */ | | */ | |
| unsigned int depth; | | unsigned int depth; | |
| | | | |
| /** | | /** | |
|
| * How much trust did we offer for downloading this block? | | * How much respect did we offer for downloading this block? (esti | |
| | | mate, | |
| | | * because we might have the same request pending for multiple cli | |
| | | ents, | |
| | | * and of course because a transmission may have failed at a lower | |
| | | * layer). | |
| */ | | */ | |
|
| unsigned int trust_offered; | | uint32_t respect_offered; | |
| | | | |
| /** | | /** | |
|
| * How much time passed between us asking for this block and | | * How often did we transmit the request? (estimate, | |
| * actually getting it? GNUNET_TIME_UNIT_FOREVER_REL if unknown. | | * because we might have the same request pending for multiple cli | |
| | | ents, | |
| | | * and of course because a transmission may have failed at a lower | |
| | | * layer). | |
| */ | | */ | |
|
| struct GNUNET_TIME_Relative block_download_duration; | | uint32_t num_transmissions; | |
| | | | |
| } progress; | | } progress; | |
| | | | |
| /** | | /** | |
| * These values are only valid for | | * These values are only valid for | |
| * GNUNET_FS_STATUS_DOWNLOAD_START events. | | * GNUNET_FS_STATUS_DOWNLOAD_START events. | |
| */ | | */ | |
| struct | | struct | |
| { | | { | |
| | | | |
| | | | |
| skipping to change at line 1345 | | skipping to change at line 1356 | |
| const char *root; | | const char *root; | |
| | | | |
| /** | | /** | |
| * Metadata for the namespace. | | * Metadata for the namespace. | |
| */ | | */ | |
| const struct GNUNET_CONTAINER_MetaData *meta; | | const struct GNUNET_CONTAINER_MetaData *meta; | |
| | | | |
| /** | | /** | |
| * Hash-identifier for the namespace. | | * Hash-identifier for the namespace. | |
| */ | | */ | |
|
| GNUNET_HashCode id; | | struct GNUNET_HashCode id; | |
| | | | |
|
| } namespace; | | } ns; | |
| | | | |
| } specifics; | | } specifics; | |
| | | | |
| } search; | | } search; | |
| | | | |
| /** | | /** | |
| * Values for all "GNUNET_FS_STATUS_UNINDEX_*" events. | | * Values for all "GNUNET_FS_STATUS_UNINDEX_*" events. | |
| */ | | */ | |
| struct | | struct | |
| { | | { | |
| | | | |
| skipping to change at line 1492 | | skipping to change at line 1503 | |
| * @param cls closure | | * @param cls closure | |
| * @param info details about the event, specifying the event type | | * @param info details about the event, specifying the event type | |
| * and various bits about the event | | * and various bits about the event | |
| * @return client-context (for the next progress call | | * @return client-context (for the next progress call | |
| * for this operation; should be set to NULL for | | * for this operation; should be set to NULL for | |
| * SUSPEND and STOPPED events). The value returned | | * SUSPEND and STOPPED events). The value returned | |
| * will be passed to future callbacks in the respective | | * will be passed to future callbacks in the respective | |
| * field in the GNUNET_FS_ProgressInfo struct. | | * field in the GNUNET_FS_ProgressInfo struct. | |
| */ | | */ | |
| typedef void *(*GNUNET_FS_ProgressCallback) (void *cls, | | typedef void *(*GNUNET_FS_ProgressCallback) (void *cls, | |
|
| const struct GNUNET_FS_Progres | | const struct GNUNET_FS_Progres | |
| sInfo | | sInfo *info); | |
| * info); | | | |
| | | | |
| /** | | /** | |
| * General (global) option flags for file-sharing. | | * General (global) option flags for file-sharing. | |
| */ | | */ | |
| enum GNUNET_FS_Flags | | enum GNUNET_FS_Flags | |
| { | | { | |
| /** | | /** | |
| * No special flags set. | | * No special flags set. | |
| */ | | */ | |
| GNUNET_FS_FLAGS_NONE = 0, | | GNUNET_FS_FLAGS_NONE = 0, | |
| | | | |
| skipping to change at line 1525 | | skipping to change at line 1535 | |
| */ | | */ | |
| GNUNET_FS_FLAGS_DO_PROBES = 2 | | GNUNET_FS_FLAGS_DO_PROBES = 2 | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Options specified in the VARARGs portion of GNUNET_FS_start. | | * Options specified in the VARARGs portion of GNUNET_FS_start. | |
| */ | | */ | |
| enum GNUNET_FS_OPTIONS | | enum GNUNET_FS_OPTIONS | |
| { | | { | |
| | | | |
|
| /** | | /** | |
| * Last option in the VARARG list. | | * Last option in the VARARG list. | |
| */ | | */ | |
| GNUNET_FS_OPTIONS_END = 0, | | GNUNET_FS_OPTIONS_END = 0, | |
| | | | |
|
| /** | | /** | |
| * Select the desired amount of parallelism (this option should be | | * Select the desired amount of parallelism (this option should be | |
| * followed by an "unsigned int" giving the desired maximum number | | * followed by an "unsigned int" giving the desired maximum number | |
| * of parallel downloads). | | * of parallel downloads). | |
| */ | | */ | |
| GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM = 1, | | GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM = 1, | |
| | | | |
|
| /** | | /** | |
| * Maximum number of requests that should be pending at a given | | * Maximum number of requests that should be pending at a given | |
| * point in time (invidivual downloads may go above this, but | | * point in time (invidivual downloads may go above this, but | |
| * if we are above this threshold, we should not activate any | | * if we are above this threshold, we should not activate any | |
| * additional downloads. | | * additional downloads. | |
| */ | | */ | |
| GNUNET_FS_OPTIONS_REQUEST_PARALLELISM = 2 | | GNUNET_FS_OPTIONS_REQUEST_PARALLELISM = 2 | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Settings for publishing a block (which may of course also | | * Settings for publishing a block (which may of course also | |
| * apply to an entire directory or file). | | * apply to an entire directory or file). | |
| */ | | */ | |
| struct GNUNET_FS_BlockOptions | | struct GNUNET_FS_BlockOptions | |
| { | | { | |
| | | | |
| | | | |
| skipping to change at line 1922 | | skipping to change at line 1932 | |
| * in the datastore. Useful for computing URIs from files. | | * in the datastore. Useful for computing URIs from files. | |
| */ | | */ | |
| GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY = 1 | | GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY = 1 | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Publish a file or directory. | | * Publish a file or directory. | |
| * | | * | |
| * @param h handle to the file sharing subsystem | | * @param h handle to the file sharing subsystem | |
| * @param fi information about the file or directory structure to publish | | * @param fi information about the file or directory structure to publish | |
|
| * @param namespace namespace to publish the file in, NULL for no namespace | | * @param ns namespace to publish the file in, NULL for no namespace | |
| * @param nid identifier to use for the publishd content in the namespace | | * @param nid identifier to use for the publishd content in the namespace | |
| * (can be NULL, must be NULL if namespace is NULL) | | * (can be NULL, must be NULL if namespace is NULL) | |
| * @param nuid update-identifier that will be used for future updates | | * @param nuid update-identifier that will be used for future updates | |
| * (can be NULL, must be NULL if namespace or nid is NULL) | | * (can be NULL, must be NULL if namespace or nid is NULL) | |
| * @param options options for the publication | | * @param options options for the publication | |
| * @return context that can be used to control the publish operation | | * @return context that can be used to control the publish operation | |
| */ | | */ | |
| struct GNUNET_FS_PublishContext * | | struct GNUNET_FS_PublishContext * | |
| GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, | | GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, | |
| struct GNUNET_FS_FileInformation *fi, | | struct GNUNET_FS_FileInformation *fi, | |
|
| struct GNUNET_FS_Namespace *namespace, const char
*nid, | | struct GNUNET_FS_Namespace *ns, const char *nid, | |
| const char *nuid, | | const char *nuid, | |
| enum GNUNET_FS_PublishOptions options); | | enum GNUNET_FS_PublishOptions options); | |
| | | | |
| /** | | /** | |
| * Stop a publication. Will abort incomplete publications (but | | * Stop a publication. Will abort incomplete publications (but | |
| * not remove blocks that have already been published) or | | * not remove blocks that have already been published) or | |
| * simply clean up the state for completed publications. | | * simply clean up the state for completed publications. | |
| * Must NOT be called from within the event callback! | | * Must NOT be called from within the event callback! | |
| * | | * | |
| * @param pc context for the publication to stop | | * @param pc context for the publication to stop | |
| | | | |
| skipping to change at line 2004 | | skipping to change at line 2014 | |
| | | | |
| /** | | /** | |
| * Handle to cancel publish SKS operation. | | * Handle to cancel publish SKS operation. | |
| */ | | */ | |
| struct GNUNET_FS_PublishSksContext; | | struct GNUNET_FS_PublishSksContext; | |
| | | | |
| /** | | /** | |
| * Publish an SBlock on GNUnet. | | * Publish an SBlock on GNUnet. | |
| * | | * | |
| * @param h handle to the file sharing subsystem | | * @param h handle to the file sharing subsystem | |
|
| * @param namespace namespace to publish in | | * @param ns namespace to publish in | |
| * @param identifier identifier to use | | * @param identifier identifier to use | |
| * @param update update identifier to use | | * @param update update identifier to use | |
| * @param meta metadata to use | | * @param meta metadata to use | |
| * @param uri URI to refer to in the SBlock | | * @param uri URI to refer to in the SBlock | |
| * @param bo block options | | * @param bo block options | |
| * @param options publication options | | * @param options publication options | |
| * @param cont continuation | | * @param cont continuation | |
| * @param cont_cls closure for cont | | * @param cont_cls closure for cont | |
| * @return NULL on error ('cont' will still be called) | | * @return NULL on error ('cont' will still be called) | |
| */ | | */ | |
| struct GNUNET_FS_PublishSksContext * | | struct GNUNET_FS_PublishSksContext * | |
| GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | | GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | |
|
| struct GNUNET_FS_Namespace *namespace, | | struct GNUNET_FS_Namespace *ns, | |
| const char *identifier, const char *update, | | const char *identifier, const char *update, | |
| const struct GNUNET_CONTAINER_MetaData *meta, | | const struct GNUNET_CONTAINER_MetaData *meta, | |
| const struct GNUNET_FS_Uri *uri, | | const struct GNUNET_FS_Uri *uri, | |
| const struct GNUNET_FS_BlockOptions *bo, | | const struct GNUNET_FS_BlockOptions *bo, | |
| enum GNUNET_FS_PublishOptions options, | | enum GNUNET_FS_PublishOptions options, | |
| GNUNET_FS_PublishContinuation cont, void *cont_cls); | | GNUNET_FS_PublishContinuation cont, void *cont_cls); | |
| | | | |
| /** | | /** | |
| * Abort the SKS publishing operation. | | * Abort the SKS publishing operation. | |
| * | | * | |
| | | | |
| skipping to change at line 2042 | | skipping to change at line 2052 | |
| | | | |
| /** | | /** | |
| * Type of a function called by "GNUNET_FS_get_indexed_files". | | * Type of a function called by "GNUNET_FS_get_indexed_files". | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param filename the name of the file, NULL for end of list | | * @param filename the name of the file, NULL for end of list | |
| * @param file_id hash of the contents of the indexed file | | * @param file_id hash of the contents of the indexed file | |
| * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort | | * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort | |
| */ | | */ | |
| typedef int (*GNUNET_FS_IndexedFileProcessor) (void *cls, const char *filen
ame, | | typedef int (*GNUNET_FS_IndexedFileProcessor) (void *cls, const char *filen
ame, | |
|
| const GNUNET_HashCode * file
_id); | | const struct GNUNET_HashCode
* file_id); | |
| | | | |
| /** | | /** | |
| * Handle to cancel 'GNUNET_FS_get_indexed_files'. | | * Handle to cancel 'GNUNET_FS_get_indexed_files'. | |
| */ | | */ | |
| struct GNUNET_FS_GetIndexedContext; | | struct GNUNET_FS_GetIndexedContext; | |
| | | | |
| /** | | /** | |
| * Iterate over all indexed files. | | * Iterate over all indexed files. | |
| * | | * | |
| * @param h handle to the file sharing subsystem | | * @param h handle to the file sharing subsystem | |
| | | | |
| skipping to change at line 2100 | | skipping to change at line 2110 | |
| /** | | /** | |
| * Context for advertising a namespace. | | * Context for advertising a namespace. | |
| */ | | */ | |
| struct GNUNET_FS_AdvertisementContext; | | struct GNUNET_FS_AdvertisementContext; | |
| | | | |
| /** | | /** | |
| * Publish an advertismement for a namespace. | | * Publish an advertismement for a namespace. | |
| * | | * | |
| * @param h handle to the file sharing subsystem | | * @param h handle to the file sharing subsystem | |
| * @param ksk_uri keywords to use for advertisment | | * @param ksk_uri keywords to use for advertisment | |
|
| * @param namespace handle for the namespace that should be advertised | | * @param ns handle for the namespace that should be advertised | |
| * @param meta meta-data for the namespace advertisement | | * @param meta meta-data for the namespace advertisement | |
| * @param bo block options | | * @param bo block options | |
| * @param rootEntry name of the root of the namespace | | * @param rootEntry name of the root of the namespace | |
| * @param cont continuation | | * @param cont continuation | |
| * @param cont_cls closure for cont | | * @param cont_cls closure for cont | |
| * @return NULL on error ('cont' will still be called) | | * @return NULL on error ('cont' will still be called) | |
| */ | | */ | |
| struct GNUNET_FS_AdvertisementContext * | | struct GNUNET_FS_AdvertisementContext * | |
| GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, | | GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, | |
| struct GNUNET_FS_Uri *ksk_uri, | | struct GNUNET_FS_Uri *ksk_uri, | |
|
| struct GNUNET_FS_Namespace *namespace, | | struct GNUNET_FS_Namespace *ns, | |
| const struct GNUNET_CONTAINER_MetaData *meta
, | | const struct GNUNET_CONTAINER_MetaData *meta
, | |
| const struct GNUNET_FS_BlockOptions *bo, | | const struct GNUNET_FS_BlockOptions *bo, | |
| const char *rootEntry, | | const char *rootEntry, | |
| GNUNET_FS_PublishContinuation cont, | | GNUNET_FS_PublishContinuation cont, | |
| void *cont_cls); | | void *cont_cls); | |
| | | | |
| /** | | /** | |
| * Abort the namespace advertisement operation. | | * Abort the namespace advertisement operation. | |
| * | | * | |
| * @param ac context of the operation to abort. | | * @param ac context of the operation to abort. | |
| */ | | */ | |
| void | | void | |
| GNUNET_FS_namespace_advertise_cancel (struct GNUNET_FS_AdvertisementContext
*ac); | | GNUNET_FS_namespace_advertise_cancel (struct GNUNET_FS_AdvertisementContext
*ac); | |
| | | | |
| /** | | /** | |
| * Create a namespace with the given name; if one already | | * Create a namespace with the given name; if one already | |
| * exists, return a handle to the existing namespace. | | * exists, return a handle to the existing namespace. | |
| * | | * | |
| * @param h handle to the file sharing subsystem | | * @param h handle to the file sharing subsystem | |
| * @param name name to use for the namespace | | * @param name name to use for the namespace | |
|
| * @return handle to the namespace, NULL on error | | * @return handle to the namespace, NULL on error (i.e. invalid filename) | |
| */ | | */ | |
| struct GNUNET_FS_Namespace * | | struct GNUNET_FS_Namespace * | |
| GNUNET_FS_namespace_create (struct GNUNET_FS_Handle *h, const char *name); | | GNUNET_FS_namespace_create (struct GNUNET_FS_Handle *h, const char *name); | |
| | | | |
| /** | | /** | |
| * Duplicate a namespace handle. | | * Duplicate a namespace handle. | |
| * | | * | |
| * @param ns namespace handle | | * @param ns namespace handle | |
| * @return duplicated handle to the namespace | | * @return duplicated handle to the namespace | |
| */ | | */ | |
| struct GNUNET_FS_Namespace * | | struct GNUNET_FS_Namespace * | |
| GNUNET_FS_namespace_dup (struct GNUNET_FS_Namespace *ns); | | GNUNET_FS_namespace_dup (struct GNUNET_FS_Namespace *ns); | |
| | | | |
| /** | | /** | |
| * Delete a namespace handle. Can be used for a clean shutdown (free | | * Delete a namespace handle. Can be used for a clean shutdown (free | |
| * memory) or also to freeze the namespace to prevent further | | * memory) or also to freeze the namespace to prevent further | |
| * insertions by anyone. | | * insertions by anyone. | |
| * | | * | |
|
| * @param namespace handle to the namespace that should be deleted / freed | | * @param ns handle to the namespace that should be deleted / freed | |
| * @param freeze prevents future insertions; creating a namespace | | * @param freeze prevents future insertions; creating a namespace | |
| * with the same name again will create a fresh namespace instead | | * with the same name again will create a fresh namespace instead | |
| * | | * | |
| * @return GNUNET_OK on success, GNUNET_SYSERR on error | | * @return GNUNET_OK on success, GNUNET_SYSERR on error | |
| */ | | */ | |
| int | | int | |
|
| GNUNET_FS_namespace_delete (struct GNUNET_FS_Namespace *namespace, int free
ze); | | GNUNET_FS_namespace_delete (struct GNUNET_FS_Namespace *ns, int freeze); | |
| | | | |
| /** | | /** | |
| * Callback with information about local (!) namespaces. | | * Callback with information about local (!) namespaces. | |
| * Contains the names of the local namespace and the global | | * Contains the names of the local namespace and the global | |
| * ID. | | * ID. | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param name human-readable identifier of the namespace | | * @param name human-readable identifier of the namespace | |
| * @param id hash identifier for the namespace | | * @param id hash identifier for the namespace | |
| */ | | */ | |
| typedef void (*GNUNET_FS_NamespaceInfoProcessor) (void *cls, const char *na
me, | | typedef void (*GNUNET_FS_NamespaceInfoProcessor) (void *cls, const char *na
me, | |
|
| const GNUNET_HashCode * i
d); | | const struct GNUNET_HashC
ode * id); | |
| | | | |
| /** | | /** | |
| * Build a list of all available local (!) namespaces The returned | | * Build a list of all available local (!) namespaces The returned | |
| * names are only the nicknames since we only iterate over the local | | * names are only the nicknames since we only iterate over the local | |
| * namespaces. | | * namespaces. | |
| * | | * | |
| * @param h handle to the file sharing subsystem | | * @param h handle to the file sharing subsystem | |
| * @param cb function to call on each known namespace | | * @param cb function to call on each known namespace | |
| * @param cb_cls closure for cb | | * @param cb_cls closure for cb | |
| */ | | */ | |
| | | | |
| skipping to change at line 2216 | | skipping to change at line 2226 | |
| * | | * | |
| * Calling this function with "next_id" NULL will cause the library to | | * Calling this function with "next_id" NULL will cause the library to | |
| * call "ip" with a root for each strongly connected component of the | | * call "ip" with a root for each strongly connected component of the | |
| * graph (a root being a node from which all other nodes in the Scc | | * graph (a root being a node from which all other nodes in the Scc | |
| * are reachable). | | * are reachable). | |
| * | | * | |
| * Calling this function with "next_id" being the name of a node will | | * Calling this function with "next_id" being the name of a node will | |
| * cause the library to call "ip" with all children of the node. Note | | * cause the library to call "ip" with all children of the node. Note | |
| * that cycles within an SCC are possible (including self-loops). | | * that cycles within an SCC are possible (including self-loops). | |
| * | | * | |
|
| * @param namespace namespace to inspect for updateable content | | * @param ns namespace to inspect for updateable content | |
| * @param next_id ID to look for; use NULL to look for SCC roots | | * @param next_id ID to look for; use NULL to look for SCC roots | |
| * @param ip function to call on each updateable identifier | | * @param ip function to call on each updateable identifier | |
| * @param ip_cls closure for ip | | * @param ip_cls closure for ip | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace, | | GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *ns, | |
| const char *next_id, | | const char *next_id, | |
| GNUNET_FS_IdentifierProcessor ip, | | GNUNET_FS_IdentifierProcessor ip, | |
| void *ip_cls); | | void *ip_cls); | |
| | | | |
| /** | | /** | |
| * Options for searching. Compatible options | | * Options for searching. Compatible options | |
| * can be OR'ed together. | | * can be OR'ed together. | |
| */ | | */ | |
| enum GNUNET_FS_SearchOptions | | enum GNUNET_FS_SearchOptions | |
| { | | { | |
| | | | |
End of changes. 28 change blocks. |
| 41 lines changed or deleted | | 54 lines changed or added | |
|
| gnunet_gns_service.h | | gnunet_gns_service.h | |
| | | | |
| skipping to change at line 25 | | skipping to change at line 25 | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
| along with GNUnet; see the file COPYING. If not, write to the | | along with GNUnet; see the file COPYING. If not, write to the | |
| Free Software Foundation, Inc., 59 Temple Place - Suite 330, | | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
| Boston, MA 02111-1307, USA. | | Boston, MA 02111-1307, USA. | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * @file include/gnunet_gns_service.h | | * @file include/gnunet_gns_service.h | |
| * @brief API to the GNS service | | * @brief API to the GNS service | |
| * @author Martin Schanzenbach | | * @author Martin Schanzenbach | |
|
| * | | | |
| * TODO: | | | |
| * - decide what goes into storage API and what into GNS-service API | | | |
| * - decide where to pass/expose/check keys / signatures | | | |
| * - are GNS private keys per peer or per user? | | | |
| */ | | */ | |
|
| | | | |
| #ifndef GNUNET_GNS_SERVICE_H | | #ifndef GNUNET_GNS_SERVICE_H | |
| #define GNUNET_GNS_SERVICE_H | | #define GNUNET_GNS_SERVICE_H | |
| | | | |
| #include "gnunet_util_lib.h" | | #include "gnunet_util_lib.h" | |
| #include "gnunet_dnsparser_lib.h" | | #include "gnunet_dnsparser_lib.h" | |
| #include "gnunet_namestore_service.h" | | #include "gnunet_namestore_service.h" | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" | | extern "C" | |
| { | | { | |
| | | | |
| skipping to change at line 53 | | skipping to change at line 47 | |
| } | | } | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
| * Connection to the GNS service. | | * Connection to the GNS service. | |
| */ | | */ | |
| struct GNUNET_GNS_Handle; | | struct GNUNET_GNS_Handle; | |
| | | | |
| /** | | /** | |
|
| * Handle to control a get operation. | | * Handle to control a lookup operation. | |
| | | */ | |
| | | struct GNUNET_GNS_LookupRequest; | |
| | | | |
| | | /** | |
| | | * Handle to control a shorten operation. | |
| */ | | */ | |
|
| struct GNUNET_GNS_LookupHandle; | | struct GNUNET_GNS_ShortenRequest; | |
| | | | |
| /** | | /** | |
|
| * Handle to control a shorten operation | | * Handle to control a get authority operation | |
| */ | | */ | |
|
| | | struct GNUNET_GNS_GetAuthRequest; | |
| | | | |
| /** | | /** | |
| * Record types | | * Record types | |
| * Based on GNUNET_DNSPARSER_TYPEs (standard DNS) | | * Based on GNUNET_DNSPARSER_TYPEs (standard DNS) | |
| */ | | */ | |
| enum GNUNET_GNS_RecordType | | enum GNUNET_GNS_RecordType | |
| { | | { | |
| /* Standard DNS */ | | /* Standard DNS */ | |
|
| GNUNET_GNS_RECORD_TYPE_A = GNUNET_DNSPARSER_TYPE_A, | | /* struct in_addr */ | |
| GNUNET_GNS_RECORD_TYPE_NS = GNUNET_DNSPARSER_TYPE_NS, | | GNUNET_GNS_RECORD_A = GNUNET_DNSPARSER_TYPE_A, | |
| GNUNET_GNS_RECORD_TYPE_CNAME = GNUNET_DNSPARSER_TYPE_CNAME, | | | |
| GNUNET_GNS_RECORD_TYPE_SOA = GNUNET_DNSPARSER_TYPE_SOA, | | /* char */ | |
| GNUNET_GNS_RECORD_TYPE_PTR = GNUNET_DNSPARSER_TYPE_PTR, | | GNUNET_GNS_RECORD_NS = GNUNET_DNSPARSER_TYPE_NS, | |
| GNUNET_GNS_RECORD_MX = GNUNET_DNSPARSER_TYPE_MX, | | | |
| GNUNET_GNS_RECORD_TXT = GNUNET_DNSPARSER_TYPE_TXT, | | /* char */ | |
| GNUNET_GNS_RECORD_AAAA = GNUNET_DNSPARSER_TYPE_AAAA, | | GNUNET_GNS_RECORD_CNAME = GNUNET_DNSPARSER_TYPE_CNAME, | |
| | | | |
| | | /* struct soa_data */ | |
| | | GNUNET_GNS_RECORD_SOA = GNUNET_DNSPARSER_TYPE_SOA, | |
| | | | |
| | | /* struct srv_data */ | |
| | | GNUNET_GNS_RECORD_SRV = GNUNET_DNSPARSER_TYPE_SRV, | |
| | | | |
| | | /* char */ | |
| | | GNUNET_GNS_RECORD_PTR = GNUNET_DNSPARSER_TYPE_PTR, | |
| | | | |
| | | /* uint16_t, char */ | |
| | | GNUNET_GNS_RECORD_MX = GNUNET_DNSPARSER_TYPE_MX, | |
| | | | |
| | | /* char */ | |
| | | GNUNET_GNS_RECORD_TXT = GNUNET_DNSPARSER_TYPE_TXT, | |
| | | | |
| | | /* struct in6_addr */ | |
| | | GNUNET_GNS_RECORD_AAAA = GNUNET_DNSPARSER_TYPE_AAAA, | |
| | | | |
| /* GNS specific */ | | /* GNS specific */ | |
|
| | | /* struct GNUNET_CRYPTO_ShortHashCode */ | |
| GNUNET_GNS_RECORD_PKEY = GNUNET_NAMESTORE_TYPE_PKEY, | | GNUNET_GNS_RECORD_PKEY = GNUNET_NAMESTORE_TYPE_PKEY, | |
|
| | | | |
| | | /* char */ | |
| GNUNET_GNS_RECORD_PSEU = GNUNET_NAMESTORE_TYPE_PSEU, | | GNUNET_GNS_RECORD_PSEU = GNUNET_NAMESTORE_TYPE_PSEU, | |
|
| GNUNET_GNS_RECORD_ANY = GNUNET_NAMESTORE_TYPE_ANY | | GNUNET_GNS_RECORD_ANY = GNUNET_NAMESTORE_TYPE_ANY, | |
| | | | |
| | | /* char */ | |
| | | GNUNET_GNS_RECORD_LEHO = GNUNET_NAMESTORE_TYPE_LEHO, | |
| | | | |
| | | /* struct vpn_data */ | |
| | | GNUNET_GNS_RECORD_VPN = GNUNET_NAMESTORE_TYPE_VPN, | |
| | | | |
| | | /* revocation */ | |
| | | GNUNET_GNS_RECORD_REV = GNUNET_NAMESTORE_TYPE_REV | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Initialize the connection with the GNS service. | | * Initialize the connection with the GNS service. | |
| * | | * | |
| * @param cfg configuration to use | | * @param cfg configuration to use | |
| * | | * | |
| * @return handle to the GNS service, or NULL on error | | * @return handle to the GNS service, or NULL on error | |
| */ | | */ | |
| struct GNUNET_GNS_Handle * | | struct GNUNET_GNS_Handle * | |
| | | | |
| skipping to change at line 108 | | skipping to change at line 138 | |
| void | | void | |
| GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle); | | GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle); | |
| | | | |
| /* *************** Standard API: lookup ******************* */ | | /* *************** Standard API: lookup ******************* */ | |
| | | | |
| /** | | /** | |
| * Iterator called on obtained result for a GNS | | * Iterator called on obtained result for a GNS | |
| * lookup | | * lookup | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
|
| * @param name "name" of the original lookup | | | |
| * @param rd_count number of records | | * @param rd_count number of records | |
| * @param rd the records in reply | | * @param rd the records in reply | |
| */ | | */ | |
| typedef void (*GNUNET_GNS_LookupResultProcessor) (void *cls, | | typedef void (*GNUNET_GNS_LookupResultProcessor) (void *cls, | |
|
| uint32_t rd_count, | | uint32_t rd_count, | |
| const struct GNUNET_NAMESTORE_RecordData * | | const struct GNUNET_NAMEST | |
| rd); | | ORE_RecordData *rd); | |
| | | | |
| /** | | /** | |
| * Perform an asynchronous lookup operation on the GNS | | * Perform an asynchronous lookup operation on the GNS | |
| * in the default zone. | | * in the default zone. | |
| * | | * | |
| * @param handle handle to the GNS service | | * @param handle handle to the GNS service | |
| * @param name the name to look up | | * @param name the name to look up | |
| * @param type the GNUNET_GNS_RecordType to look for | | * @param type the GNUNET_GNS_RecordType to look for | |
|
| | | * @param only_cached GNUNET_NO to only check locally not DHT for performan | |
| | | ce | |
| | | * @param shorten_key the private key of the shorten zone (can be NULL) | |
| * @param proc function to call on result | | * @param proc function to call on result | |
| * @param proc_cls closure for processor | | * @param proc_cls closure for processor | |
| * | | * | |
| * @return handle to the queued request | | * @return handle to the queued request | |
| */ | | */ | |
|
| struct GNUNET_GNS_QueueEntry * | | struct GNUNET_GNS_LookupRequest* | |
| GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, | | GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, | |
|
| const char * name, | | const char * name, | |
| enum GNUNET_GNS_RecordType type, | | enum GNUNET_GNS_RecordType type, | |
| GNUNET_GNS_LookupResultProcessor proc, | | int only_cached, | |
| void *proc_cls); | | struct GNUNET_CRYPTO_RsaPrivateKey *shorten_key, | |
| | | GNUNET_GNS_LookupResultProcessor proc, | |
| | | void *proc_cls); | |
| | | | |
| /** | | /** | |
| * Perform an asynchronous lookup operation on the GNS | | * Perform an asynchronous lookup operation on the GNS | |
| * in the zone specified by 'zone'. | | * in the zone specified by 'zone'. | |
| * | | * | |
| * @param handle handle to the GNS service | | * @param handle handle to the GNS service | |
| * @param name the name to look up | | * @param name the name to look up | |
| * @param zone the zone to start the resolution in | | * @param zone the zone to start the resolution in | |
| * @param type the GNUNET_GNS_RecordType to look for | | * @param type the GNUNET_GNS_RecordType to look for | |
|
| | | * @param only_cached GNUNET_YES to only check locally not DHT for performa | |
| | | nce | |
| | | * @param shorten_key the private key of the shorten zone (can be NULL) | |
| * @param proc function to call on result | | * @param proc function to call on result | |
| * @param proc_cls closure for processor | | * @param proc_cls closure for processor | |
| * | | * | |
| * @return handle to the queued request | | * @return handle to the queued request | |
| */ | | */ | |
|
| struct GNUNET_GNS_QueueEntry * | | struct GNUNET_GNS_LookupRequest* | |
| GNUNET_GNS_lookup_zone (struct GNUNET_GNS_Handle *handle, | | GNUNET_GNS_lookup_zone (struct GNUNET_GNS_Handle *handle, | |
|
| const char * name, | | const char * name, | |
| struct GNUNET_CRYPTO_ShortHashCode *zone, | | struct GNUNET_CRYPTO_ShortHashCode *zone, | |
| enum GNUNET_GNS_RecordType type, | | enum GNUNET_GNS_RecordType type, | |
| GNUNET_GNS_LookupResultProcessor proc, | | int only_cached, | |
| void *proc_cls); | | struct GNUNET_CRYPTO_RsaPrivateKey *shorten_key, | |
| | | GNUNET_GNS_LookupResultProcessor proc, | |
| | | void *proc_cls); | |
| | | | |
| | | /** | |
| | | * Cancel pending lookup request | |
| | | * | |
| | | * @param lr the lookup request to cancel | |
| | | */ | |
| | | void | |
| | | GNUNET_GNS_cancel_lookup_request (struct GNUNET_GNS_LookupRequest *lr); | |
| | | | |
| /* *************** Standard API: shorten ******************* */ | | /* *************** Standard API: shorten ******************* */ | |
| | | | |
| /** | | /** | |
| * Processor called on for a name shortening result | | * Processor called on for a name shortening result | |
| * called only once | | * called only once | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
|
| * @param short_name the shortened name or NULL if no result | | * @param short_name the shortened name or NULL if no result / error | |
| */ | | */ | |
| typedef void (*GNUNET_GNS_ShortenResultProcessor) (void *cls, | | typedef void (*GNUNET_GNS_ShortenResultProcessor) (void *cls, | |
|
| const char* short_name); | | const char* short_name); | |
| | | | |
| /** | | /** | |
| * Perform a name shortening operation on the GNS. | | * Perform a name shortening operation on the GNS. | |
| * | | * | |
| * @param handle handle to the GNS service | | * @param handle handle to the GNS service | |
| * @param name the name to look up | | * @param name the name to look up | |
|
| | | * @param private_zone the public zone of the private zone | |
| | | * @param shorten_zone the public zone of the shorten zone | |
| * @param proc function to call on result | | * @param proc function to call on result | |
| * @param proc_cls closure for processor | | * @param proc_cls closure for processor | |
| * @return handle to the operation | | * @return handle to the operation | |
| */ | | */ | |
|
| struct GNUNET_GNS_QueueEntry * | | struct GNUNET_GNS_ShortenRequest* | |
| GNUNET_GNS_shorten (struct GNUNET_GNS_Handle *handle, | | GNUNET_GNS_shorten (struct GNUNET_GNS_Handle *handle, | |
| const char * name, | | const char * name, | |
|
| | | struct GNUNET_CRYPTO_ShortHashCode *private_zone, | |
| | | struct GNUNET_CRYPTO_ShortHashCode *shorten_zone, | |
| GNUNET_GNS_ShortenResultProcessor proc, | | GNUNET_GNS_ShortenResultProcessor proc, | |
| void *proc_cls); | | void *proc_cls); | |
| | | | |
| /** | | /** | |
| * Perform a name shortening operation on the GNS. | | * Perform a name shortening operation on the GNS. | |
| * | | * | |
| * @param handle handle to the GNS service | | * @param handle handle to the GNS service | |
| * @param name the name to look up | | * @param name the name to look up | |
|
| | | * @param private_zone the public zone of the private zone | |
| | | * @param shorten_zone the public zone of the shorten zone | |
| * @param zone the zone to start the resolution in | | * @param zone the zone to start the resolution in | |
| * @param proc function to call on result | | * @param proc function to call on result | |
| * @param proc_cls closure for processor | | * @param proc_cls closure for processor | |
| * @return handle to the operation | | * @return handle to the operation | |
| */ | | */ | |
|
| struct GNUNET_GNS_QueueEntry * | | struct GNUNET_GNS_ShortenRequest* | |
| GNUNET_GNS_shorten_zone (struct GNUNET_GNS_Handle *handle, | | GNUNET_GNS_shorten_zone (struct GNUNET_GNS_Handle *handle, | |
|
| const char * name, | | const char * name, | |
| struct GNUNET_CRYPTO_ShortHashCode *zone, | | struct GNUNET_CRYPTO_ShortHashCode *private_zone, | |
| GNUNET_GNS_ShortenResultProcessor proc, | | struct GNUNET_CRYPTO_ShortHashCode *shorten_zone, | |
| void *proc_cls); | | struct GNUNET_CRYPTO_ShortHashCode *zone, | |
| | | GNUNET_GNS_ShortenResultProcessor proc, | |
| | | void *proc_cls); | |
| | | | |
| | | /** | |
| | | * Cancel pending shorten request | |
| | | * | |
| | | * @param sr the lookup request to cancel | |
| | | */ | |
| | | void | |
| | | GNUNET_GNS_cancel_shorten_request (struct GNUNET_GNS_ShortenRequest *sr); | |
| | | | |
| /* *************** Standard API: get authority ******************* */ | | /* *************** Standard API: get authority ******************* */ | |
| | | | |
| /** | | /** | |
| * Processor called on for a name shortening result | | * Processor called on for a name shortening result | |
| * called only once | | * called only once | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param auth_name the name of the auhtority or NULL | | * @param auth_name the name of the auhtority or NULL | |
| */ | | */ | |
| typedef void (*GNUNET_GNS_GetAuthResultProcessor) (void *cls, | | typedef void (*GNUNET_GNS_GetAuthResultProcessor) (void *cls, | |
|
| const char* short_name); | | const char* short_name); | |
| | | | |
| /** | | /** | |
| * Perform an authority lookup for a given name. | | * Perform an authority lookup for a given name. | |
| * | | * | |
| * @param handle handle to the GNS service | | * @param handle handle to the GNS service | |
| * @param name the name to look up authority for | | * @param name the name to look up authority for | |
| * @param proc function to call on result | | * @param proc function to call on result | |
| * @param proc_cls closure for processor | | * @param proc_cls closure for processor | |
| * @return handle to the operation | | * @return handle to the operation | |
| */ | | */ | |
|
| struct GNUNET_GNS_QueueEntry * | | struct GNUNET_GNS_GetAuthRequest* | |
| GNUNET_GNS_get_authority (struct GNUNET_GNS_Handle *handle, | | GNUNET_GNS_get_authority (struct GNUNET_GNS_Handle *handle, | |
|
| const char * name, | | const char * name, | |
| GNUNET_GNS_GetAuthResultProcessor proc, | | GNUNET_GNS_GetAuthResultProcessor proc, | |
| void *proc_cls); | | void *proc_cls); | |
| | | | |
| | | /** | |
| | | * Cancel pending get auth request | |
| | | * | |
| | | * @param gar the lookup request to cancel | |
| | | */ | |
| | | void | |
| | | GNUNET_GNS_cancel_get_auth_request (struct GNUNET_GNS_GetAuthRequest *gar); | |
| | | | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| { | | { | |
| #endif | | #endif | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| /* gnunet_gns_service.h */ | | /* gnunet_gns_service.h */ | |
| | | | |
End of changes. 29 change blocks. |
| 46 lines changed or deleted | | 117 lines changed or added | |
|
| gnunet_mesh_service.h | | gnunet_mesh_service.h | |
| | | | |
| skipping to change at line 107 | | skipping to change at line 107 | |
| * If non-zero, messages of the given type will be discarded if they | | * If non-zero, messages of the given type will be discarded if they | |
| * do not have the right size. | | * do not have the right size. | |
| */ | | */ | |
| uint16_t expected_size; | | uint16_t expected_size; | |
| | | | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Method called whenever another peer has added us to a tunnel | | * Method called whenever another peer has added us to a tunnel | |
| * the other peer initiated. | | * the other peer initiated. | |
|
| | | * Only called (once) upon reception of data with a message type which was | |
| | | * subscribed to in GNUNET_MESH_connect. A call to GNUNET_MESH_tunnel_destr | |
| | | oy | |
| | | * causes te tunnel to be ignored and no further notifications are sent abo | |
| | | ut | |
| | | * the same tunnel. | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param tunnel new handle to the tunnel | | * @param tunnel new handle to the tunnel | |
| * @param initiator peer that started the tunnel | | * @param initiator peer that started the tunnel | |
| * @param atsi performance information for the tunnel | | * @param atsi performance information for the tunnel | |
| * @return initial tunnel context for the tunnel | | * @return initial tunnel context for the tunnel | |
| * (can be NULL -- that's not an error) | | * (can be NULL -- that's not an error) | |
| */ | | */ | |
| typedef void *(GNUNET_MESH_InboundTunnelNotificationHandler) (void *cls, | | typedef void *(GNUNET_MESH_InboundTunnelNotificationHandler) (void *cls, | |
| struct | | struct | |
| | | | |
| skipping to change at line 151 | | skipping to change at line 155 | |
| | | | |
| /** | | /** | |
| * Type for an application. Values defined in gnunet_applications.h | | * Type for an application. Values defined in gnunet_applications.h | |
| */ | | */ | |
| typedef uint32_t GNUNET_MESH_ApplicationType; | | typedef uint32_t GNUNET_MESH_ApplicationType; | |
| | | | |
| /** | | /** | |
| * Connect to the mesh service. | | * Connect to the mesh service. | |
| * | | * | |
| * @param cfg configuration to use | | * @param cfg configuration to use | |
|
| * @param queue_size size of the data message queue, shared among all tunne | | | |
| ls | | | |
| * (each tunnel is guaranteed to accept at least one mess | | | |
| age, | | | |
| * no matter what is the status of other tunnels) | | | |
| * @param cls closure for the various callbacks that follow | | * @param cls closure for the various callbacks that follow | |
| * (including handlers in the handlers array) | | * (including handlers in the handlers array) | |
| * @param new_tunnel function called when an *inbound* tunnel is created | | * @param new_tunnel function called when an *inbound* tunnel is created | |
| * @param cleaner function called when an *inbound* tunnel is destroyed by
the | | * @param cleaner function called when an *inbound* tunnel is destroyed by
the | |
| * remote peer, it is *not* called if GNUNET_MESH_tunnel_des
troy | | * remote peer, it is *not* called if GNUNET_MESH_tunnel_des
troy | |
| * is called on the tunnel | | * is called on the tunnel | |
| * @param handlers callbacks for messages we care about, NULL-terminated | | * @param handlers callbacks for messages we care about, NULL-terminated | |
| * note that the mesh is allowed to drop notifications about | | * note that the mesh is allowed to drop notifications about | |
| * inbound messages if the client does not process them fast | | * inbound messages if the client does not process them fast | |
| * enough (for this notification type, a bounded queue is us
ed) | | * enough (for this notification type, a bounded queue is us
ed) | |
| * @param stypes list of the applications that this client claims to provid
e | | * @param stypes list of the applications that this client claims to provid
e | |
| * @return handle to the mesh service NULL on error | | * @return handle to the mesh service NULL on error | |
| * (in this case, init is never called) | | * (in this case, init is never called) | |
| */ | | */ | |
| struct GNUNET_MESH_Handle * | | struct GNUNET_MESH_Handle * | |
|
| GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | | GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *c | |
| unsigned int queue_size, void *cls, | | ls, | |
| GNUNET_MESH_InboundTunnelNotificationHandler new_tunne
l, | | GNUNET_MESH_InboundTunnelNotificationHandler new_tunne
l, | |
| GNUNET_MESH_TunnelEndHandler cleaner, | | GNUNET_MESH_TunnelEndHandler cleaner, | |
| const struct GNUNET_MESH_MessageHandler *handlers, | | const struct GNUNET_MESH_MessageHandler *handlers, | |
| const GNUNET_MESH_ApplicationType *stypes); | | const GNUNET_MESH_ApplicationType *stypes); | |
| | | | |
| /** | | /** | |
| * Disconnect from the mesh service. All tunnels will be destroyed. All tun
nel | | * Disconnect from the mesh service. All tunnels will be destroyed. All tun
nel | |
| * disconnect callbacks will be called on any still connected peers, notify
ing | | * disconnect callbacks will be called on any still connected peers, notify
ing | |
| * about their disconnection. The registered inbound tunnel cleaner will be | | * about their disconnection. The registered inbound tunnel cleaner will be | |
| * called should any inbound tunnels still exist. | | * called should any inbound tunnels still exist. | |
| | | | |
| skipping to change at line 217 | | skipping to change at line 217 | |
| * | | * | |
| * TODO: change to return int to let client allow the new peer or not? | | * TODO: change to return int to let client allow the new peer or not? | |
| */ | | */ | |
| typedef void (*GNUNET_MESH_PeerConnectHandler) (void *cls, | | typedef void (*GNUNET_MESH_PeerConnectHandler) (void *cls, | |
| const struct GNUNET_PeerIde
ntity | | const struct GNUNET_PeerIde
ntity | |
| * peer, | | * peer, | |
| const struct | | const struct | |
| GNUNET_ATS_Information * at
si); | | GNUNET_ATS_Information * at
si); | |
| | | | |
| /** | | /** | |
|
| | | * Announce to ther peer the availability of services described by the rege | |
| | | x, | |
| | | * in order to be reachable to other peers via connect_by_string. | |
| | | * | |
| | | * Note that the first GNUNET_REGEX_INITIAL_BYTES characters are considered | |
| | | * to be part of a prefix, (for instance 'gnunet://'). | |
| | | * If you put a variable part in there (*, +. ()), all matching strings | |
| | | * will be stored in the DHT. | |
| | | * | |
| | | * @param h Handle to mesh. | |
| | | * @param regex String with the regular expression describing local service | |
| | | s. | |
| | | * @param compression_characters How many characters can be assigned to one | |
| | | * edge of the graph. The bigger the variabil | |
| | | ity | |
| | | * of the data, the smaller this parameter sh | |
| | | ould | |
| | | * be (down to 1). | |
| | | * For maximum compression, use strlen (regex | |
| | | ) | |
| | | * or 0 (special value). Use with care! | |
| | | */ | |
| | | void | |
| | | GNUNET_MESH_announce_regex (struct GNUNET_MESH_Handle *h, | |
| | | const char *regex, | |
| | | unsigned int compression_characters); | |
| | | | |
| | | /** | |
| * Create a new tunnel (we're initiator and will be allowed to add/remove p
eers | | * Create a new tunnel (we're initiator and will be allowed to add/remove p
eers | |
| * and to broadcast). | | * and to broadcast). | |
| * | | * | |
| * @param h mesh handle | | * @param h mesh handle | |
| * @param tunnel_ctx client's tunnel context to associate with the tunnel | | * @param tunnel_ctx client's tunnel context to associate with the tunnel | |
| * @param connect_handler function to call when peers are actually connecte
d | | * @param connect_handler function to call when peers are actually connecte
d | |
| * @param disconnect_handler function to call when peers are disconnected | | * @param disconnect_handler function to call when peers are disconnected | |
| * @param handler_cls closure for connect/disconnect handlers | | * @param handler_cls closure for connect/disconnect handlers | |
| */ | | */ | |
| struct GNUNET_MESH_Tunnel * | | struct GNUNET_MESH_Tunnel * | |
| | | | |
| skipping to change at line 242 | | skipping to change at line 265 | |
| /** | | /** | |
| * Destroy an existing tunnel. The existing callback for the tunnel will NO
T | | * Destroy an existing tunnel. The existing callback for the tunnel will NO
T | |
| * be called. | | * be called. | |
| * | | * | |
| * @param tunnel tunnel handle | | * @param tunnel tunnel handle | |
| */ | | */ | |
| void | | void | |
| GNUNET_MESH_tunnel_destroy (struct GNUNET_MESH_Tunnel *tunnel); | | GNUNET_MESH_tunnel_destroy (struct GNUNET_MESH_Tunnel *tunnel); | |
| | | | |
| /** | | /** | |
|
| | | * Request that the tunnel data rate is limited to the speed of the slowest | |
| | | * receiver. | |
| | | * | |
| | | * @param tunnel Tunnel affected. | |
| | | */ | |
| | | void | |
| | | GNUNET_MESH_tunnel_speed_min (struct GNUNET_MESH_Tunnel *tunnel); | |
| | | | |
| | | /** | |
| | | * Request that the tunnel data rate is limited to the speed of the fastest | |
| | | * receiver. This is the default behavior. | |
| | | * | |
| | | * @param tunnel Tunnel affected. | |
| | | */ | |
| | | void | |
| | | GNUNET_MESH_tunnel_speed_max (struct GNUNET_MESH_Tunnel *tunnel); | |
| | | | |
| | | /** | |
| | | * Turn on/off the buffering status of the tunnel. | |
| | | * | |
| | | * @param tunnel Tunnel affected. | |
| | | * @param buffer GNUNET_YES to turn buffering on (default), | |
| | | * GNUNET_NO otherwise. | |
| | | */ | |
| | | void | |
| | | GNUNET_MESH_tunnel_buffer (struct GNUNET_MESH_Tunnel *tunnel, int buffer); | |
| | | | |
| | | /** | |
| * Request that a peer should be added to the tunnel. The connect handler | | * Request that a peer should be added to the tunnel. The connect handler | |
| * will be called when the peer connects | | * will be called when the peer connects | |
| * | | * | |
| * @param tunnel handle to existing tunnel | | * @param tunnel handle to existing tunnel | |
| * @param peer peer to add | | * @param peer peer to add | |
| */ | | */ | |
| void | | void | |
| GNUNET_MESH_peer_request_connect_add (struct GNUNET_MESH_Tunnel *tunnel, | | GNUNET_MESH_peer_request_connect_add (struct GNUNET_MESH_Tunnel *tunnel, | |
| const struct GNUNET_PeerIdentity *pee
r); | | const struct GNUNET_PeerIdentity *pee
r); | |
| | | | |
| | | | |
| skipping to change at line 276 | | skipping to change at line 327 | |
| * | | * | |
| * @param tunnel handle to existing tunnel | | * @param tunnel handle to existing tunnel | |
| * @param app_type application type that must be supported by the peer | | * @param app_type application type that must be supported by the peer | |
| * (MESH should discover peer in proximity handling this ty
pe) | | * (MESH should discover peer in proximity handling this ty
pe) | |
| */ | | */ | |
| void | | void | |
| GNUNET_MESH_peer_request_connect_by_type (struct GNUNET_MESH_Tunnel *tunnel
, | | GNUNET_MESH_peer_request_connect_by_type (struct GNUNET_MESH_Tunnel *tunnel
, | |
| GNUNET_MESH_ApplicationType app_t
ype); | | GNUNET_MESH_ApplicationType app_t
ype); | |
| | | | |
| /** | | /** | |
|
| | | * Request that the mesh should try to connect to a peer matching the | |
| | | * description given in the service string. | |
| | | * | |
| | | * @param tunnel handle to existing tunnel | |
| | | * @param description string describing the destination node requirements | |
| | | */ | |
| | | void | |
| | | GNUNET_MESH_peer_request_connect_by_string (struct GNUNET_MESH_Tunnel *tunn | |
| | | el, | |
| | | const char *description); | |
| | | | |
| | | /** | |
| | | * Request that the given peer isn't added to this tunnel in calls to | |
| | | * connect_by_* calls, (due to misbehaviour, bad performance, ...). | |
| | | * | |
| | | * @param tunnel handle to existing tunnel. | |
| | | * @param peer peer identity of the peer which should be blacklisted | |
| | | * for the tunnel. | |
| | | */ | |
| | | void | |
| | | GNUNET_MESH_peer_blacklist (struct GNUNET_MESH_Tunnel *tunnel, | |
| | | const struct GNUNET_PeerIdentity *peer); | |
| | | | |
| | | /** | |
| | | * Request that the given peer isn't blacklisted anymore from this tunnel, | |
| | | * and therefore can be added in future calls to connect_by_*. | |
| | | * The peer must have been previously blacklisted for this tunnel. | |
| | | * | |
| | | * @param tunnel handle to existing tunnel. | |
| | | * @param peer peer identity of the peer which shouldn't be blacklisted | |
| | | * for the tunnel anymore. | |
| | | */ | |
| | | void | |
| | | GNUNET_MESH_peer_unblacklist (struct GNUNET_MESH_Tunnel *tunnel, | |
| | | const struct GNUNET_PeerIdentity *peer); | |
| | | | |
| | | /** | |
| * Handle for a transmission request. | | * Handle for a transmission request. | |
| */ | | */ | |
| struct GNUNET_MESH_TransmitHandle; | | struct GNUNET_MESH_TransmitHandle; | |
| | | | |
| /** | | /** | |
| * Ask the mesh to call "notify" once it is ready to transmit the | | * Ask the mesh to call "notify" once it is ready to transmit the | |
| * given number of bytes to the specified tunnel or target. | | * given number of bytes to the specified tunnel or target. | |
|
| | | * Only one call can be active at any time, to issue another request, | |
| | | * wait for the callback or cancel the current request. | |
| * | | * | |
| * @param tunnel tunnel to use for transmission | | * @param tunnel tunnel to use for transmission | |
| * @param cork is corking allowed for this transmission? | | * @param cork is corking allowed for this transmission? | |
|
| * @param priority how important is the message? | | | |
| * @param maxdelay how long can the message wait? | | * @param maxdelay how long can the message wait? | |
| * @param target destination for the message | | * @param target destination for the message | |
| * NULL for multicast to all tunnel targets | | * NULL for multicast to all tunnel targets | |
| * @param notify_size how many bytes of buffer space does notify want? | | * @param notify_size how many bytes of buffer space does notify want? | |
| * @param notify function to call when buffer space is available; | | * @param notify function to call when buffer space is available; | |
| * will be called with NULL on timeout or if the overall queue | | * will be called with NULL on timeout or if the overall queue | |
| * for this peer is larger than queue_size and this is currently | | * for this peer is larger than queue_size and this is currently | |
| * the message with the lowest priority | | * the message with the lowest priority | |
| * @param notify_cls closure for notify | | * @param notify_cls closure for notify | |
| * @return non-NULL if the notify callback was queued, | | * @return non-NULL if the notify callback was queued, | |
| * NULL if we can not even queue the request (insufficient | | * NULL if we can not even queue the request (insufficient | |
| * memory); if NULL is returned, "notify" will NOT be called. | | * memory); if NULL is returned, "notify" will NOT be called. | |
| */ | | */ | |
| struct GNUNET_MESH_TransmitHandle * | | struct GNUNET_MESH_TransmitHandle * | |
| GNUNET_MESH_notify_transmit_ready (struct GNUNET_MESH_Tunnel *tunnel, int c
ork, | | GNUNET_MESH_notify_transmit_ready (struct GNUNET_MESH_Tunnel *tunnel, int c
ork, | |
|
| uint32_t priority, | | | |
| struct GNUNET_TIME_Relative maxdelay, | | struct GNUNET_TIME_Relative maxdelay, | |
| const struct GNUNET_PeerIdentity *target
, | | const struct GNUNET_PeerIdentity *target
, | |
| size_t notify_size, | | size_t notify_size, | |
| GNUNET_CONNECTION_TransmitReadyNotify no
tify, | | GNUNET_CONNECTION_TransmitReadyNotify no
tify, | |
| void *notify_cls); | | void *notify_cls); | |
| | | | |
| /** | | /** | |
| * Cancel the specified transmission-ready notification. | | * Cancel the specified transmission-ready notification. | |
| * | | * | |
| * @param th handle that was returned by "notify_transmit_ready". | | * @param th handle that was returned by "notify_transmit_ready". | |
| */ | | */ | |
| void | | void | |
| GNUNET_MESH_notify_transmit_ready_cancel (struct GNUNET_MESH_TransmitHandle | | GNUNET_MESH_notify_transmit_ready_cancel (struct GNUNET_MESH_TransmitHandle | |
| *th); | | *th); | |
| | | | |
| /** | | /** | |
| * Transition API for tunnel ctx management | | * Transition API for tunnel ctx management | |
|
| | | * | |
| | | * FIXME deprecated | |
| */ | | */ | |
| void | | void | |
| GNUNET_MESH_tunnel_set_data (struct GNUNET_MESH_Tunnel *tunnel, void *data)
; | | GNUNET_MESH_tunnel_set_data (struct GNUNET_MESH_Tunnel *tunnel, void *data)
; | |
| | | | |
| /** | | /** | |
| * Transition API for tunnel ctx management | | * Transition API for tunnel ctx management | |
|
| | | * | |
| | | * FIXME deprecated | |
| */ | | */ | |
| void * | | void * | |
| GNUNET_MESH_tunnel_get_data (struct GNUNET_MESH_Tunnel *tunnel); | | GNUNET_MESH_tunnel_get_data (struct GNUNET_MESH_Tunnel *tunnel); | |
| | | | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| { | | { | |
| #endif | | #endif | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
End of changes. 11 change blocks. |
| 9 lines changed or deleted | | 107 lines changed or added | |
|
| gnunet_namestore_service.h | | gnunet_namestore_service.h | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 28 | |
| Boston, MA 02111-1307, USA. | | Boston, MA 02111-1307, USA. | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * @file include/gnunet_namestore_service.h | | * @file include/gnunet_namestore_service.h | |
| * @brief API that can be used to store naming information on a GNUnet node
; | | * @brief API that can be used to store naming information on a GNUnet node
; | |
| * @author Christian Grothoff | | * @author Christian Grothoff | |
| * | | * | |
| * Other functions we might want: | | * Other functions we might want: | |
| * - enumerate all known zones | | * - enumerate all known zones | |
|
| * - convenience function to gather record and the full affilliated stree | | | |
| * in one shot | | | |
| */ | | */ | |
| | | | |
| #ifndef GNUNET_NAMESTORE_SERVICE_H | | #ifndef GNUNET_NAMESTORE_SERVICE_H | |
| #define GNUNET_NAMESTORE_SERVICE_H | | #define GNUNET_NAMESTORE_SERVICE_H | |
| | | | |
| #include "gnunet_util_lib.h" | | #include "gnunet_util_lib.h" | |
| #include "gnunet_block_lib.h" | | #include "gnunet_block_lib.h" | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" | | extern "C" | |
| | | | |
| skipping to change at line 67 | | skipping to change at line 65 | |
| * Record type for GNS zone transfer ("PSEU"). | | * Record type for GNS zone transfer ("PSEU"). | |
| */ | | */ | |
| #define GNUNET_NAMESTORE_TYPE_PSEU 65537 | | #define GNUNET_NAMESTORE_TYPE_PSEU 65537 | |
| | | | |
| /** | | /** | |
| * Record type for GNS legacy hostnames ("LEHO"). | | * Record type for GNS legacy hostnames ("LEHO"). | |
| */ | | */ | |
| #define GNUNET_NAMESTORE_TYPE_LEHO 65538 | | #define GNUNET_NAMESTORE_TYPE_LEHO 65538 | |
| | | | |
| /** | | /** | |
|
| | | * Record type for VPN resolution | |
| | | */ | |
| | | #define GNUNET_NAMESTORE_TYPE_VPN 65539 | |
| | | | |
| | | /** | |
| | | * Record type for zone revocation | |
| | | */ | |
| | | #define GNUNET_NAMESTORE_TYPE_REV 65540 | |
| | | | |
| | | /** | |
| * Entry in the queue. | | * Entry in the queue. | |
| */ | | */ | |
| struct GNUNET_NAMESTORE_QueueEntry; | | struct GNUNET_NAMESTORE_QueueEntry; | |
| | | | |
| /** | | /** | |
| * Handle to the namestore service. | | * Handle to the namestore service. | |
| */ | | */ | |
| struct GNUNET_NAMESTORE_Handle; | | struct GNUNET_NAMESTORE_Handle; | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 100 | | skipping to change at line 108 | |
| * @return handle to use to access the service | | * @return handle to use to access the service | |
| */ | | */ | |
| struct GNUNET_NAMESTORE_Handle * | | struct GNUNET_NAMESTORE_Handle * | |
| GNUNET_NAMESTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); | | GNUNET_NAMESTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); | |
| | | | |
| /** | | /** | |
| * Disconnect from the namestore service (and free associated | | * Disconnect from the namestore service (and free associated | |
| * resources). | | * resources). | |
| * | | * | |
| * @param h handle to the namestore | | * @param h handle to the namestore | |
|
| * @param drop set to GNUNET_YES to delete all data in namestore (!) | | | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h, int drop); | | GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h); | |
| | | | |
| /** | | /** | |
| * Continuation called to notify client about result of the | | * Continuation called to notify client about result of the | |
| * operation. | | * operation. | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param success GNUNET_SYSERR on failure (including timeout/queue drop/fa
ilure to validate) | | * @param success GNUNET_SYSERR on failure (including timeout/queue drop/fa
ilure to validate) | |
| * GNUNET_NO if content was already there or not found | | * GNUNET_NO if content was already there or not found | |
| * GNUNET_YES (or other positive value) on success | | * GNUNET_YES (or other positive value) on success | |
| * @param emsg NULL on success, otherwise an error message | | * @param emsg NULL on success, otherwise an error message | |
| | | | |
| skipping to change at line 147 | | skipping to change at line 154 | |
| /** | | /** | |
| * This is a private record of this peer and it should | | * This is a private record of this peer and it should | |
| * thus not be handed out to other peers. | | * thus not be handed out to other peers. | |
| */ | | */ | |
| GNUNET_NAMESTORE_RF_PRIVATE = 2, | | GNUNET_NAMESTORE_RF_PRIVATE = 2, | |
| | | | |
| /** | | /** | |
| * This record was added by the system | | * This record was added by the system | |
| * and is pending user confimation | | * and is pending user confimation | |
| */ | | */ | |
|
| GNUNET_NAMESTORE_RF_PENDING = 4 | | GNUNET_NAMESTORE_RF_PENDING = 4, | |
| | | | |
|
| | | /** | |
| | | * This expiration time of the record is a relative | |
| | | * time (not an absolute time). | |
| | | */ | |
| | | GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION = 8, | |
| | | | |
| | | /** | |
| | | * This record should not be used unless all (other) records with an abso | |
| | | lute | |
| | | * expiration time have expired. | |
| | | */ | |
| | | GNUNET_NAMESTORE_RF_SHADOW_RECORD = 16 | |
| | | | |
| | | /** | |
| | | * When comparing flags for record equality for removal, | |
| | | * which flags should must match (in addition to the type, | |
| | | * name, expiration value and data of the record)? All flags | |
| | | * that are not listed here will be ignored for this purpose. | |
| | | * (for example, we don't expect that users will remember to | |
| | | * pass the '--private' option when removing a record from | |
| | | * the namestore, hence we don't require this particular option | |
| | | * to match upon removal). See also | |
| | | * 'GNUNET_NAMESTORE_records_cmp'. | |
| | | */ | |
| | | #define GNUNET_NAMESTORE_RF_RCMP_FLAGS (GNUNET_NAMESTORE_RF_RELATIVE_EXPIRA | |
| | | TION) | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * A GNS record. | | * A GNS record. | |
| */ | | */ | |
| struct GNUNET_NAMESTORE_RecordData | | struct GNUNET_NAMESTORE_RecordData | |
| { | | { | |
| | | | |
| /** | | /** | |
| * Binary value stored in the DNS record. | | * Binary value stored in the DNS record. | |
|
| | | * FIXME: goofy API: sometimes 'data' is individually | |
| | | * 'malloc'ed, sometimes it points into some existing | |
| | | * data area (so sometimes this should be a 'void *', | |
| | | * sometimes a 'const void *'). This is unclean. | |
| */ | | */ | |
| const void *data; | | const void *data; | |
| | | | |
| /** | | /** | |
|
| * Expiration time for the DNS record. | | * Expiration time for the DNS record. Can be relative | |
| | | * or absolute, depending on 'flags'. | |
| */ | | */ | |
|
| struct GNUNET_TIME_Absolute expiration; | | uint64_t expiration_time; | |
| | | | |
| /** | | /** | |
| * Number of bytes in 'data'. | | * Number of bytes in 'data'. | |
| */ | | */ | |
| size_t data_size; | | size_t data_size; | |
| | | | |
| /** | | /** | |
| * Type of the GNS/DNS record. | | * Type of the GNS/DNS record. | |
| */ | | */ | |
| uint32_t record_type; | | uint32_t record_type; | |
| | | | |
| skipping to change at line 217 | | skipping to change at line 253 | |
| const struct GNUNET_NAMESTORE_RecordData *rd, | | const struct GNUNET_NAMESTORE_RecordData *rd, | |
| const struct GNUNET_CRYPTO_RsaSignature *signat
ure, | | const struct GNUNET_CRYPTO_RsaSignature *signat
ure, | |
| GNUNET_NAMESTORE_ContinuationWithStatus cont, | | GNUNET_NAMESTORE_ContinuationWithStatus cont, | |
| void *cont_cls); | | void *cont_cls); | |
| | | | |
| /** | | /** | |
| * Check if a signature is valid. This API is used by the GNS Block | | * Check if a signature is valid. This API is used by the GNS Block | |
| * to validate signatures received from the network. | | * to validate signatures received from the network. | |
| * | | * | |
| * @param public_key public key of the zone | | * @param public_key public key of the zone | |
|
| * @param expire block expiration | | * @param freshness time set for block expiration | |
| * @param name name that is being mapped (at most 255 characters long) | | * @param name name that is being mapped (at most 255 characters long) | |
| * @param rd_count number of entries in 'rd' array | | * @param rd_count number of entries in 'rd' array | |
| * @param rd array of records with data to store | | * @param rd array of records with data to store | |
| * @param signature signature for all the records in the zone under the giv
en name | | * @param signature signature for all the records in the zone under the giv
en name | |
| * @return GNUNET_OK if the signature is valid | | * @return GNUNET_OK if the signature is valid | |
| */ | | */ | |
| int | | int | |
| GNUNET_NAMESTORE_verify_signature (const struct GNUNET_CRYPTO_RsaPublicKeyB
inaryEncoded *public_key, | | GNUNET_NAMESTORE_verify_signature (const struct GNUNET_CRYPTO_RsaPublicKeyB
inaryEncoded *public_key, | |
| const struct GNUNET_TIME_Absolute freshn
ess, | | const struct GNUNET_TIME_Absolute freshn
ess, | |
| const char *name, | | const char *name, | |
| unsigned int rd_count, | | unsigned int rd_count, | |
| const struct GNUNET_NAMESTORE_RecordData
*rd, | | const struct GNUNET_NAMESTORE_RecordData
*rd, | |
| const struct GNUNET_CRYPTO_RsaSignature
*signature); | | const struct GNUNET_CRYPTO_RsaSignature
*signature); | |
| | | | |
| /** | | /** | |
| * Store an item in the namestore. If the item is already present, | | * Store an item in the namestore. If the item is already present, | |
| * the expiration time is updated to the max of the existing time and | | * the expiration time is updated to the max of the existing time and | |
| * the new time. This API is used by the authority of a zone. | | * the new time. This API is used by the authority of a zone. | |
|
| | | * FIXME: consider allowing to pass multiple records in one call! | |
| * | | * | |
| * @param h handle to the namestore | | * @param h handle to the namestore | |
| * @param pkey private key of the zone | | * @param pkey private key of the zone | |
| * @param name name that is being mapped (at most 255 characters long) | | * @param name name that is being mapped (at most 255 characters long) | |
| * @param rd record data to store | | * @param rd record data to store | |
| * @param cont continuation to call when done | | * @param cont continuation to call when done | |
| * @param cont_cls closure for cont | | * @param cont_cls closure for cont | |
| * @return handle to abort the request | | * @return handle to abort the request | |
| */ | | */ | |
| struct GNUNET_NAMESTORE_QueueEntry * | | struct GNUNET_NAMESTORE_QueueEntry * | |
| | | | |
| skipping to change at line 281 | | skipping to change at line 318 | |
| const char *name, | | const char *name, | |
| const struct GNUNET_NAMESTORE_RecordData *rd
, | | const struct GNUNET_NAMESTORE_RecordData *rd
, | |
| GNUNET_NAMESTORE_ContinuationWithStatus cont
, | | GNUNET_NAMESTORE_ContinuationWithStatus cont
, | |
| void *cont_cls); | | void *cont_cls); | |
| | | | |
| /** | | /** | |
| * Process a record that was stored in the namestore. | | * Process a record that was stored in the namestore. | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param zone_key public key of the zone | | * @param zone_key public key of the zone | |
|
| * @param expire when does the corresponding block in the DHT expire (until | | * @param freshness when does the corresponding block in the DHT expire (un
til | |
| * when should we never do a DHT lookup for the same name aga
in)?; | | * when should we never do a DHT lookup for the same name aga
in)?; | |
| * GNUNET_TIME_UNIT_ZERO_ABS if there are no records of any t
ype in the namestore, | | * GNUNET_TIME_UNIT_ZERO_ABS if there are no records of any t
ype in the namestore, | |
| * or the expiration time of the block in the namestore (even
if there are zero | | * or the expiration time of the block in the namestore (even
if there are zero | |
| * records matching the desired record type) | | * records matching the desired record type) | |
| * @param name name that is being mapped (at most 255 characters long) | | * @param name name that is being mapped (at most 255 characters long) | |
| * @param rd_count number of entries in 'rd' array | | * @param rd_count number of entries in 'rd' array | |
| * @param rd array of records with data to store | | * @param rd array of records with data to store | |
| * @param signature signature of the record block, NULL if signature is una
vailable (i.e. | | * @param signature signature of the record block, NULL if signature is una
vailable (i.e. | |
| * because the user queried for a particular record type only) | | * because the user queried for a particular record type only) | |
| */ | | */ | |
| typedef void (*GNUNET_NAMESTORE_RecordProcessor) (void *cls, | | typedef void (*GNUNET_NAMESTORE_RecordProcessor) (void *cls, | |
| const struct GNUNET_CRYPTO
_RsaPublicKeyBinaryEncoded *zone_key, | | const struct GNUNET_CRYPTO
_RsaPublicKeyBinaryEncoded *zone_key, | |
| struct GNUNET_TIME_Absolut
e freshness, | | struct GNUNET_TIME_Absolut
e freshness, | |
| const char *name, | | const char *name, | |
| unsigned int rd_len, | | unsigned int rd_len, | |
| const struct GNUNET_NAMEST
ORE_RecordData *rd, | | const struct GNUNET_NAMEST
ORE_RecordData *rd, | |
| const struct GNUNET_CRYPTO
_RsaSignature *signature); | | const struct GNUNET_CRYPTO
_RsaSignature *signature); | |
| | | | |
| /** | | /** | |
| * Get a result for a particular key from the namestore. The processor | | * Get a result for a particular key from the namestore. The processor | |
|
| * will only be called once. | | * will only be called once. When using this functions, relative expiratio | |
| | | n | |
| | | * times will be converted to absolute expiration times and a signature | |
| | | * will be created if we are the authority. The record data and signature | |
| | | * passed to 'proc' is thus always suitable for passing on to other peers | |
| | | * (if we are the authority). If the record type is NOT set to 'ANY' and | |
| | | * if we are NOT the authority, then non-matching records may be omitted | |
| | | * from the result and no valid signature can be created; in this case, | |
| | | * 'signature' will be NULL and the result cannot be given to other peers. | |
| * | | * | |
| * @param h handle to the namestore | | * @param h handle to the namestore | |
| * @param zone zone to look up a record from | | * @param zone zone to look up a record from | |
| * @param name name to look up | | * @param name name to look up | |
| * @param record_type desired record type, 0 for all | | * @param record_type desired record type, 0 for all | |
| * @param proc function to call on the matching records, or with | | * @param proc function to call on the matching records, or with | |
| * NULL (rd_count == 0) if there are no matching records | | * NULL (rd_count == 0) if there are no matching records | |
| * @param proc_cls closure for proc | | * @param proc_cls closure for proc | |
| * @return a handle that can be used to | | * @return a handle that can be used to | |
| * cancel | | * cancel | |
| */ | | */ | |
| struct GNUNET_NAMESTORE_QueueEntry * | | struct GNUNET_NAMESTORE_QueueEntry * | |
| GNUNET_NAMESTORE_lookup_record (struct GNUNET_NAMESTORE_Handle *h, | | GNUNET_NAMESTORE_lookup_record (struct GNUNET_NAMESTORE_Handle *h, | |
|
| const struct GNUNET_CRYPTO_ShortHashCode *zone | | const struct GNUNET_CRYPTO_ShortHashCode *zo | |
| , | | ne, | |
| const char *name, | | const char *name, | |
| uint32_t record_type, | | uint32_t record_type, | |
| GNUNET_NAMESTORE_RecordProcessor proc, void *p | | GNUNET_NAMESTORE_RecordProcessor proc, void | |
| roc_cls); | | *proc_cls); | |
| | | | |
| /** | | /** | |
| * Look for an existing PKEY delegation record for a given public key. | | * Look for an existing PKEY delegation record for a given public key. | |
| * Returns at most one result to the processor. | | * Returns at most one result to the processor. | |
| * | | * | |
| * @param h handle to the namestore | | * @param h handle to the namestore | |
| * @param zone hash of public key of the zone to look up in, never NULL | | * @param zone hash of public key of the zone to look up in, never NULL | |
| * @param value_zone hash of the public key of the target zone (value), nev
er NULL | | * @param value_zone hash of the public key of the target zone (value), nev
er NULL | |
| * @param proc function to call on the matching records, or with | | * @param proc function to call on the matching records, or with | |
| * NULL (rd_count == 0) if there are no matching records | | * NULL (rd_count == 0) if there are no matching records | |
| | | | |
| skipping to change at line 342 | | skipping to change at line 386 | |
| * cancel | | * cancel | |
| */ | | */ | |
| struct GNUNET_NAMESTORE_QueueEntry * | | struct GNUNET_NAMESTORE_QueueEntry * | |
| GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, | | GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, | |
| const struct GNUNET_CRYPTO_ShortHashCode *zon
e, | | const struct GNUNET_CRYPTO_ShortHashCode *zon
e, | |
| const struct GNUNET_CRYPTO_ShortHashCode *val
ue_zone, | | const struct GNUNET_CRYPTO_ShortHashCode *val
ue_zone, | |
| GNUNET_NAMESTORE_RecordProcessor proc, void *
proc_cls); | | GNUNET_NAMESTORE_RecordProcessor proc, void *
proc_cls); | |
| | | | |
| /** | | /** | |
| * Starts a new zone iteration (used to periodically PUT all of our | | * Starts a new zone iteration (used to periodically PUT all of our | |
|
| * records into our DHT). "proc" will be called once | | * records into our DHT). "proc" will be called once immediately, and | |
| * immediately, and then again after | | * then again after "GNUNET_NAMESTORE_zone_iterator_next" is invoked. | |
| * "GNUNET_NAMESTORE_zone_iterator_next" is invoked. | | * | |
| | | * By specifying a 'zone' of NULL and setting 'GNUNET_NAMESTORE_RF_AUTHORIT | |
| | | Y' | |
| | | * in 'must_have_flags', we can iterate over all records for which we are | |
| | | * the authority (the 'authority' flag will NOT be set in the returned | |
| | | * records anyway). | |
| | | * | |
| | | * The 'GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION' | |
| | | * bit in 'must_have_flags' has a special meaning: | |
| | | * | |
| | | * 0) If the bit is clear, all relative expriation times are converted to | |
| | | * absolute expiration times. This is useful for performing DHT PUT | |
| | | * operations (and zone transfers) of our zone. The generated signature | |
| | | s | |
| | | * will be valid for other peers. | |
| | | * 1) if it is set, it means that relative expiration times should be | |
| | | * preserved when returned (this is useful for the zone editor user | |
| | | * interface). No signatures will be created in this case, as | |
| | | * signatures must not cover records with relative expiration times. | |
| | | * | |
| | | * Note that not all queries against this interface are equally performant | |
| | | * as for some combinations no efficient index may exist. | |
| * | | * | |
| * @param h handle to the namestore | | * @param h handle to the namestore | |
| * @param zone zone to access, NULL for all zones | | * @param zone zone to access, NULL for all zones | |
| * @param must_have_flags flags that must be set for the record to be retur
ned | | * @param must_have_flags flags that must be set for the record to be retur
ned | |
| * @param must_not_have_flags flags that must NOT be set for the record to
be returned | | * @param must_not_have_flags flags that must NOT be set for the record to
be returned | |
| * @param proc function to call on each name from the zone; it | | * @param proc function to call on each name from the zone; it | |
| * will be called repeatedly with a value (if available) | | * will be called repeatedly with a value (if available) | |
| * and always once at the end with a name of NULL. | | * and always once at the end with a name of NULL. | |
| * @param proc_cls closure for proc | | * @param proc_cls closure for proc | |
| * @return an iterator handle to use for iteration | | * @return an iterator handle to use for iteration | |
| | | | |
| skipping to change at line 374 | | skipping to change at line 437 | |
| /** | | /** | |
| * Calls the record processor specified in GNUNET_NAMESTORE_zone_iteration_
start | | * Calls the record processor specified in GNUNET_NAMESTORE_zone_iteration_
start | |
| * for the next record. | | * for the next record. | |
| * | | * | |
| * @param it the iterator | | * @param it the iterator | |
| */ | | */ | |
| void | | void | |
| GNUNET_NAMESTORE_zone_iterator_next (struct GNUNET_NAMESTORE_ZoneIterator *
it); | | GNUNET_NAMESTORE_zone_iterator_next (struct GNUNET_NAMESTORE_ZoneIterator *
it); | |
| | | | |
| /** | | /** | |
|
| * Stops iteration and releases the namestore handle for further calls. | | * Stops iteration and releases the namestore handle for further calls. Mu | |
| | | st | |
| | | * be called on any iteration that has not yet completed prior to calling | |
| | | * 'GNUNET_NAMESTORE_disconnect'. | |
| * | | * | |
| * @param it the iterator | | * @param it the iterator | |
| */ | | */ | |
| void | | void | |
| GNUNET_NAMESTORE_zone_iteration_stop (struct GNUNET_NAMESTORE_ZoneIterator
*it); | | GNUNET_NAMESTORE_zone_iteration_stop (struct GNUNET_NAMESTORE_ZoneIterator
*it); | |
| | | | |
| /** | | /** | |
| * Cancel a namestore operation. The final callback from the | | * Cancel a namestore operation. The final callback from the | |
|
| * operation must not have been done yet. | | * operation must not have been done yet. Must be called on any | |
| | | * namestore operation that has not yet completed prior to calling | |
| | | * 'GNUNET_NAMESTORE_disconnect'. | |
| * | | * | |
| * @param qe operation to cancel | | * @param qe operation to cancel | |
| */ | | */ | |
| void | | void | |
| GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe); | | GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe); | |
| | | | |
| /* convenience APIs for serializing / deserializing GNS records */ | | /* convenience APIs for serializing / deserializing GNS records */ | |
| | | | |
| /** | | /** | |
| * Calculate how many bytes we will need to serialize the given | | * Calculate how many bytes we will need to serialize the given | |
| | | | |
| skipping to change at line 414 | | skipping to change at line 481 | |
| const struct GNUNET_NAMESTORE_RecordData
*rd); | | const struct GNUNET_NAMESTORE_RecordData
*rd); | |
| | | | |
| /** | | /** | |
| * Serialize the given records to the given destination buffer. | | * Serialize the given records to the given destination buffer. | |
| * | | * | |
| * @param rd_count number of records in the rd array | | * @param rd_count number of records in the rd array | |
| * @param rd array of GNUNET_NAMESTORE_RecordData with rd_count elements | | * @param rd array of GNUNET_NAMESTORE_RecordData with rd_count elements | |
| * @param dest_size size of the destination array | | * @param dest_size size of the destination array | |
| * @param dest where to write the result | | * @param dest where to write the result | |
| * | | * | |
|
| * @return the size of serialized records | | * @return the size of serialized records, -1 if records do not fit | |
| */ | | */ | |
| ssize_t | | ssize_t | |
| GNUNET_NAMESTORE_records_serialize (unsigned int rd_count, | | GNUNET_NAMESTORE_records_serialize (unsigned int rd_count, | |
| const struct GNUNET_NAMESTORE_RecordData
*rd, | | const struct GNUNET_NAMESTORE_RecordData
*rd, | |
| size_t dest_size, | | size_t dest_size, | |
| char *dest); | | char *dest); | |
| | | | |
| /** | | /** | |
| * Deserialize the given records to the given destination. | | * Deserialize the given records to the given destination. | |
| * | | * | |
| | | | |
| skipping to change at line 439 | | skipping to change at line 506 | |
| * | | * | |
| * @return GNUNET_OK on success, GNUNET_SYSERR on error | | * @return GNUNET_OK on success, GNUNET_SYSERR on error | |
| */ | | */ | |
| int | | int | |
| GNUNET_NAMESTORE_records_deserialize (size_t len, | | GNUNET_NAMESTORE_records_deserialize (size_t len, | |
| const char *src, | | const char *src, | |
| unsigned int rd_count, | | unsigned int rd_count, | |
| struct GNUNET_NAMESTORE_RecordData *de
st); | | struct GNUNET_NAMESTORE_RecordData *de
st); | |
| | | | |
| /** | | /** | |
|
| * Checks if a name is wellformed | | | |
| * | | | |
| * @param name the name to check | | | |
| * @return GNUNET_OK on success, GNUNET_SYSERR on error | | | |
| */ | | | |
| int | | | |
| GNUNET_NAMESTORE_check_name (const char * name); | | | |
| | | | |
| /** | | | |
| * Convert the 'value' of a record to a string. | | * Convert the 'value' of a record to a string. | |
| * | | * | |
| * @param type type of the record | | * @param type type of the record | |
| * @param data value in binary encoding | | * @param data value in binary encoding | |
| * @param data_size number of bytes in data | | * @param data_size number of bytes in data | |
| * @return NULL on error, otherwise human-readable representation of the va
lue | | * @return NULL on error, otherwise human-readable representation of the va
lue | |
| */ | | */ | |
| char * | | char * | |
| GNUNET_NAMESTORE_value_to_string (uint32_t type, | | GNUNET_NAMESTORE_value_to_string (uint32_t type, | |
| const void *data, | | const void *data, | |
| | | | |
| skipping to change at line 494 | | skipping to change at line 552 | |
| | | | |
| /** | | /** | |
| * Convert a type number (i.e. 1) to the corresponding type string (i.e. "A
") | | * Convert a type number (i.e. 1) to the corresponding type string (i.e. "A
") | |
| * | | * | |
| * @param type number of a type to convert | | * @param type number of a type to convert | |
| * @return corresponding typestring, NULL on error | | * @return corresponding typestring, NULL on error | |
| */ | | */ | |
| const char * | | const char * | |
| GNUNET_NAMESTORE_number_to_typename (uint32_t type); | | GNUNET_NAMESTORE_number_to_typename (uint32_t type); | |
| | | | |
|
| | | /** | |
| | | * Test if a given record is expired. | |
| | | * | |
| | | * @return GNUNET_YES if the record is expired, | |
| | | * GNUNET_NO if not | |
| | | */ | |
| | | int | |
| | | GNUNET_NAMESTORE_is_expired (const struct GNUNET_NAMESTORE_RecordData *rd); | |
| | | | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| { | | { | |
| #endif | | #endif | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| /* end of gnunet_namestore_service.h */ | | /* end of gnunet_namestore_service.h */ | |
| #endif | | #endif | |
| | | | |
End of changes. 20 change blocks. |
| 31 lines changed or deleted | | 104 lines changed or added | |
|
| gnunet_protocols.h | | gnunet_protocols.h | |
| | | | |
| skipping to change at line 783 | | skipping to change at line 783 | |
| * Request the destuction of a path | | * Request the destuction of a path | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_MESH_PATH_DESTROY 265 | | #define GNUNET_MESSAGE_TYPE_MESH_PATH_DESTROY 265 | |
| | | | |
| /** | | /** | |
| * Request the destruction of a whole tunnel | | * Request the destruction of a whole tunnel | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY 266 | | #define GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY 266 | |
| | | | |
| /** | | /** | |
|
| * We need flow control | | * ACK for a data packet. | |
| */ | | */ | |
|
| #define GNUNET_MESSAGE_TYPE_MESH_SPEED_NOTIFY 270 | | #define GNUNET_MESSAGE_TYPE_MESH_ACK 267 | |
| | | | |
| | | /** | |
| | | * Poll for an ACK. | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_MESH_POLL 268 | |
| | | | |
| /** | | /** | |
| * Connect to the mesh service, specifying subscriptions | | * Connect to the mesh service, specifying subscriptions | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT 272 | | #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT 272 | |
| | | | |
| /** | | /** | |
| * Ask the mesh service to create a new tunnel | | * Ask the mesh service to create a new tunnel | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATE 273 | | #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATE 273 | |
| | | | |
| skipping to change at line 818 | | skipping to change at line 823 | |
| * Ask the mesh service to remove a peer from a tunnel | | * Ask the mesh service to remove a peer from a tunnel | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_DEL 276 | | #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_DEL 276 | |
| | | | |
| /** | | /** | |
| * Ask the mesh service to add a peer offering a service to an existing tun
nel | | * Ask the mesh service to add a peer offering a service to an existing tun
nel | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_ADD_BY_TYPE 277 | | #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_ADD_BY_TYPE 277 | |
| | | | |
| /** | | /** | |
|
| | | * Ask the mesh service to add a peer described by a service string | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_ANNOUNCE_REGEX 278 | |
| | | | |
| | | /** | |
| | | * Ask the mesh service to add a peer described by a service string | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_ADD_BY_STRING 279 | |
| | | | |
| | | /** | |
| | | * Ask the mesh service to add a peer to the blacklist of an existing tunne | |
| | | l | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_BLACKLIST 280 | |
| | | | |
| | | /** | |
| | | * Ask the mesh service to remove a peer from the blacklist of a tunnel | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_UNBLACKLIST 281 | |
| | | | |
| | | /** | |
| | | * Set tunnel speed to slowest peer | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_MIN 282 | |
| | | | |
| | | /** | |
| | | * Set tunnel speed to fastest peer | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_MAX 283 | |
| | | | |
| | | /** | |
| | | * Set tunnel buffering on. | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_BUFFER 284 | |
| | | | |
| | | /** | |
| | | * Set tunnel buffering off. | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_NOBUFFER 285 | |
| | | | |
| | | /** | |
| | | * Local ACK for data. | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK 286 | |
| | | | |
| | | /** | |
| * 640kb should be enough for everybody | | * 640kb should be enough for everybody | |
| */ | | */ | |
|
| #define GNUNET_MESSAGE_TYPE_MESH_RESERVE_END 288 | | #define GNUNET_MESSAGE_TYPE_MESH_RESERVE_END 299 | |
| | | | |
| /**************************************************************************
***** | | /**************************************************************************
***** | |
| * CHAT message types START | | * CHAT message types START | |
| **************************************************************************
****/ | | **************************************************************************
****/ | |
| | | | |
| /** | | /** | |
| * Message sent from client to join a chat room. | | * Message sent from client to join a chat room. | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_CHAT_JOIN_REQUEST 300 | | #define GNUNET_MESSAGE_TYPE_CHAT_JOIN_REQUEST 300 | |
| | | | |
| | | | |
| skipping to change at line 1022 | | skipping to change at line 1072 | |
| * to confirm that an address is used or not used anymore | | * to confirm that an address is used or not used anymore | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_ATS_ADDRESS_IN_USE 351 | | #define GNUNET_MESSAGE_TYPE_ATS_ADDRESS_IN_USE 351 | |
| | | | |
| /** | | /** | |
| * Type of the 'struct AddressUseMessage' sent by ATS to client | | * Type of the 'struct AddressUseMessage' sent by ATS to client | |
| * to confirm that an address is used or not used anymore | | * to confirm that an address is used or not used anymore | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_ATS_RESET_BACKOFF 352 | | #define GNUNET_MESSAGE_TYPE_ATS_RESET_BACKOFF 352 | |
| | | | |
|
| | | /** | |
| | | * Type of the 'struct AddressUpdateMessage' sent by client to ATS | |
| | | * to add a new address | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_ATS_ADDRESS_ADD 353 | |
| | | | |
| /**************************************************************************
***** | | /**************************************************************************
***** | |
| * TRANSPORT message types | | * TRANSPORT message types | |
| **************************************************************************
****/ | | **************************************************************************
****/ | |
| | | | |
| /** | | /** | |
| * Message from the core saying that the transport | | * Message from the core saying that the transport | |
| * server should start giving it messages. This | | * server should start giving it messages. This | |
| * should automatically trigger the transmission of | | * should automatically trigger the transmission of | |
| * a HELLO message. | | * a HELLO message. | |
| */ | | */ | |
| | | | |
| skipping to change at line 1163 | | skipping to change at line 1219 | |
| * Request to iterate over all known addresses. | | * Request to iterate over all known addresses. | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE 383 | | #define GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE 383 | |
| | | | |
| /** | | /** | |
| * Message send by a peer to notify the other to keep the session alive. | | * Message send by a peer to notify the other to keep the session alive. | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON 384 | | #define GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON 384 | |
| | | | |
| /**************************************************************************
***** | | /**************************************************************************
***** | |
|
| * STREAM LIRBRARY MESSAGES | | * STREAM messages types | |
| **************************************************************************
****/ | | **************************************************************************
****/ | |
| | | | |
| /** | | /** | |
| * Message containing data exchanged between stream end-points over mesh. | | * Message containing data exchanged between stream end-points over mesh. | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_STREAM_DATA 400 | | #define GNUNET_MESSAGE_TYPE_STREAM_DATA 400 | |
| | | | |
| /** | | /** | |
| * ACK message | | * ACK message | |
| */ | | */ | |
| | | | |
| skipping to change at line 1267 | | skipping to change at line 1323 | |
| /** | | /** | |
| * Signal that helper is done. | | * Signal that helper is done. | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_FINISHED 426 | | #define GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_FINISHED 426 | |
| | | | |
| /**************************************************************************
***** | | /**************************************************************************
***** | |
| * NAMESTORE message types | | * NAMESTORE message types | |
| **************************************************************************
****/ | | **************************************************************************
****/ | |
| | | | |
| /** | | /** | |
|
| * Request update and listing of a peer. | | * Client to service: register. | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_NAMESTORE_START 430 | | #define GNUNET_MESSAGE_TYPE_NAMESTORE_START 430 | |
| | | | |
|
| | | /** | |
| | | * Client to service: lookup name | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME 431 | |
| | | | |
| | | /** | |
| | | * Service to client: result of name lookup | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE 432 | |
| | | | |
| | | /** | |
| | | * Client to service: put records (for caching) | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT 433 | |
| | | | |
| | | /** | |
| | | * Service to client: result of put operation. | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE 434 | |
| | | | |
| | | /** | |
| | | * Client to service: create record as authority | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE 435 | |
| | | | |
| | | /** | |
| | | * Service to client: result of record creation request | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE_RESPONSE 436 | |
| | | | |
| | | /** | |
| | | * Client to service: remove record(s) | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE 437 | |
| | | | |
| | | /** | |
| | | * Service to client: result of removal request. | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE_RESPONSE 438 | |
| | | | |
| | | /** | |
| | | * Client to service: "reverse" lookup for zone name based on zone key | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME 439 | |
| | | | |
| | | /** | |
| | | * Service to client: result of zone-to-name lookup. | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE 440 | |
| | | | |
| | | /** | |
| | | * Client to service: please start iteration | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START 445 | |
| | | | |
| | | /** | |
| | | * Service to client: current record in iteration (or end of list). | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE 446 | |
| | | | |
| | | /** | |
| | | * Client to service: next record in iteration please. | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT 447 | |
| | | | |
| | | /** | |
| | | * Client to service: stop iterating. | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP 448 | |
| | | | |
| /**************************************************************************
***** | | /**************************************************************************
***** | |
| * LOCKMANAGER message types | | * LOCKMANAGER message types | |
| **************************************************************************
****/ | | **************************************************************************
****/ | |
| | | | |
| /** | | /** | |
| * Message to acquire Lock | | * Message to acquire Lock | |
| */ | | */ | |
|
| #define GNUNET_MESSAGE_TYPE_LOCKMANAGER_ACQUIRE 440 | | #define GNUNET_MESSAGE_TYPE_LOCKMANAGER_ACQUIRE 450 | |
| | | | |
| /** | | /** | |
| * Message to release lock | | * Message to release lock | |
| */ | | */ | |
|
| #define GNUNET_MESSAGE_TYPE_LOCKMANAGER_RELEASE 441 | | #define GNUNET_MESSAGE_TYPE_LOCKMANAGER_RELEASE 451 | |
| | | | |
| /** | | /** | |
| * SUCESS reply from lockmanager | | * SUCESS reply from lockmanager | |
| */ | | */ | |
|
| #define GNUNET_MESSAGE_TYPE_LOCKMANAGER_SUCCESS 442 | | #define GNUNET_MESSAGE_TYPE_LOCKMANAGER_SUCCESS 452 | |
| | | | |
| | | /************************************************************************** | |
| | | ***** | |
| | | * TESTBED message types | |
| | | ************************************************************************** | |
| | | ****/ | |
| | | | |
| | | /** | |
| | | * Initial message from a client to a testing control service | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_INIT 460 | |
| | | | |
| | | /** | |
| | | * Message to add host | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_ADDHOST 461 | |
| | | | |
| | | /** | |
| | | * Message to signal that a add host succeeded | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM 462 | |
| | | | |
| | | /** | |
| | | * Message to configure a service to be shared among peers | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_SERVICESHARE 463 | |
| | | | |
| | | /** | |
| | | * Message to link delegated controller to slave controller | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_LCONTROLLERS 464 | |
| | | | |
| | | /** | |
| | | * Message to create a peer at a host | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_CREATEPEER 465 | |
| | | | |
| | | /** | |
| | | * Message to reconfigure a peer | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_PEERRECONF 466 | |
| | | | |
| | | /** | |
| | | * Message to start a peer at a host | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_STARTPEER 467 | |
| | | | |
| | | /** | |
| | | * Message to stop a peer at a host | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_STOPPEER 468 | |
| | | | |
| | | /** | |
| | | * Message to destroy a peer | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER 469 | |
| | | | |
| | | /** | |
| | | * Configure underlay link message | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_CONFIGULLINK 470 | |
| | | | |
| | | /** | |
| | | * Message to connect peers in a overlay | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_OLCONNECT 471 | |
| | | | |
| | | /** | |
| | | * Message for peer events | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_PEEREVENT 472 | |
| | | | |
| | | /** | |
| | | * Message for peer connect events | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_PEERCONEVENT 473 | |
| | | | |
| | | /** | |
| | | * Message for operation events | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_OPERATIONFAILEVENT 474 | |
| | | | |
| | | /** | |
| | | * Message to signal successful peer creation | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_PEERCREATESUCCESS 475 | |
| | | | |
| | | /** | |
| | | * Message to signal a generic operation has been successful | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_GENERICOPSUCCESS 476 | |
| | | | |
| | | /** | |
| | | * Message to get the configuration of a peer | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_GETPEERCONFIG 477 | |
| | | | |
| | | /** | |
| | | * Message containing the peer configuration | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_PEERCONFIG 478 | |
| | | | |
| | | /** | |
| | | * Message to request a controller to make one of its peer to connect to an | |
| | | other | |
| | | * peer using the contained HELLO | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_REQUESTCONNECT 479 | |
| | | | |
| | | /** | |
| | | * Message to cancel a REQUESTCONNECT request | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_REQUESTCONNECTCANCEL 480 | |
| | | | |
| | | /** | |
| | | * Message to request configuration of a slave controller | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_GETSLAVECONFIG 481 | |
| | | | |
| | | /** | |
| | | * Message which contains the configuration of slave controller | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG 482 | |
| | | | |
| | | /** | |
| | | * Not really a message, but for careful checks on the testbed messages; Sh | |
| | | ould | |
| | | * always be the maximum and never be used to send messages with this type | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_MAX 483 | |
| | | | |
| | | /** | |
| | | * The initialization message towards gnunet-testbed-helper | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT 495 | |
| | | | |
| | | /** | |
| | | * The reply message from gnunet-testbed-helper | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_TESTBED_HELPER_REPLY 496 | |
| | | | |
| | | /** | |
| | | * GNS. FIXME: document! | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_GNS_LOOKUP 500 | |
| | | | |
| | | #define GNUNET_MESSAGE_TYPE_GNS_LOOKUP_RESULT 501 | |
| | | | |
| | | #define GNUNET_MESSAGE_TYPE_GNS_SHORTEN 502 | |
| | | | |
| | | #define GNUNET_MESSAGE_TYPE_GNS_SHORTEN_RESULT 503 | |
| | | | |
| | | #define GNUNET_MESSAGE_TYPE_GNS_GET_AUTH 504 | |
| | | | |
| | | #define GNUNET_MESSAGE_TYPE_GNS_GET_AUTH_RESULT 505 | |
| | | | |
| /** | | /** | |
|
| * Next available: 450 | | * Next available: 520 | |
| */ | | */ | |
| | | | |
| /**************************************************************************
***** | | /**************************************************************************
***** | |
| * TODO: we need a way to register message types centrally (via some webpag
e). | | * TODO: we need a way to register message types centrally (via some webpag
e). | |
| * For now: unofficial extensions should start at 48k, internal extensions | | * For now: unofficial extensions should start at 48k, internal extensions | |
| * define here should leave some room (4-10 additional messages to the prev
ious | | * define here should leave some room (4-10 additional messages to the prev
ious | |
| * extension). | | * extension). | |
| **************************************************************************
****/ | | **************************************************************************
****/ | |
| | | | |
| /** | | /** | |
| | | | |
End of changes. 12 change blocks. |
| 9 lines changed or deleted | | 291 lines changed or added | |
|
| gnunet_strings_lib.h | | gnunet_strings_lib.h | |
| /* | | /* | |
| This file is part of GNUnet. | | This file is part of GNUnet. | |
|
| (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 Christian Grothoff
(and other contributing authors) | | (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2012 Christian Gro
thoff (and other contributing authors) | |
| | | | |
| GNUnet is free software; you can redistribute it and/or modify | | GNUnet is free software; you can redistribute it and/or modify | |
| it under the terms of the GNU General Public License as published | | it under the terms of the GNU General Public License as published | |
| by the Free Software Foundation; either version 2, or (at your | | by the Free Software Foundation; either version 2, or (at your | |
| option) any later version. | | option) any later version. | |
| | | | |
| GNUnet is distributed in the hope that it will be useful, but | | GNUnet is distributed in the hope that it will be useful, but | |
| WITHOUT ANY WARRANTY; without even the implied warranty of | | WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| General Public License for more details. | | General Public License for more details. | |
| | | | |
| skipping to change at line 76 | | skipping to change at line 76 | |
| * | | * | |
| * @param fancy_time human readable string (i.e. 1 minute) | | * @param fancy_time human readable string (i.e. 1 minute) | |
| * @param rtime set to the relative time | | * @param rtime set to the relative time | |
| * @return GNUNET_OK on success, GNUNET_SYSERR on error | | * @return GNUNET_OK on success, GNUNET_SYSERR on error | |
| */ | | */ | |
| int | | int | |
| GNUNET_STRINGS_fancy_time_to_relative (const char *fancy_time, | | GNUNET_STRINGS_fancy_time_to_relative (const char *fancy_time, | |
| struct GNUNET_TIME_Relative *rtime); | | struct GNUNET_TIME_Relative *rtime); | |
| | | | |
| /** | | /** | |
|
| | | * Convert a given fancy human-readable time to our internal | |
| | | * representation. | |
| | | * | |
| | | * @param fancy_time human readable string (i.e. %Y-%m-%d %H:%M:%S) | |
| | | * @param atime set to the absolute time | |
| | | * @return GNUNET_OK on success, GNUNET_SYSERR on error | |
| | | */ | |
| | | int | |
| | | GNUNET_STRINGS_fancy_time_to_absolute (const char *fancy_time, | |
| | | struct GNUNET_TIME_Absolute *atime); | |
| | | | |
| | | /** | |
| * Convert a given filesize into a fancy human-readable format. | | * Convert a given filesize into a fancy human-readable format. | |
| * | | * | |
| * @param size number of bytes | | * @param size number of bytes | |
| * @return fancy representation of the size (possibly rounded) for humans | | * @return fancy representation of the size (possibly rounded) for humans | |
| */ | | */ | |
| char * | | char * | |
| GNUNET_STRINGS_byte_size_fancy (unsigned long long size); | | GNUNET_STRINGS_byte_size_fancy (unsigned long long size); | |
| | | | |
| /** | | /** | |
| * Convert the len characters long character sequence | | * Convert the len characters long character sequence | |
| * given in input that is in the given input charset | | * given in input that is in the given input charset | |
| * to a string in given output charset. | | * to a string in given output charset. | |
| * @return the converted string (0-terminated), | | * @return the converted string (0-terminated), | |
| * if conversion fails, a copy of the orignal | | * if conversion fails, a copy of the orignal | |
| * string is returned. | | * string is returned. | |
| */ | | */ | |
| char * | | char * | |
| GNUNET_STRINGS_conv (const char *input, size_t len, | | GNUNET_STRINGS_conv (const char *input, size_t len, | |
|
| const char *input_charset, const char *output_charset); | | const char *input_charset, | |
| | | const char *output_charset); | |
| | | | |
| /** | | /** | |
| * Convert the len characters long character sequence | | * Convert the len characters long character sequence | |
| * given in input that is in the given charset | | * given in input that is in the given charset | |
| * to UTF-8. | | * to UTF-8. | |
| * | | * | |
| * @param input the input string (not necessarily 0-terminated) | | * @param input the input string (not necessarily 0-terminated) | |
| * @param len the number of bytes in the input | | * @param len the number of bytes in the input | |
| * @param charset character set to convert from | | * @param charset character set to convert from | |
| * @return the converted string (0-terminated) | | * @return the converted string (0-terminated) | |
| */ | | */ | |
| char * | | char * | |
|
| GNUNET_STRINGS_to_utf8 (const char *input, size_t len, const char *charset) | | GNUNET_STRINGS_to_utf8 (const char *input, | |
| ; | | size_t len, | |
| | | const char *charset); | |
| | | | |
| /** | | /** | |
| * Convert the len bytes-long UTF-8 string | | * Convert the len bytes-long UTF-8 string | |
| * given in input to the given charset. | | * given in input to the given charset. | |
| | | | |
| * @return the converted string (0-terminated), | | * @return the converted string (0-terminated), | |
| * if conversion fails, a copy of the orignal | | * if conversion fails, a copy of the orignal | |
| * string is returned. | | * string is returned. | |
| */ | | */ | |
| char * | | char * | |
|
| GNUNET_STRINGS_from_utf8 (const char *input, size_t len, const char *charse | | GNUNET_STRINGS_from_utf8 (const char *input, | |
| t); | | size_t len, | |
| | | const char *charset); | |
| | | | |
| /** | | /** | |
| * Convert the utf-8 input string to lowercase | | * Convert the utf-8 input string to lowercase | |
| * Output needs to be allocated appropriately | | * Output needs to be allocated appropriately | |
| * | | * | |
| * @param input input string | | * @param input input string | |
| * @param output output buffer | | * @param output output buffer | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_STRINGS_utf8_tolower(const char* input, char** output); | | GNUNET_STRINGS_utf8_tolower (const char* input, | |
| | | char** output); | |
| | | | |
| /** | | /** | |
| * Convert the utf-8 input string to lowercase | | * Convert the utf-8 input string to lowercase | |
| * Output needs to be allocated appropriately | | * Output needs to be allocated appropriately | |
| * | | * | |
| * @param input input string | | * @param input input string | |
| * @param output output buffer | | * @param output output buffer | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_STRINGS_utf8_toupper(const char* input, char** output); | | GNUNET_STRINGS_utf8_toupper (const char* input, | |
| | | char** output); | |
| | | | |
| /** | | /** | |
| * Complete filename (a la shell) from abbrevition. | | * Complete filename (a la shell) from abbrevition. | |
| * | | * | |
| * @param fil the name of the file, may contain ~/ or | | * @param fil the name of the file, may contain ~/ or | |
| * be relative to the current directory | | * be relative to the current directory | |
| * @return the full file name, | | * @return the full file name, | |
| * NULL is returned on error | | * NULL is returned on error | |
| */ | | */ | |
| char * | | char * | |
| GNUNET_STRINGS_filename_expand (const char *fil); | | GNUNET_STRINGS_filename_expand (const char *fil); | |
| | | | |
| /** | | /** | |
|
| * Fill a buffer of the given size with | | * Fill a buffer of the given size with count 0-terminated strings | |
| * count 0-terminated strings (given as varargs). | | * (given as varargs). If "buffer" is NULL, only compute the amount | |
| * If "buffer" is NULL, only compute the amount of | | * of space required (sum of "strlen(arg)+1"). | |
| * space required (sum of "strlen(arg)+1"). | | * | |
| * | | * Unlike using "snprintf" with "%s", this function will add | |
| * Unlike using "snprintf" with "%s", this function | | * 0-terminators after each string. The | |
| * will add 0-terminators after each string. The | | * "GNUNET_string_buffer_tokenize" function can be used to parse the | |
| * "GNUNET_string_buffer_tokenize" function can be | | * buffer back into individual strings. | |
| * used to parse the buffer back into individual | | | |
| * strings. | | | |
| * | | * | |
| * @param buffer the buffer to fill with strings, can | | * @param buffer the buffer to fill with strings, can | |
| * be NULL in which case only the necessary | | * be NULL in which case only the necessary | |
| * amount of space will be calculated | | * amount of space will be calculated | |
| * @param size number of bytes available in buffer | | * @param size number of bytes available in buffer | |
| * @param count number of strings that follow | | * @param count number of strings that follow | |
| * @param ... count 0-terminated strings to copy to buffer | | * @param ... count 0-terminated strings to copy to buffer | |
| * @return number of bytes written to the buffer | | * @return number of bytes written to the buffer | |
| * (or number of bytes that would have been written) | | * (or number of bytes that would have been written) | |
| */ | | */ | |
| size_t | | size_t | |
|
| GNUNET_STRINGS_buffer_fill (char *buffer, size_t size, unsigned int count, | | GNUNET_STRINGS_buffer_fill (char *buffer, | |
| ...); | | size_t size, | |
| | | unsigned int count, | |
| | | ...); | |
| | | | |
| /** | | /** | |
|
| * Given a buffer of a given size, find "count" | | * Given a buffer of a given size, find "count" 0-terminated strings | |
| * 0-terminated strings in the buffer and assign | | * in the buffer and assign the count (varargs) of type "const char**" | |
| * the count (varargs) of type "const char**" to the | | * to the locations of the respective strings in the buffer. | |
| * locations of the respective strings in the | | | |
| * buffer. | | | |
| * | | * | |
| * @param buffer the buffer to parse | | * @param buffer the buffer to parse | |
| * @param size size of the buffer | | * @param size size of the buffer | |
| * @param count number of strings to locate | | * @param count number of strings to locate | |
| * @param ... pointers to where to store the strings | | * @param ... pointers to where to store the strings | |
| * @return offset of the character after the last 0-termination | | * @return offset of the character after the last 0-termination | |
| * in the buffer, or 0 on error. | | * in the buffer, or 0 on error. | |
| */ | | */ | |
| unsigned int | | unsigned int | |
| GNUNET_STRINGS_buffer_tokenize (const char *buffer, size_t size, | | GNUNET_STRINGS_buffer_tokenize (const char *buffer, size_t size, | |
| unsigned int count, ...); | | unsigned int count, ...); | |
| | | | |
| /** | | /** | |
|
| * "man ctime_r", except for GNUnet time; also, unlike ctime, the | | * "asctime", except for GNUnet time. | |
| * return value does not include the newline character. | | * This is one of the very few calls in the entire API that is | |
| | | * NOT reentrant! | |
| * | | * | |
| * @param t the absolute time to convert | | * @param t the absolute time to convert | |
| * @return timestamp in human-readable form | | * @return timestamp in human-readable form | |
| */ | | */ | |
|
| char * | | const char * | |
| GNUNET_STRINGS_absolute_time_to_string (struct GNUNET_TIME_Absolute t); | | GNUNET_STRINGS_absolute_time_to_string (struct GNUNET_TIME_Absolute t); | |
| | | | |
| /** | | /** | |
| * Give relative time in human-readable fancy format. | | * Give relative time in human-readable fancy format. | |
|
| | | * This is one of the very few calls in the entire API that is | |
| | | * NOT reentrant! | |
| * | | * | |
| * @param delta time in milli seconds | | * @param delta time in milli seconds | |
|
| | | * @param do_round are we allowed to round a bit? | |
| * @return string in human-readable form | | * @return string in human-readable form | |
| */ | | */ | |
|
| char * | | const char * | |
| GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta); | | GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta, | |
| | | int do_round); | |
| | | | |
| /** | | /** | |
| * "man basename" | | * "man basename" | |
| * Returns a pointer to a part of filename (allocates nothing)! | | * Returns a pointer to a part of filename (allocates nothing)! | |
| * | | * | |
| * @param filename filename to extract basename from | | * @param filename filename to extract basename from | |
| * @return short (base) name of the file (that is, everything following the | | * @return short (base) name of the file (that is, everything following the | |
| * last directory separator in filename. If filename ends with a | | * last directory separator in filename. If filename ends with a | |
| * directory separator, the result will be a zero-length string. | | * directory separator, the result will be a zero-length string. | |
| * If filename has no directory separators, the result is filename | | * If filename has no directory separators, the result is filename | |
| | | | |
| skipping to change at line 242 | | skipping to change at line 265 | |
| * it should be placed, if needed. | | * it should be placed, if needed. | |
| * | | * | |
| * @param data data to encode | | * @param data data to encode | |
| * @param size size of data (in bytes) | | * @param size size of data (in bytes) | |
| * @param out buffer to fill | | * @param out buffer to fill | |
| * @param out_size size of the buffer. Must be large enough to hold | | * @param out_size size of the buffer. Must be large enough to hold | |
| * ((size*8) + (((size*8) % 5) > 0 ? 5 - ((size*8) % 5) : 0)) / 5 | | * ((size*8) + (((size*8) % 5) > 0 ? 5 - ((size*8) % 5) : 0)) / 5 | |
| * @return pointer to the next byte in 'out' or NULL on error. | | * @return pointer to the next byte in 'out' or NULL on error. | |
| */ | | */ | |
| char * | | char * | |
|
| GNUNET_STRINGS_data_to_string (const unsigned char *data, size_t size, | | GNUNET_STRINGS_data_to_string (const unsigned char *data, | |
| char *out, size_t out_size); | | size_t size, | |
| | | char *out, | |
| | | size_t out_size); | |
| | | | |
| /** | | /** | |
| * Convert ASCII encoding back to data | | * Convert ASCII encoding back to data | |
| * out_size must match exactly the size of the data before it was encoded. | | * out_size must match exactly the size of the data before it was encoded. | |
| * | | * | |
| * @param enc the encoding | | * @param enc the encoding | |
| * @param enclen number of characters in 'enc' (without 0-terminator, which
can be missing) | | * @param enclen number of characters in 'enc' (without 0-terminator, which
can be missing) | |
| * @param out location where to store the decoded data | | * @param out location where to store the decoded data | |
| * @param out_size sizeof the output buffer | | * @param out_size sizeof the output buffer | |
| * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco
ding | | * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco
ding | |
| */ | | */ | |
| int | | int | |
|
| GNUNET_STRINGS_string_to_data (const char *enc, size_t enclen, | | GNUNET_STRINGS_string_to_data (const char *enc, | |
| unsigned char *out, size_t out_size); | | size_t enclen, | |
| | | unsigned char *out, | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | size_t out_size); | |
| { | | | |
| #endif | | | |
| #ifdef __cplusplus | | | |
| } | | | |
| #endif | | | |
| | | | |
| enum GNUNET_STRINGS_FilenameCheck | | | |
| { | | | |
| GNUNET_STRINGS_CHECK_EXISTS = 0x00000001, | | | |
| GNUNET_STRINGS_CHECK_IS_DIRECTORY = 0x00000002, | | | |
| GNUNET_STRINGS_CHECK_IS_LINK = 0x00000004, | | | |
| GNUNET_STRINGS_CHECK_IS_ABSOLUTE = 0x00000008 | | | |
| }; | | | |
| | | | |
| /** | | /** | |
| * Parse a path that might be an URI. | | * Parse a path that might be an URI. | |
| * | | * | |
| * @param path path to parse. Must be NULL-terminated. | | * @param path path to parse. Must be NULL-terminated. | |
| * @param scheme_part a pointer to 'char *' where a pointer to a string tha
t | | * @param scheme_part a pointer to 'char *' where a pointer to a string tha
t | |
| * represents the URI scheme will be stored. Can be NULL. The string
is | | * represents the URI scheme will be stored. Can be NULL. The string
is | |
| * allocated by the function, and should be freed by GNUNET_free() w
hen | | * allocated by the function, and should be freed by GNUNET_free() w
hen | |
| * it is no longer needed. | | * it is no longer needed. | |
| * @param path_part a pointer to 'const char *' where a pointer to the path | | * @param path_part a pointer to 'const char *' where a pointer to the path | |
| * part of the URI will be stored. Can be NULL. Points to the same b
lock | | * part of the URI will be stored. Can be NULL. Points to the same b
lock | |
| * of memory as 'path', and thus must not be freed. Might point to '
\0', | | * of memory as 'path', and thus must not be freed. Might point to '
\0', | |
| * if path part is zero-length. | | * if path part is zero-length. | |
| * @return GNUNET_YES if it's an URI, GNUNET_NO otherwise. If 'path' is not | | * @return GNUNET_YES if it's an URI, GNUNET_NO otherwise. If 'path' is not | |
| * an URI, '* scheme_part' and '*path_part' will remain unchanged | | * an URI, '* scheme_part' and '*path_part' will remain unchanged | |
| * (if they weren't NULL). | | * (if they weren't NULL). | |
| */ | | */ | |
| int | | int | |
|
| GNUNET_STRINGS_parse_uri (const char *path, char **scheme_part, | | GNUNET_STRINGS_parse_uri (const char *path, | |
| const char **path_part); | | char **scheme_part, | |
| | | const char **path_part); | |
| | | | |
| /** | | /** | |
| * Check whether filename is absolute or not, and if it's an URI | | * Check whether filename is absolute or not, and if it's an URI | |
| * | | * | |
| * @param filename filename to check | | * @param filename filename to check | |
| * @param can_be_uri GNUNET_YES to check for being URI, GNUNET_NO - to | | * @param can_be_uri GNUNET_YES to check for being URI, GNUNET_NO - to | |
| * assume it's not URI | | * assume it's not URI | |
| * @param r_is_uri a pointer to an int that is set to GNUNET_YES if 'filena
me' | | * @param r_is_uri a pointer to an int that is set to GNUNET_YES if 'filena
me' | |
| * is URI and to GNUNET_NO otherwise. Can be NULL. If 'can_be_uri' i
s | | * is URI and to GNUNET_NO otherwise. Can be NULL. If 'can_be_uri' i
s | |
| * not GNUNET_YES, *r_is_uri is set to GNUNET_NO. | | * not GNUNET_YES, *r_is_uri is set to GNUNET_NO. | |
| | | | |
| skipping to change at line 315 | | skipping to change at line 328 | |
| * GNUNET_free (). Can be NULL. | | * GNUNET_free (). Can be NULL. | |
| * @return GNUNET_YES if 'filename' is absolute, GNUNET_NO otherwise. | | * @return GNUNET_YES if 'filename' is absolute, GNUNET_NO otherwise. | |
| */ | | */ | |
| int | | int | |
| GNUNET_STRINGS_path_is_absolute (const char *filename, | | GNUNET_STRINGS_path_is_absolute (const char *filename, | |
| int can_be_uri, | | int can_be_uri, | |
| int *r_is_uri, | | int *r_is_uri, | |
| char **r_uri_scheme); | | char **r_uri_scheme); | |
| | | | |
| /** | | /** | |
|
| * Perform checks on 'filename; | | * Flags for what we should check a file for. | |
| | | */ | |
| | | enum GNUNET_STRINGS_FilenameCheck | |
| | | { | |
| | | /** | |
| | | * Check that it exists. | |
| | | */ | |
| | | GNUNET_STRINGS_CHECK_EXISTS = 0x00000001, | |
| | | | |
| | | /** | |
| | | * Check that it is a directory. | |
| | | */ | |
| | | GNUNET_STRINGS_CHECK_IS_DIRECTORY = 0x00000002, | |
| | | | |
| | | /** | |
| | | * Check that it is a link. | |
| | | */ | |
| | | GNUNET_STRINGS_CHECK_IS_LINK = 0x00000004, | |
| | | | |
| | | /** | |
| | | * Check that the path is an absolute path. | |
| | | */ | |
| | | GNUNET_STRINGS_CHECK_IS_ABSOLUTE = 0x00000008 | |
| | | }; | |
| | | | |
| | | /** | |
| | | * Perform checks on 'filename'. FIXME: some duplication with | |
| | | * "GNUNET_DISK_"-APIs. We should unify those. | |
| * | | * | |
| * @param filename file to check | | * @param filename file to check | |
| * @param checks checks to perform | | * @param checks checks to perform | |
| * @return GNUNET_YES if all checks pass, GNUNET_NO if at least one of them | | * @return GNUNET_YES if all checks pass, GNUNET_NO if at least one of them | |
| * fails, GNUNET_SYSERR when a check can't be performed | | * fails, GNUNET_SYSERR when a check can't be performed | |
| */ | | */ | |
| int | | int | |
| GNUNET_STRINGS_check_filename (const char *filename, | | GNUNET_STRINGS_check_filename (const char *filename, | |
| enum GNUNET_STRINGS_FilenameCheck checks); | | enum GNUNET_STRINGS_FilenameCheck checks); | |
| | | | |
| | | | |
| skipping to change at line 373 | | skipping to change at line 413 | |
| * 0-terminator should not be counted towards addrlen). | | * 0-terminator should not be counted towards addrlen). | |
| * @param r_buf a buffer to fill. | | * @param r_buf a buffer to fill. | |
| * @return GNUNET_OK if conversion succeded. GNUNET_SYSERR otherwise, in wh
ich | | * @return GNUNET_OK if conversion succeded. GNUNET_SYSERR otherwise, in wh
ich | |
| * case the contents of r_buf are undefined. | | * case the contents of r_buf are undefined. | |
| */ | | */ | |
| int | | int | |
| GNUNET_STRINGS_to_address_ip (const char *addr, | | GNUNET_STRINGS_to_address_ip (const char *addr, | |
| uint16_t addrlen, | | uint16_t addrlen, | |
| struct sockaddr_storage *r_buf); | | struct sockaddr_storage *r_buf); | |
| | | | |
|
| | | /** | |
| | | * Returns utf-8 encoded arguments. | |
| | | * Does nothing (returns a copy of argc and argv) on any platform | |
| | | * other than W32. | |
| | | * Returned argv has u8argv[u8argc] == NULL. | |
| | | * Returned argv is a single memory block, and can be freed with a single | |
| | | * GNUNET_free () call. | |
| | | * | |
| | | * @param argc argc (as given by main()) | |
| | | * @param argv argv (as given by main()) | |
| | | * @param u8argc a location to store new argc in (though it's th same as ar | |
| | | gc) | |
| | | * @param u8argv a location to store new argv in | |
| | | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | |
| | | */ | |
| | | int | |
| | | GNUNET_STRINGS_get_utf8_args (int argc, | |
| | | char *const *argv, | |
| | | int *u8argc, | |
| | | char *const **u8argv); | |
| | | | |
| | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| | | { | |
| | | #endif | |
| | | #ifdef __cplusplus | |
| | | } | |
| | | #endif | |
| | | | |
| /* ifndef GNUNET_UTIL_STRING_H */ | | /* ifndef GNUNET_UTIL_STRING_H */ | |
| #endif | | #endif | |
| /* end of gnunet_util_string.h */ | | /* end of gnunet_util_string.h */ | |
| | | | |
End of changes. 20 change blocks. |
| 52 lines changed or deleted | | 117 lines changed or added | |
|
| gnunet_testbed_service.h | | gnunet_testbed_service.h | |
| | | | |
| skipping to change at line 32 | | skipping to change at line 32 | |
| * @file include/gnunet_testbed_service.h | | * @file include/gnunet_testbed_service.h | |
| * @brief API for writing tests and creating large-scale | | * @brief API for writing tests and creating large-scale | |
| * emulation testbeds for GNUnet. | | * emulation testbeds for GNUnet. | |
| * @author Christian Grothoff | | * @author Christian Grothoff | |
| */ | | */ | |
| | | | |
| #ifndef GNUNET_TESTBED_SERVICE_H | | #ifndef GNUNET_TESTBED_SERVICE_H | |
| #define GNUNET_TESTBED_SERVICE_H | | #define GNUNET_TESTBED_SERVICE_H | |
| | | | |
| #include "gnunet_util_lib.h" | | #include "gnunet_util_lib.h" | |
|
| | | #include "gnunet_testing_lib-new.h" | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" | | extern "C" | |
| { | | { | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| } | | } | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 60 | | skipping to change at line 61 | |
| * at a particular host. | | * at a particular host. | |
| */ | | */ | |
| struct GNUNET_TESTBED_Peer; | | struct GNUNET_TESTBED_Peer; | |
| | | | |
| /** | | /** | |
| * Opaque handle to an abstract operation to be executed by the testbed fra
mework. | | * Opaque handle to an abstract operation to be executed by the testbed fra
mework. | |
| */ | | */ | |
| struct GNUNET_TESTBED_Operation; | | struct GNUNET_TESTBED_Operation; | |
| | | | |
| /** | | /** | |
|
| * Handle to interact with a GNUnet testbed controller. Each controller ha | | * Handle to interact with a GNUnet testbed controller. Each | |
| s at | | * controller has at least one master handle which is created when the | |
| * least one master handle which is created when the controller is created; | | * controller is created; this master handle interacts with the | |
| this | | * controller process, destroying it destroys the controller (by | |
| * master handle interacts with the controller via stdin/stdout of the cont | | * closing stdin of the controller process). Additionally, | |
| roller | | * controllers can interact with each other (in a P2P fashion); those | |
| * process. Additionally, controllers can interact with each other (in a P | | * links are established via TCP/IP on the controller's service port. | |
| 2P | | | |
| * fashion); those links are established via TCP/IP on the controller's ser | | | |
| vice | | | |
| * port. | | | |
| */ | | */ | |
| struct GNUNET_TESTBED_Controller; | | struct GNUNET_TESTBED_Controller; | |
| | | | |
| /** | | /** | |
| * Handle to a large-scale testbed that is managed at a high level. | | * Handle to a large-scale testbed that is managed at a high level. | |
| */ | | */ | |
| struct GNUNET_TESTBED_Testbed; | | struct GNUNET_TESTBED_Testbed; | |
| | | | |
| /** | | /** | |
| * Create a host to run peers and controllers on. | | * Create a host to run peers and controllers on. | |
| * | | * | |
| * @param hostname name of the host, use "NULL" for localhost | | * @param hostname name of the host, use "NULL" for localhost | |
| * @param username username to use for the login; may be NULL | | * @param username username to use for the login; may be NULL | |
| * @param port port number to use for ssh; use 0 to let ssh decide | | * @param port port number to use for ssh; use 0 to let ssh decide | |
| * @return handle to the host, NULL on error | | * @return handle to the host, NULL on error | |
| */ | | */ | |
| struct GNUNET_TESTBED_Host * | | struct GNUNET_TESTBED_Host * | |
| GNUNET_TESTBED_host_create (const char *hostname, | | GNUNET_TESTBED_host_create (const char *hostname, | |
|
| const char *username, | | const char *username, | |
| uint16_t port); | | uint16_t port); | |
| | | | |
| | | /** | |
| | | * Create a host to run peers and controllers on. This function is used | |
| | | * if a peer learns about a host via IPC between controllers (and thus | |
| | | * some higher-level controller has already determined the unique IDs). | |
| | | * | |
| | | * @param id global host ID assigned to the host; 0 is | |
| | | * reserved to always mean 'localhost' | |
| | | * @param hostname name of the host, use "NULL" for localhost | |
| | | * @param username username to use for the login; may be NULL | |
| | | * @param port port number to use for ssh; use 0 to let ssh decide | |
| | | * @return handle to the host, NULL on error | |
| | | */ | |
| | | struct GNUNET_TESTBED_Host * | |
| | | GNUNET_TESTBED_host_create_with_id (uint32_t id, | |
| | | const char *hostname, | |
| | | const char *username, | |
| | | uint16_t port); | |
| | | | |
| /** | | /** | |
| * Load a set of hosts from a configuration file. | | * Load a set of hosts from a configuration file. | |
| * | | * | |
| * @param filename file with the host specification | | * @param filename file with the host specification | |
|
| * @param hosts set to the hosts found in the file | | * @param hosts set to the hosts found in the file; caller must free this i | |
| | | f | |
| | | * number of hosts returned is greater than 0 | |
| * @return number of hosts returned in 'hosts', 0 on error | | * @return number of hosts returned in 'hosts', 0 on error | |
| */ | | */ | |
| unsigned int | | unsigned int | |
| GNUNET_TESTBED_hosts_load_from_file (const char *filename, | | GNUNET_TESTBED_hosts_load_from_file (const char *filename, | |
|
| struct GNUNET_TESTBED_Host **hosts); | | struct GNUNET_TESTBED_Host ***hosts); | |
| | | | |
| /** | | /** | |
| * Destroy a host handle. Must only be called once everything | | * Destroy a host handle. Must only be called once everything | |
| * running on that host has been stopped. | | * running on that host has been stopped. | |
| * | | * | |
| * @param host handle to destroy | | * @param host handle to destroy | |
| */ | | */ | |
| void | | void | |
| GNUNET_TESTBED_host_destroy (struct GNUNET_TESTBED_Host *host); | | GNUNET_TESTBED_host_destroy (struct GNUNET_TESTBED_Host *host); | |
| | | | |
| /** | | /** | |
|
| | | * Checks whether a host can be used to start testbed service | |
| | | * | |
| | | * @param host the host to check | |
| | | * @param config the configuration handle to lookup the path of the testbed | |
| | | helper | |
| | | * @return GNUNET_YES if testbed service can be started on the given host | |
| | | * remotely; GNUNET_NO if not | |
| | | */ | |
| | | int | |
| | | GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host, | |
| | | const struct GNUNET_CONFIGURATION_Handle | |
| | | *config); | |
| | | | |
| | | /** | |
| | | * Obtain the host's hostname. | |
| | | * | |
| | | * @param host handle to the host, NULL means 'localhost' | |
| | | * @return hostname of the host | |
| | | */ | |
| | | const char * | |
| | | GNUNET_TESTBED_host_get_hostname (const struct GNUNET_TESTBED_Host *host); | |
| | | | |
| | | /** | |
| * Enumeration with (at most 64) possible event types that | | * Enumeration with (at most 64) possible event types that | |
| * can be monitored using the testbed framework. | | * can be monitored using the testbed framework. | |
| */ | | */ | |
| enum GNUNET_TESTBED_EventType | | enum GNUNET_TESTBED_EventType | |
| { | | { | |
| /** | | /** | |
| * A peer has been started. | | * A peer has been started. | |
| */ | | */ | |
| GNUNET_TESTBED_ET_PEER_START = 0, | | GNUNET_TESTBED_ET_PEER_START = 0, | |
| | | | |
| | | | |
| skipping to change at line 160 | | skipping to change at line 202 | |
| | | | |
| /** | | /** | |
| * Special value (not valid for requesting information) | | * Special value (not valid for requesting information) | |
| * that is used in the event struct if a 'generic' pointer | | * that is used in the event struct if a 'generic' pointer | |
| * is returned (for other operations not related to this | | * is returned (for other operations not related to this | |
| * enumeration). | | * enumeration). | |
| */ | | */ | |
| GNUNET_TESTBED_PIT_GENERIC = 0, | | GNUNET_TESTBED_PIT_GENERIC = 0, | |
| | | | |
| /** | | /** | |
|
| * What host is the peer running on? Returns a 'const struct | | | |
| * GNUNET_TESTBED_Host *'. Valid until | | | |
| * 'GNUNET_TESTBED_operation_done' is called. | | | |
| */ | | | |
| GNUNET_TESTBED_PIT_HOST, | | | |
| | | | |
| /** | | | |
| * What configuration is the peer using? Returns a 'const struct | | * What configuration is the peer using? Returns a 'const struct | |
| * GNUNET_CONFIGURATION_Handle *'. Valid until | | * GNUNET_CONFIGURATION_Handle *'. Valid until | |
| * 'GNUNET_TESTNIG_operation_done' is called. However, the | | * 'GNUNET_TESTNIG_operation_done' is called. However, the | |
| * values may be inaccurate if the peer is reconfigured in | | * values may be inaccurate if the peer is reconfigured in | |
| * the meantime. | | * the meantime. | |
| */ | | */ | |
| GNUNET_TESTBED_PIT_CONFIGURATION, | | GNUNET_TESTBED_PIT_CONFIGURATION, | |
| | | | |
| /** | | /** | |
| * What is the identity of the peer? Returns a | | * What is the identity of the peer? Returns a | |
| | | | |
| skipping to change at line 290 | | skipping to change at line 325 | |
| * requested. | | * requested. | |
| */ | | */ | |
| void *op_cls; | | void *op_cls; | |
| | | | |
| /** | | /** | |
| * Error message for the operation, NULL on success. | | * Error message for the operation, NULL on success. | |
| */ | | */ | |
| const char *emsg; | | const char *emsg; | |
| | | | |
| /** | | /** | |
|
| * Peer information type; captures which of the types | | * No result (NULL pointer) or generic result | |
| * in the 'op_result' is actually in use. | | * (whatever the GNUNET_TESTBED_ConnectAdapter returned). | |
| */ | | */ | |
|
| enum GNUNET_TESTBED_PeerInformationType pit; | | void *generic; | |
| | | | |
| /** | | | |
| * Pointer to an operation-specific return value; NULL on error; | | | |
| * can be NULL for certain operations. Valid until | | | |
| * 'GNUNET_TESTBED_operation_done' is called. | | | |
| */ | | | |
| union | | | |
| { | | | |
| /** | | | |
| * No result (NULL pointer) or generic result | | | |
| * (whatever the GNUNET_TESTBED_ConnectAdapter returned). | | | |
| */ | | | |
| void *generic; | | | |
| | | | |
| /** | | | |
| * Identity of host running the peer. | | | |
| */ | | | |
| struct GNUNET_TESTBED_Host *host; | | | |
| | | | |
| /** | | | |
| * Identity of the peer. | | | |
| */ | | | |
| const struct GNUNET_PeerIdentity *pid; | | | |
| | | | |
| /** | | | |
| * Configuration of the peer. | | | |
| */ | | | |
| const struct GNUNET_CONFIGURATION_Handle *cfg; | | | |
| | | | |
| } op_result; | | | |
| | | | |
| } operation_finished; | | } operation_finished; | |
| | | | |
| /** | | /** | |
| * Details about an testbed run completed event. | | * Details about an testbed run completed event. | |
| */ | | */ | |
| struct | | struct | |
| { | | { | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 365 | | skipping to change at line 370 | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Signature of the event handler function called by the | | * Signature of the event handler function called by the | |
| * respective event controller. | | * respective event controller. | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param event information about the event | | * @param event information about the event | |
| */ | | */ | |
| typedef void (*GNUNET_TESTBED_ControllerCallback)(void *cls, | | typedef void (*GNUNET_TESTBED_ControllerCallback)(void *cls, | |
|
| const struct GNUNET_TESTBE | | const struct GNUNET_TESTB | |
| D_EventInformation *event); | | ED_EventInformation *event); | |
| | | | |
| | | /** | |
| | | * Opaque Handle for Controller process | |
| | | */ | |
| | | struct GNUNET_TESTBED_ControllerProc; | |
| | | | |
| | | /** | |
| | | * Callback to signal successfull startup of the controller process | |
| | | * | |
| | | * @param cls the closure from GNUNET_TESTBED_controller_start() | |
| | | * @param cfg the configuration with which the controller has been started; | |
| | | * NULL if status is not GNUNET_OK | |
| | | * @param status GNUNET_OK if the startup is successfull; GNUNET_SYSERR if | |
| | | not, | |
| | | * GNUNET_TESTBED_controller_stop() shouldn't be called in this ca | |
| | | se | |
| | | */ | |
| | | typedef void (*GNUNET_TESTBED_ControllerStatusCallback) (void *cls, | |
| | | const struct GNUNET | |
| | | _CONFIGURATION_Handle *cfg, | |
| | | int status); | |
| | | | |
| /** | | /** | |
|
| * Start a controller process using the given configuration at the | | * Starts a controller process at the host. | |
| | | * | |
| | | * @param controller_ip the ip address of the controller. Will be set as TR | |
| | | USTED | |
| | | * host when starting testbed controller at host | |
| | | * @param host the host where the controller has to be started; NULL for | |
| | | * localhost | |
| | | * @param cfg template configuration to use for the remote controller; the | |
| | | * remote controller will be started with a slightly modified | |
| | | * configuration (port numbers, unix domain sockets and service ho | |
| | | me | |
| | | * values are changed as per TESTING library on the remote host) | |
| | | * @param cb function called when the controller is successfully started or | |
| | | * dies unexpectedly; GNUNET_TESTBED_controller_stop shouldn't be | |
| | | * called if cb is called with GNUNET_SYSERR as status. Will never | |
| | | be | |
| | | * called in the same task as 'GNUNET_TESTBED_controller_start' | |
| | | * (synchronous errors will be signalled by returning NULL). This | |
| | | * parameter cannot be NULL. | |
| | | * @param cls closure for above callbacks | |
| | | * @return the controller process handle, NULL on errors | |
| | | */ | |
| | | struct GNUNET_TESTBED_ControllerProc * | |
| | | GNUNET_TESTBED_controller_start (const char *controller_ip, | |
| | | struct GNUNET_TESTBED_Host *host, | |
| | | const struct GNUNET_CONFIGURATION_Handle * | |
| | | cfg, | |
| | | GNUNET_TESTBED_ControllerStatusCallback cb | |
| | | , | |
| | | void *cls); | |
| | | | |
| | | /** | |
| | | * Stop the controller process (also will terminate all peers and controlle | |
| | | rs | |
| | | * dependent on this controller). This function blocks until the testbed h | |
| | | as | |
| | | * been fully terminated (!). The controller status cb from | |
| | | * GNUNET_TESTBED_controller_start() will not be called. | |
| | | * | |
| | | * @param cproc the controller process handle | |
| | | */ | |
| | | void | |
| | | GNUNET_TESTBED_controller_stop (struct GNUNET_TESTBED_ControllerProc *cproc | |
| | | ); | |
| | | | |
| | | /** | |
| | | * Connect to a controller process using the given configuration at the | |
| * given host. | | * given host. | |
| * | | * | |
| * @param cfg configuration to use | | * @param cfg configuration to use | |
|
| * @param host host to run the controller on, NULL for 'localhost' | | * @param host host to run the controller on; This should be the same host | |
| | | if | |
| | | * the controller was previously started with | |
| | | * GNUNET_TESTBED_controller_start; NULL for localhost | |
| | | * @param host host where this controller is being run; | |
| * @param event_mask bit mask with set of events to call 'cc' for; | | * @param event_mask bit mask with set of events to call 'cc' for; | |
| * or-ed values of "1LL" shifted by the | | * or-ed values of "1LL" shifted by the | |
| * respective 'enum GNUNET_TESTBED_EventType' | | * respective 'enum GNUNET_TESTBED_EventType' | |
| * (i.e. "(1LL << GNUNET_TESTBED_ET_CONNECT) | ...") | | * (i.e. "(1LL << GNUNET_TESTBED_ET_CONNECT) | ...") | |
| * @param cc controller callback to invoke on events | | * @param cc controller callback to invoke on events | |
| * @param cc_cls closure for cc | | * @param cc_cls closure for cc | |
| * @return handle to the controller | | * @return handle to the controller | |
| */ | | */ | |
| struct GNUNET_TESTBED_Controller * | | struct GNUNET_TESTBED_Controller * | |
|
| GNUNET_TESTBED_controller_start (const struct GNUNET_CONFIGURATION_Handle * | | GNUNET_TESTBED_controller_connect (const struct GNUNET_CONFIGURATION_Handle | |
| cfg, | | *cfg, | |
| struct GNUNET_TESTBED_Host *host, | | struct GNUNET_TESTBED_Host *host, | |
| uint64_t event_mask, | | uint64_t event_mask, | |
| GNUNET_TESTBED_ControllerCallback cc, | | GNUNET_TESTBED_ControllerCallback cc, | |
| void *cc_cls); | | void *cc_cls); | |
| | | | |
| /** | | /** | |
| * Configure shared services at a controller. Using this function, | | * Configure shared services at a controller. Using this function, | |
| * you can specify that certain services (such as "resolver") | | * you can specify that certain services (such as "resolver") | |
| * should not be run for each peer but instead be shared | | * should not be run for each peer but instead be shared | |
| * across N peers on the specified host. This function | | * across N peers on the specified host. This function | |
| * must be called before any peers are created at the host. | | * must be called before any peers are created at the host. | |
| * | | * | |
| * @param controller controller to configure | | * @param controller controller to configure | |
| * @param service_name name of the service to share | | * @param service_name name of the service to share | |
| * @param num_peers number of peers that should share one instance | | * @param num_peers number of peers that should share one instance | |
| * of the specified service (1 for no sharing is the default), | | * of the specified service (1 for no sharing is the default), | |
| * use 0 to disable the service | | * use 0 to disable the service | |
| */ | | */ | |
| void | | void | |
| GNUNET_TESTBED_controller_configure_sharing (struct GNUNET_TESTBED_Controll
er *controller, | | GNUNET_TESTBED_controller_configure_sharing (struct GNUNET_TESTBED_Controll
er *controller, | |
|
| const char *service_name, | | const char *service_name, | |
| uint32_t num_peers); | | uint32_t num_peers); | |
| | | | |
| /** | | /** | |
| * Stop the given controller (also will terminate all peers and | | * Stop the given controller (also will terminate all peers and | |
| * controllers dependent on this controller). This function | | * controllers dependent on this controller). This function | |
| * blocks until the testbed has been fully terminated (!). | | * blocks until the testbed has been fully terminated (!). | |
| * | | * | |
| * @param controller handle to controller to stop | | * @param controller handle to controller to stop | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_TESTBED_controller_stop (struct GNUNET_TESTBED_Controller *controlle | | GNUNET_TESTBED_controller_disconnect (struct GNUNET_TESTBED_Controller *con | |
| r); | | troller); | |
| | | | |
| | | /** | |
| | | * Opaque handle for host registration | |
| | | */ | |
| | | struct GNUNET_TESTBED_HostRegistrationHandle; | |
| | | | |
| | | /** | |
| | | * Callback which will be called to after a host registration succeeded or | |
| | | failed | |
| | | * | |
| | | * @param cls the closure | |
| | | * @param emsg the error message; NULL if host registration is successful | |
| | | */ | |
| | | typedef void (* GNUNET_TESTBED_HostRegistrationCompletion) (void *cls, | |
| | | const char *ems | |
| | | g); | |
| | | | |
| | | /** | |
| | | * Register a host with the controller | |
| | | * | |
| | | * @param controller the controller handle | |
| | | * @param host the host to register | |
| | | * @param cc the completion callback to call to inform the status of | |
| | | * registration. After calling this callback the registration hand | |
| | | le | |
| | | * will be invalid. Cannot be NULL | |
| | | * @param cc_cls the closure for the cc | |
| | | * @return handle to the host registration which can be used to cancel the | |
| | | * registration; NULL if another registration handle is present a | |
| | | nd | |
| | | * is not cancelled | |
| | | */ | |
| | | struct GNUNET_TESTBED_HostRegistrationHandle * | |
| | | GNUNET_TESTBED_register_host (struct GNUNET_TESTBED_Controller *controller, | |
| | | struct GNUNET_TESTBED_Host *host, | |
| | | GNUNET_TESTBED_HostRegistrationCompletion cc, | |
| | | void *cc_cls); | |
| | | | |
| | | /** | |
| | | * Cancel the pending registration. Note that the registration message will | |
| | | * already be queued to be sent to the service, cancellation has only the | |
| | | * effect that the registration completion callback for the registration is | |
| | | * never called and from our perspective the host is not registered until t | |
| | | he | |
| | | * completion callback is called. | |
| | | * | |
| | | * @param handle the registration handle to cancel | |
| | | */ | |
| | | void | |
| | | GNUNET_TESTBED_cancel_registration (struct GNUNET_TESTBED_HostRegistrationH | |
| | | andle | |
| | | *handle); | |
| | | | |
| /** | | /** | |
|
| * Create a link from a 'master' controller to a slave controller. | | * Callback to be called when an operation is completed | |
| * Whenever the master controller is asked to start a peer at the | | | |
| * given 'delegated_host', it will delegate the request to the | | | |
| * specified slave controller. Note that the slave controller runs at | | | |
| * the 'slave_host', which may or may not be the same host as the | | | |
| * 'delegated_host' (for hierarchical delegations). The configuration | | | |
| * of the slave controller is given and to be used to either create | | | |
| * the slave controller or to connect to an existing slave controller | | | |
| * process. 'is_subordinate' specifies if the given slave controller | | | |
| * should be started and managed by the master controller, or if the | | | |
| * slave already has a master and this is just a secondary master that | | | |
| * is also allowed to use the existing slave. | | | |
| * | | * | |
|
| | | * @param cls the callback closure from functions generating an operation | |
| | | * @param op the operation that has been finished | |
| | | * @param emsg error message in case the operation has failed; will be NULL | |
| | | if | |
| | | * operation has executed successfully. | |
| | | */ | |
| | | typedef void (*GNUNET_TESTBED_OperationCompletionCallback) (void *cls, | |
| | | struct | |
| | | GNUNET_TESTBED_ | |
| | | Operation | |
| | | *op, | |
| | | const char *ems | |
| | | g); | |
| | | | |
| | | /** | |
| | | * Create a link from slave controller to delegated controller. Whenever th | |
| | | e | |
| | | * master controller is asked to start a peer at the delegated controller t | |
| | | he | |
| | | * request will be routed towards slave controller (if a route exists). The | |
| | | * slave controller will then route it to the delegated controller. The | |
| | | * configuration of the delegated controller is given and is used to either | |
| | | * create the delegated controller or to connect to an existing controller. | |
| | | Note | |
| | | * that while starting the delegated controller the configuration will be | |
| | | * modified to accommodate available free ports. the 'is_subordinate' spec | |
| | | ifies | |
| | | * if the given delegated controller should be started and managed by the s | |
| | | lave | |
| | | * controller, or if the delegated controller already has a master and the | |
| | | slave | |
| | | * controller connects to it as a non master controller. The success or fai | |
| | | lure | |
| | | * of this operation will be signalled through the | |
| | | * GNUNET_TESTBED_ControllerCallback() with an event of type | |
| | | * GNUNET_TESTBED_ET_OPERATION_FINISHED | |
| | | * | |
| | | * @param op_cls the operation closure for the event which is generated to | |
| | | * signal success or failure of this operation | |
| * @param master handle to the master controller who creates the associatio
n | | * @param master handle to the master controller who creates the associatio
n | |
|
| * @param delegated_host requests to which host should be delegated | | * @param delegated_host requests to which host should be delegated; cannot | |
| * @param slave_host which host is used to run the slave controller | | be NULL | |
| | | * @param slave_host which host is used to run the slave controller; use NU | |
| | | LL to | |
| | | * make the master controller connect to the delegated host | |
| * @param slave_cfg configuration to use for the slave controller | | * @param slave_cfg configuration to use for the slave controller | |
|
| * @param is_subordinate GNUNET_YES if the slave should be started (and sto | | * @param is_subordinate GNUNET_YES if the controller at delegated_host sho | |
| pped) | | uld | |
| * by the master controller; GNUNET_NO if we are just | | * be started by the slave controller; GNUNET_NO if the slave | |
| * allowed to use the slave via TCP/IP | | * controller has to connect to the already started delegated | |
| | | * controller via TCP/IP | |
| | | * @return the operation handle | |
| */ | | */ | |
|
| void | | struct GNUNET_TESTBED_Operation * | |
| GNUNET_TESTBED_controller_link (struct GNUNET_TESTBED_Controller *master, | | GNUNET_TESTBED_controller_link (void *op_cls, | |
| struct GNUNET_TESTBED_Host *delegated_host, | | struct GNUNET_TESTBED_Controller *master, | |
| struct GNUNET_TESTBED_Host *slave_host, | | struct GNUNET_TESTBED_Host *delegated_host, | |
| const struct GNUNET_CONFIGURATION_Handle *sl | | struct GNUNET_TESTBED_Host *slave_host, | |
| ave_cfg, | | const struct GNUNET_CONFIGURATION_Handle | |
| int is_subordinate); | | *slave_cfg, | |
| | | int is_subordinate); | |
| | | | |
| | | /** | |
| | | * Same as the GNUNET_TESTBED_controller_link, however expects configuratio | |
| | | n in | |
| | | * serialized and compressed | |
| | | * | |
| | | * @param op_cls the operation closure for the event which is generated to | |
| | | * signal success or failure of this operation | |
| | | * @param master handle to the master controller who creates the associatio | |
| | | n | |
| | | * @param delegated_host requests to which host should be delegated; cannot | |
| | | be NULL | |
| | | * @param slave_host which host is used to run the slave controller; use NU | |
| | | LL to | |
| | | * make the master controller connect to the delegated host | |
| | | * @param sxcfg serialized and compressed configuration | |
| | | * @param sxcfg_size the size sxcfg | |
| | | * @param scfg_size the size of uncompressed serialized configuration | |
| | | * @param is_subordinate GNUNET_YES if the controller at delegated_host sho | |
| | | uld | |
| | | * be started by the slave controller; GNUNET_NO if the slave | |
| | | * controller has to connect to the already started delegated | |
| | | * controller via TCP/IP | |
| | | * @return the operation handle | |
| | | */ | |
| | | struct GNUNET_TESTBED_Operation * | |
| | | GNUNET_TESTBED_controller_link_2 (void *op_cls, | |
| | | struct GNUNET_TESTBED_Controller *master, | |
| | | struct GNUNET_TESTBED_Host *delegated_hos | |
| | | t, | |
| | | struct GNUNET_TESTBED_Host *slave_host, | |
| | | const char *sxcfg, | |
| | | size_t sxcfg_size, | |
| | | size_t scfg_size, | |
| | | int is_subordinate); | |
| | | | |
| | | /** | |
| | | * Function to acquire the configuration of a running slave controller. The | |
| | | * completion of the operation is signalled through the controller_cb from | |
| | | * GNUNET_TESTBED_controller_connect(). If the operation is successful the | |
| | | * handle to the configuration is available in the generic pointer of | |
| | | * operation_finished field of struct GNUNET_TESTBED_EventInformation. | |
| | | * | |
| | | * @param op_cls the closure for the operation | |
| | | * @param master the handle to master controller | |
| | | * @param slave_host the host where the slave controller is running; the ha | |
| | | ndle | |
| | | * to the slave_host should remain valid until this operation is | |
| | | * cancelled or marked as finished | |
| | | * @return the operation handle; NULL if the slave_host is not registered a | |
| | | t | |
| | | * master | |
| | | */ | |
| | | struct GNUNET_TESTBED_Operation * | |
| | | GNUNET_TESTBED_get_slave_config (void *op_cls, | |
| | | struct GNUNET_TESTBED_Controller *master, | |
| | | struct GNUNET_TESTBED_Host *slave_host); | |
| | | | |
| | | /** | |
| | | * Functions of this signature are called when a peer has been successfully | |
| | | * created | |
| | | * | |
| | | * @param cls the closure from GNUNET_TESTBED_peer_create() | |
| | | * @param peer the handle for the created peer; NULL on any error during | |
| | | * creation | |
| | | * @param emsg NULL if peer is not NULL; else MAY contain the error descrip | |
| | | tion | |
| | | */ | |
| | | typedef void (*GNUNET_TESTBED_PeerCreateCallback) (void *cls, | |
| | | struct GNUNET_TESTBED_Pe | |
| | | er *peer, | |
| | | const char *emsg); | |
| | | | |
| /** | | /** | |
| * Create the given peer at the specified host using the given | | * Create the given peer at the specified host using the given | |
| * controller. If the given controller is not running on the target | | * controller. If the given controller is not running on the target | |
| * host, it should find or create a controller at the target host and | | * host, it should find or create a controller at the target host and | |
| * delegate creating the peer. Explicit delegation paths can be setup | | * delegate creating the peer. Explicit delegation paths can be setup | |
| * using 'GNUNET_TESTBED_controller_link'. If no explicit delegation | | * using 'GNUNET_TESTBED_controller_link'. If no explicit delegation | |
| * path exists, a direct link with a subordinate controller is setup | | * path exists, a direct link with a subordinate controller is setup | |
| * for the first delegated peer to a particular host; the subordinate | | * for the first delegated peer to a particular host; the subordinate | |
| * controller is then destroyed once the last peer that was delegated | | * controller is then destroyed once the last peer that was delegated | |
| | | | |
| skipping to change at line 468 | | skipping to change at line 663 | |
| * "GNUNET_TESTBED_peer_stop" to actually start/stop the peer's | | * "GNUNET_TESTBED_peer_stop" to actually start/stop the peer's | |
| * processes. | | * processes. | |
| * | | * | |
| * Note that the given configuration will be adjusted by the | | * Note that the given configuration will be adjusted by the | |
| * controller to avoid port/path conflicts with other peers. | | * controller to avoid port/path conflicts with other peers. | |
| * The "final" configuration can be obtained using | | * The "final" configuration can be obtained using | |
| * 'GNUNET_TESTBED_peer_get_information'. | | * 'GNUNET_TESTBED_peer_get_information'. | |
| * | | * | |
| * @param controller controller process to use | | * @param controller controller process to use | |
| * @param host host to run the peer on | | * @param host host to run the peer on | |
|
| * @param cfg configuration to use for the peer | | * @param cfg Template configuration to use for the peer. Should exist unti | |
| * @return handle to the peer (actual startup will happen asynchronously) | | l | |
| | | * operation is cancelled or GNUNET_TESTBED_operation_done() is ca | |
| | | lled | |
| | | * @param cb the callback to call when the peer has been created | |
| | | * @param cls the closure to the above callback | |
| | | * @return the operation handle | |
| */ | | */ | |
|
| struct GNUNET_TESTBED_Peer * | | struct GNUNET_TESTBED_Operation * | |
| GNUNET_TESTBED_peer_create (struct GNUNET_TESTBED_Controller *controller, | | GNUNET_TESTBED_peer_create (struct GNUNET_TESTBED_Controller *controller, | |
|
| struct GNUNET_TESTBED_Host *host, | | struct GNUNET_TESTBED_Host *host, | |
| const struct GNUNET_CONFIGURATION_Handle *cfg); | | const struct GNUNET_CONFIGURATION_Handle *cfg, | |
| | | GNUNET_TESTBED_PeerCreateCallback cb, | |
| | | void *cls); | |
| | | | |
| | | /** | |
| | | * Functions of this signature are called when a peer has been successfully | |
| | | * started or stopped. | |
| | | * | |
| | | * @param cls the closure from GNUNET_TESTBED_peer_start/stop() | |
| | | * @param emsg NULL on success; otherwise an error description | |
| | | */ | |
| | | typedef void (*GNUNET_TESTBED_PeerChurnCallback) (void *cls, | |
| | | const char *emsg); | |
| | | | |
| /** | | /** | |
| * Start the given peer. | | * Start the given peer. | |
| * | | * | |
|
| | | * @param op_cls the closure for this operation; will be set in | |
| | | * event->details.operation_finished.op_cls when this operation fa | |
| | | ils. | |
| * @param peer peer to start | | * @param peer peer to start | |
|
| | | * @param pcc function to call upon completion | |
| | | * @param pcc_cls closure for 'pcc' | |
| * @return handle to the operation | | * @return handle to the operation | |
| */ | | */ | |
| struct GNUNET_TESTBED_Operation * | | struct GNUNET_TESTBED_Operation * | |
|
| GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer); | | GNUNET_TESTBED_peer_start (void *op_cls, | |
| | | struct GNUNET_TESTBED_Peer *peer, | |
| | | GNUNET_TESTBED_PeerChurnCallback pcc, | |
| | | void *pcc_cls); | |
| | | | |
| /** | | /** | |
| * Stop the given peer. The handle remains valid (use | | * Stop the given peer. The handle remains valid (use | |
| * "GNUNET_TESTBED_peer_destroy" to fully clean up the | | * "GNUNET_TESTBED_peer_destroy" to fully clean up the | |
| * state of the peer). | | * state of the peer). | |
| * | | * | |
| * @param peer peer to stop | | * @param peer peer to stop | |
|
| | | * @param pcc function to call upon completion | |
| | | * @param pcc_cls closure for 'pcc' | |
| * @return handle to the operation | | * @return handle to the operation | |
| */ | | */ | |
| struct GNUNET_TESTBED_Operation * | | struct GNUNET_TESTBED_Operation * | |
|
| GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer); | | GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer, | |
| | | GNUNET_TESTBED_PeerChurnCallback pcc, | |
| | | void *pcc_cls); | |
| | | | |
| | | /** | |
| | | * Data returned from GNUNET_TESTBED_peer_get_information | |
| | | */ | |
| | | struct GNUNET_TESTBED_PeerInformation | |
| | | { | |
| | | /** | |
| | | * Peer information type; captures which of the types | |
| | | * in the 'op_result' is actually in use. | |
| | | */ | |
| | | enum GNUNET_TESTBED_PeerInformationType pit; | |
| | | | |
| | | /** | |
| | | * The result of the get information operation; Choose according to the p | |
| | | it | |
| | | */ | |
| | | union | |
| | | { | |
| | | /** | |
| | | * The configuration of the peer | |
| | | */ | |
| | | struct GNUNET_CONFIGURATION_Handle *cfg; | |
| | | | |
| | | /** | |
| | | * The identity of the peer | |
| | | */ | |
| | | struct GNUNET_PeerIdentity *id; | |
| | | } result; | |
| | | }; | |
| | | | |
| /** | | /** | |
|
| * Request information about a peer. | | * Callback to be called when the requested peer information is available | |
| | | * | |
| | | * @param cb_cls the closure from GNUNET_TETSBED_peer_get_information() | |
| | | * @param op the operation this callback corresponds to | |
| | | * @param pinfo the result; will be NULL if the operation has failed | |
| | | * @param emsg error message if the operation has failed; will be NULL if t | |
| | | he | |
| | | * operation is successfull | |
| | | */ | |
| | | typedef void (*GNUNET_TESTBED_PeerInfoCallback) (void *cb_cls, | |
| | | struct GNUNET_TESTBED_Oper | |
| | | ation | |
| | | *op, | |
| | | const struct | |
| | | GNUNET_TESTBED_PeerInforma | |
| | | tion | |
| | | *pinfo, | |
| | | const char *emsg); | |
| | | | |
| | | /** | |
| | | * Request information about a peer. The controller callback will not be ca | |
| | | lled | |
| | | * with event type GNUNET_TESTBED_ET_OPERATION_FINISHED when result for thi | |
| | | s | |
| | | * operation is available. Instead, the GNUNET_TESTBED_PeerInfoCallback() w | |
| | | ill | |
| | | * be called. | |
| * | | * | |
| * @param peer peer to request information about | | * @param peer peer to request information about | |
| * @param pit desired information | | * @param pit desired information | |
|
| | | * @param cb the convenience callback to be called when results for this | |
| | | * operation are available | |
| | | * @param cb_cls the closure for the above callback | |
| * @return handle to the operation | | * @return handle to the operation | |
| */ | | */ | |
| struct GNUNET_TESTBED_Operation * | | struct GNUNET_TESTBED_Operation * | |
| GNUNET_TESTBED_peer_get_information (struct GNUNET_TESTBED_Peer *peer, | | GNUNET_TESTBED_peer_get_information (struct GNUNET_TESTBED_Peer *peer, | |
|
| enum GNUNET_TESTBED_PeerInformationType | | enum GNUNET_TESTBED_PeerInformationTyp | |
| pit); | | e | |
| | | pit, | |
| | | GNUNET_TESTBED_PeerInfoCallback cb, | |
| | | void *cb_cls); | |
| | | | |
| /** | | /** | |
| * Change peer configuration. Must only be called while the | | * Change peer configuration. Must only be called while the | |
| * peer is stopped. Ports and paths cannot be changed this | | * peer is stopped. Ports and paths cannot be changed this | |
| * way. | | * way. | |
| * | | * | |
| * @param peer peer to change configuration for | | * @param peer peer to change configuration for | |
| * @param cfg new configuration (differences to existing | | * @param cfg new configuration (differences to existing | |
| * configuration only) | | * configuration only) | |
| * @return handle to the operation | | * @return handle to the operation | |
| */ | | */ | |
| struct GNUNET_TESTBED_Operation * | | struct GNUNET_TESTBED_Operation * | |
| GNUNET_TESTBED_peer_update_configuration (struct GNUNET_TESTBED_Peer *peer, | | GNUNET_TESTBED_peer_update_configuration (struct GNUNET_TESTBED_Peer *peer, | |
|
| const struct GNUNET_CONFIGURATION_
Handle *cfg); | | const struct GNUNET_CONFIGURATION
_Handle *cfg); | |
| | | | |
| /** | | /** | |
| * Destroy the given peer; the peer should have been | | * Destroy the given peer; the peer should have been | |
| * stopped first (if it was started). | | * stopped first (if it was started). | |
| * | | * | |
| * @param peer peer to stop | | * @param peer peer to stop | |
| * @return handle to the operation | | * @return handle to the operation | |
| */ | | */ | |
| struct GNUNET_TESTBED_Operation * | | struct GNUNET_TESTBED_Operation * | |
| GNUNET_TESTBED_peer_destroy (struct GNUNET_TESTBED_Peer *peer); | | GNUNET_TESTBED_peer_destroy (struct GNUNET_TESTBED_Peer *peer); | |
| | | | |
| skipping to change at line 572 | | skipping to change at line 847 | |
| * @param op_cls closure argument to give with the operation event | | * @param op_cls closure argument to give with the operation event | |
| * @param p1 first peer | | * @param p1 first peer | |
| * @param p2 second peer | | * @param p2 second peer | |
| * @param co option to change | | * @param co option to change | |
| * @param ap option-specific values | | * @param ap option-specific values | |
| * @return handle to the operation, NULL if configuring the link at this | | * @return handle to the operation, NULL if configuring the link at this | |
| * time is not allowed | | * time is not allowed | |
| */ | | */ | |
| struct GNUNET_TESTBED_Operation * | | struct GNUNET_TESTBED_Operation * | |
| GNUNET_TESTBED_underlay_configure_link_va (void *op_cls, | | GNUNET_TESTBED_underlay_configure_link_va (void *op_cls, | |
|
| struct GNUNET_TESTBED_Peer *p1, | | struct GNUNET_TESTBED_Peer *p1, | |
| struct GNUNET_TESTBED_Peer *p2, | | struct GNUNET_TESTBED_Peer *p2, | |
| enum GNUNET_TESTBED_ConnectOption | | enum GNUNET_TESTBED_ConnectOptio | |
| co, | | n co, | |
| va_list ap); | | va_list ap); | |
| | | | |
| /** | | /** | |
| * Manipulate the P2P underlay topology by configuring a link | | * Manipulate the P2P underlay topology by configuring a link | |
| * between two peers. | | * between two peers. | |
| * | | * | |
| * @param op_cls closure argument to give with the operation event | | * @param op_cls closure argument to give with the operation event | |
| * @param p1 first peer | | * @param p1 first peer | |
| * @param p2 second peer | | * @param p2 second peer | |
| * @param co option to change | | * @param co option to change | |
| * @param ... option-specific values | | * @param ... option-specific values | |
| * @return handle to the operation, NULL if configuring the link at this | | * @return handle to the operation, NULL if configuring the link at this | |
| * time is not allowed | | * time is not allowed | |
| */ | | */ | |
| struct GNUNET_TESTBED_Operation * | | struct GNUNET_TESTBED_Operation * | |
| GNUNET_TESTBED_underlay_configure_link (void *op_cls, | | GNUNET_TESTBED_underlay_configure_link (void *op_cls, | |
|
| struct GNUNET_TESTBED_Peer *p1, | | struct GNUNET_TESTBED_Peer *p1, | |
| struct GNUNET_TESTBED_Peer *p2, | | struct GNUNET_TESTBED_Peer *p2, | |
| enum GNUNET_TESTBED_ConnectOption co | | enum GNUNET_TESTBED_ConnectOption c | |
| , ...); | | o, ...); | |
| | | | |
| /** | | /** | |
|
| * Topologies supported for testbeds. | | * Topologies and topology options supported for testbeds. Options should a | |
| | | lways | |
| | | * end with GNUNET_TESTBED_TOPOLOGY_OPTION_END | |
| */ | | */ | |
| enum GNUNET_TESTBED_TopologyOption | | enum GNUNET_TESTBED_TopologyOption | |
| { | | { | |
| /** | | /** | |
|
| * A clique (everyone connected to everyone else). No options. | | * A clique (everyone connected to everyone else). No options. If there | |
| | | are N | |
| | | * peers this topology results in (N * (N -1)) connections. | |
| */ | | */ | |
| GNUNET_TESTBED_TOPOLOGY_CLIQUE, | | GNUNET_TESTBED_TOPOLOGY_CLIQUE, | |
| | | | |
| /** | | /** | |
| * Small-world network (2d torus plus random links). Followed | | * Small-world network (2d torus plus random links). Followed | |
| * by the number of random links to add (unsigned int). | | * by the number of random links to add (unsigned int). | |
| */ | | */ | |
| GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD, | | GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD, | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 628 | | skipping to change at line 905 | |
| * Ring topology. No options. | | * Ring topology. No options. | |
| */ | | */ | |
| GNUNET_TESTBED_TOPOLOGY_RING, | | GNUNET_TESTBED_TOPOLOGY_RING, | |
| | | | |
| /** | | /** | |
| * 2-d torus. No options. | | * 2-d torus. No options. | |
| */ | | */ | |
| GNUNET_TESTBED_TOPOLOGY_2D_TORUS, | | GNUNET_TESTBED_TOPOLOGY_2D_TORUS, | |
| | | | |
| /** | | /** | |
|
| * Random graph. Followed by the link density, that is the | | * Random graph. Followed by the number of random links to be establishe | |
| * percentage of links present in relation to a clique | | d | |
| * (float). | | * (unsigned int) | |
| */ | | */ | |
| GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, | | GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, | |
| | | | |
| /** | | /** | |
| * Certain percentage of peers are unable to communicate directly | | * Certain percentage of peers are unable to communicate directly | |
| * replicating NAT conditions. Followed by the fraction of | | * replicating NAT conditions. Followed by the fraction of | |
| * NAT'ed peers (float). | | * NAT'ed peers (float). | |
| */ | | */ | |
| GNUNET_TESTBED_TOPOLOGY_INTERNAT, | | GNUNET_TESTBED_TOPOLOGY_INTERNAT, | |
| | | | |
| | | | |
| skipping to change at line 659 | | skipping to change at line 935 | |
| GNUNET_TESTBED_TOPOLOGY_LINE, | | GNUNET_TESTBED_TOPOLOGY_LINE, | |
| | | | |
| /** | | /** | |
| * All peers are disconnected. No options. | | * All peers are disconnected. No options. | |
| */ | | */ | |
| GNUNET_TESTBED_TOPOLOGY_NONE, | | GNUNET_TESTBED_TOPOLOGY_NONE, | |
| | | | |
| /** | | /** | |
| * Read a topology from a given file. Followed by the name of the file (
const char *). | | * Read a topology from a given file. Followed by the name of the file (
const char *). | |
| */ | | */ | |
|
| GNUNET_TESTBED_TOPOLOGY_FROM_FILE | | GNUNET_TESTBED_TOPOLOGY_FROM_FILE, | |
| | | | |
| | | /** | |
| | | * The options should always end with this | |
| | | */ | |
| | | GNUNET_TESTBED_TOPOLOGY_OPTION_END, | |
| | | | |
| | | /* The following are not topologies but influence how the topology has to | |
| | | be | |
| | | setup. These options should follow the topology specific options (if | |
| | | required by the chosen topology). Note that these should be given befo | |
| | | re | |
| | | GNUNET_TESTBED_TOPOLOGY_OPTION_END */ | |
| | | | |
| | | /** | |
| | | * Disable automatic retrying for failed overlay connections. The default | |
| | | is | |
| | | * to always retry failed overlay connections. This parameter takes no op | |
| | | tions. | |
| | | */ | |
| | | GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Configure overall network topology to have a particular shape. | | * Configure overall network topology to have a particular shape. | |
| * | | * | |
| * @param op_cls closure argument to give with the operation event | | * @param op_cls closure argument to give with the operation event | |
| * @param num_peers number of peers in 'peers' | | * @param num_peers number of peers in 'peers' | |
| * @param peers array of 'num_peers' with the peers to configure | | * @param peers array of 'num_peers' with the peers to configure | |
| * @param topo desired underlay topology to use | | * @param topo desired underlay topology to use | |
| * @param ap topology-specific options | | * @param ap topology-specific options | |
| * @return handle to the operation, NULL if configuring the topology | | * @return handle to the operation, NULL if configuring the topology | |
| * is not allowed at this time | | * is not allowed at this time | |
| */ | | */ | |
| struct GNUNET_TESTBED_Operation * | | struct GNUNET_TESTBED_Operation * | |
| GNUNET_TESTBED_underlay_configure_topology_va (void *op_cls, | | GNUNET_TESTBED_underlay_configure_topology_va (void *op_cls, | |
|
| unsigned int num_peers, | | unsigned int num_peers, | |
| struct GNUNET_TESTBED_Peer ** | | struct GNUNET_TESTBED_Peer * | |
| peers, | | *peers, | |
| enum GNUNET_TESTBED_TopologyO | | enum GNUNET_TESTBED_Topology | |
| ption topo, | | Option topo, | |
| va_list ap); | | va_list ap); | |
| | | | |
| /** | | /** | |
| * Configure overall network topology to have a particular shape. | | * Configure overall network topology to have a particular shape. | |
| * | | * | |
| * @param op_cls closure argument to give with the operation event | | * @param op_cls closure argument to give with the operation event | |
| * @param num_peers number of peers in 'peers' | | * @param num_peers number of peers in 'peers' | |
| * @param peers array of 'num_peers' with the peers to configure | | * @param peers array of 'num_peers' with the peers to configure | |
| * @param topo desired underlay topology to use | | * @param topo desired underlay topology to use | |
| * @param ... topology-specific options | | * @param ... topology-specific options | |
| * @return handle to the operation, NULL if configuring the topology | | * @return handle to the operation, NULL if configuring the topology | |
| * is not allowed at this time | | * is not allowed at this time | |
| */ | | */ | |
| struct GNUNET_TESTBED_Operation * | | struct GNUNET_TESTBED_Operation * | |
| GNUNET_TESTBED_underlay_configure_topology (void *op_cls, | | GNUNET_TESTBED_underlay_configure_topology (void *op_cls, | |
|
| unsigned int num_peers, | | unsigned int num_peers, | |
| struct GNUNET_TESTBED_Peer **pee | | struct GNUNET_TESTBED_Peer **pe | |
| rs, | | ers, | |
| enum GNUNET_TESTBED_TopologyOpti | | enum GNUNET_TESTBED_TopologyOpt | |
| on topo, | | ion topo, | |
| ...); | | ...); | |
| | | | |
| /** | | /** | |
| * Both peers must have been started before calling this function. | | * Both peers must have been started before calling this function. | |
| * This function then obtains a HELLO from 'p1', gives it to 'p2' | | * This function then obtains a HELLO from 'p1', gives it to 'p2' | |
| * and asks 'p2' to connect to 'p1'. | | * and asks 'p2' to connect to 'p1'. | |
| * | | * | |
| * @param op_cls closure argument to give with the operation event | | * @param op_cls closure argument to give with the operation event | |
|
| | | * @param cb the callback to call when this operation has finished | |
| | | * @param cb_cls the closure for the above callback | |
| * @param p1 first peer | | * @param p1 first peer | |
| * @param p2 second peer | | * @param p2 second peer | |
| * @return handle to the operation, NULL if connecting these two | | * @return handle to the operation, NULL if connecting these two | |
| * peers is fundamentally not possible at this time (peers | | * peers is fundamentally not possible at this time (peers | |
| * not running or underlay disallows) | | * not running or underlay disallows) | |
| */ | | */ | |
| struct GNUNET_TESTBED_Operation * | | struct GNUNET_TESTBED_Operation * | |
| GNUNET_TESTBED_overlay_connect (void *op_cls, | | GNUNET_TESTBED_overlay_connect (void *op_cls, | |
|
| struct GNUNET_TESTBED_Peer *p1, | | GNUNET_TESTBED_OperationCompletionCallback | |
| struct GNUNET_TESTBED_Peer *p2); | | cb, | |
| | | void *cb_cls, | |
| | | struct GNUNET_TESTBED_Peer *p1, | |
| | | struct GNUNET_TESTBED_Peer *p2); | |
| | | | |
| /** | | /** | |
| * All peers must have been started before calling this function. | | * All peers must have been started before calling this function. | |
| * This function then connects the given peers in the P2P overlay | | * This function then connects the given peers in the P2P overlay | |
| * using the given topology. | | * using the given topology. | |
| * | | * | |
| * @param op_cls closure argument to give with the operation event | | * @param op_cls closure argument to give with the operation event | |
| * @param num_peers number of peers in 'peers' | | * @param num_peers number of peers in 'peers' | |
| * @param peers array of 'num_peers' with the peers to configure | | * @param peers array of 'num_peers' with the peers to configure | |
| * @param topo desired underlay topology to use | | * @param topo desired underlay topology to use | |
| * @param va topology-specific options | | * @param va topology-specific options | |
| * @return handle to the operation, NULL if connecting these | | * @return handle to the operation, NULL if connecting these | |
| * peers is fundamentally not possible at this time (peers | | * peers is fundamentally not possible at this time (peers | |
|
| * not running or underlay disallows) | | * not running or underlay disallows) or if num_peers is less than
2 | |
| */ | | */ | |
| struct GNUNET_TESTBED_Operation * | | struct GNUNET_TESTBED_Operation * | |
| GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls, | | GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls, | |
|
| unsigned int num_peers, | | unsigned int num_peers, | |
| struct GNUNET_TESTBED_Peer *pe | | struct GNUNET_TESTBED_Peer ** | |
| ers, | | peers, | |
| enum GNUNET_TESTBED_TopologyOp | | enum GNUNET_TESTBED_TopologyO | |
| tion topo, | | ption topo, | |
| va_list va); | | va_list va); | |
| | | | |
| /** | | /** | |
| * All peers must have been started before calling this function. | | * All peers must have been started before calling this function. | |
| * This function then connects the given peers in the P2P overlay | | * This function then connects the given peers in the P2P overlay | |
| * using the given topology. | | * using the given topology. | |
| * | | * | |
| * @param op_cls closure argument to give with the operation event | | * @param op_cls closure argument to give with the operation event | |
| * @param num_peers number of peers in 'peers' | | * @param num_peers number of peers in 'peers' | |
| * @param peers array of 'num_peers' with the peers to configure | | * @param peers array of 'num_peers' with the peers to configure | |
| * @param topo desired underlay topology to use | | * @param topo desired underlay topology to use | |
| * @param ... topology-specific options | | * @param ... topology-specific options | |
| * @return handle to the operation, NULL if connecting these | | * @return handle to the operation, NULL if connecting these | |
| * peers is fundamentally not possible at this time (peers | | * peers is fundamentally not possible at this time (peers | |
|
| * not running or underlay disallows) | | * not running or underlay disallows) or if num_peers is less than
2 | |
| */ | | */ | |
| struct GNUNET_TESTBED_Operation * | | struct GNUNET_TESTBED_Operation * | |
| GNUNET_TESTBED_overlay_configure_topology (void *op_cls, | | GNUNET_TESTBED_overlay_configure_topology (void *op_cls, | |
|
| unsigned int num_peers, | | unsigned int num_peers, | |
| struct GNUNET_TESTBED_Peer *peers | | struct GNUNET_TESTBED_Peer **pee | |
| , | | rs, | |
| enum GNUNET_TESTBED_TopologyOptio | | enum GNUNET_TESTBED_TopologyOpti | |
| n topo, | | on topo, | |
| ...); | | ...); | |
| | | | |
| /** | | /** | |
| * Ask the testbed controller to write the current overlay topology to | | * Ask the testbed controller to write the current overlay topology to | |
| * a file. Naturally, the file will only contain a snapshot as the | | * a file. Naturally, the file will only contain a snapshot as the | |
| * topology may evolve all the time. | | * topology may evolve all the time. | |
|
| | | * FIXME: needs continuation!? | |
| * | | * | |
| * @param controller overlay controller to inspect | | * @param controller overlay controller to inspect | |
| * @param filename name of the file the topology should | | * @param filename name of the file the topology should | |
| * be written to. | | * be written to. | |
| */ | | */ | |
| void | | void | |
| GNUNET_TESTBED_overlay_write_topology_to_file (struct GNUNET_TESTBED_Contro
ller *controller, | | GNUNET_TESTBED_overlay_write_topology_to_file (struct GNUNET_TESTBED_Contro
ller *controller, | |
|
| const char *filename); | | const char *filename); | |
| | | | |
| /** | | /** | |
| * Adapter function called to establish a connection to | | * Adapter function called to establish a connection to | |
| * a service. | | * a service. | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
|
| * @param cfg configuration of the peer to connect to | | * @param cfg configuration of the peer to connect to; will be available un | |
| | | til | |
| | | * GNUNET_TESTBED_operation_done() is called on the operation retu | |
| | | rned | |
| | | * from GNUNET_TESTBED_service_connect() | |
| * @return service handle to return in 'op_result', NULL on error | | * @return service handle to return in 'op_result', NULL on error | |
| */ | | */ | |
| typedef void * (*GNUNET_TESTBED_ConnectAdapter)(void *cls, | | typedef void * (*GNUNET_TESTBED_ConnectAdapter)(void *cls, | |
|
| const struct GNUNET_CONFIGUR
ATION_Handle *cfg); | | const struct GNUNET_CONFIGU
RATION_Handle *cfg); | |
| | | | |
| /** | | /** | |
| * Adapter function called to destroy a connection to | | * Adapter function called to destroy a connection to | |
| * a service. | | * a service. | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param op_result service handle returned from the connect adapter | | * @param op_result service handle returned from the connect adapter | |
| */ | | */ | |
| typedef void (*GNUNET_TESTBED_DisconnectAdapter)(void *cls, | | typedef void (*GNUNET_TESTBED_DisconnectAdapter)(void *cls, | |
|
| void *op_result); | | void *op_result); | |
| | | | |
| | | /** | |
| | | * Callback to be called when a service connect operation is completed | |
| | | * | |
| | | * @param cls the callback closure from functions generating an operation | |
| | | * @param op the operation that has been finished | |
| | | * @param ca_result the service handle returned from GNUNET_TESTBED_Connect | |
| | | Adapter() | |
| | | * @param emsg error message in case the operation has failed; will be NULL | |
| | | if | |
| | | * operation has executed successfully. | |
| | | */ | |
| | | typedef void (*GNUNET_TESTBED_ServiceConnectCompletionCallback) (void *cls, | |
| | | struct | |
| | | GNUNET_TES | |
| | | TBED_Operation | |
| | | *op, | |
| | | void | |
| | | *ca_result | |
| | | , | |
| | | const char | |
| | | *emsg ); | |
| | | | |
| /** | | /** | |
| * Connect to a service offered by the given peer. Will ensure that | | * Connect to a service offered by the given peer. Will ensure that | |
| * the request is queued to not overwhelm our ability to create and | | * the request is queued to not overwhelm our ability to create and | |
| * maintain connections with other systems. The actual service | | * maintain connections with other systems. The actual service | |
| * handle is then returned via the 'op_result' member in the event | | * handle is then returned via the 'op_result' member in the event | |
| * callback. The 'ca' callback is used to create the connection | | * callback. The 'ca' callback is used to create the connection | |
| * when the time is right; the 'da' callback will be used to | | * when the time is right; the 'da' callback will be used to | |
| * destroy the connection (upon 'GNUNET_TESTBED_operation_done'). | | * destroy the connection (upon 'GNUNET_TESTBED_operation_done'). | |
| * 'GNUNET_TESTBED_operation_cancel' can be used to abort this | | * 'GNUNET_TESTBED_operation_cancel' can be used to abort this | |
| * operation until the event callback has been called. | | * operation until the event callback has been called. | |
| * | | * | |
| * @param op_cls closure to pass in operation event | | * @param op_cls closure to pass in operation event | |
| * @param peer peer that runs the service | | * @param peer peer that runs the service | |
| * @param service_name name of the service to connect to | | * @param service_name name of the service to connect to | |
|
| | | * @param cb the callback to call when this operation finishes | |
| | | * @param cb_cls closure for the above callback | |
| * @param ca helper function to establish the connection | | * @param ca helper function to establish the connection | |
| * @param da helper function to close the connection | | * @param da helper function to close the connection | |
| * @param cada_cls closure for ca and da | | * @param cada_cls closure for ca and da | |
| * @return handle for the operation | | * @return handle for the operation | |
| */ | | */ | |
| struct GNUNET_TESTBED_Operation * | | struct GNUNET_TESTBED_Operation * | |
| GNUNET_TESTBED_service_connect (void *op_cls, | | GNUNET_TESTBED_service_connect (void *op_cls, | |
|
| struct GNUNET_TESTBED_Peer *peer, | | struct GNUNET_TESTBED_Peer *peer, | |
| const char *service_name, | | const char *service_name, | |
| GNUNET_TESTBED_ConnectAdapter ca, | | GNUNET_TESTBED_ServiceConnectCompletionCall | |
| GNUNET_TESTBED_DisconnectAdapter da, | | back cb, | |
| void *cada_cls); | | void *cb_cls, | |
| | | GNUNET_TESTBED_ConnectAdapter ca, | |
| /** | | GNUNET_TESTBED_DisconnectAdapter da, | |
| * Cancel a pending operation. Releases all resources | | void *cada_cls); | |
| * of the operation and will ensure that no event | | | |
| * is generated for the operation. Does NOT guarantee | | /** | |
| * that the operation will be fully undone (or that | | * This function is used to signal that the event information (struct | |
| | | * GNUNET_TESTBED_EventInformation) from an operation has been fully proces | |
| | | sed | |
| | | * i.e. if the event callback is ever called for this operation. If the eve | |
| | | nt | |
| | | * callback for this operation has not yet been called, calling this functi | |
| | | on | |
| | | * cancels the operation, frees its resources and ensures the no event is | |
| | | * generated with respect to this operation. Note that however cancelling a | |
| | | n | |
| | | * operation does NOT guarantee that the operation will be fully undone (or | |
| | | that | |
| * nothing ever happened). | | * nothing ever happened). | |
| * | | * | |
|
| * @param operation operation to cancel | | * This function MUST be called for every operation to fully remove the | |
| */ | | * operation from the operation queue. After calling this function, if | |
| void | | * operation is completed and its event information is of type | |
| GNUNET_TESTBED_operation_cancel (struct GNUNET_TESTBED_Operation *operation | | * GNUNET_TESTBED_ET_OPERATION_FINISHED, the 'op_result' becomes invalid (! | |
| ); | | ). | |
| | | | |
| /** | | * If the operation is generated from GNUNET_TESTBED_service_connect() then | |
| * Signal that the information from an operation has been fully | | * calling this function on such as operation calls the disconnect adapter | |
| * processed. This function MUST be called for each event | | if | |
| * of type 'operation_finished' to fully remove the operation | | * the connect adapter was ever called. | |
| * from the operation queue. After calling this function, the | | | |
| * 'op_result' becomes invalid (!). | | | |
| * | | * | |
|
| * @param operation operation to signal completion for | | * @param operation operation to signal completion or cancellation | |
| */ | | */ | |
| void | | void | |
| GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation); | | GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation); | |
| | | | |
| /** | | /** | |
| * Configure and run a testbed using the given | | * Configure and run a testbed using the given | |
| * master controller on 'num_hosts' starting | | * master controller on 'num_hosts' starting | |
| * 'num_peers' using the given peer configuration. | | * 'num_peers' using the given peer configuration. | |
| * | | * | |
| * @param controller master controller for the testbed | | * @param controller master controller for the testbed | |
| | | | |
| skipping to change at line 861 | | skipping to change at line 1182 | |
| * use 'localhost' | | * use 'localhost' | |
| * @param hosts list of hosts to use for the testbed | | * @param hosts list of hosts to use for the testbed | |
| * @param num_peers number of peers to start | | * @param num_peers number of peers to start | |
| * @param peer_cfg peer configuration template to use | | * @param peer_cfg peer configuration template to use | |
| * @param underlay_topology underlay topology to create | | * @param underlay_topology underlay topology to create | |
| * @param va topology-specific options | | * @param va topology-specific options | |
| * @return handle to the testbed | | * @return handle to the testbed | |
| */ | | */ | |
| struct GNUNET_TESTBED_Testbed * | | struct GNUNET_TESTBED_Testbed * | |
| GNUNET_TESTBED_create_va (struct GNUNET_TESTBED_Controller *controller, | | GNUNET_TESTBED_create_va (struct GNUNET_TESTBED_Controller *controller, | |
|
| unsigned int num_hosts, | | unsigned int num_hosts, | |
| struct GNUNET_TESTBED_Host **hosts, | | struct GNUNET_TESTBED_Host **hosts, | |
| unsigned int num_peers, | | unsigned int num_peers, | |
| const struct GNUNET_CONFIGURATION_Handle *peer_cfg | | const struct GNUNET_CONFIGURATION_Handle *peer_cf | |
| , | | g, | |
| enum GNUNET_TESTBED_TopologyOption underlay_topolo | | enum GNUNET_TESTBED_TopologyOption underlay_topol | |
| gy, | | ogy, | |
| va_list va); | | va_list va); | |
| | | | |
| /** | | /** | |
| * Configure and run a testbed using the given | | * Configure and run a testbed using the given | |
| * master controller on 'num_hosts' starting | | * master controller on 'num_hosts' starting | |
| * 'num_peers' using the given peer configuration. | | * 'num_peers' using the given peer configuration. | |
| * | | * | |
| * @param controller master controller for the testbed | | * @param controller master controller for the testbed | |
| * (must not be destroyed until after the | | * (must not be destroyed until after the | |
| * testbed is destroyed). | | * testbed is destroyed). | |
| * @param num_hosts number of hosts in 'hosts', 0 to only | | * @param num_hosts number of hosts in 'hosts', 0 to only | |
| * use 'localhost' | | * use 'localhost' | |
| * @param hosts list of hosts to use for the testbed | | * @param hosts list of hosts to use for the testbed | |
| * @param num_peers number of peers to start | | * @param num_peers number of peers to start | |
| * @param peer_cfg peer configuration template to use | | * @param peer_cfg peer configuration template to use | |
| * @param underlay_topology underlay topology to create | | * @param underlay_topology underlay topology to create | |
| * @param ... topology-specific options | | * @param ... topology-specific options | |
| */ | | */ | |
| struct GNUNET_TESTBED_Testbed * | | struct GNUNET_TESTBED_Testbed * | |
| GNUNET_TESTBED_create (struct GNUNET_TESTBED_Controller *controller, | | GNUNET_TESTBED_create (struct GNUNET_TESTBED_Controller *controller, | |
|
| unsigned int num_hosts, | | unsigned int num_hosts, | |
| struct GNUNET_TESTBED_Host **hosts, | | struct GNUNET_TESTBED_Host **hosts, | |
| unsigned int num_peers, | | unsigned int num_peers, | |
| const struct GNUNET_CONFIGURATION_Handle *peer_cfg, | | const struct GNUNET_CONFIGURATION_Handle *peer_cfg, | |
| enum GNUNET_TESTBED_TopologyOption underlay_topology, | | enum GNUNET_TESTBED_TopologyOption underlay_topology | |
| ...); | | , | |
| | | ...); | |
| | | | |
| /** | | /** | |
| * Destroy a testbed. Stops all running peers and then | | * Destroy a testbed. Stops all running peers and then | |
| * destroys all peers. Does NOT destroy the master controller. | | * destroys all peers. Does NOT destroy the master controller. | |
| * | | * | |
| * @param testbed testbed to destroy | | * @param testbed testbed to destroy | |
| */ | | */ | |
| void | | void | |
| GNUNET_TESTBED_destroy (struct GNUNET_TESTBED_Testbed *testbed); | | GNUNET_TESTBED_destroy (struct GNUNET_TESTBED_Testbed *testbed); | |
| | | | |
| /** | | /** | |
|
| | | * Callback function to process statistic values from all peers. | |
| | | * | |
| | | * @param cls closure | |
| | | * @param peer the peer the statistic belong to | |
| | | * @param subsystem name of subsystem that created the statistic | |
| | | * @param name the name of the datum | |
| | | * @param value the current value | |
| | | * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if | |
| | | not | |
| | | * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration | |
| | | */ | |
| | | typedef int (*GNUNET_TESTBED_StatisticsIterator) (void *cls, | |
| | | const struct GNUNET_TESTB | |
| | | ED_Peer *peer, | |
| | | const char *subsystem, | |
| | | const char *name, | |
| | | uint64_t value, | |
| | | int is_persistent); | |
| | | | |
| | | /** | |
| | | * Convenience method that iterates over all (running) peers | |
| | | * and retrieves all statistics from each peer. | |
| | | * | |
| | | * @param num_peers number of peers to iterate over | |
| | | * @param peers array of peers to iterate over | |
| | | * @param proc processing function for each statistic retrieved | |
| | | * @param cont continuation to call once call is completed(?) | |
| | | * @param cls closure to pass to proc and cont | |
| | | * @return operation handle to cancel the operation | |
| | | */ | |
| | | struct GNUNET_TESTBED_Operation * | |
| | | GNUNET_TESTBED_get_statistics (unsigned int num_peers, | |
| | | struct GNUNET_TESTBED_Peer **peers, | |
| | | GNUNET_TESTBED_StatisticsIterator proc, | |
| | | GNUNET_TESTBED_OperationCompletionCallback c | |
| | | ont, | |
| | | void *cls); | |
| | | | |
| | | /** | |
| * Convenience method for running a testbed with | | * Convenience method for running a testbed with | |
| * a single call. Underlay and overlay topology | | * a single call. Underlay and overlay topology | |
| * are configured using the "UNDERLAY" and "OVERLAY" | | * are configured using the "UNDERLAY" and "OVERLAY" | |
| * options in the "[testbed]" section of the configuration\ | | * options in the "[testbed]" section of the configuration\ | |
| * (with possible options given in "UNDERLAY_XXX" and/or | | * (with possible options given in "UNDERLAY_XXX" and/or | |
| * "OVERLAY_XXX"). | | * "OVERLAY_XXX"). | |
| * | | * | |
| * The testbed is to be terminated using a call to | | * The testbed is to be terminated using a call to | |
| * "GNUNET_SCHEDULER_shutdown". | | * "GNUNET_SCHEDULER_shutdown". | |
| * | | * | |
| * @param host_filename name of the file with the 'hosts', NULL | | * @param host_filename name of the file with the 'hosts', NULL | |
| * to run everything on 'localhost' | | * to run everything on 'localhost' | |
| * @param cfg configuration to use (for testbed, controller and peers) | | * @param cfg configuration to use (for testbed, controller and peers) | |
|
| * @param num_peers number of peers to start; FIXME: maybe put that ALSO in | | * @param num_peers number of peers to start; FIXME: maybe put that ALSO in | |
| to cfg? | | to | |
| | | * cfg?; should be greater than 0 | |
| * @param event_mask bit mask with set of events to call 'cc' for; | | * @param event_mask bit mask with set of events to call 'cc' for; | |
| * or-ed values of "1LL" shifted by the | | * or-ed values of "1LL" shifted by the | |
| * respective 'enum GNUNET_TESTBED_EventType' | | * respective 'enum GNUNET_TESTBED_EventType' | |
| * (i.e. "(1LL << GNUNET_TESTBED_ET_CONNECT) || ...") | | * (i.e. "(1LL << GNUNET_TESTBED_ET_CONNECT) || ...") | |
|
| * @param cc controller callback to invoke on events | | * @param cc controller callback to invoke on events; This callback is call | |
| | | ed | |
| | | * for all peer start events even if GNUNET_TESTBED_ET_PEER_START is | |
| | | n't | |
| | | * set in the event_mask as this is the only way get access to the | |
| | | * handle of each peer | |
| * @param cc_cls closure for cc | | * @param cc_cls closure for cc | |
| * @param master task to run once the testbed is ready | | * @param master task to run once the testbed is ready | |
| * @param master_cls closure for 'task'. | | * @param master_cls closure for 'task'. | |
| */ | | */ | |
| void | | void | |
| GNUNET_TESTBED_run (const char *host_filename, | | GNUNET_TESTBED_run (const char *host_filename, | |
|
| const struct GNUNET_CONFIGURATION_Handle *cfg, | | const struct GNUNET_CONFIGURATION_Handle *cfg, | |
| unsigned int num_peers, | | unsigned int num_peers, | |
| uint64_t event_mask, | | uint64_t event_mask, | |
| GNUNET_TESTBED_ControllerCallback cc, | | GNUNET_TESTBED_ControllerCallback cc, | |
| void *cc_cls, | | void *cc_cls, | |
| GNUNET_SCHEDULER_Task master, | | GNUNET_SCHEDULER_Task master, | |
| void *master_cls); | | void *master_cls); | |
| | | | |
| /** | | /** | |
| * Signature of a main function for a testcase. | | * Signature of a main function for a testcase. | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param num_peers number of peers in 'peers' | | * @param num_peers number of peers in 'peers' | |
| * @param peers handle to peers run in the testbed | | * @param peers handle to peers run in the testbed | |
| */ | | */ | |
| typedef void (*GNUNET_TESTBED_TestMaster)(void *cls, | | typedef void (*GNUNET_TESTBED_TestMaster)(void *cls, | |
|
| unsigned int num_peers, | | unsigned int num_peers, | |
| struct GNUNET_TESTBED_Peer **peers | | struct GNUNET_TESTBED_Peer **peer | |
| ); | | s); | |
| | | | |
| /** | | /** | |
| * Convenience method for running a "simple" test on the local system | | * Convenience method for running a "simple" test on the local system | |
| * with a single call from 'main'. Underlay and overlay topology are | | * with a single call from 'main'. Underlay and overlay topology are | |
| * configured using the "UNDERLAY" and "OVERLAY" options in the | | * configured using the "UNDERLAY" and "OVERLAY" options in the | |
| * "[testbed]" section of the configuration (with possible options | | * "[testbed]" section of the configuration (with possible options | |
| * given in "UNDERLAY_XXX" and/or "OVERLAY_XXX"). | | * given in "UNDERLAY_XXX" and/or "OVERLAY_XXX"). | |
| * | | * | |
| * The test is to be terminated using a call to | | * The test is to be terminated using a call to | |
| * "GNUNET_SCHEDULER_shutdown". If starting the test fails, | | * "GNUNET_SCHEDULER_shutdown". If starting the test fails, | |
| * the program is stopped without 'master' ever being run. | | * the program is stopped without 'master' ever being run. | |
| * | | * | |
| * NOTE: this function should be called from 'main', NOT from | | * NOTE: this function should be called from 'main', NOT from | |
| * within a GNUNET_SCHEDULER-loop. This function will initialze | | * within a GNUNET_SCHEDULER-loop. This function will initialze | |
| * the scheduler loop, the testbed and then pass control to | | * the scheduler loop, the testbed and then pass control to | |
| * 'master'. | | * 'master'. | |
| * | | * | |
| * @param testname name of the testcase (to configure logging, etc.) | | * @param testname name of the testcase (to configure logging, etc.) | |
| * @param cfg_filename configuration filename to use | | * @param cfg_filename configuration filename to use | |
| * (for testbed, controller and peers) | | * (for testbed, controller and peers) | |
|
| * @param num_peers number of peers to start | | * @param num_peers number of peers to start; should be greter than 0 | |
| | | * @param event_mask bit mask with set of events to call 'cc' for; | |
| | | * or-ed values of "1LL" shifted by the | |
| | | * respective 'enum GNUNET_TESTBED_EventType' | |
| | | * (i.e. "(1LL << GNUNET_TESTBED_ET_CONNECT) || ...") | |
| | | * @param cc controller callback to invoke on events; This callback is call | |
| | | ed | |
| | | * for all peer start events even if GNUNET_TESTBED_ET_PEER_START is | |
| | | n't | |
| | | * set in the event_mask as this is the only way get access to the | |
| | | * handle of each peer | |
| | | * @param cc_cls closure for cc | |
| * @param test_master task to run once the test is ready | | * @param test_master task to run once the test is ready | |
| * @param test_master_cls closure for 'task'. | | * @param test_master_cls closure for 'task'. | |
| */ | | */ | |
| void | | void | |
| GNUNET_TESTBED_test_run (const char *testname, | | GNUNET_TESTBED_test_run (const char *testname, | |
|
| const char *cfg_filename, | | const char *cfg_filename, | |
| unsigned int num_peers, | | unsigned int num_peers, | |
| GNUNET_TESTBED_TestMaster test_master, | | uint64_t event_mask, | |
| void *test_master_cls); | | GNUNET_TESTBED_ControllerCallback cc, | |
| | | void *cc_cls, | |
| | | GNUNET_TESTBED_TestMaster test_master, | |
| | | void *test_master_cls); | |
| | | | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| { | | { | |
| #endif | | #endif | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 64 change blocks. |
| 208 lines changed or deleted | | 657 lines changed or added | |
|
| gnunet_testing_lib-new.h | | gnunet_testing_lib-new.h | |
| | | | |
| skipping to change at line 47 | | skipping to change at line 47 | |
| #include "gnunet_statistics_service.h" | | #include "gnunet_statistics_service.h" | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" | | extern "C" | |
| { | | { | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| } | | } | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
|
| | | #define GNUNET_TESTING_HOSTKEYFILESIZE 914 | |
| | | | |
| /** | | /** | |
| * Handle for a system on which GNUnet peers are executed; | | * Handle for a system on which GNUnet peers are executed; | |
| * a system is used for reserving unique paths and ports. | | * a system is used for reserving unique paths and ports. | |
| */ | | */ | |
| struct GNUNET_TESTING_System; | | struct GNUNET_TESTING_System; | |
| | | | |
| /** | | /** | |
| * Handle for a GNUnet peer controlled by testing. | | * Handle for a GNUnet peer controlled by testing. | |
| */ | | */ | |
| struct GNUNET_TESTING_Peer; | | struct GNUNET_TESTING_Peer; | |
| | | | |
| /** | | /** | |
|
| | | * Create a system handle. There must only be one system handle per operat | |
| | | ing | |
| | | * system. Uses a default range for allowed ports. Ports are still tested | |
| | | for | |
| | | * availability. | |
| | | * | |
| | | * @param testdir only the directory name without any path. This is used fo | |
| | | r all | |
| | | * service homes; the directory will be created in a temporary loc | |
| | | ation | |
| | | * depending on the underlying OS | |
| | | * @param controller hostname of the controlling host, service configuratio | |
| | | ns | |
| | | * are modified to allow control connections from this host; can be | |
| | | NULL | |
| | | * @param hostname the hostname of the system we are using for testing; NUL | |
| | | L for | |
| | | * localhost | |
| | | * @return handle to this system, NULL on error | |
| | | */ | |
| | | struct GNUNET_TESTING_System * | |
| | | GNUNET_TESTING_system_create (const char *testdir, | |
| | | const char *controller, | |
| | | const char *hostname); | |
| | | | |
| | | /** | |
| * Create a system handle. There must only be one system | | * Create a system handle. There must only be one system | |
|
| * handle per operating system. | | * handle per operating system. Use this function directly | |
| * | | * if multiple system objects are created for the same host | |
| * @param tmppath prefix path to use for all service homes | | * (only really useful when testing --- or to make the port | |
| | | * range configureable). | |
| | | * | |
| | | * @param testdir only the directory name without any path. This is used fo | |
| | | r | |
| | | * all service homes; the directory will be created in a temporary | |
| | | * location depending on the underlying OS | |
| * @param controller hostname of the controlling host, | | * @param controller hostname of the controlling host, | |
| * service configurations are modified to allow | | * service configurations are modified to allow | |
| * control connections from this host; can be NULL | | * control connections from this host; can be NULL | |
|
| | | * @param hostname the hostname of the system we are using for testing; NUL | |
| | | L for | |
| | | * localhost | |
| | | * @param lowport lowest port number this system is allowed to allocate (in | |
| | | clusive) | |
| | | * @param highport highest port number this system is allowed to allocate ( | |
| | | exclusive) | |
| * @return handle to this system, NULL on error | | * @return handle to this system, NULL on error | |
| */ | | */ | |
| struct GNUNET_TESTING_System * | | struct GNUNET_TESTING_System * | |
|
| GNUNET_TESTING_system_create (const char *tmppath, | | GNUNET_TESTING_system_create_with_portrange (const char *testdir, | |
| const char *controller); | | const char *controller, | |
| | | const char *hostname, | |
| | | uint16_t lowport, | |
| | | uint16_t highport); | |
| | | | |
| /** | | /** | |
| * Free system resources. | | * Free system resources. | |
| * | | * | |
| * @param system system to be freed | | * @param system system to be freed | |
|
| * @param remove_paths should the 'tmppath' and all subdirectories | | * @param remove_paths should the 'testdir' and all subdirectories | |
| * be removed (clean up on shutdown)? | | * be removed (clean up on shutdown)? | |
| */ | | */ | |
| void | | void | |
| GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system, | | GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system, | |
| int remove_paths); | | int remove_paths); | |
| | | | |
| /** | | /** | |
|
| * Testing includes a number of pre-created hostkeys for faster peer | | | |
| * startup. This function loads such keys into memory from a file. | | | |
| * | | | |
| * @param system the testing system handle | | | |
| * @param filename the path of the hostkeys file | | | |
| * @return GNUNET_OK on success; GNUNET_SYSERR on error | | | |
| */ | | | |
| int | | | |
| GNUNET_TESTING_hostkeys_load (struct GNUNET_TESTING_System *system, | | | |
| const char *filename); | | | |
| | | | |
| /** | | | |
| * Function to remove the loaded hostkeys | | | |
| * | | | |
| * @param system the testing system handle | | | |
| */ | | | |
| void | | | |
| GNUNET_TESTING_hostkeys_unload (struct GNUNET_TESTING_System *system); | | | |
| | | | |
| /** | | | |
| * Testing includes a number of pre-created hostkeys for | | * Testing includes a number of pre-created hostkeys for | |
| * faster peer startup. This function can be used to | | * faster peer startup. This function can be used to | |
| * access the n-th key of those pre-created hostkeys; note | | * access the n-th key of those pre-created hostkeys; note | |
| * that these keys are ONLY useful for testing and not | | * that these keys are ONLY useful for testing and not | |
| * secure as the private keys are part of the public | | * secure as the private keys are part of the public | |
| * GNUnet source code. | | * GNUnet source code. | |
| * | | * | |
| * This is primarily a helper function used internally | | * This is primarily a helper function used internally | |
| * by 'GNUNET_TESTING_peer_configure'. | | * by 'GNUNET_TESTING_peer_configure'. | |
| * | | * | |
| * @param system the testing system handle | | * @param system the testing system handle | |
| * @param key_number desired pre-created hostkey to obtain | | * @param key_number desired pre-created hostkey to obtain | |
| * @param id set to the peer's identity (hash of the public | | * @param id set to the peer's identity (hash of the public | |
| * key; if NULL, GNUNET_SYSERR is returned immediately | | * key; if NULL, GNUNET_SYSERR is returned immediately | |
|
| * @return GNUNET_SYSERR on error (not enough keys) | | * @return NULL on error (not enough keys) | |
| */ | | */ | |
|
| int | | struct GNUNET_CRYPTO_RsaPrivateKey * | |
| GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system, | | GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system, | |
| uint32_t key_number, | | uint32_t key_number, | |
| struct GNUNET_PeerIdentity *id); | | struct GNUNET_PeerIdentity *id); | |
| | | | |
| /** | | /** | |
| * Reserve a TCP or UDP port for a peer. | | * Reserve a TCP or UDP port for a peer. | |
| * | | * | |
| * @param system system to use for reservation tracking | | * @param system system to use for reservation tracking | |
| * @param is_tcp GNUNET_YES for TCP ports, GNUNET_NO for UDP | | * @param is_tcp GNUNET_YES for TCP ports, GNUNET_NO for UDP | |
| * @return 0 if no free port was available | | * @return 0 if no free port was available | |
| | | | |
| skipping to change at line 150 | | skipping to change at line 163 | |
| * @param system system to use for reservation tracking | | * @param system system to use for reservation tracking | |
| * @param is_tcp GNUNET_YES for TCP ports, GNUNET_NO for UDP | | * @param is_tcp GNUNET_YES for TCP ports, GNUNET_NO for UDP | |
| * @param port reserved port to release | | * @param port reserved port to release | |
| */ | | */ | |
| void | | void | |
| GNUNET_TESTING_release_port (struct GNUNET_TESTING_System *system, | | GNUNET_TESTING_release_port (struct GNUNET_TESTING_System *system, | |
| int is_tcp, | | int is_tcp, | |
| uint16_t port); | | uint16_t port); | |
| | | | |
| /** | | /** | |
|
| * Create a new configuration using the given configuration | | * Create a new configuration using the given configuration as a template; | |
| * as a template; ports and paths will be modified to select | | * ports and paths will be modified to select available ports on the local | |
| * available ports on the local system. If we run | | * system. The default configuration will be available in PATHS section und | |
| | | er | |
| | | * the option DEFAULTCONFIG after the call. SERVICE_HOME is also set in PAT | |
| | | HS | |
| | | * section to the temporary directory specific to this configuration. If we | |
| | | run | |
| * out of "*port" numbers, return SYSERR. | | * out of "*port" numbers, return SYSERR. | |
| * | | * | |
| * This is primarily a helper function used internally | | * This is primarily a helper function used internally | |
| * by 'GNUNET_TESTING_peer_configure'. | | * by 'GNUNET_TESTING_peer_configure'. | |
| * | | * | |
| * @param system system to use to coordinate resource usage | | * @param system system to use to coordinate resource usage | |
| * @param cfg template configuration to update | | * @param cfg template configuration to update | |
| * @return GNUNET_OK on success, GNUNET_SYSERR on error - the configuration
will | | * @return GNUNET_OK on success, GNUNET_SYSERR on error - the configuration
will | |
| * be incomplete and should not be used there upon | | * be incomplete and should not be used there upon | |
| */ | | */ | |
| | | | |
| skipping to change at line 177 | | skipping to change at line 192 | |
| | | | |
| /** | | /** | |
| * Configure a GNUnet peer. GNUnet must be installed on the local | | * Configure a GNUnet peer. GNUnet must be installed on the local | |
| * system and available in the PATH. | | * system and available in the PATH. | |
| * | | * | |
| * @param system system to use to coordinate resource usage | | * @param system system to use to coordinate resource usage | |
| * @param cfg configuration to use; will be UPDATED (to reflect needed | | * @param cfg configuration to use; will be UPDATED (to reflect needed | |
| * changes in port numbers and paths) | | * changes in port numbers and paths) | |
| * @param key_number number of the hostkey to use for the peer | | * @param key_number number of the hostkey to use for the peer | |
| * @param id identifier for the daemon, will be set, can be NULL | | * @param id identifier for the daemon, will be set, can be NULL | |
|
| * @param emsg set to error message (set to NULL on success), can be NULL | | * @param emsg set to freshly allocated error message (set to NULL on succe | |
| | | ss), | |
| | | * can be NULL | |
| * @return handle to the peer, NULL on error | | * @return handle to the peer, NULL on error | |
| */ | | */ | |
| struct GNUNET_TESTING_Peer * | | struct GNUNET_TESTING_Peer * | |
| GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system, | | GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system, | |
| struct GNUNET_CONFIGURATION_Handle *cfg, | | struct GNUNET_CONFIGURATION_Handle *cfg, | |
| uint32_t key_number, | | uint32_t key_number, | |
| struct GNUNET_PeerIdentity *id, | | struct GNUNET_PeerIdentity *id, | |
| char **emsg); | | char **emsg); | |
| | | | |
| /** | | /** | |
|
| | | * Obtain the peer identity from a peer handle. | |
| | | * | |
| | | * @param peer peer handle for which we want the peer's identity | |
| | | * @param id identifier for the daemon, will be set | |
| | | */ | |
| | | void | |
| | | GNUNET_TESTING_peer_get_identity (const struct GNUNET_TESTING_Peer *peer, | |
| | | struct GNUNET_PeerIdentity *id); | |
| | | | |
| | | /** | |
| * Start the peer. | | * Start the peer. | |
| * | | * | |
| * @param peer peer to start | | * @param peer peer to start | |
| * @return GNUNET_OK on success, GNUNET_SYSERR on error (i.e. peer already
running) | | * @return GNUNET_OK on success, GNUNET_SYSERR on error (i.e. peer already
running) | |
| */ | | */ | |
| int | | int | |
| GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer); | | GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer); | |
| | | | |
| /** | | /** | |
| * Stop the peer. | | * Stop the peer. | |
| | | | |
| skipping to change at line 221 | | skipping to change at line 247 | |
| */ | | */ | |
| void | | void | |
| GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer *peer); | | GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer *peer); | |
| | | | |
| /** | | /** | |
| * Signature of the 'main' function for a (single-peer) testcase that | | * Signature of the 'main' function for a (single-peer) testcase that | |
| * is run using 'GNUNET_TESTING_peer_run'. | | * is run using 'GNUNET_TESTING_peer_run'. | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param cfg configuration of the peer that was started | | * @param cfg configuration of the peer that was started | |
|
| | | * @param peer identity of the peer that was created | |
| */ | | */ | |
| typedef void (*GNUNET_TESTING_TestMain)(void *cls, | | typedef void (*GNUNET_TESTING_TestMain)(void *cls, | |
|
| const struct GNUNET_CONFIGURATION_Ha | | const struct GNUNET_CONFIGURATION_Ha | |
| ndle *cfg); | | ndle *cfg, | |
| | | struct GNUNET_TESTING_Peer *peer); | |
| | | | |
| /** | | /** | |
| * Start a single peer and run a test using the testing library. | | * Start a single peer and run a test using the testing library. | |
| * Starts a peer using the given configuration and then invokes the | | * Starts a peer using the given configuration and then invokes the | |
| * given callback. This function ALSO initializes the scheduler loop | | * given callback. This function ALSO initializes the scheduler loop | |
| * and should thus be called directly from "main". The testcase | | * and should thus be called directly from "main". The testcase | |
| * should self-terminate by invoking 'GNUNET_SCHEDULER_shutdown'. | | * should self-terminate by invoking 'GNUNET_SCHEDULER_shutdown'. | |
| * | | * | |
|
| * @param tmppath path for storing temporary data for the test | | * @param testdir only the directory name without any path. This is used fo | |
| | | r | |
| | | * all service homes; the directory will be created in a temporary | |
| | | * location depending on the underlying OS | |
| * @param cfgfilename name of the configuration file to use; | | * @param cfgfilename name of the configuration file to use; | |
| * use NULL to only run with defaults | | * use NULL to only run with defaults | |
| * @param tm main function of the testcase | | * @param tm main function of the testcase | |
| * @param tm_cls closure for 'tm' | | * @param tm_cls closure for 'tm' | |
| * @return 0 on success, 1 on error | | * @return 0 on success, 1 on error | |
| */ | | */ | |
| int | | int | |
|
| GNUNET_TESTING_peer_run (const char *tmppath, | | GNUNET_TESTING_peer_run (const char *testdir, | |
| const char *cfgfilename, | | const char *cfgfilename, | |
| GNUNET_TESTING_TestMain tm, | | GNUNET_TESTING_TestMain tm, | |
| void *tm_cls); | | void *tm_cls); | |
| | | | |
| /** | | /** | |
| * Start a single service (no ARM, except of course if the given | | * Start a single service (no ARM, except of course if the given | |
| * service name is 'arm') and run a test using the testing library. | | * service name is 'arm') and run a test using the testing library. | |
| * Starts a service using the given configuration and then invokes the | | * Starts a service using the given configuration and then invokes the | |
| * given callback. This function ALSO initializes the scheduler loop | | * given callback. This function ALSO initializes the scheduler loop | |
| * and should thus be called directly from "main". The testcase | | * and should thus be called directly from "main". The testcase | |
| * should self-terminate by invoking 'GNUNET_SCHEDULER_shutdown'. | | * should self-terminate by invoking 'GNUNET_SCHEDULER_shutdown'. | |
| * | | * | |
| * This function is useful if the testcase is for a single service | | * This function is useful if the testcase is for a single service | |
| * and if that service doesn't itself depend on other services. | | * and if that service doesn't itself depend on other services. | |
| * | | * | |
|
| * @param tmppath path for storing temporary data for the test | | * @param testdir only the directory name without any path. This is used fo | |
| | | r | |
| | | * all service homes; the directory will be created in a temporary | |
| | | * location depending on the underlying OS | |
| * @param service_name name of the service to run | | * @param service_name name of the service to run | |
| * @param cfgfilename name of the configuration file to use; | | * @param cfgfilename name of the configuration file to use; | |
| * use NULL to only run with defaults | | * use NULL to only run with defaults | |
| * @param tm main function of the testcase | | * @param tm main function of the testcase | |
| * @param tm_cls closure for 'tm' | | * @param tm_cls closure for 'tm' | |
| * @return 0 on success, 1 on error | | * @return 0 on success, 1 on error | |
| */ | | */ | |
| int | | int | |
|
| GNUNET_TESTING_service_run (const char *tmppath, | | GNUNET_TESTING_service_run (const char *testdir, | |
| const char *service_name, | | const char *service_name, | |
| const char *cfgfilename, | | const char *cfgfilename, | |
| GNUNET_TESTING_TestMain tm, | | GNUNET_TESTING_TestMain tm, | |
| void *tm_cls); | | void *tm_cls); | |
| | | | |
|
| | | /** | |
| | | * Sometimes we use the binary name to determine which specific | |
| | | * test to run. In those cases, the string after the last "_" | |
| | | * in 'argv[0]' specifies a string that determines the configuration | |
| | | * file or plugin to use. | |
| | | * | |
| | | * This function returns the respective substring, taking care | |
| | | * of issues such as binaries ending in '.exe' on W32. | |
| | | * | |
| | | * @param argv0 the name of the binary | |
| | | * @return string between the last '_' and the '.exe' (or the end of the st | |
| | | ring), | |
| | | * NULL if argv0 has no '_' | |
| | | */ | |
| | | char * | |
| | | GNUNET_TESTING_get_testname_from_underscore (const char *argv0); | |
| | | | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| { | | { | |
| #endif | | #endif | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 19 change blocks. |
| 38 lines changed or deleted | | 104 lines changed or added | |
|