block_dns.h | block_dns.h | |||
---|---|---|---|---|
/* | ||||
This file is part of GNUnet. | ||||
(C) 2009 Christian Grothoff (and other contributing authors) | ||||
GNUnet is free software; you can redistribute it and/or modify | ||||
it under the terms of the GNU General Public License as published | ||||
by the Free Software Foundation; either version 3, or (at your | ||||
option) any later version. | ||||
GNUnet is distributed in the hope that it will be useful, but | ||||
WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
General Public License for more details. | ||||
You should have received a copy of the GNU General Public License | ||||
along with GNUnet; see the file COPYING. If not, write to the | ||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||||
Boston, MA 02111-1307, USA. | ||||
*/ | ||||
/** | ||||
* @file include/block_dns.h | ||||
* @author Philipp Toelke | ||||
*/ | ||||
#ifndef _GNVPN_BLOCKDNS_H_ | #ifndef _GNVPN_BLOCKDNS_H_ | |||
#define _GNVPN_BLOCKDNS_H_ | #define _GNVPN_BLOCKDNS_H_ | |||
#include "gnunet_common.h" | #include "gnunet_common.h" | |||
#include "gnunet_crypto_lib.h" | #include "gnunet_crypto_lib.h" | |||
/** | /** | |||
* Bitmask describing what IP-protocols are supported by the service | * Bitmask describing what IP-protocols are supported by the service | |||
*/ | */ | |||
enum GNUNET_DNS_ServiceTypes | enum GNUNET_DNS_ServiceTypes | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 24 lines changed or added | |||
gnunet_applications.h | gnunet_applications.h | |||
---|---|---|---|---|
skipping to change at line 54 | skipping to change at line 54 | |||
* Test. | * Test. | |||
*/ | */ | |||
#define GNUNET_APPLICATION_TYPE_TEST 1 | #define GNUNET_APPLICATION_TYPE_TEST 1 | |||
/** | /** | |||
* Internet DNS resolution (external DNS gateway). | * Internet DNS resolution (external DNS gateway). | |||
*/ | */ | |||
#define GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER 2 | #define GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER 2 | |||
/** | /** | |||
* Internet HTTP gateway (port 80). | * Internet IPv4 gateway (any TCP/UDP/ICMP). | |||
*/ | */ | |||
#define GNUNET_APPLICATION_TYPE_INTERNET_HTTP_GATEWAY 3 | #define GNUNET_APPLICATION_TYPE_IPV4_GATEWAY 16 | |||
/** | /** | |||
* Internet HTTPS gateway (port 443). | * Internet IPv6 gateway (any TCP/UDP/ICMP). | |||
*/ | */ | |||
#define GNUNET_APPLICATION_TYPE_INTERNET_HTTPS_GATEWAY 4 | #define GNUNET_APPLICATION_TYPE_IPV6_GATEWAY 17 | |||
/** | ||||
* Internet TCP gateway (any port). | ||||
*/ | ||||
#define GNUNET_APPLICATION_TYPE_INTERNET_TCP_GATEWAY 5 | ||||
/** | ||||
* Internet UDP gateway (any port). | ||||
*/ | ||||
#define GNUNET_APPLICATION_TYPE_INTERNET_UDP_GATEWAY 6 | ||||
/** | ||||
* GNUnet VPN Search Engine (searches HTTP sites hosted within GNUnet) [exa | ||||
mple] | ||||
*/ | ||||
#define GNUNET_APPLICATION_TYPE_GNUNET_SEARCH 7 | ||||
#if 0 /* keep Emacsens' auto-indent happy */ | #if 0 /* keep Emacsens' auto-indent happy */ | |||
{ | { | |||
#endif | #endif | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
/* ifndef GNUNET_APPLICATIONS_H */ | /* ifndef GNUNET_APPLICATIONS_H */ | |||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
20 lines changed or deleted | 4 lines changed or added | |||
gnunet_ats_service.h | gnunet_ats_service.h | |||
---|---|---|---|---|
skipping to change at line 404 | skipping to change at line 404 | |||
/** | /** | |||
* Is a peer reachable? | * Is a peer reachable? | |||
*/ | */ | |||
// GNUNET_ATS_AVAILABILITY_REACHABLE = 2048, | // GNUNET_ATS_AVAILABILITY_REACHABLE = 2048, | |||
/** | /** | |||
* Is there a connection established to a peer using this transport | * Is there a connection established to a peer using this transport | |||
*/ | */ | |||
// GNUNET_ATS_AVAILABILITY_CONNECTED = 2049 | // GNUNET_ATS_AVAILABILITY_CONNECTED = 2049 | |||
}; | }; | |||
/** | ||||
* Number of ATS quality properties | ||||
*/ | ||||
#define GNUNET_ATS_QualityPropertiesCount 2 | ||||
/** | ||||
* ATS quality properties as array initializer | ||||
*/ | ||||
#define GNUNET_ATS_QualityProperties {GNUNET_ATS_QUALITY_NET_DELAY, GNUNET_ | ||||
ATS_QUALITY_NET_DISTANCE} | ||||
/** | ||||
* Number of ATS quality properties | ||||
*/ | ||||
#define GNUNET_ATS_NetworkTypeCount 5 | ||||
/** | ||||
* ATS quality properties as array initializer | ||||
*/ | ||||
#define GNUNET_ATS_NetworkType {GNUNET_ATS_NET_UNSPECIFIED, GNUNET_ATS_NET_ | ||||
LOOPBACK, GNUNET_ATS_NET_LAN, GNUNET_ATS_NET_WAN, GNUNET_ATS_NET_WLAN} | ||||
GNUNET_NETWORK_STRUCT_BEGIN | GNUNET_NETWORK_STRUCT_BEGIN | |||
/** | /** | |||
* struct used to communicate the transport's properties like cost and | * struct used to communicate the transport's properties like cost and | |||
* quality of service as well as high-level constraints on resource | * quality of service as well as high-level constraints on resource | |||
* consumption. | * consumption. | |||
* | * | |||
* +---+ | * +---+ | |||
* +-----------+ Constraints | | Plugin properties +---------+ | * +-----------+ Constraints | | Plugin properties +---------+ | |||
* | Highlevel |------------> |ATS| <------------------|Transport| | * | Highlevel |------------> |ATS| <------------------|Transport| | |||
skipping to change at line 521 | skipping to change at line 541 | |||
* | * | |||
* @param sh handle | * @param sh handle | |||
* @param peer identity of the peer | * @param peer identity of the peer | |||
*/ | */ | |||
void | void | |||
GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SchedulingHandle *sh, | GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SchedulingHandle *sh, | |||
const struct GNUNET_PeerIdentity *peer); | const struct GNUNET_PeerIdentity *peer); | |||
/** | /** | |||
* Returns where the address is located: LAN or WAN or ... | * Returns where the address is located: LAN or WAN or ... | |||
* @param sh the GNUNET_ATS_SchedulingHandle handle | ||||
* @param addr address | * @param addr address | |||
* @param addrlen address length | * @param addrlen address length | |||
* @return location as GNUNET_ATS_Information | * @return location as GNUNET_ATS_Information | |||
*/ | */ | |||
struct GNUNET_ATS_Information | const struct GNUNET_ATS_Information | |||
GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle *sh, | GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle *sh, | |||
const struct sockaddr * addr, | const struct sockaddr * addr, | |||
socklen_t addrlen); | socklen_t addrlen); | |||
/** | /** | |||
* We have updated performance statistics for a given address. Note | * We have updated performance statistics for a given address. Note | |||
* that this function can be called for addresses that are currently | * that this function can be called for addresses that are currently | |||
* in use as well as addresses that are valid but not actively in use. | * in use as well as addresses that are valid but not actively in use. | |||
* Furthermore, the peer may not even be connected to us right now (in | * Furthermore, the peer may not even be connected to us right now (in | |||
* which case the call may be ignored or the information may be stored | * which case the call may be ignored or the information may be stored | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 24 lines changed or added | |||
gnunet_block_lib.h | gnunet_block_lib.h | |||
---|---|---|---|---|
skipping to change at line 95 | skipping to change at line 95 | |||
GNUNET_BLOCK_TYPE_DHT_HELLO = 7, | GNUNET_BLOCK_TYPE_DHT_HELLO = 7, | |||
/** | /** | |||
* Block for testing. | * Block for testing. | |||
*/ | */ | |||
GNUNET_BLOCK_TYPE_TEST = 8, | GNUNET_BLOCK_TYPE_TEST = 8, | |||
/** | /** | |||
* Block for storing .gnunet-domains | * Block for storing .gnunet-domains | |||
*/ | */ | |||
GNUNET_BLOCK_TYPE_DNS = 10 | GNUNET_BLOCK_TYPE_DNS = 10, | |||
/** | ||||
* Block for storing record data | ||||
*/ | ||||
GNUNET_BLOCK_TYPE_GNS_NAMERECORD = 11 | ||||
}; | }; | |||
/** | /** | |||
* Possible ways for how a block may relate to a query. | * Possible ways for how a block may relate to a query. | |||
*/ | */ | |||
enum GNUNET_BLOCK_EvaluationResult | enum GNUNET_BLOCK_EvaluationResult | |||
{ | { | |||
/** | /** | |||
* Valid result, and there may be more. | * Valid result, and there may be more. | |||
*/ | */ | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 6 lines changed or added | |||
gnunet_common.h | gnunet_common.h | |||
---|---|---|---|---|
skipping to change at line 52 | skipping to change at line 52 | |||
#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 | |||
/** | /** | |||
* Version of the API (for entire gnunetutil.so library). | * Version of the API (for entire gnunetutil.so library). | |||
*/ | */ | |||
#define GNUNET_UTIL_VERSION 0x00090100 | #define GNUNET_UTIL_VERSION 0x00090200 | |||
/** | /** | |||
* 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 | |||
#define GNUNET_NO 0 | #define GNUNET_NO 0 | |||
#define GNUNET_MIN(a,b) (((a) < (b)) ? (a) : (b)) | #define GNUNET_MIN(a,b) (((a) < (b)) ? (a) : (b)) | |||
#define GNUNET_MAX(a,b) (((a) > (b)) ? (a) : (b)) | #define GNUNET_MAX(a,b) (((a) > (b)) ? (a) : (b)) | |||
/* some systems use one underscore only, and mingw uses no underscore... */ | ||||
#ifndef __BYTE_ORDER | ||||
#ifdef _BYTE_ORDER | ||||
#define __BYTE_ORDER _BYTE_ORDER | ||||
#else | ||||
#ifdef BYTE_ORDER | ||||
#define __BYTE_ORDER BYTE_ORDER | ||||
#endif | ||||
#endif | ||||
#endif | ||||
#ifndef __BIG_ENDIAN | ||||
#ifdef _BIG_ENDIAN | ||||
#define __BIG_ENDIAN _BIG_ENDIAN | ||||
#else | ||||
#ifdef BIG_ENDIAN | ||||
#define __BIG_ENDIAN BIG_ENDIAN | ||||
#endif | ||||
#endif | ||||
#endif | ||||
#ifndef __LITTLE_ENDIAN | ||||
#ifdef _LITTLE_ENDIAN | ||||
#define __LITTLE_ENDIAN _LITTLE_ENDIAN | ||||
#else | ||||
#ifdef LITTLE_ENDIAN | ||||
#define __LITTLE_ENDIAN LITTLE_ENDIAN | ||||
#endif | ||||
#endif | ||||
#endif | ||||
/** | /** | |||
* Endian operations | * Endian operations | |||
*/ | */ | |||
# if __BYTE_ORDER == __LITTLE_ENDIAN | # if __BYTE_ORDER == __LITTLE_ENDIAN | |||
# define GNUNET_htobe16(x) __bswap_16 (x) | # define GNUNET_htobe16(x) __bswap_16 (x) | |||
# define GNUNET_htole16(x) (x) | # define GNUNET_htole16(x) (x) | |||
# define GNUNET_be16toh(x) __bswap_16 (x) | # define GNUNET_be16toh(x) __bswap_16 (x) | |||
# define GNUNET_le16toh(x) (x) | # define GNUNET_le16toh(x) (x) | |||
skipping to change at line 116 | skipping to change at line 145 | |||
/** | /** | |||
* gcc-ism to get packed structs. | * gcc-ism to get packed structs. | |||
*/ | */ | |||
#define GNUNET_PACKED __attribute__((packed)) | #define GNUNET_PACKED __attribute__((packed)) | |||
/** | /** | |||
* 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 | ||||
*/ | ||||
#define GNUNET_NORETURN __attribute__((noreturn)) | ||||
#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) | |||
*/ | */ | |||
#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) | |||
skipping to change at line 286 | skipping to change at line 320 | |||
* @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_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 (GN_UNLIKELY(log_call_enabled == -1))\ | if ((GNUNET_EXTRA_LOGGING > 0) || ((GNUNET_ERROR_TYPE_DEBUG & (kind)) == | |||
log_call_enabled = GNUNET_get_log_call_status ((kind) & (~GNUNET_ERROR_ | 0)) { \ | |||
TYPE_BULK), comp, __FILE__, __FUNCTION__, log_line);\ | if (GN_UNLIKELY(log_call_enabled == -1))\ | |||
if (GN_UNLIKELY(skip_log > 0)) {skip_log--;}\ | log_call_enabled = GNUNET_get_log_call_status ((kind) & (~GNUNET_ERRO | |||
else {\ | R_TYPE_BULK), (comp), __FILE__, __FUNCTION__, log_line); \ | |||
if (GN_UNLIKELY(log_call_enabled))\ | if (GN_UNLIKELY(skip_log > 0)) {skip_log--;}\ | |||
GNUNET_log_from_nocheck (kind, comp, __VA_ARGS__);\ | else {\ | |||
if (GN_UNLIKELY(log_call_enabled))\ | ||||
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 (GN_UNLIKELY(log_call_enabled == -1))\ | if ((GNUNET_EXTRA_LOGGING > 0) || ((GNUNET_ERROR_TYPE_DEBUG & (kind)) == | |||
log_call_enabled = GNUNET_get_log_call_status ((kind) & (~GNUNET_ERROR_ | 0)) { \ | |||
TYPE_BULK), NULL, __FILE__, __FUNCTION__, log_line);\ | if (GN_UNLIKELY(log_call_enabled == -1))\ | |||
if (GN_UNLIKELY(skip_log > 0)) {skip_log--;}\ | log_call_enabled = GNUNET_get_log_call_status ((kind) & (~GNUNET_ERRO | |||
else {\ | R_TYPE_BULK), NULL, __FILE__, __FUNCTION__, log_line);\ | |||
if (GN_UNLIKELY(log_call_enabled))\ | if (GN_UNLIKELY(skip_log > 0)) {skip_log--;}\ | |||
GNUNET_log_nocheck (kind, __VA_ARGS__);\ | else {\ | |||
if (GN_UNLIKELY(log_call_enabled))\ | ||||
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 | |||
/** | /** | |||
* Abort the process, generate a core dump if possible. | * Abort the process, generate a core dump if possible. | |||
*/ | */ | |||
void | void | |||
GNUNET_abort (void); | 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 | |||
* @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 (unsigned int n, int check_reset); | |||
skipping to change at line 390 | skipping to change at line 428 | |||
* 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. | |||
*/ | */ | |||
const char * | const char * | |||
GNUNET_i2s (const struct GNUNET_PeerIdentity *pid); | GNUNET_i2s (const struct GNUNET_PeerIdentity *pid); | |||
/** | /** | |||
* Convert a peer identity to a string (for printing debug messages). | ||||
* This is one of the very few calls in the entire API that is | ||||
* NOT reentrant! | ||||
* | ||||
* @param pid the peer identity | ||||
* @return string form of the pid; will be overwritten by next | ||||
* call to GNUNET_i2s. | ||||
*/ | ||||
const char * | ||||
GNUNET_i2s_full (const struct GNUNET_PeerIdentity *pid); | ||||
/** | ||||
* Convert a "struct sockaddr*" (IPv4 or IPv6 address) to a string | * Convert a "struct sockaddr*" (IPv4 or IPv6 address) to a string | |||
* (for printing debug messages). This is one of the very few calls | * (for printing debug messages). This is one of the very few calls | |||
* in the entire API that is NOT reentrant! | * in the entire API that is NOT reentrant! | |||
* | * | |||
* @param addr the address | * @param addr the address | |||
* @param addrlen the length of the address | * @param addrlen the length of the address | |||
* @return nicely formatted string for the address | * @return nicely formatted string for the address | |||
* will be overwritten by next call to GNUNET_a2s. | * will be overwritten by next call to GNUNET_a2s. | |||
*/ | */ | |||
const char * | const char * | |||
skipping to change at line 483 | skipping to change at line 533 | |||
GNUNET_ntohll (uint64_t n); | GNUNET_ntohll (uint64_t n); | |||
/** | /** | |||
* Convert unsigned 64-bit integer to network-byte-order. | * Convert unsigned 64-bit integer to network-byte-order. | |||
* @param n the value in host byte order | * @param n the value in host byte order | |||
* @return the same value in network byte order | * @return the same value in network byte order | |||
*/ | */ | |||
uint64_t | uint64_t | |||
GNUNET_htonll (uint64_t n); | GNUNET_htonll (uint64_t n); | |||
/** | ||||
* Convert double to network-byte-order. | ||||
* @param d the value in network byte order | ||||
* @return the same value in host byte order | ||||
*/ | ||||
double | ||||
GNUNET_hton_double (double d); | ||||
/** | ||||
* Convert double to host-byte-order | ||||
* @param d the value in network byte order | ||||
* @return the same value in host byte order | ||||
*/ | ||||
double | ||||
GNUNET_ntoh_double (double d); | ||||
/* ************************* allocation functions ****************** */ | /* ************************* allocation functions ****************** */ | |||
/** | /** | |||
* Maximum allocation with GNUNET_malloc macro. | * Maximum allocation with GNUNET_malloc macro. | |||
*/ | */ | |||
#define GNUNET_MAX_MALLOC_CHECKED (1024 * 1024 * 40) | #define GNUNET_MAX_MALLOC_CHECKED (1024 * 1024 * 40) | |||
/** | /** | |||
* Wrapper around malloc. Allocates size bytes of memory. | * Wrapper around malloc. Allocates size bytes of memory. | |||
* The memory will be zero'ed out. | * The memory will be zero'ed out. | |||
End of changes. 8 change blocks. | ||||
16 lines changed or deleted | 84 lines changed or added | |||
gnunet_config.h | gnunet_config.h | |||
---|---|---|---|---|
skipping to change at line 205 | skipping to change at line 205 | |||
/* 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 to 1 if you have the `gettimeofday' function. */ | |||
#define HAVE_GETTIMEOFDAY 1 | #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. */ | |||
/* #undef HAVE_GLPK_H */ | #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'. */ | |||
/* #undef HAVE_GLP_IOCP_PRESOLVE */ | #define HAVE_GLP_IOCP_PRESOLVE 1 | |||
/* Define to 1 if you have the `gmtime' function. */ | /* Define to 1 if you have the `gmtime' function. */ | |||
#define HAVE_GMTIME 1 | #define HAVE_GMTIME 1 | |||
/* Define to 1 if you have the `gmtime_r' function. */ | /* Define to 1 if you have the `gmtime_r' function. */ | |||
#define HAVE_GMTIME_R 1 | #define HAVE_GMTIME_R 1 | |||
/* Define if you have the iconv() function. */ | /* Define if you have the iconv() function. */ | |||
#define HAVE_ICONV 1 | #define HAVE_ICONV 1 | |||
skipping to change at line 250 | skipping to change at line 250 | |||
/* Define to 1 if you have a functional curl library. */ | /* Define to 1 if you have a functional curl library. */ | |||
#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 */ | |||
/* #undef HAVE_LIBGLPK */ | #define HAVE_LIBGLPK 1 | |||
/* Define to 1 if you have the `intl' library (-lintl). */ | /* Define to 1 if you have the `intl' library (-lintl). */ | |||
/* #undef HAVE_LIBINTL */ | /* #undef HAVE_LIBINTL */ | |||
/* Define to 1 if you have the <libintl.h> header file. */ | /* Define to 1 if you have the <libintl.h> header file. */ | |||
#define HAVE_LIBINTL_H 1 | #define HAVE_LIBINTL_H 1 | |||
/* Define to 1 if you have the `kstat' library (-lkstat). */ | /* Define to 1 if you have the `kstat' library (-lkstat). */ | |||
/* #undef HAVE_LIBKSTAT */ | /* #undef HAVE_LIBKSTAT */ | |||
skipping to change at line 276 | skipping to change at line 276 | |||
/* Define to 1 if you have the `resolv' library (-lresolv). */ | /* Define to 1 if you have the `resolv' library (-lresolv). */ | |||
/* #undef HAVE_LIBRESOLV */ | /* #undef HAVE_LIBRESOLV */ | |||
/* Define to 1 if you have the `rt' library (-lrt). */ | /* Define to 1 if you have the `rt' library (-lrt). */ | |||
/* #undef HAVE_LIBRT */ | /* #undef HAVE_LIBRT */ | |||
/* Define to 1 if you have the `socket' library (-lsocket). */ | /* Define to 1 if you have the `socket' library (-lsocket). */ | |||
/* #undef HAVE_LIBSOCKET */ | /* #undef HAVE_LIBSOCKET */ | |||
/* Define if you have the unistring library. */ | ||||
#define HAVE_LIBUNISTRING 1 | ||||
/* 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 to 1 if you have the `localtime_r' function. */ | |||
skipping to change at line 706 | skipping to change at line 709 | |||
/* 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.1" | #define PACKAGE_STRING "gnunet 0.9.2" | |||
/* 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.1" | #define PACKAGE_VERSION "0.9.2" | |||
/* 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 748 | skipping to change at line 751 | |||
/* 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.1" | #define VERSION "0.9.2" | |||
/* 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 */ | |||
/* 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 | |||
End of changes. 7 change blocks. | ||||
6 lines changed or deleted | 9 lines changed or added | |||
gnunet_crypto_lib.h | gnunet_crypto_lib.h | |||
---|---|---|---|---|
skipping to change at line 224 | skipping to change at line 224 | |||
/** | /** | |||
* Seed a weak random generator. Only GNUNET_CRYPTO_QUALITY_WEAK-mode gener ator | * Seed a weak random generator. Only GNUNET_CRYPTO_QUALITY_WEAK-mode gener ator | |||
* can be seeded. | * can be seeded. | |||
* | * | |||
* @param seed the seed to use | * @param seed the seed to use | |||
*/ | */ | |||
void | void | |||
GNUNET_CRYPTO_seed_weak_random (int32_t seed); | GNUNET_CRYPTO_seed_weak_random (int32_t seed); | |||
/** | /** | |||
* Perform an incremental step in a CRC16 (for TCP/IP) calculation. | ||||
* | ||||
* @param sum current sum, initially 0 | ||||
* @param buf buffer to calculate CRC over (must be 16-bit aligned) | ||||
* @param len number of bytes in hdr, must be multiple of 2 | ||||
* @return updated crc sum (must be subjected to GNUNET_CRYPTO_crc16_finish | ||||
to get actual crc16) | ||||
*/ | ||||
uint32_t | ||||
GNUNET_CRYPTO_crc16_step (uint32_t sum, const void *buf, size_t len); | ||||
/** | ||||
* Convert results from GNUNET_CRYPTO_crc16_step to final crc16. | ||||
* | ||||
* @param sum cummulative sum | ||||
* @return crc16 value | ||||
*/ | ||||
uint16_t | ||||
GNUNET_CRYPTO_crc16_finish (uint32_t sum); | ||||
/** | ||||
* Calculate the checksum of a buffer in one step. | ||||
* | ||||
* @param buf buffer to calculate CRC over (must be 16-bit aligned) | ||||
* @param len number of bytes in hdr, must be multiple of 2 | ||||
* @return crc16 value | ||||
*/ | ||||
uint16_t | ||||
GNUNET_CRYPTO_crc16_n (const void *buf, size_t len); | ||||
/** | ||||
* Compute the CRC32 checksum for the first len | * Compute the CRC32 checksum for the first len | |||
* bytes of the buffer. | * bytes of the buffer. | |||
* | * | |||
* @param buf the data over which we're taking the CRC | * @param buf the data over which we're taking the CRC | |||
* @param len the length of the buffer in bytes | * @param len the length of the buffer in bytes | |||
* @return the resulting CRC32 checksum | * @return the resulting CRC32 checksum | |||
*/ | */ | |||
int32_t | int32_t | |||
GNUNET_CRYPTO_crc32_n (const void *buf, size_t len); | GNUNET_CRYPTO_crc32_n (const void *buf, size_t len); | |||
skipping to change at line 353 | skipping to change at line 383 | |||
* @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 GNUNET_HashCode * block, | |||
struct GNUNET_CRYPTO_HashAsciiEncoded *result); | struct GNUNET_CRYPTO_HashAsciiEncoded *result); | |||
/** | /** | |||
* Convert ASCII encoding back to GNUNET_CRYPTO_hash | * Convert ASCII encoding back to GNUNET_CRYPTO_hash | |||
* | ||||
* @param enc the encoding | * @param enc the encoding | |||
* @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_string (const char *enc, GNUNET_HashCode * result); | GNUNET_CRYPTO_hash_from_string2 (const char *enc, size_t enclen, | |||
GNUNET_HashCode * result); | ||||
/** | ||||
* Convert ASCII encoding back to GNUNET_CRYPTO_hash | ||||
* @param enc the encoding | ||||
* @param result where to store the GNUNET_CRYPTO_hash code | ||||
* @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco | ||||
ding | ||||
*/ | ||||
#define GNUNET_CRYPTO_hash_from_string(enc, result) \ | ||||
GNUNET_CRYPTO_hash_from_string2 (enc, strlen(enc), result) | ||||
/** | /** | |||
* Compute the distance between 2 hashcodes. | * Compute the distance between 2 hashcodes. | |||
* 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 | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 45 lines changed or added | |||
gnunet_dht_service.h | gnunet_dht_service.h | |||
---|---|---|---|---|
skipping to change at line 205 | skipping to change at line 205 | |||
* 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. | |||
* | * | |||
* On return get_handle will no longer be valid, caller | * On return get_handle will no longer be valid, caller | |||
* must not use again!!! | * must not use again!!! | |||
*/ | */ | |||
void | void | |||
GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle); | GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle); | |||
/* *************** Extended API: monitor ******************* */ | ||||
struct GNUNET_DHT_MonitorHandle; | ||||
/** | ||||
* Callback called on each request going through the DHT. | ||||
* | ||||
* @param cls Closure. | ||||
* @param mtype Type of the DHT message monitored. | ||||
* @param exp When will this value expire. | ||||
* @param key Key of the result/request. | ||||
* @param get_path Peers on reply path (or NULL if not recorded). | ||||
* @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_length number of entries in get_path. | ||||
* @param desired_replication_level Desired replication level. | ||||
* @param type Type of the result/request. | ||||
* @param data Pointer to the result data. | ||||
* @param size Number of bytes in data. | ||||
*/ | ||||
typedef void (*GNUNET_DHT_MonitorCB) (void *cls, | ||||
uint16_t mtype, | ||||
struct GNUNET_TIME_Absolute exp, | ||||
const GNUNET_HashCode * key, | ||||
const struct GNUNET_PeerIdentity * | ||||
get_path, unsigned int get_path_lengt | ||||
h, | ||||
const struct GNUNET_PeerIdentity * | ||||
put_path, unsigned int put_path_lengt | ||||
h, | ||||
uint32_t desired_replication_level, | ||||
enum GNUNET_DHT_RouteOption options, | ||||
enum GNUNET_BLOCK_Type type, | ||||
const void *data, | ||||
size_t size); | ||||
/** | ||||
* Start monitoring the local DHT service. | ||||
* | ||||
* @param handle Handle to the DHT service. | ||||
* @param type Type of blocks that are of interest. | ||||
* @param key Key of data of interest, NULL for all. | ||||
* @param cb Callback to process all monitored data. | ||||
* @param cb_cls Closure for cb. | ||||
* | ||||
* @return Handle to stop monitoring. | ||||
*/ | ||||
struct GNUNET_DHT_MonitorHandle * | ||||
GNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle, | ||||
enum GNUNET_BLOCK_Type type, | ||||
const GNUNET_HashCode *key, | ||||
GNUNET_DHT_MonitorCB cb, | ||||
void *cb_cls); | ||||
/** | ||||
* Stop monitoring. | ||||
* | ||||
* @param handle The handle to the monitor request returned by monitor_star | ||||
t. | ||||
* | ||||
* On return handle will no longer be valid, caller must not use again!!! | ||||
*/ | ||||
void | ||||
GNUNET_DHT_monitor_stop (struct GNUNET_DHT_MonitorHandle *handle); | ||||
#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_dht_service.h */ | /* gnunet_dht_service.h */ | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 65 lines changed or added | |||
gnunet_disk_lib.h | gnunet_disk_lib.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_disk_lib.h | * @file include/gnunet_disk_lib.h | |||
* @brief disk IO apis | * @brief disk IO apis | |||
*/ | */ | |||
#ifndef GNUNET_DISK_LIB_H | #ifndef GNUNET_DISK_LIB_H | |||
#define GNUNET_DISK_LIB_H | #define GNUNET_DISK_LIB_H | |||
/** | #if WINDOWS | |||
* Opaque handle used to access files. | #define OFF_T uint64_t | |||
*/ | #else | |||
struct GNUNET_DISK_FileHandle; | #define OFF_T off_t | |||
#endif | ||||
/** | /** | |||
* Handle used to manage a pipe. | * Handle used to manage a pipe. | |||
*/ | */ | |||
struct GNUNET_DISK_PipeHandle; | struct GNUNET_DISK_PipeHandle; | |||
enum GNUNET_FILE_Type | enum GNUNET_FILE_Type | |||
{ | { | |||
GNUNET_DISK_FILE, GNUNET_PIPE | GNUNET_DISK_FILE, GNUNET_PIPE | |||
}; | }; | |||
skipping to change at line 288 | skipping to change at line 289 | |||
int | int | |||
GNUNET_DISK_file_test (const char *fil); | GNUNET_DISK_file_test (const char *fil); | |||
/** | /** | |||
* Move the read/write pointer in a file | * Move the read/write pointer in a file | |||
* @param h handle of an open file | * @param h handle of an open file | |||
* @param offset position to move to | * @param offset position to move to | |||
* @param whence specification to which position the offset parameter relat es to | * @param whence specification to which position the offset parameter relat es to | |||
* @return the new position on success, GNUNET_SYSERR otherwise | * @return the new position on success, GNUNET_SYSERR otherwise | |||
*/ | */ | |||
off_t | OFF_T | |||
GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle *h, off_t offset | GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle *h, OFF_T offset | |||
, | , | |||
enum GNUNET_DISK_Seek whence); | enum GNUNET_DISK_Seek whence); | |||
/** | /** | |||
* Get the size of the file (or directory) | * Get the size of the file (or directory) | |||
* of the given file (in bytes). | * of the given file (in bytes). | |||
* | * | |||
* @param filename name of the file or directory | * @param filename name of the file or directory | |||
* @param size set to the size of the file (or, | * @param size set to the size of the file (or, | |||
* in the case of directories, the sum | * in the case of directories, the sum | |||
* of all sizes of files in the directory) | * of all sizes of files in the directory) | |||
skipping to change at line 366 | skipping to change at line 367 | |||
/** | /** | |||
* Get the size of an open file. | * Get the size of an open file. | |||
* | * | |||
* @param fh open file handle | * @param fh open file handle | |||
* @param size where to write size of the file | * @param size where to write size of the file | |||
* @return GNUNET_OK on success, GNUNET_SYSERR on error | * @return GNUNET_OK on success, GNUNET_SYSERR on error | |||
*/ | */ | |||
int | int | |||
GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh, | GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh, | |||
off_t *size); | OFF_T *size); | |||
/** | /** | |||
* Creates an interprocess channel | * Creates an interprocess channel | |||
* @param blocking creates an asynchronous pipe if set to GNUNET_NO | * | |||
* @param blocking_read creates an asynchronous pipe for reading if set to | ||||
GNUNET_NO | ||||
* @param blocking_write creates an asynchronous pipe for writing if set to | ||||
GNUNET_NO | ||||
* @param inherit_read 1 to make read handle inheritable, 0 otherwise (NT o nly) | * @param inherit_read 1 to make read handle inheritable, 0 otherwise (NT o nly) | |||
* @param inherit_write 1 to make write handle inheritable, 0 otherwise (NT only) | * @param inherit_write 1 to make write handle inheritable, 0 otherwise (NT only) | |||
* @return handle to the new pipe, NULL on error | * @return handle to the new pipe, NULL on error | |||
*/ | */ | |||
struct GNUNET_DISK_PipeHandle * | struct GNUNET_DISK_PipeHandle * | |||
GNUNET_DISK_pipe (int blocking, int inherit_read, int inherit_write); | GNUNET_DISK_pipe (int blocking_read, int blocking_write, int inherit_read, | |||
int inherit_write); | ||||
/** | ||||
* Creates a pipe object from a couple of file descriptors. | ||||
* Useful for wrapping existing pipe FDs. | ||||
* | ||||
* @param blocking_read creates an asynchronous pipe for reading if set to | ||||
GNUNET_NO | ||||
* @param blocking_write creates an asynchronous pipe for writing if set to | ||||
GNUNET_NO | ||||
* @param fd an array of two fd values. One of them may be -1 for read-only | ||||
or write-only pipes | ||||
* | ||||
* @return handle to the new pipe, NULL on error | ||||
*/ | ||||
struct GNUNET_DISK_PipeHandle * | ||||
GNUNET_DISK_pipe_from_fd (int blocking_read, int blocking_write, int fd[2]) | ||||
; | ||||
/** | /** | |||
* Closes an interprocess channel | * Closes an interprocess channel | |||
* @param p pipe | * @param p pipe | |||
* @return GNUNET_OK on success, GNUNET_SYSERR otherwise | * @return GNUNET_OK on success, GNUNET_SYSERR otherwise | |||
*/ | */ | |||
int | int | |||
GNUNET_DISK_pipe_close (struct GNUNET_DISK_PipeHandle *p); | GNUNET_DISK_pipe_close (struct GNUNET_DISK_PipeHandle *p); | |||
/** | /** | |||
skipping to change at line 430 | skipping to change at line 446 | |||
* @param result the buffer to write the result to | * @param result the buffer to write the result to | |||
* @param len the maximum number of bytes to read | * @param len the maximum number of bytes to read | |||
* @return the number of bytes read on success, GNUNET_SYSERR on failure | * @return the number of bytes read on success, GNUNET_SYSERR on failure | |||
*/ | */ | |||
ssize_t | ssize_t | |||
GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h, void *result , | GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h, void *result , | |||
size_t len); | size_t len); | |||
/** | /** | |||
* Read the contents of a binary file into a buffer. | * Read the contents of a binary file into a buffer. | |||
* Guarantees not to block (returns GNUNET_SYSERR and sets errno to EAGAIN | ||||
* when no data can be read). | ||||
* | ||||
* @param h handle to an open file | ||||
* @param result the buffer to write the result to | ||||
* @param len the maximum number of bytes to read | ||||
* @return the number of bytes read on success, GNUNET_SYSERR on failure | ||||
*/ | ||||
ssize_t | ||||
GNUNET_DISK_file_read_non_blocking (const struct GNUNET_DISK_FileHandle * h | ||||
, | ||||
void *result, size_t len); | ||||
/** | ||||
* Read the contents of a binary file into a buffer. | ||||
* | * | |||
* @param fn file name | * @param fn file name | |||
* @param result the buffer to write the result to | * @param result the buffer to write the result to | |||
* @param len the maximum number of bytes to read | * @param len the maximum number of bytes to read | |||
* @return number of bytes read, GNUNET_SYSERR on failure | * @return number of bytes read, GNUNET_SYSERR on failure | |||
*/ | */ | |||
ssize_t | ssize_t | |||
GNUNET_DISK_fn_read (const char *fn, void *result, size_t len); | GNUNET_DISK_fn_read (const char *fn, void *result, size_t len); | |||
/** | /** | |||
skipping to change at line 452 | skipping to change at line 482 | |||
* @param h handle to open file | * @param h handle to open file | |||
* @param buffer the data to write | * @param buffer the data to write | |||
* @param n number of bytes to write | * @param n number of bytes to write | |||
* @return number of bytes written on success, GNUNET_SYSERR on error | * @return number of bytes written on success, GNUNET_SYSERR on error | |||
*/ | */ | |||
ssize_t | ssize_t | |||
GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle *h, | GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle *h, | |||
const void *buffer, size_t n); | const void *buffer, size_t n); | |||
/** | /** | |||
* Write a buffer to a file, blocking, if necessary. | ||||
* @param h handle to open file | ||||
* @param buffer the data to write | ||||
* @param n number of bytes to write | ||||
* @return number of bytes written on success, GNUNET_SYSERR on error | ||||
*/ | ||||
ssize_t | ||||
GNUNET_DISK_file_write_blocking (const struct GNUNET_DISK_FileHandle * h, | ||||
const void *buffer, size_t n); | ||||
/** | ||||
* Write a buffer to a file. If the file is longer than | * Write a buffer to a file. If the file is longer than | |||
* the given buffer size, it will be truncated. | * the given buffer size, it will be truncated. | |||
* | * | |||
* @param fn file name | * @param fn file name | |||
* @param buffer the data to write | * @param buffer the data to write | |||
* @param n number of bytes to write | * @param n number of bytes to write | |||
* @param mode file permissions | * @param mode file permissions | |||
* @return number of bytes written on success, GNUNET_SYSERR on error | * @return number of bytes written on success, GNUNET_SYSERR on error | |||
*/ | */ | |||
ssize_t | ssize_t | |||
skipping to change at line 535 | skipping to change at line 576 | |||
/** | /** | |||
* Scan a directory for files using the scheduler to run a task for | * Scan a directory for files using the scheduler to run a task for | |||
* each entry. The name of the directory must be expanded first (!). | * each entry. The name of the directory must be expanded first (!). | |||
* If a scheduler does not need to be used, GNUNET_DISK_directory_scan | * If a scheduler does not need to be used, GNUNET_DISK_directory_scan | |||
* may provide a simpler API. | * may provide a simpler API. | |||
* | * | |||
* @param prio priority to use | * @param prio priority to use | |||
* @param dirName the name of the directory | * @param dirName the name of the directory | |||
* @param callback the method to call for each file | * @param callback the method to call for each file | |||
* @param callback_cls closure for callback | * @param callback_cls closure for callback | |||
* @return GNUNET_YES if directory is not empty and 'callback' | ||||
* will be called later, GNUNET_NO otherwise, GNUNET_SYSERR on erro | ||||
r. | ||||
*/ | */ | |||
void | int | |||
GNUNET_DISK_directory_iterator_start (enum GNUNET_SCHEDULER_Priority prio, | GNUNET_DISK_directory_iterator_start (enum GNUNET_SCHEDULER_Priority prio, | |||
const char *dirName, | const char *dirName, | |||
GNUNET_DISK_DirectoryIteratorCallback | GNUNET_DISK_DirectoryIteratorCallback | |||
callback, void *callback_cls); | callback, void *callback_cls); | |||
/** | /** | |||
* Create the directory structure for storing | * Create the directory structure for storing | |||
* a file. | * a file. | |||
* | * | |||
* @param filename name of a file in the directory | * @param filename name of a file in the directory | |||
skipping to change at line 595 | skipping to change at line 638 | |||
/** | /** | |||
* Lock a part of a file. | * Lock a part of a file. | |||
* | * | |||
* @param fh file handle | * @param fh file handle | |||
* @param lockStart absolute position from where to lock | * @param lockStart absolute position from where to lock | |||
* @param lockEnd absolute position until where to lock | * @param lockEnd absolute position until where to lock | |||
* @param excl GNUNET_YES for an exclusive lock | * @param excl GNUNET_YES for an exclusive lock | |||
* @return GNUNET_OK on success, GNUNET_SYSERR on error | * @return GNUNET_OK on success, GNUNET_SYSERR on error | |||
*/ | */ | |||
int | int | |||
GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, off_t lockStart, | GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, OFF_T lockStart, | |||
off_t lockEnd, int excl); | OFF_T lockEnd, int excl); | |||
/** | /** | |||
* Unlock a part of a file | * Unlock a part of a file | |||
* @param fh file handle | * @param fh file handle | |||
* @param unlockStart absolute position from where to unlock | * @param unlockStart absolute position from where to unlock | |||
* @param unlockEnd absolute position until where to unlock | * @param unlockEnd absolute position until where to unlock | |||
* @return GNUNET_OK on success, GNUNET_SYSERR on error | * @return GNUNET_OK on success, GNUNET_SYSERR on error | |||
*/ | */ | |||
int | int | |||
GNUNET_DISK_file_unlock (struct GNUNET_DISK_FileHandle *fh, off_t unlockSta | GNUNET_DISK_file_unlock (struct GNUNET_DISK_FileHandle *fh, OFF_T unlockSta | |||
rt, | rt, | |||
off_t unlockEnd); | OFF_T unlockEnd); | |||
/** | /** | |||
* @brief Removes special characters as ':' from a filename. | * @brief Removes special characters as ':' from a filename. | |||
* @param fn the filename to canonicalize | * @param fn the filename to canonicalize | |||
*/ | */ | |||
void | void | |||
GNUNET_DISK_filename_canonicalize (char *fn); | GNUNET_DISK_filename_canonicalize (char *fn); | |||
/** | /** | |||
* @brief Change owner of a file | * @brief Change owner of a file | |||
skipping to change at line 678 | skipping to change at line 721 | |||
GNUNET_DISK_file_unmap (struct GNUNET_DISK_MapHandle *h); | GNUNET_DISK_file_unmap (struct GNUNET_DISK_MapHandle *h); | |||
/** | /** | |||
* Write file changes to disk | * Write file changes to disk | |||
* @param h handle to an open file | * @param h handle to an open file | |||
* @return GNUNET_OK on success, GNUNET_SYSERR otherwise | * @return GNUNET_OK on success, GNUNET_SYSERR otherwise | |||
*/ | */ | |||
int | int | |||
GNUNET_DISK_file_sync (const struct GNUNET_DISK_FileHandle *h); | GNUNET_DISK_file_sync (const struct GNUNET_DISK_FileHandle *h); | |||
/** | ||||
* Creates a named pipe/FIFO and opens it | ||||
* @param fn pointer to the name of the named pipe or to NULL | ||||
* @param flags open flags | ||||
* @param perm access permissions | ||||
* @return pipe handle on success, NULL on error | ||||
*/ | ||||
struct GNUNET_DISK_FileHandle * | ||||
GNUNET_DISK_npipe_create (char **fn, enum GNUNET_DISK_OpenFlags flags, | ||||
enum GNUNET_DISK_AccessPermissions perm); | ||||
/** | ||||
* Opens already existing named pipe/FIFO | ||||
* | ||||
* @param fn name of an existing named pipe | ||||
* @param flags open flags | ||||
* @param perm access permissions | ||||
* @return pipe handle on success, NULL on error | ||||
*/ | ||||
struct GNUNET_DISK_FileHandle * | ||||
GNUNET_DISK_npipe_open (const char *fn, enum GNUNET_DISK_OpenFlags flags, | ||||
enum GNUNET_DISK_AccessPermissions perm); | ||||
/** | ||||
* Closes a named pipe/FIFO | ||||
* @param pipe named pipe | ||||
* @return GNUNET_OK on success, GNUNET_SYSERR otherwise | ||||
*/ | ||||
int | ||||
GNUNET_DISK_npipe_close (struct GNUNET_DISK_FileHandle *pipe); | ||||
#if 0 /* keep Emacsens' auto-indent happy */ | #if 0 /* keep Emacsens' auto-indent happy */ | |||
{ | { | |||
#endif | #endif | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
/* ifndef GNUNET_DISK_LIB_H */ | /* ifndef GNUNET_DISK_LIB_H */ | |||
#endif | #endif | |||
/* end of gnunet_disk_lib.h */ | /* end of gnunet_disk_lib.h */ | |||
End of changes. 12 change blocks. | ||||
47 lines changed or deleted | 68 lines changed or added | |||
gnunet_fs_service.h | gnunet_fs_service.h | |||
---|---|---|---|---|
skipping to change at line 29 | skipping to change at line 29 | |||
*/ | */ | |||
/** | /** | |||
* @file include/gnunet_fs_service.h | * @file include/gnunet_fs_service.h | |||
* @brief API for file-sharing via GNUnet | * @brief API for file-sharing via GNUnet | |||
* @author Christian Grothoff | * @author Christian Grothoff | |||
*/ | */ | |||
#ifndef GNUNET_FS_LIB_H | #ifndef GNUNET_FS_LIB_H | |||
#define GNUNET_FS_LIB_H | #define GNUNET_FS_LIB_H | |||
#include "gnunet_util_lib.h" | #include "gnunet_util_lib.h" | |||
#include "gnunet_scheduler_lib.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 55 | skipping to change at line 56 | |||
* 2.2.x: with directories | * 2.2.x: with directories | |||
* 3.0.x: with namespaces | * 3.0.x: with namespaces | |||
* 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 | ||||
*/ | */ | |||
#define GNUNET_FS_VERSION 0x00090001 | #define GNUNET_FS_VERSION 0x00090102 | |||
/* ******************** 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 988 | skipping to change at line 990 | |||
* 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 trust did we offer for downloading this block? | |||
*/ | */ | |||
unsigned int trust_offered; | unsigned int trust_offered; | |||
/** | ||||
* 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; | ||||
} 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 1638 | skipping to change at line 1646 | |||
* Close our connection with the file-sharing service. | * Close our connection with the file-sharing service. | |||
* The callback given to GNUNET_FS_start will no longer be | * The callback given to GNUNET_FS_start will no longer be | |||
* called after this function returns. | * called after this function returns. | |||
* | * | |||
* @param h handle that was returned from GNUNET_FS_start | * @param h handle that was returned from GNUNET_FS_start | |||
*/ | */ | |||
void | void | |||
GNUNET_FS_stop (struct GNUNET_FS_Handle *h); | GNUNET_FS_stop (struct GNUNET_FS_Handle *h); | |||
/** | /** | |||
* Extract meta-data from a file. | ||||
* | ||||
* @param md metadata to set | ||||
* @param filename name of file to inspect | ||||
* @param extractors plugins to use | ||||
* @return GNUNET_SYSERR on error, otherwise the number | ||||
* of meta-data items obtained | ||||
*/ | ||||
int | ||||
GNUNET_FS_meta_data_extract_from_file (struct GNUNET_CONTAINER_MetaData *md | ||||
, | ||||
const char *filename, | ||||
struct EXTRACTOR_PluginList *extract | ||||
ors); | ||||
/** | ||||
* Function called on entries in a GNUNET_FS_FileInformation publish-struct ure. | * Function called on entries in a GNUNET_FS_FileInformation publish-struct ure. | |||
* | * | |||
* @param cls closure | * @param cls closure | |||
* @param fi the entry in the publish-structure | * @param fi the entry in the publish-structure | |||
* @param length length of the file or directory | * @param length length of the file or directory | |||
* @param meta metadata for the file or directory (can be modified) | * @param meta metadata for the file or directory (can be modified) | |||
* @param uri pointer to the keywords that will be used for this entry (can be modified) | * @param uri pointer to the keywords that will be used for this entry (can be modified) | |||
* @param bo block options (can be modified) | * @param bo block options (can be modified) | |||
* @param do_index should we index (can be modified) | * @param do_index should we index (can be modified) | |||
* @param client_info pointer to client context set upon creation (can be m odified) | * @param client_info pointer to client context set upon creation (can be m odified) | |||
skipping to change at line 1692 | skipping to change at line 1686 | |||
* | * | |||
* @param s structure to get the filename for | * @param s structure to get the filename for | |||
* @return NULL on error, otherwise filename that | * @return NULL on error, otherwise filename that | |||
* can be passed to "GNUNET_FS_file_information_recover" | * can be passed to "GNUNET_FS_file_information_recover" | |||
* to read this fi-struct from disk. | * to read this fi-struct from disk. | |||
*/ | */ | |||
const char * | const char * | |||
GNUNET_FS_file_information_get_id (struct GNUNET_FS_FileInformation *s); | GNUNET_FS_file_information_get_id (struct GNUNET_FS_FileInformation *s); | |||
/** | /** | |||
* Obtain the filename from the file information structure. | ||||
* | ||||
* @param s structure to get the filename for | ||||
* @return "filename" field of the structure (can be NULL) | ||||
*/ | ||||
const char * | ||||
GNUNET_FS_file_information_get_filename (struct GNUNET_FS_FileInformation * | ||||
s); | ||||
/** | ||||
* Set the filename in the file information structure. | ||||
* If filename was already set, frees it before setting the new one. | ||||
* Makes a copy of the argument. | ||||
* | ||||
* @param s structure to get the filename for | ||||
* @param filename filename to set | ||||
*/ | ||||
void | ||||
GNUNET_FS_file_information_set_filename (struct GNUNET_FS_FileInformation * | ||||
s, | ||||
const char *filename); | ||||
/** | ||||
* Create an entry for a file in a publish-structure. | * Create an entry for a file in a publish-structure. | |||
* | * | |||
* @param h handle to the file sharing subsystem | * @param h handle to the file sharing subsystem | |||
* @param client_info initial client-info value for this entry | * @param client_info initial client-info value for this entry | |||
* @param filename name of the file or directory to publish | * @param filename name of the file or directory to publish | |||
* @param keywords under which keywords should this file be available | * @param keywords under which keywords should this file be available | |||
* directly; can be NULL | * directly; can be NULL | |||
* @param meta metadata for the file | * @param meta metadata for the file | |||
* @param do_index GNUNET_YES for index, GNUNET_NO for insertion, | * @param do_index GNUNET_YES for index, GNUNET_NO for insertion, | |||
* GNUNET_SYSERR for simulation | * GNUNET_SYSERR for simulation | |||
skipping to change at line 1795 | skipping to change at line 1810 | |||
void *reader_cls, | void *reader_cls, | |||
const struct GNUNET_FS_Uri | const struct GNUNET_FS_Uri | |||
*keywords, | *keywords, | |||
const struct | const struct | |||
GNUNET_CONTAINER_MetaData *m eta, | GNUNET_CONTAINER_MetaData *m eta, | |||
int do_index, | int do_index, | |||
const struct | const struct | |||
GNUNET_FS_BlockOptions *bo); | GNUNET_FS_BlockOptions *bo); | |||
/** | /** | |||
* Function that a "GNUNET_FS_DirectoryScanner" should call | ||||
* for each entry in the directory. | ||||
* | ||||
* @param cls closure | ||||
* @param filename name of the file (including path); must end | ||||
* in a "/" (even on W32) if this is a directory | ||||
* @param fi information about the file (should not be | ||||
* used henceforth by the caller) | ||||
*/ | ||||
typedef void (*GNUNET_FS_FileProcessor) (void *cls, const char *filename, | ||||
struct GNUNET_FS_FileInformation * | ||||
fi); | ||||
/** | ||||
* Type of a function that will be used to scan a directory. | ||||
* | ||||
* @param cls closure | ||||
* @param h handle to the file sharing subsystem | ||||
* @param dirname name of the directory to scan | ||||
* @param do_index should files be indexed or inserted | ||||
* @param bo block options | ||||
* @param proc function to call on each entry | ||||
* @param proc_cls closure for proc | ||||
* @param emsg where to store an error message (on errors) | ||||
* @return GNUNET_OK on success | ||||
*/ | ||||
typedef int (*GNUNET_FS_DirectoryScanner) (void *cls, | ||||
struct GNUNET_FS_Handle * h, | ||||
const char *dirname, int do_inde | ||||
x, | ||||
const struct GNUNET_FS_BlockOpti | ||||
ons * | ||||
bo, GNUNET_FS_FileProcessor proc | ||||
, | ||||
void *proc_cls, char **emsg); | ||||
/** | ||||
* Simple, useful default implementation of a directory scanner | ||||
* (GNUNET_FS_DirectoryScanner). This implementation expects to get a | ||||
* UNIX filename, will publish all files in the directory except hidden | ||||
* files (those starting with a "."). Metadata will be extracted | ||||
* using GNU libextractor; the specific list of plugins should be | ||||
* specified in "cls", passing NULL will disable (!) metadata | ||||
* extraction. Keywords will be derived from the metadata and | ||||
* associated with directories as appropriate. This is strictly a | ||||
* convenience function (however, if all tools use it, there will | ||||
* be less of a chance of distinguishing users by the specific | ||||
* user-interface they were using). | ||||
* | ||||
* @param cls must be of type "struct EXTRACTOR_Extractor*" | ||||
* @param h handle to the file sharing subsystem | ||||
* @param dirname name of the directory to scan | ||||
* @param do_index should files be indexed or inserted | ||||
* @param bo block options | ||||
* @param proc function called on each entry | ||||
* @param proc_cls closure for proc | ||||
* @param emsg where to store an error message (on errors) | ||||
* @return GNUNET_OK on success | ||||
*/ | ||||
int | ||||
GNUNET_FS_directory_scanner_default (void *cls, struct GNUNET_FS_Handle *h, | ||||
const char *dirname, int do_index, | ||||
const struct GNUNET_FS_BlockOptions *b | ||||
o, | ||||
GNUNET_FS_FileProcessor proc, | ||||
void *proc_cls, char **emsg); | ||||
/** | ||||
* Create a publish-structure from an existing file hierarchy, inferring | ||||
* and organizing keywords and metadata as much as possible. This | ||||
* function primarily performs the recursive build and re-organizes | ||||
* keywords and metadata; for automatically getting metadata | ||||
* extraction, scanning of directories and creation of the respective | ||||
* GNUNET_FS_FileInformation entries the default scanner should be | ||||
* passed (GNUNET_FS_directory_scanner_default). This is strictly a | ||||
* convenience function. | ||||
* | ||||
* @param h handle to the file sharing subsystem | ||||
* @param client_info initial client-info value for this entry | ||||
* @param filename name of the top-level file or directory | ||||
* @param scanner function used to get a list of files in a directory | ||||
* @param scanner_cls closure for scanner | ||||
* @param do_index should files in the hierarchy be indexed? | ||||
* @param bo block options | ||||
* @param emsg where to store an error message | ||||
* @return publish structure entry for the directory, NULL on error | ||||
*/ | ||||
struct GNUNET_FS_FileInformation * | ||||
GNUNET_FS_file_information_create_from_directory (struct GNUNET_FS_Handle * | ||||
h, | ||||
void *client_info, | ||||
const char *filename, | ||||
GNUNET_FS_DirectoryScanne | ||||
r | ||||
scanner, void *scanner_cl | ||||
s, | ||||
int do_index, | ||||
const struct | ||||
GNUNET_FS_BlockOptions *b | ||||
o, | ||||
char **emsg); | ||||
/** | ||||
* Create an entry for an empty directory in a publish-structure. | * Create an entry for an empty directory in a publish-structure. | |||
* This function should be used by applications for which the | * This function should be used by applications for which the | |||
* use of "GNUNET_FS_file_information_create_from_directory" | * use of "GNUNET_FS_file_information_create_from_directory" | |||
* is not appropriate. | * is not appropriate. | |||
* | * | |||
* @param h handle to the file sharing subsystem | * @param h handle to the file sharing subsystem | |||
* @param client_info initial client-info value for this entry | * @param client_info initial client-info value for this entry | |||
* @param keywords under which keywords should this directory be available | * @param keywords under which keywords should this directory be available | |||
* directly; can be NULL | * directly; can be NULL | |||
* @param meta metadata for the directory | * @param meta metadata for the directory | |||
* @param bo block options | * @param bo block options | |||
* @param filename name of the directory; can be NULL | ||||
* @return publish structure entry for the directory , NULL on error | * @return publish structure entry for the directory , NULL on error | |||
*/ | */ | |||
struct GNUNET_FS_FileInformation * | struct GNUNET_FS_FileInformation * | |||
GNUNET_FS_file_information_create_empty_directory (struct GNUNET_FS_Handle *h, | GNUNET_FS_file_information_create_empty_directory (struct GNUNET_FS_Handle *h, | |||
void *client_info, | void *client_info, | |||
const struct GNUNET_FS_U ri | const struct GNUNET_FS_U ri | |||
*keywords, | *keywords, | |||
const struct | const struct | |||
GNUNET_CONTAINER_MetaDat a | GNUNET_CONTAINER_MetaDat a | |||
*meta, | *meta, | |||
const struct | const struct | |||
GNUNET_FS_BlockOptions * | GNUNET_FS_BlockOptions * | |||
bo); | bo, | |||
const char *filename); | ||||
/** | /** | |||
* Test if a given entry represents a directory. | * Test if a given entry represents a directory. | |||
* | * | |||
* @param ent check if this FI represents a directory | * @param ent check if this FI represents a directory | |||
* @return GNUNET_YES if so, GNUNET_NO if not | * @return GNUNET_YES if so, GNUNET_NO if not | |||
*/ | */ | |||
int | int | |||
GNUNET_FS_file_information_is_directory (const struct GNUNET_FS_FileInforma tion | GNUNET_FS_file_information_is_directory (const struct GNUNET_FS_FileInforma tion | |||
*ent); | *ent); | |||
skipping to change at line 2034 | skipping to change at line 1957 | |||
* | * | |||
* @param cls closure | * @param cls closure | |||
* @param uri URI under which the block is now available, NULL on error | * @param uri URI under which the block is now available, NULL on error | |||
* @param emsg error message, NULL on success | * @param emsg error message, NULL on success | |||
*/ | */ | |||
typedef void (*GNUNET_FS_PublishContinuation) (void *cls, | typedef void (*GNUNET_FS_PublishContinuation) (void *cls, | |||
const struct GNUNET_FS_Uri * uri, | const struct GNUNET_FS_Uri * uri, | |||
const char *emsg); | const char *emsg); | |||
/** | /** | |||
* Handle to cancel publish KSK operation. | ||||
*/ | ||||
struct GNUNET_FS_PublishKskContext; | ||||
/** | ||||
* Publish a KBlock on GNUnet. | * Publish a KBlock on GNUnet. | |||
* | * | |||
* @param h handle to the file sharing subsystem | * @param h handle to the file sharing subsystem | |||
* @param ksk_uri keywords to use | * @param ksk_uri keywords to use | |||
* @param meta metadata to use | * @param meta metadata to use | |||
* @param uri URI to refer to in the KBlock | * @param uri URI to refer to in the KBlock | |||
* @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) | ||||
*/ | */ | |||
void | struct GNUNET_FS_PublishKskContext * | |||
GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, | GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, | |||
const struct GNUNET_FS_Uri *ksk_uri, | const struct GNUNET_FS_Uri *ksk_uri, | |||
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 KSK publishing operation. | ||||
* | ||||
* @param pkc context of the operation to abort. | ||||
*/ | ||||
void | ||||
GNUNET_FS_publish_ksk_cancel (struct GNUNET_FS_PublishKskContext *pkc); | ||||
/** | ||||
* Handle to cancel publish SKS operation. | ||||
*/ | ||||
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 namespace 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) | ||||
*/ | */ | |||
void | 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 *namespace, | |||
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. | ||||
* | ||||
* @param psc context of the operation to abort. | ||||
*/ | ||||
void | ||||
GNUNET_FS_publish_sks_cancel (struct GNUNET_FS_PublishSksContext *psc); | ||||
/** | ||||
* 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 | * @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 GNUNET_HashCode * file _id); | |||
/** | /** | |||
* Handle to cancel 'GNUNET_FS_get_indexed_files'. | ||||
*/ | ||||
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 | |||
* @param iterator function to call on each indexed file | * @param iterator function to call on each indexed file | |||
* @param iterator_cls closure for iterator | * @param iterator_cls closure for iterator | |||
* @param cont continuation to call when done; | * @return NULL on error ('iter' is not called) | |||
* reason should be "TIMEOUT" (on | ||||
* error) or "PREREQ_DONE" (on success) | ||||
* @param cont_cls closure for cont | ||||
*/ | */ | |||
void | struct GNUNET_FS_GetIndexedContext * | |||
GNUNET_FS_get_indexed_files (struct GNUNET_FS_Handle *h, | GNUNET_FS_get_indexed_files (struct GNUNET_FS_Handle *h, | |||
GNUNET_FS_IndexedFileProcessor iterator, | GNUNET_FS_IndexedFileProcessor iterator, | |||
void *iterator_cls, GNUNET_SCHEDULER_Task cont | void *iterator_cls); | |||
, | ||||
void *cont_cls); | /** | |||
* Cancel iteration over all indexed files. | ||||
* | ||||
* @param gic operation to cancel | ||||
*/ | ||||
void | ||||
GNUNET_FS_get_indexed_files_cancel (struct GNUNET_FS_GetIndexedContext *gic | ||||
); | ||||
/** | /** | |||
* Unindex a file. | * Unindex a file. | |||
* | * | |||
* @param h handle to the file sharing subsystem | * @param h handle to the file sharing subsystem | |||
* @param filename file to unindex | * @param filename file to unindex | |||
* @param cctx initial value for the client context | * @param cctx initial value for the client context | |||
* @return NULL on error, otherwise handle | * @return NULL on error, otherwise handle | |||
*/ | */ | |||
struct GNUNET_FS_UnindexContext * | struct GNUNET_FS_UnindexContext * | |||
skipping to change at line 2127 | skipping to change at line 2087 | |||
/** | /** | |||
* Clean up after completion of an unindex operation. | * Clean up after completion of an unindex operation. | |||
* | * | |||
* @param uc handle | * @param uc handle | |||
*/ | */ | |||
void | void | |||
GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc); | GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc); | |||
/** | /** | |||
* Context for advertising a namespace. | ||||
*/ | ||||
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 namespace 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) | ||||
*/ | */ | |||
void | 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 *namespace, | |||
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. | ||||
* | ||||
* @param ac context of the operation to abort. | ||||
*/ | ||||
void | ||||
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 | |||
*/ | */ | |||
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. | ||||
* | ||||
* @param ns namespace handle | ||||
* @return duplicated handle to the namespace | ||||
*/ | ||||
struct GNUNET_FS_Namespace * | ||||
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 namespace 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 | |||
*/ | */ | |||
skipping to change at line 2555 | skipping to change at line 2538 | |||
* | * | |||
* @param bld directory to finish | * @param bld directory to finish | |||
* @param rsize set to the number of bytes needed | * @param rsize set to the number of bytes needed | |||
* @param rdata set to the encoded directory | * @param rdata set to the encoded directory | |||
* @return GNUNET_OK on success | * @return GNUNET_OK on success | |||
*/ | */ | |||
int | int | |||
GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld, | GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld, | |||
size_t * rsize, void **rdata); | size_t * rsize, void **rdata); | |||
/* ******************** DirScanner API *********************** */ | ||||
/** | ||||
* Progress reasons of the directory scanner. | ||||
*/ | ||||
enum GNUNET_FS_DirScannerProgressUpdateReason | ||||
{ | ||||
/** | ||||
* We've started processing a file or directory. | ||||
*/ | ||||
GNUNET_FS_DIRSCANNER_FILE_START = 0, | ||||
/** | ||||
* We're having trouble accessing a file (soft-error); it will | ||||
* be ignored. | ||||
*/ | ||||
GNUNET_FS_DIRSCANNER_FILE_IGNORED, | ||||
/** | ||||
* We've found all files (in the pre-pass). | ||||
*/ | ||||
GNUNET_FS_DIRSCANNER_ALL_COUNTED, | ||||
/** | ||||
* We've finished extracting meta data from a file. | ||||
*/ | ||||
GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED, | ||||
/** | ||||
* Last call to the progress function: we have finished scanning | ||||
* the directory. | ||||
*/ | ||||
GNUNET_FS_DIRSCANNER_FINISHED, | ||||
/** | ||||
* There was an internal error. Application should abort the scan. | ||||
*/ | ||||
GNUNET_FS_DIRSCANNER_INTERNAL_ERROR | ||||
}; | ||||
/** | ||||
* Function called over time as the directory scanner makes | ||||
* progress on the job at hand. | ||||
* | ||||
* @param cls closure | ||||
* @param filename which file we are making progress on | ||||
* @param is_directory GNUNET_YES if this is a directory, | ||||
* GNUNET_NO if this is a file | ||||
* GNUNET_SYSERR if it is neither (or unknown) | ||||
* @param reason kind of progress we are making | ||||
*/ | ||||
typedef void (*GNUNET_FS_DirScannerProgressCallback) (void *cls, | ||||
const char *filename, | ||||
int is_directory, | ||||
enum GNUNET_FS_DirScan | ||||
nerProgressUpdateReason reason); | ||||
/** | ||||
* A node of a directory tree (produced by dirscanner) | ||||
*/ | ||||
struct GNUNET_FS_ShareTreeItem | ||||
{ | ||||
/** | ||||
* This is a doubly-linked list | ||||
*/ | ||||
struct GNUNET_FS_ShareTreeItem *prev; | ||||
/** | ||||
* This is a doubly-linked list | ||||
*/ | ||||
struct GNUNET_FS_ShareTreeItem *next; | ||||
/** | ||||
* This is a doubly-linked tree | ||||
* NULL for top-level entries. | ||||
*/ | ||||
struct GNUNET_FS_ShareTreeItem *parent; | ||||
/** | ||||
* This is a doubly-linked tree | ||||
* NULL for files and empty directories | ||||
*/ | ||||
struct GNUNET_FS_ShareTreeItem *children_head; | ||||
/** | ||||
* This is a doubly-linked tree | ||||
* NULL for files and empty directories | ||||
*/ | ||||
struct GNUNET_FS_ShareTreeItem *children_tail; | ||||
/** | ||||
* Metadata for this file or directory | ||||
*/ | ||||
struct GNUNET_CONTAINER_MetaData *meta; | ||||
/** | ||||
* Keywords for this file or directory (derived from metadata). | ||||
*/ | ||||
struct GNUNET_FS_Uri *ksk_uri; | ||||
/** | ||||
* Name of the file/directory | ||||
*/ | ||||
char *filename; | ||||
/** | ||||
* Base name of the file/directory. | ||||
*/ | ||||
char *short_filename; | ||||
/** | ||||
* GNUNET_YES if this is a directory | ||||
*/ | ||||
int is_directory; | ||||
}; | ||||
/** | ||||
* Opaqe handle to an asynchronous directory scanning activity. | ||||
*/ | ||||
struct GNUNET_FS_DirScanner; | ||||
/** | ||||
* Start a directory scanner. | ||||
* | ||||
* @param filename name of the directory to scan | ||||
* @param disable_extractor GNUNET_YES to not to run libextractor on files | ||||
(only build a tree) | ||||
* @param ex if not NULL, must be a list of extra plugins for extractor | ||||
* @param cb the callback to call when there are scanning progress messages | ||||
* @param cb_cls closure for 'cb' | ||||
* @return directory scanner object to be used for controlling the scanner | ||||
*/ | ||||
struct GNUNET_FS_DirScanner * | ||||
GNUNET_FS_directory_scan_start (const char *filename, | ||||
int disable_extractor, | ||||
const char *ex, | ||||
GNUNET_FS_DirScannerProgressCallback cb, | ||||
void *cb_cls); | ||||
/** | ||||
* Abort the scan. Must not be called from within the progress_callback | ||||
* function. | ||||
* | ||||
* @param ds directory scanner structure | ||||
*/ | ||||
void | ||||
GNUNET_FS_directory_scan_abort (struct GNUNET_FS_DirScanner *ds); | ||||
/** | ||||
* Obtain the result of the scan after the scan has signalled | ||||
* completion. Must not be called prior to completion. The 'ds' is | ||||
* freed as part of this call. | ||||
* | ||||
* @param ds directory scanner structure | ||||
* @return the results of the scan (a directory tree) | ||||
*/ | ||||
struct GNUNET_FS_ShareTreeItem * | ||||
GNUNET_FS_directory_scan_get_result (struct GNUNET_FS_DirScanner *ds); | ||||
/** | ||||
* Process a share item tree, moving frequent keywords up and | ||||
* copying frequent metadata up. | ||||
* | ||||
* @param toplevel toplevel directory in the tree, returned by the scanner | ||||
*/ | ||||
void | ||||
GNUNET_FS_share_tree_trim (struct GNUNET_FS_ShareTreeItem *toplevel); | ||||
/** | ||||
* Release memory of a share item tree. | ||||
* | ||||
* @param toplevel toplevel of the tree to be freed | ||||
*/ | ||||
void | ||||
GNUNET_FS_share_tree_free (struct GNUNET_FS_ShareTreeItem *toplevel); | ||||
#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. 27 change blocks. | ||||
134 lines changed or deleted | 288 lines changed or added | |||
gnunet_mesh_service.h | gnunet_mesh_service.h | |||
---|---|---|---|---|
skipping to change at line 128 | skipping to change at line 128 | |||
* tunnel, | * tunnel, | |||
const struct | const struct | |||
GNUNET_PeerId entity | GNUNET_PeerId entity | |||
* initiator, | * initiator, | |||
const struct | const struct | |||
GNUNET_ATS_In formation | GNUNET_ATS_In formation | |||
* atsi); | * atsi); | |||
/** | /** | |||
* Function called whenever an inbound tunnel is destroyed. Should clean u p | * Function called whenever an inbound tunnel is destroyed. Should clean u p | |||
* any associated state. | * any associated state. This function is NOT called if the client has | |||
* explicitly asked for the tunnel to be destroyed using | ||||
* GNUNET_MESH_tunnel_destroy. It must NOT call GNUNET_MESH_tunnel_destroy | ||||
on | ||||
* the tunnel. | ||||
* | * | |||
* @param cls closure (set from GNUNET_MESH_connect) | * @param cls closure (set from GNUNET_MESH_connect) | |||
* @param tunnel connection to the other end (henceforth invalid) | * @param tunnel connection to the other end (henceforth invalid) | |||
* @param tunnel_ctx place where local state associated | * @param tunnel_ctx place where local state associated | |||
* with the tunnel is stored | * with the tunnel is stored | |||
*/ | */ | |||
typedef void (GNUNET_MESH_TunnelEndHandler) (void *cls, | typedef void (GNUNET_MESH_TunnelEndHandler) (void *cls, | |||
const struct GNUNET_MESH_Tunne l * | const struct GNUNET_MESH_Tunne l * | |||
tunnel, void *tunnel_ctx); | tunnel, void *tunnel_ctx); | |||
skipping to change at line 154 | skipping to change at line 157 | |||
/** | /** | |||
* 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 | * @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, | * (each tunnel is guaranteed to accept at least one mess age, | |||
* no matter what is the status of other tunnels) | * 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 | * @param cleaner function called when an *inbound* tunnel is destroyed by | |||
the | ||||
* remote peer, it is *not* called if GNUNET_MESH_tunnel_des | ||||
troy | ||||
* 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, | |||
unsigned int queue_size, void *cls, | unsigned int queue_size, void *cls, | |||
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. | * 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 | ||||
* about their disconnection. The registered inbound tunnel cleaner will be | ||||
* called should any inbound tunnels still exist. | ||||
* | * | |||
* @param handle connection to mesh to disconnect | * @param handle connection to mesh to disconnect | |||
*/ | */ | |||
void | void | |||
GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle); | GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle); | |||
/** | /** | |||
* Method called whenever a peer has disconnected from the tunnel. | * Method called whenever a peer has disconnected from the tunnel. | |||
* Implementations of this callback must NOT call | ||||
* GNUNET_MESH_tunnel_destroy immediately, but instead schedule those | ||||
* to run in some other task later. However, calling | ||||
* "GNUNET_MESH_notify_transmit_ready_cancel" is allowed. | ||||
* | * | |||
* @param cls closure | * @param cls closure | |||
* @param peer peer identity the tunnel stopped working with | * @param peer peer identity the tunnel stopped working with | |||
*/ | */ | |||
typedef void (*GNUNET_MESH_PeerDisconnectHandler) (void *cls, | typedef void (*GNUNET_MESH_PeerDisconnectHandler) (void *cls, | |||
const struct | const struct | |||
GNUNET_PeerIdentity * pe er); | GNUNET_PeerIdentity * pe er); | |||
/** | /** | |||
* Method called whenever a peer has connected to the tunnel. | * Method called whenever a peer has connected to the tunnel. | |||
* TODO: change to typedef int? to let client allow the new peer or not | ||||
* | * | |||
* @param cls closure | * @param cls closure | |||
* @param peer peer identity the tunnel was created to, NULL on timeout | * @param peer peer identity the tunnel was created to, NULL on timeout | |||
* @param atsi performance data for the connection | * @param atsi performance data for the connection | |||
* | ||||
* 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); | |||
/** | /** | |||
* 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). | |||
skipping to change at line 220 | skipping to change at line 233 | |||
* @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 * | |||
GNUNET_MESH_tunnel_create (struct GNUNET_MESH_Handle *h, void *tunnel_ctx, | GNUNET_MESH_tunnel_create (struct GNUNET_MESH_Handle *h, void *tunnel_ctx, | |||
GNUNET_MESH_PeerConnectHandler connect_handler, | GNUNET_MESH_PeerConnectHandler connect_handler, | |||
GNUNET_MESH_PeerDisconnectHandler disconnect_han dler, | GNUNET_MESH_PeerDisconnectHandler disconnect_han dler, | |||
void *handler_cls); | void *handler_cls); | |||
/** | /** | |||
* Destroy an existing tunnel. | * Destroy an existing tunnel. The existing callback for the tunnel will NO | |||
T | ||||
* 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 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 | |||
* | * | |||
End of changes. 7 change blocks. | ||||
5 lines changed or deleted | 25 lines changed or added | |||
gnunet_os_lib.h | gnunet_os_lib.h | |||
---|---|---|---|---|
skipping to change at line 30 | skipping to change at line 30 | |||
/** | /** | |||
* @file include/gnunet_os_lib.h | * @file include/gnunet_os_lib.h | |||
* @brief low level process routines | * @brief low level process routines | |||
* @author Christian Grothoff | * @author Christian Grothoff | |||
* @author Krista Bennett | * @author Krista Bennett | |||
* @author Gerd Knorr <kraxel@bytesex.org> | * @author Gerd Knorr <kraxel@bytesex.org> | |||
* @author Ioana Patrascu | * @author Ioana Patrascu | |||
* @author Tzvetan Horozov | * @author Tzvetan Horozov | |||
* @author Milan | * @author Milan | |||
* | ||||
* This code manages child processes. We can communicate with child | ||||
* processes using signals. Because signals are not supported on W32 | ||||
* and Java (at least not nicely), we can alternatively use a pipe | ||||
* to send signals to the child processes (if the child process is | ||||
* a full-blown GNUnet process that supports reading signals from | ||||
* a pipe, of course). Naturally, this also only works for 'normal' | ||||
* termination via signals, and not as a replacement for SIGKILL. | ||||
* Thus using pipes to communicate signals should only be enabled if | ||||
* the child is a Java process OR if we are on Windoze. | ||||
*/ | */ | |||
#ifndef GNUNET_OS_LIB_H | #ifndef GNUNET_OS_LIB_H | |||
#define GNUNET_OS_LIB_H | #define GNUNET_OS_LIB_H | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" | extern "C" | |||
{ | { | |||
#if 0 /* keep Emacsens' auto-indent happy */ | #if 0 /* keep Emacsens' auto-indent happy */ | |||
} | } | |||
skipping to change at line 197 | skipping to change at line 207 | |||
* | * | |||
* The pointer it returns points to static memory location and must not be | * The pointer it returns points to static memory location and must not be | |||
* deallocated/closed | * deallocated/closed | |||
* | * | |||
* @return pointer to the process sturcutre for this process | * @return pointer to the process sturcutre for this process | |||
*/ | */ | |||
struct GNUNET_OS_Process * | struct GNUNET_OS_Process * | |||
GNUNET_OS_process_current (void); | GNUNET_OS_process_current (void); | |||
/** | /** | |||
* Sends sig to the process | * Sends a signal to the process | |||
* | * | |||
* @param proc pointer to process structure | * @param proc pointer to process structure | |||
* @param sig signal | * @param sig signal | |||
* @return 0 on success, -1 on error | * @return 0 on success, -1 on error | |||
*/ | */ | |||
int | int | |||
GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig); | GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig); | |||
/** | /** | |||
* Cleans up process structure contents (OS-dependent) and deallocates it | * Cleans up process structure contents (OS-dependent) and deallocates it | |||
skipping to change at line 238 | skipping to change at line 248 | |||
* @param prio priority value | * @param prio priority value | |||
* @return GNUNET_OK on success, GNUNET_SYSERR on error | * @return GNUNET_OK on success, GNUNET_SYSERR on error | |||
*/ | */ | |||
int | int | |||
GNUNET_OS_set_process_priority (struct GNUNET_OS_Process *proc, | GNUNET_OS_set_process_priority (struct GNUNET_OS_Process *proc, | |||
enum GNUNET_SCHEDULER_Priority prio); | enum GNUNET_SCHEDULER_Priority prio); | |||
/** | /** | |||
* Start a process. | * Start a process. | |||
* | * | |||
* @param pipe_control should a pipe be used to send signals to the child? | ||||
* @param pipe_stdin pipe to use to send input to child process (or NULL) | ||||
* @param pipe_stdout pipe to use to get output from child process (or NULL | ||||
) | ||||
* @param filename name of the binary | ||||
* @param argv NULL-terminated array of arguments to the process | ||||
* @return pointer to process structure of the new process, NULL on error | ||||
*/ | ||||
struct GNUNET_OS_Process * | ||||
GNUNET_OS_start_process_vap (int pipe_control, | ||||
struct GNUNET_DISK_PipeHandle *pipe_stdin, | ||||
struct GNUNET_DISK_PipeHandle *pipe_stdout, | ||||
const char *filename, | ||||
char *const argv[]); | ||||
/** | ||||
* Start a process. | ||||
* | ||||
* @param pipe_control should a pipe be used to send signals to the child? | ||||
* @param pipe_stdin pipe to use to send input to child process (or NULL) | * @param pipe_stdin pipe to use to send input to child process (or NULL) | |||
* @param pipe_stdout pipe to use to get output from child process (or NULL ) | * @param pipe_stdout pipe to use to get output from child process (or NULL ) | |||
* @param filename name of the binary | * @param filename name of the binary | |||
* @param ... NULL-terminated list of arguments to the process | * @param ... NULL-terminated list of arguments to the process | |||
* @return pointer to process structure of the new process, NULL on error | * @return pointer to process structure of the new process, NULL on error | |||
*/ | */ | |||
struct GNUNET_OS_Process * | struct GNUNET_OS_Process * | |||
GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, | GNUNET_OS_start_process (int pipe_control, | |||
struct GNUNET_DISK_PipeHandle *pipe_stdin, | ||||
struct GNUNET_DISK_PipeHandle *pipe_stdout, | struct GNUNET_DISK_PipeHandle *pipe_stdout, | |||
const char *filename, ...); | const char *filename, ...); | |||
/** | /** | |||
* Start a process. | * Start a process. | |||
* | * | |||
* @param pipe_control should a pipe be used to send signals to the child? | ||||
* @param pipe_stdin pipe to use to send input to child process (or NULL) | * @param pipe_stdin pipe to use to send input to child process (or NULL) | |||
* @param pipe_stdout pipe to use to get output from child process (or NULL ) | * @param pipe_stdout pipe to use to get output from child process (or NULL ) | |||
* @param filename name of the binary | * @param filename name of the binary | |||
* @param va NULL-terminated list of arguments to the process | * @param va NULL-terminated list of arguments to the process | |||
* @return pointer to process structure of the new process, NULL on error | * @return pointer to process structure of the new process, NULL on error | |||
*/ | */ | |||
struct GNUNET_OS_Process * | struct GNUNET_OS_Process * | |||
GNUNET_OS_start_process_va (struct GNUNET_DISK_PipeHandle *pipe_stdin, | GNUNET_OS_start_process_va (int pipe_control, | |||
struct GNUNET_DISK_PipeHandle *pipe_stdin, | ||||
struct GNUNET_DISK_PipeHandle *pipe_stdout, | struct GNUNET_DISK_PipeHandle *pipe_stdout, | |||
const char *filename, va_list va); | const char *filename, va_list va); | |||
/** | /** | |||
* Start a process. | * Start a process. | |||
* | * | |||
* @param pipe_control should a pipe be used to send signals to the child? | ||||
* @param lsocks array of listen sockets to dup systemd-style (or NULL); | * @param lsocks array of listen sockets to dup systemd-style (or NULL); | |||
* must be NULL on platforms where dup is not supported | * must be NULL on platforms where dup is not supported | |||
* @param filename name of the binary | * @param filename name of the binary | |||
* @param argv NULL-terminated list of arguments to the process, | * @param argv NULL-terminated list of arguments to the process, | |||
* including the process name as the first argument | * including the process name as the first argument | |||
* @return pointer to process structure of the new process, NULL on error | * @return pointer to process structure of the new process, NULL on error | |||
*/ | */ | |||
struct GNUNET_OS_Process * | struct GNUNET_OS_Process * | |||
GNUNET_OS_start_process_v (const SOCKTYPE *lsocks, const char *filename, | GNUNET_OS_start_process_v (int pipe_control, | |||
const SOCKTYPE *lsocks, | ||||
const char *filename, | ||||
char *const argv[]); | char *const argv[]); | |||
/** | /** | |||
* Handle to a command action. | * Handle to a command action. | |||
*/ | */ | |||
struct GNUNET_OS_CommandHandle; | struct GNUNET_OS_CommandHandle; | |||
/** | /** | |||
* Type of a function to process a line of output. | * Type of a function to process a line of output. | |||
* | * | |||
skipping to change at line 341 | skipping to change at line 375 | |||
* thus only be used if the child process is known to have terminated | * thus only be used if the child process is known to have terminated | |||
* or to terminate very soon. | * or to terminate very soon. | |||
* | * | |||
* @param proc pointer to process structure of the process to wait for | * @param proc pointer to process structure of the process to wait for | |||
* @return GNUNET_OK on success, GNUNET_SYSERR otherwise | * @return GNUNET_OK on success, GNUNET_SYSERR otherwise | |||
*/ | */ | |||
int | int | |||
GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc); | GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc); | |||
/** | /** | |||
* Connects this process to its parent via pipe | * Connects this process to its parent via pipe; | |||
* essentially, the parent control handler will read signal numbers | ||||
* from the 'GNUNET_OS_CONTROL_PIPE' (as given in an environment | ||||
* variable) and raise those signals. | ||||
* | ||||
* @param cls closure (unused) | ||||
* @param tc scheduler context (unused) | ||||
*/ | */ | |||
void | void | |||
GNUNET_OS_install_parent_control_handler (void *cls, | GNUNET_OS_install_parent_control_handler (void *cls, | |||
const struct | const struct | |||
GNUNET_SCHEDULER_TaskContext *tc) ; | GNUNET_SCHEDULER_TaskContext *tc) ; | |||
/** | /** | |||
* Check whether an executable exists and possibly | * Check whether an executable exists and possibly | |||
* if the suid bit is set on the file. | * if the suid bit is set on the file. | |||
* Attempts to find the file using the current | * Attempts to find the file using the current | |||
End of changes. 9 change blocks. | ||||
5 lines changed or deleted | 46 lines changed or added | |||
gnunet_protocols.h | gnunet_protocols.h | |||
---|---|---|---|---|
skipping to change at line 515 | skipping to change at line 515 | |||
/** | /** | |||
* Peer tries to find data in DHT. | * Peer tries to find data in DHT. | |||
*/ | */ | |||
#define GNUNET_MESSAGE_TYPE_DHT_P2P_GET 147 | #define GNUNET_MESSAGE_TYPE_DHT_P2P_GET 147 | |||
/** | /** | |||
* Data is returned to peer from DHT. | * Data is returned to peer from DHT. | |||
*/ | */ | |||
#define GNUNET_MESSAGE_TYPE_DHT_P2P_RESULT 148 | #define GNUNET_MESSAGE_TYPE_DHT_P2P_RESULT 148 | |||
/** | ||||
* Request / receive information about transiting GETs | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET 149 | ||||
/** | ||||
* Request / receive information about transiting GET responses | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET_RESP 150 | ||||
/** | ||||
* Request / receive information about transiting PUTs | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT 151 | ||||
/** | ||||
* Request / receive information about transiting PUT responses (TODO) | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT_RESP 152 | ||||
/************************************************************************** ***** | /************************************************************************** ***** | |||
* HOSTLIST message types | * HOSTLIST message types | |||
************************************************************************** ****/ | ************************************************************************** ****/ | |||
/** | /** | |||
* Hostlist advertisement message | * Hostlist advertisement message | |||
*/ | */ | |||
#define GNUNET_MESSAGE_TYPE_HOSTLIST_ADVERTISEMENT 160 | #define GNUNET_MESSAGE_TYPE_HOSTLIST_ADVERTISEMENT 160 | |||
/************************************************************************** ***** | /************************************************************************** ***** | |||
skipping to change at line 569 | skipping to change at line 589 | |||
/************************************************************************** ***** | /************************************************************************** ***** | |||
* VPN message types | * VPN message types | |||
************************************************************************** ****/ | ************************************************************************** ****/ | |||
/** | /** | |||
* Type of messages between the gnunet-vpn-helper and the daemon | * Type of messages between the gnunet-vpn-helper and the daemon | |||
*/ | */ | |||
#define GNUNET_MESSAGE_TYPE_VPN_HELPER 185 | #define GNUNET_MESSAGE_TYPE_VPN_HELPER 185 | |||
/** | /** | |||
* Type of messages containing an UDP packet for a service | * Type of messages containing an ICMP packet for a service. | |||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_SERVICE 190 | ||||
/** | ||||
* Type of messages containing an ICMP packet for the Internet. | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_INTERNET 191 | ||||
/** | ||||
* Type of messages containing an ICMP packet for the VPN | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_VPN 192 | ||||
/** | ||||
* Type of messages containing an DNS request for a DNS exit service. | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_VPN_DNS_TO_INTERNET 193 | ||||
/** | ||||
* Type of messages containing an DNS reply from a DNS exit service. | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_VPN_DNS_FROM_INTERNET 194 | ||||
/** | ||||
* Type of messages containing an TCP packet for a service. | ||||
*/ | */ | |||
#define GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP 186 | #define GNUNET_MESSAGE_TYPE_VPN_TCP_TO_SERVICE_START 195 | |||
/** | /** | |||
* Type of messages containing an UDP packet from a service | * Type of messages containing an TCP packet for the Internet. | |||
*/ | */ | |||
#define GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP_BACK 187 | #define GNUNET_MESSAGE_TYPE_VPN_TCP_TO_INTERNET_START 196 | |||
/** | /** | |||
* Type of messages containing an TCP packet for a service | * Type of messages containing an TCP packet of an established connection. | |||
*/ | */ | |||
#define GNUNET_MESSAGE_TYPE_VPN_SERVICE_TCP 188 | #define GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_EXIT 197 | |||
/** | /** | |||
* Type of messages containing an TCP packet from a service | * Type of messages containing an TCP packet of an established connection. | |||
*/ | */ | |||
#define GNUNET_MESSAGE_TYPE_VPN_SERVICE_TCP_BACK 189 | #define GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_VPN 198 | |||
/** | /** | |||
* Type of messages containing an UDP packet for a remote host | * Type of messages containing an UDP packet for a service. | |||
*/ | */ | |||
#define GNUNET_MESSAGE_TYPE_VPN_REMOTE_UDP 190 | #define GNUNET_MESSAGE_TYPE_VPN_UDP_TO_SERVICE 199 | |||
/** | ||||
* Type of messages containing an UDP packet for the Internet. | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_VPN_UDP_TO_INTERNET 200 | ||||
/** | /** | |||
* Type of messages containing an UDP packet from a remote host | * Type of messages containing an UDP packet from a remote host | |||
*/ | */ | |||
#define GNUNET_MESSAGE_TYPE_VPN_REMOTE_UDP_BACK 191 | #define GNUNET_MESSAGE_TYPE_VPN_UDP_REPLY 201 | |||
/** | /** | |||
* Type of messages containing an TCP packet for a remote host | * Client asks VPN service to setup an IP to redirect traffic | |||
* via an exit node to some global IP address. | ||||
*/ | */ | |||
#define GNUNET_MESSAGE_TYPE_VPN_REMOTE_TCP 192 | #define GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_IP 202 | |||
/** | /** | |||
* Type of messages containing an TCP packet from a remote host | * Client asks VPN service to setup an IP to redirect traffic | |||
* to some peer offering a service. | ||||
*/ | */ | |||
#define GNUNET_MESSAGE_TYPE_VPN_REMOTE_TCP_BACK 193 | #define GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_SERVICE 203 | |||
/** | ||||
* VPN service responds to client with an IP to use for the | ||||
* requested redirection. | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_VPN_CLIENT_USE_IP 204 | ||||
/************************************************************************** ***** | /************************************************************************** ***** | |||
* VPN-DNS message types | * VPN-DNS message types | |||
************************************************************************** ****/ | ************************************************************************** ****/ | |||
/** | /** | |||
* Type of messages to query the local service-dns | * Initial message from client to DNS service for registration. | |||
*/ | */ | |||
#define GNUNET_MESSAGE_TYPE_VPN_DNS_LOCAL_QUERY_DNS 205 | #define GNUNET_MESSAGE_TYPE_DNS_CLIENT_INIT 211 | |||
/** | ||||
* Type of messages the local service-dns responds with | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_VPN_DNS_LOCAL_RESPONSE_DNS 206 | ||||
/** | /** | |||
* Type of messages to instruct the local service-dns to rehijack the dns | * Type of messages between the gnunet-helper-dns and the service | |||
*/ | */ | |||
#define GNUNET_MESSAGE_TYPE_REHIJACK 207 | #define GNUNET_MESSAGE_TYPE_DNS_CLIENT_REQUEST 212 | |||
/** | /** | |||
* Type of messages to send a DNS-query to another peer | * Type of messages between the gnunet-helper-dns and the service | |||
*/ | */ | |||
#define GNUNET_MESSAGE_TYPE_VPN_REMOTE_QUERY_DNS 208 | #define GNUNET_MESSAGE_TYPE_DNS_CLIENT_RESPONSE 213 | |||
/** | /** | |||
* Type of messages to send a DNS-answer to another peer | * Type of messages between the gnunet-helper-dns and the service | |||
*/ | */ | |||
#define GNUNET_MESSAGE_TYPE_VPN_REMOTE_ANSWER_DNS 209 | #define GNUNET_MESSAGE_TYPE_DNS_HELPER 214 | |||
/************************************************************************** ***** | /************************************************************************** ***** | |||
* MESH message types | * MESH message types | |||
************************************************************************** ****/ | ************************************************************************** ****/ | |||
/** | /** | |||
* Type of message used to transport messages throug a MESH-tunnel (LEGACY) | * Type of message used to transport messages throug a MESH-tunnel (LEGACY) | |||
*/ | */ | |||
#define GNUNET_MESSAGE_TYPE_MESH 215 | #define GNUNET_MESSAGE_TYPE_MESH 215 | |||
skipping to change at line 1077 | skipping to change at line 1134 | |||
/** | /** | |||
* 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 | ||||
************************************************************************** | ||||
****/ | ||||
/** | ||||
* Message containing data exchanged between stream end-points over mesh. | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_STREAM_DATA 400 | ||||
/** | ||||
* ACK message | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_STREAM_ACK 401 | ||||
/** | ||||
* Handshake hello message | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_STREAM_HELLO 402 | ||||
/** | ||||
* Handshake hello acknowledgement message | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_STREAM_HELLO_ACK 403 | ||||
/** | ||||
* Reset message | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_STREAM_RESET 404 | ||||
/** | ||||
* Transmit close message (data transmission no longer possible after this | ||||
* message) | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_STREAM_TRANSMIT_CLOSE 405 | ||||
/** | ||||
* Transmit close acknowledgement message | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_STREAM_TRANSMIT_CLOSE_ACK 406 | ||||
/** | ||||
* Receive close message (data is no loger read by the receiver after this | ||||
* message) | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_STREAM_RECEIVE_CLOSE 407 | ||||
/** | ||||
* Receive close acknowledgement message | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_STREAM_RECEIVE_CLOSE_ACK 408 | ||||
/** | ||||
* Stream close message (data is no longer sent or read after this message) | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_STREAM_CLOSE 409 | ||||
/** | ||||
* Close acknowledgement message | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_STREAM_CLOSE_ACK 410 | ||||
/************************************************************************** | ||||
***** | ||||
* FS-PUBLISH-HELPER IPC Messages | ||||
************************************************************************** | ||||
****/ | ||||
/** | ||||
* Progress information from the helper: found a file | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_FILE 420 | ||||
/** | ||||
* Progress information from the helper: found a directory | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_DIRECTORY 421 | ||||
/** | ||||
* Error signal from the helper. | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_ERROR 422 | ||||
/** | ||||
* Signal that helper skipped a file. | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_SKIP_FILE 423 | ||||
/** | ||||
* Signal that helper is done scanning the directory tree. | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_COUNTING_DONE 424 | ||||
/** | ||||
* Extracted meta data from the helper. | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_META_DATA 425 | ||||
/** | ||||
* Signal that helper is done. | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_FINISHED 426 | ||||
/************************************************************************** | ||||
***** | ||||
* NAMESTORE message types | ||||
************************************************************************** | ||||
****/ | ||||
/** | ||||
* Request update and listing of a peer. | ||||
*/ | ||||
#define GNUNET_MESSAGE_TYPE_NAMESTORE_START 430 | ||||
/** | /** | |||
* Next available: 400 | * Next available: 440 | |||
*/ | */ | |||
/************************************************************************** ***** | /************************************************************************** ***** | |||
* 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. 26 change blocks. | ||||
28 lines changed or deleted | 200 lines changed or added | |||
gnunet_resolver_service.h | gnunet_resolver_service.h | |||
---|---|---|---|---|
skipping to change at line 77 | skipping to change at line 77 | |||
/** | /** | |||
* Destroy the connection to the resolver service. | * Destroy the connection to the resolver service. | |||
*/ | */ | |||
void | void | |||
GNUNET_RESOLVER_disconnect (void); | GNUNET_RESOLVER_disconnect (void); | |||
/** | /** | |||
* Convert a string to one or more IP addresses. | * Convert a string to one or more IP addresses. | |||
* | * | |||
* @param hostname the hostname to resolve | * @param hostname the hostname to resolve | |||
* @param domain AF_INET or AF_INET6; use AF_UNSPEC for "any" | * @param af AF_INET or AF_INET6; use AF_UNSPEC for "any" | |||
* @param callback function to call with addresses | * @param callback function to call with addresses | |||
* @param callback_cls closure for callback | * @param callback_cls closure for callback | |||
* @param timeout how long to try resolving | * @param timeout how long to try resolving | |||
* @return handle that can be used to cancel the request, NULL on error | * @return handle that can be used to cancel the request, NULL on error | |||
*/ | */ | |||
struct GNUNET_RESOLVER_RequestHandle * | struct GNUNET_RESOLVER_RequestHandle * | |||
GNUNET_RESOLVER_ip_get (const char *hostname, int domain, | GNUNET_RESOLVER_ip_get (const char *hostname, int af, | |||
struct GNUNET_TIME_Relative timeout, | struct GNUNET_TIME_Relative timeout, | |||
GNUNET_RESOLVER_AddressCallback callback, | GNUNET_RESOLVER_AddressCallback callback, | |||
void *callback_cls); | void *callback_cls); | |||
/** | /** | |||
* Resolve our hostname to an IP address. | * Resolve our hostname to an IP address. | |||
* | * | |||
* @param domain AF_INET or AF_INET6; use AF_UNSPEC for "any" | * @param af AF_INET or AF_INET6; use AF_UNSPEC for "any" | |||
* @param callback function to call with addresses | * @param callback function to call with addresses | |||
* @param cls closure for callback | * @param cls closure for callback | |||
* @param timeout how long to try resolving | * @param timeout how long to try resolving | |||
* @return handle that can be used to cancel the request, NULL on error | * @return handle that can be used to cancel the request, NULL on error | |||
*/ | */ | |||
struct GNUNET_RESOLVER_RequestHandle * | struct GNUNET_RESOLVER_RequestHandle * | |||
GNUNET_RESOLVER_hostname_resolve (int domain, | GNUNET_RESOLVER_hostname_resolve (int af, | |||
struct GNUNET_TIME_Relative timeout, | struct GNUNET_TIME_Relative timeout, | |||
GNUNET_RESOLVER_AddressCallback callback, | GNUNET_RESOLVER_AddressCallback callback, | |||
void *cls); | void *cls); | |||
/** | /** | |||
* Function called by the resolver for each hostname obtained from DNS. | * Function called by the resolver for each hostname obtained from DNS. | |||
* | * | |||
* @param cls closure | * @param cls closure | |||
* @param hostname one of the names for the host, NULL | * @param hostname one of the names for the host, NULL | |||
* on the last call to the callback | * on the last call to the callback | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
gnunet_scheduler_lib.h | gnunet_scheduler_lib.h | |||
---|---|---|---|---|
skipping to change at line 112 | skipping to change at line 112 | |||
GNUNET_SCHEDULER_PRIORITY_IDLE = 1, | GNUNET_SCHEDULER_PRIORITY_IDLE = 1, | |||
/** | /** | |||
* Run as background job (higher than idle, | * Run as background job (higher than idle, | |||
* lower than default). | * lower than default). | |||
*/ | */ | |||
GNUNET_SCHEDULER_PRIORITY_BACKGROUND = 2, | GNUNET_SCHEDULER_PRIORITY_BACKGROUND = 2, | |||
/** | /** | |||
* Run with the default priority (normal | * Run with the default priority (normal | |||
* P2P operations). Higher than BACKGROUND. | * P2P operations). Any task that is scheduled | |||
* without an explicit priority being specified | ||||
* will run with this priority. | ||||
*/ | */ | |||
GNUNET_SCHEDULER_PRIORITY_DEFAULT = 3, | GNUNET_SCHEDULER_PRIORITY_DEFAULT = 3, | |||
/** | /** | |||
* Run with high priority (important requests). | * Run with high priority (important requests). | |||
* Higher than DEFAULT. | * Higher than DEFAULT. | |||
*/ | */ | |||
GNUNET_SCHEDULER_PRIORITY_HIGH = 4, | GNUNET_SCHEDULER_PRIORITY_HIGH = 4, | |||
/** | /** | |||
skipping to change at line 257 | skipping to change at line 259 | |||
GNUNET_SCHEDULER_get_load (enum GNUNET_SCHEDULER_Priority p); | GNUNET_SCHEDULER_get_load (enum GNUNET_SCHEDULER_Priority p); | |||
/** | /** | |||
* Obtain the reason code for why the current task was | * Obtain the reason code for why the current task was | |||
* started. Will return the same value as | * started. Will return the same value as | |||
* the GNUNET_SCHEDULER_TaskContext's reason field. | * the GNUNET_SCHEDULER_TaskContext's reason field. | |||
* | * | |||
* * @return reason(s) why the current task is run | * * @return reason(s) why the current task is run | |||
*/ | */ | |||
enum GNUNET_SCHEDULER_Reason | enum GNUNET_SCHEDULER_Reason | |||
GNUNET_SCHEDULER_get_reason (); | GNUNET_SCHEDULER_get_reason (void); | |||
/** | /** | |||
* Cancel the task with the specified identifier. | * Cancel the task with the specified identifier. | |||
* The task must not yet have run. | * The task must not yet have run. | |||
* | * | |||
* * @param task id of the task to cancel | * * @param task id of the task to cancel | |||
* @return the closure of the callback of the cancelled task | * @return the closure of the callback of the cancelled task | |||
*/ | */ | |||
void * | void * | |||
GNUNET_SCHEDULER_cancel (GNUNET_SCHEDULER_TaskIdentifier task); | GNUNET_SCHEDULER_cancel (GNUNET_SCHEDULER_TaskIdentifier task); | |||
skipping to change at line 283 | skipping to change at line 285 | |||
* | * | |||
* * @param task main function of the task | * * @param task main function of the task | |||
* @param task_cls closure of task | * @param task_cls closure of task | |||
* @param reason reason for task invocation | * @param reason reason for task invocation | |||
*/ | */ | |||
void | void | |||
GNUNET_SCHEDULER_add_continuation (GNUNET_SCHEDULER_Task task, void *task_c ls, | GNUNET_SCHEDULER_add_continuation (GNUNET_SCHEDULER_Task task, void *task_c ls, | |||
enum GNUNET_SCHEDULER_Reason reason); | enum GNUNET_SCHEDULER_Reason reason); | |||
/** | /** | |||
* Continue the current execution with the given function. This is | ||||
* similar to the other "add" functions except that there is no delay | ||||
* and the reason code can be specified. | ||||
* | ||||
* @param task main function of the task | ||||
* @param task_cls closure for 'main' | ||||
* @param reason reason for task invocation | ||||
* @param priority priority to use for the task | ||||
*/ | ||||
void | ||||
GNUNET_SCHEDULER_add_continuation_with_priority (GNUNET_SCHEDULER_Task task | ||||
, void *task_cls, | ||||
enum GNUNET_SCHEDULER_Reaso | ||||
n reason, | ||||
enum GNUNET_SCHEDULER_Prior | ||||
ity priority); | ||||
/** | ||||
* Schedule a new task to be run after the specified prerequisite task | * Schedule a new task to be run after the specified prerequisite task | |||
* has completed. It will be run with the priority of the calling | * has completed. It will be run with DEFAULT priority. | |||
* task. | ||||
* | * | |||
* * @param prerequisite_task run this task after the task with the given | * * @param prerequisite_task run this task after the task with the given | |||
* task identifier completes (and any of our other | * task identifier completes (and any of our other | |||
* conditions, such as delay, read or write-readiness | * conditions, such as delay, read or write-readiness | |||
* are satisfied). Use GNUNET_SCHEDULER_NO_TASK to not have any de pendency | * are satisfied). Use GNUNET_SCHEDULER_NO_TASK to not have any de pendency | |||
* on completion of other tasks (this will cause the task to run as | * on completion of other tasks (this will cause the task to run as | |||
* soon as possible). | * soon as possible). | |||
* @param task main function of the task | * @param task main function of the task | |||
* @param task_cls closure of task | * @param task_cls closure of task | |||
* @return unique task identifier for the job | * @return unique task identifier for the job | |||
skipping to change at line 317 | skipping to change at line 333 | |||
* @param task_cls closure of task | * @param task_cls closure of task | |||
* @return unique task identifier for the job | * @return unique task identifier for the job | |||
* only valid until "task" is started! | * only valid until "task" is started! | |||
*/ | */ | |||
GNUNET_SCHEDULER_TaskIdentifier | GNUNET_SCHEDULER_TaskIdentifier | |||
GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, | GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, | |||
GNUNET_SCHEDULER_Task task, void *task_ cls); | GNUNET_SCHEDULER_Task task, void *task_ cls); | |||
/** | /** | |||
* Schedule a new task to be run as soon as possible. The task | * Schedule a new task to be run as soon as possible. The task | |||
* will be run with the priority of the calling task. | * will be run with the DEFAULT priority. | |||
* | * | |||
* * @param task main function of the task | * * @param task main function of the task | |||
* @param task_cls closure of task | * @param task_cls closure of task | |||
* @return unique task identifier for the job | * @return unique task identifier for the job | |||
* only valid until "task" is started! | * only valid until "task" is started! | |||
*/ | */ | |||
GNUNET_SCHEDULER_TaskIdentifier | GNUNET_SCHEDULER_TaskIdentifier | |||
GNUNET_SCHEDULER_add_now (GNUNET_SCHEDULER_Task task, void *task_cls); | GNUNET_SCHEDULER_add_now (GNUNET_SCHEDULER_Task task, void *task_cls); | |||
/** | /** | |||
skipping to change at line 349 | skipping to change at line 365 | |||
* only valid until "task" is started! | * only valid until "task" is started! | |||
*/ | */ | |||
GNUNET_SCHEDULER_TaskIdentifier | GNUNET_SCHEDULER_TaskIdentifier | |||
GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness, | GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness, | |||
GNUNET_SCHEDULER_Task task, | GNUNET_SCHEDULER_Task task, | |||
void *task_cls); | void *task_cls); | |||
/** | /** | |||
* Schedule a new task to be run with a specified delay. The task | * Schedule a new task to be run with a specified delay. The task | |||
* will be scheduled for execution once the delay has expired. It | * will be scheduled for execution once the delay has expired. It | |||
* will be run with the priority of the calling task. | * will be run with the DEFAULT priority. | |||
* | * | |||
* * @param delay when should this operation time out? Use | * * @param delay when should this operation time out? Use | |||
* GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | * GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | |||
* @param task main function of the task | * @param task main function of the task | |||
* @param task_cls closure of task | * @param task_cls closure of task | |||
* @return unique task identifier for the job | * @return unique task identifier for the job | |||
* only valid until "task" is started! | * only valid until "task" is started! | |||
*/ | */ | |||
GNUNET_SCHEDULER_TaskIdentifier | GNUNET_SCHEDULER_TaskIdentifier | |||
GNUNET_SCHEDULER_add_delayed (struct GNUNET_TIME_Relative delay, | GNUNET_SCHEDULER_add_delayed (struct GNUNET_TIME_Relative delay, | |||
GNUNET_SCHEDULER_Task task, void *task_cls); | GNUNET_SCHEDULER_Task task, void *task_cls); | |||
/** | /** | |||
* Schedule a new task to be run with a specified delay. The task | ||||
* will be scheduled for execution once the delay has expired. | ||||
* | ||||
* @param delay when should this operation time out? Use | ||||
* GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | ||||
* @param priority priority to use for the task | ||||
* @param task main function of the task | ||||
* @param task_cls closure of task | ||||
* @return unique task identifier for the job | ||||
* only valid until "task" is started! | ||||
*/ | ||||
GNUNET_SCHEDULER_TaskIdentifier | ||||
GNUNET_SCHEDULER_add_delayed_with_priority (struct GNUNET_TIME_Relative del | ||||
ay, | ||||
enum GNUNET_SCHEDULER_Priority p | ||||
riority, | ||||
GNUNET_SCHEDULER_Task task, void | ||||
*task_cls); | ||||
/** | ||||
* Schedule a new task to be run with a specified delay or when the | * Schedule a new task to be run with a specified delay or when the | |||
* specified file descriptor is ready for reading. The delay can be | * specified file descriptor is ready for reading. The delay can be | |||
* used as a timeout on the socket being ready. The task will be | * used as a timeout on the socket being ready. The task will be | |||
* scheduled for execution once either the delay has expired or the | * scheduled for execution once either the delay has expired or the | |||
* socket operation is ready. It will be run with the priority of | * socket operation is ready. It will be run with the DEFAULT priority. | |||
* the calling task. | ||||
* | * | |||
* * @param delay when should this operation time out? Use | * * @param delay when should this operation time out? Use | |||
* GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | * GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | |||
* @param rfd read file-descriptor | * @param rfd read file-descriptor | |||
* @param task main function of the task | * @param task main function of the task | |||
* @param task_cls closure of task | * @param task_cls closure of task | |||
* @return unique task identifier for the job | * @return unique task identifier for the job | |||
* only valid until "task" is started! | * only valid until "task" is started! | |||
*/ | */ | |||
GNUNET_SCHEDULER_TaskIdentifier | GNUNET_SCHEDULER_TaskIdentifier | |||
GNUNET_SCHEDULER_add_read_net (struct GNUNET_TIME_Relative delay, | GNUNET_SCHEDULER_add_read_net (struct GNUNET_TIME_Relative delay, | |||
struct GNUNET_NETWORK_Handle *rfd, | struct GNUNET_NETWORK_Handle *rfd, | |||
GNUNET_SCHEDULER_Task task, void *task_cls); | GNUNET_SCHEDULER_Task task, void *task_cls); | |||
/** | /** | |||
* Schedule a new task to be run with a specified delay or when the | * Schedule a new task to be run with a specified delay or when the | |||
* specified file descriptor is ready for writing. The delay can be | * specified file descriptor is ready for writing. The delay can be | |||
* used as a timeout on the socket being ready. The task will be | * used as a timeout on the socket being ready. The task will be | |||
* scheduled for execution once either the delay has expired or the | * scheduled for execution once either the delay has expired or the | |||
* socket operation is ready. It will be run with the priority of | * socket operation is ready. It will be run with the DEFAULT priority. | |||
* the calling task. | ||||
* | * | |||
* * @param delay when should this operation time out? Use | * * @param delay when should this operation time out? Use | |||
* GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | * GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | |||
* @param wfd write file-descriptor | * @param wfd write file-descriptor | |||
* @param task main function of the task | * @param task main function of the task | |||
* @param task_cls closure of task | * @param task_cls closure of task | |||
* @return unique task identifier for the job | * @return unique task identifier for the job | |||
* only valid until "task" is started! | * only valid until "task" is started! | |||
*/ | */ | |||
GNUNET_SCHEDULER_TaskIdentifier | GNUNET_SCHEDULER_TaskIdentifier | |||
GNUNET_SCHEDULER_add_write_net (struct GNUNET_TIME_Relative delay, | GNUNET_SCHEDULER_add_write_net (struct GNUNET_TIME_Relative delay, | |||
struct GNUNET_NETWORK_Handle *wfd, | struct GNUNET_NETWORK_Handle *wfd, | |||
GNUNET_SCHEDULER_Task task, void *task_cls) ; | GNUNET_SCHEDULER_Task task, void *task_cls) ; | |||
/** | /** | |||
* Schedule a new task to be run with a specified delay or when the | * Schedule a new task to be run with a specified delay or when the | |||
* specified file descriptor is ready for reading. The delay can be | * specified file descriptor is ready for reading. The delay can be | |||
* used as a timeout on the socket being ready. The task will be | * used as a timeout on the socket being ready. The task will be | |||
* scheduled for execution once either the delay has expired or the | * scheduled for execution once either the delay has expired or the | |||
* socket operation is ready. It will be run with the priority of | * socket operation is ready. It will be run with the DEFAULT priority. | |||
* the calling task. | ||||
* | * | |||
* * @param delay when should this operation time out? Use | * * @param delay when should this operation time out? Use | |||
* GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | * GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | |||
* @param rfd read file-descriptor | * @param rfd read file-descriptor | |||
* @param task main function of the task | * @param task main function of the task | |||
* @param task_cls closure of task | * @param task_cls closure of task | |||
* @return unique task identifier for the job | * @return unique task identifier for the job | |||
* only valid until "task" is started! | * only valid until "task" is started! | |||
*/ | */ | |||
GNUNET_SCHEDULER_TaskIdentifier | GNUNET_SCHEDULER_TaskIdentifier | |||
GNUNET_SCHEDULER_add_read_file (struct GNUNET_TIME_Relative delay, | GNUNET_SCHEDULER_add_read_file (struct GNUNET_TIME_Relative delay, | |||
const struct GNUNET_DISK_FileHandle *rfd, | const struct GNUNET_DISK_FileHandle *rfd, | |||
GNUNET_SCHEDULER_Task task, void *task_cls) ; | GNUNET_SCHEDULER_Task task, void *task_cls) ; | |||
/** | /** | |||
* Schedule a new task to be run with a specified delay or when the | * Schedule a new task to be run with a specified delay or when the | |||
* specified file descriptor is ready for writing. The delay can be | * specified file descriptor is ready for writing. The delay can be | |||
* used as a timeout on the socket being ready. The task will be | * used as a timeout on the socket being ready. The task will be | |||
* scheduled for execution once either the delay has expired or the | * scheduled for execution once either the delay has expired or the | |||
* socket operation is ready. It will be run with the priority of | * socket operation is ready. It will be run with the DEFAULT priority. | |||
* the calling task. | ||||
* | * | |||
* * @param delay when should this operation time out? Use | * * @param delay when should this operation time out? Use | |||
* GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | * GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | |||
* @param wfd write file-descriptor | * @param wfd write file-descriptor | |||
* @param task main function of the task | * @param task main function of the task | |||
* @param task_cls closure of task | * @param task_cls closure of task | |||
* @return unique task identifier for the job | * @return unique task identifier for the job | |||
* only valid until "task" is started! | * only valid until "task" is started! | |||
*/ | */ | |||
GNUNET_SCHEDULER_TaskIdentifier | GNUNET_SCHEDULER_TaskIdentifier | |||
End of changes. 11 change blocks. | ||||
14 lines changed or deleted | 49 lines changed or added | |||
gnunet_server_lib.h | gnunet_server_lib.h | |||
---|---|---|---|---|
skipping to change at line 231 | skipping to change at line 231 | |||
* times out or activity happens on the socket). | * times out or activity happens on the socket). | |||
* | * | |||
* @param client the client to update | * @param client the client to update | |||
* @param timeout new timeout for activities on the socket | * @param timeout new timeout for activities on the socket | |||
*/ | */ | |||
void | void | |||
GNUNET_SERVER_client_set_timeout (struct GNUNET_SERVER_Client *client, | GNUNET_SERVER_client_set_timeout (struct GNUNET_SERVER_Client *client, | |||
struct GNUNET_TIME_Relative timeout); | struct GNUNET_TIME_Relative timeout); | |||
/** | /** | |||
* Set if a client should finish a pending write when disconnecting. | ||||
*/ | ||||
void | ||||
GNUNET_SERVER_client_set_finish_pending_write (struct GNUNET_SERVER_Client | ||||
*client, | ||||
int finish); | ||||
/** | ||||
* Disable the warning the server issues if a message is not acknowledged | * Disable the warning the server issues if a message is not acknowledged | |||
* in a timely fashion. Use this call if a client is intentionally delayed | * in a timely fashion. Use this call if a client is intentionally delayed | |||
* for a while. Only applies to the current message. | * for a while. Only applies to the current message. | |||
* | * | |||
* @param client client for which to disable the warning | * @param client client for which to disable the warning | |||
*/ | */ | |||
void | void | |||
GNUNET_SERVER_disable_receive_done_warning (struct GNUNET_SERVER_Client | GNUNET_SERVER_disable_receive_done_warning (struct GNUNET_SERVER_Client | |||
*client); | *client); | |||
skipping to change at line 597 | skipping to change at line 604 | |||
int purge, int one_shot); | int purge, int one_shot); | |||
/** | /** | |||
* Destroys a tokenizer. | * Destroys a tokenizer. | |||
* | * | |||
* @param mst tokenizer to destroy | * @param mst tokenizer to destroy | |||
*/ | */ | |||
void | void | |||
GNUNET_SERVER_mst_destroy (struct GNUNET_SERVER_MessageStreamTokenizer *mst ); | GNUNET_SERVER_mst_destroy (struct GNUNET_SERVER_MessageStreamTokenizer *mst ); | |||
/** | ||||
* Signature of a function to create a custom tokenizer. | ||||
* | ||||
* @param cls closure from 'GNUNET_SERVER_set_callbacks' | ||||
* @param client handle to client the tokenzier will be used for | ||||
* @return handle to custom tokenizer ('mst') | ||||
*/ | ||||
typedef void* (*GNUNET_SERVER_MstCreateCallback) (void *cls, | ||||
struct GNUNET_SERVER_Clie | ||||
nt *client); | ||||
/** | ||||
* Signature of a function to destroy a custom tokenizer. | ||||
* | ||||
* @param cls closure from 'GNUNET_SERVER_set_callbacks' | ||||
* @param mst custom tokenizer handle | ||||
*/ | ||||
typedef void (*GNUNET_SERVER_MstDestroyCallback) (void *cls, void *mst); | ||||
/** | ||||
* Signature of a function to destroy a custom tokenizer. | ||||
* | ||||
* @param cls closure from 'GNUNET_SERVER_set_callbacks' | ||||
* @param mst custom tokenizer handle | ||||
* @param client_identity ID of client for which this is a buffer, | ||||
* can be NULL (will be passed back to 'cb') | ||||
* @param buf input data to add | ||||
* @param size number of bytes in buf | ||||
* @param purge should any excess bytes in the buffer be discarded | ||||
* (i.e. for packet-based services like UDP) | ||||
* @param one_shot only call callback once, keep rest of message in buffer | ||||
* @return GNUNET_OK if we are done processing (need more data) | ||||
* GNUNET_NO if one_shot was set and we have another message ready | ||||
* GNUNET_SYSERR if the data stream is corrupt | ||||
*/ | ||||
typedef int (*GNUNET_SERVER_MstReceiveCallback) (void *cls, void *mst, | ||||
struct GNUNET_SERVER_Clien | ||||
t *client, | ||||
const char *buf, size_t si | ||||
ze, | ||||
int purge, int one_shot); | ||||
/** | ||||
* Change functions used by the server to tokenize the message stream. | ||||
* (very rarely used). | ||||
* | ||||
* @param server server to modify | ||||
* @param create new tokenizer initialization function | ||||
* @param destroy new tokenizer destruction function | ||||
* @param receive new tokenizer receive function | ||||
* @param cls closure for 'create', 'receive', 'destroy' | ||||
*/ | ||||
void | ||||
GNUNET_SERVER_set_callbacks (struct GNUNET_SERVER_Handle *server, | ||||
GNUNET_SERVER_MstCreateCallback create, | ||||
GNUNET_SERVER_MstDestroyCallback destroy, | ||||
GNUNET_SERVER_MstReceiveCallback receive, | ||||
void *cls); | ||||
#if 0 /* keep Emacsens' auto-indent happy */ | #if 0 /* keep Emacsens' auto-indent happy */ | |||
{ | { | |||
#endif | #endif | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
/* ifndef GNUNET_SERVER_LIB_H */ | /* ifndef GNUNET_SERVER_LIB_H */ | |||
#endif | #endif | |||
/* end of gnunet_server_lib.h */ | /* end of gnunet_server_lib.h */ | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 67 lines changed or added | |||
gnunet_strings_lib.h | gnunet_strings_lib.h | |||
---|---|---|---|---|
skipping to change at line 192 | skipping to change at line 192 | |||
/** | /** | |||
* Give relative time in human-readable fancy format. | * Give relative time in human-readable fancy format. | |||
* | * | |||
* @param delta time in milli seconds | * @param delta time in milli seconds | |||
* @return string in human-readable form | * @return string in human-readable form | |||
*/ | */ | |||
char * | char * | |||
GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta); | GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta); | |||
/** | ||||
* "man basename" | ||||
* Returns a pointer to a part of filename (allocates nothing)! | ||||
* | ||||
* @param filename filename to extract basename from | ||||
* @return short (base) name of the file (that is, everything following the | ||||
* last directory separator in filename. If filename ends with a | ||||
* directory separator, the result will be a zero-length string. | ||||
* If filename has no directory separators, the result is filename | ||||
* itself. | ||||
*/ | ||||
const char * | ||||
GNUNET_STRINGS_get_short_name (const char *filename); | ||||
#if 0 /* keep Emacsens' auto-indent happy */ | #if 0 /* keep Emacsens' auto-indent happy */ | |||
{ | { | |||
#endif | #endif | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #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. 1 change blocks. | ||||
0 lines changed or deleted | 14 lines changed or added | |||
gnunet_testing_lib.h | gnunet_testing_lib.h | |||
---|---|---|---|---|
skipping to change at line 503 | skipping to change at line 503 | |||
* Check whether the given daemon is running. | * Check whether the given daemon is running. | |||
* | * | |||
* @param daemon the daemon to check | * @param daemon the daemon to check | |||
* @return GNUNET_YES if the daemon is up, GNUNET_NO if the | * @return GNUNET_YES if the daemon is up, GNUNET_NO if the | |||
* daemon is down, GNUNET_SYSERR on error. | * daemon is down, GNUNET_SYSERR on error. | |||
*/ | */ | |||
int | int | |||
GNUNET_TESTING_test_daemon_running (struct GNUNET_TESTING_Daemon *daemon); | GNUNET_TESTING_test_daemon_running (struct GNUNET_TESTING_Daemon *daemon); | |||
/** | /** | |||
* Obtain the peer identity of the peer with the given configuration | ||||
* handle. This function reads the private key of the peer, obtains | ||||
* the public key and hashes it. | ||||
* | ||||
* @param cfg configuration of the peer | ||||
* @param pid where to store the peer identity | ||||
* @return GNUNET_OK on success, GNUNET_SYSERR on failure | ||||
*/ | ||||
int | ||||
GNUNET_TESTING_get_peer_identity (const struct GNUNET_CONFIGURATION_Handle | ||||
*cfg, | ||||
struct GNUNET_PeerIdentity *pid); | ||||
/** | ||||
* Restart (stop and start) a GNUnet daemon. | * Restart (stop and start) a GNUnet daemon. | |||
* | * | |||
* @param d the daemon that should be restarted | * @param d the daemon that should be restarted | |||
* @param cb function called once the daemon is (re)started | * @param cb function called once the daemon is (re)started | |||
* @param cb_cls closure for cb | * @param cb_cls closure for cb | |||
*/ | */ | |||
void | void | |||
GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d, | GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d, | |||
GNUNET_TESTING_NotifyDaemonRunning cb, | GNUNET_TESTING_NotifyDaemonRunning cb, | |||
void *cb_cls); | void *cb_cls); | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 14 lines changed or added | |||
gnunet_transport_plugin.h | gnunet_transport_plugin.h | |||
---|---|---|---|---|
skipping to change at line 275 | skipping to change at line 275 | |||
* GNUNET_SYSERR if the target disconnected; | * GNUNET_SYSERR if the target disconnected; | |||
* disconnect will ALSO be signalled using | * disconnect will ALSO be signalled using | |||
* the ReceiveCallback. | * the ReceiveCallback. | |||
*/ | */ | |||
typedef void (*GNUNET_TRANSPORT_TransmitContinuation) (void *cls, | typedef void (*GNUNET_TRANSPORT_TransmitContinuation) (void *cls, | |||
const struct | const struct | |||
GNUNET_PeerIdentity * | GNUNET_PeerIdentity * | |||
target, int result); | target, int result); | |||
/** | /** | |||
* Function that can be used by the transport service to transmit | ||||
* a message using the plugin. Note that in the case of a | ||||
* peer disconnecting, the continuation MUST be called | ||||
* prior to the disconnect notification itself. This function | ||||
* will be called with this peer's HELLO message to initiate | ||||
* a fresh connection to another peer. | ||||
* | ||||
* @param cls closure | ||||
* @param target who should receive this message | ||||
* @param msgbuf the message to transmit | ||||
* @param msgbuf_size number of bytes in 'msgbuf' | ||||
* @param priority how important is the message (most plugins will | ||||
* ignore message priority and just FIFO) | ||||
* @param timeout how long to wait at most for the transmission (does not | ||||
* require plugins to discard the message after the timeout, | ||||
* just advisory for the desired delay; most plugins will ig | ||||
nore | ||||
* this as well) | ||||
* @param session which session must be used (or NULL for "any") | ||||
* @param addr the address to use (can be NULL if the plugin | ||||
* is "on its own" (i.e. re-use existing TCP connection)) | ||||
* @param addrlen length of the address in bytes | ||||
* @param force_address GNUNET_YES if the plugin MUST use the given address | ||||
, | ||||
* GNUNET_NO means the plugin may use any other address and | ||||
* GNUNET_SYSERR means that only reliable existing | ||||
* bi-directional connections should be used (regardless | ||||
* of address) | ||||
* @param cont continuation to call once the message has | ||||
* been transmitted (or if the transport is ready | ||||
* for the next transmission call; or if the | ||||
* peer disconnected...); can be NULL | ||||
* @param cont_cls closure for cont | ||||
* @return number of bytes used (on the physical network, with overheads); | ||||
* -1 on hard errors (i.e. address invalid); 0 is a legal value | ||||
* and does NOT mean that the message was not transmitted (DV) | ||||
*/ | ||||
typedef ssize_t (*GNUNET_TRANSPORT_TransmitFunction) (void *cls, | ||||
const struct | ||||
GNUNET_PeerIdentity * | ||||
target, | ||||
const char *msgbuf, | ||||
size_t msgbuf_size, | ||||
uint32_t priority, | ||||
struct | ||||
GNUNET_TIME_Relative | ||||
timeout, | ||||
struct Session * sess | ||||
ion, | ||||
const void *addr, | ||||
size_t addrlen, | ||||
int force_address, | ||||
GNUNET_TRANSPORT_Tran | ||||
smitContinuation | ||||
cont, void *cont_cls) | ||||
; | ||||
/** | ||||
* The new send function with just the session and no address | * The new send function with just the session and no address | |||
* | * | |||
* Function that can be used by the transport service to transmit | * Function that can be used by the transport service to transmit | |||
* a message using the plugin. Note that in the case of a | * a message using the plugin. Note that in the case of a | |||
* peer disconnecting, the continuation MUST be called | * peer disconnecting, the continuation MUST be called | |||
* prior to the disconnect notification itself. This function | * prior to the disconnect notification itself. This function | |||
* will be called with this peer's HELLO message to initiate | * will be called with this peer's HELLO message to initiate | |||
* a fresh connection to another peer. | * a fresh connection to another peer. | |||
* | * | |||
* @param cls closure | * @param cls closure | |||
* @param target who should receive this message | * @param session which session must be used | |||
* @param msgbuf the message to transmit | * @param msgbuf the message to transmit | |||
* @param msgbuf_size number of bytes in 'msgbuf' | * @param msgbuf_size number of bytes in 'msgbuf' | |||
* @param priority how important is the message (most plugins will | * @param priority how important is the message (most plugins will | |||
* ignore message priority and just FIFO) | * ignore message priority and just FIFO) | |||
* @param timeout how long to wait at most for the transmission (does not | * @param timeout how long to wait at most for the transmission (does not | |||
* require plugins to discard the message after the timeout, | * require plugins to discard the message after the timeout, | |||
* just advisory for the desired delay; most plugins will ig nore | * just advisory for the desired delay; most plugins will ig nore | |||
* this as well) | * this as well) | |||
* @param session which session must be used (or NULL for "any") | ||||
* @param addr the address to use (can be NULL if the plugin | ||||
* is "on its own" (i.e. re-use existing TCP connection)) | ||||
* @param addrlen length of the address in bytes | ||||
* @param force_address GNUNET_YES if the plugin MUST use the given address | ||||
, | ||||
* GNUNET_NO means the plugin may use any other address and | ||||
* GNUNET_SYSERR means that only reliable existing | ||||
* bi-directional connections should be used (regardless | ||||
* of address) | ||||
* @param cont continuation to call once the message has | * @param cont continuation to call once the message has | |||
* been transmitted (or if the transport is ready | * been transmitted (or if the transport is ready | |||
* for the next transmission call; or if the | * for the next transmission call; or if the | |||
* peer disconnected...); can be NULL | * peer disconnected...); can be NULL | |||
* @param cont_cls closure for cont | * @param cont_cls closure for cont | |||
* @return number of bytes used (on the physical network, with overheads); | * @return number of bytes used (on the physical network, with overheads); | |||
* -1 on hard errors (i.e. address invalid); 0 is a legal value | * -1 on hard errors (i.e. address invalid); 0 is a legal value | |||
* and does NOT mean that the message was not transmitted (DV) | * and does NOT mean that the message was not transmitted (DV) | |||
*/ | */ | |||
typedef ssize_t (*GNUNET_TRANSPORT_TransmitFunctionWithSession) (void *cls, | typedef ssize_t (*GNUNET_TRANSPORT_TransmitFunction) (void *cls, | |||
const struct | struct Session *session, | |||
GNUNET_PeerIdentity * | const char *msgbuf, size_t msgbuf_size, | |||
target, | unsigned int priority, | |||
const char *msgbuf, | struct GNUNET_TIME_Relative to, | |||
size_t msgbuf_size, | GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls); | |||
uint32_t priority, | ||||
struct GNUNET_TIME_Re | ||||
lative timeout, | ||||
struct Session * sess | ||||
ion, | ||||
GNUNET_TRANSPORT_Tran | ||||
smitContinuation | ||||
cont, void *cont_cls) | ||||
; | ||||
/** | /** | |||
* Function that can be called to force a disconnect from the | * Function that can be called to force a disconnect from the | |||
* specified neighbour. This should also cancel all previously | * specified neighbour. This should also cancel all previously | |||
* scheduled transmissions. Obviously the transmission may have been | * scheduled transmissions. Obviously the transmission may have been | |||
* partially completed already, which is OK. The plugin is supposed | * partially completed already, which is OK. The plugin is supposed | |||
* to close the connection (if applicable) and no longer call the | * to close the connection (if applicable) and no longer call the | |||
* transmit continuation(s). | * transmit continuation(s). | |||
* | * | |||
* Finally, plugin MUST NOT call the services's receive function to | * Finally, plugin MUST NOT call the services's receive function to | |||
skipping to change at line 456 | skipping to change at line 389 | |||
* and transport, GNUNET_SYSERR if not | * and transport, GNUNET_SYSERR if not | |||
*/ | */ | |||
typedef int (*GNUNET_TRANSPORT_CheckAddress) (void *cls, const void *addr, | typedef int (*GNUNET_TRANSPORT_CheckAddress) (void *cls, const void *addr, | |||
size_t addrlen); | size_t addrlen); | |||
/** | /** | |||
* Create a new session to transmit data to the target | * Create a new session to transmit data to the target | |||
* This session will used to send data to this peer and the plugin will | * This session will used to send data to this peer and the plugin will | |||
* notify us by calling the env->session_end function | * notify us by calling the env->session_end function | |||
* | * | |||
* @param cls closure | * @param cls the plugin | |||
* @param target the neighbour id | * @param target the neighbour id | |||
* @param addr pointer to the address | * @param addr pointer to the address | |||
* @param addrlen length of addr | * @param addrlen length of addr | |||
* @return the session if the address is valid, NULL otherwise | * @return the session if the address is valid, NULL otherwise | |||
*/ | */ | |||
typedef const void * (*GNUNET_TRANSPORT_CreateSession) (void *cls, | typedef struct Session * (*GNUNET_TRANSPORT_CreateSession) (void *cls, | |||
const struct GNUNET_PeerI | const struct GNUNET_HELLO_Address *address); | |||
dentity *target, | ||||
const void *addr, | ||||
size_t addrlen); | ||||
/** | /** | |||
* Function called for a quick conversion of the binary address to | * Function called for a quick conversion of the binary address to | |||
* a numeric address. Note that the caller must not free the | * a numeric address. Note that the caller must not free the | |||
* address and that the next call to this function is allowed | * address and that the next call to this function is allowed | |||
* to override the address again. | * to override the address again. | |||
* | * | |||
* @param cls closure | * @param cls closure | |||
* @param addr binary address | * @param addr binary address | |||
* @param addr_len length of the address | * @param addr_len length of the address | |||
skipping to change at line 504 | skipping to change at line 435 | |||
/** | /** | |||
* Function that the transport service will use to transmit data to | * Function that the transport service will use to transmit data to | |||
* another peer. May be NULL for plugins that only support | * another peer. May be NULL for plugins that only support | |||
* receiving data. After this call, the plugin call the specified | * receiving data. After this call, the plugin call the specified | |||
* continuation with success or error before notifying us about the | * continuation with success or error before notifying us about the | |||
* target having disconnected. | * target having disconnected. | |||
*/ | */ | |||
GNUNET_TRANSPORT_TransmitFunction send; | GNUNET_TRANSPORT_TransmitFunction send; | |||
/** | /** | |||
* New send function | ||||
* Will be renamed to "send" when implementation is done | ||||
*/ | ||||
GNUNET_TRANSPORT_TransmitFunctionWithSession send_with_session; | ||||
/** | ||||
* Function that can be used to force the plugin to disconnect from | * Function that can be used to force the plugin to disconnect from | |||
* the given peer and cancel all previous transmissions (and their | * the given peer and cancel all previous transmissions (and their | |||
* continuations). | * continuations). | |||
*/ | */ | |||
GNUNET_TRANSPORT_DisconnectFunction disconnect; | GNUNET_TRANSPORT_DisconnectFunction disconnect; | |||
/** | /** | |||
* Function to pretty-print addresses. NOTE: this function is not | * Function to pretty-print addresses. NOTE: this function is not | |||
* yet used by transport-service, but will be used in the future | * yet used by transport-service, but will be used in the future | |||
* once the transport-API has been completed. | * once the transport-API has been completed. | |||
skipping to change at line 545 | skipping to change at line 469 | |||
/** | /** | |||
* Function that will be called to convert a binary address | * Function that will be called to convert a binary address | |||
* to a string (numeric conversion only). | * to a string (numeric conversion only). | |||
*/ | */ | |||
GNUNET_TRANSPORT_AddressToString address_to_string; | GNUNET_TRANSPORT_AddressToString address_to_string; | |||
/** | /** | |||
* Function that will be called tell the plugin to create a session | * Function that will be called tell the plugin to create a session | |||
* object | * object | |||
*/ | */ | |||
GNUNET_TRANSPORT_CreateSession create_session; | GNUNET_TRANSPORT_CreateSession get_session; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 8 change blocks. | ||||
98 lines changed or deleted | 11 lines changed or added | |||
gnunet_transport_service.h | gnunet_transport_service.h | |||
---|---|---|---|---|
skipping to change at line 269 | skipping to change at line 269 | |||
/** | /** | |||
* Handle to cancel a pending address lookup. | * Handle to cancel a pending address lookup. | |||
*/ | */ | |||
struct GNUNET_TRANSPORT_AddressToStringContext; | struct GNUNET_TRANSPORT_AddressToStringContext; | |||
/** | /** | |||
* Convert a binary address into a human readable address. | * Convert a binary address into a human readable address. | |||
* | * | |||
* @param cfg configuration to use | * @param cfg configuration to use | |||
* @param address address to convert (binary format) | * @param address address to convert (binary format) | |||
* @param addressLen number of bytes in address | ||||
* @param numeric should (IP) addresses be displayed in numeric form | * @param numeric should (IP) addresses be displayed in numeric form | |||
* (otherwise do reverse DNS lookup) | * (otherwise do reverse DNS lookup) | |||
* @param nameTrans name of the transport to which the address belongs | ||||
* @param timeout how long is the lookup allowed to take at most | * @param timeout how long is the lookup allowed to take at most | |||
* @param aluc function to call with the results | * @param aluc function to call with the results | |||
* @param aluc_cls closure for aluc | * @param aluc_cls closure for aluc | |||
* @return handle to cancel the operation, NULL on error | * @return handle to cancel the operation, NULL on error | |||
*/ | */ | |||
struct GNUNET_TRANSPORT_AddressToStringContext * | struct GNUNET_TRANSPORT_AddressToStringContext * | |||
GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handl e | GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handl e | |||
*cfg, | *cfg, | |||
const struct GNUNET_HELLO_Address *addr ess, | const struct GNUNET_HELLO_Address *addr ess, | |||
int numeric, | int numeric, | |||
skipping to change at line 344 | skipping to change at line 342 | |||
/** | /** | |||
* Handle for blacklisting peers. | * Handle for blacklisting peers. | |||
*/ | */ | |||
struct GNUNET_TRANSPORT_Blacklist; | struct GNUNET_TRANSPORT_Blacklist; | |||
/** | /** | |||
* Function that decides if a connection is acceptable or not. | * Function that decides if a connection is acceptable or not. | |||
* | * | |||
* @param cls closure | * @param cls closure | |||
* @param pid peer to approve or disapproave | * @param pid peer to approve or disapproave | |||
* @return GNUNET_OK if the connection is allowed | * @return GNUNET_OK if the connection is allowed, GNUNET_SYSERR if not | |||
*/ | */ | |||
typedef int (*GNUNET_TRANSPORT_BlacklistCallback) (void *cls, | typedef int (*GNUNET_TRANSPORT_BlacklistCallback) (void *cls, | |||
const struct | const struct | |||
GNUNET_PeerIdentity * pi d); | GNUNET_PeerIdentity * pi d); | |||
/** | /** | |||
* Install a blacklist callback. The service will be queried for all | * Install a blacklist callback. The service will be queried for all | |||
* existing connections as well as any fresh connections to check if | * existing connections as well as any fresh connections to check if | |||
* they are permitted. If the blacklisting callback is unregistered, | * they are permitted. If the blacklisting callback is unregistered, | |||
* all hosts that were denied in the past will automatically be | * all hosts that were denied in the past will automatically be | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 1 lines changed or added | |||
gnunet_util_lib.h | gnunet_util_lib.h | |||
---|---|---|---|---|
skipping to change at line 49 | skipping to change at line 49 | |||
#include "gnunet_common.h" | #include "gnunet_common.h" | |||
#include "gnunet_bandwidth_lib.h" | #include "gnunet_bandwidth_lib.h" | |||
#include "gnunet_bio_lib.h" | #include "gnunet_bio_lib.h" | |||
#include "gnunet_client_lib.h" | #include "gnunet_client_lib.h" | |||
#include "gnunet_configuration_lib.h" | #include "gnunet_configuration_lib.h" | |||
#include "gnunet_connection_lib.h" | #include "gnunet_connection_lib.h" | |||
#include "gnunet_container_lib.h" | #include "gnunet_container_lib.h" | |||
#include "gnunet_crypto_lib.h" | #include "gnunet_crypto_lib.h" | |||
#include "gnunet_disk_lib.h" | #include "gnunet_disk_lib.h" | |||
#include "gnunet_getopt_lib.h" | #include "gnunet_getopt_lib.h" | |||
#include "gnunet_helper_lib.h" | ||||
#include "gnunet_network_lib.h" | #include "gnunet_network_lib.h" | |||
#include "gnunet_os_lib.h" | #include "gnunet_os_lib.h" | |||
#include "gnunet_peer_lib.h" | #include "gnunet_peer_lib.h" | |||
#include "gnunet_plugin_lib.h" | #include "gnunet_plugin_lib.h" | |||
#include "gnunet_program_lib.h" | #include "gnunet_program_lib.h" | |||
#include "gnunet_protocols.h" | #include "gnunet_protocols.h" | |||
#include "gnunet_pseudonym_lib.h" | #include "gnunet_pseudonym_lib.h" | |||
#include "gnunet_scheduler_lib.h" | #include "gnunet_scheduler_lib.h" | |||
#include "gnunet_server_lib.h" | #include "gnunet_server_lib.h" | |||
#include "gnunet_service_lib.h" | #include "gnunet_service_lib.h" | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 1 lines changed or added | |||
platform.h | platform.h | |||
---|---|---|---|---|
skipping to change at line 110 | skipping to change at line 110 | |||
#endif | #endif | |||
#endif | #endif | |||
#include <string.h> | #include <string.h> | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <stdlib.h> | #include <stdlib.h> | |||
#include <stdint.h> | #include <stdint.h> | |||
#include <stdarg.h> | #include <stdarg.h> | |||
#include <errno.h> | #include <errno.h> | |||
#include <signal.h> | #include <signal.h> | |||
#include <libgen.h> | ||||
#ifdef WINDOWS | #ifdef WINDOWS | |||
#include <malloc.h> /* for alloca(), on other OSes it's in stdl ib.h */ | #include <malloc.h> /* for alloca(), on other OSes it's in stdl ib.h */ | |||
#endif | #endif | |||
#ifndef _MSC_VER | #ifndef _MSC_VER | |||
#include <unistd.h> /* KLB_FIX */ | #include <unistd.h> /* KLB_FIX */ | |||
#endif | #endif | |||
#include <sys/stat.h> | #include <sys/stat.h> | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#ifndef _MSC_VER | #ifndef _MSC_VER | |||
#include <dirent.h> /* KLB_FIX */ | #include <dirent.h> /* KLB_FIX */ | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 1 lines changed or added | |||
plibc.h | plibc.h | |||
---|---|---|---|---|
skipping to change at line 25 | skipping to change at line 25 | |||
You should have received a copy of the GNU Lesser General Public | You should have received a copy of the GNU Lesser General Public | |||
License along with this library; if not, write to the Free Softwa re | License along with this library; if not, write to the Free Softwa re | |||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1 307 USA | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1 307 USA | |||
*/ | */ | |||
/** | /** | |||
* @file include/plibc.h | * @file include/plibc.h | |||
* @brief PlibC header | * @brief PlibC header | |||
* @attention This file is usually not installed under Unix, | * @attention This file is usually not installed under Unix, | |||
* so ship it with your application | * so ship it with your application | |||
* @version $Revision: 69 $ | * @version $Revision$ | |||
*/ | */ | |||
#ifndef _PLIBC_H_ | #ifndef _PLIBC_H_ | |||
#define _PLIBC_H_ | #define _PLIBC_H_ | |||
#ifndef SIGALRM | #ifndef SIGALRM | |||
#define SIGALRM 14 | #define SIGALRM 14 | |||
#endif | #endif | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" | extern "C" { | |||
{ | ||||
#endif | #endif | |||
#include <stddef.h> | #include <stddef.h> | |||
#ifdef Q_OS_WIN32 | #ifdef Q_OS_WIN32 | |||
#define WINDOWS 1 | #define WINDOWS 1 | |||
#endif | #endif | |||
#define HAVE_PLIBC_FD 0 | #define HAVE_PLIBC_FD 0 | |||
#ifdef WINDOWS | #ifdef WINDOWS | |||
#if ENABLE_NLS | #if ENABLE_NLS | |||
#include "langinfo.h" | #include "langinfo.h" | |||
#endif | #endif | |||
#include <winsock2.h> | ||||
#include <ws2tcpip.h> | #include <ws2tcpip.h> | |||
#include <windows.h> | #include <windows.h> | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <time.h> | #include <time.h> | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <sys/stat.h> | #include <sys/stat.h> | |||
#include <dirent.h> | #include <dirent.h> | |||
#include <errno.h> | #include <errno.h> | |||
#include <stdarg.h> | #include <stdarg.h> | |||
#define __BYTE_ORDER BYTE_ORDER | #define __BYTE_ORDER BYTE_ORDER | |||
#define __BIG_ENDIAN BIG_ENDIAN | #define __BIG_ENDIAN BIG_ENDIAN | |||
/* Conflicts with our definitions */ | /* Conflicts with our definitions */ | |||
#define __G_WIN32_H__ | #define __G_WIN32_H__ | |||
/* Convert LARGE_INTEGER to double */ | /* Convert LARGE_INTEGER to double */ | |||
#define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \ | #define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \ | |||
(double)((x).LowPart)) | (double)((x).LowPart)) | |||
#ifndef __MINGW64__ | ||||
struct stat64 | struct stat64 | |||
{ | { | |||
_dev_t st_dev; | _dev_t st_dev; | |||
_ino_t st_ino; | _ino_t st_ino; | |||
_mode_t st_mode; | _mode_t st_mode; | |||
short st_nlink; | short st_nlink; | |||
short st_uid; | short st_uid; | |||
short st_gid; | short st_gid; | |||
_dev_t st_rdev; | _dev_t st_rdev; | |||
__int64 st_size; | __int64 st_size; | |||
__time64_t st_atime; | __time64_t st_atime; | |||
__time64_t st_mtime; | __time64_t st_mtime; | |||
__time64_t st_ctime; | __time64_t st_ctime; | |||
}; | }; | |||
#endif | ||||
typedef unsigned int sa_family_t; | typedef unsigned int sa_family_t; | |||
struct sockaddr_un | struct sockaddr_un { | |||
{ | short sun_family; /*AF_UNIX*/ | |||
short sun_family; /*AF_UNIX */ | char sun_path[108]; /*path name */ | |||
char sun_path[108]; /*path name */ | }; | |||
}; | ||||
#ifndef pid_t | #ifndef pid_t | |||
#define pid_t DWORD | #define pid_t DWORD | |||
#endif | #endif | |||
#ifndef error_t | #ifndef error_t | |||
#define error_t int | #define error_t int | |||
#endif | #endif | |||
#ifndef WEXITSTATUS | #ifndef WEXITSTATUS | |||
#define WEXITSTATUS(status) (((status) & 0xff00) >> 8) | #define WEXITSTATUS(status) (((status) & 0xff00) >> 8) | |||
#endif | #endif | |||
#ifndef MSG_DONTWAIT | #ifndef MSG_DONTWAIT | |||
#define MSG_DONTWAIT 0 | #define MSG_DONTWAIT 0 | |||
#endif | #endif | |||
enum | enum | |||
{ | { | |||
_SC_PAGESIZE = 30, | _SC_PAGESIZE = 30, | |||
_SC_PAGE_SIZE = 30 | _SC_PAGE_SIZE = 30 | |||
}; | }; | |||
/* Thanks to the Cygwin project */ | /* Thanks to the Cygwin project */ | |||
#define ENOCSI 43 /* No CSI structure available */ | #define ENOCSI 43 /* No CSI structure available */ | |||
#define EL2HLT 44 /* Level 2 halted */ | #define EL2HLT 44 /* Level 2 halted */ | |||
#ifndef EDEADLK | #ifndef EDEADLK | |||
#define EDEADLK 45 /* Deadlock condition */ | #define EDEADLK 45 /* Deadlock condition */ | |||
#endif | #endif | |||
#ifndef ENOLCK | #ifndef ENOLCK | |||
#define ENOLCK 46 /* No record locks available */ | #define ENOLCK 46 /* No record locks available */ | |||
#endif | #endif | |||
#define EBADE 50 /* Invalid exchange */ | #define EBADE 50 /* Invalid exchange */ | |||
#define EBADR 51 /* Invalid request descriptor */ | #define EBADR 51 /* Invalid request descriptor */ | |||
#define EXFULL 52 /* Exchange full */ | #define EXFULL 52 /* Exchange full */ | |||
#define ENOANO 53 /* No anode */ | #define ENOANO 53 /* No anode */ | |||
#define EBADRQC 54 /* Invalid request code */ | #define EBADRQC 54 /* Invalid request code */ | |||
#define EBADSLT 55 /* Invalid slot */ | #define EBADSLT 55 /* Invalid slot */ | |||
#ifndef EDEADLOCK | #ifndef EDEADLOCK | |||
#define EDEADLOCK EDEADLK /* File locking deadlock error */ | #define EDEADLOCK EDEADLK /* File locking deadlock error */ | |||
#endif | #endif | |||
#define EBFONT 57 /* Bad font file fmt */ | #define EBFONT 57 /* Bad font file fmt */ | |||
#define ENOSTR 60 /* Device not a stream */ | #define ENOSTR 60 /* Device not a stream */ | |||
#define ENODATA 61 /* No data (for no delay io) */ | #define ENODATA 61 /* No data (for no delay io) */ | |||
#define ETIME 62 /* Timer expired */ | #define ETIME 62 /* Timer expired */ | |||
#define ENOSR 63 /* Out of streams resources */ | #define ENOSR 63 /* Out of streams resources */ | |||
#define ENONET 64 /* Machine is not on the network */ | #define ENONET 64 /* Machine is not on the network */ | |||
#define ENOPKG 65 /* Package not installed */ | #define ENOPKG 65 /* Package not installed */ | |||
#define EREMOTE 66 /* The object is remote */ | #define EREMOTE 66 /* The object is remote */ | |||
#define ENOLINK 67 /* The link has been severed */ | #define ENOLINK 67 /* The link has been severed */ | |||
#define EADV 68 /* Advertise error */ | #define EADV 68 /* Advertise error */ | |||
#define ESRMNT 69 /* Srmount error */ | #define ESRMNT 69 /* Srmount error */ | |||
#define ECOMM 70 /* Communication error on send */ | #define ECOMM 70 /* Communication error on send */ | |||
#define EPROTO 71 /* Protocol error */ | #define EPROTO 71 /* Protocol error */ | |||
#define EMULTIHOP 74 /* Multihop attempted */ | #define EMULTIHOP 74 /* Multihop attempted */ | |||
#define ELBIN 75 /* Inode is remote (not really error) */ | #define ELBIN 75 /* Inode is remote (not really error) */ | |||
#define EDOTDOT 76 /* Cross mount point (not really error) */ | #define EDOTDOT 76 /* Cross mount point (not really error) */ | |||
#define EBADMSG 77 /* Trying to read unreadable message */ | #define EBADMSG 77 /* Trying to read unreadable message */ | |||
#define ENOTUNIQ 80 /* Given log. name not unique */ | #define ENOTUNIQ 80 /* Given log. name not unique */ | |||
#define EBADFD 81 /* f.d. invalid for this operation */ | #define EBADFD 81 /* f.d. invalid for this operation */ | |||
#define EREMCHG 82 /* Remote address changed */ | #define EREMCHG 82 /* Remote address changed */ | |||
#define ELIBACC 83 /* Can't access a needed shared lib */ | #define ELIBACC 83 /* Can't access a needed shared lib */ | |||
#define ELIBBAD 84 /* Accessing a corrupted shared lib */ | #define ELIBBAD 84 /* Accessing a corrupted shared lib */ | |||
#define ELIBSCN 85 /* .lib section in a.out corrupted */ | #define ELIBSCN 85 /* .lib section in a.out corrupted */ | |||
#define ELIBMAX 86 /* Attempting to link in too many libs */ | #define ELIBMAX 86 /* Attempting to link in too many libs */ | |||
#define ELIBEXEC 87 /* Attempting to exec a shared library */ | #define ELIBEXEC 87 /* Attempting to exec a shared library */ | |||
#ifndef ENOSYS | #ifndef ENOSYS | |||
#define ENOSYS 88 /* Function not implemented */ | #define ENOSYS 88 /* Function not implemented */ | |||
#endif | #endif | |||
#define ENMFILE 89 /* No more files */ | #define ENMFILE 89 /* No more files */ | |||
#ifndef ENOTEMPTY | #ifndef ENOTEMPTY | |||
#define ENOTEMPTY 90 /* Directory not empty */ | #define ENOTEMPTY 90 /* Directory not empty */ | |||
#endif | #endif | |||
#ifndef ENAMETOOLONG | #ifndef ENAMETOOLONG | |||
#define ENAMETOOLONG 91 /* File or path name too long */ | #define ENAMETOOLONG 91 /* File or path name too long */ | |||
#endif | #endif | |||
#define ELOOP 92 /* Too many symbolic links */ | #define ELOOP 92 /* Too many symbolic links */ | |||
#define EOPNOTSUPP 95 /* Operation not supported on transport end | #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ | |||
point */ | #define EPFNOSUPPORT 96 /* Protocol family not supported */ | |||
#define EPFNOSUPPORT 96 /* Protocol family not supported */ | #define ECONNRESET 104 /* Connection reset by peer */ | |||
#define ECONNRESET 104 /* Connection reset by peer */ | #define ENOBUFS 105 /* No buffer space available */ | |||
#define ENOBUFS 105 /* No buffer space available */ | #define EAFNOSUPPORT 106 /* Address family not supported by protocol family | |||
#define EAFNOSUPPORT 106 /* Address family not supported by protocol | */ | |||
family */ | #define EPROTOTYPE 107 /* Protocol wrong type for socket */ | |||
#define EPROTOTYPE 107 /* Protocol wrong type for socket */ | #define ENOTSOCK 108 /* Socket operation on non-socket */ | |||
#define ENOTSOCK 108 /* Socket operation on non-socket */ | #define ENOPROTOOPT 109 /* Protocol not available */ | |||
#define ENOPROTOOPT 109 /* Protocol not available */ | #define ESHUTDOWN 110 /* Can't send after socket shutdown */ | |||
#define ESHUTDOWN 110 /* Can't send after socket shutdown */ | #define ECONNREFUSED 111 /* Connection refused */ | |||
#define ECONNREFUSED 111 /* Connection refused */ | #define EADDRINUSE 112 /* Address already in use */ | |||
#define EADDRINUSE 112 /* Address already in use */ | #define ECONNABORTED 113 /* Connection aborted */ | |||
#define ECONNABORTED 113 /* Connection aborted */ | #define ENETUNREACH 114 /* Network is unreachable */ | |||
#define ENETUNREACH 114 /* Network is unreachable */ | #define ENETDOWN 115 /* Network interface is not configured */ | |||
#define ENETDOWN 115 /* Network interface is not configured */ | ||||
#ifndef ETIMEDOUT | #ifndef ETIMEDOUT | |||
#define ETIMEDOUT 116 /* Connection timed out */ | #define ETIMEDOUT 116 /* Connection timed out */ | |||
#endif | #endif | |||
#define EHOSTDOWN 117 /* Host is down */ | #define EHOSTDOWN 117 /* Host is down */ | |||
#define EHOSTUNREACH 118 /* Host is unreachable */ | #define EHOSTUNREACH 118 /* Host is unreachable */ | |||
#define EINPROGRESS 119 /* Connection already in progress */ | #define EINPROGRESS 119 /* Connection already in progress */ | |||
#define EALREADY 120 /* Socket already connected */ | #define EALREADY 120 /* Socket already connected */ | |||
#define EDESTADDRREQ 121 /* Destination address required */ | #define EDESTADDRREQ 121 /* Destination address required */ | |||
#define EMSGSIZE 122 /* Message too long */ | #define EMSGSIZE 122 /* Message too long */ | |||
#define EPROTONOSUPPORT 123 /* Unknown protocol */ | #define EPROTONOSUPPORT 123 /* Unknown protocol */ | |||
#define ESOCKTNOSUPPORT 124 /* Socket type not supported */ | #define ESOCKTNOSUPPORT 124 /* Socket type not supported */ | |||
#define EADDRNOTAVAIL 125 /* Address not available */ | #define EADDRNOTAVAIL 125 /* Address not available */ | |||
#define ENETRESET 126 /* Connection aborted by network */ | #define ENETRESET 126 /* Connection aborted by network */ | |||
#define EISCONN 127 /* Socket is already connected */ | #define EISCONN 127 /* Socket is already connected */ | |||
#define ENOTCONN 128 /* Socket is not connected */ | #define ENOTCONN 128 /* Socket is not connected */ | |||
#define ETOOMANYREFS 129 /* Too many references: cannot splice */ | #define ETOOMANYREFS 129 /* Too many references: cannot splice */ | |||
#define EPROCLIM 130 /* Too many processes */ | #define EPROCLIM 130 /* Too many processes */ | |||
#define EUSERS 131 /* Too many users */ | #define EUSERS 131 /* Too many users */ | |||
#define EDQUOT 132 /* Disk quota exceeded */ | #define EDQUOT 132 /* Disk quota exceeded */ | |||
#define ESTALE 133 /* Unknown error */ | #define ESTALE 133 /* Unknown error */ | |||
#ifndef ENOTSUP | #ifndef ENOTSUP | |||
#define ENOTSUP 134 /* Not supported */ | #define ENOTSUP 134 /* Not supported */ | |||
#endif | #endif | |||
#define ENOMEDIUM 135 /* No medium (in tape drive) */ | #define ENOMEDIUM 135 /* No medium (in tape drive) */ | |||
#define ENOSHARE 136 /* No such host or network path */ | #define ENOSHARE 136 /* No such host or network path */ | |||
#define ECASECLASH 137 /* Filename exists with different case */ | #define ECASECLASH 137 /* Filename exists with different case */ | |||
#define EWOULDBLOCK EAGAIN /* Operation would block */ | #define EWOULDBLOCK EAGAIN /* Operation would block */ | |||
#define EOVERFLOW 139 /* Value too large for defined data type */ | #define EOVERFLOW 139 /* Value too large for defined data type */ | |||
#undef HOST_NOT_FOUND | #undef HOST_NOT_FOUND | |||
#define HOST_NOT_FOUND 1 | #define HOST_NOT_FOUND 1 | |||
#undef TRY_AGAIN | #undef TRY_AGAIN | |||
#define TRY_AGAIN 2 | #define TRY_AGAIN 2 | |||
#undef NO_RECOVERY | #undef NO_RECOVERY | |||
#define NO_RECOVERY 3 | #define NO_RECOVERY 3 | |||
#undef NO_ADDRESS | #undef NO_ADDRESS | |||
#define NO_ADDRESS 4 | #define NO_ADDRESS 4 | |||
#define PROT_READ 0x1 | #define PROT_READ 0x1 | |||
#define PROT_WRITE 0x2 | #define PROT_WRITE 0x2 | |||
#define MAP_SHARED 0x1 | #define MAP_SHARED 0x1 | |||
#define MAP_PRIVATE 0x2 /* unsupported */ | #define MAP_PRIVATE 0x2 /* unsupported */ | |||
#define MAP_FIXED 0x10 | #define MAP_FIXED 0x10 | |||
#define MAP_ANONYMOUS 0x20 /* unsupported */ | ||||
#define MAP_FAILED ((void *)-1) | #define MAP_FAILED ((void *)-1) | |||
struct statfs | #define MS_ASYNC 1 /* sync memory asynchronously */ | |||
{ | #define MS_INVALIDATE 2 /* invalidate the caches */ | |||
long f_type; /* type of filesystem (see below) */ | #define MS_SYNC 4 /* synchronous memory sync */ | |||
long f_bsize; /* optimal transfer block size */ | ||||
long f_blocks; /* total data blocks in file system */ | struct statfs | |||
long f_bfree; /* free blocks in fs */ | { | |||
long f_bavail; /* free blocks avail to non-superuser */ | long f_type; /* type of filesystem (see below) */ | |||
long f_files; /* total file nodes in file system */ | long f_bsize; /* optimal transfer block size */ | |||
long f_ffree; /* free file nodes in fs */ | long f_blocks; /* total data blocks in file system */ | |||
long f_fsid; /* file system id */ | long f_bfree; /* free blocks in fs */ | |||
long f_namelen; /* maximum length of filenames */ | long f_bavail; /* free blocks avail to non-superuser */ | |||
long f_spare[6]; /* spare for later */ | long f_files; /* total file nodes in file system */ | |||
}; | long f_ffree; /* free file nodes in fs */ | |||
long f_fsid; /* file system id */ | ||||
long f_namelen; /* maximum length of filenames */ | ||||
long f_spare[6]; /* spare for later */ | ||||
}; | ||||
extern const struct in6_addr in6addr_any; /* :: */ | extern const struct in6_addr in6addr_any; /* :: */ | |||
extern const struct in6_addr in6addr_loopback; /* ::1 */ | extern const struct in6_addr in6addr_loopback; /* ::1 */ | |||
/* Taken from the Wine project <http://www.winehq.org> | /* Taken from the Wine project <http://www.winehq.org> | |||
/wine/include/winternl.h */ | /wine/include/winternl.h */ | |||
enum SYSTEM_INFORMATION_CLASS | enum SYSTEM_INFORMATION_CLASS | |||
{ | { | |||
SystemBasicInformation = 0, | SystemBasicInformation = 0, | |||
Unknown1, | Unknown1, | |||
SystemPerformanceInformation = 2, | SystemPerformanceInformation = 2, | |||
SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */ | SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */ | |||
Unknown4, | Unknown4, | |||
SystemProcessInformation = 5, | SystemProcessInformation = 5, | |||
Unknown6, | Unknown6, | |||
Unknown7, | Unknown7, | |||
SystemProcessorPerformanceInformation = 8, | SystemProcessorPerformanceInformation = 8, | |||
Unknown9, | Unknown9, | |||
Unknown10, | Unknown10, | |||
SystemDriverInformation, | SystemDriverInformation, | |||
Unknown12, | Unknown12, | |||
Unknown13, | Unknown13, | |||
Unknown14, | Unknown14, | |||
Unknown15, | Unknown15, | |||
SystemHandleList, | SystemHandleList, | |||
Unknown17, | Unknown17, | |||
Unknown18, | Unknown18, | |||
Unknown19, | Unknown19, | |||
Unknown20, | Unknown20, | |||
SystemCacheInformation, | SystemCacheInformation, | |||
Unknown22, | Unknown22, | |||
SystemInterruptInformation = 23, | SystemInterruptInformation = 23, | |||
SystemExceptionInformation = 33, | SystemExceptionInformation = 33, | |||
SystemRegistryQuotaInformation = 37, | SystemRegistryQuotaInformation = 37, | |||
SystemLookasideInformation = 45 | SystemLookasideInformation = 45 | |||
}; | }; | |||
typedef struct | typedef struct | |||
{ | { | |||
LARGE_INTEGER IdleTime; | LARGE_INTEGER IdleTime; | |||
LARGE_INTEGER KernelTime; | LARGE_INTEGER KernelTime; | |||
LARGE_INTEGER UserTime; | LARGE_INTEGER UserTime; | |||
LARGE_INTEGER Reserved1[2]; | LARGE_INTEGER Reserved1[2]; | |||
ULONG Reserved2; | ULONG Reserved2; | |||
} SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION; | } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION; | |||
#define sleep(secs) (Sleep(secs * 1000)) | #define sleep(secs) (Sleep(secs * 1000)) | |||
/*********************** statfs *****************************/ | /*********************** statfs *****************************/ | |||
/* fake block size */ | /* fake block size */ | |||
#define FAKED_BLOCK_SIZE 512 | #define FAKED_BLOCK_SIZE 512 | |||
/* linux-compatible values for fs type */ | /* linux-compatible values for fs type */ | |||
#define MSDOS_SUPER_MAGIC 0x4d44 | #define MSDOS_SUPER_MAGIC 0x4d44 | |||
#define NTFS_SUPER_MAGIC 0x5346544E | #define NTFS_SUPER_MAGIC 0x5346544E | |||
/*********************** End of statfs ***********************/ | /*********************** End of statfs ***********************/ | |||
#define SHUT_RDWR SD_BOTH | #define SHUT_RDWR SD_BOTH | |||
/* Operations for flock() */ | /* Operations for flock() */ | |||
#define LOCK_SH 1 /* shared lock */ | #define LOCK_SH 1 /* shared lock */ | |||
#define LOCK_EX 2 /* exclusive lock */ | #define LOCK_EX 2 /* exclusive lock */ | |||
#define LOCK_NB 4 /* or'd with one of the above to prevent | #define LOCK_NB 4 /* or'd with one of the above to prevent | |||
* blocking */ | blocking */ | |||
#define LOCK_UN 8 /* remove lock */ | #define LOCK_UN 8 /* remove lock */ | |||
/* Not supported under MinGW */ | /* Not supported under MinGW */ | |||
#define S_IRGRP 0 | #define S_IRGRP 0 | |||
#define S_IWGRP 0 | #define S_IWGRP 0 | |||
#define S_IROTH 0 | #define S_IROTH 0 | |||
#define S_IXGRP 0 | #define S_IXGRP 0 | |||
#define S_IWOTH 0 | #define S_IWOTH 0 | |||
#define S_IXOTH 0 | #define S_IXOTH 0 | |||
#define S_ISUID 0 | #define S_ISUID 0 | |||
#define S_ISGID 0 | #define S_ISGID 0 | |||
skipping to change at line 336 | skipping to change at line 338 | |||
#define SHUT_WR SD_SEND | #define SHUT_WR SD_SEND | |||
#define SHUT_RD SD_RECEIVE | #define SHUT_RD SD_RECEIVE | |||
#define SHUT_RDWR SD_BOTH | #define SHUT_RDWR SD_BOTH | |||
#define SIGKILL 9 | #define SIGKILL 9 | |||
#define SIGTERM 15 | #define SIGTERM 15 | |||
#define SetErrnoFromWinError(e) _SetErrnoFromWinError(e, __FILE__, __LINE__ ) | #define SetErrnoFromWinError(e) _SetErrnoFromWinError(e, __FILE__, __LINE__ ) | |||
BOOL _plibc_CreateShortcut (const char *pszSrc, const char *pszDest); | BOOL _plibc_CreateShortcut(const char *pszSrc, const char *pszDest); | |||
BOOL _plibc_DereferenceShortcut (char *pszShortcut); | BOOL _plibc_DereferenceShortcut(char *pszShortcut); | |||
char *plibc_ChooseDir (char *pszTitle, unsigned long ulFlags); | char *plibc_ChooseDir(char *pszTitle, unsigned long ulFlags); | |||
char *plibc_ChooseFile (char *pszTitle, unsigned long ulFlags); | char *plibc_ChooseFile(char *pszTitle, unsigned long ulFlags); | |||
long QueryRegistry (HKEY hMainKey, const char *pszKey, const char *pszSub | ||||
Key, | long QueryRegistry(HKEY hMainKey, const char *pszKey, const char *pszSubKey | |||
char *pszBuffer, long *pdLength); | , | |||
char *pszBuffer, long *pdLength); | ||||
BOOL __win_IsHandleMarkedAsBlocking (int hHandle); | long QueryRegistryW(HKEY hMainKey, const wchar_t *pszKey, const wchar_t *ps | |||
void __win_SetHandleBlockingMode (int s, BOOL bBlocking); | zSubKey, | |||
void __win_DiscardHandleBlockingMode (int s); | wchar_t *pszBuffer, long *pdLength); | |||
int _win_isSocketValid (int s); | ||||
int plibc_conv_to_win_path (const char *pszUnix, char *pszWindows); | BOOL __win_IsHandleMarkedAsBlocking(int hHandle); | |||
unsigned plibc_get_handle_count (); | void __win_SetHandleBlockingMode(int s, BOOL bBlocking); | |||
void __win_DiscardHandleBlockingMode(int s); | ||||
typedef void (*TPanicProc) (int, char *); | int _win_isSocketValid(int s); | |||
void plibc_set_panic_proc (TPanicProc proc); | int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows); | |||
int plibc_conv_to_win_pathw(const wchar_t *pszUnix, wchar_t *pwszWindows); | ||||
int flock (int fd, int operation); | ||||
int fsync (int fildes); | int plibc_conv_to_win_pathwconv(const char *pszUnix, wchar_t *pwszWindows); | |||
int inet_pton (int af, const char *src, void *dst); | int plibc_conv_to_win_pathwconv_ex(const char *pszUnix, wchar_t *pszWindows | |||
int inet_pton4 (const char *src, u_char * dst, int pton); | , int derefLinks); | |||
unsigned plibc_get_handle_count(); | ||||
typedef void (*TPanicProc) (int, char *); | ||||
void plibc_set_panic_proc(TPanicProc proc); | ||||
int flock(int fd, int operation); | ||||
int fsync(int fildes); | ||||
int inet_pton(int af, const char *src, void *dst); | ||||
int inet_pton4(const char *src, u_char *dst, int pton); | ||||
#if USE_IPV6 | #if USE_IPV6 | |||
int inet_pton6 (const char *src, u_char * dst); | int inet_pton6(const char *src, u_char *dst); | |||
#endif | #endif | |||
int truncate (const char *fname, int distance); | int truncate(const char *fname, int distance); | |||
int statfs (const char *path, struct statfs *buf); | int statfs(const char *path, struct statfs *buf); | |||
const char *hstrerror (int err); | const char *hstrerror(int err); | |||
int mkstemp (char *tmplate); | int mkstemp(char *tmplate); | |||
char *strptime (const char *buf, const char *format, struct tm *tm); | char *strptime (const char *buf, const char *format, struct tm *tm); | |||
const char *inet_ntop (int af, const void *src, char *dst, size_t size); | const char *inet_ntop(int af, const void *src, char *dst, size_t size); | |||
struct tm *gmtime_r(const time_t *clock, struct tm *result); | ||||
int plibc_init (char *pszOrg, char *pszApp); | ||||
void plibc_shutdown (); | int plibc_init(char *pszOrg, char *pszApp); | |||
int plibc_initialized (); | void plibc_shutdown(); | |||
int plibc_conv_to_win_path_ex (const char *pszUnix, char *pszWindows, | int plibc_initialized(); | |||
int derefLinks); | ||||
void _SetErrnoFromWinError (long lWinError, char *pszCaller, int iLine); | void _SetErrnoFromWinError(long lWinError, char *pszCaller, int iLine); | |||
void SetErrnoFromWinsockError (long lWinError); | void SetErrnoFromWinsockError(long lWinError); | |||
void SetHErrnoFromWinError (long lWinError); | void SetHErrnoFromWinError(long lWinError); | |||
void SetErrnoFromHRESULT (HRESULT hRes); | void SetErrnoFromHRESULT(HRESULT hRes); | |||
int GetErrnoFromWinsockError (long lWinError); | int GetErrnoFromWinsockError(long lWinError); | |||
FILE *_win_fopen (const char *filename, const char *mode); | FILE *_win_fopen(const char *filename, const char *mode); | |||
DIR *_win_opendir (const char *dirname); | int _win_fclose(FILE *); | |||
int _win_open (const char *filename, int oflag, ...); | DIR *_win_opendir(const char *dirname); | |||
struct dirent *_win_readdir(DIR *dirp); | ||||
int _win_closedir(DIR *dirp); | ||||
int _win_open(const char *filename, int oflag, ...); | ||||
#ifdef ENABLE_NLS | #ifdef ENABLE_NLS | |||
char *_win_bindtextdomain (const char *domainname, const char *dirname); | char *_win_bindtextdomain(const char *domainname, const char *dirname); | |||
#endif | #endif | |||
int _win_chdir (const char *path); | int _win_chdir(const char *path); | |||
int _win_close (int fd); | int _win_close(int fd); | |||
int _win_creat (const char *path, mode_t mode); | int _win_creat(const char *path, mode_t mode); | |||
char *_win_ctime (const time_t * clock); | char *_win_ctime(const time_t *clock); | |||
char *_win_ctime_r (const time_t * clock, char *buf); | char *_win_ctime_r(const time_t *clock, char *buf); | |||
int _win_fstat (int handle, struct stat *buffer); | int _win_fstat(int handle, struct stat *buffer); | |||
int _win_ftruncate (int fildes, off_t length); | int _win_ftruncate(int fildes, off_t length); | |||
void _win_gettimeofday (struct timeval *tp, void *tzp); | void _win_gettimeofday(struct timeval *tp, void *tzp); | |||
int _win_kill (pid_t pid, int sig); | int _win_kill(pid_t pid, int sig); | |||
int _win_pipe (int *phandles); | int _win_pipe(int *phandles); | |||
int _win_rmdir (const char *path); | int _win_rmdir(const char *path); | |||
int _win_access (const char *path, int mode); | int _win_access( const char *path, int mode ); | |||
int _win_chmod (const char *filename, int pmode); | int _win_chmod(const char *filename, int pmode); | |||
char *realpath (const char *file_name, char *resolved_name); | char *realpath(const char *file_name, char *resolved_name); | |||
long _win_random (void); | long _win_random(void); | |||
void _win_srandom (unsigned int seed); | void _win_srandom(unsigned int seed); | |||
int _win_remove (const char *path); | int _win_remove(const char *path); | |||
int _win_rename (const char *oldname, const char *newname); | int _win_rename(const char *oldname, const char *newname); | |||
int _win_stat (const char *path, struct stat *buffer); | int _win_stat(const char *path, struct stat *buffer); | |||
int _win_stat64 (const char *path, struct stat64 *buffer); | int _win_stat64(const char *path, struct stat64 *buffer); | |||
long _win_sysconf (int name); | long _win_sysconf(int name); | |||
int _win_unlink (const char *filename); | int _win_unlink(const char *filename); | |||
int _win_write (int fildes, const void *buf, size_t nbyte); | int _win_write(int fildes, const void *buf, size_t nbyte); | |||
int _win_read (int fildes, void *buf, size_t nbyte); | int _win_read(int fildes, void *buf, size_t nbyte); | |||
size_t _win_fwrite (const void *buffer, size_t size, size_t count, | size_t _win_fwrite(const void *buffer, size_t size, size_t count, FILE *str | |||
FILE * stream); | eam); | |||
size_t _win_fread (void *buffer, size_t size, size_t count, FILE * stream | size_t _win_fread( void *buffer, size_t size, size_t count, FILE *stream ); | |||
); | int _win_symlink(const char *path1, const char *path2); | |||
int _win_symlink (const char *path1, const char *path2); | void *_win_mmap(void *start, size_t len, int access, int flags, int fd, | |||
void *_win_mmap (void *start, size_t len, int access, int flags, int fd, | unsigned long long offset); | |||
unsigned long long offset); | int _win_msync(void *start, size_t length, int flags); | |||
int _win_munmap (void *start, size_t length); | int _win_munmap(void *start, size_t length); | |||
int _win_lstat (const char *path, struct stat *buf); | int _win_lstat(const char *path, struct stat *buf); | |||
int _win_lstat64 (const char *path, struct stat64 *buf); | int _win_lstat64(const char *path, struct stat64 *buf); | |||
int _win_readlink (const char *path, char *buf, size_t bufsize); | int _win_readlink(const char *path, char *buf, size_t bufsize); | |||
int _win_accept (int s, struct sockaddr *addr, int *addrlen); | int _win_accept(int s, struct sockaddr *addr, int *addrlen); | |||
int _win_printf (const char *format, ...); | ||||
int _win_fprintf (FILE * f, const char *format, ...); | int _win_printf(const char *format,...); | |||
int _win_vprintf (const char *format, va_list ap); | int _win_wprintf(const wchar_t *format, ...); | |||
int _win_vfprintf (FILE * stream, const char *format, va_list arg_ptr); | ||||
int _win_vsprintf (char *dest, const char *format, va_list arg_ptr); | int _win_fprintf(FILE *f,const char *format,...); | |||
int _win_vsnprintf (char *str, size_t size, const char *format, | int _win_fwprintf(FILE *f,const wchar_t *format, ...); | |||
va_list arg_ptr); | ||||
int _win_snprintf (char *str, size_t size, const char *format, ...); | int _win_vprintf(const char *format, va_list ap); | |||
int _win_sprintf (char *dest, const char *format, ...); | int _win_vfwprintf(FILE *stream, const wchar_t *format, va_list arg_ptr); | |||
int _win_vsscanf (const char *str, const char *format, va_list arg_ptr); | ||||
int _win_sscanf (const char *str, const char *format, ...); | int _win_vfprintf(FILE *stream, const char *format, va_list arg_ptr); | |||
int _win_vfscanf (FILE * stream, const char *format, va_list arg_ptr); | int _win_vwprintf(const wchar_t *format, va_list ap); | |||
int _win_vscanf (const char *format, va_list arg_ptr); | ||||
int _win_scanf (const char *format, ...); | int _win_vsprintf(char *dest,const char *format, va_list arg_ptr); | |||
int _win_fscanf (FILE * stream, const char *format, ...); | int _win_vswprintf(wchar_t *dest, const wchar_t *format, va_list arg_ptr); | |||
pid_t _win_waitpid (pid_t pid, int *stat_loc, int options); | ||||
int _win_bind (int s, const struct sockaddr *name, int namelen); | int _win_vsnprintf(char* str, size_t size, const char *format, va_list arg_ | |||
int _win_connect (int s, const struct sockaddr *name, int namelen); | ptr); | |||
int _win_getpeername (int s, struct sockaddr *name, int *namelen); | int _win_vsnwprintf(wchar_t* wstr, size_t size, const wchar_t *format, va_l | |||
int _win_getsockname (int s, struct sockaddr *name, int *namelen); | ist arg_ptr); | |||
int _win_getsockopt (int s, int level, int optname, char *optval, | ||||
int *optlen); | int _win_snprintf(char *str,size_t size,const char *format,...); | |||
int _win_listen (int s, int backlog); | int _win_snwprintf(wchar_t *str, size_t size, const wchar_t *format, ...); | |||
int _win_recv (int s, char *buf, int len, int flags); | ||||
int _win_recvfrom (int s, void *buf, int len, int flags, | int _win_sprintf(char *dest,const char *format,...); | |||
struct sockaddr *from, int *fromlen); | int _win_swprintf(wchar_t *dest, const wchar_t *format, ...); | |||
int _win_select (int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds, | ||||
const struct timeval *tv); | int _win_vsscanf(const char* str, const char* format, va_list arg_ptr); | |||
int _win_send (int s, const char *buf, int len, int flags); | int _win_vswscanf(const wchar_t* wstr, const wchar_t* format, va_list arg_p | |||
int _win_sendto (int s, const char *buf, int len, int flags, | tr); | |||
const struct sockaddr *to, int tolen); | ||||
int _win_setsockopt (int s, int level, int optname, const void *optval, | int _win_sscanf(const char *str, const char *format, ...); | |||
int optlen); | int _win_swscanf(const wchar_t *wstr, const wchar_t *format, ...); | |||
int _win_shutdown (int s, int how); | ||||
int _win_socket (int af, int type, int protocol); | int _win_vfscanf(FILE *stream, const char *format, va_list arg_ptr); | |||
struct hostent *_win_gethostbyaddr (const char *addr, int len, int type); | int _win_vfwscanf(FILE *stream, const wchar_t *format, va_list arg_ptr); | |||
struct hostent *_win_gethostbyname (const char *name); | ||||
struct hostent *gethostbyname2 (const char *name, int af); | int _win_vscanf(const char *format, va_list arg_ptr); | |||
char *_win_strerror (int errnum); | int _win_vwscanf(const wchar_t *format, va_list arg_ptr); | |||
int IsWinNT (); | ||||
char *index (const char *s, int c); | int _win_scanf(const char *format, ...); | |||
int _win_wscanf(const wchar_t *format, ...); | ||||
int _win_fscanf(FILE *stream, const char *format, ...); | ||||
int _win_fwscanf(FILE *stream, const wchar_t *format, ...); | ||||
pid_t _win_waitpid(pid_t pid, int *stat_loc, int options); | ||||
int _win_bind(int s, const struct sockaddr *name, int namelen); | ||||
int _win_connect(int s,const struct sockaddr *name, int namelen); | ||||
int _win_getpeername(int s, struct sockaddr *name, | ||||
int *namelen); | ||||
int _win_getsockname(int s, struct sockaddr *name, | ||||
int *namelen); | ||||
int _win_getsockopt(int s, int level, int optname, char *optval, | ||||
int *optlen); | ||||
int _win_listen(int s, int backlog); | ||||
int _win_recv(int s, char *buf, int len, int flags); | ||||
int _win_recvfrom(int s, void *buf, int len, int flags, | ||||
struct sockaddr *from, int *fromlen); | ||||
int _win_select(int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds, | ||||
const struct timeval *tv); | ||||
int _win_send(int s, const char *buf, int len, int flags); | ||||
int _win_sendto(int s, const char *buf, int len, int flags, | ||||
const struct sockaddr *to, int tolen); | ||||
int _win_setsockopt(int s, int level, int optname, const void *optval, | ||||
int optlen); | ||||
int _win_shutdown(int s, int how); | ||||
int _win_socket(int af, int type, int protocol); | ||||
struct hostent *_win_gethostbyaddr(const char *addr, int len, int type); | ||||
struct hostent *_win_gethostbyname(const char *name); | ||||
struct hostent *gethostbyname2(const char *name, int af); | ||||
char *_win_strerror(int errnum); | ||||
int IsWinNT(); | ||||
char *index(const char *s, int c); | ||||
#if !HAVE_STRNDUP | #if !HAVE_STRNDUP | |||
char *strndup (const char *s, size_t n); | char *strndup (const char *s, size_t n); | |||
#endif | #endif | |||
#if !HAVE_STRNLEN | #if !HAVE_STRNLEN | |||
size_t strnlen (const char *str, size_t maxlen); | size_t strnlen (const char *str, size_t maxlen); | |||
#endif | #endif | |||
char *stpcpy (char *dest, const char *src); | char *stpcpy(char *dest, const char *src); | |||
char *strcasestr (const char *haystack_start, const char *needle_start); | char *strcasestr(const char *haystack_start, const char *needle_start); | |||
#ifndef __MINGW64__ | ||||
#define strcasecmp(a, b) stricmp(a, b) | #define strcasecmp(a, b) stricmp(a, b) | |||
#define wcscasecmp(a, b) wcsicmp(a, b) | ||||
#define strncasecmp(a, b, c) strnicmp(a, b, c) | #define strncasecmp(a, b, c) strnicmp(a, b, c) | |||
#define wcsncasecmp(a, b, c) wcsnicmp(a, b, c) | ||||
#endif /* WINDOWS */ | #endif | |||
#endif /* WINDOWS */ | ||||
#ifndef WINDOWS | #ifndef WINDOWS | |||
#define DIR_SEPARATOR '/' | #define DIR_SEPARATOR '/' | |||
#define DIR_SEPARATOR_STR "/" | #define DIR_SEPARATOR_STR "/" | |||
#define PATH_SEPARATOR ':' | #define PATH_SEPARATOR ':' | |||
#define PATH_SEPARATOR_STR ":" | #define PATH_SEPARATOR_STR ":" | |||
#define NEWLINE "\n" | #define NEWLINE "\n" | |||
#ifdef ENABLE_NLS | #ifdef ENABLE_NLS | |||
#define BINDTEXTDOMAIN(d, n) bindtextdomain(d, n) | #define BINDTEXTDOMAIN(d, n) bindtextdomain(d, n) | |||
#endif | #endif | |||
#define CREAT(p, m) creat(p, m) | #define CREAT(p, m) creat(p, m) | |||
#define PLIBC_CTIME(c) ctime(c) | #define PLIBC_CTIME(c) ctime(c) | |||
#define CTIME_R(c, b) ctime_r(c, b) | #define CTIME_R(c, b) ctime_r(c, b) | |||
#undef FOPEN | #undef FOPEN | |||
#define FOPEN(f, m) fopen(f, m) | #define FOPEN(f, m) fopen(f, m) | |||
#define FTRUNCATE(f, l) ftruncate(f, l) | #define FCLOSE(f) fclose(f) | |||
#define OPENDIR(d) opendir(d) | #define FTRUNCATE(f, l) ftruncate(f, l) | |||
#define OPEN open | #define OPENDIR(d) opendir(d) | |||
#define CHDIR(d) chdir(d) | #define CLOSEDIR(d) closedir(d) | |||
#define CLOSE(f) close(f) | #define READDIR(d) readdir(d) | |||
#define LSEEK(f, o, w) lseek(f, o, w) | #define OPEN open | |||
#define RMDIR(f) rmdir(f) | #define CHDIR(d) chdir(d) | |||
#define ACCESS(p, m) access(p, m) | #define CLOSE(f) close(f) | |||
#define CHMOD(f, p) chmod(f, p) | #define LSEEK(f, o, w) lseek(f, o, w) | |||
#define FSTAT(h, b) fstat(h, b) | #define RMDIR(f) rmdir(f) | |||
#define PLIBC_KILL(p, s) kill(p, s) | #define ACCESS(p, m) access(p, m) | |||
#define PIPE(h) pipe(h) | #define CHMOD(f, p) chmod(f, p) | |||
#define REMOVE(p) remove(p) | #define FSTAT(h, b) fstat(h, b) | |||
#define RENAME(o, n) rename(o, n) | #define PLIBC_KILL(p, s) kill(p, s) | |||
#define STAT(p, b) stat(p, b) | #define PIPE(h) pipe(h) | |||
#define STAT64(p, b) stat64(p, b) | #define REMOVE(p) remove(p) | |||
#define SYSCONF(n) sysconf(n) | #define RENAME(o, n) rename(o, n) | |||
#define UNLINK(f) unlink(f) | #define STAT(p, b) stat(p, b) | |||
#define WRITE(f, b, n) write(f, b, n) | #define STAT64(p, b) stat64(p, b) | |||
#define READ(f, b, n) read(f, b, n) | #define SYSCONF(n) sysconf(n) | |||
#define GN_FREAD(b, s, c, f) fread(b, s, c, f) | #define UNLINK(f) unlink(f) | |||
#define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f) | #define WRITE(f, b, n) write(f, b, n) | |||
#define SYMLINK(a, b) symlink(a, b) | #define READ(f, b, n) read(f, b, n) | |||
#define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o) | #define GN_FREAD(b, s, c, f) fread(b, s, c, f) | |||
#define MUNMAP(s, l) munmap(s, l) | #define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f) | |||
#define STRERROR(i) strerror(i) | #define SYMLINK(a, b) symlink(a, b) | |||
#define RANDOM() random() | #define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o) | |||
#define SRANDOM(s) srandom(s) | #define MKFIFO(p, m) mkfifo(p, m) | |||
#define READLINK(p, b, s) readlink(p, b, s) | #define MSYNC(s, l, f) msync(s, l, f) | |||
#define LSTAT(p, b) lstat(p, b) | #define MUNMAP(s, l) munmap(s, l) | |||
#define LSTAT64(p, b) lstat64(p, b) | #define STRERROR(i) strerror(i) | |||
#define PRINTF printf | #define RANDOM() random() | |||
#define FPRINTF fprintf | #define SRANDOM(s) srandom(s) | |||
#define VPRINTF(f, a) vprintf(f, a) | #define READLINK(p, b, s) readlink(p, b, s) | |||
#define VFPRINTF(s, f, a) vfprintf(s, f, a) | #define LSTAT(p, b) lstat(p, b) | |||
#define VSPRINTF(d, f, a) vsprintf(d, f, a) | #define LSTAT64(p, b) lstat64(p, b) | |||
#define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a) | #define PRINTF printf | |||
#define _REAL_SNPRINTF snprintf | #define FPRINTF fprintf | |||
#define SPRINTF sprintf | #define VPRINTF(f, a) vprintf(f, a) | |||
#define VSSCANF(s, f, a) vsscanf(s, f, a) | #define VFPRINTF(s, f, a) vfprintf(s, f, a) | |||
#define SSCANF sscanf | #define VSPRINTF(d, f, a) vsprintf(d, f, a) | |||
#define VFSCANF(s, f, a) vfscanf(s, f, a) | #define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a) | |||
#define VSCANF(f, a) vscanf(f, a) | #define _REAL_SNPRINTF snprintf | |||
#define SCANF scanf | #define SPRINTF sprintf | |||
#define FSCANF fscanf | #define VSSCANF(s, f, a) vsscanf(s, f, a) | |||
#define WAITPID(p, s, o) waitpid(p, s, o) | #define SSCANF sscanf | |||
#define ACCEPT(s, a, l) accept(s, a, l) | #define VFSCANF(s, f, a) vfscanf(s, f, a) | |||
#define BIND(s, n, l) bind(s, n, l) | #define VSCANF(f, a) vscanf(f, a) | |||
#define CONNECT(s, n, l) connect(s, n, l) | #define SCANF scanf | |||
#define GETPEERNAME(s, n, l) getpeername(s, n, l) | #define FSCANF fscanf | |||
#define GETSOCKNAME(s, n, l) getsockname(s, n, l) | #define WAITPID(p, s, o) waitpid(p, s, o) | |||
#define GETSOCKOPT(s, l, o, v, p) getsockopt(s, l, o, v, p) | #define ACCEPT(s, a, l) accept(s, a, l) | |||
#define LISTEN(s, b) listen(s, b) | #define BIND(s, n, l) bind(s, n, l) | |||
#define RECV(s, b, l, f) recv(s, b, l, f) | #define CONNECT(s, n, l) connect(s, n, l) | |||
#define RECVFROM(s, b, l, f, r, o) recvfrom(s, b, l, f, r, o) | #define GETPEERNAME(s, n, l) getpeername(s, n, l) | |||
#define SELECT(n, r, w, e, t) select(n, r, w, e, t) | #define GETSOCKNAME(s, n, l) getsockname(s, n, l) | |||
#define SEND(s, b, l, f) send(s, b, l, f) | #define GETSOCKOPT(s, l, o, v, p) getsockopt(s, l, o, v, p) | |||
#define SENDTO(s, b, l, f, o, n) sendto(s, b, l, f, o, n) | #define LISTEN(s, b) listen(s, b) | |||
#define SETSOCKOPT(s, l, o, v, n) setsockopt(s, l, o, v, n) | #define RECV(s, b, l, f) recv(s, b, l, f) | |||
#define SHUTDOWN(s, h) shutdown(s, h) | #define RECVFROM(s, b, l, f, r, o) recvfrom(s, b, l, f, r, o) | |||
#define SOCKET(a, t, p) socket(a, t, p) | #define SELECT(n, r, w, e, t) select(n, r, w, e, t) | |||
#define GETHOSTBYADDR(a, l, t) gethostbyname(a, l, t) | #define SEND(s, b, l, f) send(s, b, l, f) | |||
#define GETHOSTBYNAME(n) gethostbyname(n) | #define SENDTO(s, b, l, f, o, n) sendto(s, b, l, f, o, n) | |||
#define GETTIMEOFDAY(t, n) gettimeofday(t, n) | #define SETSOCKOPT(s, l, o, v, n) setsockopt(s, l, o, v, n) | |||
#define INSQUE(e, p) insque(e, p) | #define SHUTDOWN(s, h) shutdown(s, h) | |||
#define REMQUE(e) remque(e) | #define SOCKET(a, t, p) socket(a, t, p) | |||
#define HSEARCH(i, a) hsearch(i, a) | #define GETHOSTBYADDR(a, l, t) gethostbyname(a, l, t) | |||
#define HCREATE(n) hcreate(n) | #define GETHOSTBYNAME(n) gethostbyname(n) | |||
#define HDESTROY() hdestroy() | #define GETTIMEOFDAY(t, n) gettimeofday(t, n) | |||
#define HSEARCH_R(i, a, r, h) hsearch_r(i, a, r, h) | #define INSQUE(e, p) insque(e, p) | |||
#define HCREATE_R(n, h) hcreate_r(n, h) | #define REMQUE(e) remque(e) | |||
#define HDESTROY_R(h) hdestroy_r(h) | #define HSEARCH(i, a) hsearch(i, a) | |||
#define TSEARCH(k, r, c) tsearch(k, r, c) | #define HCREATE(n) hcreate(n) | |||
#define TFIND(k, r, c) tfind(k, r, c) | #define HDESTROY() hdestroy() | |||
#define TDELETE(k, r, c) tdelete(k, r, c) | #define HSEARCH_R(i, a, r, h) hsearch_r(i, a, r, h) | |||
#define TWALK(r, a) twalk(r, a) | #define HCREATE_R(n, h) hcreate_r(n, h) | |||
#define TDESTROY(r, f) tdestroy(r, f) | #define HDESTROY_R(h) hdestroy_r(h) | |||
#define LFIND(k, b, n, s, c) lfind(k, b, n, s, c) | #define TSEARCH(k, r, c) tsearch(k, r, c) | |||
#define LSEARCH(k, b, n, s, c) lsearch(k, b, n, s, c) | #define TFIND(k, r, c) tfind(k, r, c) | |||
#define TDELETE(k, r, c) tdelete(k, r, c) | ||||
#define TWALK(r, a) twalk(r, a) | ||||
#define TDESTROY(r, f) tdestroy(r, f) | ||||
#define LFIND(k, b, n, s, c) lfind(k, b, n, s, c) | ||||
#define LSEARCH(k, b, n, s, c) lsearch(k, b, n, s, c) | ||||
#else | #else | |||
#define DIR_SEPARATOR '\\' | #define DIR_SEPARATOR '\\' | |||
#define DIR_SEPARATOR_STR "\\" | #define DIR_SEPARATOR_STR "\\" | |||
#define PATH_SEPARATOR ';' | #define PATH_SEPARATOR ';' | |||
#define PATH_SEPARATOR_STR ";" | #define PATH_SEPARATOR_STR ";" | |||
#define NEWLINE "\r\n" | #define NEWLINE "\r\n" | |||
#ifdef ENABLE_NLS | #ifdef ENABLE_NLS | |||
#define BINDTEXTDOMAIN(d, n) _win_bindtextdomain(d, n) | #define BINDTEXTDOMAIN(d, n) _win_bindtextdomain(d, n) | |||
#endif | #endif | |||
#define CREAT(p, m) _win_creat(p, m) | #define CREAT(p, m) _win_creat(p, m) | |||
#define PLIBC_CTIME(c) _win_ctime(c) | #define PLIBC_CTIME(c) _win_ctime(c) | |||
#define CTIME_R(c, b) _win_ctime_r(c, b) | #define CTIME_R(c, b) _win_ctime_r(c, b) | |||
#define FOPEN(f, m) _win_fopen(f, m) | #define FOPEN(f, m) _win_fopen(f, m) | |||
#define FTRUNCATE(f, l) _win_ftruncate(f, l) | #define FCLOSE(f) _win_fclose(f) | |||
#define OPENDIR(d) _win_opendir(d) | #define FTRUNCATE(f, l) _win_ftruncate(f, l) | |||
#define OPEN _win_open | #define OPENDIR(d) _win_opendir(d) | |||
#define CHDIR(d) _win_chdir(d) | #define CLOSEDIR(d) _win_closedir(d) | |||
#define CLOSE(f) _win_close(f) | #define READDIR(d) _win_readdir(d) | |||
#define PLIBC_KILL(p, s) _win_kill(p, s) | #define OPEN _win_open | |||
#define LSEEK(f, o, w) _win_lseek(f, o, w) | #define CHDIR(d) _win_chdir(d) | |||
#define FSTAT(h, b) _win_fstat(h, b) | #define CLOSE(f) _win_close(f) | |||
#define RMDIR(f) _win_rmdir(f) | #define PLIBC_KILL(p, s) _win_kill(p, s) | |||
#define ACCESS(p, m) _win_access(p, m) | #define LSEEK(f, o, w) _win_lseek(f, o, w) | |||
#define CHMOD(f, p) _win_chmod(f, p) | #define FSTAT(h, b) _win_fstat(h, b) | |||
#define PIPE(h) _win_pipe(h) | #define RMDIR(f) _win_rmdir(f) | |||
#define RANDOM() _win_random() | #define ACCESS(p, m) _win_access(p, m) | |||
#define SRANDOM(s) _win_srandom(s) | #define CHMOD(f, p) _win_chmod(f, p) | |||
#define REMOVE(p) _win_remove(p) | #define PIPE(h) _win_pipe(h) | |||
#define RENAME(o, n) _win_rename(o, n) | #define RANDOM() _win_random() | |||
#define STAT(p, b) _win_stat(p, b) | #define SRANDOM(s) _win_srandom(s) | |||
#define STAT64(p, b) _win_stat64(p, b) | #define REMOVE(p) _win_remove(p) | |||
#define SYSCONF(n) _win_sysconf(n) | #define RENAME(o, n) _win_rename(o, n) | |||
#define UNLINK(f) _win_unlink(f) | #define STAT(p, b) _win_stat(p, b) | |||
#define WRITE(f, b, n) _win_write(f, b, n) | #define STAT64(p, b) _win_stat64(p, b) | |||
#define READ(f, b, n) _win_read(f, b, n) | #define SYSCONF(n) _win_sysconf(n) | |||
#define GN_FREAD(b, s, c, f) _win_fread(b, s, c, f) | #define UNLINK(f) _win_unlink(f) | |||
#define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f) | #define WRITE(f, b, n) _win_write(f, b, n) | |||
#define SYMLINK(a, b) _win_symlink(a, b) | #define READ(f, b, n) _win_read(f, b, n) | |||
#define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o) | #define GN_FREAD(b, s, c, f) _win_fread(b, s, c, f) | |||
#define MUNMAP(s, l) _win_munmap(s, l) | #define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f) | |||
#define STRERROR(i) _win_strerror(i) | #define SYMLINK(a, b) _win_symlink(a, b) | |||
#define READLINK(p, b, s) _win_readlink(p, b, s) | #define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o) | |||
#define LSTAT(p, b) _win_lstat(p, b) | #define MKFIFO(p, m) _win_mkfifo(p, m) | |||
#define LSTAT64(p, b) _win_lstat64(p, b) | #define MSYNC(s, l, f) _win_msync(s, l, f) | |||
#define PRINTF(f, ...) _win_printf(f , __VA_ARGS__) | #define MUNMAP(s, l) _win_munmap(s, l) | |||
#define FPRINTF(fil, fmt, ...) _win_fprintf(fil, fmt, __VA_ARGS__) | #define STRERROR(i) _win_strerror(i) | |||
#define VPRINTF(f, a) _win_vprintf(f, a) | #define READLINK(p, b, s) _win_readlink(p, b, s) | |||
#define VFPRINTF(s, f, a) _win_vfprintf(s, f, a) | #define LSTAT(p, b) _win_lstat(p, b) | |||
#define VSPRINTF(d, f, a) _win_vsprintf(d, f, a) | #define LSTAT64(p, b) _win_lstat64(p, b) | |||
#define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a) | #define PRINTF(f, ...) _win_printf(f , __VA_ARGS__) | |||
#define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt, _ | #define FPRINTF(fil, fmt, ...) _win_fprintf(fil, fmt, __VA_ARGS__) | |||
_VA_ARGS__) | #define VPRINTF(f, a) _win_vprintf(f, a) | |||
#define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__) | #define VFPRINTF(s, f, a) _win_vfprintf(s, f, a) | |||
#define VSSCANF(s, f, a) _win_vsscanf(s, f, a) | #define VSPRINTF(d, f, a) _win_vsprintf(d, f, a) | |||
#define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__) | #define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a) | |||
#define VFSCANF(s, f, a) _win_vfscanf(s, f, a) | #define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt, | |||
#define VSCANF(f, a) _win_vscanf(f, a) | __VA_ARGS__) | |||
#define SCANF(f, ...) _win_scanf(f, __VA_ARGS__) | #define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__) | |||
#define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__) | #define VSSCANF(s, f, a) _win_vsscanf(s, f, a) | |||
#define WAITPID(p, s, o) _win_waitpid(p, s, o) | #define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__) | |||
#define ACCEPT(s, a, l) _win_accept(s, a, l) | #define VFSCANF(s, f, a) _win_vfscanf(s, f, a) | |||
#define BIND(s, n, l) _win_bind(s, n, l) | #define VSCANF(f, a) _win_vscanf(f, a) | |||
#define CONNECT(s, n, l) _win_connect(s, n, l) | #define SCANF(f, ...) _win_scanf(f, __VA_ARGS__) | |||
#define GETPEERNAME(s, n, l) _win_getpeername(s, n, l) | #define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__) | |||
#define GETSOCKNAME(s, n, l) _win_getsockname(s, n, l) | #define WAITPID(p, s, o) _win_waitpid(p, s, o) | |||
#define GETSOCKOPT(s, l, o, v, p) _win_getsockopt(s, l, o, v, p) | #define ACCEPT(s, a, l) _win_accept(s, a, l) | |||
#define LISTEN(s, b) _win_listen(s, b) | #define BIND(s, n, l) _win_bind(s, n, l) | |||
#define RECV(s, b, l, f) _win_recv(s, b, l, f) | #define CONNECT(s, n, l) _win_connect(s, n, l) | |||
#define RECVFROM(s, b, l, f, r, o) _win_recvfrom(s, b, l, f, r, o) | #define GETPEERNAME(s, n, l) _win_getpeername(s, n, l) | |||
#define SELECT(n, r, w, e, t) _win_select(n, r, w, e, t) | #define GETSOCKNAME(s, n, l) _win_getsockname(s, n, l) | |||
#define SEND(s, b, l, f) _win_send(s, b, l, f) | #define GETSOCKOPT(s, l, o, v, p) _win_getsockopt(s, l, o, v, p) | |||
#define SENDTO(s, b, l, f, o, n) _win_sendto(s, b, l, f, o, n) | #define LISTEN(s, b) _win_listen(s, b) | |||
#define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n) | #define RECV(s, b, l, f) _win_recv(s, b, l, f) | |||
#define SHUTDOWN(s, h) _win_shutdown(s, h) | #define RECVFROM(s, b, l, f, r, o) _win_recvfrom(s, b, l, f, r, o) | |||
#define SOCKET(a, t, p) _win_socket(a, t, p) | #define SELECT(n, r, w, e, t) _win_select(n, r, w, e, t) | |||
#define GETHOSTBYADDR(a, l, t) _win_gethostbyname(a, l, t) | #define SEND(s, b, l, f) _win_send(s, b, l, f) | |||
#define GETHOSTBYNAME(n) _win_gethostbyname(n) | #define SENDTO(s, b, l, f, o, n) _win_sendto(s, b, l, f, o, n) | |||
#define GETTIMEOFDAY(t, n) _win_gettimeofday(t, n) | #define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n) | |||
#define INSQUE(e, p) _win_insque(e, p) | #define SHUTDOWN(s, h) _win_shutdown(s, h) | |||
#define REMQUE(e) _win_remque(e) | #define SOCKET(a, t, p) _win_socket(a, t, p) | |||
#define HSEARCH(i, a) _win_hsearch(i, a) | #define GETHOSTBYADDR(a, l, t) _win_gethostbyname(a, l, t) | |||
#define HCREATE(n) _win_hcreate(n) | #define GETHOSTBYNAME(n) _win_gethostbyname(n) | |||
#define HDESTROY() _win_hdestroy() | #define GETTIMEOFDAY(t, n) _win_gettimeofday(t, n) | |||
#define HSEARCH_R(i, a, r, h) _win_hsearch_r(i, a, r, h) | #define INSQUE(e, p) _win_insque(e, p) | |||
#define HCREATE_R(n, h) _win_hcreate_r(n, h) | #define REMQUE(e) _win_remque(e) | |||
#define HDESTROY_R(h) _win_hdestroy_r(h) | #define HSEARCH(i, a) _win_hsearch(i, a) | |||
#define TSEARCH(k, r, c) _win_tsearch(k, r, c) | #define HCREATE(n) _win_hcreate(n) | |||
#define TFIND(k, r, c) _win_tfind(k, r, c) | #define HDESTROY() _win_hdestroy() | |||
#define TDELETE(k, r, c) _win_tdelete(k, r, c) | #define HSEARCH_R(i, a, r, h) _win_hsearch_r(i, a, r, h) | |||
#define TWALK(r, a) _win_twalk(r, a) | #define HCREATE_R(n, h) _win_hcreate_r(n, h) | |||
#define TDESTROY(r, f) _win_tdestroy(r, f) | #define HDESTROY_R(h) _win_hdestroy_r(h) | |||
#define LFIND(k, b, n, s, c) _win_lfind(k, b, n, s, c) | #define TSEARCH(k, r, c) _win_tsearch(k, r, c) | |||
#define LSEARCH(k, b, n, s, c) _win_lsearch(k, b, n, s, c) | #define TFIND(k, r, c) _win_tfind(k, r, c) | |||
#define TDELETE(k, r, c) _win_tdelete(k, r, c) | ||||
#define TWALK(r, a) _win_twalk(r, a) | ||||
#define TDESTROY(r, f) _win_tdestroy(r, f) | ||||
#define LFIND(k, b, n, s, c) _win_lfind(k, b, n, s, c) | ||||
#define LSEARCH(k, b, n, s, c) _win_lsearch(k, b, n, s, c) | ||||
#endif | #endif | |||
/* search.h */ | /* search.h */ | |||
/* Prototype structure for a linked-list data structure. | /* Prototype structure for a linked-list data structure. | |||
This is the type used by the `insque' and `remque' functions. */ | This is the type used by the `insque' and `remque' functions. */ | |||
struct PLIBC_SEARCH_QELEM | struct PLIBC_SEARCH_QELEM | |||
{ | { | |||
struct qelem *q_forw; | struct qelem *q_forw; | |||
struct qelem *q_back; | struct qelem *q_back; | |||
char q_data[1]; | char q_data[1]; | |||
}; | }; | |||
/* Insert ELEM into a doubly-linked list, after PREV. */ | /* Insert ELEM into a doubly-linked list, after PREV. */ | |||
void _win_insque (void *__elem, void *__prev); | void _win_insque (void *__elem, void *__prev); | |||
/* Unlink ELEM from the doubly-linked list that it is in. */ | /* Unlink ELEM from the doubly-linked list that it is in. */ | |||
void _win_remque (void *__elem); | void _win_remque (void *__elem); | |||
/* For use with hsearch(3). */ | /* For use with hsearch(3). */ | |||
typedef int (*PLIBC_SEARCH__compar_fn_t) (__const void *, __const void *) ; | typedef int (*PLIBC_SEARCH__compar_fn_t) (__const void *, __const void *); | |||
typedef PLIBC_SEARCH__compar_fn_t _win_comparison_fn_t; | typedef PLIBC_SEARCH__compar_fn_t _win_comparison_fn_t; | |||
/* Action which shall be performed in the call the hsearch. */ | /* Action which shall be performed in the call the hsearch. */ | |||
typedef enum | typedef enum | |||
{ | { | |||
PLIBC_SEARCH_FIND, | PLIBC_SEARCH_FIND, | |||
PLIBC_SEARCH_ENTER | PLIBC_SEARCH_ENTER | |||
} | } | |||
PLIBC_SEARCH_ACTION; | PLIBC_SEARCH_ACTION; | |||
typedef struct PLIBC_SEARCH_entry | typedef struct PLIBC_SEARCH_entry | |||
{ | { | |||
char *key; | char *key; | |||
void *data; | void *data; | |||
} | } | |||
PLIBC_SEARCH_ENTRY; | PLIBC_SEARCH_ENTRY; | |||
/* The reentrant version has no static variables to maintain the state. | /* The reentrant version has no static variables to maintain the state. | |||
Instead the interface of all functions is extended to take an argument | Instead the interface of all functions is extended to take an argument | |||
which describes the current status. */ | which describes the current status. */ | |||
typedef struct _PLIBC_SEARCH_ENTRY | typedef struct _PLIBC_SEARCH_ENTRY | |||
{ | { | |||
unsigned int used; | unsigned int used; | |||
PLIBC_SEARCH_ENTRY entry; | PLIBC_SEARCH_ENTRY entry; | |||
} | } | |||
_PLIBC_SEARCH_ENTRY; | _PLIBC_SEARCH_ENTRY; | |||
/* Family of hash table handling functions. The functions also | /* Family of hash table handling functions. The functions also | |||
have reentrant counterparts ending with _r. The non-reentrant | have reentrant counterparts ending with _r. The non-reentrant | |||
functions all work on a signle internal hashing table. */ | functions all work on a signle internal hashing table. */ | |||
/* Search for entry matching ITEM.key in internal hash table. If | /* Search for entry matching ITEM.key in internal hash table. If | |||
ACTION is `FIND' return found entry or signal error by returning | ACTION is `FIND' return found entry or signal error by returning | |||
NULL. If ACTION is `ENTER' replace existing data (if any) with | NULL. If ACTION is `ENTER' replace existing data (if any) with | |||
ITEM.data. */ | ITEM.data. */ | |||
PLIBC_SEARCH_ENTRY *_win_hsearch (PLIBC_SEARCH_ENTRY __item, | PLIBC_SEARCH_ENTRY *_win_hsearch (PLIBC_SEARCH_ENTRY __item, PLIBC_SEARCH_A | |||
PLIBC_SEARCH_ACTION __action); | CTION __action); | |||
/* Create a new hashing table which will at most contain NEL elements. */ | /* Create a new hashing table which will at most contain NEL elements. */ | |||
int _win_hcreate (size_t __nel); | int _win_hcreate (size_t __nel); | |||
/* Destroy current internal hashing table. */ | /* Destroy current internal hashing table. */ | |||
void _win_hdestroy (void); | void _win_hdestroy (void); | |||
/* Data type for reentrant functions. */ | /* Data type for reentrant functions. */ | |||
struct PLIBC_SEARCH_hsearch_data | struct PLIBC_SEARCH_hsearch_data | |||
{ | { | |||
struct _PLIBC_SEARCH_ENTRY *table; | struct _PLIBC_SEARCH_ENTRY *table; | |||
unsigned int size; | unsigned int size; | |||
unsigned int filled; | unsigned int filled; | |||
}; | }; | |||
/* Reentrant versions which can handle multiple hashing tables at the | /* Reentrant versions which can handle multiple hashing tables at the | |||
same time. */ | same time. */ | |||
int _win_hsearch_r (PLIBC_SEARCH_ENTRY __item, PLIBC_SEARCH_ACTION __acti | int _win_hsearch_r (PLIBC_SEARCH_ENTRY __item, PLIBC_SEARCH_ACTION __action | |||
on, | , PLIBC_SEARCH_ENTRY **__retval, | |||
PLIBC_SEARCH_ENTRY ** __retval, | struct PLIBC_SEARCH_hsearch_data *__htab); | |||
struct PLIBC_SEARCH_hsearch_data *__htab); | int _win_hcreate_r (size_t __nel, struct PLIBC_SEARCH_hsearch_data *__htab) | |||
int _win_hcreate_r (size_t __nel, struct PLIBC_SEARCH_hsearch_data *__hta | ; | |||
b); | void _win_hdestroy_r (struct PLIBC_SEARCH_hsearch_data *__htab); | |||
void _win_hdestroy_r (struct PLIBC_SEARCH_hsearch_data *__htab); | ||||
/* The tsearch routines are very interesting. They make many | /* The tsearch routines are very interesting. They make many | |||
assumptions about the compiler. It assumes that the first field | assumptions about the compiler. It assumes that the first field | |||
in node must be the "key" field, which points to the datum. | in node must be the "key" field, which points to the datum. | |||
Everything depends on that. */ | Everything depends on that. */ | |||
/* For tsearch */ | /* For tsearch */ | |||
typedef enum | typedef enum | |||
{ | { | |||
PLIBC_SEARCH_preorder, | PLIBC_SEARCH_preorder, | |||
PLIBC_SEARCH_postorder, | PLIBC_SEARCH_postorder, | |||
PLIBC_SEARCH_endorder, | PLIBC_SEARCH_endorder, | |||
PLIBC_SEARCH_leaf | PLIBC_SEARCH_leaf | |||
} | } | |||
PLIBC_SEARCH_VISIT; | PLIBC_SEARCH_VISIT; | |||
/* Search for an entry matching the given KEY in the tree pointed to | /* Search for an entry matching the given KEY in the tree pointed to | |||
by *ROOTP and insert a new element if not found. */ | by *ROOTP and insert a new element if not found. */ | |||
void *_win_tsearch (__const void *__key, void **__rootp, | void *_win_tsearch (__const void *__key, void **__rootp, | |||
PLIBC_SEARCH__compar_fn_t __compar); | PLIBC_SEARCH__compar_fn_t __compar); | |||
/* Search for an entry matching the given KEY in the tree pointed to | /* Search for an entry matching the given KEY in the tree pointed to | |||
by *ROOTP. If no matching entry is available return NULL. */ | by *ROOTP. If no matching entry is available return NULL. */ | |||
void *_win_tfind (__const void *__key, void *__const * __rootp, | void *_win_tfind (__const void *__key, void *__const *__rootp, | |||
PLIBC_SEARCH__compar_fn_t __compar); | PLIBC_SEARCH__compar_fn_t __compar); | |||
/* Remove the element matching KEY from the tree pointed to by *ROOTP. */ | /* Remove the element matching KEY from the tree pointed to by *ROOTP. */ | |||
void *_win_tdelete (__const void *__restrict __key, void **__restrict __r | void *_win_tdelete (__const void *__restrict __key, | |||
ootp, | void **__restrict __rootp, | |||
PLIBC_SEARCH__compar_fn_t __compar); | PLIBC_SEARCH__compar_fn_t __compar); | |||
typedef void (*PLIBC_SEARCH__action_fn_t) (__const void *__nodep, | typedef void (*PLIBC_SEARCH__action_fn_t) (__const void *__nodep, PLIBC_SEA | |||
PLIBC_SEARCH_VISIT __value, | RCH_VISIT __value, | |||
int __level); | int __level); | |||
/* Walk through the whole tree and call the ACTION callback for every node | /* Walk through the whole tree and call the ACTION callback for every node | |||
or leaf. */ | or leaf. */ | |||
void _win_twalk (__const void *__root, PLIBC_SEARCH__action_fn_t __action ); | void _win_twalk (__const void *__root, PLIBC_SEARCH__action_fn_t __action); | |||
/* Callback type for function to free a tree node. If the keys are atomic | /* Callback type for function to free a tree node. If the keys are atomic | |||
data this function should do nothing. */ | data this function should do nothing. */ | |||
typedef void (*PLIBC_SEARCH__free_fn_t) (void *__nodep); | typedef void (*PLIBC_SEARCH__free_fn_t) (void *__nodep); | |||
/* Destroy the whole tree, call FREEFCT for each node or leaf. */ | /* Destroy the whole tree, call FREEFCT for each node or leaf. */ | |||
void _win_tdestroy (void *__root, PLIBC_SEARCH__free_fn_t __freefct); | void _win_tdestroy (void *__root, PLIBC_SEARCH__free_fn_t __freefct); | |||
/* Perform linear search for KEY by comparing by COMPAR in an array | /* Perform linear search for KEY by comparing by COMPAR in an array | |||
[BASE,BASE+NMEMB*SIZE). */ | [BASE,BASE+NMEMB*SIZE). */ | |||
void *_win_lfind (__const void *__key, __const void *__base, size_t * __n | void *_win_lfind (__const void *__key, __const void *__base, | |||
memb, | size_t *__nmemb, size_t __size, PLIBC_SEARCH__compar_fn_t __compar) | |||
size_t __size, PLIBC_SEARCH__compar_fn_t __compar); | ; | |||
/* Perform linear search for KEY by comparing by COMPAR function in | /* Perform linear search for KEY by comparing by COMPAR function in | |||
array [BASE,BASE+NMEMB*SIZE) and insert entry if not found. */ | array [BASE,BASE+NMEMB*SIZE) and insert entry if not found. */ | |||
void *_win_lsearch (__const void *__key, void *__base, size_t * __nmemb, | void *_win_lsearch (__const void *__key, void *__base, | |||
size_t __size, PLIBC_SEARCH__compar_fn_t __compar); | size_t *__nmemb, size_t __size, PLIBC_SEARCH__compar_fn_t __compa | |||
r); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif //_PLIBC_H_ | #endif //_PLIBC_H_ | |||
/* end of plibc.h */ | /* end of plibc.h */ | |||
End of changes. 79 change blocks. | ||||
524 lines changed or deleted | 583 lines changed or added | |||