gnunet_applications.h   gnunet_applications.h 
skipping to change at line 63 skipping to change at line 63
/** /**
* Internet IPv4 gateway (any TCP/UDP/ICMP). * Internet IPv4 gateway (any TCP/UDP/ICMP).
*/ */
#define GNUNET_APPLICATION_TYPE_IPV4_GATEWAY 16 #define GNUNET_APPLICATION_TYPE_IPV4_GATEWAY 16
/** /**
* Internet IPv6 gateway (any TCP/UDP/ICMP). * Internet IPv6 gateway (any TCP/UDP/ICMP).
*/ */
#define GNUNET_APPLICATION_TYPE_IPV6_GATEWAY 17 #define GNUNET_APPLICATION_TYPE_IPV6_GATEWAY 17
/**
* Internet exit regex prefix. Consisting of application ID, followed by ve
rsion
* and padding.
*/
#define GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX "GNEX0001PADPADPA"
#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 gnunet_applications.h */ /* end of gnunet_applications.h */
 End of changes. 1 change blocks. 
0 lines changed or deleted 7 lines changed or added


 gnunet_arm_service.h   gnunet_arm_service.h 
skipping to change at line 40 skipping to change at line 40
#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
#include "gnunet_configuration_lib.h" #include "gnunet_configuration_lib.h"
#include "gnunet_scheduler_lib.h" #include "gnunet_scheduler_lib.h"
#include "gnunet_os_lib.h"
#include "gnunet_time_lib.h" #include "gnunet_time_lib.h"
/** /**
* Version of the arm API. * Version of the arm API.
*/ */
#define GNUNET_ARM_VERSION 0x00000001 #define GNUNET_ARM_VERSION 0x00000001
/** /**
* Values characterizing GNUnet process states. * Values characterizing GNUnet process states.
*/ */
skipping to change at line 166 skipping to change at line 167
* the service has started to listen on the server socket and it may * the service has started to listen on the server socket and it may
* also be that the service has crashed in the meantime. Clients * also be that the service has crashed in the meantime. Clients
* should repeatedly try to connect to the service at the respective * should repeatedly try to connect to the service at the respective
* port (with some delays in between) before assuming that the service * port (with some delays in between) before assuming that the service
* actually failed to start. Note that if an error is returned to the * actually failed to start. Note that if an error is returned to the
* callback, clients obviously should not bother with trying to * callback, clients obviously should not bother with trying to
* contact the service. * contact the service.
* *
* @param h handle to ARM * @param h handle to ARM
* @param service_name name of the service * @param service_name name of the service
* @param std_inheritance flags controlling std descriptors inheritance
* @param timeout how long to wait before failing for good * @param timeout how long to wait before failing for good
* @param cb callback to invoke when service is ready * @param cb callback to invoke when service is ready
* @param cb_cls closure for callback * @param cb_cls closure for callback
*/ */
void void
GNUNET_ARM_start_service (struct GNUNET_ARM_Handle *h, const char *service_ name, GNUNET_ARM_start_service (struct GNUNET_ARM_Handle *h, const char *service_ name,
enum GNUNET_OS_InheritStdioFlags std_inheritance,
struct GNUNET_TIME_Relative timeout, struct GNUNET_TIME_Relative timeout,
GNUNET_ARM_Callback cb, void *cb_cls); GNUNET_ARM_Callback cb, void *cb_cls);
/** /**
* Stop a service. Note that the callback is invoked as soon * Stop a service. Note that the callback is invoked as soon
* as ARM confirms that it will ask the service to terminate. * as ARM confirms that it will ask the service to terminate.
* The actual termination may still take some time. * The actual termination may still take some time.
* *
* @param h handle to ARM * @param h handle to ARM
* @param service_name name of the service * @param service_name name of the service
 End of changes. 3 change blocks. 
0 lines changed or deleted 3 lines changed or added


 gnunet_ats_service.h   gnunet_ats_service.h 
skipping to change at line 563 skipping to change at line 563
* @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 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 a new address ATS should know. Addresses have to be added with t
his
* function before they can be: updated, set in use and destroyed
*
* @param sh handle
* @param address the address
* @param session session handle (if available)
* @param ats performance data for the address
* @param ats_count number of performance records in 'ats'
*/
int
GNUNET_ATS_address_add (struct GNUNET_ATS_SchedulingHandle *sh,
const struct GNUNET_HELLO_Address *address,
struct Session *session,
const struct GNUNET_ATS_Information *ats,
uint32_t ats_count);
/**
* 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
* for later use). Update bandwidth assignments. * for later use). Update bandwidth assignments.
* *
* @param sh handle * @param sh handle
* @param address updated address * @param address updated address
* @param session session handle (if available) * @param session session handle (if available)
 End of changes. 1 change blocks. 
0 lines changed or deleted 18 lines changed or added


 gnunet_block_lib.h   gnunet_block_lib.h 
skipping to change at line 100 skipping to change at line 100
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 * Block for storing record data
*/ */
GNUNET_BLOCK_TYPE_GNS_NAMERECORD = 11 GNUNET_BLOCK_TYPE_GNS_NAMERECORD = 11,
/**
* Block for storing mesh peers
*/
GNUNET_BLOCK_TYPE_MESH_PEER = 20,
/**
* Block for finding peers by type
*/
GNUNET_BLOCK_TYPE_MESH_PEER_BY_TYPE = 21,
/**
* Block to store a mesh regex state
*/
GNUNET_BLOCK_TYPE_MESH_REGEX = 22,
/**
* Block to store a mesh regex accepting state
*/
GNUNET_BLOCK_TYPE_MESH_REGEX_ACCEPT = 23
}; };
/** /**
* 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.
*/ */
skipping to change at line 159 skipping to change at line 179
struct GNUNET_BLOCK_Context; struct GNUNET_BLOCK_Context;
/** /**
* Mingle hash with the mingle_number to produce different bits. * Mingle hash with the mingle_number to produce different bits.
* *
* @param in original hash code * @param in original hash code
* @param mingle_number number for hash permutation * @param mingle_number number for hash permutation
* @param hc where to store the result. * @param hc where to store the result.
*/ */
void void
GNUNET_BLOCK_mingle_hash (const GNUNET_HashCode * in, uint32_t mingle_numbe GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode * in, uint32_t mingl
r, e_number,
GNUNET_HashCode * hc); struct GNUNET_HashCode * hc);
/** /**
* Create a block context. Loads the block plugins. * Create a block context. Loads the block plugins.
* *
* @param cfg configuration to use * @param cfg configuration to use
* @return NULL on error * @return NULL on error
*/ */
struct GNUNET_BLOCK_Context * struct GNUNET_BLOCK_Context *
GNUNET_BLOCK_context_create (const struct GNUNET_CONFIGURATION_Handle *cfg) ; GNUNET_BLOCK_context_create (const struct GNUNET_CONFIGURATION_Handle *cfg) ;
skipping to change at line 200 skipping to change at line 220
* @param bf_mutator mutation value for bf * @param bf_mutator mutation value for bf
* @param xquery extrended query data (can be NULL, depending on type) * @param xquery extrended query data (can be NULL, depending on type)
* @param xquery_size number of bytes in xquery * @param xquery_size number of bytes in xquery
* @param reply_block response to validate * @param reply_block response to validate
* @param reply_block_size number of bytes in reply block * @param reply_block_size number of bytes in reply block
* @return characterization of result * @return characterization of result
*/ */
enum GNUNET_BLOCK_EvaluationResult enum GNUNET_BLOCK_EvaluationResult
GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx, GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx,
enum GNUNET_BLOCK_Type type, enum GNUNET_BLOCK_Type type,
const GNUNET_HashCode * query, const struct GNUNET_HashCode * query,
struct GNUNET_CONTAINER_BloomFilter **bf, struct GNUNET_CONTAINER_BloomFilter **bf,
int32_t bf_mutator, const void *xquery, int32_t bf_mutator, const void *xquery,
size_t xquery_size, const void *reply_block, size_t xquery_size, const void *reply_block,
size_t reply_block_size); size_t reply_block_size);
/** /**
* Function called to obtain the key for a block. * Function called to obtain the key for a block.
* *
* @param ctx block context * @param ctx block context
* @param type block type * @param type block type
skipping to change at line 222 skipping to change at line 242
* @param block_size number of bytes in block * @param block_size number of bytes in block
* @param key set to the key (query) for the given block * @param key set to the key (query) for the given block
* @return GNUNET_YES on success, * @return GNUNET_YES on success,
* GNUNET_NO if the block is malformed * GNUNET_NO if the block is malformed
* GNUNET_SYSERR if type not supported * GNUNET_SYSERR if type not supported
* (or if extracting a key from a block of this type does not work) * (or if extracting a key from a block of this type does not work)
*/ */
int int
GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx, GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx,
enum GNUNET_BLOCK_Type type, const void *block, enum GNUNET_BLOCK_Type type, const void *block,
size_t block_size, GNUNET_HashCode * key); size_t block_size, struct GNUNET_HashCode * key);
/** /**
* Construct a bloom filter that would filter out the given * Construct a bloom filter that would filter out the given
* results. * results.
* *
* @param bf_mutator mutation value to use * @param bf_mutator mutation value to use
* @param seen_results results already seen * @param seen_results results already seen
* @param seen_results_count number of entries in 'seen_results' * @param seen_results_count number of entries in 'seen_results'
* @return NULL if seen_results_count is 0, otherwise a BF * @return NULL if seen_results_count is 0, otherwise a BF
* that would match the given results. * that would match the given results.
*/ */
struct GNUNET_CONTAINER_BloomFilter * struct GNUNET_CONTAINER_BloomFilter *
GNUNET_BLOCK_construct_bloomfilter (int32_t bf_mutator, GNUNET_BLOCK_construct_bloomfilter (int32_t bf_mutator,
const GNUNET_HashCode * seen_results, const struct GNUNET_HashCode * seen_res ults,
unsigned int seen_results_count); unsigned int seen_results_count);
#if 0 /* keep Emacsens' auto-indent happy */ #if 0 /* keep Emacsens' auto-indent happy */
{ {
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* ifndef GNUNET_BLOCK_LIB_H */ /* ifndef GNUNET_BLOCK_LIB_H */
 End of changes. 5 change blocks. 
7 lines changed or deleted 27 lines changed or added


 gnunet_block_plugin.h   gnunet_block_plugin.h 
skipping to change at line 58 skipping to change at line 58
* @param reply_block response to validate * @param reply_block response to validate
* @param reply_block_size number of bytes in reply block * @param reply_block_size number of bytes in reply block
* @return characterization of result * @return characterization of result
*/ */
typedef enum typedef enum
GNUNET_BLOCK_EvaluationResult (*GNUNET_BLOCK_EvaluationFunction) (void *cls, GNUNET_BLOCK_EvaluationResult (*GNUNET_BLOCK_EvaluationFunction) (void *cls,
enum enum
GNUNE T_BLOCK_Type GNUNE T_BLOCK_Type
type, type,
const const
GNUNE T_HashCode struc t GNUNET_HashCode
* que ry, * que ry,
struc t struc t
GNUNE T_CONTAINER_BloomFilter GNUNE T_CONTAINER_BloomFilter
** bf , ** bf ,
int32 _t int32 _t
bf_mu tator, bf_mu tator,
const void const void
*xque ry, *xque ry,
size_ t size_ t
xquer y_size, xquer y_size,
skipping to change at line 91 skipping to change at line 91
* @param key set to the key (query) for the given block * @param key set to the key (query) for the given block
* @return GNUNET_YES on success, * @return GNUNET_YES on success,
* GNUNET_NO if the block is malformed * GNUNET_NO if the block is malformed
* GNUNET_SYSERR if type not supported * GNUNET_SYSERR if type not supported
* (or if extracting a key from a block of this type does not work) * (or if extracting a key from a block of this type does not work)
*/ */
typedef int (*GNUNET_BLOCK_GetKeyFunction) (void *cls, typedef int (*GNUNET_BLOCK_GetKeyFunction) (void *cls,
enum GNUNET_BLOCK_Type type, enum GNUNET_BLOCK_Type type,
const void *block, const void *block,
size_t block_size, size_t block_size,
GNUNET_HashCode * key); struct GNUNET_HashCode * key);
/** /**
* Each plugin is required to return a pointer to a struct of this * Each plugin is required to return a pointer to a struct of this
* type as the return value from its entry point. * type as the return value from its entry point.
*/ */
struct GNUNET_BLOCK_PluginFunctions struct GNUNET_BLOCK_PluginFunctions
{ {
/** /**
* Closure for all of the callbacks. * Closure for all of the callbacks.
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 gnunet_chat_service.h   gnunet_chat_service.h 
skipping to change at line 113 skipping to change at line 113
* @param sender what is the ID of the sender? (maybe NULL) * @param sender what is the ID of the sender? (maybe NULL)
* @param member_info information about the joining member * @param member_info information about the joining member
* @param message the message text * @param message the message text
* @param timestamp when was the message sent? * @param timestamp when was the message sent?
* @param options options for the message * @param options options for the message
* @return GNUNET_OK to accept the message now, GNUNET_NO to * @return GNUNET_OK to accept the message now, GNUNET_NO to
* accept (but user is away), GNUNET_SYSERR to signal denied delive ry * accept (but user is away), GNUNET_SYSERR to signal denied delive ry
*/ */
typedef int (*GNUNET_CHAT_MessageCallback) (void *cls, typedef int (*GNUNET_CHAT_MessageCallback) (void *cls,
struct GNUNET_CHAT_Room * room, struct GNUNET_CHAT_Room * room,
const GNUNET_HashCode * sender, const struct GNUNET_HashCode * sender,
const struct const struct
GNUNET_CONTAINER_MetaData * GNUNET_CONTAINER_MetaData *
member_info, const char *messag e, member_info, const char *messag e,
struct GNUNET_TIME_Absolute struct GNUNET_TIME_Absolute
timestamp, timestamp,
enum GNUNET_CHAT_MsgOptions enum GNUNET_CHAT_MsgOptions
options); options);
/** /**
* Callback used for notification that another room member has joined or le ft. * Callback used for notification that another room member has joined or le ft.
skipping to change at line 158 skipping to change at line 158
* @param timestamp when was the message received? * @param timestamp when was the message received?
* @param receiver who is confirming the receipt? * @param receiver who is confirming the receipt?
* @return GNUNET_OK to continue, GNUNET_SYSERR to refuse processing furthe r * @return GNUNET_OK to continue, GNUNET_SYSERR to refuse processing furthe r
* confirmations from anyone for this message * confirmations from anyone for this message
*/ */
typedef int (*GNUNET_CHAT_MessageConfirmation) (void *cls, typedef int (*GNUNET_CHAT_MessageConfirmation) (void *cls,
struct GNUNET_CHAT_Room * r oom, struct GNUNET_CHAT_Room * r oom,
uint32_t orig_seq_number, uint32_t orig_seq_number,
struct GNUNET_TIME_Absolute struct GNUNET_TIME_Absolute
timestamp, timestamp,
const GNUNET_HashCode * const struct GNUNET_HashCod e *
receiver); receiver);
/** /**
* Join a chat room. * Join a chat room.
* *
* @param cfg configuration * @param cfg configuration
* @param nick_name nickname of the user joining (used to * @param nick_name nickname of the user joining (used to
* determine which public key to use); * determine which public key to use);
* the nickname should probably also * the nickname should probably also
* be used in the member_info (as "EXTRACTOR_TITLE") * be used in the member_info (as "EXTRACTOR_TITLE")
skipping to change at line 197 skipping to change at line 197
const char *nick_name, const char *nick_name,
struct GNUNET_CONTAINER_MetaData *member_info, struct GNUNET_CONTAINER_MetaData *member_info,
const char *room_name, const char *room_name,
enum GNUNET_CHAT_MsgOptions msg_options, enum GNUNET_CHAT_MsgOptions msg_options,
GNUNET_CHAT_JoinCallback joinCallback, void *join_cl s, GNUNET_CHAT_JoinCallback joinCallback, void *join_cl s,
GNUNET_CHAT_MessageCallback messageCallback, GNUNET_CHAT_MessageCallback messageCallback,
void *message_cls, void *message_cls,
GNUNET_CHAT_MemberListCallback memberCallback, GNUNET_CHAT_MemberListCallback memberCallback,
void *member_cls, void *member_cls,
GNUNET_CHAT_MessageConfirmation confirmationCallback , GNUNET_CHAT_MessageConfirmation confirmationCallback ,
void *confirmation_cls, GNUNET_HashCode * me); void *confirmation_cls, struct GNUNET_HashCode * me) ;
/** /**
* Send a message. * Send a message.
* *
* @param room handle for the chat room * @param room handle for the chat room
* @param message message to be sent * @param message message to be sent
* @param options options for the message * @param options options for the message
* @param receiver use NULL to send to everyone in the room * @param receiver use NULL to send to everyone in the room
* @param sequence_number where to write the sequence id of the message * @param sequence_number where to write the sequence id of the message
*/ */
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added


 gnunet_common.h   gnunet_common.h 
skipping to change at line 49 skipping to change at line 49
#ifdef MINGW #ifdef MINGW
#include "winproc.h" #include "winproc.h"
#endif #endif
#ifdef HAVE_STDINT_H #ifdef HAVE_STDINT_H
#include <stdint.h> #include <stdint.h>
#endif #endif
#ifdef HAVE_STDARG_H #ifdef HAVE_STDARG_H
#include <stdarg.h> #include <stdarg.h>
#endif #endif
#ifdef __cplusplus
extern "C"
{
#if 0 /* keep Emacsens' auto-indent happy */
}
#endif
#endif
/** /**
* Version of the API (for entire gnunetutil.so library). * Version of the API (for entire gnunetutil.so library).
*/ */
#define GNUNET_UTIL_VERSION 0x00090200 #define GNUNET_UTIL_VERSION 0x00090400
/** /**
* Named constants for return values. The following * Named constants for return values. The following
* invariants hold: "GNUNET_NO == 0" (to allow "if (GNUNET_NO)") * invariants hold: "GNUNET_NO == 0" (to allow "if (GNUNET_NO)")
* "GNUNET_OK != GNUNET_SYSERR", "GNUNET_OK != GNUNET_NO", "GNUNET_NO != GN UNET_SYSERR" * "GNUNET_OK != GNUNET_SYSERR", "GNUNET_OK != GNUNET_NO", "GNUNET_NO != GN UNET_SYSERR"
* and finally "GNUNET_YES != GNUNET_NO". * and finally "GNUNET_YES != GNUNET_NO".
*/ */
#define GNUNET_OK 1 #define GNUNET_OK 1
#define GNUNET_SYSERR -1 #define GNUNET_SYSERR -1
#define GNUNET_YES 1 #define GNUNET_YES 1
skipping to change at line 170 skipping to change at line 178
/** /**
* gcc-ism to document unused arguments * gcc-ism to document unused arguments
*/ */
#define GNUNET_UNUSED __attribute__((unused)) #define GNUNET_UNUSED __attribute__((unused))
/** /**
* gcc-ism to document functions that don't return * gcc-ism to document functions that don't return
*/ */
#define GNUNET_NORETURN __attribute__((noreturn)) #define GNUNET_NORETURN __attribute__((noreturn))
#if MINGW
#if __GNUC__ > 3 #if __GNUC__ > 3
/** /**
* gcc 4.x-ism to pack structures even on W32 (to be used before structs) * gcc 4.x-ism to pack structures even on W32 (to be used before structs);
* Using this would cause structs to be unaligned on the stack on Sparc,
* so we *only* use this on W32 (see #670578 from Debian); fortunately,
* W32 doesn't run on sparc anyway.
*/ */
#define GNUNET_NETWORK_STRUCT_BEGIN \ #define GNUNET_NETWORK_STRUCT_BEGIN \
_Pragma("pack(push)") \ _Pragma("pack(push)") \
_Pragma("pack(1)") _Pragma("pack(1)")
/** /**
* gcc 4.x-ism to pack structures even on W32 (to be used after structs) * gcc 4.x-ism to pack structures even on W32 (to be used after structs)
* Using this would cause structs to be unaligned on the stack on Sparc,
* so we *only* use this on W32 (see #670578 from Debian); fortunately,
* W32 doesn't run on sparc anyway.
*/ */
#define GNUNET_NETWORK_STRUCT_END _Pragma("pack(pop)") #define GNUNET_NETWORK_STRUCT_END _Pragma("pack(pop)")
#else #else
#ifdef MINGW
#error gcc 4.x or higher required on W32 systems #error gcc 4.x or higher required on W32 systems
#endif #endif
#else
/** /**
* Good luck, GNUNET_PACKED should suffice, but this won't work on W32 * Define as empty, GNUNET_PACKED should suffice, but this won't work on W3 2
*/ */
#define GNUNET_NETWORK_STRUCT_BEGIN #define GNUNET_NETWORK_STRUCT_BEGIN
/** /**
* Good luck, GNUNET_PACKED should suffice, but this won't work on W32 * Define as empty, GNUNET_PACKED should suffice, but this won't work on W3 2;
*/ */
#define GNUNET_NETWORK_STRUCT_END #define GNUNET_NETWORK_STRUCT_END
#endif #endif
/* ************************ super-general types *********************** */ /* ************************ super-general types *********************** */
GNUNET_NETWORK_STRUCT_BEGIN GNUNET_NETWORK_STRUCT_BEGIN
/** /**
* Header for all communications. * Header for all communications.
skipping to change at line 221 skipping to change at line 237
uint16_t size GNUNET_PACKED; uint16_t size GNUNET_PACKED;
/** /**
* The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian form at. * The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian form at.
*/ */
uint16_t type GNUNET_PACKED; uint16_t type GNUNET_PACKED;
}; };
/** /**
* @brief 512-bit hashcode * @brief A SHA-512 hashcode
*/ */
typedef struct GNUNET_HashCode struct GNUNET_HashCode
{ {
uint32_t bits[512 / 8 / sizeof (uint32_t)]; /* = 16 */ uint32_t bits[512 / 8 / sizeof (uint32_t)]; /* = 16 */
} };
GNUNET_HashCode;
/**
* @brief A SHA-256 hashcode
*/
struct GNUNET_CRYPTO_ShortHashCode
{
uint32_t bits[256 / 8 / sizeof (uint32_t)]; /* = 8 */
};
/** /**
* The identity of the host (basically the SHA-512 hashcode of * The identity of the host (basically the SHA-512 hashcode of
* it's public key). * it's public key).
*/ */
struct GNUNET_PeerIdentity struct GNUNET_PeerIdentity
{ {
GNUNET_HashCode hashPubKey; struct GNUNET_HashCode hashPubKey;
}; };
GNUNET_NETWORK_STRUCT_END GNUNET_NETWORK_STRUCT_END
/** /**
* Function called with a filename. * Function called with a filename.
* *
* @param cls closure * @param cls closure
* @param filename complete filename (absolute path) * @param filename complete filename (absolute path)
* @return GNUNET_OK to continue to iterate, * @return GNUNET_OK to continue to iterate,
* GNUNET_SYSERR to abort iteration with error! * GNUNET_SYSERR to abort iteration with error!
skipping to change at line 280 skipping to change at line 303
* @param kind severeity * @param kind severeity
* @param component what component is issuing the message? * @param component what component is issuing the message?
* @param date when was the message logged? * @param date when was the message logged?
* @param message what is the message * @param message what is the message
*/ */
typedef void (*GNUNET_Logger) (void *cls, enum GNUNET_ErrorType kind, typedef void (*GNUNET_Logger) (void *cls, enum GNUNET_ErrorType kind,
const char *component, const char *date, const char *component, const char *date,
const char *message); const char *message);
/** /**
* Number of log calls to ignore. * Get the number of log calls that are going to be skipped
*
* @return number of log calls to be ignored
*/ */
extern unsigned int skip_log; int
GNUNET_get_log_skip ();
#if !defined(GNUNET_CULL_LOGGING) #if !defined(GNUNET_CULL_LOGGING)
int int
GNUNET_get_log_call_status (int caller_level, const char *comp, GNUNET_get_log_call_status (int caller_level, const char *comp,
const char *file, const char *function, int lin e); const char *file, const char *function, int lin e);
#endif #endif
/** /**
* Main log function. * Main log function.
* *
* @param kind how serious is the error? * @param kind how serious is the error?
* @param message what is the message (format string) * @param message what is the message (format string)
* @param ... arguments for format string * @param ... arguments for format string
*/ */
void void
GNUNET_log_nocheck (enum GNUNET_ErrorType kind, const char *message, ...); GNUNET_log_nocheck (enum GNUNET_ErrorType kind, const char *message, ...);
skipping to change at line 340 skipping to change at line 367
void void
GNUNET_log_from_nocheck (enum GNUNET_ErrorType kind, const char *comp, GNUNET_log_from_nocheck (enum GNUNET_ErrorType kind, const char *comp,
const char *message, ...); const char *message, ...);
#if !defined(GNUNET_CULL_LOGGING) #if !defined(GNUNET_CULL_LOGGING)
#define GNUNET_log_from(kind,comp,...) do { int log_line = __LINE__;\ #define GNUNET_log_from(kind,comp,...) do { int log_line = __LINE__;\
static int log_call_enabled = GNUNET_LOG_CALL_STATUS;\ static int log_call_enabled = GNUNET_LOG_CALL_STATUS;\
if ((GNUNET_EXTRA_LOGGING > 0) || ((GNUNET_ERROR_TYPE_DEBUG & (kind)) == 0)) { \ if ((GNUNET_EXTRA_LOGGING > 0) || ((GNUNET_ERROR_TYPE_DEBUG & (kind)) == 0)) { \
if (GN_UNLIKELY(log_call_enabled == -1))\ if (GN_UNLIKELY(log_call_enabled == -1))\
log_call_enabled = GNUNET_get_log_call_status ((kind) & (~GNUNET_ERRO R_TYPE_BULK), (comp), __FILE__, __FUNCTION__, log_line); \ log_call_enabled = GNUNET_get_log_call_status ((kind) & (~GNUNET_ERRO R_TYPE_BULK), (comp), __FILE__, __FUNCTION__, log_line); \
if (GN_UNLIKELY(skip_log > 0)) {skip_log--;}\ if (GN_UNLIKELY(GNUNET_get_log_skip () > 0)) { GNUNET_log_skip (-1, GNU NET_NO); }\
else {\ else {\
if (GN_UNLIKELY(log_call_enabled))\ if (GN_UNLIKELY(log_call_enabled))\
GNUNET_log_from_nocheck ((kind), comp, __VA_ARGS__); \ GNUNET_log_from_nocheck ((kind), comp, __VA_ARGS__); \
}\ }\
}\ }\
} while (0) } while (0)
#define GNUNET_log(kind,...) do { int log_line = __LINE__;\ #define GNUNET_log(kind,...) do { int log_line = __LINE__;\
static int log_call_enabled = GNUNET_LOG_CALL_STATUS;\ static int log_call_enabled = GNUNET_LOG_CALL_STATUS;\
if ((GNUNET_EXTRA_LOGGING > 0) || ((GNUNET_ERROR_TYPE_DEBUG & (kind)) == 0)) { \ if ((GNUNET_EXTRA_LOGGING > 0) || ((GNUNET_ERROR_TYPE_DEBUG & (kind)) == 0)) { \
if (GN_UNLIKELY(log_call_enabled == -1))\ if (GN_UNLIKELY(log_call_enabled == -1))\
log_call_enabled = GNUNET_get_log_call_status ((kind) & (~GNUNET_ERRO R_TYPE_BULK), NULL, __FILE__, __FUNCTION__, log_line);\ log_call_enabled = GNUNET_get_log_call_status ((kind) & (~GNUNET_ERRO R_TYPE_BULK), NULL, __FILE__, __FUNCTION__, log_line);\
if (GN_UNLIKELY(skip_log > 0)) {skip_log--;}\ if (GN_UNLIKELY(GNUNET_get_log_skip () > 0)) { GNUNET_log_skip (-1, GNU NET_NO); }\
else {\ else {\
if (GN_UNLIKELY(log_call_enabled))\ if (GN_UNLIKELY(log_call_enabled))\
GNUNET_log_nocheck ((kind), __VA_ARGS__); \ GNUNET_log_nocheck ((kind), __VA_ARGS__); \
}\ }\
}\ }\
} while (0) } while (0)
#else #else
#define GNUNET_log(...) #define GNUNET_log(...)
#define GNUNET_log_from(...) #define GNUNET_log_from(...)
#endif #endif
/** /**
* Log error message about missing configuration option.
*
* @param kind log level
* @param section section with missing option
* @param option name of missing option
*/
void
GNUNET_log_config_missing (enum GNUNET_ErrorType kind,
const char *section,
const char *option);
/**
* Log error message about invalid configuration option value.
*
* @param kind log level
* @param section section with invalid option
* @param option name of invalid option
* @param required what is required that is invalid about the option
*/
void
GNUNET_log_config_invalid (enum GNUNET_ErrorType kind,
const char *section,
const char *option,
const char *required);
/**
* Abort the process, generate a core dump if possible. * Abort the process, generate a core dump if possible.
*/ */
void void
GNUNET_abort (void) GNUNET_NORETURN; GNUNET_abort (void) GNUNET_NORETURN;
/** /**
* Ignore the next n calls to the log function. * Ignore the next n calls to the log function.
* *
* @param n number of log calls to ignore * @param n number of log calls to ignore (could be negative)
* @param check_reset GNUNET_YES to assert that the log skip counter is cur rently zero * @param check_reset GNUNET_YES to assert that the log skip counter is cur rently zero
*/ */
void void
GNUNET_log_skip (unsigned int n, int check_reset); GNUNET_log_skip (int n, int check_reset);
/** /**
* Setup logging. * Setup logging.
* *
* @param comp default component to use * @param comp default component to use
* @param loglevel what types of messages should be logged * @param loglevel what types of messages should be logged
* @param logfile change logging to logfile (use NULL to keep stderr) * @param logfile change logging to logfile (use NULL to keep stderr)
* @return GNUNET_OK on success, GNUNET_SYSERR if logfile could not be open ed * @return GNUNET_OK on success, GNUNET_SYSERR if logfile could not be open ed
*/ */
int int
skipping to change at line 410 skipping to change at line 463
/** /**
* Remove a custom logger. * Remove a custom logger.
* *
* @param logger log function * @param logger log function
* @param logger_cls closure for logger * @param logger_cls closure for logger
*/ */
void void
GNUNET_logger_remove (GNUNET_Logger logger, void *logger_cls); GNUNET_logger_remove (GNUNET_Logger logger, void *logger_cls);
/** /**
* Convert a short hash value to a string (for printing debug messages).
* This is one of the very few calls in the entire API that is
* NOT reentrant!
*
* @param hc the short hash code
* @return string
*/
const char *
GNUNET_short_h2s (const struct GNUNET_CRYPTO_ShortHashCode * hc);
/**
* Convert a short hash value to a string (for printing debug messages).
* This prints all 104 characters of a hashcode!
* This is one of the very few calls in the entire API that is
* NOT reentrant!
*
* @param hc the short hash code
* @return string
*/
const char *
GNUNET_short_h2s_full (const struct GNUNET_CRYPTO_ShortHashCode * hc);
/**
* Convert a hash value to a string (for printing debug messages). * Convert a hash value to a string (for printing debug messages).
* This is one of the very few calls in the entire API that is * This is one of the very few calls in the entire API that is
* NOT reentrant! * NOT reentrant!
* *
* @param hc the hash code * @param hc the hash code
* @return string * @return string
*/ */
const char * const char *
GNUNET_h2s (const GNUNET_HashCode * hc); GNUNET_h2s (const struct GNUNET_HashCode * hc);
/** /**
* Convert a hash value to a string (for printing debug messages). * Convert a hash value to a string (for printing debug messages).
* This prints all 104 characters of a hashcode! * This prints all 104 characters of a hashcode!
* This is one of the very few calls in the entire API that is * This is one of the very few calls in the entire API that is
* NOT reentrant! * NOT reentrant!
* *
* @param hc the hash code * @param hc the hash code
* @return string * @return string
*/ */
const char * const char *
GNUNET_h2s_full (const GNUNET_HashCode * hc); GNUNET_h2s_full (const struct GNUNET_HashCode * hc);
/** /**
* Convert a peer identity to a string (for printing debug messages). * Convert a peer identity to a string (for printing debug messages).
* This is one of the very few calls in the entire API that is * This is one of the very few calls in the entire API that is
* NOT reentrant! * NOT reentrant!
* *
* @param pid the peer identity * @param pid the peer identity
* @return string form of the pid; will be overwritten by next * @return string form of the pid; will be overwritten by next
* call to GNUNET_i2s. * call to GNUNET_i2s.
*/ */
skipping to change at line 835 skipping to change at line 911
GNUNET_copy_message (const struct GNUNET_MessageHeader *msg); GNUNET_copy_message (const struct GNUNET_MessageHeader *msg);
#if __STDC_VERSION__ < 199901L #if __STDC_VERSION__ < 199901L
#if __GNUC__ >= 2 #if __GNUC__ >= 2
#define __func__ __FUNCTION__ #define __func__ __FUNCTION__
#else #else
#define __func__ "<unknown>" #define __func__ "<unknown>"
#endif #endif
#endif #endif
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
#ifdef __cplusplus
}
#endif
#endif /*GNUNET_COMMON_H_ */ #endif /*GNUNET_COMMON_H_ */
 End of changes. 26 change blocks. 
18 lines changed or deleted 101 lines changed or added


 gnunet_config.h   gnunet_config.h 
skipping to change at line 15 skipping to change at line 15
/* Define to 1 if the `closedir' function returns void instead of `int'. */ /* Define to 1 if the `closedir' function returns void instead of `int'. */
/* #undef CLOSEDIR_VOID */ /* #undef CLOSEDIR_VOID */
/* This is a Cygwin system */ /* This is a Cygwin system */
/* #undef CYGWIN */ /* #undef CYGWIN */
/* This is an Apple Darwin system */ /* This is an Apple Darwin system */
/* #undef DARWIN */ /* #undef DARWIN */
/* enable expensive heap statistics */
#define ENABLE_HEAP_STATISTICS 0
/* Define to 1 if translation of program messages to the user's native /* Define to 1 if translation of program messages to the user's native
language is requested. */ language is requested. */
#define ENABLE_NLS 1 #define ENABLE_NLS 1
/* 1 if freed memory should be poisoned, 0 otherwise */
#define ENABLE_POISONING 0
/* enable workarounds used on Windows (only useful for test cases) */ /* enable workarounds used on Windows (only useful for test cases) */
#define ENABLE_WINDOWS_WORKAROUNDS 0 #define ENABLE_WINDOWS_WORKAROUNDS 0
/* Build a Mac OS X Framework */ /* Build a Mac OS X Framework */
/* #undef FRAMEWORK_BUILD */ /* #undef FRAMEWORK_BUILD */
/* This is a FreeBSD system */ /* This is a FreeBSD system */
/* #undef FREEBSD */ /* #undef FREEBSD */
/* This is a GNU system */
/* #undef GNU */
/* Define to cull all logging calls */ /* Define to cull all logging calls */
/* #undef GNUNET_CULL_LOGGING */ /* #undef GNUNET_CULL_LOGGING */
/* This should be the default choice for the name of the first network /* This should be the default choice for the name of the first network
interface */ interface */
#define GNUNET_DEFAULT_INTERFACE "eth0" #define GNUNET_DEFAULT_INTERFACE "eth0"
/* 1 if extra logging is enabled, 2 for very verbose extra logging, 0 /* 1 if extra logging is enabled, 2 for very verbose extra logging, 0
otherwise */ otherwise */
#define GNUNET_EXTRA_LOGGING GNUNET_NO #define GNUNET_EXTRA_LOGGING GNUNET_NO
skipping to change at line 80 skipping to change at line 89
CoreFoundation framework. */ CoreFoundation framework. */
/* #undef HAVE_CFLOCALECOPYCURRENT */ /* #undef HAVE_CFLOCALECOPYCURRENT */
/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue i n /* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue i n
the CoreFoundation framework. */ the CoreFoundation framework. */
/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ /* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */
/* Define to 1 if your system has a working `chown' function. */ /* Define to 1 if your system has a working `chown' function. */
#define HAVE_CHOWN 1 #define HAVE_CHOWN 1
/* Define to 1 if you have the `clock_gettime' function. */
/* #undef HAVE_CLOCK_GETTIME */
/* Define to 1 if you have the `closedir' function. */ /* Define to 1 if you have the `closedir' function. */
#define HAVE_CLOSEDIR 1 #define HAVE_CLOSEDIR 1
/* Define to 1 if you have the <ctype.h> header file. */ /* Define to 1 if you have the <ctype.h> header file. */
#define HAVE_CTYPE_H 1 #define HAVE_CTYPE_H 1
/* Define if the GNU dcgettext() function is already present or preinstalle d. /* Define if the GNU dcgettext() function is already present or preinstalle d.
*/ */
#define HAVE_DCGETTEXT 1 #define HAVE_DCGETTEXT 1
skipping to change at line 123 skipping to change at line 129
/* Define to 1 if you have the <dlfcn.h> header file. */ /* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1 #define HAVE_DLFCN_H 1
/* Define to 1 if you have the <dl.h> header file. */ /* Define to 1 if you have the <dl.h> header file. */
/* #undef HAVE_DL_H */ /* #undef HAVE_DL_H */
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
/* #undef HAVE_DOPRNT */ /* #undef HAVE_DOPRNT */
/* Define to 1 if you have the `dup2' function. */
#define HAVE_DUP2 1
/* Define if you have the _dyld_func_lookup function. */ /* Define if you have the _dyld_func_lookup function. */
/* #undef HAVE_DYLD */ /* #undef HAVE_DYLD */
/* Define to 1 if you have the <endian.h> header file. */ /* Define to 1 if you have the <endian.h> header file. */
#define HAVE_ENDIAN_H 1 #define HAVE_ENDIAN_H 1
/* Define to 1 if you have the <errno.h> header file. */ /* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1 #define HAVE_ERRNO_H 1
/* Define to 1 if the system has the type `error_t'. */ /* Define to 1 if the system has the type `error_t'. */
#define HAVE_ERROR_T 1 #define HAVE_ERROR_T 1
/* Define to 1 if you have the <execinfo.h> header file. */
#define HAVE_EXECINFO_H 1
/* Define to 1 if you have the <extractor.h> header file. */ /* Define to 1 if you have the <extractor.h> header file. */
#define HAVE_EXTRACTOR_H 1 #define HAVE_EXTRACTOR_H 1
/* Define to 1 if you have the <fcntl.h> header file. */ /* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1 #define HAVE_FCNTL_H 1
/* Define to 1 if you have the `fdatasync' function. */
#define HAVE_FDATASYNC 1
/* Define to 1 if you have the `floor' function. */
#define HAVE_FLOOR 1
/* Define to 1 if you have the `fork' function. */ /* Define to 1 if you have the `fork' function. */
#define HAVE_FORK 1 #define HAVE_FORK 1
/* Define to 1 if you have the `freeifaddrs' function. */ /* Define to 1 if you have the `freeifaddrs' function. */
#define HAVE_FREEIFADDRS 1 #define HAVE_FREEIFADDRS 1
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#define HAVE_FSEEKO 1 #define HAVE_FSEEKO 1
/* Define to 1 if you have the `ftruncate' function. */
#define HAVE_FTRUNCATE 1
/* Define this if getaddrinfo() is available */ /* Define this if getaddrinfo() is available */
#define HAVE_GETADDRINFO 1 #define HAVE_GETADDRINFO 1
/* Define to 1 if you have the `getcwd' function. */
#define HAVE_GETCWD 1
/* Define this if gethostbyaddr() is available */ /* Define this if gethostbyaddr() is available */
#define HAVE_GETHOSTBYADDR 1 #define HAVE_GETHOSTBYADDR 1
/* Define this if gethostbyname() is available */ /* Define this if gethostbyname() is available */
#define HAVE_GETHOSTBYNAME 1 #define HAVE_GETHOSTBYNAME 1
/* Define to 1 if you have the `gethostbyname2' function. */ /* Define to 1 if you have the `gethostbyname2' function. */
#define HAVE_GETHOSTBYNAME2 1 #define HAVE_GETHOSTBYNAME2 1
/* Define this if gethostname() is available */ /* Define this if gethostname() is available */
skipping to change at line 195 skipping to change at line 189
/* Define this if getnameinfo() is available */ /* Define this if getnameinfo() is available */
#define HAVE_GETNAMEINFO 1 #define HAVE_GETNAMEINFO 1
/* Define to 1 if you have the `getpeereid' function. */ /* Define to 1 if you have the `getpeereid' function. */
/* #undef HAVE_GETPEEREID */ /* #undef HAVE_GETPEEREID */
/* Define to 1 if you have the `getpeerucred' function. */ /* Define to 1 if you have the `getpeerucred' function. */
/* #undef HAVE_GETPEERUCRED */ /* #undef HAVE_GETPEERUCRED */
/* Define to 1 if you have the `getresgid' function. */
#define HAVE_GETRESGID 1
/* Define to 1 if you have the `getrusage' function. */ /* Define to 1 if you have the `getrusage' function. */
#define HAVE_GETRUSAGE 1 #define HAVE_GETRUSAGE 1
/* Define if the GNU gettext() function is already present or preinstalled. */ /* Define if the GNU gettext() function is already present or preinstalled. */
#define HAVE_GETTEXT 1 #define HAVE_GETTEXT 1
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
/* Define to 1 if you have the <glpk.h> header file. */ /* Define to 1 if you have the <glpk.h> header file. */
#define HAVE_GLPK_H 1 #define HAVE_GLPK_H 1
/* Define to 1 if `presolve' is a member of `glp_iocp'. */ /* Define to 1 if `presolve' is a member of `glp_iocp'. */
#define HAVE_GLP_IOCP_PRESOLVE 1 #define HAVE_GLP_IOCP_PRESOLVE 1
/* Define to 1 if you have the `gmtime' function. */ /* We have gnutls */
#define HAVE_GMTIME 1 #define HAVE_GNUTLS true
/* Define to 1 if you have the `gmtime_r' function. */ /* Define to 1 if you have the <gnutls/abstract.h> header file. */
#define HAVE_GMTIME_R 1 #define HAVE_GNUTLS_ABSTRACT_H 1
/* Define if you have the iconv() function. */ /* Define if you have the iconv() function. */
#define HAVE_ICONV 1 #define HAVE_ICONV 1
/* Define to 1 if you have the <ifaddrs.h> header file. */ /* Define to 1 if you have the <ifaddrs.h> header file. */
#define HAVE_IFADDRS_H 1 #define HAVE_IFADDRS_H 1
/* Define this if inet_ntoa() is available */ /* Define this if inet_ntoa() is available */
#define HAVE_INET_NTOA 1 /* #undef HAVE_INET_NTOA */
/* Define to 1 if you have the `initgroups' function. */ /* Define to 1 if you have the `initgroups' function. */
#define HAVE_INITGROUPS 1 #define HAVE_INITGROUPS 1
/* Define to 1 if you have the <inttypes.h> header file. */ /* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1 #define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <kstat.h> header file. */ /* Define to 1 if you have the <kstat.h> header file. */
/* #undef HAVE_KSTAT_H */ /* #undef HAVE_KSTAT_H */
/* Define to 1 if you have the <kvm.h> header file. */ /* Define to 1 if you have the <kvm.h> header file. */
/* #undef HAVE_KVM_H */ /* #undef HAVE_KVM_H */
/* Define to 1 if you have the <langinfo.h> header file. */ /* Define to 1 if you have the <langinfo.h> header file. */
#define HAVE_LANGINFO_H 1 #define HAVE_LANGINFO_H 1
/* Define to 1 if you have a functional curl library. */ /* Have libcurl */
#define HAVE_LIBCURL 1 #define HAVE_LIBCURL 1
/* Define if you have the libdl library or equivalent. */ /* Define if you have the libdl library or equivalent. */
#define HAVE_LIBDL 1 #define HAVE_LIBDL 1
/* Define if libdlloader will be built on this platform */ /* Define if libdlloader will be built on this platform */
#define HAVE_LIBDLLOADER 1 #define HAVE_LIBDLLOADER 1
/* Have GLPK */ /* Have GLPK */
#define HAVE_LIBGLPK 1 #define HAVE_LIBGLPK 1
skipping to change at line 288 skipping to change at line 282
/* Define to 1 if you have the `z' library (-lz). */ /* Define to 1 if you have the `z' library (-lz). */
#define HAVE_LIBZ 1 #define HAVE_LIBZ 1
/* Define to 1 if you have the <limits.h> header file. */ /* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1 #define HAVE_LIMITS_H 1
/* Define to 1 if you have the <locale.h> header file. */ /* Define to 1 if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1 #define HAVE_LOCALE_H 1
/* Define to 1 if you have the `localtime_r' function. */
#define HAVE_LOCALTIME_R 1
/* Define this if a modern libltdl is already installed */ /* Define this if a modern libltdl is already installed */
#define HAVE_LTDL 1 #define HAVE_LTDL 1
/* Define to 1 if you have the <mach/mach.h> header file. */ /* Define to 1 if you have the <mach/mach.h> header file. */
/* #undef HAVE_MACH_MACH_H */ /* #undef HAVE_MACH_MACH_H */
/* Define to 1 if you have the <mach-o/dyld.h> header file. */ /* Define to 1 if you have the <mach-o/dyld.h> header file. */
/* #undef HAVE_MACH_O_DYLD_H */ /* #undef HAVE_MACH_O_DYLD_H */
/* Define to 1 if you have the `mallinfo' function. */
#define HAVE_MALLINFO 1
/* Define to 1 if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H 1
/* Define to 1 if you have the <malloc/malloc.h> header file. */
/* #undef HAVE_MALLOC_MALLOC_H */
/* Define to 1 if you have the `malloc_size' function. */
/* #undef HAVE_MALLOC_SIZE */
/* Define to 1 if you have the `malloc_usable_size' function. */
#define HAVE_MALLOC_USABLE_SIZE 1
/* Define to 1 if you have the <math.h> header file. */ /* Define to 1 if you have the <math.h> header file. */
#define HAVE_MATH_H 1 #define HAVE_MATH_H 1
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1
/* Define to 1 if you have the <memory.h> header file. */ /* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1 #define HAVE_MEMORY_H 1
/* Define to 1 if you have the `memset' function. */
#define HAVE_MEMSET 1
/* We have libmicrohttpd */ /* We have libmicrohttpd */
#define HAVE_MHD 1 #define HAVE_MHD 1
/* Define to 1 if you have the <microhttpd.h> header file. */ /* Define to 1 if you have the <microhttpd.h> header file. */
#define HAVE_MICROHTTPD_H 1 #define HAVE_MICROHTTPD_H 1
/* Define to 1 if you have the `mkdir' function. */
#define HAVE_MKDIR 1
/* Define to 1 if you have the `mkfifo' function. */
#define HAVE_MKFIFO 1
/* Define to 1 if you have the `mktime' function. */
#define HAVE_MKTIME 1
/* Define to 1 if you have the `mmap' function. */
#define HAVE_MMAP 1
/* Define to 1 if you have the `mremap' function. */ /* Define to 1 if you have the `mremap' function. */
#define HAVE_MREMAP 1 #define HAVE_MREMAP 1
/* Define to 1 if you have the <mysql/mysql.h> header file. */ /* Define to 1 if you have the <mysql/mysql.h> header file. */
#define HAVE_MYSQL_MYSQL_H 1 #define HAVE_MYSQL_MYSQL_H 1
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* #undef HAVE_NDIR_H */ /* #undef HAVE_NDIR_H */
/* Define to 1 if you have the <netdb.h> header file. */ /* Define to 1 if you have the <netdb.h> header file. */
#define HAVE_NETDB_H 1 #define HAVE_NETDB_H 1
/* Define to 1 if you have the <netinet/in.h> header file. */ /* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1 #define HAVE_NETINET_IN_H 1
/* Define to 1 if you have the <netinet/in_systm.h> header file. */ /* Define to 1 if you have the <netinet/in_systm.h> header file. */
#define HAVE_NETINET_IN_SYSTM_H 1 #define HAVE_NETINET_IN_SYSTM_H 1
/* Define to 1 if you have the `nl_langinfo' function. */
#define HAVE_NL_LANGINFO 1
/* Define to 1 if you have the <nss.h> header file. */ /* Define to 1 if you have the <nss.h> header file. */
#define HAVE_NSS_H 1 #define HAVE_NSS_H 1
/* Define to 1 if the system has the type `off_t'. */ /* Define to 1 if the system has the type `off_t'. */
#define HAVE_OFF_T 1 #define HAVE_OFF_T 1
/* Define to 1 if you have the `opendir' function. */ /* Define to 1 if you have the `opendir' function. */
#define HAVE_OPENDIR 1 #define HAVE_OPENDIR 1
/* Define to 1 if you have the <postgresql/libpq-fe.h> header file. */ /* Define to 1 if you have the <postgresql/libpq-fe.h> header file. */
/* #undef HAVE_POSTGRESQL_LIBPQ_FE_H */ /* #undef HAVE_POSTGRESQL_LIBPQ_FE_H */
/* Define if libtool can extract symbol lists from object files. */ /* Define if libtool can extract symbol lists from object files. */
#define HAVE_PRELOADED_SYMBOLS 1 #define HAVE_PRELOADED_SYMBOLS 1
/* Define to 1 if you have the `putenv' function. */
#define HAVE_PUTENV 1
/* Define to 1 if you have the `rand' function. */
#define HAVE_RAND 1
/* Define to 1 if you have the `readdir' function. */ /* Define to 1 if you have the `readdir' function. */
#define HAVE_READDIR 1 #define HAVE_READDIR 1
/* Define to 1 if you have the `realpath' function. */
#define HAVE_REALPATH 1
/* Define to 1 if you have the `rmdir' function. */
#define HAVE_RMDIR 1
/* Define to 1 if you have the `sbrk' function. */
#define HAVE_SBRK 1
/* Define this if select() is available */ /* Define this if select() is available */
#define HAVE_SELECT 1 /* #undef HAVE_SELECT */
/* Define to 1 if you have the `setlocale' function. */
#define HAVE_SETLOCALE 1
/* Define to 1 if you have the `setresuid' function. */ /* Define to 1 if you have the `setresuid' function. */
#define HAVE_SETRESUID 1 #define HAVE_SETRESUID 1
/* Define to 1 if you have the `setrlimit' function. */ /* Define to 1 if you have the `setrlimit' function. */
#define HAVE_SETRLIMIT 1 #define HAVE_SETRLIMIT 1
/* Define if you have the shl_load function. */ /* Define if you have the shl_load function. */
/* #undef HAVE_SHL_LOAD */ /* #undef HAVE_SHL_LOAD */
skipping to change at line 412 skipping to change at line 379
/* Define to 1 if the system has the type `sigset_t'. */ /* Define to 1 if the system has the type `sigset_t'. */
#define HAVE_SIGSET_T 1 #define HAVE_SIGSET_T 1
/* Define to 1 if the system has the type `size_t'. */ /* Define to 1 if the system has the type `size_t'. */
#define HAVE_SIZE_T 1 #define HAVE_SIZE_T 1
/* Do we have sockaddr_in.sin_len? */ /* Do we have sockaddr_in.sin_len? */
/* #undef HAVE_SOCKADDR_IN_SIN_LEN */ /* #undef HAVE_SOCKADDR_IN_SIN_LEN */
/* Define this if socket() is available */ /* Define this if socket() is available */
#define HAVE_SOCKET 1 /* #undef HAVE_SOCKET */
/* Define to 1 if you have the <sockLib.h> header file. */ /* Define to 1 if you have the <sockLib.h> header file. */
/* #undef HAVE_SOCKLIB_H */ /* #undef HAVE_SOCKLIB_H */
/* Define to 1 if you have the <sqlite3.h> header file. */ /* Define to 1 if you have the <sqlite3.h> header file. */
#define HAVE_SQLITE3_H 1 #define HAVE_SQLITE3_H 1
/* Define to 1 if you have the `stat64' function. */ /* Define to 1 if you have the `stat64' function. */
#define HAVE_STAT64 1 #define HAVE_STAT64 1
skipping to change at line 445 skipping to change at line 412
/* Define to 1 if you have the <stdint.h> header file. */ /* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1 #define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdio.h> header file. */ /* Define to 1 if you have the <stdio.h> header file. */
#define HAVE_STDIO_H 1 #define HAVE_STDIO_H 1
/* Define to 1 if you have the <stdlib.h> header file. */ /* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1 #define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strcasecmp' function. */
#define HAVE_STRCASECMP 1
/* Define to 1 if you have the `strchr' function. */
#define HAVE_STRCHR 1
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1
/* Define to 1 if you have the `strftime' function. */ /* Define to 1 if you have the `strftime' function. */
#define HAVE_STRFTIME 1 #define HAVE_STRFTIME 1
/* Define to 1 if you have the <strings.h> header file. */ /* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1 #define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */ /* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1 #define HAVE_STRING_H 1
/* Define to 1 if you have the `strlcat' function. */ /* Define to 1 if you have the `strlcat' function. */
/* #undef HAVE_STRLCAT */ /* #undef HAVE_STRLCAT */
/* Define to 1 if you have the `strlcpy' function. */ /* Define to 1 if you have the `strlcpy' function. */
/* #undef HAVE_STRLCPY */ /* #undef HAVE_STRLCPY */
/* Define to 1 if you have the `strncasecmp' function. */
#define HAVE_STRNCASECMP 1
/* Define to 1 if you have the `strndup' function. */ /* Define to 1 if you have the `strndup' function. */
#define HAVE_STRNDUP 1 #define HAVE_STRNDUP 1
/* Define to 1 if you have the `strrchr' function. */ /* Define to 1 if you have the `strnlen' function. */
#define HAVE_STRRCHR 1 #define HAVE_STRNLEN 1
/* Define to 1 if you have the `strstr' function. */
#define HAVE_STRSTR 1
/* Define to 1 if you have the `strtol' function. */
#define HAVE_STRTOL 1
/* Define to 1 if you have the `sysconf' function. */ /* Define to 1 if you have the `sysconf' function. */
#define HAVE_SYSCONF 1 #define HAVE_SYSCONF 1
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR '. /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR '.
*/ */
/* #undef HAVE_SYS_DIR_H */ /* #undef HAVE_SYS_DIR_H */
/* Define to 1 if you have the <sys/dl.h> header file. */ /* Define to 1 if you have the <sys/dl.h> header file. */
/* #undef HAVE_SYS_DL_H */ /* #undef HAVE_SYS_DL_H */
skipping to change at line 564 skipping to change at line 510
/* Define to 1 if you have the <terminos.h> header file. */ /* Define to 1 if you have the <terminos.h> header file. */
/* #undef HAVE_TERMINOS_H */ /* #undef HAVE_TERMINOS_H */
/* Define to 1 if you have the <ucred.h> header file. */ /* Define to 1 if you have the <ucred.h> header file. */
/* #undef HAVE_UCRED_H */ /* #undef HAVE_UCRED_H */
/* We can access-64 bit values that are only 32-bit aligned */ /* We can access-64 bit values that are only 32-bit aligned */
#define HAVE_UNALIGNED_64_ACCESS 0 #define HAVE_UNALIGNED_64_ACCESS 0
/* Define to 1 if you have the `uname' function. */
#define HAVE_UNAME 1
/* Define to 1 if you have the <unistd.h> header file. */ /* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1 #define HAVE_UNISTD_H 1
/* Define to 1 if you have the `vfork' function. */ /* Define to 1 if you have the `vfork' function. */
#define HAVE_VFORK 1 #define HAVE_VFORK 1
/* Define to 1 if you have the <vfork.h> header file. */ /* Define to 1 if you have the <vfork.h> header file. */
/* #undef HAVE_VFORK_H */ /* #undef HAVE_VFORK_H */
/* Define to 1 if you have the `vprintf' function. */ /* Define to 1 if you have the `vprintf' function. */
skipping to change at line 657 skipping to change at line 600
/* Defined if libcurl supports SMTP */ /* Defined if libcurl supports SMTP */
#define LIBCURL_PROTOCOL_SMTP 1 #define LIBCURL_PROTOCOL_SMTP 1
/* Defined if libcurl supports TELNET */ /* Defined if libcurl supports TELNET */
#define LIBCURL_PROTOCOL_TELNET 1 #define LIBCURL_PROTOCOL_TELNET 1
/* Defined if libcurl supports TFTP */ /* Defined if libcurl supports TFTP */
#define LIBCURL_PROTOCOL_TFTP 1 #define LIBCURL_PROTOCOL_TFTP 1
/* This is a Linux system */ /* Define to 1 if you want IDN support. */
#define LIBIDN 1
/* This is a Linux kernel */
#define LINUX 1 #define LINUX 1
/* Define to 1 if `lstat' dereferences a symlink specified with a trailing /* Define to 1 if `lstat' dereferences a symlink specified with a trailing
slash. */ slash. */
#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
/* Define if the OS needs help to load dependent libraries for dlopen(). */ /* Define if the OS needs help to load dependent libraries for dlopen(). */
/* #undef LTDL_DLOPEN_DEPLIBS */ /* #undef LTDL_DLOPEN_DEPLIBS */
/* Define to the system default library search path. */ /* Define to the system default library search path. */
#define LT_DLSEARCH_PATH "/lib:/usr/lib:/usr/lib/atlas-sse:/usr/lib/atlas-s se3:/usr/lib/atlas:/usr/lib/paraview-mpi" #define LT_DLSEARCH_PATH "/lib:/usr/lib:/usr/lib/atlas-sse:/usr/lib/atlas-s se3:/usr/lib/atlas:/usr/lib/paraview-mpi"
/* The archive extension */ /* The archive extension */
#define LT_LIBEXT "a" #define LT_LIBEXT "a"
/* The archive prefix */
#define LT_LIBPREFIX "lib"
/* Define to the extension used for runtime loadable modules, say, ".so". * / /* Define to the extension used for runtime loadable modules, say, ".so". * /
#define LT_MODULE_EXT ".so" #define LT_MODULE_EXT ".so"
/* Define to the name of the environment variable that determines the run-t ime /* Define to the name of the environment variable that determines the run-t ime
module search path. */ module search path. */
#define LT_MODULE_PATH_VAR "LD_LIBRARY_PATH" #define LT_MODULE_PATH_VAR "LD_LIBRARY_PATH"
/* Define to the sub-directory in which libtool stores uninstalled librarie s. /* Define to the sub-directory in which libtool stores uninstalled librarie s.
*/ */
#define LT_OBJDIR ".libs/" #define LT_OBJDIR ".libs/"
/* Define to the shared library suffix, say, ".dylib". */
/* #undef LT_SHARED_EXT */
/* This is a MinGW system */ /* This is a MinGW system */
/* #undef MINGW */ /* #undef MINGW */
/* required libgcrypt version */
#define NEED_LIBGCRYPT_VERSION "1.4.2"
/* Define if dlsym() requires a leading underscore in symbol names. */ /* Define if dlsym() requires a leading underscore in symbol names. */
/* #undef NEED_USCORE */ /* #undef NEED_USCORE */
/* This is a NetBSD system */ /* This is a NetBSD system */
/* #undef NETBSD */ /* #undef NETBSD */
/* Define to 1 if your C compiler doesn't accept -c and -o together. */ /* Define to 1 if your C compiler doesn't accept -c and -o together. */
/* #undef NO_MINUS_C_MINUS_O */ /* #undef NO_MINUS_C_MINUS_O */
/* This is an OpenBSD system */ /* This is an OpenBSD system */
skipping to change at line 712 skipping to change at line 667
/* Name of package */ /* Name of package */
#define PACKAGE "gnunet" #define PACKAGE "gnunet"
/* Define to the address where bug reports for this package should be sent. */ /* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "bug-gnunet@gnu.org" #define PACKAGE_BUGREPORT "bug-gnunet@gnu.org"
/* Define to the full name of this package. */ /* Define to the full name of this package. */
#define PACKAGE_NAME "gnunet" #define PACKAGE_NAME "gnunet"
/* Define to the full name and version of this package. */ /* Define to the full name and version of this package. */
#define PACKAGE_STRING "gnunet 0.9.3" #define PACKAGE_STRING "gnunet 0.9.4"
/* Define to the one symbol short name of this package. */ /* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "gnunet" #define PACKAGE_TARNAME "gnunet"
/* Define to the home page for this package. */ /* Define to the home page for this package. */
#define PACKAGE_URL "" #define PACKAGE_URL ""
/* Define to the version of this package. */ /* Define to the version of this package. */
#define PACKAGE_VERSION "0.9.3" #define PACKAGE_VERSION "0.9.4"
/* Define as the return type of signal handlers (`int' or `void'). */ /* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void #define RETSIGTYPE void
/* Define to the type of arg 1 for `select'. */ /* Define to the type of arg 1 for `select'. */
#define SELECT_TYPE_ARG1 int #define SELECT_TYPE_ARG1 int
/* Define to the type of args 2, 3 and 4 for `select'. */ /* Define to the type of args 2, 3 and 4 for `select'. */
#define SELECT_TYPE_ARG234 (fd_set *) #define SELECT_TYPE_ARG234 (fd_set *)
skipping to change at line 754 skipping to change at line 709
/* Define to 1 if you have the ANSI C header files. */ /* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1 #define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1 #define TIME_WITH_SYS_TIME 1
/* Define to 1 if your <sys/time.h> declares `struct tm'. */ /* Define to 1 if your <sys/time.h> declares `struct tm'. */
/* #undef TM_IN_SYS_TIME */ /* #undef TM_IN_SYS_TIME */
/* Version number of package */ /* Version number of package */
#define VERSION "0.9.3" #define VERSION "0.9.4"
/* This is a Windows system */ /* This is a Windows system */
/* #undef WINDOWS */ /* #undef WINDOWS */
/* Define to 1 if the X Window System is missing or not being used. */ /* Define to 1 if the X Window System is missing or not being used. */
/* #undef X_DISPLAY_MISSING */ /* #undef X_DISPLAY_MISSING */
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */ /* Number of bits in a file offset, on hosts where this is settable. */
#define _FILE_OFFSET_BITS 64 #define _FILE_OFFSET_BITS 64
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
/* #undef _LARGEFILE_SOURCE */ /* #undef _LARGEFILE_SOURCE */
/* Define for large files, on AIX-style hosts. */ /* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */ /* #undef _LARGE_FILES */
/* Need with solaris or errno doesnt work */ /* Need with solaris or errno doesnt work */
 End of changes. 37 change blocks. 
101 lines changed or deleted 61 lines changed or added


 gnunet_configuration_lib.h   gnunet_configuration_lib.h 
skipping to change at line 109 skipping to change at line 109
* *
* @param cfg configuration to update * @param cfg configuration to update
* @param filename name of the configuration file * @param filename name of the configuration file
* @return GNUNET_OK on success, GNUNET_SYSERR on error * @return GNUNET_OK on success, GNUNET_SYSERR on error
*/ */
int int
GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
const char *filename); const char *filename);
/** /**
* Serializes the given configuration.
*
* @param cfg configuration to serialize
* @param size will be set to the size of the serialized memory block
* @return the memory block where the serialized configuration is
* present. This memory should be freed by the caller
*/
char *
GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *c
fg,
size_t *size);
/**
* De-serializes configuration
*
* @param cfg configuration to update
* @param mem the memory block of serialized configuration
* @param size the size of the memory block
* @param allow_inline set to GNUNET_YES if we recursively load configurati
on
* from inlined configurations; GNUNET_NO if not and raise warning
s
* when we come across them
* @return GNUNET_OK on success, GNUNET_ERROR on error
*/
int
GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg,
const char *mem,
const size_t size,
int allow_inline);
/**
* Write configuration file. * Write configuration file.
* *
* @param cfg configuration to write * @param cfg configuration to write
* @param filename where to write the configuration * @param filename where to write the configuration
* @return GNUNET_OK on success, GNUNET_SYSERR on error * @return GNUNET_OK on success, GNUNET_SYSERR on error
*/ */
int int
GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg,
const char *filename); const char *filename);
 End of changes. 1 change blocks. 
0 lines changed or deleted 32 lines changed or added


 gnunet_constants.h   gnunet_constants.h 
skipping to change at line 55 skipping to change at line 55
*/ */
#define GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT GNUNET_BANDWIDTH_value_init (102 4) #define GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT GNUNET_BANDWIDTH_value_init (102 4)
/** /**
* After how long do we consider a connection to a peer dead * After how long do we consider a connection to a peer dead
* if we don't receive messages from the peer? * if we don't receive messages from the peer?
*/ */
#define GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT GNUNET_TIME_relative_multi ply (GNUNET_TIME_UNIT_MINUTES, 5) #define GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT GNUNET_TIME_relative_multi ply (GNUNET_TIME_UNIT_MINUTES, 5)
/** /**
* After how long do we consider a connection to a peer dead
* if we got an explicit disconnect and were unable to reconnect?
*/
#define GNUNET_CONSTANTS_DISCONNECT_SESSION_TIMEOUT GNUNET_TIME_relative_mu
ltiply (GNUNET_TIME_UNIT_SECONDS, 3)
/**
* How long do we delay reading more from a peer after a quota violation? * How long do we delay reading more from a peer after a quota violation?
*/ */
#define GNUNET_CONSTANTS_QUOTA_VIOLATION_TIMEOUT GNUNET_TIME_relative_multi ply (GNUNET_TIME_UNIT_SECONDS, 2) #define GNUNET_CONSTANTS_QUOTA_VIOLATION_TIMEOUT GNUNET_TIME_relative_multi ply (GNUNET_TIME_UNIT_SECONDS, 2)
/** /**
* How long do we wait after a FORK+EXEC before testing for the
* resulting process to be up (port open, waitpid, etc.)?
*/
#define GNUNET_CONSTANTS_EXEC_WAIT GNUNET_TIME_relative_multiply (GNUNET_TI
ME_UNIT_MILLISECONDS, 200)
/**
* After how long do we retry a service connection that was
* unavailable? Used in cases where an exponential back-off
* seems inappropriate.
*/
#define GNUNET_CONSTANTS_SERVICE_RETRY GNUNET_TIME_relative_multiply (GNUNE
T_TIME_UNIT_MILLISECONDS, 500)
/**
* After how long do we consider a service unresponsive * After how long do we consider a service unresponsive
* even if we assume that the service commonly does not * even if we assume that the service commonly does not
* respond instantly (DNS, Database, etc.). * respond instantly (DNS, Database, etc.).
*/ */
#define GNUNET_CONSTANTS_SERVICE_TIMEOUT GNUNET_TIME_relative_multiply (GNU NET_TIME_UNIT_MINUTES, 10) #define GNUNET_CONSTANTS_SERVICE_TIMEOUT GNUNET_TIME_relative_multiply (GNU NET_TIME_UNIT_MINUTES, 10)
/** /**
* How long do we delay messages to get larger packet sizes (CORKing)? * How long do we delay messages to get larger packet sizes (CORKing)?
*/ */
#define GNUNET_CONSTANTS_MAX_CORK_DELAY GNUNET_TIME_relative_multiply (GNUN ET_TIME_UNIT_SECONDS, 1) #define GNUNET_CONSTANTS_MAX_CORK_DELAY GNUNET_TIME_relative_multiply (GNUN ET_TIME_UNIT_SECONDS, 1)
skipping to change at line 117 skipping to change at line 98
* After how long do we expire an address in a HELLO that we just * After how long do we expire an address in a HELLO that we just
* validated? This value is also used for our own addresses when we * validated? This value is also used for our own addresses when we
* create a HELLO. * create a HELLO.
*/ */
#define GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION GNUNET_TIME_relative_mult iply (GNUNET_TIME_UNIT_HOURS, 12) #define GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION GNUNET_TIME_relative_mult iply (GNUNET_TIME_UNIT_HOURS, 12)
/** /**
* Size of the 'struct EncryptedMessage' of the core (which * Size of the 'struct EncryptedMessage' of the core (which
* is the per-message overhead of the core). * is the per-message overhead of the core).
*/ */
#define GNUNET_CONSTANTS_CORE_SIZE_ENCRYPTED_MESSAGE (24 + sizeof (GNUNET_H #define GNUNET_CONSTANTS_CORE_SIZE_ENCRYPTED_MESSAGE (24 + sizeof (struct G
ashCode)) NUNET_HashCode))
/**
* Size of the 'struct OutboundMessage' of the transport
* (which, in combination with the
* GNUNET_CONSTANTS_CORE_SIZE_ENCRYPTED_MESSAGE) defines
* the headers that must be pre-pendable to all GNUnet
* messages. Taking GNUNET_SERVER_MAX_MESSAGE_SIZE
* and subtracting these two constants defines the largest
* message core can handle.
*/
#define GNUNET_CONSTANTS_TRANSPORT_SIZE_OUTBOUND_MESSAGE (16 + sizeof (stru
ct GNUNET_PeerIdentity))
/** /**
* What is the maximum size for encrypted messages? Note that this * What is the maximum size for encrypted messages? Note that this
* number imposes a clear limit on the maximum size of any message. * number imposes a clear limit on the maximum size of any message.
* Set to a value close to 64k but not so close that transports will * Set to a value close to 64k but not so close that transports will
* have trouble with their headers. * have trouble with their headers.
* *
* Could theoretically be 64k minus (GNUNET_CONSTANTS_CORE_SIZE_ENCRYPTED_M ESSAGE + * Could theoretically be 64k minus (GNUNET_CONSTANTS_CORE_SIZE_ENCRYPTED_M ESSAGE +
* GNUNET_CONSTANTS_TRANSPORT_SIZE_OUTBOUND_MESSAGE), but we're going * GNUNET_CONSTANTS_TRANSPORT_SIZE_OUTBOUND_MESSAGE), but we're going
* to be more conservative for now. * to be more conservative for now.
 End of changes. 3 change blocks. 
36 lines changed or deleted 2 lines changed or added


 gnunet_container_lib.h   gnunet_container_lib.h 
skipping to change at line 64 skipping to change at line 64
struct GNUNET_CONTAINER_BloomFilter; struct GNUNET_CONTAINER_BloomFilter;
/** /**
* Iterator over HashCodes. * Iterator over HashCodes.
* *
* @param cls closure * @param cls closure
* @param next set to the next hash code * @param next set to the next hash code
* @return GNUNET_YES if next was updated * @return GNUNET_YES if next was updated
* GNUNET_NO if there are no more entries * GNUNET_NO if there are no more entries
*/ */
typedef int (*GNUNET_HashCodeIterator) (void *cls, GNUNET_HashCode * next); typedef int (*GNUNET_HashCodeIterator) (void *cls, struct GNUNET_HashCode * next);
/** /**
* Load a bloom-filter from a file. * Load a bloom-filter from a file.
* *
* @param filename the name of the file (or the prefix) * @param filename the name of the file (or the prefix)
* @param size the size of the bloom-filter (number of * @param size the size of the bloom-filter (number of
* bytes of storage space to use); will be rounded up * bytes of storage space to use); will be rounded up
* to next power of 2 * to next power of 2
* @param k the number of GNUNET_CRYPTO_hash-functions to apply per * @param k the number of GNUNET_CRYPTO_hash-functions to apply per
* element (number of bits set per element in the set) * element (number of bits set per element in the set)
skipping to change at line 119 skipping to change at line 119
char *data, size_t size); char *data, size_t size);
/** /**
* Test if an element is in the filter. * Test if an element is in the filter.
* @param e the element * @param e the element
* @param bf the filter * @param bf the filter
* @return GNUNET_YES if the element is in the filter, GNUNET_NO if not * @return GNUNET_YES if the element is in the filter, GNUNET_NO if not
*/ */
int int
GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilte r GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilte r
*bf, const GNUNET_HashCode * e); *bf, const struct GNUNET_HashCode * e);
/** /**
* Add an element to the filter * Add an element to the filter
* @param bf the filter * @param bf the filter
* @param e the element * @param e the element
*/ */
void void
GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter *bf, GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter *bf,
const GNUNET_HashCode * e); const struct GNUNET_HashCode * e);
/** /**
* Remove an element from the filter. * Remove an element from the filter.
* @param bf the filter * @param bf the filter
* @param e the element to remove * @param e the element to remove
*/ */
void void
GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter *b f, GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter *b f,
const GNUNET_HashCode * e); const struct GNUNET_HashCode * e);
/** /**
* Create a copy of a bloomfilter. * Create a copy of a bloomfilter.
* *
* @param bf the filter * @param bf the filter
* @return copy of bf * @return copy of bf
*/ */
struct GNUNET_CONTAINER_BloomFilter * struct GNUNET_CONTAINER_BloomFilter *
GNUNET_CONTAINER_bloomfilter_copy (const struct GNUNET_CONTAINER_BloomFilte r GNUNET_CONTAINER_bloomfilter_copy (const struct GNUNET_CONTAINER_BloomFilte r
*bf); *bf);
skipping to change at line 284 skipping to change at line 284
* @param md metadata to extend * @param md metadata to extend
* @param plugin_name name of the plugin that produced this value; * @param plugin_name name of the plugin that produced this value;
* special values can be used (i.e. '&lt;zlib&gt;' for zlib being * special values can be used (i.e. '&lt;zlib&gt;' for zlib being
* used in the main libextractor library and yielding * used in the main libextractor library and yielding
* meta data). * meta data).
* @param type libextractor-type describing the meta data * @param type libextractor-type describing the meta data
* @param format basic format information about data * @param format basic format information about data
* @param data_mime_type mime-type of data (not of the original file); * @param data_mime_type mime-type of data (not of the original file);
* can be NULL (if mime-type is not known) * can be NULL (if mime-type is not known)
* @param data actual meta-data found * @param data actual meta-data found
* @param data_len number of bytes in data * @param data_size number of bytes in data
* @return GNUNET_OK on success, GNUNET_SYSERR if this entry already exists * @return GNUNET_OK on success, GNUNET_SYSERR if this entry already exists
* data_mime_type and plugin_name are not considered for "exists" c hecks * data_mime_type and plugin_name are not considered for "exists" c hecks
*/ */
int int
GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md, GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md,
const char *plugin_name, const char *plugin_name,
enum EXTRACTOR_MetaType type, enum EXTRACTOR_MetaType type,
enum EXTRACTOR_MetaFormat format, enum EXTRACTOR_MetaFormat format,
const char *data_mime_type, const char * data, const char *data_mime_type, const char * data,
size_t data_len); size_t data_size);
/** /**
* Extend metadata. Merges the meta data from the second argument * Extend metadata. Merges the meta data from the second argument
* into the first, discarding duplicate key-value pairs. * into the first, discarding duplicate key-value pairs.
* *
* @param md metadata to extend * @param md metadata to extend
* @param in metadata to merge * @param in metadata to merge
*/ */
void void
GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md, GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md,
const struct GNUNET_CONTAINER_MetaData *i n); const struct GNUNET_CONTAINER_MetaData *i n);
/** /**
* Remove an item. * Remove an item.
* *
* @param md metadata to manipulate * @param md metadata to manipulate
* @param type type of the item to remove * @param type type of the item to remove
* @param data specific value to remove, NULL to remove all * @param data specific value to remove, NULL to remove all
* entries of the given type * entries of the given type
* @param data_len number of bytes in data * @param data_size number of bytes in data
* @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist i n md * @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist i n md
*/ */
int int
GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md, GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md,
enum EXTRACTOR_MetaType type, enum EXTRACTOR_MetaType type,
const char *data, size_t data_len); const char *data, size_t data_size);
/** /**
* Remove all items in the container. * Remove all items in the container.
* *
* @param md metadata to manipulate * @param md metadata to manipulate
*/ */
void void
GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md); GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md);
/** /**
skipping to change at line 511 skipping to change at line 511
* Iterator over hash map entries. * Iterator over hash map entries.
* *
* @param cls closure * @param cls closure
* @param key current key code * @param key current key code
* @param value value in the hash map * @param value value in the hash map
* @return GNUNET_YES if we should continue to * @return GNUNET_YES if we should continue to
* iterate, * iterate,
* GNUNET_NO if not. * GNUNET_NO if not.
*/ */
typedef int (*GNUNET_CONTAINER_HashMapIterator) (void *cls, typedef int (*GNUNET_CONTAINER_HashMapIterator) (void *cls,
const GNUNET_HashCode * ke y, const struct GNUNET_HashCo de * key,
void *value); void *value);
/** /**
* Create a multi hash map. * Create a multi hash map.
* *
* @param len initial size (map will grow as needed) * @param len initial size (map will grow as needed)
* @param do_not_copy_keys GNUNET_NO is always safe and should be used by d
efault;
* GNUNET_YES means that on 'put', the 'key' does n
ot have
* to be copied as the destination of the pointer i
s
* guaranteed to be life as long as the value is st
ored in
* the hashmap. This can significantly reduce memo
ry
* consumption, but of course is also a recipie for
* heap corruption if the assumption is not true.
Only
* use this if (1) memory use is important in this
case and
* (2) you have triple-checked that the invariant h
olds
* @return NULL on error * @return NULL on error
*/ */
struct GNUNET_CONTAINER_MultiHashMap * struct GNUNET_CONTAINER_MultiHashMap *
GNUNET_CONTAINER_multihashmap_create (unsigned int len); GNUNET_CONTAINER_multihashmap_create (unsigned int len,
int do_not_copy_keys);
/** /**
* Destroy a hash map. Will not free any values * Destroy a hash map. Will not free any values
* stored in the hash map! * stored in the hash map!
* *
* @param map the map * @param map the map
*/ */
void void
GNUNET_CONTAINER_multihashmap_destroy (struct GNUNET_CONTAINER_MultiHashMap GNUNET_CONTAINER_multihashmap_destroy (struct GNUNET_CONTAINER_MultiHashMap
*map); *map);
skipping to change at line 545 skipping to change at line 555
* *
* @param map the map * @param map the map
* @param key what to look for * @param key what to look for
* @return NULL if no value was found; note that * @return NULL if no value was found; note that
* this is indistinguishable from values that just * this is indistinguishable from values that just
* happen to be NULL; use "contains" to test for * happen to be NULL; use "contains" to test for
* key-value pairs with value NULL * key-value pairs with value NULL
*/ */
void * void *
GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashM ap GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashM ap
*map, const GNUNET_HashCode * key); *map, const struct GNUNET_HashCode * key );
/** /**
* Remove the given key-value pair from the map. Note that if the * Remove the given key-value pair from the map. Note that if the
* key-value pair is in the map multiple times, only one of the pairs * key-value pair is in the map multiple times, only one of the pairs
* will be removed. * will be removed.
* *
* @param map the map * @param map the map
* @param key key of the key-value pair * @param key key of the key-value pair
* @param value value of the key-value pair * @param value value of the key-value pair
* @return GNUNET_YES on success, GNUNET_NO if the key-value pair * @return GNUNET_YES on success, GNUNET_NO if the key-value pair
* is not in the map * is not in the map
*/ */
int int
GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map,
const GNUNET_HashCode * key, void *va lue); const struct GNUNET_HashCode * key, v oid *value);
/** /**
* Remove all entries for the given key from the map. * Remove all entries for the given key from the map.
* Note that the values would not be "freed". * Note that the values would not be "freed".
* *
* @param map the map * @param map the map
* @param key identifies values to be removed * @param key identifies values to be removed
* @return number of values removed * @return number of values removed
*/ */
int int
GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHash Map GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHash Map
*map, const GNUNET_HashCode * key ); *map, const struct GNUNET_HashCod e * key);
/** /**
* Check if the map contains any value under the given * Check if the map contains any value under the given
* key (including values that are NULL). * key (including values that are NULL).
* *
* @param map the map * @param map the map
* @param key the key to test if a value exists for it * @param key the key to test if a value exists for it
* @return GNUNET_YES if such a value exists, * @return GNUNET_YES if such a value exists,
* GNUNET_NO if not * GNUNET_NO if not
*/ */
int int
GNUNET_CONTAINER_multihashmap_contains (const struct GNUNET_CONTAINER_multihashmap_contains (const struct
GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MultiHashMap *map,
const GNUNET_HashCode * key); const struct GNUNET_HashCode * key) ;
/** /**
* Check if the map contains the given value under the given * Check if the map contains the given value under the given
* key. * key.
* *
* @param map the map * @param map the map
* @param key the key to test if a value exists for it * @param key the key to test if a value exists for it
* @param value value to test for * @param value value to test for
* @return GNUNET_YES if such a value exists, * @return GNUNET_YES if such a value exists,
* GNUNET_NO if not * GNUNET_NO if not
*/ */
int int
GNUNET_CONTAINER_multihashmap_contains_value (const struct GNUNET_CONTAINER_multihashmap_contains_value (const struct
GNUNET_CONTAINER_MultiHashMap GNUNET_CONTAINER_MultiHashMap
*map, const GNUNET_HashCode * key, *map, const struct GNUNET_Has hCode * key,
const void *value); const void *value);
/** /**
* Store a key-value pair in the map. * Store a key-value pair in the map.
* *
* @param map the map * @param map the map
* @param key key to use * @param key key to use
* @param value value to use * @param value value to use
* @param opt options for put * @param opt options for put
* @return GNUNET_OK on success, * @return GNUNET_OK on success,
* GNUNET_NO if a value was replaced (with REPLACE) * GNUNET_NO if a value was replaced (with REPLACE)
* GNUNET_SYSERR if UNIQUE_ONLY was the option and the * GNUNET_SYSERR if UNIQUE_ONLY was the option and the
* value already exists * value already exists
*/ */
int int
GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *ma p, GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *ma p,
const GNUNET_HashCode * key, void *value , const struct GNUNET_HashCode * key, void *value,
enum GNUNET_CONTAINER_MultiHashMapOption enum GNUNET_CONTAINER_MultiHashMapOption
opt); opt);
/** /**
* Get the number of key-value pairs in the map. * Get the number of key-value pairs in the map.
* *
* @param map the map * @param map the map
* @return the number of key value pairs * @return the number of key value pairs
*/ */
unsigned int unsigned int
skipping to change at line 660 skipping to change at line 670
* @param map the map * @param map the map
* @param key key that the entries must correspond to * @param key key that the entries must correspond to
* @param it function to call on each entry * @param it function to call on each entry
* @param it_cls extra argument to it * @param it_cls extra argument to it
* @return the number of key value pairs processed, * @return the number of key value pairs processed,
* GNUNET_SYSERR if it aborted iteration * GNUNET_SYSERR if it aborted iteration
*/ */
int int
GNUNET_CONTAINER_multihashmap_get_multiple (const struct GNUNET_CONTAINER_multihashmap_get_multiple (const struct
GNUNET_CONTAINER_MultiHashMap * map, GNUNET_CONTAINER_MultiHashMap * map,
const GNUNET_HashCode * key, const struct GNUNET_HashCode * key,
GNUNET_CONTAINER_HashMapIterato r it, GNUNET_CONTAINER_HashMapIterato r it,
void *it_cls); void *it_cls);
/* ******************** doubly-linked list *************** */ /* ******************** doubly-linked list *************** */
/* To avoid mistakes: head->prev == tail->next == NULL */ /* To avoid mistakes: head->prev == tail->next == NULL */
/** /**
* Insert an element at the head of a DLL. Assumes that head, tail and * Insert an element at the head of a DLL. Assumes that head, tail and
* element are structs with prev and next fields. * element are structs with prev and next fields.
* *
skipping to change at line 784 skipping to change at line 794
(head) = (element)->next; \ (head) = (element)->next; \
else \ else \
(element)->prev->next = (element)->next; \ (element)->prev->next = (element)->next; \
if ((element)->next == NULL) \ if ((element)->next == NULL) \
(tail) = (element)->prev; \ (tail) = (element)->prev; \
else \ else \
(element)->next->prev = (element)->prev; \ (element)->next->prev = (element)->prev; \
(element)->next = NULL; \ (element)->next = NULL; \
(element)->prev = NULL; } while (0) (element)->prev = NULL; } while (0)
/* ************ Multi-DLL interface, allows DLL elements to be
in multiple lists at the same time *********************** */
/**
* Insert an element at the head of a MDLL. Assumes that head, tail and
* element are structs with prev and next fields.
*
* @param mdll suffix name for the next and prev pointers in the element
* @param head pointer to the head of the MDLL
* @param tail pointer to the tail of the MDLL
* @param element element to insert
*/
#define GNUNET_CONTAINER_MDLL_insert(mdll,head,tail,element) do { \
GNUNET_assert ( ( (element)->prev_##mdll == NULL) && ((head) != (element)
)); \
GNUNET_assert ( ( (element)->next_##mdll == NULL) && ((tail) != (element)
)); \
(element)->next_##mdll = (head); \
(element)->prev_##mdll = NULL; \
if ((tail) == NULL) \
(tail) = element; \
else \
(head)->prev_##mdll = element; \
(head) = (element); } while (0)
/**
* Insert an element at the tail of a MDLL. Assumes that head, tail and
* element are structs with prev and next fields.
*
* @param mdll suffix name for the next and prev pointers in the element
* @param head pointer to the head of the MDLL
* @param tail pointer to the tail of the MDLL
* @param element element to insert
*/
#define GNUNET_CONTAINER_MDLL_insert_tail(mdll,head,tail,element) do { \
GNUNET_assert ( ( (element)->prev_##mdll == NULL) && ((head) != (element)
)); \
GNUNET_assert ( ( (element)->next_##mdll == NULL) && ((tail) != (element)
)); \
(element)->prev_##mdll = (tail); \
(element)->next_##mdll = NULL; \
if ((head) == NULL) \
(head) = element; \
else \
(tail)->next_##mdll = element; \
(tail) = (element); } while (0)
/**
* Insert an element into a MDLL after the given other element. Insert
* at the head if the other element is NULL.
*
* @param mdll suffix name for the next and prev pointers in the element
* @param head pointer to the head of the MDLL
* @param tail pointer to the tail of the MDLL
* @param other prior element, NULL for insertion at head of MDLL
* @param element element to insert
*/
#define GNUNET_CONTAINER_MDLL_insert_after(mdll,head,tail,other,element) do
{ \
GNUNET_assert ( ( (element)->prev_##mdll == NULL) && ((head) != (element)
)); \
GNUNET_assert ( ( (element)->next_##mdll == NULL) && ((tail) != (element)
)); \
(element)->prev_##mdll = (other); \
if (NULL == other) \
{ \
(element)->next_##mdll = (head); \
(head) = (element); \
} \
else \
{ \
(element)->next_##mdll = (other)->next_##mdll; \
(other)->next_##mdll = (element); \
} \
if (NULL == (element)->next_##mdll) \
(tail) = (element); \
else \
(element)->next->prev_##mdll = (element); } while (0)
/**
* Insert an element into a MDLL before the given other element. Insert
* at the tail if the other element is NULL.
*
* @param mdll suffix name for the next and prev pointers in the element
* @param head pointer to the head of the MDLL
* @param tail pointer to the tail of the MDLL
* @param other prior element, NULL for insertion at head of MDLL
* @param element element to insert
*/
#define GNUNET_CONTAINER_MDLL_insert_before(mdll,head,tail,other,element) d
o { \
GNUNET_assert ( ( (element)->prev_##mdll == NULL) && ((head) != (element)
)); \
GNUNET_assert ( ( (element)->next_##mdll == NULL) && ((tail) != (element)
)); \
(element)->next_##mdll = (other); \
if (NULL == other) \
{ \
(element)->prev = (tail); \
(tail) = (element); \
} \
else \
{ \
(element)->prev_##mdll = (other)->prev_##mdll; \
(other)->prev_##mdll = (element); \
} \
if (NULL == (element)->prev_##mdll) \
(head) = (element); \
else \
(element)->prev_##mdll->next_##mdll = (element); } while (0)
/**
* Remove an element from a MDLL. Assumes
* that head, tail and element are structs
* with prev and next fields.
*
* @param mdll suffix name for the next and prev pointers in the element
* @param head pointer to the head of the MDLL
* @param tail pointer to the tail of the MDLL
* @param element element to remove
*/
#define GNUNET_CONTAINER_MDLL_remove(mdll,head,tail,element) do { \
GNUNET_assert ( ( (element)->prev_##mdll != NULL) || ((head) == (element)
)); \
GNUNET_assert ( ( (element)->next_##mdll != NULL) || ((tail) == (element)
)); \
if ((element)->prev_##mdll == NULL) \
(head) = (element)->next_##mdll; \
else \
(element)->prev_##mdll->next_##mdll = (element)->next_##mdll; \
if ((element)->next_##mdll == NULL) \
(tail) = (element)->prev_##mdll; \
else \
(element)->next_##mdll->prev_##mdll = (element)->prev_##mdll; \
(element)->next_##mdll = NULL; \
(element)->prev_##mdll = NULL; } while (0)
/* ******************** Heap *************** */ /* ******************** Heap *************** */
/** /**
* Cost by which elements in a heap can be ordered. * Cost by which elements in a heap can be ordered.
*/ */
typedef uint64_t GNUNET_CONTAINER_HeapCostType; typedef uint64_t GNUNET_CONTAINER_HeapCostType;
/* /*
* Heap type, either max or min. Hopefully makes the * Heap type, either max or min. Hopefully makes the
* implementation more useful. * implementation more useful.
 End of changes. 19 change blocks. 
17 lines changed or deleted 172 lines changed or added


 gnunet_core_service.h   gnunet_core_service.h 
skipping to change at line 45 skipping to change at line 45
} }
#endif #endif
#endif #endif
#include "gnunet_util_lib.h" #include "gnunet_util_lib.h"
#include "gnunet_transport_service.h" #include "gnunet_transport_service.h"
/** /**
* Version number of GNUnet-core API. * Version number of GNUnet-core API.
*/ */
#define GNUNET_CORE_VERSION 0x00000000 #define GNUNET_CORE_VERSION 0x00000001
/** /**
* Opaque handle to the service. * Opaque handle to the service.
*/ */
struct GNUNET_CORE_Handle; struct GNUNET_CORE_Handle;
/** /**
* Method called whenever a given peer connects. * Method called whenever a given peer connects.
* *
* @param cls closure * @param cls closure
skipping to change at line 144 skipping to change at line 144
typedef void (*GNUNET_CORE_StartupCallback) (void *cls, typedef void (*GNUNET_CORE_StartupCallback) (void *cls,
struct GNUNET_CORE_Handle * se rver, struct GNUNET_CORE_Handle * se rver,
const struct GNUNET_PeerIdenti ty * const struct GNUNET_PeerIdenti ty *
my_identity); my_identity);
/** /**
* Connect to the core service. Note that the connection may complete * Connect to the core service. Note that the connection may complete
* (or fail) asynchronously. This function primarily causes the given * (or fail) asynchronously. This function primarily causes the given
* callback notification functions to be invoked whenever the * callback notification functions to be invoked whenever the
* specified event happens. The maximum number of queued * specified event happens. The maximum number of queued
* notifications (queue length) is per client but the queue is shared * notifications (queue length) is per client; the queue is shared
* across all types of notifications. So a slow client that registers * across all types of notifications. So a slow client that registers
* for 'outbound_notify' also risks missing 'inbound_notify' messages. * for 'outbound_notify' also risks missing 'inbound_notify' messages.
* Certain events (such as connect/disconnect notifications) are not * Certain events (such as connect/disconnect notifications) are not
* subject to queue size limitations. * subject to queue size limitations.
* *
* @param cfg configuration to use * @param cfg configuration to use
* @param queue_size size of the per-peer message queue
* @param cls closure for the various callbacks that follow (including hand lers in the handlers array) * @param cls closure for the various callbacks that follow (including hand lers in the handlers array)
* @param init callback to call once we have successfully * @param init callback to call once we have successfully
* connected to the core service * connected to the core service
* @param connects function to call on peer connect, can be NULL * @param connects function to call on peer connect, can be NULL
* @param disconnects function to call on peer disconnect / timeout, can be NULL * @param disconnects function to call on peer disconnect / timeout, can be NULL
* @param inbound_notify function to call for all inbound messages, can be NULL * @param inbound_notify function to call for all inbound messages, can be NULL
* note that the core is allowed to drop notifications about inbound * note that the core is allowed to drop notifications about inbound
* messages if the client does not process them fast enough (for this * messages if the client does not process them fast enough (for this
* notification type, a bounded queue is used) * notification type, a bounded queue is used)
* @param inbound_hdr_only set to GNUNET_YES if inbound_notify will only re ad the * @param inbound_hdr_only set to GNUNET_YES if inbound_notify will only re ad the
skipping to change at line 186 skipping to change at line 185
* notification type, a bounded queue is used) * notification type, a bounded queue is used)
* @param handlers callbacks for messages we care about, NULL-terminated * @param handlers callbacks for messages we care about, NULL-terminated
* note that the core is allowed to drop notifications about inbound * note that the core is allowed to drop notifications about inbound
* messages if the client does not process them fast enough (for this * messages if the client does not process them fast enough (for this
* notification type, a bounded queue is used) * notification type, a bounded queue is used)
* @return handle to the core service (only useful for disconnect until 'in it' is called), * @return handle to the core service (only useful for disconnect until 'in it' is called),
* NULL on error (in this case, init is never called) * NULL on error (in this case, init is never called)
*/ */
struct GNUNET_CORE_Handle * struct GNUNET_CORE_Handle *
GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
unsigned int queue_size, void *cls, void *cls,
GNUNET_CORE_StartupCallback init, GNUNET_CORE_StartupCallback init,
GNUNET_CORE_ConnectEventHandler connects, GNUNET_CORE_ConnectEventHandler connects,
GNUNET_CORE_DisconnectEventHandler disconnects, GNUNET_CORE_DisconnectEventHandler disconnects,
GNUNET_CORE_MessageCallback inbound_notify, GNUNET_CORE_MessageCallback inbound_notify,
int inbound_hdr_only, int inbound_hdr_only,
GNUNET_CORE_MessageCallback outbound_notify, GNUNET_CORE_MessageCallback outbound_notify,
int outbound_hdr_only, int outbound_hdr_only,
const struct GNUNET_CORE_MessageHandler *handlers); const struct GNUNET_CORE_MessageHandler *handlers);
/** /**
skipping to change at line 213 skipping to change at line 212
void void
GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle); GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle);
/** /**
* Handle for a transmission request. * Handle for a transmission request.
*/ */
struct GNUNET_CORE_TransmitHandle; struct GNUNET_CORE_TransmitHandle;
/** /**
* Ask the core to call "notify" once it is ready to transmit the * Ask the core to call "notify" once it is ready to transmit the
* given number of bytes to the specified "target". Must only be * given number of bytes to the specified "target". Must only be
* called after a connection to the respective peer has been * called after a connection to the respective peer has been
* established (and the client has been informed about this). * established (and the client has been informed about this). You may
* * have one request of this type pending for each connected peer at
* any time. If a peer disconnects, the application MUST call
* "GNUNET_CORE_notify_transmit_ready_cancel" on the respective
* transmission request, if one such request is pending.
* *
* @param handle connection to core service * @param handle connection to core service
* @param cork is corking allowed for this transmission? * @param cork is corking allowed for this transmission?
* @param priority how important is the message? * @param priority how important is the message?
* @param maxdelay how long can the message wait? * @param maxdelay how long can the message wait?
* @param target who should receive the message, never NULL (can be this pe er's identity for loopback) * @param target who should receive the message, never NULL (can be this pe er's identity for loopback)
* @param notify_size how many bytes of buffer space does notify want? * @param notify_size how many bytes of buffer space does notify want?
* @param notify function to call when buffer space is available; * @param notify function to call when buffer space is available;
* will be called with NULL on timeout or if the overall queue * will be called with NULL on timeout; clients MUST cancel
* for this peer is larger than queue_size and this is currently
* the message with the lowest priority; will also be called
* with 'NULL' buf if the peer disconnects; since the disconnect
* signal will be emmitted even later, clients MUST cancel
* all pending transmission requests DURING the disconnect * all pending transmission requests DURING the disconnect
* handler (unless they ensure that 'notify' never calls * handler
* 'GNUNET_CORE_notify_transmit_ready').
* @param notify_cls closure for notify * @param notify_cls closure for notify
* @return non-NULL if the notify callback was queued, * @return non-NULL if the notify callback was queued,
* NULL if we can not even queue the request (insufficient * NULL if we can not even queue the request (request already pendi
* memory); if NULL is returned, "notify" will NOT be called. ng);
* if NULL is returned, "notify" will NOT be called.
*/ */
struct GNUNET_CORE_TransmitHandle * struct GNUNET_CORE_TransmitHandle *
GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int c ork, GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int c ork,
uint32_t priority, uint32_t priority,
struct GNUNET_TIME_Relative maxdelay, struct GNUNET_TIME_Relative maxdelay,
const struct GNUNET_PeerIdentity *target , const struct GNUNET_PeerIdentity *target ,
size_t notify_size, size_t notify_size,
GNUNET_CONNECTION_TransmitReadyNotify no tify, GNUNET_CONNECTION_TransmitReadyNotify no tify,
void *notify_cls); void *notify_cls);
 End of changes. 9 change blocks. 
16 lines changed or deleted 14 lines changed or added


 gnunet_crypto_lib.h   gnunet_crypto_lib.h 
skipping to change at line 93 skipping to change at line 93
#define GNUNET_CRYPTO_RSA_DATA_ENCODING_LENGTH 256 #define GNUNET_CRYPTO_RSA_DATA_ENCODING_LENGTH 256
/** /**
* Length of an RSA KEY (n,e,len), 2048 bit (=256 octests) key n, 2 byte e * Length of an RSA KEY (n,e,len), 2048 bit (=256 octests) key n, 2 byte e
*/ */
#define GNUNET_CRYPTO_RSA_KEY_LENGTH 258 #define GNUNET_CRYPTO_RSA_KEY_LENGTH 258
/** /**
* Length of a hash value * Length of a hash value
*/ */
#define GNUNET_CRYPTO_HASH_LENGTH 512/8 #define GNUNET_CRYPTO_HASH_LENGTH (512/8)
/**
* Maximum length of an ECC signature.
* Note: round up to multiple of 8 minus 2 for alignment.
*/
#define GNUNET_CRYPTO_ECC_SIGNATURE_DATA_ENCODING_LENGTH 190
/**
* Maximum length of the public key (q-point, Q = dP) when encoded.
*/
#define GNUNET_CRYPTO_ECC_MAX_PUBLIC_KEY_LENGTH 140
/** /**
* The private information of an RSA key pair. * The private information of an RSA key pair.
*/ */
struct GNUNET_CRYPTO_RsaPrivateKey; struct GNUNET_CRYPTO_RsaPrivateKey;
/**
* The private information of an ECC private key.
*/
struct GNUNET_CRYPTO_EccPrivateKey;
GNUNET_NETWORK_STRUCT_BEGIN GNUNET_NETWORK_STRUCT_BEGIN
/** /**
* GNUnet mandates a certain format for the encoding * GNUnet mandates a certain format for the encoding
* of private RSA key information that is provided * of private RSA key information that is provided
* by the RSA implementations. This format is used * by the RSA implementations. This format is used
* to serialize a private RSA key (typically when * to serialize a private RSA key (typically when
* writing it to disk). * writing it to disk).
*/ */
struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded
skipping to change at line 127 skipping to change at line 143
uint16_t sized GNUNET_PACKED; /* in big-endian! */ uint16_t sized GNUNET_PACKED; /* in big-endian! */
uint16_t sizep GNUNET_PACKED; /* in big-endian! */ uint16_t sizep GNUNET_PACKED; /* in big-endian! */
uint16_t sizeq GNUNET_PACKED; /* in big-endian! */ uint16_t sizeq GNUNET_PACKED; /* in big-endian! */
uint16_t sizedmp1 GNUNET_PACKED; /* in big-endian! */ uint16_t sizedmp1 GNUNET_PACKED; /* in big-endian! */
uint16_t sizedmq1 GNUNET_PACKED; /* in big-endian! */ uint16_t sizedmq1 GNUNET_PACKED; /* in big-endian! */
/* followed by the actual values */ /* followed by the actual values */
}; };
GNUNET_NETWORK_STRUCT_END GNUNET_NETWORK_STRUCT_END
/** /**
* @brief 0-terminated ASCII encoding of a GNUNET_HashCode. * @brief 0-terminated ASCII encoding of a struct GNUNET_HashCode.
*/ */
struct GNUNET_CRYPTO_HashAsciiEncoded struct GNUNET_CRYPTO_HashAsciiEncoded
{ {
unsigned char encoding[104]; unsigned char encoding[104];
}; };
/** /**
* @brief 256-bit hashcode
*/
struct GNUNET_CRYPTO_ShortHashCode
{
uint32_t bits[256 / 8 / sizeof (uint32_t)]; /* = 8 */
};
/**
* @brief 0-terminated ASCII encoding of a 'struct GNUNET_ShortHashCode'. * @brief 0-terminated ASCII encoding of a 'struct GNUNET_ShortHashCode'.
*/ */
struct GNUNET_CRYPTO_ShortHashAsciiEncoded struct GNUNET_CRYPTO_ShortHashAsciiEncoded
{ {
unsigned char short_encoding[53]; unsigned char short_encoding[53];
}; };
/** /**
* @brief an RSA signature * @brief an RSA signature
*/ */
skipping to change at line 219 skipping to change at line 227
/** /**
* RSA Encrypted data. * RSA Encrypted data.
*/ */
struct GNUNET_CRYPTO_RsaEncryptedData struct GNUNET_CRYPTO_RsaEncryptedData
{ {
unsigned char encoding[GNUNET_CRYPTO_RSA_DATA_ENCODING_LENGTH]; unsigned char encoding[GNUNET_CRYPTO_RSA_DATA_ENCODING_LENGTH];
}; };
/** /**
* @brief header of what an ECC signature signs
* this must be followed by "size - 8" bytes of
* the actual signed data
*/
struct GNUNET_CRYPTO_EccSignaturePurpose
{
/**
* How many bytes does this signature sign?
* (including this purpose header); in network
* byte order (!).
*/
uint32_t size GNUNET_PACKED;
/**
* What does this signature vouch for? This
* must contain a GNUNET_SIGNATURE_PURPOSE_XXX
* constant (from gnunet_signatures.h). In
* network byte order!
*/
uint32_t purpose GNUNET_PACKED;
};
/**
* @brief an ECC signature
*/
struct GNUNET_CRYPTO_EccSignature
{
/**
* Overall size of the signature data.
*/
uint16_t size;
/**
* S-expression, padded with zeros.
*/
char sexpr[GNUNET_CRYPTO_ECC_SIGNATURE_DATA_ENCODING_LENGTH];
};
/**
* Public ECC key (always for NIST P-521) encoded in a format suitable
* for network transmission as created using 'gcry_sexp_sprint'.
*/
struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded
{
/**
* Size of the encoding, in network byte order.
*/
uint16_t size;
/**
* Actual length of the q-point binary encoding.
*/
uint16_t len;
/**
* 0-padded q-point in binary encoding (GCRYPT_MPI_FMT_USG).
*/
unsigned char key[GNUNET_CRYPTO_ECC_MAX_PUBLIC_KEY_LENGTH];
};
struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded
{
/**
* Overall size of the private key.
*/
uint16_t size;
/* followd by S-expression, opaque to applications */
/* FIXME: consider defining padding to make this a fixed-size struct */
};
/**
* @brief type for session keys * @brief type for session keys
*/ */
struct GNUNET_CRYPTO_AesSessionKey struct GNUNET_CRYPTO_AesSessionKey
{ {
/** /**
* Actual key. * Actual key.
*/ */
unsigned char key[GNUNET_CRYPTO_AES_KEY_LENGTH]; unsigned char key[GNUNET_CRYPTO_AES_KEY_LENGTH];
/** /**
* checksum! * checksum!
*/ */
uint32_t crc32 GNUNET_PACKED; uint32_t crc32 GNUNET_PACKED;
}; };
GNUNET_NETWORK_STRUCT_END GNUNET_NETWORK_STRUCT_END
/** /**
* @brief IV for sym cipher * @brief IV for sym cipher
* *
* NOTE: must be smaller (!) in size than the * NOTE: must be smaller (!) in size than the
* GNUNET_HashCode. * struct GNUNET_HashCode.
*/ */
struct GNUNET_CRYPTO_AesInitializationVector struct GNUNET_CRYPTO_AesInitializationVector
{ {
unsigned char iv[GNUNET_CRYPTO_AES_KEY_LENGTH / 2]; unsigned char iv[GNUNET_CRYPTO_AES_KEY_LENGTH / 2];
}; };
/** /**
* @brief type for (message) authentication keys * @brief type for (message) authentication keys
*/ */
struct GNUNET_CRYPTO_AuthKey struct GNUNET_CRYPTO_AuthKey
skipping to change at line 420 skipping to change at line 503
const struct GNUNET_CRYPTO_AesSessionKey *sk ey, const struct GNUNET_CRYPTO_AesSessionKey *sk ey,
const void *salt, size_t salt_len, va_list a rgp); const void *salt, size_t salt_len, va_list a rgp);
/** /**
* Convert hash to ASCII encoding. * Convert hash to ASCII encoding.
* @param block the hash code * @param block the hash code
* @param result where to store the encoding (struct GNUNET_CRYPTO_HashAsci iEncoded can be * @param result where to store the encoding (struct GNUNET_CRYPTO_HashAsci iEncoded can be
* safely cast to char*, a '\\0' termination is set). * safely cast to char*, a '\\0' termination is set).
*/ */
void void
GNUNET_CRYPTO_hash_to_enc (const GNUNET_HashCode * block, GNUNET_CRYPTO_hash_to_enc (const struct GNUNET_HashCode * block,
struct GNUNET_CRYPTO_HashAsciiEncoded *result); struct GNUNET_CRYPTO_HashAsciiEncoded *result);
/** /**
* Convert short hash to ASCII encoding. * Convert short hash to ASCII encoding.
* *
* @param block the hash code * @param block the hash code
* @param result where to store the encoding (struct GNUNET_CRYPTO_ShortHas hAsciiEncoded can be * @param result where to store the encoding (struct GNUNET_CRYPTO_ShortHas hAsciiEncoded can be
* safely cast to char*, a '\\0' termination is set). * safely cast to char*, a '\\0' termination is set).
*/ */
void void
GNUNET_CRYPTO_short_hash_to_enc (const struct GNUNET_CRYPTO_ShortHashCode * block, GNUNET_CRYPTO_short_hash_to_enc (const struct GNUNET_CRYPTO_ShortHashCode * block,
struct GNUNET_CRYPTO_ShortHashAsciiEncoded *result); struct GNUNET_CRYPTO_ShortHashAsciiEncoded *result);
/** /**
* Convert ASCII encoding back to a 'GNUNET_HashCode' * Convert ASCII encoding back to a 'struct GNUNET_HashCode'
* *
* @param enc the encoding * @param enc the encoding
* @param enclen number of characters in 'enc' (without 0-terminator, which can be missing) * @param enclen number of characters in 'enc' (without 0-terminator, which can be missing)
* @param result where to store the GNUNET_CRYPTO_hash code * @param result where to store the GNUNET_CRYPTO_hash code
* @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco ding * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco ding
*/ */
int int
GNUNET_CRYPTO_hash_from_string2 (const char *enc, size_t enclen, GNUNET_CRYPTO_hash_from_string2 (const char *enc, size_t enclen,
GNUNET_HashCode * result); struct GNUNET_HashCode * result);
/** /**
* Convert ASCII encoding back to a 'struct GNUNET_CRYPTO_ShortHash' * Convert ASCII encoding back to a 'struct GNUNET_CRYPTO_ShortHash'
* *
* @param enc the encoding * @param enc the encoding
* @param enclen number of characters in 'enc' (without 0-terminator, which can be missing) * @param enclen number of characters in 'enc' (without 0-terminator, which can be missing)
* @param result where to store the GNUNET_CRYPTO_hash code * @param result where to store the GNUNET_CRYPTO_hash code
* @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco ding * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco ding
*/ */
int int
GNUNET_CRYPTO_short_hash_from_string2 (const char *enc, size_t enclen, GNUNET_CRYPTO_short_hash_from_string2 (const char *enc, size_t enclen,
struct GNUNET_CRYPTO_ShortHashCode * result); struct GNUNET_CRYPTO_ShortHashCode * result);
/** /**
* Convert ASCII encoding back to GNUNET_HashCode * Convert ASCII encoding back to struct GNUNET_HashCode
* *
* @param enc the encoding * @param enc the encoding
* @param result where to store the hash code * @param result where to store the hash code
* @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco ding * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco ding
*/ */
#define GNUNET_CRYPTO_hash_from_string(enc, result) \ #define GNUNET_CRYPTO_hash_from_string(enc, result) \
GNUNET_CRYPTO_hash_from_string2 (enc, strlen(enc), result) GNUNET_CRYPTO_hash_from_string2 (enc, strlen(enc), result)
/** /**
* Convert ASCII encoding back to a 'struct GNUNET_CRYPTO_ShortHash' * Convert ASCII encoding back to a 'struct GNUNET_CRYPTO_ShortHash'
skipping to change at line 502 skipping to change at line 585
* The computation must be fast, not involve * The computation must be fast, not involve
* a.a or a.e (they're used elsewhere), and * a.a or a.e (they're used elsewhere), and
* be somewhat consistent. And of course, the * be somewhat consistent. And of course, the
* result should be a positive number. * result should be a positive number.
* *
* @param a some hash code * @param a some hash code
* @param b some hash code * @param b some hash code
* @return number between 0 and UINT32_MAX * @return number between 0 and UINT32_MAX
*/ */
uint32_t uint32_t
GNUNET_CRYPTO_hash_distance_u32 (const GNUNET_HashCode * a, GNUNET_CRYPTO_hash_distance_u32 (const struct GNUNET_HashCode * a,
const GNUNET_HashCode * b); const struct GNUNET_HashCode * b);
/** /**
* Compute hash of a given block. * Compute hash of a given block.
* *
* @param block the data to hash * @param block the data to hash
* @param size size of the block * @param size size of the block
* @param ret pointer to where to write the hashcode * @param ret pointer to where to write the hashcode
*/ */
void void
GNUNET_CRYPTO_hash (const void *block, size_t size, GNUNET_HashCode * ret); GNUNET_CRYPTO_hash (const void *block, size_t size, struct GNUNET_HashCode * ret);
/** /**
* Compute short (256-bit) hash of a given block. * Compute short (256-bit) hash of a given block.
* *
* @param block the data to hash * @param block the data to hash
* @param size size of the block * @param size size of the block
* @param ret pointer to where to write the hashcode * @param ret pointer to where to write the hashcode
*/ */
void void
GNUNET_CRYPTO_short_hash (const void *block, size_t size, GNUNET_CRYPTO_short_hash (const void *block, size_t size,
skipping to change at line 559 skipping to change at line 642
* Calculate HMAC of a message (RFC 2104) * Calculate HMAC of a message (RFC 2104)
* *
* @param key secret key * @param key secret key
* @param plaintext input plaintext * @param plaintext input plaintext
* @param plaintext_len length of plaintext * @param plaintext_len length of plaintext
* @param hmac where to store the hmac * @param hmac where to store the hmac
*/ */
void void
GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key, GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key,
const void *plaintext, size_t plaintext_len, const void *plaintext, size_t plaintext_len,
GNUNET_HashCode * hmac); struct GNUNET_HashCode * hmac);
/** /**
* Function called once the hash computation over the * Function called once the hash computation over the
* specified file has completed. * specified file has completed.
* *
* @param cls closure * @param cls closure
* @param res resulting hash, NULL on error * @param res resulting hash, NULL on error
*/ */
typedef void (*GNUNET_CRYPTO_HashCompletedCallback) (void *cls, typedef void (*GNUNET_CRYPTO_HashCompletedCallback) (void *cls,
const GNUNET_HashCode * const struct GNUNET_Ha shCode *
res); res);
/** /**
* Handle to file hashing operation. * Handle to file hashing operation.
*/ */
struct GNUNET_CRYPTO_FileHashContext; struct GNUNET_CRYPTO_FileHashContext;
/** /**
* Compute the hash of an entire file. * Compute the hash of an entire file.
* *
skipping to change at line 609 skipping to change at line 692
GNUNET_CRYPTO_hash_file_cancel (struct GNUNET_CRYPTO_FileHashContext *fhc); GNUNET_CRYPTO_hash_file_cancel (struct GNUNET_CRYPTO_FileHashContext *fhc);
/** /**
* Create a random hash code. * Create a random hash code.
* *
* @param mode desired quality level * @param mode desired quality level
* @param result hash code that is randomized * @param result hash code that is randomized
*/ */
void void
GNUNET_CRYPTO_hash_create_random (enum GNUNET_CRYPTO_Quality mode, GNUNET_CRYPTO_hash_create_random (enum GNUNET_CRYPTO_Quality mode,
GNUNET_HashCode * result); struct GNUNET_HashCode * result);
/** /**
* compute result(delta) = b - a * compute result(delta) = b - a
* *
* @param a some hash code * @param a some hash code
* @param b some hash code * @param b some hash code
* @param result set to b - a * @param result set to b - a
*/ */
void void
GNUNET_CRYPTO_hash_difference (const GNUNET_HashCode * a, GNUNET_CRYPTO_hash_difference (const struct GNUNET_HashCode * a,
const GNUNET_HashCode * b, const struct GNUNET_HashCode * b,
GNUNET_HashCode * result); struct GNUNET_HashCode * result);
/** /**
* compute result(b) = a + delta * compute result(b) = a + delta
* *
* @param a some hash code * @param a some hash code
* @param delta some hash code * @param delta some hash code
* @param result set to a + delta * @param result set to a + delta
*/ */
void void
GNUNET_CRYPTO_hash_sum (const GNUNET_HashCode * a, GNUNET_CRYPTO_hash_sum (const struct GNUNET_HashCode * a,
const GNUNET_HashCode * delta, const struct GNUNET_HashCode * delta,
GNUNET_HashCode * result); struct GNUNET_HashCode * result);
/** /**
* compute result = a ^ b * compute result = a ^ b
* *
* @param a some hash code * @param a some hash code
* @param b some hash code * @param b some hash code
* @param result set to a ^ b * @param result set to a ^ b
*/ */
void void
GNUNET_CRYPTO_hash_xor (const GNUNET_HashCode * a, const GNUNET_HashCode * GNUNET_CRYPTO_hash_xor (const struct GNUNET_HashCode * a, const struct GNUN
b, ET_HashCode * b,
GNUNET_HashCode * result); struct GNUNET_HashCode * result);
/** /**
* Convert a hashcode into a key. * Convert a hashcode into a key.
* *
* @param hc hash code that serves to generate the key * @param hc hash code that serves to generate the key
* @param skey set to a valid session key * @param skey set to a valid session key
* @param iv set to a valid initialization vector * @param iv set to a valid initialization vector
*/ */
void void
GNUNET_CRYPTO_hash_to_aes_key (const GNUNET_HashCode * hc, GNUNET_CRYPTO_hash_to_aes_key (const struct GNUNET_HashCode * hc,
struct GNUNET_CRYPTO_AesSessionKey *skey, struct GNUNET_CRYPTO_AesSessionKey *skey,
struct GNUNET_CRYPTO_AesInitializationVector struct GNUNET_CRYPTO_AesInitializationVector
*iv); *iv);
/** /**
* Obtain a bit from a hashcode. * Obtain a bit from a hashcode.
* *
* @param code the GNUNET_CRYPTO_hash to index bit-wise * @param code the GNUNET_CRYPTO_hash to index bit-wise
* @param bit index into the hashcode, [0...159] * @param bit index into the hashcode, [0...159]
* @return Bit \a bit from hashcode \a code, -1 for invalid index * @return Bit \a bit from hashcode \a code, -1 for invalid index
*/ */
int int
GNUNET_CRYPTO_hash_get_bit (const GNUNET_HashCode * code, unsigned int bit) ; GNUNET_CRYPTO_hash_get_bit (const struct GNUNET_HashCode * code, unsigned i nt bit);
/** /**
* Determine how many low order bits match in two * Determine how many low order bits match in two
* GNUNET_HashCodes. i.e. - 010011 and 011111 share * struct GNUNET_HashCodes. i.e. - 010011 and 011111 share
* the first two lowest order bits, and therefore the * the first two lowest order bits, and therefore the
* return value is two (NOT XOR distance, nor how many * return value is two (NOT XOR distance, nor how many
* bits match absolutely!). * bits match absolutely!).
* *
* @param first the first hashcode * @param first the first hashcode
* @param second the hashcode to compare first to * @param second the hashcode to compare first to
* *
* @return the number of bits that match * @return the number of bits that match
*/ */
unsigned int unsigned int
GNUNET_CRYPTO_hash_matching_bits (const GNUNET_HashCode * first, GNUNET_CRYPTO_hash_matching_bits (const struct GNUNET_HashCode * first,
const GNUNET_HashCode * second); const struct GNUNET_HashCode * second);
/** /**
* Compare function for HashCodes, producing a total ordering * Compare function for HashCodes, producing a total ordering
* of all hashcodes. * of all hashcodes.
* *
* @param h1 some hash code * @param h1 some hash code
* @param h2 some hash code * @param h2 some hash code
* @return 1 if h1 > h2, -1 if h1 < h2 and 0 if h1 == h2. * @return 1 if h1 > h2, -1 if h1 < h2 and 0 if h1 == h2.
*/ */
int int
GNUNET_CRYPTO_hash_cmp (const GNUNET_HashCode * h1, const GNUNET_HashCode * h2); GNUNET_CRYPTO_hash_cmp (const struct GNUNET_HashCode * h1, const struct GNU NET_HashCode * h2);
/** /**
* Find out which of the two GNUNET_CRYPTO_hash codes is closer to target * Find out which of the two GNUNET_CRYPTO_hash codes is closer to target
* in the XOR metric (Kademlia). * in the XOR metric (Kademlia).
* *
* @param h1 some hash code * @param h1 some hash code
* @param h2 some hash code * @param h2 some hash code
* @param target some hash code * @param target some hash code
* @return -1 if h1 is closer, 1 if h2 is closer and 0 if h1==h2. * @return -1 if h1 is closer, 1 if h2 is closer and 0 if h1==h2.
*/ */
int int
GNUNET_CRYPTO_hash_xorcmp (const GNUNET_HashCode * h1, GNUNET_CRYPTO_hash_xorcmp (const struct GNUNET_HashCode * h1,
const GNUNET_HashCode * h2, const struct GNUNET_HashCode * h2,
const GNUNET_HashCode * target); const struct GNUNET_HashCode * target);
/** /**
* @brief Derive an authentication key * @brief Derive an authentication key
* @param key authentication key * @param key authentication key
* @param rkey root key * @param rkey root key
* @param salt salt * @param salt salt
* @param salt_len size of the salt * @param salt_len size of the salt
* @param argp pair of void * & size_t for context chunks, terminated by NU LL * @param argp pair of void * & size_t for context chunks, terminated by NU LL
*/ */
void void
skipping to change at line 804 skipping to change at line 887
* @param skm source key material * @param skm source key material
* @param skm_len length of skm * @param skm_len length of skm
* @param ... void * & size_t pairs for context chunks * @param ... void * & size_t pairs for context chunks
* @return GNUNET_YES on success * @return GNUNET_YES on success
*/ */
int int
GNUNET_CRYPTO_kdf (void *result, size_t out_len, const void *xts, GNUNET_CRYPTO_kdf (void *result, size_t out_len, const void *xts,
size_t xts_len, const void *skm, size_t skm_len, ...); size_t xts_len, const void *skm, size_t skm_len, ...);
/** /**
* Create a new private key. Caller must free return value.
*
* @return fresh private key
*/
struct GNUNET_CRYPTO_RsaPrivateKey *
GNUNET_CRYPTO_rsa_key_create (void);
/**
* Convert a public key to a string. * Convert a public key to a string.
* *
* @param pub key to convert * @param pub key to convert
* @return string representing 'pub' * @return string representing 'pub'
*/ */
char * char *
GNUNET_CRYPTO_rsa_public_key_to_string (struct GNUNET_CRYPTO_RsaPublicKeyBi naryEncoded *pub); GNUNET_CRYPTO_rsa_public_key_to_string (struct GNUNET_CRYPTO_RsaPublicKeyBi naryEncoded *pub);
/** /**
* Convert a string representing a public key to a public key. * Convert a string representing a public key to a public key.
skipping to change at line 836 skipping to change at line 911
* @return GNUNET_OK on success * @return GNUNET_OK on success
*/ */
int int
GNUNET_CRYPTO_rsa_public_key_from_string (const char *enc, GNUNET_CRYPTO_rsa_public_key_from_string (const char *enc,
size_t enclen, size_t enclen,
struct GNUNET_CRYPTO_RsaPublicKeyB inaryEncoded *pub); struct GNUNET_CRYPTO_RsaPublicKeyB inaryEncoded *pub);
/** /**
* Encode the private key in a format suitable for * Encode the private key in a format suitable for
* storing it into a file. * storing it into a file.
* @returns encoding of the private key. * @return encoding of the private key
* The first 4 bytes give the size of the array, as usual.
*/ */
struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded * struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded *
GNUNET_CRYPTO_rsa_encode_key (const struct GNUNET_CRYPTO_RsaPrivateKey *hos tkey); GNUNET_CRYPTO_rsa_encode_key (const struct GNUNET_CRYPTO_RsaPrivateKey *hos tkey);
/** /**
* Decode the private key from the data-format back * Decode the private key from the data-format back
* to the "normal", internal format. * to the "normal", internal format.
* *
* @param buf the buffer where the private key data is stored * @param buf the buffer where the private key data is stored
* @param len the length of the data in 'buffer' * @param len the length of the data in 'buffer'
* @return NULL on error
*/ */
struct GNUNET_CRYPTO_RsaPrivateKey * struct GNUNET_CRYPTO_RsaPrivateKey *
GNUNET_CRYPTO_rsa_decode_key (const char *buf, uint16_t len); GNUNET_CRYPTO_rsa_decode_key (const char *buf, uint16_t len);
/** /**
* Create a new private key by reading it from a file. If the * Create a new private key by reading it from a file. If the
* files does not exist, create a new key and write it to the * files does not exist, create a new key and write it to the
* file. Caller must free return value. Note that this function * file. Caller must free return value. Note that this function
* can not guarantee that another process might not be trying * can not guarantee that another process might not be trying
* the same operation on the same file at the same time. * the same operation on the same file at the same time.
* If the contents of the file * If the contents of the file
* are invalid the old file is deleted and a fresh key is * are invalid the old file is deleted and a fresh key is
* created. * created.
* *
* @param filename name of file to use for storage * @param filename name of file to use for storage
* @return new private key, NULL on error (for example, * @return new private key, NULL on error (for example,
* permission denied) * permission denied)
* @deprecated use 'GNUNET_CRYPTO_rsa_key_create_start' instead
*/ */
struct GNUNET_CRYPTO_RsaPrivateKey * struct GNUNET_CRYPTO_RsaPrivateKey *
GNUNET_CRYPTO_rsa_key_create_from_file (const char *filename); GNUNET_CRYPTO_rsa_key_create_from_file (const char *filename);
/** /**
* Handle to cancel private key generation.
*/
struct GNUNET_CRYPTO_RsaKeyGenerationContext;
/**
* Function called upon completion of 'GNUNET_CRYPTO_rsa_key_create_async'.
*
* @param cls closure
* @param pk NULL on error, otherwise the private key (which must be free'd
by the callee)
* @param emsg NULL on success, otherwise an error message
*/
typedef void (*GNUNET_CRYPTO_RsaKeyCallback)(void *cls,
struct GNUNET_CRYPTO_RsaPrivate
Key *pk,
const char *emsg);
/**
* Create a new private key by reading it from a file. If the files
* does not exist, create a new key and write it to the file. If the
* contents of the file are invalid the old file is deleted and a
* fresh key is created.
*
* @param filename name of file to use for storage
* @param cont function to call when done (or on errors)
* @param cont_cls closure for 'cont'
* @return handle to abort operation, NULL on fatal errors (cont will not b
e called if NULL is returned)
*/
struct GNUNET_CRYPTO_RsaKeyGenerationContext *
GNUNET_CRYPTO_rsa_key_create_start (const char *filename,
GNUNET_CRYPTO_RsaKeyCallback cont,
void *cont_cls);
/**
* Abort RSA key generation.
*
* @param gc key generation context to abort
*/
void
GNUNET_CRYPTO_rsa_key_create_stop (struct GNUNET_CRYPTO_RsaKeyGenerationCon
text *gc);
/**
* Setup a hostkey file for a peer given the name of the * Setup a hostkey file for a peer given the name of the
* configuration file (!). This function is used so that * configuration file (!). This function is used so that
* at a later point code can be certain that reading a * at a later point code can be certain that reading a
* hostkey is fast (for example in time-dependent testcases). * hostkey is fast (for example in time-dependent testcases).
* *
* @param cfg_name name of the configuration file to use * @param cfg_name name of the configuration file to use
*/ */
void void
GNUNET_CRYPTO_setup_hostkey (const char *cfg_name); GNUNET_CRYPTO_rsa_setup_hostkey (const char *cfg_name);
/** /**
* Deterministically (!) create a private key using only the * Deterministically (!) create a private key using only the
* given HashCode as input to the PRNG. * given HashCode as input to the PRNG.
* *
* @param hc "random" input to PRNG * @param hc "random" input to PRNG
* @return some private key purely dependent on input * @return some private key purely dependent on input
*/ */
struct GNUNET_CRYPTO_RsaPrivateKey * struct GNUNET_CRYPTO_RsaPrivateKey *
GNUNET_CRYPTO_rsa_key_create_from_hash (const GNUNET_HashCode * hc); GNUNET_CRYPTO_rsa_key_create_from_hash (const struct GNUNET_HashCode *hc);
/** /**
* Free memory occupied by the private key. * Free memory occupied by the private key.
* @param hostkey pointer to the memory to free *
* @param key pointer to the memory to free
*/ */
void void
GNUNET_CRYPTO_rsa_key_free (struct GNUNET_CRYPTO_RsaPrivateKey *hostkey); GNUNET_CRYPTO_rsa_key_free (struct GNUNET_CRYPTO_RsaPrivateKey *key);
/** /**
* Extract the public key of the host. * Extract the public key of the host.
* *
* @param priv the private key * @param priv the private key
* @param pub where to write the public key * @param pub where to write the public key
*/ */
void void
GNUNET_CRYPTO_rsa_key_get_public (const struct GNUNET_CRYPTO_RsaPrivateKey GNUNET_CRYPTO_rsa_key_get_public (const struct GNUNET_CRYPTO_RsaPrivateKey
*priv, *priv,
skipping to change at line 971 skipping to change at line 1088
*/ */
int int
GNUNET_CRYPTO_rsa_verify (uint32_t purpose, GNUNET_CRYPTO_rsa_verify (uint32_t purpose,
const struct GNUNET_CRYPTO_RsaSignaturePurpose const struct GNUNET_CRYPTO_RsaSignaturePurpose
*validate, *validate,
const struct GNUNET_CRYPTO_RsaSignature *sig, const struct GNUNET_CRYPTO_RsaSignature *sig,
const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEnco ded const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEnco ded
*publicKey); *publicKey);
/** /**
* Function called upon completion of 'GNUNET_CRYPTO_ecc_key_create_async'.
*
* @param cls closure
* @param pk NULL on error, otherwise the private key (which must be free'd
by the callee)
* @param emsg NULL on success, otherwise an error message
*/
typedef void (*GNUNET_CRYPTO_EccKeyCallback)(void *cls,
struct GNUNET_CRYPTO_EccPrivate
Key *pk,
const char *emsg);
/**
* Free memory occupied by ECC key
*
* @param privatekey pointer to the memory to free
*/
void
GNUNET_CRYPTO_ecc_key_free (struct GNUNET_CRYPTO_EccPrivateKey *privatekey)
;
/**
* Extract the public key for the given private key.
*
* @param priv the private key
* @param pub where to write the public key
*/
void
GNUNET_CRYPTO_ecc_key_get_public (const struct GNUNET_CRYPTO_EccPrivateKey
*priv,
struct GNUNET_CRYPTO_EccPublicKeyBinaryEn
coded *pub);
/**
* Convert a public key to a string.
*
* @param pub key to convert
* @return string representing 'pub'
*/
char *
GNUNET_CRYPTO_ecc_public_key_to_string (struct GNUNET_CRYPTO_EccPublicKeyBi
naryEncoded *pub);
/**
* Convert a string representing a public key to a public key.
*
* @param enc encoded public key
* @param enclen number of bytes in enc (without 0-terminator)
* @param pub where to store the public key
* @return GNUNET_OK on success
*/
int
GNUNET_CRYPTO_ecc_public_key_from_string (const char *enc,
size_t enclen,
struct GNUNET_CRYPTO_EccPublicKeyB
inaryEncoded *pub);
/**
* Encode the private key in a format suitable for
* storing it into a file.
*
* @param key key to encode
* @return encoding of the private key.
* The first 4 bytes give the size of the array, as usual.
*/
struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded *
GNUNET_CRYPTO_ecc_encode_key (const struct GNUNET_CRYPTO_EccPrivateKey *key
);
/**
* Decode the private key from the file-format back
* to the "normal", internal format.
*
* @param buf the buffer where the private key data is stored
* @param len the length of the data in 'buffer'
* @return NULL on error
*/
struct GNUNET_CRYPTO_EccPrivateKey *
GNUNET_CRYPTO_ecc_decode_key (const char *buf,
size_t len);
/**
* Create a new private key by reading it from a file. If the
* files does not exist, create a new key and write it to the
* file. Caller must free return value. Note that this function
* can not guarantee that another process might not be trying
* the same operation on the same file at the same time.
* If the contents of the file
* are invalid the old file is deleted and a fresh key is
* created.
*
* @return new private key, NULL on error (for example,
* permission denied)
*/
struct GNUNET_CRYPTO_EccPrivateKey *
GNUNET_CRYPTO_ecc_key_create_from_file (const char *filename);
/**
* Handle to cancel private key generation and state for the
* key generation operation.
*/
struct GNUNET_CRYPTO_EccKeyGenerationContext;
/**
* Create a new private key by reading it from a file. If the files
* does not exist, create a new key and write it to the file. If the
* contents of the file are invalid the old file is deleted and a
* fresh key is created.
*
* @param filename name of file to use for storage
* @param cont function to call when done (or on errors)
* @param cont_cls closure for 'cont'
* @return handle to abort operation, NULL on fatal errors (cont will not b
e called if NULL is returned)
*/
struct GNUNET_CRYPTO_EccKeyGenerationContext *
GNUNET_CRYPTO_ecc_key_create_start (const char *filename,
GNUNET_CRYPTO_EccKeyCallback cont,
void *cont_cls);
/**
* Abort ECC key generation.
*
* @param gc key generation context to abort
*/
void
GNUNET_CRYPTO_ecc_key_create_stop (struct GNUNET_CRYPTO_EccKeyGenerationCon
text *gc);
/**
* Setup a hostkey file for a peer given the name of the
* configuration file (!). This function is used so that
* at a later point code can be certain that reading a
* hostkey is fast (for example in time-dependent testcases).
*
* @param cfg_name name of the configuration file to use
*/
void
GNUNET_CRYPTO_ecc_setup_hostkey (const char *cfg_name);
/**
* Sign a given block.
*
* @param key private key to use for the signing
* @param purpose what to sign (size, purpose)
* @param sig where to write the signature
* @return GNUNET_SYSERR on error, GNUNET_OK on success
*/
int
GNUNET_CRYPTO_ecc_sign (const struct GNUNET_CRYPTO_EccPrivateKey *key,
const struct GNUNET_CRYPTO_EccSignaturePurpose *pur
pose,
struct GNUNET_CRYPTO_EccSignature *sig);
/**
* Verify signature.
*
* @param purpose what is the purpose that the signature should have?
* @param validate block to validate (size, purpose, data)
* @param sig signature that is being validated
* @param publicKey public key of the signer
* @returns GNUNET_OK if ok, GNUNET_SYSERR if invalid
*/
int
GNUNET_CRYPTO_ecc_verify (uint32_t purpose,
const struct GNUNET_CRYPTO_EccSignaturePurpose
*validate,
const struct GNUNET_CRYPTO_EccSignature *sig,
const struct GNUNET_CRYPTO_EccPublicKeyBinaryEnco
ded
*publicKey);
/**
* This function should only be called in testcases * This function should only be called in testcases
* where strong entropy gathering is not desired * where strong entropy gathering is not desired
* (for example, for hostkey generation). * (for example, for hostkey generation).
*/ */
void void
GNUNET_CRYPTO_random_disable_entropy_gathering (void); GNUNET_CRYPTO_random_disable_entropy_gathering (void);
/**
* Check if we are using weak random number generation.
*
* @return GNUNET_YES if weak number generation is on
* (thus will return YES if 'GNUNET_CRYPTO_random_disable_entropy_g
athering'
* was called previously).
*/
int
GNUNET_CRYPTO_random_is_weak (void);
#if 0 /* keep Emacsens' auto-indent happy */ #if 0 /* keep Emacsens' auto-indent happy */
{ {
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* ifndef GNUNET_CRYPTO_LIB_H */ /* ifndef GNUNET_CRYPTO_LIB_H */
#endif #endif
/* end of gnunet_crypto_lib.h */ /* end of gnunet_crypto_lib.h */
 End of changes. 35 change blocks. 
53 lines changed or deleted 358 lines changed or added


 gnunet_datacache_lib.h   gnunet_datacache_lib.h 
skipping to change at line 82 skipping to change at line 82
* @param cls closure * @param cls closure
* @param exp when will the content expire? * @param exp when will the content expire?
* @param key key for the content * @param key key for the content
* @param size number of bytes in data * @param size number of bytes in data
* @param data content stored * @param data content stored
* @param type type of the content * @param type type of the content
* @return GNUNET_OK to continue iterating, GNUNET_SYSERR to abort * @return GNUNET_OK to continue iterating, GNUNET_SYSERR to abort
*/ */
typedef int (*GNUNET_DATACACHE_Iterator) (void *cls, typedef int (*GNUNET_DATACACHE_Iterator) (void *cls,
struct GNUNET_TIME_Absolute exp, struct GNUNET_TIME_Absolute exp,
const GNUNET_HashCode * key, const struct GNUNET_HashCode * ke y,
size_t size, const char *data, size_t size, const char *data,
enum GNUNET_BLOCK_Type type); enum GNUNET_BLOCK_Type type);
/** /**
* Store an item in the datacache. * Store an item in the datacache.
* *
* @param h handle to the datacache * @param h handle to the datacache
* @param key key to store data under * @param key key to store data under
* @param size number of bytes in data * @param size number of bytes in data
* @param data data to store * @param data data to store
* @param type type of the value * @param type type of the value
* @param discard_time when to discard the value in any case * @param discard_time when to discard the value in any case
* @return GNUNET_OK on success, GNUNET_SYSERR on error (full, etc.) * @return GNUNET_OK on success, GNUNET_SYSERR on error (full, etc.)
*/ */
int int
GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h, GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h,
const GNUNET_HashCode * key, size_t size, const struct GNUNET_HashCode * key, size_t size,
const char *data, enum GNUNET_BLOCK_Type type, const char *data, enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute discard_time); struct GNUNET_TIME_Absolute discard_time);
/** /**
* Iterate over the results for a particular key * Iterate over the results for a particular key
* in the datacache. * in the datacache.
* *
* @param h handle to the datacache * @param h handle to the datacache
* @param key what to look up * @param key what to look up
* @param type entries of which type are relevant? * @param type entries of which type are relevant?
* @param iter maybe NULL (to just count) * @param iter maybe NULL (to just count)
* @param iter_cls closure for iter * @param iter_cls closure for iter
* @return the number of results found * @return the number of results found
*/ */
unsigned int unsigned int
GNUNET_DATACACHE_get (struct GNUNET_DATACACHE_Handle *h, GNUNET_DATACACHE_get (struct GNUNET_DATACACHE_Handle *h,
const GNUNET_HashCode * key, enum GNUNET_BLOCK_Type t ype, const struct GNUNET_HashCode * key, enum GNUNET_BLOCK _Type type,
GNUNET_DATACACHE_Iterator iter, void *iter_cls); GNUNET_DATACACHE_Iterator iter, void *iter_cls);
#if 0 /* keep Emacsens' auto-indent happy */ #if 0 /* keep Emacsens' auto-indent happy */
{ {
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* end of gnunet_datacache_lib.h */ /* end of gnunet_datacache_lib.h */
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added


 gnunet_datacache_plugin.h   gnunet_datacache_plugin.h 
skipping to change at line 48 skipping to change at line 48
/** /**
* Function called by plugins to notify the datacache * Function called by plugins to notify the datacache
* about content deletions. * about content deletions.
* *
* @param cls closure * @param cls closure
* @param key key of the content that was deleted * @param key key of the content that was deleted
* @param size number of bytes that were made available * @param size number of bytes that were made available
*/ */
typedef void (*GNUNET_DATACACHE_DeleteNotifyCallback) (void *cls, typedef void (*GNUNET_DATACACHE_DeleteNotifyCallback) (void *cls,
const GNUNET_HashCod e * const struct GNUNET_ HashCode *
key, size_t size); key, size_t size);
/** /**
* The datastore service will pass a pointer to a struct * The datastore service will pass a pointer to a struct
* of this type as the first and only argument to the * of this type as the first and only argument to the
* entry point of each datastore plugin. * entry point of each datastore plugin.
*/ */
struct GNUNET_DATACACHE_PluginEnvironment struct GNUNET_DATACACHE_PluginEnvironment
{ {
skipping to change at line 108 skipping to change at line 108
/** /**
* Store an item in the datastore. * Store an item in the datastore.
* *
* @param cls closure (internal context for the plugin) * @param cls closure (internal context for the plugin)
* @param size number of bytes in data * @param size number of bytes in data
* @param data data to store * @param data data to store
* @param type type of the value * @param type type of the value
* @param discard_time when to discard the value in any case * @param discard_time when to discard the value in any case
* @return 0 on error, number of bytes used otherwise * @return 0 on error, number of bytes used otherwise
*/ */
size_t (*put) (void *cls, const GNUNET_HashCode * key, size_t size, size_t (*put) (void *cls, const struct GNUNET_HashCode * key, size_t size,
const char *data, enum GNUNET_BLOCK_Type type, const char *data, enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute discard_time); struct GNUNET_TIME_Absolute discard_time);
/** /**
* Iterate over the results for a particular key * Iterate over the results for a particular key
* in the datastore. * in the datastore.
* *
* @param cls closure (internal context for the plugin) * @param cls closure (internal context for the plugin)
* @param key * @param key
* @param type entries of which type are relevant? * @param type entries of which type are relevant?
* @param iter maybe NULL (to just count) * @param iter maybe NULL (to just count)
* @param iter_cls closure for iter * @param iter_cls closure for iter
* @return the number of results found * @return the number of results found
*/ */
unsigned int (*get) (void *cls, const GNUNET_HashCode * key, unsigned int (*get) (void *cls, const struct GNUNET_HashCode * key,
enum GNUNET_BLOCK_Type type, enum GNUNET_BLOCK_Type type,
GNUNET_DATACACHE_Iterator iter, void *iter_cls); GNUNET_DATACACHE_Iterator iter, void *iter_cls);
/** /**
* Delete the entry with the lowest expiration value * Delete the entry with the lowest expiration value
* from the datacache right now. * from the datacache right now.
* *
* @param cls closure (internal context for the plugin) * @param cls closure (internal context for the plugin)
* @return GNUNET_OK on success, GNUNET_SYSERR on error * @return GNUNET_OK on success, GNUNET_SYSERR on error
*/ */
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added


 gnunet_datastore_plugin.h   gnunet_datastore_plugin.h 
skipping to change at line 91 skipping to change at line 91
* @param data content stored * @param data content stored
* @param type type of the content * @param type type of the content
* @param priority priority of the content * @param priority priority of the content
* @param anonymity anonymity-level for the content * @param anonymity anonymity-level for the content
* @param expiration expiration time for the content * @param expiration expiration time for the content
* @param uid unique identifier for the datum * @param uid unique identifier for the datum
* *
* @return GNUNET_OK to keep the item * @return GNUNET_OK to keep the item
* GNUNET_NO to delete the item * GNUNET_NO to delete the item
*/ */
typedef int (*PluginDatumProcessor) (void *cls, const GNUNET_HashCode * key , typedef int (*PluginDatumProcessor) (void *cls, const struct GNUNET_HashCod e * key,
uint32_t size, const void *data, uint32_t size, const void *data,
enum GNUNET_BLOCK_Type type, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity, uint32_t priority, uint32_t anonymity,
struct GNUNET_TIME_Absolute expiration , struct GNUNET_TIME_Absolute expiration ,
uint64_t uid); uint64_t uid);
/** /**
* Get an estimate of how much space the database is * Get an estimate of how much space the database is
* currently using. * currently using.
* *
skipping to change at line 125 skipping to change at line 125
* @param data content stored * @param data content stored
* @param type type of the content * @param type type of the content
* @param priority priority of the content * @param priority priority of the content
* @param anonymity anonymity-level for the content * @param anonymity anonymity-level for the content
* @param replication replication-level for the content * @param replication replication-level for the content
* @param expiration expiration time for the content * @param expiration expiration time for the content
* @param msg set to an error message (on failure) * @param msg set to an error message (on failure)
* @return GNUNET_OK on success, * @return GNUNET_OK on success,
* GNUNET_SYSERR on failure * GNUNET_SYSERR on failure
*/ */
typedef int (*PluginPut) (void *cls, const GNUNET_HashCode * key, uint32_t size, typedef int (*PluginPut) (void *cls, const struct GNUNET_HashCode * key, ui nt32_t size,
const void *data, enum GNUNET_BLOCK_Type type, const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity, uint32_t priority, uint32_t anonymity,
uint32_t replication, uint32_t replication,
struct GNUNET_TIME_Absolute expiration, char **ms g); struct GNUNET_TIME_Absolute expiration, char **ms g);
/** /**
* An processor over a set of keys stored in the datastore. * An processor over a set of keys stored in the datastore.
* *
* @param cls closure * @param cls closure
* @param key key in the data store * @param key key in the data store
* @param count how many values are stored under this key in the datastore * @param count how many values are stored under this key in the datastore
*/ */
typedef void (*PluginKeyProcessor) (void *cls, typedef void (*PluginKeyProcessor) (void *cls,
const GNUNET_HashCode *key, const struct GNUNET_HashCode *key,
unsigned int count); unsigned int count);
/** /**
* Get all of the keys in the datastore. * Get all of the keys in the datastore.
* *
* @param cls closure * @param cls closure
* @param proc function to call on each key * @param proc function to call on each key
* @param proc_cls closure for proc * @param proc_cls closure for proc
*/ */
typedef void (*PluginGetKeys) (void *cls, typedef void (*PluginGetKeys) (void *cls,
skipping to change at line 173 skipping to change at line 173
* there may be! * there may be!
* @param type entries of which type are relevant? * @param type entries of which type are relevant?
* Use 0 for any type. * Use 0 for any type.
* @param min find the smallest key that is larger than the given min, * @param min find the smallest key that is larger than the given min,
* NULL for no minimum (return smallest key) * NULL for no minimum (return smallest key)
* @param proc function to call on the matching value; * @param proc function to call on the matching value;
* proc should be called with NULL if there is no result * proc should be called with NULL if there is no result
* @param proc_cls closure for proc * @param proc_cls closure for proc
*/ */
typedef void (*PluginGetKey) (void *cls, uint64_t offset, typedef void (*PluginGetKey) (void *cls, uint64_t offset,
const GNUNET_HashCode * key, const struct GNUNET_HashCode * key,
const GNUNET_HashCode * vhash, const struct GNUNET_HashCode * vhash,
enum GNUNET_BLOCK_Type type, enum GNUNET_BLOCK_Type type,
PluginDatumProcessor proc, void *proc_cls); PluginDatumProcessor proc, void *proc_cls);
/** /**
* Get a random item (additional constraints may apply depending on * Get a random item (additional constraints may apply depending on
* the specific implementation). Calls 'proc' with all values ZERO or * the specific implementation). Calls 'proc' with all values ZERO or
* NULL if no item applies, otherwise 'proc' is called once and only * NULL if no item applies, otherwise 'proc' is called once and only
* once with an item. * once with an item.
* *
* @param cls closure * @param cls closure
 End of changes. 4 change blocks. 
5 lines changed or deleted 5 lines changed or added


 gnunet_datastore_service.h   gnunet_datastore_service.h 
skipping to change at line 152 skipping to change at line 152
* (if other requests of higher priority are in the queue) * (if other requests of higher priority are in the queue)
* @param timeout timeout for the operation * @param timeout timeout for the operation
* @param cont continuation to call when done * @param cont continuation to call when done
* @param cont_cls closure for cont * @param cont_cls closure for cont
* @return NULL if the entry was not queued, otherwise a handle that can be used to * @return NULL if the entry was not queued, otherwise a handle that can be used to
* cancel; note that even if NULL is returned, the callback will be invoked * cancel; note that even if NULL is returned, the callback will be invoked
* (or rather, will already have been invoked) * (or rather, will already have been invoked)
*/ */
struct GNUNET_DATASTORE_QueueEntry * struct GNUNET_DATASTORE_QueueEntry *
GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, uint32_t rid, GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, uint32_t rid,
const GNUNET_HashCode * key, size_t size, const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type, const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity, uint32_t priority, uint32_t anonymity,
uint32_t replication, uint32_t replication,
struct GNUNET_TIME_Absolute expiration, struct GNUNET_TIME_Absolute expiration,
unsigned int queue_priority, unsigned int max_queue_s ize, unsigned int queue_priority, unsigned int max_queue_s ize,
struct GNUNET_TIME_Relative timeout, struct GNUNET_TIME_Relative timeout,
GNUNET_DATASTORE_ContinuationWithStatus cont, GNUNET_DATASTORE_ContinuationWithStatus cont,
void *cont_cls); void *cont_cls);
/** /**
skipping to change at line 241 skipping to change at line 241
* (if other requests of higher priority are in the queue) * (if other requests of higher priority are in the queue)
* @param timeout how long to wait at most for a response * @param timeout how long to wait at most for a response
* @param cont continuation to call when done * @param cont continuation to call when done
* @param cont_cls closure for cont * @param cont_cls closure for cont
* @return NULL if the entry was not queued, otherwise a handle that can be used to * @return NULL if the entry was not queued, otherwise a handle that can be used to
* cancel; note that even if NULL is returned, the callback will be invoked * cancel; note that even if NULL is returned, the callback will be invoked
* (or rather, will already have been invoked) * (or rather, will already have been invoked)
*/ */
struct GNUNET_DATASTORE_QueueEntry * struct GNUNET_DATASTORE_QueueEntry *
GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h, GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h,
const GNUNET_HashCode * key, size_t size, const struct GNUNET_HashCode * key, size_t size,
const void *data, unsigned int queue_priority, const void *data, unsigned int queue_priority,
unsigned int max_queue_size, unsigned int max_queue_size,
struct GNUNET_TIME_Relative timeout, struct GNUNET_TIME_Relative timeout,
GNUNET_DATASTORE_ContinuationWithStatus cont, GNUNET_DATASTORE_ContinuationWithStatus cont,
void *cont_cls); void *cont_cls);
/** /**
* Process a datum that was stored in the datastore. * Process a datum that was stored in the datastore.
* *
* @param cls closure * @param cls closure
skipping to change at line 263 skipping to change at line 263
* @param size number of bytes in data * @param size number of bytes in data
* @param data content stored * @param data content stored
* @param type type of the content * @param type type of the content
* @param priority priority of the content * @param priority priority of the content
* @param anonymity anonymity-level for the content * @param anonymity anonymity-level for the content
* @param expiration expiration time for the content * @param expiration expiration time for the content
* @param uid unique identifier for the datum; * @param uid unique identifier for the datum;
* maybe 0 if no unique identifier is available * maybe 0 if no unique identifier is available
*/ */
typedef void (*GNUNET_DATASTORE_DatumProcessor) (void *cls, typedef void (*GNUNET_DATASTORE_DatumProcessor) (void *cls,
const GNUNET_HashCode * ke y, const struct GNUNET_HashCo de * key,
size_t size, const void *d ata, size_t size, const void *d ata,
enum GNUNET_BLOCK_Type typ e, enum GNUNET_BLOCK_Type typ e,
uint32_t priority, uint32_t priority,
uint32_t anonymity, uint32_t anonymity,
struct GNUNET_TIME_Absolut e struct GNUNET_TIME_Absolut e
expiration, uint64_t uid); expiration, uint64_t uid);
/** /**
* Get a result for a particular key from the datastore. The processor * Get a result for a particular key from the datastore. The processor
* will only be called once. * will only be called once.
skipping to change at line 294 skipping to change at line 294
* (if other requests of higher priority are in the queue) * (if other requests of higher priority are in the queue)
* @param timeout how long to wait at most for a response * @param timeout how long to wait at most for a response
* @param proc function to call on a matching value; * @param proc function to call on a matching value;
* or with a NULL value if no datum matches * or with a NULL value if no datum matches
* @param proc_cls closure for proc * @param proc_cls closure for proc
* @return NULL if the entry was not queued, otherwise a handle that can be used to * @return NULL if the entry was not queued, otherwise a handle that can be used to
* cancel * cancel
*/ */
struct GNUNET_DATASTORE_QueueEntry * struct GNUNET_DATASTORE_QueueEntry *
GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, uint64_t offse t, GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, uint64_t offse t,
const GNUNET_HashCode * key, const struct GNUNET_HashCode * key,
enum GNUNET_BLOCK_Type type, enum GNUNET_BLOCK_Type type,
unsigned int queue_priority, unsigned int queue_priority,
unsigned int max_queue_size, unsigned int max_queue_size,
struct GNUNET_TIME_Relative timeout, struct GNUNET_TIME_Relative timeout,
GNUNET_DATASTORE_DatumProcessor proc, void *proc_ cls); GNUNET_DATASTORE_DatumProcessor proc, void *proc_ cls);
/** /**
* Get a single zero-anonymity value from the datastore. * Get a single zero-anonymity value from the datastore.
* Note that some implementations can ignore the 'offset' and * Note that some implementations can ignore the 'offset' and
* instead return a random zero-anonymity value. In that case, * instead return a random zero-anonymity value. In that case,
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added


 gnunet_dht_service.h   gnunet_dht_service.h 
skipping to change at line 156 skipping to change at line 156
* @param data the data to store * @param data the data to store
* @param exp desired expiration time for the value * @param exp desired expiration time for the value
* @param timeout how long to wait for transmission of this request * @param timeout how long to wait for transmission of this request
* @param cont continuation to call when done (transmitting request to serv ice) * @param cont continuation to call when done (transmitting request to serv ice)
* You must not call "GNUNET_DHT_disconnect" in this continuation * You must not call "GNUNET_DHT_disconnect" in this continuation
* @param cont_cls closure for cont * @param cont_cls closure for cont
* @return handle to cancel the "PUT" operation, NULL on error * @return handle to cancel the "PUT" operation, NULL on error
* (size too big) * (size too big)
*/ */
struct GNUNET_DHT_PutHandle * struct GNUNET_DHT_PutHandle *
GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, const GNUNET_HashCode * k GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle,
ey, const struct GNUNET_HashCode * key,
uint32_t desired_replication_level, uint32_t desired_replication_level,
enum GNUNET_DHT_RouteOption options, enum GNUNET_DHT_RouteOption options,
enum GNUNET_BLOCK_Type type, size_t size, const char *data, enum GNUNET_BLOCK_Type type,
size_t size, const void *data,
struct GNUNET_TIME_Absolute exp, struct GNUNET_TIME_Absolute exp,
struct GNUNET_TIME_Relative timeout, struct GNUNET_TIME_Relative timeout,
GNUNET_DHT_PutContinuation cont, GNUNET_DHT_PutContinuation cont,
void *cont_cls); void *cont_cls);
/** /**
* Cancels a DHT PUT operation. Note that the PUT request may still * Cancels a DHT PUT operation. Note that the PUT request may still
* go out over the network (we can't stop that); However, if the PUT * go out over the network (we can't stop that); However, if the PUT
* has not yet been sent to the service, cancelling the PUT will stop * has not yet been sent to the service, cancelling the PUT will stop
* this from happening (but there is no way for the user of this API * this from happening (but there is no way for the user of this API
skipping to change at line 196 skipping to change at line 198
* @param get_path peers on reply path (or NULL if not recorded) * @param get_path peers on reply path (or NULL if not recorded)
* @param get_path_length number of entries in get_path * @param get_path_length number of entries in get_path
* @param put_path peers on the PUT path (or NULL if not recorded) * @param put_path peers on the PUT path (or NULL if not recorded)
* @param put_path_length number of entries in get_path * @param put_path_length number of entries in get_path
* @param type type of the result * @param type type of the result
* @param size number of bytes in data * @param size number of bytes in data
* @param data pointer to the result data * @param data pointer to the result data
*/ */
typedef void (*GNUNET_DHT_GetIterator) (void *cls, typedef void (*GNUNET_DHT_GetIterator) (void *cls,
struct GNUNET_TIME_Absolute exp, struct GNUNET_TIME_Absolute exp,
const GNUNET_HashCode * key, const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity * const struct GNUNET_PeerIdentity *
get_path, unsigned int get_path_len gth, get_path, unsigned int get_path_len gth,
const struct GNUNET_PeerIdentity * const struct GNUNET_PeerIdentity *
put_path, unsigned int put_path_len gth, put_path, unsigned int put_path_len gth,
enum GNUNET_BLOCK_Type type, enum GNUNET_BLOCK_Type type,
size_t size, const void *data); size_t size, const void *data);
/** /**
* Perform an asynchronous GET operation on the DHT identified. See * Perform an asynchronous GET operation on the DHT identified. See
* also "GNUNET_BLOCK_evaluate". * also "GNUNET_BLOCK_evaluate".
skipping to change at line 223 skipping to change at line 225
* @param options routing options for this message * @param options routing options for this message
* @param xquery extended query data (can be NULL, depending on type) * @param xquery extended query data (can be NULL, depending on type)
* @param xquery_size number of bytes in xquery * @param xquery_size number of bytes in xquery
* @param iter function to call on each result * @param iter function to call on each result
* @param iter_cls closure for iter * @param iter_cls closure for iter
* *
* @return handle to stop the async get * @return handle to stop the async get
*/ */
struct GNUNET_DHT_GetHandle * struct GNUNET_DHT_GetHandle *
GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle,
enum GNUNET_BLOCK_Type type, const GNUNET_HashCode * key, enum GNUNET_BLOCK_Type type, const struct GNUNET_Hash Code * key,
uint32_t desired_replication_level, uint32_t desired_replication_level,
enum GNUNET_DHT_RouteOption options, const void *xque ry, enum GNUNET_DHT_RouteOption options, const void *xque ry,
size_t xquery_size, GNUNET_DHT_GetIterator iter, size_t xquery_size, GNUNET_DHT_GetIterator iter,
void *iter_cls); void *iter_cls);
/** /**
* Stop async DHT-get. Frees associated resources. * Stop async DHT-get. Frees associated resources.
* *
* @param get_handle GET operation to stop. * @param get_handle GET operation to stop.
* *
skipping to change at line 266 skipping to change at line 268
* @param desired_replication_level Desired replication level. * @param desired_replication_level Desired replication level.
* @param key Key of the requested data. * @param key Key of the requested data.
*/ */
typedef void (*GNUNET_DHT_MonitorGetCB) (void *cls, typedef void (*GNUNET_DHT_MonitorGetCB) (void *cls,
enum GNUNET_DHT_RouteOption option s, enum GNUNET_DHT_RouteOption option s,
enum GNUNET_BLOCK_Type type, enum GNUNET_BLOCK_Type type,
uint32_t hop_count, uint32_t hop_count,
uint32_t desired_replication_level , uint32_t desired_replication_level ,
unsigned int path_length, unsigned int path_length,
const struct GNUNET_PeerIdentity * path, const struct GNUNET_PeerIdentity * path,
const GNUNET_HashCode * key); const struct GNUNET_HashCode * key );
/** /**
* Callback called on each GET reply going through the DHT. * Callback called on each GET reply going through the DHT.
* *
* @param cls Closure. * @param cls Closure.
* @param type The type of data in the result. * @param type The type of data in the result.
* @param get_path Peers on GET path (or NULL if not recorded). * @param get_path Peers on GET path (or NULL if not recorded).
* @param get_path_length number of entries in get_path. * @param get_path_length number of entries in get_path.
* @param put_path peers on the PUT path (or NULL if not recorded). * @param put_path peers on the PUT path (or NULL if not recorded).
* @param put_path_length number of entries in get_path. * @param put_path_length number of entries in get_path.
skipping to change at line 291 skipping to change at line 293
*/ */
typedef void (*GNUNET_DHT_MonitorGetRespCB) (void *cls, typedef void (*GNUNET_DHT_MonitorGetRespCB) (void *cls,
enum GNUNET_BLOCK_Type type, enum GNUNET_BLOCK_Type type,
const struct GNUNET_PeerIdenti ty const struct GNUNET_PeerIdenti ty
*get_path, *get_path,
unsigned int get_path_length, unsigned int get_path_length,
const struct GNUNET_PeerIdenti ty const struct GNUNET_PeerIdenti ty
* put_path, * put_path,
unsigned int put_path_length, unsigned int put_path_length,
struct GNUNET_TIME_Absolute ex p, struct GNUNET_TIME_Absolute ex p,
const GNUNET_HashCode * key, const struct GNUNET_HashCode * key,
const void *data, const void *data,
size_t size); size_t size);
/** /**
* Callback called on each PUT request going through the DHT. * Callback called on each PUT request going through the DHT.
* *
* @param cls Closure. * @param cls Closure.
* @param options Options, for instance RecordRoute, DemultiplexEverywhere. * @param options Options, for instance RecordRoute, DemultiplexEverywhere.
* @param type The type of data in the request. * @param type The type of data in the request.
* @param hop_count Hop count so far. * @param hop_count Hop count so far.
skipping to change at line 318 skipping to change at line 320
* @param size Number of bytes in data. * @param size Number of bytes in data.
*/ */
typedef void (*GNUNET_DHT_MonitorPutCB) (void *cls, typedef void (*GNUNET_DHT_MonitorPutCB) (void *cls,
enum GNUNET_DHT_RouteOption option s, enum GNUNET_DHT_RouteOption option s,
enum GNUNET_BLOCK_Type type, enum GNUNET_BLOCK_Type type,
uint32_t hop_count, uint32_t hop_count,
uint32_t desired_replication_level , uint32_t desired_replication_level ,
unsigned int path_length, unsigned int path_length,
const struct GNUNET_PeerIdentity * path, const struct GNUNET_PeerIdentity * path,
struct GNUNET_TIME_Absolute exp, struct GNUNET_TIME_Absolute exp,
const GNUNET_HashCode * key, const struct GNUNET_HashCode * key ,
const void *data, const void *data,
size_t size); size_t size);
/** /**
* Start monitoring the local DHT service. * Start monitoring the local DHT service.
* *
* @param handle Handle to the DHT service. * @param handle Handle to the DHT service.
* @param type Type of blocks that are of interest. * @param type Type of blocks that are of interest.
* @param key Key of data of interest, NULL for all. * @param key Key of data of interest, NULL for all.
* @param get_cb Callback to process monitored get messages. * @param get_cb Callback to process monitored get messages.
* @param get_resp_cb Callback to process monitored get response messages. * @param get_resp_cb Callback to process monitored get response messages.
* @param put_cb Callback to process monitored put messages. * @param put_cb Callback to process monitored put messages.
* @param cb_cls Closure for cb. * @param cb_cls Closure for cb.
* *
* @return Handle to stop monitoring. * @return Handle to stop monitoring.
*/ */
struct GNUNET_DHT_MonitorHandle * struct GNUNET_DHT_MonitorHandle *
GNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle, GNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle,
enum GNUNET_BLOCK_Type type, enum GNUNET_BLOCK_Type type,
const GNUNET_HashCode *key, const struct GNUNET_HashCode *key,
GNUNET_DHT_MonitorGetCB get_cb, GNUNET_DHT_MonitorGetCB get_cb,
GNUNET_DHT_MonitorGetRespCB get_resp_cb, GNUNET_DHT_MonitorGetRespCB get_resp_cb,
GNUNET_DHT_MonitorPutCB put_cb, GNUNET_DHT_MonitorPutCB put_cb,
void *cb_cls); void *cb_cls);
/** /**
* Stop monitoring. * Stop monitoring.
* *
* @param handle The handle to the monitor request returned by monitor_star t. * @param handle The handle to the monitor request returned by monitor_star t.
* *
 End of changes. 8 change blocks. 
9 lines changed or deleted 10 lines changed or added


 gnunet_disk_lib.h   gnunet_disk_lib.h 
skipping to change at line 39 skipping to change at line 39
#define OFF_T uint64_t #define OFF_T uint64_t
#else #else
#define OFF_T off_t #define OFF_T off_t
#endif #endif
/** /**
* Handle used to manage a pipe. * Handle used to manage a pipe.
*/ */
struct GNUNET_DISK_PipeHandle; struct GNUNET_DISK_PipeHandle;
/**
* Type of a handle.
*/
enum GNUNET_FILE_Type enum GNUNET_FILE_Type
{ {
GNUNET_DISK_FILE, GNUNET_PIPE /**
* Handle represents a file.
*/
GNUNET_DISK_HANLDE_TYPE_FILE,
/**
* Handle represents a pipe.
*/
GNUNET_DISK_HANLDE_TYPE_PIPE
}; };
/** /**
* Handle used to access files (and pipes). * Handle used to access files (and pipes).
*/ */
struct GNUNET_DISK_FileHandle struct GNUNET_DISK_FileHandle
{ {
#if WINDOWS #if WINDOWS
/** /**
skipping to change at line 216 skipping to change at line 227
*/ */
GNUNET_DISK_PERM_OTHER_WRITE = 128, GNUNET_DISK_PERM_OTHER_WRITE = 128,
/** /**
* Everybody can execute. * Everybody can execute.
*/ */
GNUNET_DISK_PERM_OTHER_EXEC = 256 GNUNET_DISK_PERM_OTHER_EXEC = 256
}; };
/** /**
* Constants for specifying how to seek. * Constants for specifying how to seek. Do not change values or order,
* some of the code depends on the specific numeric values!
*/ */
enum GNUNET_DISK_Seek enum GNUNET_DISK_Seek
{ {
/** /**
* Seek an absolute position (from the start of the file). * Seek an absolute position (from the start of the file).
*/ */
GNUNET_DISK_SEEK_SET, GNUNET_DISK_SEEK_SET = 0,
/** /**
* Seek a relative position (from the current offset). * Seek a relative position (from the current offset).
*/ */
GNUNET_DISK_SEEK_CUR, GNUNET_DISK_SEEK_CUR = 1,
/** /**
* Seek an absolute position from the end of the file. * Seek an absolute position from the end of the file.
*/ */
GNUNET_DISK_SEEK_END GNUNET_DISK_SEEK_END = 2
}; };
/** /**
* Enumeration identifying the two ends of a pipe. * Enumeration identifying the two ends of a pipe.
*/ */
enum GNUNET_DISK_PipeEnd enum GNUNET_DISK_PipeEnd
{ {
/** /**
* The reading-end of a pipe. * The reading-end of a pipe.
*/ */
skipping to change at line 345 skipping to change at line 357
* *
* @param t component to use for the name; * @param t component to use for the name;
* does NOT contain "XXXXXX" or "/tmp/". * does NOT contain "XXXXXX" or "/tmp/".
* @return NULL on error, otherwise name of fresh * @return NULL on error, otherwise name of fresh
* file on disk in directory for temporary files * file on disk in directory for temporary files
*/ */
char * char *
GNUNET_DISK_mktemp (const char *t); GNUNET_DISK_mktemp (const char *t);
/** /**
* Create an (empty) temporary directory on disk. If the given name is not
an
* absolute path, the current 'TMPDIR' will be prepended. In any case, 6
* random characters will be appended to the name to create a unique name.
*
* @param t component to use for the name;
* does NOT contain "XXXXXX" or "/tmp/".
* @return NULL on error, otherwise name of freshly created directory
*/
char *
GNUNET_DISK_mkdtemp (const char *t);
/**
* Open a file. Note that the access permissions will only be * Open a file. Note that the access permissions will only be
* used if a new file is created and if the underlying operating * used if a new file is created and if the underlying operating
* system supports the given permissions. * system supports the given permissions.
* *
* @param fn file name to be opened * @param fn file name to be opened
* @param flags opening flags, a combination of GNUNET_DISK_OPEN_xxx bit fl ags * @param flags opening flags, a combination of GNUNET_DISK_OPEN_xxx bit fl ags
* @param perm permissions for the newly created file, use * @param perm permissions for the newly created file, use
* GNUNET_DISK_PERM_NONE if a file could not be created by this * GNUNET_DISK_PERM_NONE if a file could not be created by this
* call (because of flags) * call (because of flags)
* @return IO handle on success, NULL on error * @return IO handle on success, NULL on error
skipping to change at line 436 skipping to change at line 460
* *
* @param p pipe * @param p pipe
* @param n end to access * @param n end to access
* @return handle for the respective end * @return handle for the respective end
*/ */
const struct GNUNET_DISK_FileHandle * const struct GNUNET_DISK_FileHandle *
GNUNET_DISK_pipe_handle (const struct GNUNET_DISK_PipeHandle *p, GNUNET_DISK_pipe_handle (const struct GNUNET_DISK_PipeHandle *p,
enum GNUNET_DISK_PipeEnd n); enum GNUNET_DISK_PipeEnd n);
/** /**
* Get a handle from a native FD.
*
* @param fd native file descriptor
* @return file handle corresponding to the descriptor
*/
struct GNUNET_DISK_FileHandle *
GNUNET_DISK_get_handle_from_native (FILE *fd);
/**
* Read the contents of a binary file into a buffer. * Read the contents of a binary file into a buffer.
* @param h handle to an open file * @param h handle to an open file
* @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);
skipping to change at line 458 skipping to change at line 491
* Guarantees not to block (returns GNUNET_SYSERR and sets errno to EAGAIN * Guarantees not to block (returns GNUNET_SYSERR and sets errno to EAGAIN
* when no data can be read). * when no data can be read).
* *
* @param h handle to an open file * @param h handle to an open file
* @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_non_blocking (const struct GNUNET_DISK_FileHandle * h , GNUNET_DISK_file_read_non_blocking (const struct GNUNET_DISK_FileHandle * h ,
void *result, size_t len); void *result, size_t len);
/** /**
* Read the contents of a binary file into a buffer. * 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
skipping to change at line 615 skipping to change at line 648
* @return GNUNET_YES if yes, GNUNET_NO if does not exist, GNUNET_SYSERR * @return GNUNET_YES if yes, GNUNET_NO if does not exist, GNUNET_SYSERR
* on any error and if exists but not directory * on any error and if exists but not directory
*/ */
int int
GNUNET_DISK_directory_test (const char *fil); GNUNET_DISK_directory_test (const char *fil);
/** /**
* Remove all files in a directory (rm -rf). Call with * Remove all files in a directory (rm -rf). Call with
* caution. * caution.
* *
* @param fileName the file to remove * @param filename the file to remove
* @return GNUNET_OK on success, GNUNET_SYSERR on error * @return GNUNET_OK on success, GNUNET_SYSERR on error
*/ */
int int
GNUNET_DISK_directory_remove (const char *fileName); GNUNET_DISK_directory_remove (const char *filename);
/** /**
* Implementation of "mkdir -p" * Implementation of "mkdir -p"
* *
* @param dir the directory to create * @param dir the directory to create
* @returns GNUNET_SYSERR on failure, GNUNET_OK otherwise * @returns GNUNET_SYSERR on failure, GNUNET_OK otherwise
*/ */
int int
GNUNET_DISK_directory_create (const char *dir); GNUNET_DISK_directory_create (const char *dir);
 End of changes. 11 change blocks. 
8 lines changed or deleted 42 lines changed or added


 gnunet_dnsparser_lib.h   gnunet_dnsparser_lib.h 
skipping to change at line 34 skipping to change at line 34
* @author Philipp Toelke * @author Philipp Toelke
* @author Christian Grothoff * @author Christian Grothoff
*/ */
#ifndef GNUNET_DNSPARSER_LIB_H #ifndef GNUNET_DNSPARSER_LIB_H
#define GNUNET_DNSPARSER_LIB_H #define GNUNET_DNSPARSER_LIB_H
#include "platform.h" #include "platform.h"
#include "gnunet_common.h" #include "gnunet_common.h"
/** /**
* Maximum length of a label in DNS.
*/
#define GNUNET_DNSPARSER_MAX_LABEL_LENGTH 63
/**
* Maximum length of a name in DNS.
*/
#define GNUNET_DNSPARSER_MAX_NAME_LENGTH 253
/**
* A few common DNS types. * A few common DNS types.
*/ */
#define GNUNET_DNSPARSER_TYPE_A 1 #define GNUNET_DNSPARSER_TYPE_A 1
#define GNUNET_DNSPARSER_TYPE_NS 2 #define GNUNET_DNSPARSER_TYPE_NS 2
#define GNUNET_DNSPARSER_TYPE_CNAME 5 #define GNUNET_DNSPARSER_TYPE_CNAME 5
#define GNUNET_DNSPARSER_TYPE_SOA 6 #define GNUNET_DNSPARSER_TYPE_SOA 6
#define GNUNET_DNSPARSER_TYPE_PTR 12 #define GNUNET_DNSPARSER_TYPE_PTR 12
#define GNUNET_DNSPARSER_TYPE_MX 15 #define GNUNET_DNSPARSER_TYPE_MX 15
#define GNUNET_DNSPARSER_TYPE_TXT 16 #define GNUNET_DNSPARSER_TYPE_TXT 16
#define GNUNET_DNSPARSER_TYPE_AAAA 28 #define GNUNET_DNSPARSER_TYPE_AAAA 28
#define GNUNET_DNSPARSER_TYPE_SRV 33
#define GNUNET_DNSPARSER_TYPE_TLSA 52
/** /**
* A few common DNS classes (ok, only one is common, but I list a * A few common DNS classes (ok, only one is common, but I list a
* couple more to make it clear what we're talking about here). * couple more to make it clear what we're talking about here).
*/ */
#define GNUNET_DNSPARSER_CLASS_INTERNET 1 #define GNUNET_DNSPARSER_CLASS_INTERNET 1
#define GNUNET_DNSPARSER_CLASS_CHAOS 3 #define GNUNET_DNSPARSER_CLASS_CHAOS 3
#define GNUNET_DNSPARSER_CLASS_HESIOD 4 #define GNUNET_DNSPARSER_CLASS_HESIOD 4
#define GNUNET_DNSPARSER_OPCODE_QUERY 0 #define GNUNET_DNSPARSER_OPCODE_QUERY 0
skipping to change at line 81 skipping to change at line 93
#define GNUNET_DNSPARSER_RETURN_CODE_YXRRSET 7 #define GNUNET_DNSPARSER_RETURN_CODE_YXRRSET 7
#define GNUNET_DNSPARSER_RETURN_CODE_NXRRSET 8 #define GNUNET_DNSPARSER_RETURN_CODE_NXRRSET 8
#define GNUNET_DNSPARSER_RETURN_CODE_NOT_AUTH 9 #define GNUNET_DNSPARSER_RETURN_CODE_NOT_AUTH 9
#define GNUNET_DNSPARSER_RETURN_CODE_NOT_ZONE 10 #define GNUNET_DNSPARSER_RETURN_CODE_NOT_ZONE 10
/** /**
* DNS flags (largely RFC 1035 / RFC 2136). * DNS flags (largely RFC 1035 / RFC 2136).
*/ */
struct GNUNET_DNSPARSER_Flags struct GNUNET_DNSPARSER_Flags
{ {
#if __BYTE_ORDER == __LITTLE_ENDIAN
/** /**
* Set to 1 if recursion is desired (client -> server) * Set to 1 if recursion is desired (client -> server)
*/ */
unsigned int recursion_desired : 1 GNUNET_PACKED; unsigned int recursion_desired : 1 GNUNET_PACKED;
/** /**
* Set to 1 if message is truncated * Set to 1 if message is truncated
*/ */
unsigned int message_truncated : 1 GNUNET_PACKED; unsigned int message_truncated : 1 GNUNET_PACKED;
skipping to change at line 130 skipping to change at line 143
/** /**
* Always zero. * Always zero.
*/ */
unsigned int zero : 1 GNUNET_PACKED; unsigned int zero : 1 GNUNET_PACKED;
/** /**
* Set to 1 if recursion is available (server -> client) * Set to 1 if recursion is available (server -> client)
*/ */
unsigned int recursion_available : 1 GNUNET_PACKED; unsigned int recursion_available : 1 GNUNET_PACKED;
#elif __BYTE_ORDER == __BIG_ENDIAN
/**
* query:0, response:1
*/
unsigned int query_or_response : 1 GNUNET_PACKED;
/**
* See GNUNET_DNSPARSER_OPCODE_ defines.
*/
unsigned int opcode : 4 GNUNET_PACKED;
/**
* Set to 1 if this is an authoritative answer
*/
unsigned int authoritative_answer : 1 GNUNET_PACKED;
/**
* Set to 1 if message is truncated
*/
unsigned int message_truncated : 1 GNUNET_PACKED;
/**
* Set to 1 if recursion is desired (client -> server)
*/
unsigned int recursion_desired : 1 GNUNET_PACKED;
/**
* Set to 1 if recursion is available (server -> client)
*/
unsigned int recursion_available : 1 GNUNET_PACKED;
/**
* Always zero.
*/
unsigned int zero : 1 GNUNET_PACKED;
/**
* Response has been cryptographically verified, RFC 4035.
*/
unsigned int authenticated_data : 1 GNUNET_PACKED;
/**
* See RFC 4035.
*/
unsigned int checking_disabled : 1 GNUNET_PACKED;
/**
* See GNUNET_DNSPARSER_RETURN_CODE_ defines.
*/
unsigned int return_code : 4 GNUNET_PACKED;
#else
#error byteorder undefined
#endif
} GNUNET_GCC_STRUCT_LAYOUT; } GNUNET_GCC_STRUCT_LAYOUT;
/** /**
* A DNS query. * A DNS query.
*/ */
struct GNUNET_DNSPARSER_Query struct GNUNET_DNSPARSER_Query
{ {
/** /**
* Name of the record that the query is for (0-terminated). * Name of the record that the query is for (0-terminated).
* In UTF-8 format. The library will convert from and to DNS-IDNA
* as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an
* individual label is well-formed. If a given name is not well-formed,
* creating the DNS packet will fail.
*/ */
char *name; char *name;
/** /**
* See GNUNET_DNSPARSER_TYPE_*. * See GNUNET_DNSPARSER_TYPE_*.
*/ */
uint16_t type; uint16_t type;
/** /**
* See GNUNET_DNSPARSER_CLASS_*. * See GNUNET_DNSPARSER_CLASS_*.
skipping to change at line 169 skipping to change at line 240
struct GNUNET_DNSPARSER_MxRecord struct GNUNET_DNSPARSER_MxRecord
{ {
/** /**
* Preference for this entry (lower value is higher preference). * Preference for this entry (lower value is higher preference).
*/ */
uint16_t preference; uint16_t preference;
/** /**
* Name of the mail server. * Name of the mail server.
* In UTF-8 format. The library will convert from and to DNS-IDNA
* as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an
* individual label is well-formed. If a given name is not well-formed,
* creating the DNS packet will fail.
*/ */
char *mxhost; char *mxhost;
}; };
/** /**
* Information from SRV records (RFC 2782). The 'service', 'proto'
* and 'domain_name' fields together give the DNS-name which for SRV
* records is of the form "_$SERVICE._$PROTO.$DOMAIN_NAME". The DNS
* parser provides the full name in 'struct DNSPARSER_Record' and the
* individual components in the respective fields of this struct.
* When serializing, you CAN set the 'name' field of 'struct
* GNUNET_DNSPARSER_Record' to NULL, in which case the DNSPARSER code
* will populate 'name' from the 'service', 'proto' and 'domain_name'
* fields in this struct.
*/
struct GNUNET_DNSPARSER_SrvRecord
{
/**
* Service name without the underscore (!). Note that RFC 6335 clarifies
the
* set of legal characters for service names.
* In UTF-8 format. The library will convert from and to DNS-IDNA
* as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an
* individual label is well-formed. If a given name is not well-formed,
* creating the DNS packet will fail.
*/
char *service;
/**
* Transport protocol (typcially "tcp" or "udp", but others might be allo
wed).
* Without the underscore (!).
*/
char *proto;
/**
* Domain name for which the record is valid
* In UTF-8 format. The library will convert from and to DNS-IDNA
* as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an
* individual label is well-formed. If a given name is not well-formed,
* creating the DNS packet will fail.
*/
char *domain_name;
/**
* Hostname offering the service.
* In UTF-8 format. The library will convert from and to DNS-IDNA
* as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an
* individual label is well-formed. If a given name is not well-formed,
* creating the DNS packet will fail.
*/
char *target;
/**
* Preference for this entry (lower value is higher preference). Clients
* will contact hosts from the lowest-priority group first and fall back
* to higher priorities if the low-priority entries are unavailable.
*/
uint16_t priority;
/**
* Relative weight for records with the same priority. Clients will use
* the hosts of the same (lowest) priority with a probability proportiona
l
* to the weight given.
*/
uint16_t weight;
/**
* TCP or UDP port of the service.
*/
uint16_t port;
};
/**
* Information from SOA records (RFC 1035). * Information from SOA records (RFC 1035).
*/ */
struct GNUNET_DNSPARSER_SoaRecord struct GNUNET_DNSPARSER_SoaRecord
{ {
/** /**
*The domainname of the name server that was the *The domainname of the name server that was the
* original or primary source of data for this zone. * original or primary source of data for this zone.
* In UTF-8 format. The library will convert from and to DNS-IDNA
* as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an
* individual label is well-formed. If a given name is not well-formed,
* creating the DNS packet will fail.
*/ */
char *mname; char *mname;
/** /**
* A domainname which specifies the mailbox of the * A domainname which specifies the mailbox of the
* person responsible for this zone. * person responsible for this zone.
* In UTF-8 format. The library will convert from and to DNS-IDNA
* as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an
* individual label is well-formed. If a given name is not well-formed,
* creating the DNS packet will fail.
*/ */
char *rname; char *rname;
/** /**
* The version number of the original copy of the zone. * The version number of the original copy of the zone.
*/ */
uint32_t serial; uint32_t serial;
/** /**
* Time interval before the zone should be refreshed. * Time interval before the zone should be refreshed.
skipping to change at line 247 skipping to change at line 399
}; };
/** /**
* A DNS response record. * A DNS response record.
*/ */
struct GNUNET_DNSPARSER_Record struct GNUNET_DNSPARSER_Record
{ {
/** /**
* Name of the record that the query is for (0-terminated). * Name of the record that the query is for (0-terminated).
* In UTF-8 format. The library will convert from and to DNS-IDNA
* as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an
* individual label is well-formed. If a given name is not well-formed,
* creating the DNS packet will fail.
*/ */
char *name; char *name;
/**
* Payload of the record (which one of these is valid depends on the 'typ
e').
*/
union union
{ {
/** /**
* For NS, CNAME and PTR records, this is the uncompressed 0-terminated hostname. * For NS, CNAME and PTR records, this is the uncompressed 0-terminated hostname.
* In UTF-8 format. The library will convert from and to DNS-IDNA
* as necessary. Use 'GNUNET_DNSPARSER_check_label' to test if an
* individual label is well-formed. If a given name is not well-formed,
* creating the DNS packet will fail.
*/ */
char *hostname; char *hostname;
/** /**
* SOA data for SOA records. * SOA data for SOA records.
*/ */
struct GNUNET_DNSPARSER_SoaRecord *soa; struct GNUNET_DNSPARSER_SoaRecord *soa;
/** /**
* MX data for MX records. * MX data for MX records.
*/ */
struct GNUNET_DNSPARSER_MxRecord *mx; struct GNUNET_DNSPARSER_MxRecord *mx;
/** /**
* SRV data for SRV records.
*/
struct GNUNET_DNSPARSER_SrvRecord *srv;
/**
* Raw data for all other types. * Raw data for all other types.
*/ */
struct GNUNET_DNSPARSER_RawRecord raw; struct GNUNET_DNSPARSER_RawRecord raw;
} data; } data;
/** /**
* When does the record expire? * When does the record expire?
*/ */
struct GNUNET_TIME_Absolute expiration_time; struct GNUNET_TIME_Absolute expiration_time;
skipping to change at line 350 skipping to change at line 518
struct GNUNET_DNSPARSER_Flags flags; struct GNUNET_DNSPARSER_Flags flags;
/** /**
* DNS ID (to match replies to requests). * DNS ID (to match replies to requests).
*/ */
uint16_t id; uint16_t id;
}; };
/** /**
* Check if a label in UTF-8 format can be coded into valid IDNA.
* This can fail if the ASCII-conversion becomes longer than 63 characters.
*
* @param label label to check (UTF-8 string)
* @return GNUNET_OK if the label can be converted to IDNA,
* GNUNET_SYSERR if the label is not valid for DNS names
*/
int
GNUNET_DNSPARSER_check_label (const char *label);
/**
* Parse a UDP payload of a DNS packet in to a nice struct for further * Parse a UDP payload of a DNS packet in to a nice struct for further
* processing and manipulation. * processing and manipulation.
* *
* @param udp_payload wire-format of the DNS packet * @param udp_payload wire-format of the DNS packet
* @param udp_payload_length number of bytes in udp_payload * @param udp_payload_length number of bytes in udp_payload
* @return NULL on error, otherwise the parsed packet * @return NULL on error, otherwise the parsed packet
*/ */
struct GNUNET_DNSPARSER_Packet * struct GNUNET_DNSPARSER_Packet *
GNUNET_DNSPARSER_parse (const char *udp_payload, GNUNET_DNSPARSER_parse (const char *udp_payload,
size_t udp_payload_length); size_t udp_payload_length);
 End of changes. 14 change blocks. 
0 lines changed or deleted 183 lines changed or added


 gnunet_fragmentation_lib.h   gnunet_fragmentation_lib.h 
skipping to change at line 73 skipping to change at line 73
* Create a fragmentation context for the given message. * Create a fragmentation context for the given message.
* Fragments the message into fragments of size "mtu" or * Fragments the message into fragments of size "mtu" or
* less. Calls 'proc' on each un-acknowledged fragment, * less. Calls 'proc' on each un-acknowledged fragment,
* using both the expected 'delay' between messages and * using both the expected 'delay' between messages and
* acknowledgements and the given 'tracker' to guide the * acknowledgements and the given 'tracker' to guide the
* frequency of calls to 'proc'. * frequency of calls to 'proc'.
* *
* @param stats statistics context * @param stats statistics context
* @param mtu the maximum message size for each fragment * @param mtu the maximum message size for each fragment
* @param tracker bandwidth tracker to use for flow control (can be NULL) * @param tracker bandwidth tracker to use for flow control (can be NULL)
* @param delay expected delay between fragment transmission * @param msg_delay initial delay to insert between fragment transmissions
* based on previous messages
* @param ack_delay expected delay between fragment transmission
* and ACK based on previous messages * and ACK based on previous messages
* @param msg the message to fragment * @param msg the message to fragment
* @param proc function to call for each fragment to transmit * @param proc function to call for each fragment to transmit
* @param proc_cls closure for proc * @param proc_cls closure for proc
* @return the fragmentation context * @return the fragmentation context
*/ */
struct GNUNET_FRAGMENT_Context * struct GNUNET_FRAGMENT_Context *
GNUNET_FRAGMENT_context_create (struct GNUNET_STATISTICS_Handle *stats, GNUNET_FRAGMENT_context_create (struct GNUNET_STATISTICS_Handle *stats,
uint16_t mtu, uint16_t mtu,
struct GNUNET_BANDWIDTH_Tracker *tracker, struct GNUNET_BANDWIDTH_Tracker *tracker,
struct GNUNET_TIME_Relative delay, struct GNUNET_TIME_Relative msg_delay,
struct GNUNET_TIME_Relative ack_delay,
const struct GNUNET_MessageHeader *msg, const struct GNUNET_MessageHeader *msg,
GNUNET_FRAGMENT_MessageProcessor proc, GNUNET_FRAGMENT_MessageProcessor proc,
void *proc_cls); void *proc_cls);
/** /**
* Continuation to call from the 'proc' function after the fragment * Continuation to call from the 'proc' function after the fragment
* has been transmitted (and hence the next fragment can now be * has been transmitted (and hence the next fragment can now be
* given to proc). * given to proc).
* *
* @param fc fragmentation context * @param fc fragmentation context
skipping to change at line 119 skipping to change at line 122
*/ */
int int
GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc, GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc,
const struct GNUNET_MessageHeader *msg); const struct GNUNET_MessageHeader *msg);
/** /**
* Destroy the given fragmentation context (stop calling 'proc', free * Destroy the given fragmentation context (stop calling 'proc', free
* resources). * resources).
* *
* @param fc fragmentation context * @param fc fragmentation context
* @return average delay between transmission and ACK for the * @param msg_delay where to store average delay between individual message
* last message, FOREVER if the message was not fully transmitted transmissions the
* last message (OUT only)
* @param ack_delay where to store average delay between transmission and A
CK for the
* last message, set to FOREVER if the message was not fully transm
itted (OUT only)
*/ */
struct GNUNET_TIME_Relative void
GNUNET_FRAGMENT_context_destroy (struct GNUNET_FRAGMENT_Context *fc); GNUNET_FRAGMENT_context_destroy (struct GNUNET_FRAGMENT_Context *fc,
struct GNUNET_TIME_Relative *msg_delay,
struct GNUNET_TIME_Relative *ack_delay);
/** /**
* Defragmentation context (one per connection). * Defragmentation context (one per connection).
*/ */
struct GNUNET_DEFRAGMENT_Context; struct GNUNET_DEFRAGMENT_Context;
/** /**
* Function that is called with acknowledgement messages created by * Function that is called with acknowledgement messages created by
* the fragmentation module. Acknowledgements are cummulative, * the fragmentation module. Acknowledgements are cummulative,
* so it is OK to only transmit the 'latest' ack message for the same * so it is OK to only transmit the 'latest' ack message for the same
 End of changes. 4 change blocks. 
6 lines changed or deleted 16 lines changed or added


 gnunet_fs_service.h   gnunet_fs_service.h 
skipping to change at line 58 skipping to change at line 58
* 3.1.x: with namespace meta-data * 3.1.x: with namespace meta-data
* 3.2.x: with collections * 3.2.x: with collections
* 4.0.x: with expiration, variable meta-data, kblocks * 4.0.x: with expiration, variable meta-data, kblocks
* 4.1.x: with new error and configuration handling * 4.1.x: with new error and configuration handling
* 5.0.x: with location URIs * 5.0.x: with location URIs
* 6.0.0: with support for OR in KSKs * 6.0.0: with support for OR in KSKs
* 6.1.x: with simplified namespace support * 6.1.x: with simplified namespace support
* 9.0.0: CPS-style integrated API * 9.0.0: CPS-style integrated API
* 9.1.1: asynchronous directory scanning * 9.1.1: asynchronous directory scanning
*/ */
#define GNUNET_FS_VERSION 0x00090102 #define GNUNET_FS_VERSION 0x00090103
/* ******************** URI API *********************** */ /* ******************** URI API *********************** */
#define GNUNET_FS_URI_PREFIX "gnunet://fs/" #define GNUNET_FS_URI_PREFIX "gnunet://fs/"
#define GNUNET_FS_URI_KSK_INFIX "ksk/" #define GNUNET_FS_URI_KSK_INFIX "ksk/"
#define GNUNET_FS_URI_SKS_INFIX "sks/" #define GNUNET_FS_URI_SKS_INFIX "sks/"
#define GNUNET_FS_URI_CHK_INFIX "chk/" #define GNUNET_FS_URI_CHK_INFIX "chk/"
#define GNUNET_FS_URI_LOC_INFIX "loc/" #define GNUNET_FS_URI_LOC_INFIX "loc/"
/** /**
skipping to change at line 92 skipping to change at line 92
int is_mandatory); int is_mandatory);
/** /**
* Get a unique key from a URI. This is for putting URIs * Get a unique key from a URI. This is for putting URIs
* into HashMaps. The key may change between FS implementations. * into HashMaps. The key may change between FS implementations.
* *
* @param uri uri to convert to a unique key * @param uri uri to convert to a unique key
* @param key wherer to store the unique key * @param key wherer to store the unique key
*/ */
void void
GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, GNUNET_HashCode * ke y); GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, struct GNUNET_HashCo de * key);
/** /**
* Convert a URI to a UTF-8 String. * Convert a URI to a UTF-8 String.
* *
* @param uri uri to convert to a string * @param uri uri to convert to a string
* @return the UTF-8 string * @return the UTF-8 string
*/ */
char * char *
GNUNET_FS_uri_to_string (const struct GNUNET_FS_Uri *uri); GNUNET_FS_uri_to_string (const struct GNUNET_FS_Uri *uri);
skipping to change at line 324 skipping to change at line 324
char **emsg); char **emsg);
/** /**
* Create an SKS URI from a namespace ID and an identifier. * Create an SKS URI from a namespace ID and an identifier.
* *
* @param nsid namespace ID * @param nsid namespace ID
* @param id identifier * @param id identifier
* @return an FS URI for the given namespace and identifier * @return an FS URI for the given namespace and identifier
*/ */
struct GNUNET_FS_Uri * struct GNUNET_FS_Uri *
GNUNET_FS_uri_sks_create_from_nsid (GNUNET_HashCode * nsid, const char *id) ; GNUNET_FS_uri_sks_create_from_nsid (struct GNUNET_HashCode * nsid, const ch ar *id);
/** /**
* Get the ID of a namespace from the given * Get the ID of a namespace from the given
* namespace URI. * namespace URI.
* *
* @param uri the uri to get the namespace ID from * @param uri the uri to get the namespace ID from
* @param nsid where to store the ID of the namespace * @param nsid where to store the ID of the namespace
* @return GNUNET_OK on success * @return GNUNET_OK on success
*/ */
int int
GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri, GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri,
GNUNET_HashCode * nsid); struct GNUNET_HashCode * nsid);
/** /**
* Get the content identifier of an SKS URI. * Get the content identifier of an SKS URI.
* *
* @param uri the sks uri * @param uri the sks uri
* @return NULL on error (not a valid SKS URI) * @return NULL on error (not a valid SKS URI)
*/ */
char * char *
GNUNET_FS_uri_sks_get_content_id (const struct GNUNET_FS_Uri *uri); GNUNET_FS_uri_sks_get_content_id (const struct GNUNET_FS_Uri *uri);
skipping to change at line 980 skipping to change at line 980
* At what offset in the file is "data"? * At what offset in the file is "data"?
*/ */
uint64_t offset; uint64_t offset;
/** /**
* Length of the data block. * Length of the data block.
*/ */
uint64_t data_len; uint64_t data_len;
/** /**
* How much time passed between us asking for this block and
* actually getting it? GNUNET_TIME_UNIT_FOREVER_REL if unknown.
*/
struct GNUNET_TIME_Relative block_download_duration;
/**
* Depth of the given block in the tree; * Depth of the given block in the tree;
* 0 would be the lowest level (DBLOCKS). * 0 would be the lowest level (DBLOCKS).
*/ */
unsigned int depth; unsigned int depth;
/** /**
* How much trust did we offer for downloading this block? * How much respect did we offer for downloading this block? (esti
mate,
* because we might have the same request pending for multiple cli
ents,
* and of course because a transmission may have failed at a lower
* layer).
*/ */
unsigned int trust_offered; uint32_t respect_offered;
/** /**
* How much time passed between us asking for this block and * How often did we transmit the request? (estimate,
* actually getting it? GNUNET_TIME_UNIT_FOREVER_REL if unknown. * because we might have the same request pending for multiple cli
ents,
* and of course because a transmission may have failed at a lower
* layer).
*/ */
struct GNUNET_TIME_Relative block_download_duration; uint32_t num_transmissions;
} progress; } progress;
/** /**
* These values are only valid for * These values are only valid for
* GNUNET_FS_STATUS_DOWNLOAD_START events. * GNUNET_FS_STATUS_DOWNLOAD_START events.
*/ */
struct struct
{ {
skipping to change at line 1345 skipping to change at line 1356
const char *root; const char *root;
/** /**
* Metadata for the namespace. * Metadata for the namespace.
*/ */
const struct GNUNET_CONTAINER_MetaData *meta; const struct GNUNET_CONTAINER_MetaData *meta;
/** /**
* Hash-identifier for the namespace. * Hash-identifier for the namespace.
*/ */
GNUNET_HashCode id; struct GNUNET_HashCode id;
} namespace; } ns;
} specifics; } specifics;
} search; } search;
/** /**
* Values for all "GNUNET_FS_STATUS_UNINDEX_*" events. * Values for all "GNUNET_FS_STATUS_UNINDEX_*" events.
*/ */
struct struct
{ {
skipping to change at line 1492 skipping to change at line 1503
* @param cls closure * @param cls closure
* @param info details about the event, specifying the event type * @param info details about the event, specifying the event type
* and various bits about the event * and various bits about the event
* @return client-context (for the next progress call * @return client-context (for the next progress call
* for this operation; should be set to NULL for * for this operation; should be set to NULL for
* SUSPEND and STOPPED events). The value returned * SUSPEND and STOPPED events). The value returned
* will be passed to future callbacks in the respective * will be passed to future callbacks in the respective
* field in the GNUNET_FS_ProgressInfo struct. * field in the GNUNET_FS_ProgressInfo struct.
*/ */
typedef void *(*GNUNET_FS_ProgressCallback) (void *cls, typedef void *(*GNUNET_FS_ProgressCallback) (void *cls,
const struct GNUNET_FS_Progres const struct GNUNET_FS_Progres
sInfo sInfo *info);
* info);
/** /**
* General (global) option flags for file-sharing. * General (global) option flags for file-sharing.
*/ */
enum GNUNET_FS_Flags enum GNUNET_FS_Flags
{ {
/** /**
* No special flags set. * No special flags set.
*/ */
GNUNET_FS_FLAGS_NONE = 0, GNUNET_FS_FLAGS_NONE = 0,
skipping to change at line 1525 skipping to change at line 1535
*/ */
GNUNET_FS_FLAGS_DO_PROBES = 2 GNUNET_FS_FLAGS_DO_PROBES = 2
}; };
/** /**
* Options specified in the VARARGs portion of GNUNET_FS_start. * Options specified in the VARARGs portion of GNUNET_FS_start.
*/ */
enum GNUNET_FS_OPTIONS enum GNUNET_FS_OPTIONS
{ {
/** /**
* Last option in the VARARG list. * Last option in the VARARG list.
*/ */
GNUNET_FS_OPTIONS_END = 0, GNUNET_FS_OPTIONS_END = 0,
/** /**
* Select the desired amount of parallelism (this option should be * Select the desired amount of parallelism (this option should be
* followed by an "unsigned int" giving the desired maximum number * followed by an "unsigned int" giving the desired maximum number
* of parallel downloads). * of parallel downloads).
*/ */
GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM = 1, GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM = 1,
/** /**
* Maximum number of requests that should be pending at a given * Maximum number of requests that should be pending at a given
* point in time (invidivual downloads may go above this, but * point in time (invidivual downloads may go above this, but
* if we are above this threshold, we should not activate any * if we are above this threshold, we should not activate any
* additional downloads. * additional downloads.
*/ */
GNUNET_FS_OPTIONS_REQUEST_PARALLELISM = 2 GNUNET_FS_OPTIONS_REQUEST_PARALLELISM = 2
}; };
/** /**
* Settings for publishing a block (which may of course also * Settings for publishing a block (which may of course also
* apply to an entire directory or file). * apply to an entire directory or file).
*/ */
struct GNUNET_FS_BlockOptions struct GNUNET_FS_BlockOptions
{ {
skipping to change at line 1922 skipping to change at line 1932
* in the datastore. Useful for computing URIs from files. * in the datastore. Useful for computing URIs from files.
*/ */
GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY = 1 GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY = 1
}; };
/** /**
* Publish a file or directory. * Publish a file or directory.
* *
* @param h handle to the file sharing subsystem * @param h handle to the file sharing subsystem
* @param fi information about the file or directory structure to publish * @param fi information about the file or directory structure to publish
* @param namespace namespace to publish the file in, NULL for no namespace * @param ns namespace to publish the file in, NULL for no namespace
* @param nid identifier to use for the publishd content in the namespace * @param nid identifier to use for the publishd content in the namespace
* (can be NULL, must be NULL if namespace is NULL) * (can be NULL, must be NULL if namespace is NULL)
* @param nuid update-identifier that will be used for future updates * @param nuid update-identifier that will be used for future updates
* (can be NULL, must be NULL if namespace or nid is NULL) * (can be NULL, must be NULL if namespace or nid is NULL)
* @param options options for the publication * @param options options for the publication
* @return context that can be used to control the publish operation * @return context that can be used to control the publish operation
*/ */
struct GNUNET_FS_PublishContext * struct GNUNET_FS_PublishContext *
GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h,
struct GNUNET_FS_FileInformation *fi, struct GNUNET_FS_FileInformation *fi,
struct GNUNET_FS_Namespace *namespace, const char *nid, struct GNUNET_FS_Namespace *ns, const char *nid,
const char *nuid, const char *nuid,
enum GNUNET_FS_PublishOptions options); enum GNUNET_FS_PublishOptions options);
/** /**
* Stop a publication. Will abort incomplete publications (but * Stop a publication. Will abort incomplete publications (but
* not remove blocks that have already been published) or * not remove blocks that have already been published) or
* simply clean up the state for completed publications. * simply clean up the state for completed publications.
* Must NOT be called from within the event callback! * Must NOT be called from within the event callback!
* *
* @param pc context for the publication to stop * @param pc context for the publication to stop
skipping to change at line 2004 skipping to change at line 2014
/** /**
* Handle to cancel publish SKS operation. * Handle to cancel publish SKS operation.
*/ */
struct GNUNET_FS_PublishSksContext; struct GNUNET_FS_PublishSksContext;
/** /**
* Publish an SBlock on GNUnet. * Publish an SBlock on GNUnet.
* *
* @param h handle to the file sharing subsystem * @param h handle to the file sharing subsystem
* @param namespace namespace to publish in * @param ns namespace to publish in
* @param identifier identifier to use * @param identifier identifier to use
* @param update update identifier to use * @param update update identifier to use
* @param meta metadata to use * @param meta metadata to use
* @param uri URI to refer to in the SBlock * @param uri URI to refer to in the SBlock
* @param bo block options * @param bo block options
* @param options publication options * @param options publication options
* @param cont continuation * @param cont continuation
* @param cont_cls closure for cont * @param cont_cls closure for cont
* @return NULL on error ('cont' will still be called) * @return NULL on error ('cont' will still be called)
*/ */
struct GNUNET_FS_PublishSksContext * struct GNUNET_FS_PublishSksContext *
GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
struct GNUNET_FS_Namespace *namespace, struct GNUNET_FS_Namespace *ns,
const char *identifier, const char *update, const char *identifier, const char *update,
const struct GNUNET_CONTAINER_MetaData *meta, const struct GNUNET_CONTAINER_MetaData *meta,
const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_Uri *uri,
const struct GNUNET_FS_BlockOptions *bo, const struct GNUNET_FS_BlockOptions *bo,
enum GNUNET_FS_PublishOptions options, enum GNUNET_FS_PublishOptions options,
GNUNET_FS_PublishContinuation cont, void *cont_cls); GNUNET_FS_PublishContinuation cont, void *cont_cls);
/** /**
* Abort the SKS publishing operation. * Abort the SKS publishing operation.
* *
skipping to change at line 2042 skipping to change at line 2052
/** /**
* Type of a function called by "GNUNET_FS_get_indexed_files". * Type of a function called by "GNUNET_FS_get_indexed_files".
* *
* @param cls closure * @param cls closure
* @param filename the name of the file, NULL for end of list * @param filename the name of the file, NULL for end of list
* @param file_id hash of the contents of the indexed file * @param file_id hash of the contents of the indexed file
* @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort
*/ */
typedef int (*GNUNET_FS_IndexedFileProcessor) (void *cls, const char *filen ame, typedef int (*GNUNET_FS_IndexedFileProcessor) (void *cls, const char *filen ame,
const GNUNET_HashCode * file _id); const struct GNUNET_HashCode * file_id);
/** /**
* Handle to cancel 'GNUNET_FS_get_indexed_files'. * Handle to cancel 'GNUNET_FS_get_indexed_files'.
*/ */
struct GNUNET_FS_GetIndexedContext; struct GNUNET_FS_GetIndexedContext;
/** /**
* Iterate over all indexed files. * Iterate over all indexed files.
* *
* @param h handle to the file sharing subsystem * @param h handle to the file sharing subsystem
skipping to change at line 2100 skipping to change at line 2110
/** /**
* Context for advertising a namespace. * Context for advertising a namespace.
*/ */
struct GNUNET_FS_AdvertisementContext; struct GNUNET_FS_AdvertisementContext;
/** /**
* Publish an advertismement for a namespace. * Publish an advertismement for a namespace.
* *
* @param h handle to the file sharing subsystem * @param h handle to the file sharing subsystem
* @param ksk_uri keywords to use for advertisment * @param ksk_uri keywords to use for advertisment
* @param namespace handle for the namespace that should be advertised * @param ns handle for the namespace that should be advertised
* @param meta meta-data for the namespace advertisement * @param meta meta-data for the namespace advertisement
* @param bo block options * @param bo block options
* @param rootEntry name of the root of the namespace * @param rootEntry name of the root of the namespace
* @param cont continuation * @param cont continuation
* @param cont_cls closure for cont * @param cont_cls closure for cont
* @return NULL on error ('cont' will still be called) * @return NULL on error ('cont' will still be called)
*/ */
struct GNUNET_FS_AdvertisementContext * struct GNUNET_FS_AdvertisementContext *
GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h,
struct GNUNET_FS_Uri *ksk_uri, struct GNUNET_FS_Uri *ksk_uri,
struct GNUNET_FS_Namespace *namespace, struct GNUNET_FS_Namespace *ns,
const struct GNUNET_CONTAINER_MetaData *meta , const struct GNUNET_CONTAINER_MetaData *meta ,
const struct GNUNET_FS_BlockOptions *bo, const struct GNUNET_FS_BlockOptions *bo,
const char *rootEntry, const char *rootEntry,
GNUNET_FS_PublishContinuation cont, GNUNET_FS_PublishContinuation cont,
void *cont_cls); void *cont_cls);
/** /**
* Abort the namespace advertisement operation. * Abort the namespace advertisement operation.
* *
* @param ac context of the operation to abort. * @param ac context of the operation to abort.
*/ */
void void
GNUNET_FS_namespace_advertise_cancel (struct GNUNET_FS_AdvertisementContext *ac); GNUNET_FS_namespace_advertise_cancel (struct GNUNET_FS_AdvertisementContext *ac);
/** /**
* Create a namespace with the given name; if one already * Create a namespace with the given name; if one already
* exists, return a handle to the existing namespace. * exists, return a handle to the existing namespace.
* *
* @param h handle to the file sharing subsystem * @param h handle to the file sharing subsystem
* @param name name to use for the namespace * @param name name to use for the namespace
* @return handle to the namespace, NULL on error * @return handle to the namespace, NULL on error (i.e. invalid filename)
*/ */
struct GNUNET_FS_Namespace * struct GNUNET_FS_Namespace *
GNUNET_FS_namespace_create (struct GNUNET_FS_Handle *h, const char *name); GNUNET_FS_namespace_create (struct GNUNET_FS_Handle *h, const char *name);
/** /**
* Duplicate a namespace handle. * Duplicate a namespace handle.
* *
* @param ns namespace handle * @param ns namespace handle
* @return duplicated handle to the namespace * @return duplicated handle to the namespace
*/ */
struct GNUNET_FS_Namespace * struct GNUNET_FS_Namespace *
GNUNET_FS_namespace_dup (struct GNUNET_FS_Namespace *ns); GNUNET_FS_namespace_dup (struct GNUNET_FS_Namespace *ns);
/** /**
* Delete a namespace handle. Can be used for a clean shutdown (free * Delete a namespace handle. Can be used for a clean shutdown (free
* memory) or also to freeze the namespace to prevent further * memory) or also to freeze the namespace to prevent further
* insertions by anyone. * insertions by anyone.
* *
* @param namespace handle to the namespace that should be deleted / freed * @param ns handle to the namespace that should be deleted / freed
* @param freeze prevents future insertions; creating a namespace * @param freeze prevents future insertions; creating a namespace
* with the same name again will create a fresh namespace instead * with the same name again will create a fresh namespace instead
* *
* @return GNUNET_OK on success, GNUNET_SYSERR on error * @return GNUNET_OK on success, GNUNET_SYSERR on error
*/ */
int int
GNUNET_FS_namespace_delete (struct GNUNET_FS_Namespace *namespace, int free ze); GNUNET_FS_namespace_delete (struct GNUNET_FS_Namespace *ns, int freeze);
/** /**
* Callback with information about local (!) namespaces. * Callback with information about local (!) namespaces.
* Contains the names of the local namespace and the global * Contains the names of the local namespace and the global
* ID. * ID.
* *
* @param cls closure * @param cls closure
* @param name human-readable identifier of the namespace * @param name human-readable identifier of the namespace
* @param id hash identifier for the namespace * @param id hash identifier for the namespace
*/ */
typedef void (*GNUNET_FS_NamespaceInfoProcessor) (void *cls, const char *na me, typedef void (*GNUNET_FS_NamespaceInfoProcessor) (void *cls, const char *na me,
const GNUNET_HashCode * i d); const struct GNUNET_HashC ode * id);
/** /**
* Build a list of all available local (!) namespaces The returned * Build a list of all available local (!) namespaces The returned
* names are only the nicknames since we only iterate over the local * names are only the nicknames since we only iterate over the local
* namespaces. * namespaces.
* *
* @param h handle to the file sharing subsystem * @param h handle to the file sharing subsystem
* @param cb function to call on each known namespace * @param cb function to call on each known namespace
* @param cb_cls closure for cb * @param cb_cls closure for cb
*/ */
skipping to change at line 2216 skipping to change at line 2226
* *
* Calling this function with "next_id" NULL will cause the library to * Calling this function with "next_id" NULL will cause the library to
* call "ip" with a root for each strongly connected component of the * call "ip" with a root for each strongly connected component of the
* graph (a root being a node from which all other nodes in the Scc * graph (a root being a node from which all other nodes in the Scc
* are reachable). * are reachable).
* *
* Calling this function with "next_id" being the name of a node will * Calling this function with "next_id" being the name of a node will
* cause the library to call "ip" with all children of the node. Note * cause the library to call "ip" with all children of the node. Note
* that cycles within an SCC are possible (including self-loops). * that cycles within an SCC are possible (including self-loops).
* *
* @param namespace namespace to inspect for updateable content * @param ns namespace to inspect for updateable content
* @param next_id ID to look for; use NULL to look for SCC roots * @param next_id ID to look for; use NULL to look for SCC roots
* @param ip function to call on each updateable identifier * @param ip function to call on each updateable identifier
* @param ip_cls closure for ip * @param ip_cls closure for ip
*/ */
void void
GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace, GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *ns,
const char *next_id, const char *next_id,
GNUNET_FS_IdentifierProcessor ip, GNUNET_FS_IdentifierProcessor ip,
void *ip_cls); void *ip_cls);
/** /**
* Options for searching. Compatible options * Options for searching. Compatible options
* can be OR'ed together. * can be OR'ed together.
*/ */
enum GNUNET_FS_SearchOptions enum GNUNET_FS_SearchOptions
{ {
 End of changes. 28 change blocks. 
41 lines changed or deleted 54 lines changed or added


 gnunet_getopt_lib.h   gnunet_getopt_lib.h 
skipping to change at line 226 skipping to change at line 226
* @param scls additional closure (will point to the 'unsigned long long') * @param scls additional closure (will point to the 'unsigned long long')
* @param option name of the option * @param option name of the option
* @param value actual value of the option as a string. * @param value actual value of the option as a string.
* @return GNUNET_OK if parsing the value worked * @return GNUNET_OK if parsing the value worked
*/ */
int int
GNUNET_GETOPT_set_ulong (struct GNUNET_GETOPT_CommandLineProcessorContext * ctx, GNUNET_GETOPT_set_ulong (struct GNUNET_GETOPT_CommandLineProcessorContext * ctx,
void *scls, const char *option, const char *value) ; void *scls, const char *option, const char *value) ;
/** /**
* Set an option of type 'struct GNUNET_TIME_Relative' from the command lin
e.
* A pointer to this function should be passed as part of the
* 'struct GNUNET_GETOPT_CommandLineOption' array to initialize options
* of this type. It should be followed by a pointer to a value of
* type 'struct GNUNET_TIME_Relative'.
*
* @param ctx command line processing context
* @param scls additional closure (will point to the 'struct GNUNET_TIME_Re
lative')
* @param option name of the option
* @param value actual value of the option as a string.
* @return GNUNET_OK if parsing the value worked
*/
int
GNUNET_GETOPT_set_relative_time (struct GNUNET_GETOPT_CommandLineProcessorC
ontext *ctx,
void *scls, const char *option, const char
*value);
/**
* Set an option of type 'unsigned int' from the command line. * Set an option of type 'unsigned int' from the command line.
* A pointer to this function should be passed as part of the * A pointer to this function should be passed as part of the
* 'struct GNUNET_GETOPT_CommandLineOption' array to initialize options * 'struct GNUNET_GETOPT_CommandLineOption' array to initialize options
* of this type. It should be followed by a pointer to a value of * of this type. It should be followed by a pointer to a value of
* type 'unsigned int'. * type 'unsigned int'.
* *
* @param ctx command line processing context * @param ctx command line processing context
* @param scls additional closure (will point to the 'unsigned int') * @param scls additional closure (will point to the 'unsigned int')
* @param option name of the option * @param option name of the option
* @param value actual value of the option as a string. * @param value actual value of the option as a string.
skipping to change at line 306 skipping to change at line 323
/* *************** internal prototypes - use macros above! ************* */ /* *************** internal prototypes - use macros above! ************* */
/** /**
* Print out details on command line options (implements --help). * Print out details on command line options (implements --help).
* *
* @param ctx command line processing context * @param ctx command line processing context
* @param scls additional closure (points to about text) * @param scls additional closure (points to about text)
* @param option name of the option * @param option name of the option
* @param value not used (NULL) * @param value not used (NULL)
* @return GNUNET_SYSERR (do not continue) * @return GNUNET_NO (do not continue, not an error)
*/ */
int int
GNUNET_GETOPT_format_help_ (struct GNUNET_GETOPT_CommandLineProcessorContex t GNUNET_GETOPT_format_help_ (struct GNUNET_GETOPT_CommandLineProcessorContex t
*ctx, void *scls, const char *option, *ctx, void *scls, const char *option,
const char *value); const char *value);
/** /**
* Print out program version (implements --version). * Print out program version (implements --version).
* *
* @param ctx command line processing context * @param ctx command line processing context
* @param scls additional closure (points to version string) * @param scls additional closure (points to version string)
* @param option name of the option * @param option name of the option
* @param value not used (NULL) * @param value not used (NULL)
* @return GNUNET_SYSERR (do not continue) * @return GNUNET_NO (do not continue, not an error)
*/ */
int int
GNUNET_GETOPT_print_version_ (struct GNUNET_GETOPT_CommandLineProcessorCont ext GNUNET_GETOPT_print_version_ (struct GNUNET_GETOPT_CommandLineProcessorCont ext
*ctx, void *scls, const char *option, *ctx, void *scls, const char *option,
const char *value); const char *value);
#if 0 /* keep Emacsens' auto-indent happy */ #if 0 /* keep Emacsens' auto-indent happy */
{ {
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
 End of changes. 3 change blocks. 
2 lines changed or deleted 23 lines changed or added


 gnunet_gns_service.h   gnunet_gns_service.h 
skipping to change at line 25 skipping to change at line 25
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the along with GNUnet; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330, Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. Boston, MA 02111-1307, USA.
*/ */
/** /**
* @file include/gnunet_gns_service.h * @file include/gnunet_gns_service.h
* @brief API to the GNS service * @brief API to the GNS service
* @author Martin Schanzenbach * @author Martin Schanzenbach
*
* TODO:
* - decide what goes into storage API and what into GNS-service API
* - decide where to pass/expose/check keys / signatures
* - are GNS private keys per peer or per user?
*/ */
#ifndef GNUNET_GNS_SERVICE_H #ifndef GNUNET_GNS_SERVICE_H
#define GNUNET_GNS_SERVICE_H #define GNUNET_GNS_SERVICE_H
#include "gnunet_util_lib.h" #include "gnunet_util_lib.h"
#include "gnunet_dnsparser_lib.h" #include "gnunet_dnsparser_lib.h"
#include "gnunet_namestore_service.h" #include "gnunet_namestore_service.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {
skipping to change at line 53 skipping to change at line 47
} }
#endif #endif
#endif #endif
/** /**
* Connection to the GNS service. * Connection to the GNS service.
*/ */
struct GNUNET_GNS_Handle; struct GNUNET_GNS_Handle;
/** /**
* Handle to control a get operation. * Handle to control a lookup operation.
*/
struct GNUNET_GNS_LookupRequest;
/**
* Handle to control a shorten operation.
*/ */
struct GNUNET_GNS_LookupHandle; struct GNUNET_GNS_ShortenRequest;
/** /**
* Handle to control a shorten operation * Handle to control a get authority operation
*/ */
struct GNUNET_GNS_GetAuthRequest;
/** /**
* Record types * Record types
* Based on GNUNET_DNSPARSER_TYPEs (standard DNS) * Based on GNUNET_DNSPARSER_TYPEs (standard DNS)
*/ */
enum GNUNET_GNS_RecordType enum GNUNET_GNS_RecordType
{ {
/* Standard DNS */ /* Standard DNS */
GNUNET_GNS_RECORD_TYPE_A = GNUNET_DNSPARSER_TYPE_A, /* struct in_addr */
GNUNET_GNS_RECORD_TYPE_NS = GNUNET_DNSPARSER_TYPE_NS, GNUNET_GNS_RECORD_A = GNUNET_DNSPARSER_TYPE_A,
GNUNET_GNS_RECORD_TYPE_CNAME = GNUNET_DNSPARSER_TYPE_CNAME,
GNUNET_GNS_RECORD_TYPE_SOA = GNUNET_DNSPARSER_TYPE_SOA, /* char */
GNUNET_GNS_RECORD_TYPE_PTR = GNUNET_DNSPARSER_TYPE_PTR, GNUNET_GNS_RECORD_NS = GNUNET_DNSPARSER_TYPE_NS,
GNUNET_GNS_RECORD_MX = GNUNET_DNSPARSER_TYPE_MX,
GNUNET_GNS_RECORD_TXT = GNUNET_DNSPARSER_TYPE_TXT, /* char */
GNUNET_GNS_RECORD_AAAA = GNUNET_DNSPARSER_TYPE_AAAA, GNUNET_GNS_RECORD_CNAME = GNUNET_DNSPARSER_TYPE_CNAME,
/* struct soa_data */
GNUNET_GNS_RECORD_SOA = GNUNET_DNSPARSER_TYPE_SOA,
/* struct srv_data */
GNUNET_GNS_RECORD_SRV = GNUNET_DNSPARSER_TYPE_SRV,
/* char */
GNUNET_GNS_RECORD_PTR = GNUNET_DNSPARSER_TYPE_PTR,
/* uint16_t, char */
GNUNET_GNS_RECORD_MX = GNUNET_DNSPARSER_TYPE_MX,
/* char */
GNUNET_GNS_RECORD_TXT = GNUNET_DNSPARSER_TYPE_TXT,
/* struct in6_addr */
GNUNET_GNS_RECORD_AAAA = GNUNET_DNSPARSER_TYPE_AAAA,
/* GNS specific */ /* GNS specific */
/* struct GNUNET_CRYPTO_ShortHashCode */
GNUNET_GNS_RECORD_PKEY = GNUNET_NAMESTORE_TYPE_PKEY, GNUNET_GNS_RECORD_PKEY = GNUNET_NAMESTORE_TYPE_PKEY,
/* char */
GNUNET_GNS_RECORD_PSEU = GNUNET_NAMESTORE_TYPE_PSEU, GNUNET_GNS_RECORD_PSEU = GNUNET_NAMESTORE_TYPE_PSEU,
GNUNET_GNS_RECORD_ANY = GNUNET_NAMESTORE_TYPE_ANY GNUNET_GNS_RECORD_ANY = GNUNET_NAMESTORE_TYPE_ANY,
/* char */
GNUNET_GNS_RECORD_LEHO = GNUNET_NAMESTORE_TYPE_LEHO,
/* struct vpn_data */
GNUNET_GNS_RECORD_VPN = GNUNET_NAMESTORE_TYPE_VPN,
/* revocation */
GNUNET_GNS_RECORD_REV = GNUNET_NAMESTORE_TYPE_REV
}; };
/** /**
* Initialize the connection with the GNS service. * Initialize the connection with the GNS service.
* *
* @param cfg configuration to use * @param cfg configuration to use
* *
* @return handle to the GNS service, or NULL on error * @return handle to the GNS service, or NULL on error
*/ */
struct GNUNET_GNS_Handle * struct GNUNET_GNS_Handle *
skipping to change at line 108 skipping to change at line 138
void void
GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle); GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle);
/* *************** Standard API: lookup ******************* */ /* *************** Standard API: lookup ******************* */
/** /**
* Iterator called on obtained result for a GNS * Iterator called on obtained result for a GNS
* lookup * lookup
* *
* @param cls closure * @param cls closure
* @param name "name" of the original lookup
* @param rd_count number of records * @param rd_count number of records
* @param rd the records in reply * @param rd the records in reply
*/ */
typedef void (*GNUNET_GNS_LookupResultProcessor) (void *cls, typedef void (*GNUNET_GNS_LookupResultProcessor) (void *cls,
uint32_t rd_count, uint32_t rd_count,
const struct GNUNET_NAMESTORE_RecordData * const struct GNUNET_NAMEST
rd); ORE_RecordData *rd);
/** /**
* Perform an asynchronous lookup operation on the GNS * Perform an asynchronous lookup operation on the GNS
* in the default zone. * in the default zone.
* *
* @param handle handle to the GNS service * @param handle handle to the GNS service
* @param name the name to look up * @param name the name to look up
* @param type the GNUNET_GNS_RecordType to look for * @param type the GNUNET_GNS_RecordType to look for
* @param only_cached GNUNET_NO to only check locally not DHT for performan
ce
* @param shorten_key the private key of the shorten zone (can be NULL)
* @param proc function to call on result * @param proc function to call on result
* @param proc_cls closure for processor * @param proc_cls closure for processor
* *
* @return handle to the queued request * @return handle to the queued request
*/ */
struct GNUNET_GNS_QueueEntry * struct GNUNET_GNS_LookupRequest*
GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
const char * name, const char * name,
enum GNUNET_GNS_RecordType type, enum GNUNET_GNS_RecordType type,
GNUNET_GNS_LookupResultProcessor proc, int only_cached,
void *proc_cls); struct GNUNET_CRYPTO_RsaPrivateKey *shorten_key,
GNUNET_GNS_LookupResultProcessor proc,
void *proc_cls);
/** /**
* Perform an asynchronous lookup operation on the GNS * Perform an asynchronous lookup operation on the GNS
* in the zone specified by 'zone'. * in the zone specified by 'zone'.
* *
* @param handle handle to the GNS service * @param handle handle to the GNS service
* @param name the name to look up * @param name the name to look up
* @param zone the zone to start the resolution in * @param zone the zone to start the resolution in
* @param type the GNUNET_GNS_RecordType to look for * @param type the GNUNET_GNS_RecordType to look for
* @param only_cached GNUNET_YES to only check locally not DHT for performa
nce
* @param shorten_key the private key of the shorten zone (can be NULL)
* @param proc function to call on result * @param proc function to call on result
* @param proc_cls closure for processor * @param proc_cls closure for processor
* *
* @return handle to the queued request * @return handle to the queued request
*/ */
struct GNUNET_GNS_QueueEntry * struct GNUNET_GNS_LookupRequest*
GNUNET_GNS_lookup_zone (struct GNUNET_GNS_Handle *handle, GNUNET_GNS_lookup_zone (struct GNUNET_GNS_Handle *handle,
const char * name, const char * name,
struct GNUNET_CRYPTO_ShortHashCode *zone, struct GNUNET_CRYPTO_ShortHashCode *zone,
enum GNUNET_GNS_RecordType type, enum GNUNET_GNS_RecordType type,
GNUNET_GNS_LookupResultProcessor proc, int only_cached,
void *proc_cls); struct GNUNET_CRYPTO_RsaPrivateKey *shorten_key,
GNUNET_GNS_LookupResultProcessor proc,
void *proc_cls);
/**
* Cancel pending lookup request
*
* @param lr the lookup request to cancel
*/
void
GNUNET_GNS_cancel_lookup_request (struct GNUNET_GNS_LookupRequest *lr);
/* *************** Standard API: shorten ******************* */ /* *************** Standard API: shorten ******************* */
/** /**
* Processor called on for a name shortening result * Processor called on for a name shortening result
* called only once * called only once
* *
* @param cls closure * @param cls closure
* @param short_name the shortened name or NULL if no result * @param short_name the shortened name or NULL if no result / error
*/ */
typedef void (*GNUNET_GNS_ShortenResultProcessor) (void *cls, typedef void (*GNUNET_GNS_ShortenResultProcessor) (void *cls,
const char* short_name); const char* short_name);
/** /**
* Perform a name shortening operation on the GNS. * Perform a name shortening operation on the GNS.
* *
* @param handle handle to the GNS service * @param handle handle to the GNS service
* @param name the name to look up * @param name the name to look up
* @param private_zone the public zone of the private zone
* @param shorten_zone the public zone of the shorten zone
* @param proc function to call on result * @param proc function to call on result
* @param proc_cls closure for processor * @param proc_cls closure for processor
* @return handle to the operation * @return handle to the operation
*/ */
struct GNUNET_GNS_QueueEntry * struct GNUNET_GNS_ShortenRequest*
GNUNET_GNS_shorten (struct GNUNET_GNS_Handle *handle, GNUNET_GNS_shorten (struct GNUNET_GNS_Handle *handle,
const char * name, const char * name,
struct GNUNET_CRYPTO_ShortHashCode *private_zone,
struct GNUNET_CRYPTO_ShortHashCode *shorten_zone,
GNUNET_GNS_ShortenResultProcessor proc, GNUNET_GNS_ShortenResultProcessor proc,
void *proc_cls); void *proc_cls);
/** /**
* Perform a name shortening operation on the GNS. * Perform a name shortening operation on the GNS.
* *
* @param handle handle to the GNS service * @param handle handle to the GNS service
* @param name the name to look up * @param name the name to look up
* @param private_zone the public zone of the private zone
* @param shorten_zone the public zone of the shorten zone
* @param zone the zone to start the resolution in * @param zone the zone to start the resolution in
* @param proc function to call on result * @param proc function to call on result
* @param proc_cls closure for processor * @param proc_cls closure for processor
* @return handle to the operation * @return handle to the operation
*/ */
struct GNUNET_GNS_QueueEntry * struct GNUNET_GNS_ShortenRequest*
GNUNET_GNS_shorten_zone (struct GNUNET_GNS_Handle *handle, GNUNET_GNS_shorten_zone (struct GNUNET_GNS_Handle *handle,
const char * name, const char * name,
struct GNUNET_CRYPTO_ShortHashCode *zone, struct GNUNET_CRYPTO_ShortHashCode *private_zone,
GNUNET_GNS_ShortenResultProcessor proc, struct GNUNET_CRYPTO_ShortHashCode *shorten_zone,
void *proc_cls); struct GNUNET_CRYPTO_ShortHashCode *zone,
GNUNET_GNS_ShortenResultProcessor proc,
void *proc_cls);
/**
* Cancel pending shorten request
*
* @param sr the lookup request to cancel
*/
void
GNUNET_GNS_cancel_shorten_request (struct GNUNET_GNS_ShortenRequest *sr);
/* *************** Standard API: get authority ******************* */ /* *************** Standard API: get authority ******************* */
/** /**
* Processor called on for a name shortening result * Processor called on for a name shortening result
* called only once * called only once
* *
* @param cls closure * @param cls closure
* @param auth_name the name of the auhtority or NULL * @param auth_name the name of the auhtority or NULL
*/ */
typedef void (*GNUNET_GNS_GetAuthResultProcessor) (void *cls, typedef void (*GNUNET_GNS_GetAuthResultProcessor) (void *cls,
const char* short_name); const char* short_name);
/** /**
* Perform an authority lookup for a given name. * Perform an authority lookup for a given name.
* *
* @param handle handle to the GNS service * @param handle handle to the GNS service
* @param name the name to look up authority for * @param name the name to look up authority for
* @param proc function to call on result * @param proc function to call on result
* @param proc_cls closure for processor * @param proc_cls closure for processor
* @return handle to the operation * @return handle to the operation
*/ */
struct GNUNET_GNS_QueueEntry * struct GNUNET_GNS_GetAuthRequest*
GNUNET_GNS_get_authority (struct GNUNET_GNS_Handle *handle, GNUNET_GNS_get_authority (struct GNUNET_GNS_Handle *handle,
const char * name, const char * name,
GNUNET_GNS_GetAuthResultProcessor proc, GNUNET_GNS_GetAuthResultProcessor proc,
void *proc_cls); void *proc_cls);
/**
* Cancel pending get auth request
*
* @param gar the lookup request to cancel
*/
void
GNUNET_GNS_cancel_get_auth_request (struct GNUNET_GNS_GetAuthRequest *gar);
#if 0 /* keep Emacsens' auto-indent happy */ #if 0 /* keep Emacsens' auto-indent happy */
{ {
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
/* gnunet_gns_service.h */ /* gnunet_gns_service.h */
 End of changes. 29 change blocks. 
46 lines changed or deleted 117 lines changed or added


 gnunet_hello_lib.h   gnunet_hello_lib.h 
skipping to change at line 315 skipping to change at line 315
* Get the header from a HELLO message, used so other code * Get the header from a HELLO message, used so other code
* can correctly send HELLO messages. * can correctly send HELLO messages.
* *
* @param hello the hello message * @param hello the hello message
* *
* @return header or NULL if the HELLO was malformed * @return header or NULL if the HELLO was malformed
*/ */
struct GNUNET_MessageHeader * struct GNUNET_MessageHeader *
GNUNET_HELLO_get_header (struct GNUNET_HELLO_Message *hello); GNUNET_HELLO_get_header (struct GNUNET_HELLO_Message *hello);
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
#ifdef __cplusplus
}
#endif
/* ifndef GNUNET_HELLO_LIB_H */ /* ifndef GNUNET_HELLO_LIB_H */
#endif #endif
/* end of gnunet_hello_lib.h */ /* end of gnunet_hello_lib.h */
 End of changes. 1 change blocks. 
0 lines changed or deleted 7 lines changed or added


 gnunet_helper_lib.h   gnunet_helper_lib.h 
skipping to change at line 27 skipping to change at line 27
Free Software Foundation, Inc., 59 Temple Place - Suite 330, Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. Boston, MA 02111-1307, USA.
*/ */
/** /**
* @file include/gnunet_helper_lib.h * @file include/gnunet_helper_lib.h
* @brief API for dealing with (SUID) helper processes that communicate via GNUNET_MessageHeaders on stdin/stdout * @brief API for dealing with (SUID) helper processes that communicate via GNUNET_MessageHeaders on stdin/stdout
* @author Philipp Toelke * @author Philipp Toelke
* @author Christian Grothoff * @author Christian Grothoff
*/ */
#ifndef GNUNET_HELPER_LIB_H #ifndef GNUNET_HELPER_LIB_H
#define GNUNET_HELPER_LIB_H #define GNUNET_HELPER_LIB_H
#include "gnunet_scheduler_lib.h" #include "gnunet_scheduler_lib.h"
#include "gnunet_server_lib.h" #include "gnunet_server_lib.h"
/** /**
* The handle to a helper process. * The handle to a helper process.
*/ */
struct GNUNET_HELPER_Handle; struct GNUNET_HELPER_Handle;
/** /**
* @brief Starts a helper and begins reading from it * Callback that will be called when the helper process dies. This is not c
alled
* when the helper process is stoped using GNUNET_HELPER_stop()
*
* @param cls the closure from GNUNET_HELPER_start()
*/
typedef void (*GNUNET_HELPER_ExceptionCallback) (void *cls);
/**
* Starts a helper and begins reading from it. The helper process is
* restarted when it dies except when it is stopped using GNUNET_HELPER_sto
p()
* or when the exp_cb callback is not NULL.
* *
* @param with_control_pipe does the helper support the use of a control pi pe for signalling?
* @param binary_name name of the binary to run * @param binary_name name of the binary to run
* @param binary_argv NULL-terminated list of arguments to give when starti ng the binary (this * @param binary_argv NULL-terminated list of arguments to give when starti ng the binary (this
* argument must not be modified by the client for * argument must not be modified by the client for
* the lifetime of the helper handle) * the lifetime of the helper handle)
* @param cb function to call if we get messages from the helper * @param cb function to call if we get messages from the helper
* @param cb_cls Closure for the callback * @param exp_cb the exception callback to call. Set this to NULL if the he
lper
* process has to be restarted automatically when it dies/crashes
* @param cb_cls closure for the above callbacks
* @return the new Handle, NULL on error * @return the new Handle, NULL on error
*/ */
struct GNUNET_HELPER_Handle * struct GNUNET_HELPER_Handle *
GNUNET_HELPER_start (const char *binary_name, GNUNET_HELPER_start (int with_control_pipe,
const char *binary_name,
char *const binary_argv[], char *const binary_argv[],
GNUNET_SERVER_MessageTokenizerCallback cb, void *cb_cls GNUNET_SERVER_MessageTokenizerCallback cb,
); GNUNET_HELPER_ExceptionCallback exp_cb,
void *cb_cls);
/** /**
* @brief Kills the helper, closes the pipe and frees the handle * Kills the helper, closes the pipe and frees the handle
* *
* @param h handle to helper to stop * @param h handle to helper to stop
*/ */
void void
GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h); GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h);
/** /**
* Continuation function. * Continuation function.
* *
* @param cls closure * @param cls closure
 End of changes. 7 change blocks. 
6 lines changed or deleted 25 lines changed or added


 gnunet_lockmanager_service.h   gnunet_lockmanager_service.h 
skipping to change at line 91 skipping to change at line 91
* when an acquired lock has been lost (happens when the lockmanager servic e * when an acquired lock has been lost (happens when the lockmanager servic e
* crashes/restarts). * crashes/restarts).
* *
* @param cls the closure from GNUNET_LOCKMANAGER_lock call * @param cls the closure from GNUNET_LOCKMANAGER_lock call
* *
* @param domain_name the locking domain of the lock * @param domain_name the locking domain of the lock
* *
* @param lock the lock for which this status is relevant * @param lock the lock for which this status is relevant
* *
* @param status GNUNET_LOCKMANAGER_SUCCESS if the lock has been successful ly * @param status GNUNET_LOCKMANAGER_SUCCESS if the lock has been successful ly
* acquired; GNUNET_LOCKMANAGER_RELEASE when the acquired lock is * acquired; GNUNET_LOCKMANAGER_RELEASE when the acquired lock is
lost * lost.
*/ */
typedef void typedef void
(*GNUNET_LOCKMANAGER_StatusCallback) (void *cls, (*GNUNET_LOCKMANAGER_StatusCallback) (void *cls,
const char *domain_name, const char *domain_name,
uint32_t lock, uint32_t lock,
enum GNUNET_LOCKMANAGER_Status enum GNUNET_LOCKMANAGER_Status
status); status);
/** /**
* Opaque handle to locking request * Opaque handle to locking request
skipping to change at line 138 skipping to change at line 139
struct GNUNET_LOCKMANAGER_LockingRequest * struct GNUNET_LOCKMANAGER_LockingRequest *
GNUNET_LOCKMANAGER_acquire_lock (struct GNUNET_LOCKMANAGER_Handle *handle, GNUNET_LOCKMANAGER_acquire_lock (struct GNUNET_LOCKMANAGER_Handle *handle,
const char *domain_name, const char *domain_name,
uint32_t lock, uint32_t lock,
GNUNET_LOCKMANAGER_StatusCallback GNUNET_LOCKMANAGER_StatusCallback
status_cb, status_cb,
void *status_cb_cls); void *status_cb_cls);
/** /**
* Function to cancel the locking request generated by * Function to cancel the locking request generated by
* GNUNET_LOCKMANAGER_acquire_lock. If the lock is acquired us then the loc * GNUNET_LOCKMANAGER_acquire_lock. If the lock is acquired by us then the
k is lock
* released. GNUNET_LOCKMANAGER_StatusCallback will not be called upon any * is released. GNUNET_LOCKMANAGER_StatusCallback will not be called upon a
ny
* status changes resulting due to this call. * status changes resulting due to this call.
* *
* @param request the LockingRequest to cancel * @param request the LockingRequest to cancel
*/ */
void void
GNUNET_LOCKMANAGER_cancel_request (struct GNUNET_LOCKMANAGER_LockingRequest GNUNET_LOCKMANAGER_cancel_request (struct GNUNET_LOCKMANAGER_LockingRequest
*request); *request);
#if 0 /* keep Emacsens' auto-indent happy */ #if 0 /* keep Emacsens' auto-indent happy */
{ {
 End of changes. 2 change blocks. 
5 lines changed or deleted 6 lines changed or added


 gnunet_mesh_service.h   gnunet_mesh_service.h 
skipping to change at line 107 skipping to change at line 107
* If non-zero, messages of the given type will be discarded if they * If non-zero, messages of the given type will be discarded if they
* do not have the right size. * do not have the right size.
*/ */
uint16_t expected_size; uint16_t expected_size;
}; };
/** /**
* Method called whenever another peer has added us to a tunnel * Method called whenever another peer has added us to a tunnel
* the other peer initiated. * the other peer initiated.
* Only called (once) upon reception of data with a message type which was
* subscribed to in GNUNET_MESH_connect. A call to GNUNET_MESH_tunnel_destr
oy
* causes te tunnel to be ignored and no further notifications are sent abo
ut
* the same tunnel.
* *
* @param cls closure * @param cls closure
* @param tunnel new handle to the tunnel * @param tunnel new handle to the tunnel
* @param initiator peer that started the tunnel * @param initiator peer that started the tunnel
* @param atsi performance information for the tunnel * @param atsi performance information for the tunnel
* @return initial tunnel context for the tunnel * @return initial tunnel context for the tunnel
* (can be NULL -- that's not an error) * (can be NULL -- that's not an error)
*/ */
typedef void *(GNUNET_MESH_InboundTunnelNotificationHandler) (void *cls, typedef void *(GNUNET_MESH_InboundTunnelNotificationHandler) (void *cls,
struct struct
skipping to change at line 151 skipping to change at line 155
/** /**
* Type for an application. Values defined in gnunet_applications.h * Type for an application. Values defined in gnunet_applications.h
*/ */
typedef uint32_t GNUNET_MESH_ApplicationType; typedef uint32_t GNUNET_MESH_ApplicationType;
/** /**
* Connect to the mesh service. * Connect to the mesh service.
* *
* @param cfg configuration to use * @param cfg configuration to use
* @param queue_size size of the data message queue, shared among all tunne
ls
* (each tunnel is guaranteed to accept at least one mess
age,
* no matter what is the status of other tunnels)
* @param cls closure for the various callbacks that follow * @param cls closure for the various callbacks that follow
* (including handlers in the handlers array) * (including handlers in the handlers array)
* @param new_tunnel function called when an *inbound* tunnel is created * @param new_tunnel function called when an *inbound* tunnel is created
* @param cleaner function called when an *inbound* tunnel is destroyed by the * @param cleaner function called when an *inbound* tunnel is destroyed by the
* remote peer, it is *not* called if GNUNET_MESH_tunnel_des troy * remote peer, it is *not* called if GNUNET_MESH_tunnel_des troy
* is called on the tunnel * is called on the tunnel
* @param handlers callbacks for messages we care about, NULL-terminated * @param handlers callbacks for messages we care about, NULL-terminated
* note that the mesh is allowed to drop notifications about * note that the mesh is allowed to drop notifications about
* inbound messages if the client does not process them fast * inbound messages if the client does not process them fast
* enough (for this notification type, a bounded queue is us ed) * enough (for this notification type, a bounded queue is us ed)
* @param stypes list of the applications that this client claims to provid e * @param stypes list of the applications that this client claims to provid e
* @return handle to the mesh service NULL on error * @return handle to the mesh service NULL on error
* (in this case, init is never called) * (in this case, init is never called)
*/ */
struct GNUNET_MESH_Handle * struct GNUNET_MESH_Handle *
GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *c
unsigned int queue_size, void *cls, ls,
GNUNET_MESH_InboundTunnelNotificationHandler new_tunne l, GNUNET_MESH_InboundTunnelNotificationHandler new_tunne l,
GNUNET_MESH_TunnelEndHandler cleaner, GNUNET_MESH_TunnelEndHandler cleaner,
const struct GNUNET_MESH_MessageHandler *handlers, const struct GNUNET_MESH_MessageHandler *handlers,
const GNUNET_MESH_ApplicationType *stypes); const GNUNET_MESH_ApplicationType *stypes);
/** /**
* Disconnect from the mesh service. All tunnels will be destroyed. All tun nel * Disconnect from the mesh service. All tunnels will be destroyed. All tun nel
* disconnect callbacks will be called on any still connected peers, notify ing * disconnect callbacks will be called on any still connected peers, notify ing
* about their disconnection. The registered inbound tunnel cleaner will be * about their disconnection. The registered inbound tunnel cleaner will be
* called should any inbound tunnels still exist. * called should any inbound tunnels still exist.
skipping to change at line 217 skipping to change at line 217
* *
* TODO: change to return int to let client allow the new peer or not? * TODO: change to return int to let client allow the new peer or not?
*/ */
typedef void (*GNUNET_MESH_PeerConnectHandler) (void *cls, typedef void (*GNUNET_MESH_PeerConnectHandler) (void *cls,
const struct GNUNET_PeerIde ntity const struct GNUNET_PeerIde ntity
* peer, * peer,
const struct const struct
GNUNET_ATS_Information * at si); GNUNET_ATS_Information * at si);
/** /**
* Announce to ther peer the availability of services described by the rege
x,
* in order to be reachable to other peers via connect_by_string.
*
* Note that the first GNUNET_REGEX_INITIAL_BYTES characters are considered
* to be part of a prefix, (for instance 'gnunet://').
* If you put a variable part in there (*, +. ()), all matching strings
* will be stored in the DHT.
*
* @param h Handle to mesh.
* @param regex String with the regular expression describing local service
s.
* @param compression_characters How many characters can be assigned to one
* edge of the graph. The bigger the variabil
ity
* of the data, the smaller this parameter sh
ould
* be (down to 1).
* For maximum compression, use strlen (regex
)
* or 0 (special value). Use with care!
*/
void
GNUNET_MESH_announce_regex (struct GNUNET_MESH_Handle *h,
const char *regex,
unsigned int compression_characters);
/**
* Create a new tunnel (we're initiator and will be allowed to add/remove p eers * Create a new tunnel (we're initiator and will be allowed to add/remove p eers
* and to broadcast). * and to broadcast).
* *
* @param h mesh handle * @param h mesh handle
* @param tunnel_ctx client's tunnel context to associate with the tunnel * @param tunnel_ctx client's tunnel context to associate with the tunnel
* @param connect_handler function to call when peers are actually connecte d * @param connect_handler function to call when peers are actually connecte d
* @param disconnect_handler function to call when peers are disconnected * @param disconnect_handler function to call when peers are disconnected
* @param handler_cls closure for connect/disconnect handlers * @param handler_cls closure for connect/disconnect handlers
*/ */
struct GNUNET_MESH_Tunnel * struct GNUNET_MESH_Tunnel *
skipping to change at line 242 skipping to change at line 265
/** /**
* Destroy an existing tunnel. The existing callback for the tunnel will NO T * Destroy an existing tunnel. The existing callback for the tunnel will NO T
* be called. * be called.
* *
* @param tunnel tunnel handle * @param tunnel tunnel handle
*/ */
void void
GNUNET_MESH_tunnel_destroy (struct GNUNET_MESH_Tunnel *tunnel); GNUNET_MESH_tunnel_destroy (struct GNUNET_MESH_Tunnel *tunnel);
/** /**
* Request that the tunnel data rate is limited to the speed of the slowest
* receiver.
*
* @param tunnel Tunnel affected.
*/
void
GNUNET_MESH_tunnel_speed_min (struct GNUNET_MESH_Tunnel *tunnel);
/**
* Request that the tunnel data rate is limited to the speed of the fastest
* receiver. This is the default behavior.
*
* @param tunnel Tunnel affected.
*/
void
GNUNET_MESH_tunnel_speed_max (struct GNUNET_MESH_Tunnel *tunnel);
/**
* Turn on/off the buffering status of the tunnel.
*
* @param tunnel Tunnel affected.
* @param buffer GNUNET_YES to turn buffering on (default),
* GNUNET_NO otherwise.
*/
void
GNUNET_MESH_tunnel_buffer (struct GNUNET_MESH_Tunnel *tunnel, int buffer);
/**
* Request that a peer should be added to the tunnel. The connect handler * Request that a peer should be added to the tunnel. The connect handler
* will be called when the peer connects * will be called when the peer connects
* *
* @param tunnel handle to existing tunnel * @param tunnel handle to existing tunnel
* @param peer peer to add * @param peer peer to add
*/ */
void void
GNUNET_MESH_peer_request_connect_add (struct GNUNET_MESH_Tunnel *tunnel, GNUNET_MESH_peer_request_connect_add (struct GNUNET_MESH_Tunnel *tunnel,
const struct GNUNET_PeerIdentity *pee r); const struct GNUNET_PeerIdentity *pee r);
skipping to change at line 276 skipping to change at line 327
* *
* @param tunnel handle to existing tunnel * @param tunnel handle to existing tunnel
* @param app_type application type that must be supported by the peer * @param app_type application type that must be supported by the peer
* (MESH should discover peer in proximity handling this ty pe) * (MESH should discover peer in proximity handling this ty pe)
*/ */
void void
GNUNET_MESH_peer_request_connect_by_type (struct GNUNET_MESH_Tunnel *tunnel , GNUNET_MESH_peer_request_connect_by_type (struct GNUNET_MESH_Tunnel *tunnel ,
GNUNET_MESH_ApplicationType app_t ype); GNUNET_MESH_ApplicationType app_t ype);
/** /**
* Request that the mesh should try to connect to a peer matching the
* description given in the service string.
*
* @param tunnel handle to existing tunnel
* @param description string describing the destination node requirements
*/
void
GNUNET_MESH_peer_request_connect_by_string (struct GNUNET_MESH_Tunnel *tunn
el,
const char *description);
/**
* Request that the given peer isn't added to this tunnel in calls to
* connect_by_* calls, (due to misbehaviour, bad performance, ...).
*
* @param tunnel handle to existing tunnel.
* @param peer peer identity of the peer which should be blacklisted
* for the tunnel.
*/
void
GNUNET_MESH_peer_blacklist (struct GNUNET_MESH_Tunnel *tunnel,
const struct GNUNET_PeerIdentity *peer);
/**
* Request that the given peer isn't blacklisted anymore from this tunnel,
* and therefore can be added in future calls to connect_by_*.
* The peer must have been previously blacklisted for this tunnel.
*
* @param tunnel handle to existing tunnel.
* @param peer peer identity of the peer which shouldn't be blacklisted
* for the tunnel anymore.
*/
void
GNUNET_MESH_peer_unblacklist (struct GNUNET_MESH_Tunnel *tunnel,
const struct GNUNET_PeerIdentity *peer);
/**
* Handle for a transmission request. * Handle for a transmission request.
*/ */
struct GNUNET_MESH_TransmitHandle; struct GNUNET_MESH_TransmitHandle;
/** /**
* Ask the mesh to call "notify" once it is ready to transmit the * Ask the mesh to call "notify" once it is ready to transmit the
* given number of bytes to the specified tunnel or target. * given number of bytes to the specified tunnel or target.
* Only one call can be active at any time, to issue another request,
* wait for the callback or cancel the current request.
* *
* @param tunnel tunnel to use for transmission * @param tunnel tunnel to use for transmission
* @param cork is corking allowed for this transmission? * @param cork is corking allowed for this transmission?
* @param priority how important is the message?
* @param maxdelay how long can the message wait? * @param maxdelay how long can the message wait?
* @param target destination for the message * @param target destination for the message
* NULL for multicast to all tunnel targets * NULL for multicast to all tunnel targets
* @param notify_size how many bytes of buffer space does notify want? * @param notify_size how many bytes of buffer space does notify want?
* @param notify function to call when buffer space is available; * @param notify function to call when buffer space is available;
* will be called with NULL on timeout or if the overall queue * will be called with NULL on timeout or if the overall queue
* for this peer is larger than queue_size and this is currently * for this peer is larger than queue_size and this is currently
* the message with the lowest priority * the message with the lowest priority
* @param notify_cls closure for notify * @param notify_cls closure for notify
* @return non-NULL if the notify callback was queued, * @return non-NULL if the notify callback was queued,
* NULL if we can not even queue the request (insufficient * NULL if we can not even queue the request (insufficient
* memory); if NULL is returned, "notify" will NOT be called. * memory); if NULL is returned, "notify" will NOT be called.
*/ */
struct GNUNET_MESH_TransmitHandle * struct GNUNET_MESH_TransmitHandle *
GNUNET_MESH_notify_transmit_ready (struct GNUNET_MESH_Tunnel *tunnel, int c ork, GNUNET_MESH_notify_transmit_ready (struct GNUNET_MESH_Tunnel *tunnel, int c ork,
uint32_t priority,
struct GNUNET_TIME_Relative maxdelay, struct GNUNET_TIME_Relative maxdelay,
const struct GNUNET_PeerIdentity *target , const struct GNUNET_PeerIdentity *target ,
size_t notify_size, size_t notify_size,
GNUNET_CONNECTION_TransmitReadyNotify no tify, GNUNET_CONNECTION_TransmitReadyNotify no tify,
void *notify_cls); void *notify_cls);
/** /**
* Cancel the specified transmission-ready notification. * Cancel the specified transmission-ready notification.
* *
* @param th handle that was returned by "notify_transmit_ready". * @param th handle that was returned by "notify_transmit_ready".
*/ */
void void
GNUNET_MESH_notify_transmit_ready_cancel (struct GNUNET_MESH_TransmitHandle GNUNET_MESH_notify_transmit_ready_cancel (struct GNUNET_MESH_TransmitHandle
*th); *th);
/** /**
* Transition API for tunnel ctx management * Transition API for tunnel ctx management
*
* FIXME deprecated
*/ */
void void
GNUNET_MESH_tunnel_set_data (struct GNUNET_MESH_Tunnel *tunnel, void *data) ; GNUNET_MESH_tunnel_set_data (struct GNUNET_MESH_Tunnel *tunnel, void *data) ;
/** /**
* Transition API for tunnel ctx management * Transition API for tunnel ctx management
*
* FIXME deprecated
*/ */
void * void *
GNUNET_MESH_tunnel_get_data (struct GNUNET_MESH_Tunnel *tunnel); GNUNET_MESH_tunnel_get_data (struct GNUNET_MESH_Tunnel *tunnel);
#if 0 /* keep Emacsens' auto-indent happy */ #if 0 /* keep Emacsens' auto-indent happy */
{ {
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
 End of changes. 11 change blocks. 
9 lines changed or deleted 107 lines changed or added


 gnunet_namestore_plugin.h   gnunet_namestore_plugin.h 
skipping to change at line 119 skipping to change at line 119
* Iterate over the results for a particular key and zone in the * Iterate over the results for a particular key and zone in the
* datastore. Will return at most one result to the iterator. * datastore. Will return at most one result to the iterator.
* *
* @param cls closure (internal context for the plugin) * @param cls closure (internal context for the plugin)
* @param zone hash of public key of the zone, NULL to iterate over all z ones * @param zone hash of public key of the zone, NULL to iterate over all z ones
* @param name name as '\0' terminated string, NULL to iterate over all r ecords of the zone * @param name name as '\0' terminated string, NULL to iterate over all r ecords of the zone
* @param offset offset in the list of all matching records * @param offset offset in the list of all matching records
* @param iter function to call with the result * @param iter function to call with the result
* @param iter_cls closure for iter * @param iter_cls closure for iter
* @return GNUNET_OK on success, GNUNET_NO if there were no results, GNUN ET_SYSERR on error * @return GNUNET_OK on success, GNUNET_NO if there were no results, GNUN ET_SYSERR on error
* 'iter' will have been called unless the return value is 'GNUNET_ SYSERR'
*/ */
int (*iterate_records) (void *cls, int (*iterate_records) (void *cls,
const struct GNUNET_CRYPTO_ShortHashCode *zone, const struct GNUNET_CRYPTO_ShortHashCode *zone,
const char *name, const char *name,
uint64_t offset, uint64_t offset,
GNUNET_NAMESTORE_RecordIterator iter, void *iter_c ls); GNUNET_NAMESTORE_RecordIterator iter, void *iter_c ls);
/** /**
* Look for an existing PKEY delegation record for a given public key. * Look for an existing PKEY delegation record for a given public key.
* Returns at most one result to the iterator. * Returns at most one result to the iterator.
* *
* @param cls closure (internal context for the plugin) * @param cls closure (internal context for the plugin)
* @param zone hash of public key of the zone to look up in, never NULL * @param zone hash of public key of the zone to look up in, never NULL
* @param value_zone hash of the public key of the target zone (value), n ever NULL * @param value_zone hash of the public key of the target zone (value), n ever NULL
* @param iter function to call with the result * @param iter function to call with the result
* @param iter_cls closure for iter * @param iter_cls closure for iter
* @return GNUNET_OK on success, GNUNET_NO if there were no results, GNUN ET_SYSERR on error * @return GNUNET_OK on success, GNUNET_NO if there were no results, GNUN ET_SYSERR on error
* 'iter' will have been called unless the return value is 'GNUNET_ SYSERR'
*/ */
int (*zone_to_name) (void *cls, int (*zone_to_name) (void *cls,
const struct GNUNET_CRYPTO_ShortHashCode *zone, const struct GNUNET_CRYPTO_ShortHashCode *zone,
const struct GNUNET_CRYPTO_ShortHashCode *value_zone, const struct GNUNET_CRYPTO_ShortHashCode *value_zone,
GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) ; GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) ;
/** /**
* Delete an entire zone (all records). Not used in normal operation. * Delete an entire zone (all records). Not used in normal operation.
* *
* @param cls closure (internal context for the plugin) * @param cls closure (internal context for the plugin)
 End of changes. 2 change blocks. 
0 lines changed or deleted 2 lines changed or added


 gnunet_namestore_service.h   gnunet_namestore_service.h 
skipping to change at line 28 skipping to change at line 28
Boston, MA 02111-1307, USA. Boston, MA 02111-1307, USA.
*/ */
/** /**
* @file include/gnunet_namestore_service.h * @file include/gnunet_namestore_service.h
* @brief API that can be used to store naming information on a GNUnet node ; * @brief API that can be used to store naming information on a GNUnet node ;
* @author Christian Grothoff * @author Christian Grothoff
* *
* Other functions we might want: * Other functions we might want:
* - enumerate all known zones * - enumerate all known zones
* - convenience function to gather record and the full affilliated stree
* in one shot
*/ */
#ifndef GNUNET_NAMESTORE_SERVICE_H #ifndef GNUNET_NAMESTORE_SERVICE_H
#define GNUNET_NAMESTORE_SERVICE_H #define GNUNET_NAMESTORE_SERVICE_H
#include "gnunet_util_lib.h" #include "gnunet_util_lib.h"
#include "gnunet_block_lib.h" #include "gnunet_block_lib.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
skipping to change at line 67 skipping to change at line 65
* Record type for GNS zone transfer ("PSEU"). * Record type for GNS zone transfer ("PSEU").
*/ */
#define GNUNET_NAMESTORE_TYPE_PSEU 65537 #define GNUNET_NAMESTORE_TYPE_PSEU 65537
/** /**
* Record type for GNS legacy hostnames ("LEHO"). * Record type for GNS legacy hostnames ("LEHO").
*/ */
#define GNUNET_NAMESTORE_TYPE_LEHO 65538 #define GNUNET_NAMESTORE_TYPE_LEHO 65538
/** /**
* Record type for VPN resolution
*/
#define GNUNET_NAMESTORE_TYPE_VPN 65539
/**
* Record type for zone revocation
*/
#define GNUNET_NAMESTORE_TYPE_REV 65540
/**
* Entry in the queue. * Entry in the queue.
*/ */
struct GNUNET_NAMESTORE_QueueEntry; struct GNUNET_NAMESTORE_QueueEntry;
/** /**
* Handle to the namestore service. * Handle to the namestore service.
*/ */
struct GNUNET_NAMESTORE_Handle; struct GNUNET_NAMESTORE_Handle;
/** /**
skipping to change at line 100 skipping to change at line 108
* @return handle to use to access the service * @return handle to use to access the service
*/ */
struct GNUNET_NAMESTORE_Handle * struct GNUNET_NAMESTORE_Handle *
GNUNET_NAMESTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); GNUNET_NAMESTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
/** /**
* Disconnect from the namestore service (and free associated * Disconnect from the namestore service (and free associated
* resources). * resources).
* *
* @param h handle to the namestore * @param h handle to the namestore
* @param drop set to GNUNET_YES to delete all data in namestore (!)
*/ */
void void
GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h, int drop); GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h);
/** /**
* Continuation called to notify client about result of the * Continuation called to notify client about result of the
* operation. * operation.
* *
* @param cls closure * @param cls closure
* @param success GNUNET_SYSERR on failure (including timeout/queue drop/fa ilure to validate) * @param success GNUNET_SYSERR on failure (including timeout/queue drop/fa ilure to validate)
* GNUNET_NO if content was already there or not found * GNUNET_NO if content was already there or not found
* GNUNET_YES (or other positive value) on success * GNUNET_YES (or other positive value) on success
* @param emsg NULL on success, otherwise an error message * @param emsg NULL on success, otherwise an error message
skipping to change at line 147 skipping to change at line 154
/** /**
* This is a private record of this peer and it should * This is a private record of this peer and it should
* thus not be handed out to other peers. * thus not be handed out to other peers.
*/ */
GNUNET_NAMESTORE_RF_PRIVATE = 2, GNUNET_NAMESTORE_RF_PRIVATE = 2,
/** /**
* This record was added by the system * This record was added by the system
* and is pending user confimation * and is pending user confimation
*/ */
GNUNET_NAMESTORE_RF_PENDING = 4 GNUNET_NAMESTORE_RF_PENDING = 4,
/**
* This expiration time of the record is a relative
* time (not an absolute time).
*/
GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION = 8,
/**
* This record should not be used unless all (other) records with an abso
lute
* expiration time have expired.
*/
GNUNET_NAMESTORE_RF_SHADOW_RECORD = 16
/**
* When comparing flags for record equality for removal,
* which flags should must match (in addition to the type,
* name, expiration value and data of the record)? All flags
* that are not listed here will be ignored for this purpose.
* (for example, we don't expect that users will remember to
* pass the '--private' option when removing a record from
* the namestore, hence we don't require this particular option
* to match upon removal). See also
* 'GNUNET_NAMESTORE_records_cmp'.
*/
#define GNUNET_NAMESTORE_RF_RCMP_FLAGS (GNUNET_NAMESTORE_RF_RELATIVE_EXPIRA
TION)
}; };
/** /**
* A GNS record. * A GNS record.
*/ */
struct GNUNET_NAMESTORE_RecordData struct GNUNET_NAMESTORE_RecordData
{ {
/** /**
* Binary value stored in the DNS record. * Binary value stored in the DNS record.
* FIXME: goofy API: sometimes 'data' is individually
* 'malloc'ed, sometimes it points into some existing
* data area (so sometimes this should be a 'void *',
* sometimes a 'const void *'). This is unclean.
*/ */
const void *data; const void *data;
/** /**
* Expiration time for the DNS record. * Expiration time for the DNS record. Can be relative
* or absolute, depending on 'flags'.
*/ */
struct GNUNET_TIME_Absolute expiration; uint64_t expiration_time;
/** /**
* Number of bytes in 'data'. * Number of bytes in 'data'.
*/ */
size_t data_size; size_t data_size;
/** /**
* Type of the GNS/DNS record. * Type of the GNS/DNS record.
*/ */
uint32_t record_type; uint32_t record_type;
skipping to change at line 217 skipping to change at line 253
const struct GNUNET_NAMESTORE_RecordData *rd, const struct GNUNET_NAMESTORE_RecordData *rd,
const struct GNUNET_CRYPTO_RsaSignature *signat ure, const struct GNUNET_CRYPTO_RsaSignature *signat ure,
GNUNET_NAMESTORE_ContinuationWithStatus cont, GNUNET_NAMESTORE_ContinuationWithStatus cont,
void *cont_cls); void *cont_cls);
/** /**
* Check if a signature is valid. This API is used by the GNS Block * Check if a signature is valid. This API is used by the GNS Block
* to validate signatures received from the network. * to validate signatures received from the network.
* *
* @param public_key public key of the zone * @param public_key public key of the zone
* @param expire block expiration * @param freshness time set for block expiration
* @param name name that is being mapped (at most 255 characters long) * @param name name that is being mapped (at most 255 characters long)
* @param rd_count number of entries in 'rd' array * @param rd_count number of entries in 'rd' array
* @param rd array of records with data to store * @param rd array of records with data to store
* @param signature signature for all the records in the zone under the giv en name * @param signature signature for all the records in the zone under the giv en name
* @return GNUNET_OK if the signature is valid * @return GNUNET_OK if the signature is valid
*/ */
int int
GNUNET_NAMESTORE_verify_signature (const struct GNUNET_CRYPTO_RsaPublicKeyB inaryEncoded *public_key, GNUNET_NAMESTORE_verify_signature (const struct GNUNET_CRYPTO_RsaPublicKeyB inaryEncoded *public_key,
const struct GNUNET_TIME_Absolute freshn ess, const struct GNUNET_TIME_Absolute freshn ess,
const char *name, const char *name,
unsigned int rd_count, unsigned int rd_count,
const struct GNUNET_NAMESTORE_RecordData *rd, const struct GNUNET_NAMESTORE_RecordData *rd,
const struct GNUNET_CRYPTO_RsaSignature *signature); const struct GNUNET_CRYPTO_RsaSignature *signature);
/** /**
* Store an item in the namestore. If the item is already present, * Store an item in the namestore. If the item is already present,
* the expiration time is updated to the max of the existing time and * the expiration time is updated to the max of the existing time and
* the new time. This API is used by the authority of a zone. * the new time. This API is used by the authority of a zone.
* FIXME: consider allowing to pass multiple records in one call!
* *
* @param h handle to the namestore * @param h handle to the namestore
* @param pkey private key of the zone * @param pkey private key of the zone
* @param name name that is being mapped (at most 255 characters long) * @param name name that is being mapped (at most 255 characters long)
* @param rd record data to store * @param rd record data to store
* @param cont continuation to call when done * @param cont continuation to call when done
* @param cont_cls closure for cont * @param cont_cls closure for cont
* @return handle to abort the request * @return handle to abort the request
*/ */
struct GNUNET_NAMESTORE_QueueEntry * struct GNUNET_NAMESTORE_QueueEntry *
skipping to change at line 281 skipping to change at line 318
const char *name, const char *name,
const struct GNUNET_NAMESTORE_RecordData *rd , const struct GNUNET_NAMESTORE_RecordData *rd ,
GNUNET_NAMESTORE_ContinuationWithStatus cont , GNUNET_NAMESTORE_ContinuationWithStatus cont ,
void *cont_cls); void *cont_cls);
/** /**
* Process a record that was stored in the namestore. * Process a record that was stored in the namestore.
* *
* @param cls closure * @param cls closure
* @param zone_key public key of the zone * @param zone_key public key of the zone
* @param expire when does the corresponding block in the DHT expire (until * @param freshness when does the corresponding block in the DHT expire (un til
* when should we never do a DHT lookup for the same name aga in)?; * when should we never do a DHT lookup for the same name aga in)?;
* GNUNET_TIME_UNIT_ZERO_ABS if there are no records of any t ype in the namestore, * GNUNET_TIME_UNIT_ZERO_ABS if there are no records of any t ype in the namestore,
* or the expiration time of the block in the namestore (even if there are zero * or the expiration time of the block in the namestore (even if there are zero
* records matching the desired record type) * records matching the desired record type)
* @param name name that is being mapped (at most 255 characters long) * @param name name that is being mapped (at most 255 characters long)
* @param rd_count number of entries in 'rd' array * @param rd_count number of entries in 'rd' array
* @param rd array of records with data to store * @param rd array of records with data to store
* @param signature signature of the record block, NULL if signature is una vailable (i.e. * @param signature signature of the record block, NULL if signature is una vailable (i.e.
* because the user queried for a particular record type only) * because the user queried for a particular record type only)
*/ */
typedef void (*GNUNET_NAMESTORE_RecordProcessor) (void *cls, typedef void (*GNUNET_NAMESTORE_RecordProcessor) (void *cls,
const struct GNUNET_CRYPTO _RsaPublicKeyBinaryEncoded *zone_key, const struct GNUNET_CRYPTO _RsaPublicKeyBinaryEncoded *zone_key,
struct GNUNET_TIME_Absolut e freshness, struct GNUNET_TIME_Absolut e freshness,
const char *name, const char *name,
unsigned int rd_len, unsigned int rd_len,
const struct GNUNET_NAMEST ORE_RecordData *rd, const struct GNUNET_NAMEST ORE_RecordData *rd,
const struct GNUNET_CRYPTO _RsaSignature *signature); const struct GNUNET_CRYPTO _RsaSignature *signature);
/** /**
* Get a result for a particular key from the namestore. The processor * Get a result for a particular key from the namestore. The processor
* will only be called once. * will only be called once. When using this functions, relative expiratio
n
* times will be converted to absolute expiration times and a signature
* will be created if we are the authority. The record data and signature
* passed to 'proc' is thus always suitable for passing on to other peers
* (if we are the authority). If the record type is NOT set to 'ANY' and
* if we are NOT the authority, then non-matching records may be omitted
* from the result and no valid signature can be created; in this case,
* 'signature' will be NULL and the result cannot be given to other peers.
* *
* @param h handle to the namestore * @param h handle to the namestore
* @param zone zone to look up a record from * @param zone zone to look up a record from
* @param name name to look up * @param name name to look up
* @param record_type desired record type, 0 for all * @param record_type desired record type, 0 for all
* @param proc function to call on the matching records, or with * @param proc function to call on the matching records, or with
* NULL (rd_count == 0) if there are no matching records * NULL (rd_count == 0) if there are no matching records
* @param proc_cls closure for proc * @param proc_cls closure for proc
* @return a handle that can be used to * @return a handle that can be used to
* cancel * cancel
*/ */
struct GNUNET_NAMESTORE_QueueEntry * struct GNUNET_NAMESTORE_QueueEntry *
GNUNET_NAMESTORE_lookup_record (struct GNUNET_NAMESTORE_Handle *h, GNUNET_NAMESTORE_lookup_record (struct GNUNET_NAMESTORE_Handle *h,
const struct GNUNET_CRYPTO_ShortHashCode *zone const struct GNUNET_CRYPTO_ShortHashCode *zo
, ne,
const char *name, const char *name,
uint32_t record_type, uint32_t record_type,
GNUNET_NAMESTORE_RecordProcessor proc, void *p GNUNET_NAMESTORE_RecordProcessor proc, void
roc_cls); *proc_cls);
/** /**
* Look for an existing PKEY delegation record for a given public key. * Look for an existing PKEY delegation record for a given public key.
* Returns at most one result to the processor. * Returns at most one result to the processor.
* *
* @param h handle to the namestore * @param h handle to the namestore
* @param zone hash of public key of the zone to look up in, never NULL * @param zone hash of public key of the zone to look up in, never NULL
* @param value_zone hash of the public key of the target zone (value), nev er NULL * @param value_zone hash of the public key of the target zone (value), nev er NULL
* @param proc function to call on the matching records, or with * @param proc function to call on the matching records, or with
* NULL (rd_count == 0) if there are no matching records * NULL (rd_count == 0) if there are no matching records
skipping to change at line 342 skipping to change at line 386
* cancel * cancel
*/ */
struct GNUNET_NAMESTORE_QueueEntry * struct GNUNET_NAMESTORE_QueueEntry *
GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h,
const struct GNUNET_CRYPTO_ShortHashCode *zon e, const struct GNUNET_CRYPTO_ShortHashCode *zon e,
const struct GNUNET_CRYPTO_ShortHashCode *val ue_zone, const struct GNUNET_CRYPTO_ShortHashCode *val ue_zone,
GNUNET_NAMESTORE_RecordProcessor proc, void * proc_cls); GNUNET_NAMESTORE_RecordProcessor proc, void * proc_cls);
/** /**
* Starts a new zone iteration (used to periodically PUT all of our * Starts a new zone iteration (used to periodically PUT all of our
* records into our DHT). "proc" will be called once * records into our DHT). "proc" will be called once immediately, and
* immediately, and then again after * then again after "GNUNET_NAMESTORE_zone_iterator_next" is invoked.
* "GNUNET_NAMESTORE_zone_iterator_next" is invoked. *
* By specifying a 'zone' of NULL and setting 'GNUNET_NAMESTORE_RF_AUTHORIT
Y'
* in 'must_have_flags', we can iterate over all records for which we are
* the authority (the 'authority' flag will NOT be set in the returned
* records anyway).
*
* The 'GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION'
* bit in 'must_have_flags' has a special meaning:
*
* 0) If the bit is clear, all relative expriation times are converted to
* absolute expiration times. This is useful for performing DHT PUT
* operations (and zone transfers) of our zone. The generated signature
s
* will be valid for other peers.
* 1) if it is set, it means that relative expiration times should be
* preserved when returned (this is useful for the zone editor user
* interface). No signatures will be created in this case, as
* signatures must not cover records with relative expiration times.
*
* Note that not all queries against this interface are equally performant
* as for some combinations no efficient index may exist.
* *
* @param h handle to the namestore * @param h handle to the namestore
* @param zone zone to access, NULL for all zones * @param zone zone to access, NULL for all zones
* @param must_have_flags flags that must be set for the record to be retur ned * @param must_have_flags flags that must be set for the record to be retur ned
* @param must_not_have_flags flags that must NOT be set for the record to be returned * @param must_not_have_flags flags that must NOT be set for the record to be returned
* @param proc function to call on each name from the zone; it * @param proc function to call on each name from the zone; it
* will be called repeatedly with a value (if available) * will be called repeatedly with a value (if available)
* and always once at the end with a name of NULL. * and always once at the end with a name of NULL.
* @param proc_cls closure for proc * @param proc_cls closure for proc
* @return an iterator handle to use for iteration * @return an iterator handle to use for iteration
skipping to change at line 374 skipping to change at line 437
/** /**
* Calls the record processor specified in GNUNET_NAMESTORE_zone_iteration_ start * Calls the record processor specified in GNUNET_NAMESTORE_zone_iteration_ start
* for the next record. * for the next record.
* *
* @param it the iterator * @param it the iterator
*/ */
void void
GNUNET_NAMESTORE_zone_iterator_next (struct GNUNET_NAMESTORE_ZoneIterator * it); GNUNET_NAMESTORE_zone_iterator_next (struct GNUNET_NAMESTORE_ZoneIterator * it);
/** /**
* Stops iteration and releases the namestore handle for further calls. * Stops iteration and releases the namestore handle for further calls. Mu
st
* be called on any iteration that has not yet completed prior to calling
* 'GNUNET_NAMESTORE_disconnect'.
* *
* @param it the iterator * @param it the iterator
*/ */
void void
GNUNET_NAMESTORE_zone_iteration_stop (struct GNUNET_NAMESTORE_ZoneIterator *it); GNUNET_NAMESTORE_zone_iteration_stop (struct GNUNET_NAMESTORE_ZoneIterator *it);
/** /**
* Cancel a namestore operation. The final callback from the * Cancel a namestore operation. The final callback from the
* operation must not have been done yet. * operation must not have been done yet. Must be called on any
* namestore operation that has not yet completed prior to calling
* 'GNUNET_NAMESTORE_disconnect'.
* *
* @param qe operation to cancel * @param qe operation to cancel
*/ */
void void
GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe); GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe);
/* convenience APIs for serializing / deserializing GNS records */ /* convenience APIs for serializing / deserializing GNS records */
/** /**
* Calculate how many bytes we will need to serialize the given * Calculate how many bytes we will need to serialize the given
skipping to change at line 414 skipping to change at line 481
const struct GNUNET_NAMESTORE_RecordData *rd); const struct GNUNET_NAMESTORE_RecordData *rd);
/** /**
* Serialize the given records to the given destination buffer. * Serialize the given records to the given destination buffer.
* *
* @param rd_count number of records in the rd array * @param rd_count number of records in the rd array
* @param rd array of GNUNET_NAMESTORE_RecordData with rd_count elements * @param rd array of GNUNET_NAMESTORE_RecordData with rd_count elements
* @param dest_size size of the destination array * @param dest_size size of the destination array
* @param dest where to write the result * @param dest where to write the result
* *
* @return the size of serialized records * @return the size of serialized records, -1 if records do not fit
*/ */
ssize_t ssize_t
GNUNET_NAMESTORE_records_serialize (unsigned int rd_count, GNUNET_NAMESTORE_records_serialize (unsigned int rd_count,
const struct GNUNET_NAMESTORE_RecordData *rd, const struct GNUNET_NAMESTORE_RecordData *rd,
size_t dest_size, size_t dest_size,
char *dest); char *dest);
/** /**
* Deserialize the given records to the given destination. * Deserialize the given records to the given destination.
* *
skipping to change at line 439 skipping to change at line 506
* *
* @return GNUNET_OK on success, GNUNET_SYSERR on error * @return GNUNET_OK on success, GNUNET_SYSERR on error
*/ */
int int
GNUNET_NAMESTORE_records_deserialize (size_t len, GNUNET_NAMESTORE_records_deserialize (size_t len,
const char *src, const char *src,
unsigned int rd_count, unsigned int rd_count,
struct GNUNET_NAMESTORE_RecordData *de st); struct GNUNET_NAMESTORE_RecordData *de st);
/** /**
* Checks if a name is wellformed
*
* @param name the name to check
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
int
GNUNET_NAMESTORE_check_name (const char * name);
/**
* Convert the 'value' of a record to a string. * Convert the 'value' of a record to a string.
* *
* @param type type of the record * @param type type of the record
* @param data value in binary encoding * @param data value in binary encoding
* @param data_size number of bytes in data * @param data_size number of bytes in data
* @return NULL on error, otherwise human-readable representation of the va lue * @return NULL on error, otherwise human-readable representation of the va lue
*/ */
char * char *
GNUNET_NAMESTORE_value_to_string (uint32_t type, GNUNET_NAMESTORE_value_to_string (uint32_t type,
const void *data, const void *data,
skipping to change at line 494 skipping to change at line 552
/** /**
* Convert a type number (i.e. 1) to the corresponding type string (i.e. "A ") * Convert a type number (i.e. 1) to the corresponding type string (i.e. "A ")
* *
* @param type number of a type to convert * @param type number of a type to convert
* @return corresponding typestring, NULL on error * @return corresponding typestring, NULL on error
*/ */
const char * const char *
GNUNET_NAMESTORE_number_to_typename (uint32_t type); GNUNET_NAMESTORE_number_to_typename (uint32_t type);
/**
* Test if a given record is expired.
*
* @return GNUNET_YES if the record is expired,
* GNUNET_NO if not
*/
int
GNUNET_NAMESTORE_is_expired (const struct GNUNET_NAMESTORE_RecordData *rd);
#if 0 /* keep Emacsens' auto-indent happy */ #if 0 /* keep Emacsens' auto-indent happy */
{ {
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* end of gnunet_namestore_service.h */ /* end of gnunet_namestore_service.h */
#endif #endif
 End of changes. 20 change blocks. 
31 lines changed or deleted 104 lines changed or added


 gnunet_network_lib.h   gnunet_network_lib.h 
skipping to change at line 72 skipping to change at line 72
*/ */
struct GNUNET_CONTAINER_SList *handles; struct GNUNET_CONTAINER_SList *handles;
#endif #endif
}; };
#include "gnunet_disk_lib.h" #include "gnunet_disk_lib.h"
#include "gnunet_time_lib.h" #include "gnunet_time_lib.h"
/** /**
* Test if the given protocol family is supported by this system.
*
* @param pf protocol family to test (PF_INET, PF_INET6, PF_UNIX)
* @return GNUNET_OK if the PF is supported
*/
int
GNUNET_NETWORK_test_pf (int pf);
/**
* Given a unixpath that is too long (larger than UNIX_PATH_MAX),
* shorten it to an acceptable length while keeping it unique
* and making sure it remains a valid filename (if possible).
*
* @param unixpath long path, will be freed (or same pointer returned
* with moved 0-termination).
* @return shortened unixpath, NULL on error
*/
char *
GNUNET_NETWORK_shorten_unixpath (char *unixpath);
/**
* Accept a new connection on a socket. Configure it for non-blocking * Accept a new connection on a socket. Configure it for non-blocking
* IO and mark it as non-inheritable to child processes (set the * IO and mark it as non-inheritable to child processes (set the
* close-on-exec flag). * close-on-exec flag).
* *
* @param desc bound socket * @param desc bound socket
* @param address address of the connecting peer, may be NULL * @param address address of the connecting peer, may be NULL
* @param address_len length of address * @param address_len length of address
* @return client socket * @return client socket
*/ */
struct GNUNET_NETWORK_Handle * struct GNUNET_NETWORK_Handle *
skipping to change at line 176 skipping to change at line 197
* @param desc socket * @param desc socket
* @param buffer buffer * @param buffer buffer
* @param length length of buffer * @param length length of buffer
* @param src_addr either the source to recv from, or all zeroes * @param src_addr either the source to recv from, or all zeroes
* to be filled in by recvfrom * to be filled in by recvfrom
* @param addrlen length of the addr * @param addrlen length of the addr
*/ */
ssize_t ssize_t
GNUNET_NETWORK_socket_recvfrom (const struct GNUNET_NETWORK_Handle *desc, GNUNET_NETWORK_socket_recvfrom (const struct GNUNET_NETWORK_Handle *desc,
void *buffer, size_t length, void *buffer, size_t length,
struct sockaddr *src_addr, socklen_t * addr len); struct sockaddr *src_addr, socklen_t *addrl en);
/** /**
* Read data from a connected socket (always non-blocking). * Read data from a connected socket (always non-blocking).
* *
* @param desc socket * @param desc socket
* @param buffer buffer * @param buffer buffer
* @param length length of buffer * @param length length of buffer
* @return number of bytes read * @return number of bytes read
*/ */
ssize_t ssize_t
 End of changes. 2 change blocks. 
1 lines changed or deleted 22 lines changed or added


 gnunet_os_lib.h   gnunet_os_lib.h 
skipping to change at line 58 skipping to change at line 58
#if 0 /* keep Emacsens' auto-indent happy */ #if 0 /* keep Emacsens' auto-indent happy */
} }
#endif #endif
#endif #endif
#include "gnunet_common.h" #include "gnunet_common.h"
#include "gnunet_configuration_lib.h" #include "gnunet_configuration_lib.h"
#include "gnunet_scheduler_lib.h" #include "gnunet_scheduler_lib.h"
/** /**
* Flags that determine which of the standard streams
* should be inherited by the child process.
*/
enum GNUNET_OS_InheritStdioFlags
{
/**
* No standard streams should be inherited.
*/
GNUNET_OS_INHERIT_STD_NONE = 0,
/**
* When this flag is set, the child process will
* inherit stdin of the parent.
*/
GNUNET_OS_INHERIT_STD_IN = 1,
/**
* When this flag is set, the child process will
* inherit stdout of the parent.
*/
GNUNET_OS_INHERIT_STD_OUT = 2,
/**
* When this flag is set, the child process will
* inherit stderr of the parent.
*/
GNUNET_OS_INHERIT_STD_ERR = 4,
/**
* When these flags are set, the child process will
* inherit stdout and stderr of the parent.
*/
GNUNET_OS_INHERIT_STD_OUT_AND_ERR = 6,
/**
* Use this option to have all of the standard streams
* (stdin, stdout and stderror) be inherited.
*/
GNUNET_OS_INHERIT_STD_ALL = 7
};
/**
* Process information (OS-dependent) * Process information (OS-dependent)
*/ */
struct GNUNET_OS_Process; struct GNUNET_OS_Process;
/** /**
* Possible installation paths to request * Possible installation paths to request
*/ */
enum GNUNET_OS_InstallationPathKind enum GNUNET_OS_InstallationPathKind
{ {
/** /**
skipping to change at line 108 skipping to change at line 151
/** /**
* Return the prefix of the path with application icons (share/icons/). * Return the prefix of the path with application icons (share/icons/).
*/ */
GNUNET_OS_IPK_ICONDIR, GNUNET_OS_IPK_ICONDIR,
/** /**
* Return the prefix of the path with documentation files, including the * Return the prefix of the path with documentation files, including the
* license (share/doc/gnunet/). * license (share/doc/gnunet/).
*/ */
GNUNET_OS_IPK_DOCDIR GNUNET_OS_IPK_DOCDIR,
/**
* Return the directory where helper binaries are installed (lib/gnunet/l
ibexec/)
*/
GNUNET_OS_IPK_LIBEXECDIR
}; };
/** /**
* Process status types * Process status types
*/ */
enum GNUNET_OS_ProcessStatusType enum GNUNET_OS_ProcessStatusType
{ {
/** /**
* The process is not known to the OS (or at * The process is not known to the OS (or at
* least not one of our children). * least not one of our children).
skipping to change at line 155 skipping to change at line 203
* GNUNET_OS_IPK_SELF_PREFIX, the current running apps installation * GNUNET_OS_IPK_SELF_PREFIX, the current running apps installation
* directory. * directory.
* *
* @param dirkind what kind of directory is desired? * @param dirkind what kind of directory is desired?
* @return a pointer to the dir path (to be freed by the caller) * @return a pointer to the dir path (to be freed by the caller)
*/ */
char * char *
GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkin d); GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkin d);
/** /**
* Given the name of a gnunet-helper, gnunet-service or gnunet-daemon
* binary, try to prefix it with the libexec/-directory to get the
* full path.
*
* @param progname name of the binary
* @return full path to the binary, if possible, otherwise copy of 'prognam
e'
*/
char *
GNUNET_OS_get_libexec_binary_path (const char *progname);
/**
* Callback function invoked for each interface found. * Callback function invoked for each interface found.
* *
* @param cls closure * @param cls closure
* @param name name of the interface (can be NULL for unknown) * @param name name of the interface (can be NULL for unknown)
* @param isDefault is this presumably the default interface * @param isDefault is this presumably the default interface
* @param addr address of this interface (can be NULL for unknown or unassi gned) * @param addr address of this interface (can be NULL for unknown or unassi gned)
* @param broadcast_addr the broadcast address (can be NULL for unknown or unassigned) * @param broadcast_addr the broadcast address (can be NULL for unknown or unassigned)
* @param netmask the network mask (can be NULL for unknown or unassigned)) * @param netmask the network mask (can be NULL for unknown or unassigned))
* @param addrlen length of the address * @param addrlen length of the address
* @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort
skipping to change at line 249 skipping to change at line 308
* @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_control should a pipe be used to send signals to the child?
* @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags
* @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 argv NULL-terminated array of arguments to the process * @param argv NULL-terminated array 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_vap (int pipe_control, GNUNET_OS_start_process_vap (int pipe_control,
enum GNUNET_OS_InheritStdioFlags std_inheritan ce,
struct GNUNET_DISK_PipeHandle *pipe_stdin, struct GNUNET_DISK_PipeHandle *pipe_stdin,
struct GNUNET_DISK_PipeHandle *pipe_stdout, struct GNUNET_DISK_PipeHandle *pipe_stdout,
const char *filename, const char *filename,
char *const argv[]); char *const argv[]);
/** /**
* Start a process. * Start a process.
* *
* @param pipe_control should a pipe be used to send signals to the child? * @param pipe_control should a pipe be used to send signals to the child?
* @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags
* @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 (int pipe_control, GNUNET_OS_start_process (int pipe_control,
enum GNUNET_OS_InheritStdioFlags std_inheritance,
struct GNUNET_DISK_PipeHandle *pipe_stdin, 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_control should a pipe be used to send signals to the child?
* @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags
* @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 (int pipe_control, GNUNET_OS_start_process_va (int pipe_control,
enum GNUNET_OS_InheritStdioFlags std_inheritanc e,
struct GNUNET_DISK_PipeHandle *pipe_stdin, 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 pipe_control should a pipe be used to send signals to the child?
* @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags
* @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 (int pipe_control, GNUNET_OS_start_process_v (int pipe_control,
enum GNUNET_OS_InheritStdioFlags std_inheritance ,
const SOCKTYPE *lsocks, const SOCKTYPE *lsocks,
const char *filename, 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;
/** /**
 End of changes. 11 change blocks. 
1 lines changed or deleted 70 lines changed or added


 gnunet_peer_lib.h   gnunet_peer_lib.h 
skipping to change at line 95 skipping to change at line 95
/** /**
* Convert an interned PID to a normal peer identity. * Convert an interned PID to a normal peer identity.
* *
* @param id interned PID to convert * @param id interned PID to convert
* @param pid where to write the normal peer identity * @param pid where to write the normal peer identity
*/ */
void void
GNUNET_PEER_resolve (GNUNET_PEER_Id id, struct GNUNET_PeerIdentity *pid); GNUNET_PEER_resolve (GNUNET_PEER_Id id, struct GNUNET_PeerIdentity *pid);
/**
* Convert an interned PID to a normal peer identity.
*
* @param id interned PID to convert
* @return pointer to peer identity, valid as long 'id' is valid
*/
const struct GNUNET_PeerIdentity *
GNUNET_PEER_resolve2 (GNUNET_PEER_Id id);
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
#ifdef __cplusplus
}
#endif
/* ifndef GNUNET_PEER_LIB_H */ /* ifndef GNUNET_PEER_LIB_H */
#endif #endif
/* end of gnunet_peer_lib.h */ /* end of gnunet_peer_lib.h */
 End of changes. 1 change blocks. 
0 lines changed or deleted 16 lines changed or added


 gnunet_protocols.h   gnunet_protocols.h 
skipping to change at line 783 skipping to change at line 783
* Request the destuction of a path * Request the destuction of a path
*/ */
#define GNUNET_MESSAGE_TYPE_MESH_PATH_DESTROY 265 #define GNUNET_MESSAGE_TYPE_MESH_PATH_DESTROY 265
/** /**
* Request the destruction of a whole tunnel * Request the destruction of a whole tunnel
*/ */
#define GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY 266 #define GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY 266
/** /**
* We need flow control * ACK for a data packet.
*/ */
#define GNUNET_MESSAGE_TYPE_MESH_SPEED_NOTIFY 270 #define GNUNET_MESSAGE_TYPE_MESH_ACK 267
/**
* Poll for an ACK.
*/
#define GNUNET_MESSAGE_TYPE_MESH_POLL 268
/** /**
* Connect to the mesh service, specifying subscriptions * Connect to the mesh service, specifying subscriptions
*/ */
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT 272 #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT 272
/** /**
* Ask the mesh service to create a new tunnel * Ask the mesh service to create a new tunnel
*/ */
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATE 273 #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATE 273
skipping to change at line 818 skipping to change at line 823
* Ask the mesh service to remove a peer from a tunnel * Ask the mesh service to remove a peer from a tunnel
*/ */
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_DEL 276 #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_DEL 276
/** /**
* Ask the mesh service to add a peer offering a service to an existing tun nel * Ask the mesh service to add a peer offering a service to an existing tun nel
*/ */
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_ADD_BY_TYPE 277 #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_ADD_BY_TYPE 277
/** /**
* Ask the mesh service to add a peer described by a service string
*/
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_ANNOUNCE_REGEX 278
/**
* Ask the mesh service to add a peer described by a service string
*/
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_ADD_BY_STRING 279
/**
* Ask the mesh service to add a peer to the blacklist of an existing tunne
l
*/
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_BLACKLIST 280
/**
* Ask the mesh service to remove a peer from the blacklist of a tunnel
*/
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_UNBLACKLIST 281
/**
* Set tunnel speed to slowest peer
*/
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_MIN 282
/**
* Set tunnel speed to fastest peer
*/
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_MAX 283
/**
* Set tunnel buffering on.
*/
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_BUFFER 284
/**
* Set tunnel buffering off.
*/
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_NOBUFFER 285
/**
* Local ACK for data.
*/
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK 286
/**
* 640kb should be enough for everybody * 640kb should be enough for everybody
*/ */
#define GNUNET_MESSAGE_TYPE_MESH_RESERVE_END 288 #define GNUNET_MESSAGE_TYPE_MESH_RESERVE_END 299
/************************************************************************** ***** /************************************************************************** *****
* CHAT message types START * CHAT message types START
************************************************************************** ****/ ************************************************************************** ****/
/** /**
* Message sent from client to join a chat room. * Message sent from client to join a chat room.
*/ */
#define GNUNET_MESSAGE_TYPE_CHAT_JOIN_REQUEST 300 #define GNUNET_MESSAGE_TYPE_CHAT_JOIN_REQUEST 300
skipping to change at line 1022 skipping to change at line 1072
* to confirm that an address is used or not used anymore * to confirm that an address is used or not used anymore
*/ */
#define GNUNET_MESSAGE_TYPE_ATS_ADDRESS_IN_USE 351 #define GNUNET_MESSAGE_TYPE_ATS_ADDRESS_IN_USE 351
/** /**
* Type of the 'struct AddressUseMessage' sent by ATS to client * Type of the 'struct AddressUseMessage' sent by ATS to client
* to confirm that an address is used or not used anymore * to confirm that an address is used or not used anymore
*/ */
#define GNUNET_MESSAGE_TYPE_ATS_RESET_BACKOFF 352 #define GNUNET_MESSAGE_TYPE_ATS_RESET_BACKOFF 352
/**
* Type of the 'struct AddressUpdateMessage' sent by client to ATS
* to add a new address
*/
#define GNUNET_MESSAGE_TYPE_ATS_ADDRESS_ADD 353
/************************************************************************** ***** /************************************************************************** *****
* TRANSPORT message types * TRANSPORT message types
************************************************************************** ****/ ************************************************************************** ****/
/** /**
* Message from the core saying that the transport * Message from the core saying that the transport
* server should start giving it messages. This * server should start giving it messages. This
* should automatically trigger the transmission of * should automatically trigger the transmission of
* a HELLO message. * a HELLO message.
*/ */
skipping to change at line 1163 skipping to change at line 1219
* Request to iterate over all known addresses. * Request to iterate over all known addresses.
*/ */
#define GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE 383 #define GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE 383
/** /**
* Message send by a peer to notify the other to keep the session alive. * Message send by a peer to notify the other to keep the session alive.
*/ */
#define GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON 384 #define GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON 384
/************************************************************************** ***** /************************************************************************** *****
* STREAM LIRBRARY MESSAGES * STREAM messages types
************************************************************************** ****/ ************************************************************************** ****/
/** /**
* Message containing data exchanged between stream end-points over mesh. * Message containing data exchanged between stream end-points over mesh.
*/ */
#define GNUNET_MESSAGE_TYPE_STREAM_DATA 400 #define GNUNET_MESSAGE_TYPE_STREAM_DATA 400
/** /**
* ACK message * ACK message
*/ */
skipping to change at line 1267 skipping to change at line 1323
/** /**
* Signal that helper is done. * Signal that helper is done.
*/ */
#define GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_FINISHED 426 #define GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_FINISHED 426
/************************************************************************** ***** /************************************************************************** *****
* NAMESTORE message types * NAMESTORE message types
************************************************************************** ****/ ************************************************************************** ****/
/** /**
* Request update and listing of a peer. * Client to service: register.
*/ */
#define GNUNET_MESSAGE_TYPE_NAMESTORE_START 430 #define GNUNET_MESSAGE_TYPE_NAMESTORE_START 430
/**
* Client to service: lookup name
*/
#define GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME 431
/**
* Service to client: result of name lookup
*/
#define GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE 432
/**
* Client to service: put records (for caching)
*/
#define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT 433
/**
* Service to client: result of put operation.
*/
#define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE 434
/**
* Client to service: create record as authority
*/
#define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE 435
/**
* Service to client: result of record creation request
*/
#define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE_RESPONSE 436
/**
* Client to service: remove record(s)
*/
#define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE 437
/**
* Service to client: result of removal request.
*/
#define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE_RESPONSE 438
/**
* Client to service: "reverse" lookup for zone name based on zone key
*/
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME 439
/**
* Service to client: result of zone-to-name lookup.
*/
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE 440
/**
* Client to service: please start iteration
*/
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START 445
/**
* Service to client: current record in iteration (or end of list).
*/
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE 446
/**
* Client to service: next record in iteration please.
*/
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT 447
/**
* Client to service: stop iterating.
*/
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP 448
/************************************************************************** ***** /************************************************************************** *****
* LOCKMANAGER message types * LOCKMANAGER message types
************************************************************************** ****/ ************************************************************************** ****/
/** /**
* Message to acquire Lock * Message to acquire Lock
*/ */
#define GNUNET_MESSAGE_TYPE_LOCKMANAGER_ACQUIRE 440 #define GNUNET_MESSAGE_TYPE_LOCKMANAGER_ACQUIRE 450
/** /**
* Message to release lock * Message to release lock
*/ */
#define GNUNET_MESSAGE_TYPE_LOCKMANAGER_RELEASE 441 #define GNUNET_MESSAGE_TYPE_LOCKMANAGER_RELEASE 451
/** /**
* SUCESS reply from lockmanager * SUCESS reply from lockmanager
*/ */
#define GNUNET_MESSAGE_TYPE_LOCKMANAGER_SUCCESS 442 #define GNUNET_MESSAGE_TYPE_LOCKMANAGER_SUCCESS 452
/**************************************************************************
*****
* TESTBED message types
**************************************************************************
****/
/**
* Initial message from a client to a testing control service
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_INIT 460
/**
* Message to add host
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_ADDHOST 461
/**
* Message to signal that a add host succeeded
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM 462
/**
* Message to configure a service to be shared among peers
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_SERVICESHARE 463
/**
* Message to link delegated controller to slave controller
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_LCONTROLLERS 464
/**
* Message to create a peer at a host
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_CREATEPEER 465
/**
* Message to reconfigure a peer
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_PEERRECONF 466
/**
* Message to start a peer at a host
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_STARTPEER 467
/**
* Message to stop a peer at a host
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_STOPPEER 468
/**
* Message to destroy a peer
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER 469
/**
* Configure underlay link message
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_CONFIGULLINK 470
/**
* Message to connect peers in a overlay
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_OLCONNECT 471
/**
* Message for peer events
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_PEEREVENT 472
/**
* Message for peer connect events
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_PEERCONEVENT 473
/**
* Message for operation events
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_OPERATIONFAILEVENT 474
/**
* Message to signal successful peer creation
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_PEERCREATESUCCESS 475
/**
* Message to signal a generic operation has been successful
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_GENERICOPSUCCESS 476
/**
* Message to get the configuration of a peer
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_GETPEERCONFIG 477
/**
* Message containing the peer configuration
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_PEERCONFIG 478
/**
* Message to request a controller to make one of its peer to connect to an
other
* peer using the contained HELLO
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_REQUESTCONNECT 479
/**
* Message to cancel a REQUESTCONNECT request
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_REQUESTCONNECTCANCEL 480
/**
* Message to request configuration of a slave controller
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_GETSLAVECONFIG 481
/**
* Message which contains the configuration of slave controller
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG 482
/**
* Not really a message, but for careful checks on the testbed messages; Sh
ould
* always be the maximum and never be used to send messages with this type
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_MAX 483
/**
* The initialization message towards gnunet-testbed-helper
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT 495
/**
* The reply message from gnunet-testbed-helper
*/
#define GNUNET_MESSAGE_TYPE_TESTBED_HELPER_REPLY 496
/**
* GNS. FIXME: document!
*/
#define GNUNET_MESSAGE_TYPE_GNS_LOOKUP 500
#define GNUNET_MESSAGE_TYPE_GNS_LOOKUP_RESULT 501
#define GNUNET_MESSAGE_TYPE_GNS_SHORTEN 502
#define GNUNET_MESSAGE_TYPE_GNS_SHORTEN_RESULT 503
#define GNUNET_MESSAGE_TYPE_GNS_GET_AUTH 504
#define GNUNET_MESSAGE_TYPE_GNS_GET_AUTH_RESULT 505
/** /**
* Next available: 450 * Next available: 520
*/ */
/************************************************************************** ***** /************************************************************************** *****
* TODO: we need a way to register message types centrally (via some webpag e). * TODO: we need a way to register message types centrally (via some webpag e).
* For now: unofficial extensions should start at 48k, internal extensions * For now: unofficial extensions should start at 48k, internal extensions
* define here should leave some room (4-10 additional messages to the prev ious * define here should leave some room (4-10 additional messages to the prev ious
* extension). * extension).
************************************************************************** ****/ ************************************************************************** ****/
/** /**
 End of changes. 12 change blocks. 
9 lines changed or deleted 291 lines changed or added


 gnunet_pseudonym_lib.h   gnunet_pseudonym_lib.h 
skipping to change at line 54 skipping to change at line 54
* *
* @param cls closure * @param cls closure
* @param pseudonym hash code of public key of pseudonym * @param pseudonym hash code of public key of pseudonym
* @param name name of the pseudonym (might be NULL) * @param name name of the pseudonym (might be NULL)
* @param unique_name unique name of the pseudonym (might be NULL) * @param unique_name unique name of the pseudonym (might be NULL)
* @param md meta data known about the pseudonym * @param md meta data known about the pseudonym
* @param rating the local rating of the pseudonym * @param rating the local rating of the pseudonym
* @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort
*/ */
typedef int (*GNUNET_PSEUDONYM_Iterator) (void *cls, typedef int (*GNUNET_PSEUDONYM_Iterator) (void *cls,
const GNUNET_HashCode * pseudonym , const struct GNUNET_HashCode * ps eudonym,
const char *name, const char *name,
const char *unique_name, const char *unique_name,
const struct GNUNET_CONTAINER_Met aData const struct GNUNET_CONTAINER_Met aData
* md, int rating); * md, int rating);
/** /**
* Change the ranking of a pseudonym. * Change the ranking of a pseudonym.
* *
* @param cfg overall configuration * @param cfg overall configuration
* @param nsid id of the pseudonym * @param nsid id of the pseudonym
* @param delta by how much should the rating be changed? * @param delta by how much should the rating be changed?
* @return new rating of the namespace * @return new rating of the namespace
*/ */
int int
GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg,
const GNUNET_HashCode * nsid, int delta); const struct GNUNET_HashCode * nsid, int delta);
/** /**
* Add a pseudonym to the set of known pseudonyms. * Add a pseudonym to the set of known pseudonyms.
* For all pseudonym advertisements that we discover * For all pseudonym advertisements that we discover
* FS should automatically call this function. * FS should automatically call this function.
* *
* @param cfg overall configuration * @param cfg overall configuration
* @param id the pseudonym identifier * @param id the pseudonym identifier
* @param meta metadata for the pseudonym * @param meta metadata for the pseudonym
*/ */
void void
GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg,
const GNUNET_HashCode * id, const struct GNUNET_HashCode * id,
const struct GNUNET_CONTAINER_MetaData *meta); const struct GNUNET_CONTAINER_MetaData *meta);
/** /**
* List all known pseudonyms. * List all known pseudonyms.
* *
* @param cfg overall configuration * @param cfg overall configuration
* @param iterator function to call for each pseudonym * @param iterator function to call for each pseudonym
* @param closure closure for iterator * @param closure closure for iterator
* @return number of pseudonyms found * @return number of pseudonyms found
*/ */
skipping to change at line 129 skipping to change at line 129
* *
* @param cfg configuration * @param cfg configuration
* @param nsid cryptographic ID of the namespace * @param nsid cryptographic ID of the namespace
* @param name name to uniquify * @param name name to uniquify
* @param suffix if not NULL, filled with the suffix value * @param suffix if not NULL, filled with the suffix value
* @return NULL on failure (should never happen), name on success. * @return NULL on failure (should never happen), name on success.
* Free the name with GNUNET_free(). * Free the name with GNUNET_free().
*/ */
char * char *
GNUNET_PSEUDONYM_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *c fg, GNUNET_PSEUDONYM_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *c fg,
const GNUNET_HashCode * nsid, const char *name, unsigned int *suffix); const struct GNUNET_HashCode * nsid, const char *name, unsigned int *su ffix);
/** /**
* Get namespace name, metadata and rank * Get namespace name, metadata and rank
* This is a wrapper around internal read_info() call, and ensures that * This is a wrapper around internal read_info() call, and ensures that
* returned data is not invalid (not NULL). * returned data is not invalid (not NULL).
* Writing back information returned by this function will give * Writing back information returned by this function will give
* a name "no-name" to pseudonyms that have no name. This side-effect is * a name "no-name" to pseudonyms that have no name. This side-effect is
* unavoidable, but hardly harmful. * unavoidable, but hardly harmful.
* *
* @param cfg configuration * @param cfg configuration
skipping to change at line 154 skipping to change at line 154
* @param ret_name a location to store human-readable name. Name is not uni que. * @param ret_name a location to store human-readable name. Name is not uni que.
* NULL, if name is not needed. Free with GNUNET_free(). * NULL, if name is not needed. Free with GNUNET_free().
* @param name_is_a_dup is set to GNUNET_YES, if ret_name was filled with * @param name_is_a_dup is set to GNUNET_YES, if ret_name was filled with
* a duplicate of a "no-name" placeholder * a duplicate of a "no-name" placeholder
* @return GNUNET_OK on success. GNUENT_SYSERR if the data was * @return GNUNET_OK on success. GNUENT_SYSERR if the data was
* unobtainable (in that case ret_* are filled with placeholders - * unobtainable (in that case ret_* are filled with placeholders -
* empty metadata container, rank -1 and a "no-name" name). * empty metadata container, rank -1 and a "no-name" name).
*/ */
int int
GNUNET_PSEUDONYM_get_info (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_PSEUDONYM_get_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
const GNUNET_HashCode * nsid, struct GNUNET_CONTAINER_MetaData **ret_me ta, const struct GNUNET_HashCode * nsid, struct GNUNET_CONTAINER_MetaData * *ret_meta,
int32_t *ret_rank, char **ret_name, int *name_is_a_dup); int32_t *ret_rank, char **ret_name, int *name_is_a_dup);
/** /**
* Get the namespace ID belonging to the given namespace name. * Get the namespace ID belonging to the given namespace name.
* *
* @param cfg configuration to use * @param cfg configuration to use
* @param ns_uname unique (!) human-readable name for the namespace * @param ns_uname unique (!) human-readable name for the namespace
* @param nsid set to namespace ID based on 'ns_uname' * @param nsid set to namespace ID based on 'ns_uname'
* @return GNUNET_OK on success, GNUNET_SYSERR on failure * @return GNUNET_OK on success, GNUNET_SYSERR on failure
*/ */
int int
GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *ns_uname, GNUNET_HashCode * nsid); const char *ns_uname, struct GNUNET_HashCode * nsid);
/** /**
* Set the pseudonym metadata, rank and name. * Set the pseudonym metadata, rank and name.
* *
* @param cfg overall configuration * @param cfg overall configuration
* @param nsid id of the pseudonym * @param nsid id of the pseudonym
* @param name name to set. Must be the non-unique version of it. * @param name name to set. Must be the non-unique version of it.
* May be NULL, in which case it erases pseudonym's name! * May be NULL, in which case it erases pseudonym's name!
* @param md metadata to set * @param md metadata to set
* May be NULL, in which case it erases pseudonym's metadata! * May be NULL, in which case it erases pseudonym's metadata!
* @param rank rank to assign * @param rank rank to assign
* @return GNUNET_OK on success, GNUNET_SYSERR on failure * @return GNUNET_OK on success, GNUNET_SYSERR on failure
*/ */
int int
GNUNET_PSEUDONYM_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_PSEUDONYM_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
const GNUNET_HashCode * nsid, const char *name, const struct GNUNET_HashCode * nsid, const char *name,
const struct GNUNET_CONTAINER_MetaData *md, int rank); const struct GNUNET_CONTAINER_MetaData *md, int rank);
#if 0 /* keep Emacsens' auto-indent happy */ #if 0 /* keep Emacsens' auto-indent happy */
{ {
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* ifndef GNUNET_PSEUDONYM_LIB_H */ /* ifndef GNUNET_PSEUDONYM_LIB_H */
 End of changes. 7 change blocks. 
7 lines changed or deleted 7 lines changed or added


 gnunet_regex_lib.h   gnunet_regex_lib.h 
skipping to change at line 41 skipping to change at line 41
#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
/** /**
* Constant for how many bytes the initial string regex should have.
*/
#define GNUNET_REGEX_INITIAL_BYTES 24
/**
* Maximum regex string length for use with GNUNET_REGEX_ipv4toregex
*/
#define GNUNET_REGEX_IPV4_REGEXLEN 32 + 6
/**
* Maximum regex string length for use with GNUNET_REGEX_ipv6toregex
*/
#define GNUNET_REGEX_IPV6_REGEXLEN 128 + 6
/**
* Automaton (NFA/DFA) representation. * Automaton (NFA/DFA) representation.
*/ */
struct GNUNET_REGEX_Automaton; struct GNUNET_REGEX_Automaton;
/** /**
* Edge representation. * Edge representation.
*/ */
struct GNUNET_REGEX_Edge struct GNUNET_REGEX_Edge
{ {
/** /**
* Label of the edge. * Label of the edge. FIXME: might want to not consume exactly multiples of 8 bits, need length?
*/ */
const char *label; const char *label;
/** /**
* Destionation of the edge. * Destionation of the edge.
*/ */
GNUNET_HashCode destination; struct GNUNET_HashCode destination;
}; };
/** /**
* Construct an NFA by parsing the regex string of length 'len'.
*
* @param regex regular expression string.
* @param len length of the string.
*
* @return NFA, needs to be freed using GNUNET_REGEX_destroy_automaton.
*/
struct GNUNET_REGEX_Automaton *
GNUNET_REGEX_construct_nfa (const char *regex, const size_t len);
/**
* Construct DFA for the given 'regex' of length 'len'. * Construct DFA for the given 'regex' of length 'len'.
* *
* Path compression means, that for example a DFA o -> a -> b -> c -> o wil
l be
* compressed to o -> abc -> o. Note that this parameter influences the
* non-determinism of states of the resulting NFA in the DHT (number of out
going
* edges with the same label). For example for an application that stores I
Pv4
* addresses as bitstrings it could make sense to limit the path compressio
n to
* 4 or 8.
*
* @param regex regular expression string. * @param regex regular expression string.
* @param len length of the regular expression. * @param len length of the regular expression.
* * @param max_path_len limit the path compression length to the
* @return DFA, needs to be freed using GNUNET_REGEX_destroy_automaton. * given value. If set to 1, no path compression is applied. Set to
0 for
* maximal possible path compression (generally not desireable).
* @return DFA, needs to be freed using GNUNET_REGEX_automaton_destroy.
*/ */
struct GNUNET_REGEX_Automaton * struct GNUNET_REGEX_Automaton *
GNUNET_REGEX_construct_dfa (const char *regex, const size_t len); GNUNET_REGEX_construct_dfa (const char *regex, const size_t len,
int max_path_len);
/** /**
* Free the memory allocated by constructing the GNUNET_REGEX_Automaton. * Free the memory allocated by constructing the GNUNET_REGEX_Automaton.
* data structure. * data structure.
* *
* @param a automaton to be destroyed. * @param a automaton to be destroyed.
*/ */
void void
GNUNET_REGEX_automaton_destroy (struct GNUNET_REGEX_Automaton *a); GNUNET_REGEX_automaton_destroy (struct GNUNET_REGEX_Automaton *a);
/** /**
* Options for graph creation function
* GNUNET_REGEX_automaton_save_graph.
*/
enum GNUNET_REGEX_GraphSavingOptions
{
/**
* Default. Do nothing special.
*/
GNUNET_REGEX_GRAPH_DEFAULT = 0,
/**
* The generated graph will include extra information such as the NFA sta
tes
* that were used to generate the DFA state.
*/
GNUNET_REGEX_GRAPH_VERBOSE = 1,
/**
* Enable graph coloring. Will color each SCC in a different color.
*/
GNUNET_REGEX_GRAPH_COLORING = 2
};
/**
* Save the given automaton as a GraphViz dot file. * Save the given automaton as a GraphViz dot file.
* *
* @param a the automaton to be saved. * @param a the automaton to be saved.
* @param filename where to save the file. * @param filename where to save the file.
* @param options options for graph generation that include coloring or ver
bose
* mode
*/ */
void void
GNUNET_REGEX_automaton_save_graph (struct GNUNET_REGEX_Automaton *a, GNUNET_REGEX_automaton_save_graph (struct GNUNET_REGEX_Automaton *a,
const char *filename); const char *filename,
enum GNUNET_REGEX_GraphSavingOptions opt
ions);
/** /**
* Evaluates the given 'string' against the given compiled regex. * Evaluates the given 'string' against the given compiled regex.
* *
* @param a automaton. * @param a automaton.
* @param string string to check. * @param string string to check.
* *
* @return 0 if string matches, non 0 otherwise. * @return 0 if string matches, non 0 otherwise.
*/ */
int int
GNUNET_REGEX_eval (struct GNUNET_REGEX_Automaton *a, GNUNET_REGEX_eval (struct GNUNET_REGEX_Automaton *a,
const char *string); const char *string);
/** /**
* Get the first key for the given 'input_string'. This hashes * Get the first key for the given 'input_string'. This hashes
* the first x bits of the 'input_strings'. * the first x bits of the 'input_string'.
* *
* @param input_string string. * @param input_string string.
* @param string_len length of the 'input_string'. * @param string_len length of the 'input_string'.
* @param key pointer to where to write the hash code. * @param key pointer to where to write the hash code.
* *
* @return number of bits of 'input_string' that have been consumed * @return number of bits of 'input_string' that have been consumed
* to construct the key * to construct the key
*/ */
unsigned int size_t
GNUNET_REGEX_get_first_key (const char *input_string, unsigned int string_l GNUNET_REGEX_get_first_key (const char *input_string, size_t string_len,
en, struct GNUNET_HashCode * key);
GNUNET_HashCode * key);
/** /**
* Check if the given 'proof' matches the given 'key'. * Check if the given 'proof' matches the given 'key'.
* *
* @param proof partial regex * @param proof partial regex of a state.
* @param key hash * @param key hash of a state.
* *
* @return GNUNET_OK if the proof is valid for the given key * @return GNUNET_OK if the proof is valid for the given key.
*/ */
int int
GNUNET_REGEX_check_proof (const char *proof, GNUNET_REGEX_check_proof (const char *proof,
const GNUNET_HashCode *key); const struct GNUNET_HashCode *key);
/** /**
* Iterator callback function. * Iterator callback function.
* *
* @param cls closure. * @param cls closure.
* @param key hash for current state. * @param key hash for current state.
* @param proof proof for current state. * @param proof proof for current state.
* @param accepting GNUNET_YES if this is an accepting state, GNUNET_NO if not. * @param accepting GNUNET_YES if this is an accepting state, GNUNET_NO if not.
* @param num_edges number of edges leaving current state. * @param num_edges number of edges leaving current state.
* @param edges edges leaving current state. * @param edges edges leaving current state.
*/ */
typedef void (*GNUNET_REGEX_KeyIterator)(void *cls, typedef void (*GNUNET_REGEX_KeyIterator)(void *cls,
const GNUNET_HashCode *key, const struct GNUNET_HashCode *key,
const char *proof, const char *proof,
int accepting, int accepting,
unsigned int num_edges, unsigned int num_edges,
const struct GNUNET_REGEX_Edge *ed ges); const struct GNUNET_REGEX_Edge *ed ges);
/** /**
* Iterate over all edges starting from start state of automaton 'a'. Calli ng * Iterate over all edges starting from start state of automaton 'a'. Calli ng
* iterator for each edge. * iterator for each edge.
* *
* @param a automaton. * @param a automaton.
* @param iterator iterator called for each edge. * @param iterator iterator called for each edge.
* @param iterator_cls closure. * @param iterator_cls closure.
*/ */
void void
GNUNET_REGEX_iterate_all_edges (struct GNUNET_REGEX_Automaton *a, GNUNET_REGEX_iterate_all_edges (struct GNUNET_REGEX_Automaton *a,
GNUNET_REGEX_KeyIterator iterator, GNUNET_REGEX_KeyIterator iterator,
void *iterator_cls); void *iterator_cls);
/**
* Create a regex in 'rxstr' from the given 'ip' and 'netmask'.
*
* @param ip IPv4 representation.
* @param netmask netmask for the ip.
* @param rxstr generated regex, must be at least GNUNET_REGEX_IPV4_REGEXLE
N
* bytes long.
*/
void
GNUNET_REGEX_ipv4toregex (const struct in_addr *ip, const char *netmask,
char *rxstr);
/**
* Create a regex in 'rxstr' from the given 'ipv6' and 'prefixlen'.
*
* @param ipv6 IPv6 representation.
* @param prefixlen length of the ipv6 prefix.
* @param rxstr generated regex, must be at least GNUNET_REGEX_IPV6_REGEXLE
N
* bytes long.
*/
void
GNUNET_REGEX_ipv6toregex (const struct in6_addr *ipv6,
unsigned int prefixlen, char *rxstr);
#if 0 /* keep Emacsens' auto-indent happy */ #if 0 /* keep Emacsens' auto-indent happy */
{ {
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* end of gnunet_regex_lib.h */ /* end of gnunet_regex_lib.h */
#endif #endif
 End of changes. 17 change blocks. 
27 lines changed or deleted 100 lines changed or added


 gnunet_scheduler_lib.h   gnunet_scheduler_lib.h 
skipping to change at line 210 skipping to change at line 210
* @param wfds set of sockets to be checked for writability * @param wfds set of sockets to be checked for writability
* @param efds set of sockets to be checked for exceptions * @param efds set of sockets to be checked for exceptions
* @param timeout relative value when to return * @param timeout relative value when to return
* @return number of selected sockets, GNUNET_SYSERR on error * @return number of selected sockets, GNUNET_SYSERR on error
*/ */
typedef int (*GNUNET_SCHEDULER_select) (void *cls, typedef int (*GNUNET_SCHEDULER_select) (void *cls,
struct GNUNET_NETWORK_FDSet * rfds, struct GNUNET_NETWORK_FDSet * rfds,
struct GNUNET_NETWORK_FDSet * wfds, struct GNUNET_NETWORK_FDSet * wfds,
struct GNUNET_NETWORK_FDSet * efds, struct GNUNET_NETWORK_FDSet * efds,
struct GNUNET_TIME_Relative timeout ); struct GNUNET_TIME_Relative timeout );
/** /**
* Initialize and run scheduler. This function will return when all * Initialize and run scheduler. This function will return when all
* tasks have completed. On systems with signals, receiving a SIGTERM * tasks have completed. On systems with signals, receiving a SIGTERM
* (and other similar signals) will cause "GNUNET_SCHEDULER_shutdown" * (and other similar signals) will cause "GNUNET_SCHEDULER_shutdown"
* to be run after the active task is complete. As a result, SIGTERM * to be run after the active task is complete. As a result, SIGTERM
* causes all active tasks to be scheduled with reason * causes all active tasks to be scheduled with reason
* "GNUNET_SCHEDULER_REASON_SHUTDOWN". (However, tasks added * "GNUNET_SCHEDULER_REASON_SHUTDOWN". (However, tasks added
* afterwards will execute normally!). Note that any particular * afterwards will execute normally!). Note that any particular
* signal will only shut down one scheduler; applications should * signal will only shut down one scheduler; applications should
* always only create a single scheduler. * always only create a single scheduler.
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 gnunet_server_lib.h   gnunet_server_lib.h 
skipping to change at line 152 skipping to change at line 152
* (typically, "port" already in use) * (typically, "port" already in use)
*/ */
struct GNUNET_SERVER_Handle * struct GNUNET_SERVER_Handle *
GNUNET_SERVER_create (GNUNET_CONNECTION_AccessCheck access, void *access_cl s, GNUNET_SERVER_create (GNUNET_CONNECTION_AccessCheck access, void *access_cl s,
struct sockaddr *const *serverAddr, struct sockaddr *const *serverAddr,
const socklen_t * socklen, const socklen_t * socklen,
struct GNUNET_TIME_Relative idle_timeout, struct GNUNET_TIME_Relative idle_timeout,
int require_found); int require_found);
/** /**
* Suspend accepting connections from the listen socket temporarily.
*
* @param server server to stop accepting connections.
*/
void
GNUNET_SERVER_suspend (struct GNUNET_SERVER_Handle *server);
/**
* Resume accepting connections from the listen socket.
*
* @param server server to stop accepting connections.
*/
void
GNUNET_SERVER_resume (struct GNUNET_SERVER_Handle *server);
/**
* Stop the listen socket and get ready to shutdown the server * Stop the listen socket and get ready to shutdown the server
* once only 'monitor' clients are left. * once only 'monitor' clients are left.
* *
* @param server server to stop listening on * @param server server to stop listening on
*/ */
void void
GNUNET_SERVER_stop_listening (struct GNUNET_SERVER_Handle *server); GNUNET_SERVER_stop_listening (struct GNUNET_SERVER_Handle *server);
/** /**
* Free resources held by this server. * Free resources held by this server.
 End of changes. 1 change blocks. 
0 lines changed or deleted 16 lines changed or added


 gnunet_stream_lib.h   gnunet_stream_lib.h 
skipping to change at line 88 skipping to change at line 88
/** /**
* Functions of this type will be called when a stream is established * Functions of this type will be called when a stream is established
* *
* @param cls the closure from GNUNET_STREAM_open * @param cls the closure from GNUNET_STREAM_open
* @param socket socket to use to communicate with the other side (read/wri te) * @param socket socket to use to communicate with the other side (read/wri te)
*/ */
typedef void (*GNUNET_STREAM_OpenCallback) (void *cls, typedef void (*GNUNET_STREAM_OpenCallback) (void *cls,
struct GNUNET_STREAM_Socket *soc ket); struct GNUNET_STREAM_Socket *soc ket);
/** /**
* Callback for signalling stream listen success; See
* GNUNET_STREAM_OPTION_SIGNAL_LISTEN_SUCCESS
*/
typedef void (*GNUNET_STREAM_ListenSuccessCallback) (void);
/**
* Options for the stream. * Options for the stream.
*/ */
enum GNUNET_STREAM_Option enum GNUNET_STREAM_Option
{ {
/** /**
* End of the option list. * End of the option list.
*/ */
GNUNET_STREAM_OPTION_END = 0, GNUNET_STREAM_OPTION_END = 0,
/** /**
* Option to set the initial retransmission timeout (when do we retrans mit * Option to set the initial retransmission timeout (when do we retrans mit
* a packet that did not yield an acknowledgement for the first time?). * a packet that did not yield an acknowledgement for the first time?).
* Repeated retransmissions will then use an exponential back-off. * Repeated retransmissions will then use an exponential back-off.
* Takes a 'struct GNUNET_TIME_Relative' as the only argument. A value * Takes a 'struct GNUNET_TIME_Relative' as the only argument. A value
* of '0' means to use the round-trip time (plus a tiny grace period); * of '0' means to use the round-trip time (plus a tiny grace period);
* this is also the default. * this is also the default.
*/ */
GNUNET_STREAM_OPTION_INITIAL_RETRANSMIT_TIMEOUT GNUNET_STREAM_OPTION_INITIAL_RETRANSMIT_TIMEOUT,
/**
* Option to set the write sequence number. Takes a uint32_t as paramet
er
* to set the value of the write sequence number
*/
GNUNET_STREAM_OPTION_TESTING_SET_WRITE_SEQUENCE_NUMBER,
/**
* Listen socket timeout in milliseconds given as uint32_t
*/
GNUNET_STREAM_OPTION_LISTEN_TIMEOUT,
/**
* Option to register a callback when stream listening is successfull.
Takes
* parameter of the form GNUNET_STREAM_ListenSuccessCallback. The callb
ack
* is only called if listening is successful
*/
GNUNET_STREAM_OPTION_SIGNAL_LISTEN_SUCCESS,
/**
* Option to set the maximum payload size in bytes of a stream data
* packets. Takes an uint16_t as argument. Note that this should be les
s
* than 64000 and cannot be zero. Default is 64000 bytes.
*/
GNUNET_STREAM_OPTION_MAX_PAYLOAD_SIZE
}; };
/** /**
* Tries to open a stream to the target peer * Tries to open a stream to the target peer
* *
* @param cfg configuration to use * @param cfg configuration to use
* @param target the target peer to which the stream has to be opened * @param target the target peer to which the stream has to be opened
* @param app_port the application port number which uniquely identifies th is * @param app_port the application port number which uniquely identifies th is
* stream * stream
* @param open_cb this function will be called after stream has be establis * @param open_cb this function will be called after stream has be establis
hed hed;
* cannot be NULL
* @param open_cb_cls the closure for open_cb * @param open_cb_cls the closure for open_cb
* @param ... options to the stream, terminated by GNUNET_STREAM_OPTION_END * @param ... options to the stream, terminated by GNUNET_STREAM_OPTION_END
* @return if successful it returns the stream socket; NULL if stream canno t be * @return if successful it returns the stream socket; NULL if stream canno t be
* opened * opened
*/ */
struct GNUNET_STREAM_Socket * struct GNUNET_STREAM_Socket *
GNUNET_STREAM_open (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_STREAM_open (const struct GNUNET_CONFIGURATION_Handle *cfg,
const struct GNUNET_PeerIdentity *target, const struct GNUNET_PeerIdentity *target,
GNUNET_MESH_ApplicationType app_port, GNUNET_MESH_ApplicationType app_port,
GNUNET_STREAM_OpenCallback open_cb, GNUNET_STREAM_OpenCallback open_cb,
skipping to change at line 179 skipping to change at line 211
* Closes the stream and frees the associated state. The stream should be * Closes the stream and frees the associated state. The stream should be
* shutdown before closing. * shutdown before closing.
* *
* @param socket the stream socket * @param socket the stream socket
*/ */
void void
GNUNET_STREAM_close (struct GNUNET_STREAM_Socket *socket); GNUNET_STREAM_close (struct GNUNET_STREAM_Socket *socket);
/** /**
* Functions of this type are called upon new stream connection from other peers * Functions of this type are called upon new stream connection from other peers
* or upon binding error which happen when the app_port given in
* GNUNET_STREAM_listen() is already taken.
* *
* @param cls the closure from GNUNET_STREAM_listen * @param cls the closure from GNUNET_STREAM_listen
* @param socket the socket representing the stream * @param socket the socket representing the stream; NULL on binding error
* @param initiator the identity of the peer who wants to establish a strea m * @param initiator the identity of the peer who wants to establish a strea m
* with us * with us; NULL on binding error
* @return GNUNET_OK to keep the socket open, GNUNET_SYSERR to close the * @return GNUNET_OK to keep the socket open, GNUNET_SYSERR to close the
* stream (the socket will be invalid after the call) * stream (the socket will be invalid after the call)
*/ */
typedef int (*GNUNET_STREAM_ListenCallback) (void *cls, typedef int (*GNUNET_STREAM_ListenCallback) (void *cls,
struct GNUNET_STREAM_Socket *s ocket, struct GNUNET_STREAM_Socket *s ocket,
const struct const struct
GNUNET_PeerIdentity *initiator ); GNUNET_PeerIdentity *initiator );
/** /**
* A socket for listening. * A socket for listening.
*/ */
struct GNUNET_STREAM_ListenSocket; struct GNUNET_STREAM_ListenSocket;
/** /**
* Listens for stream connections for a specific application ports * Listens for stream connections for a specific application ports
* *
* @param cfg the configuration to use * @param cfg the configuration to use
* @param app_port the application port for which new streams will be accep *
ted * @param app_port the application port for which new streams will be
* accepted. If another stream is listening on the same port the
* listen_cb will be called to signal binding error and the returne
d
* ListenSocket will be invalidated.
*
* @param listen_cb this function will be called when a peer tries to estab lish * @param listen_cb this function will be called when a peer tries to estab lish
* a stream with us * a stream with us
* @param listen_cb_cls closure for listen_cb * @param listen_cb_cls closure for listen_cb
* @param ... options to the stream, terminated by GNUNET_STREAM_OPTION_END
* @return listen socket, NULL for any error * @return listen socket, NULL for any error
*/ */
struct GNUNET_STREAM_ListenSocket * struct GNUNET_STREAM_ListenSocket *
GNUNET_STREAM_listen (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_STREAM_listen (const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_MESH_ApplicationType app_port, GNUNET_MESH_ApplicationType app_port,
GNUNET_STREAM_ListenCallback listen_cb, GNUNET_STREAM_ListenCallback listen_cb,
void *listen_cb_cls); void *listen_cb_cls,
...);
/** /**
* Closes the listen socket * Closes the listen socket
* *
* @param lsocket the listen socket * @param lsocket the listen socket
*/ */
void void
GNUNET_STREAM_listen_close (struct GNUNET_STREAM_ListenSocket *lsocket); GNUNET_STREAM_listen_close (struct GNUNET_STREAM_ListenSocket *lsocket);
/** /**
skipping to change at line 294 skipping to change at line 335
size_t size); size_t size);
/** /**
* Tries to read data from the stream. * Tries to read data from the stream.
* *
* @param socket the socket representing a stream * @param socket the socket representing a stream
* @param timeout the timeout period * @param timeout the timeout period
* @param proc function to call with data (once only) * @param proc function to call with data (once only)
* @param proc_cls the closure for proc * @param proc_cls the closure for proc
* *
* @return handle to cancel the operation; if the stream has been shutdown * @return handle to cancel the operation; NULL is returned if: the stream
for has
* this type of opeartion then the DataProcessor is immediately * been shutdown for this type of opeartion (the DataProcessor is
* called with GNUNET_STREAM_SHUTDOWN as status and NULL if retur * immediately called with GNUNET_STREAM_SHUTDOWN as status) OR a
ned nother
* read handle is present (only one read handle per socket is pre
sent
* at any time)
*/ */
struct GNUNET_STREAM_IOReadHandle * struct GNUNET_STREAM_IOReadHandle *
GNUNET_STREAM_read (struct GNUNET_STREAM_Socket *socket, GNUNET_STREAM_read (struct GNUNET_STREAM_Socket *socket,
struct GNUNET_TIME_Relative timeout, struct GNUNET_TIME_Relative timeout,
GNUNET_STREAM_DataProcessor proc, GNUNET_STREAM_DataProcessor proc,
void *proc_cls); void *proc_cls);
/** /**
* Cancels pending write operation. Also cancels packet retransmissions whi ch * Cancels pending write operation. Also cancels packet retransmissions whi ch
* may have resulted otherwise. * may have resulted otherwise.
 End of changes. 10 change blocks. 
13 lines changed or deleted 61 lines changed or added


 gnunet_strings_lib.h   gnunet_strings_lib.h 
/* /*
This file is part of GNUnet. This file is part of GNUnet.
(C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 Christian Grothoff (and other contributing authors) (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2012 Christian Gro thoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2, or (at your by the Free Software Foundation; either version 2, or (at your
option) any later version. option) any later version.
GNUnet is distributed in the hope that it will be useful, but GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. General Public License for more details.
skipping to change at line 76 skipping to change at line 76
* *
* @param fancy_time human readable string (i.e. 1 minute) * @param fancy_time human readable string (i.e. 1 minute)
* @param rtime set to the relative time * @param rtime set to the relative time
* @return GNUNET_OK on success, GNUNET_SYSERR on error * @return GNUNET_OK on success, GNUNET_SYSERR on error
*/ */
int int
GNUNET_STRINGS_fancy_time_to_relative (const char *fancy_time, GNUNET_STRINGS_fancy_time_to_relative (const char *fancy_time,
struct GNUNET_TIME_Relative *rtime); struct GNUNET_TIME_Relative *rtime);
/** /**
* Convert a given fancy human-readable time to our internal
* representation.
*
* @param fancy_time human readable string (i.e. %Y-%m-%d %H:%M:%S)
* @param atime set to the absolute time
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
int
GNUNET_STRINGS_fancy_time_to_absolute (const char *fancy_time,
struct GNUNET_TIME_Absolute *atime);
/**
* Convert a given filesize into a fancy human-readable format. * Convert a given filesize into a fancy human-readable format.
* *
* @param size number of bytes * @param size number of bytes
* @return fancy representation of the size (possibly rounded) for humans * @return fancy representation of the size (possibly rounded) for humans
*/ */
char * char *
GNUNET_STRINGS_byte_size_fancy (unsigned long long size); GNUNET_STRINGS_byte_size_fancy (unsigned long long size);
/** /**
* Convert the len characters long character sequence * Convert the len characters long character sequence
* given in input that is in the given input charset * given in input that is in the given input charset
* to a string in given output charset. * to a string in given output charset.
* @return the converted string (0-terminated), * @return the converted string (0-terminated),
* if conversion fails, a copy of the orignal * if conversion fails, a copy of the orignal
* string is returned. * string is returned.
*/ */
char * char *
GNUNET_STRINGS_conv (const char *input, size_t len, GNUNET_STRINGS_conv (const char *input, size_t len,
const char *input_charset, const char *output_charset); const char *input_charset,
const char *output_charset);
/** /**
* Convert the len characters long character sequence * Convert the len characters long character sequence
* given in input that is in the given charset * given in input that is in the given charset
* to UTF-8. * to UTF-8.
* *
* @param input the input string (not necessarily 0-terminated) * @param input the input string (not necessarily 0-terminated)
* @param len the number of bytes in the input * @param len the number of bytes in the input
* @param charset character set to convert from * @param charset character set to convert from
* @return the converted string (0-terminated) * @return the converted string (0-terminated)
*/ */
char * char *
GNUNET_STRINGS_to_utf8 (const char *input, size_t len, const char *charset) GNUNET_STRINGS_to_utf8 (const char *input,
; size_t len,
const char *charset);
/** /**
* Convert the len bytes-long UTF-8 string * Convert the len bytes-long UTF-8 string
* given in input to the given charset. * given in input to the given charset.
* @return the converted string (0-terminated), * @return the converted string (0-terminated),
* if conversion fails, a copy of the orignal * if conversion fails, a copy of the orignal
* string is returned. * string is returned.
*/ */
char * char *
GNUNET_STRINGS_from_utf8 (const char *input, size_t len, const char *charse GNUNET_STRINGS_from_utf8 (const char *input,
t); size_t len,
const char *charset);
/** /**
* Convert the utf-8 input string to lowercase * Convert the utf-8 input string to lowercase
* Output needs to be allocated appropriately * Output needs to be allocated appropriately
* *
* @param input input string * @param input input string
* @param output output buffer * @param output output buffer
*/ */
void void
GNUNET_STRINGS_utf8_tolower(const char* input, char** output); GNUNET_STRINGS_utf8_tolower (const char* input,
char** output);
/** /**
* Convert the utf-8 input string to lowercase * Convert the utf-8 input string to lowercase
* Output needs to be allocated appropriately * Output needs to be allocated appropriately
* *
* @param input input string * @param input input string
* @param output output buffer * @param output output buffer
*/ */
void void
GNUNET_STRINGS_utf8_toupper(const char* input, char** output); GNUNET_STRINGS_utf8_toupper (const char* input,
char** output);
/** /**
* Complete filename (a la shell) from abbrevition. * Complete filename (a la shell) from abbrevition.
* *
* @param fil the name of the file, may contain ~/ or * @param fil the name of the file, may contain ~/ or
* be relative to the current directory * be relative to the current directory
* @return the full file name, * @return the full file name,
* NULL is returned on error * NULL is returned on error
*/ */
char * char *
GNUNET_STRINGS_filename_expand (const char *fil); GNUNET_STRINGS_filename_expand (const char *fil);
/** /**
* Fill a buffer of the given size with * Fill a buffer of the given size with count 0-terminated strings
* count 0-terminated strings (given as varargs). * (given as varargs). If "buffer" is NULL, only compute the amount
* If "buffer" is NULL, only compute the amount of * of space required (sum of "strlen(arg)+1").
* space required (sum of "strlen(arg)+1"). *
* * Unlike using "snprintf" with "%s", this function will add
* Unlike using "snprintf" with "%s", this function * 0-terminators after each string. The
* will add 0-terminators after each string. The * "GNUNET_string_buffer_tokenize" function can be used to parse the
* "GNUNET_string_buffer_tokenize" function can be * buffer back into individual strings.
* used to parse the buffer back into individual
* strings.
* *
* @param buffer the buffer to fill with strings, can * @param buffer the buffer to fill with strings, can
* be NULL in which case only the necessary * be NULL in which case only the necessary
* amount of space will be calculated * amount of space will be calculated
* @param size number of bytes available in buffer * @param size number of bytes available in buffer
* @param count number of strings that follow * @param count number of strings that follow
* @param ... count 0-terminated strings to copy to buffer * @param ... count 0-terminated strings to copy to buffer
* @return number of bytes written to the buffer * @return number of bytes written to the buffer
* (or number of bytes that would have been written) * (or number of bytes that would have been written)
*/ */
size_t size_t
GNUNET_STRINGS_buffer_fill (char *buffer, size_t size, unsigned int count, GNUNET_STRINGS_buffer_fill (char *buffer,
...); size_t size,
unsigned int count,
...);
/** /**
* Given a buffer of a given size, find "count" * Given a buffer of a given size, find "count" 0-terminated strings
* 0-terminated strings in the buffer and assign * in the buffer and assign the count (varargs) of type "const char**"
* the count (varargs) of type "const char**" to the * to the locations of the respective strings in the buffer.
* locations of the respective strings in the
* buffer.
* *
* @param buffer the buffer to parse * @param buffer the buffer to parse
* @param size size of the buffer * @param size size of the buffer
* @param count number of strings to locate * @param count number of strings to locate
* @param ... pointers to where to store the strings * @param ... pointers to where to store the strings
* @return offset of the character after the last 0-termination * @return offset of the character after the last 0-termination
* in the buffer, or 0 on error. * in the buffer, or 0 on error.
*/ */
unsigned int unsigned int
GNUNET_STRINGS_buffer_tokenize (const char *buffer, size_t size, GNUNET_STRINGS_buffer_tokenize (const char *buffer, size_t size,
unsigned int count, ...); unsigned int count, ...);
/** /**
* "man ctime_r", except for GNUnet time; also, unlike ctime, the * "asctime", except for GNUnet time.
* return value does not include the newline character. * This is one of the very few calls in the entire API that is
* NOT reentrant!
* *
* @param t the absolute time to convert * @param t the absolute time to convert
* @return timestamp in human-readable form * @return timestamp in human-readable form
*/ */
char * const char *
GNUNET_STRINGS_absolute_time_to_string (struct GNUNET_TIME_Absolute t); GNUNET_STRINGS_absolute_time_to_string (struct GNUNET_TIME_Absolute t);
/** /**
* Give relative time in human-readable fancy format. * Give relative time in human-readable fancy format.
* This is one of the very few calls in the entire API that is
* NOT reentrant!
* *
* @param delta time in milli seconds * @param delta time in milli seconds
* @param do_round are we allowed to round a bit?
* @return string in human-readable form * @return string in human-readable form
*/ */
char * const char *
GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta); GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta,
int do_round);
/** /**
* "man basename" * "man basename"
* Returns a pointer to a part of filename (allocates nothing)! * Returns a pointer to a part of filename (allocates nothing)!
* *
* @param filename filename to extract basename from * @param filename filename to extract basename from
* @return short (base) name of the file (that is, everything following the * @return short (base) name of the file (that is, everything following the
* last directory separator in filename. If filename ends with a * last directory separator in filename. If filename ends with a
* directory separator, the result will be a zero-length string. * directory separator, the result will be a zero-length string.
* If filename has no directory separators, the result is filename * If filename has no directory separators, the result is filename
skipping to change at line 242 skipping to change at line 265
* it should be placed, if needed. * it should be placed, if needed.
* *
* @param data data to encode * @param data data to encode
* @param size size of data (in bytes) * @param size size of data (in bytes)
* @param out buffer to fill * @param out buffer to fill
* @param out_size size of the buffer. Must be large enough to hold * @param out_size size of the buffer. Must be large enough to hold
* ((size*8) + (((size*8) % 5) > 0 ? 5 - ((size*8) % 5) : 0)) / 5 * ((size*8) + (((size*8) % 5) > 0 ? 5 - ((size*8) % 5) : 0)) / 5
* @return pointer to the next byte in 'out' or NULL on error. * @return pointer to the next byte in 'out' or NULL on error.
*/ */
char * char *
GNUNET_STRINGS_data_to_string (const unsigned char *data, size_t size, GNUNET_STRINGS_data_to_string (const unsigned char *data,
char *out, size_t out_size); size_t size,
char *out,
size_t out_size);
/** /**
* Convert ASCII encoding back to data * Convert ASCII encoding back to data
* out_size must match exactly the size of the data before it was encoded. * out_size must match exactly the size of the data before it was encoded.
* *
* @param enc the encoding * @param enc the encoding
* @param enclen number of characters in 'enc' (without 0-terminator, which can be missing) * @param enclen number of characters in 'enc' (without 0-terminator, which can be missing)
* @param out location where to store the decoded data * @param out location where to store the decoded data
* @param out_size sizeof the output buffer * @param out_size sizeof the output buffer
* @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco ding * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco ding
*/ */
int int
GNUNET_STRINGS_string_to_data (const char *enc, size_t enclen, GNUNET_STRINGS_string_to_data (const char *enc,
unsigned char *out, size_t out_size); size_t enclen,
unsigned char *out,
#if 0 /* keep Emacsens' auto-indent happy */ size_t out_size);
{
#endif
#ifdef __cplusplus
}
#endif
enum GNUNET_STRINGS_FilenameCheck
{
GNUNET_STRINGS_CHECK_EXISTS = 0x00000001,
GNUNET_STRINGS_CHECK_IS_DIRECTORY = 0x00000002,
GNUNET_STRINGS_CHECK_IS_LINK = 0x00000004,
GNUNET_STRINGS_CHECK_IS_ABSOLUTE = 0x00000008
};
/** /**
* Parse a path that might be an URI. * Parse a path that might be an URI.
* *
* @param path path to parse. Must be NULL-terminated. * @param path path to parse. Must be NULL-terminated.
* @param scheme_part a pointer to 'char *' where a pointer to a string tha t * @param scheme_part a pointer to 'char *' where a pointer to a string tha t
* represents the URI scheme will be stored. Can be NULL. The string is * represents the URI scheme will be stored. Can be NULL. The string is
* allocated by the function, and should be freed by GNUNET_free() w hen * allocated by the function, and should be freed by GNUNET_free() w hen
* it is no longer needed. * it is no longer needed.
* @param path_part a pointer to 'const char *' where a pointer to the path * @param path_part a pointer to 'const char *' where a pointer to the path
* part of the URI will be stored. Can be NULL. Points to the same b lock * part of the URI will be stored. Can be NULL. Points to the same b lock
* of memory as 'path', and thus must not be freed. Might point to ' \0', * of memory as 'path', and thus must not be freed. Might point to ' \0',
* if path part is zero-length. * if path part is zero-length.
* @return GNUNET_YES if it's an URI, GNUNET_NO otherwise. If 'path' is not * @return GNUNET_YES if it's an URI, GNUNET_NO otherwise. If 'path' is not
* an URI, '* scheme_part' and '*path_part' will remain unchanged * an URI, '* scheme_part' and '*path_part' will remain unchanged
* (if they weren't NULL). * (if they weren't NULL).
*/ */
int int
GNUNET_STRINGS_parse_uri (const char *path, char **scheme_part, GNUNET_STRINGS_parse_uri (const char *path,
const char **path_part); char **scheme_part,
const char **path_part);
/** /**
* Check whether filename is absolute or not, and if it's an URI * Check whether filename is absolute or not, and if it's an URI
* *
* @param filename filename to check * @param filename filename to check
* @param can_be_uri GNUNET_YES to check for being URI, GNUNET_NO - to * @param can_be_uri GNUNET_YES to check for being URI, GNUNET_NO - to
* assume it's not URI * assume it's not URI
* @param r_is_uri a pointer to an int that is set to GNUNET_YES if 'filena me' * @param r_is_uri a pointer to an int that is set to GNUNET_YES if 'filena me'
* is URI and to GNUNET_NO otherwise. Can be NULL. If 'can_be_uri' i s * is URI and to GNUNET_NO otherwise. Can be NULL. If 'can_be_uri' i s
* not GNUNET_YES, *r_is_uri is set to GNUNET_NO. * not GNUNET_YES, *r_is_uri is set to GNUNET_NO.
skipping to change at line 315 skipping to change at line 328
* GNUNET_free (). Can be NULL. * GNUNET_free (). Can be NULL.
* @return GNUNET_YES if 'filename' is absolute, GNUNET_NO otherwise. * @return GNUNET_YES if 'filename' is absolute, GNUNET_NO otherwise.
*/ */
int int
GNUNET_STRINGS_path_is_absolute (const char *filename, GNUNET_STRINGS_path_is_absolute (const char *filename,
int can_be_uri, int can_be_uri,
int *r_is_uri, int *r_is_uri,
char **r_uri_scheme); char **r_uri_scheme);
/** /**
* Perform checks on 'filename; * Flags for what we should check a file for.
*/
enum GNUNET_STRINGS_FilenameCheck
{
/**
* Check that it exists.
*/
GNUNET_STRINGS_CHECK_EXISTS = 0x00000001,
/**
* Check that it is a directory.
*/
GNUNET_STRINGS_CHECK_IS_DIRECTORY = 0x00000002,
/**
* Check that it is a link.
*/
GNUNET_STRINGS_CHECK_IS_LINK = 0x00000004,
/**
* Check that the path is an absolute path.
*/
GNUNET_STRINGS_CHECK_IS_ABSOLUTE = 0x00000008
};
/**
* Perform checks on 'filename'. FIXME: some duplication with
* "GNUNET_DISK_"-APIs. We should unify those.
* *
* @param filename file to check * @param filename file to check
* @param checks checks to perform * @param checks checks to perform
* @return GNUNET_YES if all checks pass, GNUNET_NO if at least one of them * @return GNUNET_YES if all checks pass, GNUNET_NO if at least one of them
* fails, GNUNET_SYSERR when a check can't be performed * fails, GNUNET_SYSERR when a check can't be performed
*/ */
int int
GNUNET_STRINGS_check_filename (const char *filename, GNUNET_STRINGS_check_filename (const char *filename,
enum GNUNET_STRINGS_FilenameCheck checks); enum GNUNET_STRINGS_FilenameCheck checks);
skipping to change at line 373 skipping to change at line 413
* 0-terminator should not be counted towards addrlen). * 0-terminator should not be counted towards addrlen).
* @param r_buf a buffer to fill. * @param r_buf a buffer to fill.
* @return GNUNET_OK if conversion succeded. GNUNET_SYSERR otherwise, in wh ich * @return GNUNET_OK if conversion succeded. GNUNET_SYSERR otherwise, in wh ich
* case the contents of r_buf are undefined. * case the contents of r_buf are undefined.
*/ */
int int
GNUNET_STRINGS_to_address_ip (const char *addr, GNUNET_STRINGS_to_address_ip (const char *addr,
uint16_t addrlen, uint16_t addrlen,
struct sockaddr_storage *r_buf); struct sockaddr_storage *r_buf);
/**
* Returns utf-8 encoded arguments.
* Does nothing (returns a copy of argc and argv) on any platform
* other than W32.
* Returned argv has u8argv[u8argc] == NULL.
* Returned argv is a single memory block, and can be freed with a single
* GNUNET_free () call.
*
* @param argc argc (as given by main())
* @param argv argv (as given by main())
* @param u8argc a location to store new argc in (though it's th same as ar
gc)
* @param u8argv a location to store new argv in
* @return GNUNET_OK on success, GNUNET_SYSERR on failure
*/
int
GNUNET_STRINGS_get_utf8_args (int argc,
char *const *argv,
int *u8argc,
char *const **u8argv);
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
#ifdef __cplusplus
}
#endif
/* ifndef GNUNET_UTIL_STRING_H */ /* ifndef GNUNET_UTIL_STRING_H */
#endif #endif
/* end of gnunet_util_string.h */ /* end of gnunet_util_string.h */
 End of changes. 20 change blocks. 
52 lines changed or deleted 117 lines changed or added


 gnunet_testbed_service.h   gnunet_testbed_service.h 
skipping to change at line 32 skipping to change at line 32
* @file include/gnunet_testbed_service.h * @file include/gnunet_testbed_service.h
* @brief API for writing tests and creating large-scale * @brief API for writing tests and creating large-scale
* emulation testbeds for GNUnet. * emulation testbeds for GNUnet.
* @author Christian Grothoff * @author Christian Grothoff
*/ */
#ifndef GNUNET_TESTBED_SERVICE_H #ifndef GNUNET_TESTBED_SERVICE_H
#define GNUNET_TESTBED_SERVICE_H #define GNUNET_TESTBED_SERVICE_H
#include "gnunet_util_lib.h" #include "gnunet_util_lib.h"
#include "gnunet_testing_lib-new.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {
#if 0 /* keep Emacsens' auto-indent happy */ #if 0 /* keep Emacsens' auto-indent happy */
} }
#endif #endif
#endif #endif
/** /**
skipping to change at line 60 skipping to change at line 61
* at a particular host. * at a particular host.
*/ */
struct GNUNET_TESTBED_Peer; struct GNUNET_TESTBED_Peer;
/** /**
* Opaque handle to an abstract operation to be executed by the testbed fra mework. * Opaque handle to an abstract operation to be executed by the testbed fra mework.
*/ */
struct GNUNET_TESTBED_Operation; struct GNUNET_TESTBED_Operation;
/** /**
* Handle to interact with a GNUnet testbed controller. Each controller ha * Handle to interact with a GNUnet testbed controller. Each
s at * controller has at least one master handle which is created when the
* least one master handle which is created when the controller is created; * controller is created; this master handle interacts with the
this * controller process, destroying it destroys the controller (by
* master handle interacts with the controller via stdin/stdout of the cont * closing stdin of the controller process). Additionally,
roller * controllers can interact with each other (in a P2P fashion); those
* process. Additionally, controllers can interact with each other (in a P * links are established via TCP/IP on the controller's service port.
2P
* fashion); those links are established via TCP/IP on the controller's ser
vice
* port.
*/ */
struct GNUNET_TESTBED_Controller; struct GNUNET_TESTBED_Controller;
/** /**
* Handle to a large-scale testbed that is managed at a high level. * Handle to a large-scale testbed that is managed at a high level.
*/ */
struct GNUNET_TESTBED_Testbed; struct GNUNET_TESTBED_Testbed;
/** /**
* Create a host to run peers and controllers on. * Create a host to run peers and controllers on.
* *
* @param hostname name of the host, use "NULL" for localhost * @param hostname name of the host, use "NULL" for localhost
* @param username username to use for the login; may be NULL * @param username username to use for the login; may be NULL
* @param port port number to use for ssh; use 0 to let ssh decide * @param port port number to use for ssh; use 0 to let ssh decide
* @return handle to the host, NULL on error * @return handle to the host, NULL on error
*/ */
struct GNUNET_TESTBED_Host * struct GNUNET_TESTBED_Host *
GNUNET_TESTBED_host_create (const char *hostname, GNUNET_TESTBED_host_create (const char *hostname,
const char *username, const char *username,
uint16_t port); uint16_t port);
/**
* Create a host to run peers and controllers on. This function is used
* if a peer learns about a host via IPC between controllers (and thus
* some higher-level controller has already determined the unique IDs).
*
* @param id global host ID assigned to the host; 0 is
* reserved to always mean 'localhost'
* @param hostname name of the host, use "NULL" for localhost
* @param username username to use for the login; may be NULL
* @param port port number to use for ssh; use 0 to let ssh decide
* @return handle to the host, NULL on error
*/
struct GNUNET_TESTBED_Host *
GNUNET_TESTBED_host_create_with_id (uint32_t id,
const char *hostname,
const char *username,
uint16_t port);
/** /**
* Load a set of hosts from a configuration file. * Load a set of hosts from a configuration file.
* *
* @param filename file with the host specification * @param filename file with the host specification
* @param hosts set to the hosts found in the file * @param hosts set to the hosts found in the file; caller must free this i
f
* number of hosts returned is greater than 0
* @return number of hosts returned in 'hosts', 0 on error * @return number of hosts returned in 'hosts', 0 on error
*/ */
unsigned int unsigned int
GNUNET_TESTBED_hosts_load_from_file (const char *filename, GNUNET_TESTBED_hosts_load_from_file (const char *filename,
struct GNUNET_TESTBED_Host **hosts); struct GNUNET_TESTBED_Host ***hosts);
/** /**
* Destroy a host handle. Must only be called once everything * Destroy a host handle. Must only be called once everything
* running on that host has been stopped. * running on that host has been stopped.
* *
* @param host handle to destroy * @param host handle to destroy
*/ */
void void
GNUNET_TESTBED_host_destroy (struct GNUNET_TESTBED_Host *host); GNUNET_TESTBED_host_destroy (struct GNUNET_TESTBED_Host *host);
/** /**
* Checks whether a host can be used to start testbed service
*
* @param host the host to check
* @param config the configuration handle to lookup the path of the testbed
helper
* @return GNUNET_YES if testbed service can be started on the given host
* remotely; GNUNET_NO if not
*/
int
GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host,
const struct GNUNET_CONFIGURATION_Handle
*config);
/**
* Obtain the host's hostname.
*
* @param host handle to the host, NULL means 'localhost'
* @return hostname of the host
*/
const char *
GNUNET_TESTBED_host_get_hostname (const struct GNUNET_TESTBED_Host *host);
/**
* Enumeration with (at most 64) possible event types that * Enumeration with (at most 64) possible event types that
* can be monitored using the testbed framework. * can be monitored using the testbed framework.
*/ */
enum GNUNET_TESTBED_EventType enum GNUNET_TESTBED_EventType
{ {
/** /**
* A peer has been started. * A peer has been started.
*/ */
GNUNET_TESTBED_ET_PEER_START = 0, GNUNET_TESTBED_ET_PEER_START = 0,
skipping to change at line 160 skipping to change at line 202
/** /**
* Special value (not valid for requesting information) * Special value (not valid for requesting information)
* that is used in the event struct if a 'generic' pointer * that is used in the event struct if a 'generic' pointer
* is returned (for other operations not related to this * is returned (for other operations not related to this
* enumeration). * enumeration).
*/ */
GNUNET_TESTBED_PIT_GENERIC = 0, GNUNET_TESTBED_PIT_GENERIC = 0,
/** /**
* What host is the peer running on? Returns a 'const struct
* GNUNET_TESTBED_Host *'. Valid until
* 'GNUNET_TESTBED_operation_done' is called.
*/
GNUNET_TESTBED_PIT_HOST,
/**
* What configuration is the peer using? Returns a 'const struct * What configuration is the peer using? Returns a 'const struct
* GNUNET_CONFIGURATION_Handle *'. Valid until * GNUNET_CONFIGURATION_Handle *'. Valid until
* 'GNUNET_TESTNIG_operation_done' is called. However, the * 'GNUNET_TESTNIG_operation_done' is called. However, the
* values may be inaccurate if the peer is reconfigured in * values may be inaccurate if the peer is reconfigured in
* the meantime. * the meantime.
*/ */
GNUNET_TESTBED_PIT_CONFIGURATION, GNUNET_TESTBED_PIT_CONFIGURATION,
/** /**
* What is the identity of the peer? Returns a * What is the identity of the peer? Returns a
skipping to change at line 290 skipping to change at line 325
* requested. * requested.
*/ */
void *op_cls; void *op_cls;
/** /**
* Error message for the operation, NULL on success. * Error message for the operation, NULL on success.
*/ */
const char *emsg; const char *emsg;
/** /**
* Peer information type; captures which of the types * No result (NULL pointer) or generic result
* in the 'op_result' is actually in use. * (whatever the GNUNET_TESTBED_ConnectAdapter returned).
*/ */
enum GNUNET_TESTBED_PeerInformationType pit; void *generic;
/**
* Pointer to an operation-specific return value; NULL on error;
* can be NULL for certain operations. Valid until
* 'GNUNET_TESTBED_operation_done' is called.
*/
union
{
/**
* No result (NULL pointer) or generic result
* (whatever the GNUNET_TESTBED_ConnectAdapter returned).
*/
void *generic;
/**
* Identity of host running the peer.
*/
struct GNUNET_TESTBED_Host *host;
/**
* Identity of the peer.
*/
const struct GNUNET_PeerIdentity *pid;
/**
* Configuration of the peer.
*/
const struct GNUNET_CONFIGURATION_Handle *cfg;
} op_result;
} operation_finished; } operation_finished;
/** /**
* Details about an testbed run completed event. * Details about an testbed run completed event.
*/ */
struct struct
{ {
/** /**
skipping to change at line 365 skipping to change at line 370
}; };
/** /**
* Signature of the event handler function called by the * Signature of the event handler function called by the
* respective event controller. * respective event controller.
* *
* @param cls closure * @param cls closure
* @param event information about the event * @param event information about the event
*/ */
typedef void (*GNUNET_TESTBED_ControllerCallback)(void *cls, typedef void (*GNUNET_TESTBED_ControllerCallback)(void *cls,
const struct GNUNET_TESTBE const struct GNUNET_TESTB
D_EventInformation *event); ED_EventInformation *event);
/**
* Opaque Handle for Controller process
*/
struct GNUNET_TESTBED_ControllerProc;
/**
* Callback to signal successfull startup of the controller process
*
* @param cls the closure from GNUNET_TESTBED_controller_start()
* @param cfg the configuration with which the controller has been started;
* NULL if status is not GNUNET_OK
* @param status GNUNET_OK if the startup is successfull; GNUNET_SYSERR if
not,
* GNUNET_TESTBED_controller_stop() shouldn't be called in this ca
se
*/
typedef void (*GNUNET_TESTBED_ControllerStatusCallback) (void *cls,
const struct GNUNET
_CONFIGURATION_Handle *cfg,
int status);
/** /**
* Start a controller process using the given configuration at the * Starts a controller process at the host.
*
* @param controller_ip the ip address of the controller. Will be set as TR
USTED
* host when starting testbed controller at host
* @param host the host where the controller has to be started; NULL for
* localhost
* @param cfg template configuration to use for the remote controller; the
* remote controller will be started with a slightly modified
* configuration (port numbers, unix domain sockets and service ho
me
* values are changed as per TESTING library on the remote host)
* @param cb function called when the controller is successfully started or
* dies unexpectedly; GNUNET_TESTBED_controller_stop shouldn't be
* called if cb is called with GNUNET_SYSERR as status. Will never
be
* called in the same task as 'GNUNET_TESTBED_controller_start'
* (synchronous errors will be signalled by returning NULL). This
* parameter cannot be NULL.
* @param cls closure for above callbacks
* @return the controller process handle, NULL on errors
*/
struct GNUNET_TESTBED_ControllerProc *
GNUNET_TESTBED_controller_start (const char *controller_ip,
struct GNUNET_TESTBED_Host *host,
const struct GNUNET_CONFIGURATION_Handle *
cfg,
GNUNET_TESTBED_ControllerStatusCallback cb
,
void *cls);
/**
* Stop the controller process (also will terminate all peers and controlle
rs
* dependent on this controller). This function blocks until the testbed h
as
* been fully terminated (!). The controller status cb from
* GNUNET_TESTBED_controller_start() will not be called.
*
* @param cproc the controller process handle
*/
void
GNUNET_TESTBED_controller_stop (struct GNUNET_TESTBED_ControllerProc *cproc
);
/**
* Connect to a controller process using the given configuration at the
* given host. * given host.
* *
* @param cfg configuration to use * @param cfg configuration to use
* @param host host to run the controller on, NULL for 'localhost' * @param host host to run the controller on; This should be the same host
if
* the controller was previously started with
* GNUNET_TESTBED_controller_start; NULL for localhost
* @param host host where this controller is being run;
* @param event_mask bit mask with set of events to call 'cc' for; * @param event_mask bit mask with set of events to call 'cc' for;
* or-ed values of "1LL" shifted by the * or-ed values of "1LL" shifted by the
* respective 'enum GNUNET_TESTBED_EventType' * respective 'enum GNUNET_TESTBED_EventType'
* (i.e. "(1LL << GNUNET_TESTBED_ET_CONNECT) | ...") * (i.e. "(1LL << GNUNET_TESTBED_ET_CONNECT) | ...")
* @param cc controller callback to invoke on events * @param cc controller callback to invoke on events
* @param cc_cls closure for cc * @param cc_cls closure for cc
* @return handle to the controller * @return handle to the controller
*/ */
struct GNUNET_TESTBED_Controller * struct GNUNET_TESTBED_Controller *
GNUNET_TESTBED_controller_start (const struct GNUNET_CONFIGURATION_Handle * GNUNET_TESTBED_controller_connect (const struct GNUNET_CONFIGURATION_Handle
cfg, *cfg,
struct GNUNET_TESTBED_Host *host, struct GNUNET_TESTBED_Host *host,
uint64_t event_mask, uint64_t event_mask,
GNUNET_TESTBED_ControllerCallback cc, GNUNET_TESTBED_ControllerCallback cc,
void *cc_cls); void *cc_cls);
/** /**
* Configure shared services at a controller. Using this function, * Configure shared services at a controller. Using this function,
* you can specify that certain services (such as "resolver") * you can specify that certain services (such as "resolver")
* should not be run for each peer but instead be shared * should not be run for each peer but instead be shared
* across N peers on the specified host. This function * across N peers on the specified host. This function
* must be called before any peers are created at the host. * must be called before any peers are created at the host.
* *
* @param controller controller to configure * @param controller controller to configure
* @param service_name name of the service to share * @param service_name name of the service to share
* @param num_peers number of peers that should share one instance * @param num_peers number of peers that should share one instance
* of the specified service (1 for no sharing is the default), * of the specified service (1 for no sharing is the default),
* use 0 to disable the service * use 0 to disable the service
*/ */
void void
GNUNET_TESTBED_controller_configure_sharing (struct GNUNET_TESTBED_Controll er *controller, GNUNET_TESTBED_controller_configure_sharing (struct GNUNET_TESTBED_Controll er *controller,
const char *service_name, const char *service_name,
uint32_t num_peers); uint32_t num_peers);
/** /**
* Stop the given controller (also will terminate all peers and * Stop the given controller (also will terminate all peers and
* controllers dependent on this controller). This function * controllers dependent on this controller). This function
* blocks until the testbed has been fully terminated (!). * blocks until the testbed has been fully terminated (!).
* *
* @param controller handle to controller to stop * @param controller handle to controller to stop
*/ */
void void
GNUNET_TESTBED_controller_stop (struct GNUNET_TESTBED_Controller *controlle GNUNET_TESTBED_controller_disconnect (struct GNUNET_TESTBED_Controller *con
r); troller);
/**
* Opaque handle for host registration
*/
struct GNUNET_TESTBED_HostRegistrationHandle;
/**
* Callback which will be called to after a host registration succeeded or
failed
*
* @param cls the closure
* @param emsg the error message; NULL if host registration is successful
*/
typedef void (* GNUNET_TESTBED_HostRegistrationCompletion) (void *cls,
const char *ems
g);
/**
* Register a host with the controller
*
* @param controller the controller handle
* @param host the host to register
* @param cc the completion callback to call to inform the status of
* registration. After calling this callback the registration hand
le
* will be invalid. Cannot be NULL
* @param cc_cls the closure for the cc
* @return handle to the host registration which can be used to cancel the
* registration; NULL if another registration handle is present a
nd
* is not cancelled
*/
struct GNUNET_TESTBED_HostRegistrationHandle *
GNUNET_TESTBED_register_host (struct GNUNET_TESTBED_Controller *controller,
struct GNUNET_TESTBED_Host *host,
GNUNET_TESTBED_HostRegistrationCompletion cc,
void *cc_cls);
/**
* Cancel the pending registration. Note that the registration message will
* already be queued to be sent to the service, cancellation has only the
* effect that the registration completion callback for the registration is
* never called and from our perspective the host is not registered until t
he
* completion callback is called.
*
* @param handle the registration handle to cancel
*/
void
GNUNET_TESTBED_cancel_registration (struct GNUNET_TESTBED_HostRegistrationH
andle
*handle);
/** /**
* Create a link from a 'master' controller to a slave controller. * Callback to be called when an operation is completed
* Whenever the master controller is asked to start a peer at the
* given 'delegated_host', it will delegate the request to the
* specified slave controller. Note that the slave controller runs at
* the 'slave_host', which may or may not be the same host as the
* 'delegated_host' (for hierarchical delegations). The configuration
* of the slave controller is given and to be used to either create
* the slave controller or to connect to an existing slave controller
* process. 'is_subordinate' specifies if the given slave controller
* should be started and managed by the master controller, or if the
* slave already has a master and this is just a secondary master that
* is also allowed to use the existing slave.
* *
* @param cls the callback closure from functions generating an operation
* @param op the operation that has been finished
* @param emsg error message in case the operation has failed; will be NULL
if
* operation has executed successfully.
*/
typedef void (*GNUNET_TESTBED_OperationCompletionCallback) (void *cls,
struct
GNUNET_TESTBED_
Operation
*op,
const char *ems
g);
/**
* Create a link from slave controller to delegated controller. Whenever th
e
* master controller is asked to start a peer at the delegated controller t
he
* request will be routed towards slave controller (if a route exists). The
* slave controller will then route it to the delegated controller. The
* configuration of the delegated controller is given and is used to either
* create the delegated controller or to connect to an existing controller.
Note
* that while starting the delegated controller the configuration will be
* modified to accommodate available free ports. the 'is_subordinate' spec
ifies
* if the given delegated controller should be started and managed by the s
lave
* controller, or if the delegated controller already has a master and the
slave
* controller connects to it as a non master controller. The success or fai
lure
* of this operation will be signalled through the
* GNUNET_TESTBED_ControllerCallback() with an event of type
* GNUNET_TESTBED_ET_OPERATION_FINISHED
*
* @param op_cls the operation closure for the event which is generated to
* signal success or failure of this operation
* @param master handle to the master controller who creates the associatio n * @param master handle to the master controller who creates the associatio n
* @param delegated_host requests to which host should be delegated * @param delegated_host requests to which host should be delegated; cannot
* @param slave_host which host is used to run the slave controller be NULL
* @param slave_host which host is used to run the slave controller; use NU
LL to
* make the master controller connect to the delegated host
* @param slave_cfg configuration to use for the slave controller * @param slave_cfg configuration to use for the slave controller
* @param is_subordinate GNUNET_YES if the slave should be started (and sto * @param is_subordinate GNUNET_YES if the controller at delegated_host sho
pped) uld
* by the master controller; GNUNET_NO if we are just * be started by the slave controller; GNUNET_NO if the slave
* allowed to use the slave via TCP/IP * controller has to connect to the already started delegated
* controller via TCP/IP
* @return the operation handle
*/ */
void struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_controller_link (struct GNUNET_TESTBED_Controller *master, GNUNET_TESTBED_controller_link (void *op_cls,
struct GNUNET_TESTBED_Host *delegated_host, struct GNUNET_TESTBED_Controller *master,
struct GNUNET_TESTBED_Host *slave_host, struct GNUNET_TESTBED_Host *delegated_host,
const struct GNUNET_CONFIGURATION_Handle *sl struct GNUNET_TESTBED_Host *slave_host,
ave_cfg, const struct GNUNET_CONFIGURATION_Handle
int is_subordinate); *slave_cfg,
int is_subordinate);
/**
* Same as the GNUNET_TESTBED_controller_link, however expects configuratio
n in
* serialized and compressed
*
* @param op_cls the operation closure for the event which is generated to
* signal success or failure of this operation
* @param master handle to the master controller who creates the associatio
n
* @param delegated_host requests to which host should be delegated; cannot
be NULL
* @param slave_host which host is used to run the slave controller; use NU
LL to
* make the master controller connect to the delegated host
* @param sxcfg serialized and compressed configuration
* @param sxcfg_size the size sxcfg
* @param scfg_size the size of uncompressed serialized configuration
* @param is_subordinate GNUNET_YES if the controller at delegated_host sho
uld
* be started by the slave controller; GNUNET_NO if the slave
* controller has to connect to the already started delegated
* controller via TCP/IP
* @return the operation handle
*/
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_controller_link_2 (void *op_cls,
struct GNUNET_TESTBED_Controller *master,
struct GNUNET_TESTBED_Host *delegated_hos
t,
struct GNUNET_TESTBED_Host *slave_host,
const char *sxcfg,
size_t sxcfg_size,
size_t scfg_size,
int is_subordinate);
/**
* Function to acquire the configuration of a running slave controller. The
* completion of the operation is signalled through the controller_cb from
* GNUNET_TESTBED_controller_connect(). If the operation is successful the
* handle to the configuration is available in the generic pointer of
* operation_finished field of struct GNUNET_TESTBED_EventInformation.
*
* @param op_cls the closure for the operation
* @param master the handle to master controller
* @param slave_host the host where the slave controller is running; the ha
ndle
* to the slave_host should remain valid until this operation is
* cancelled or marked as finished
* @return the operation handle; NULL if the slave_host is not registered a
t
* master
*/
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_get_slave_config (void *op_cls,
struct GNUNET_TESTBED_Controller *master,
struct GNUNET_TESTBED_Host *slave_host);
/**
* Functions of this signature are called when a peer has been successfully
* created
*
* @param cls the closure from GNUNET_TESTBED_peer_create()
* @param peer the handle for the created peer; NULL on any error during
* creation
* @param emsg NULL if peer is not NULL; else MAY contain the error descrip
tion
*/
typedef void (*GNUNET_TESTBED_PeerCreateCallback) (void *cls,
struct GNUNET_TESTBED_Pe
er *peer,
const char *emsg);
/** /**
* Create the given peer at the specified host using the given * Create the given peer at the specified host using the given
* controller. If the given controller is not running on the target * controller. If the given controller is not running on the target
* host, it should find or create a controller at the target host and * host, it should find or create a controller at the target host and
* delegate creating the peer. Explicit delegation paths can be setup * delegate creating the peer. Explicit delegation paths can be setup
* using 'GNUNET_TESTBED_controller_link'. If no explicit delegation * using 'GNUNET_TESTBED_controller_link'. If no explicit delegation
* path exists, a direct link with a subordinate controller is setup * path exists, a direct link with a subordinate controller is setup
* for the first delegated peer to a particular host; the subordinate * for the first delegated peer to a particular host; the subordinate
* controller is then destroyed once the last peer that was delegated * controller is then destroyed once the last peer that was delegated
skipping to change at line 468 skipping to change at line 663
* "GNUNET_TESTBED_peer_stop" to actually start/stop the peer's * "GNUNET_TESTBED_peer_stop" to actually start/stop the peer's
* processes. * processes.
* *
* Note that the given configuration will be adjusted by the * Note that the given configuration will be adjusted by the
* controller to avoid port/path conflicts with other peers. * controller to avoid port/path conflicts with other peers.
* The "final" configuration can be obtained using * The "final" configuration can be obtained using
* 'GNUNET_TESTBED_peer_get_information'. * 'GNUNET_TESTBED_peer_get_information'.
* *
* @param controller controller process to use * @param controller controller process to use
* @param host host to run the peer on * @param host host to run the peer on
* @param cfg configuration to use for the peer * @param cfg Template configuration to use for the peer. Should exist unti
* @return handle to the peer (actual startup will happen asynchronously) l
* operation is cancelled or GNUNET_TESTBED_operation_done() is ca
lled
* @param cb the callback to call when the peer has been created
* @param cls the closure to the above callback
* @return the operation handle
*/ */
struct GNUNET_TESTBED_Peer * struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_peer_create (struct GNUNET_TESTBED_Controller *controller, GNUNET_TESTBED_peer_create (struct GNUNET_TESTBED_Controller *controller,
struct GNUNET_TESTBED_Host *host, struct GNUNET_TESTBED_Host *host,
const struct GNUNET_CONFIGURATION_Handle *cfg); const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_TESTBED_PeerCreateCallback cb,
void *cls);
/**
* Functions of this signature are called when a peer has been successfully
* started or stopped.
*
* @param cls the closure from GNUNET_TESTBED_peer_start/stop()
* @param emsg NULL on success; otherwise an error description
*/
typedef void (*GNUNET_TESTBED_PeerChurnCallback) (void *cls,
const char *emsg);
/** /**
* Start the given peer. * Start the given peer.
* *
* @param op_cls the closure for this operation; will be set in
* event->details.operation_finished.op_cls when this operation fa
ils.
* @param peer peer to start * @param peer peer to start
* @param pcc function to call upon completion
* @param pcc_cls closure for 'pcc'
* @return handle to the operation * @return handle to the operation
*/ */
struct GNUNET_TESTBED_Operation * struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer); GNUNET_TESTBED_peer_start (void *op_cls,
struct GNUNET_TESTBED_Peer *peer,
GNUNET_TESTBED_PeerChurnCallback pcc,
void *pcc_cls);
/** /**
* Stop the given peer. The handle remains valid (use * Stop the given peer. The handle remains valid (use
* "GNUNET_TESTBED_peer_destroy" to fully clean up the * "GNUNET_TESTBED_peer_destroy" to fully clean up the
* state of the peer). * state of the peer).
* *
* @param peer peer to stop * @param peer peer to stop
* @param pcc function to call upon completion
* @param pcc_cls closure for 'pcc'
* @return handle to the operation * @return handle to the operation
*/ */
struct GNUNET_TESTBED_Operation * struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer); GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer,
GNUNET_TESTBED_PeerChurnCallback pcc,
void *pcc_cls);
/**
* Data returned from GNUNET_TESTBED_peer_get_information
*/
struct GNUNET_TESTBED_PeerInformation
{
/**
* Peer information type; captures which of the types
* in the 'op_result' is actually in use.
*/
enum GNUNET_TESTBED_PeerInformationType pit;
/**
* The result of the get information operation; Choose according to the p
it
*/
union
{
/**
* The configuration of the peer
*/
struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* The identity of the peer
*/
struct GNUNET_PeerIdentity *id;
} result;
};
/** /**
* Request information about a peer. * Callback to be called when the requested peer information is available
*
* @param cb_cls the closure from GNUNET_TETSBED_peer_get_information()
* @param op the operation this callback corresponds to
* @param pinfo the result; will be NULL if the operation has failed
* @param emsg error message if the operation has failed; will be NULL if t
he
* operation is successfull
*/
typedef void (*GNUNET_TESTBED_PeerInfoCallback) (void *cb_cls,
struct GNUNET_TESTBED_Oper
ation
*op,
const struct
GNUNET_TESTBED_PeerInforma
tion
*pinfo,
const char *emsg);
/**
* Request information about a peer. The controller callback will not be ca
lled
* with event type GNUNET_TESTBED_ET_OPERATION_FINISHED when result for thi
s
* operation is available. Instead, the GNUNET_TESTBED_PeerInfoCallback() w
ill
* be called.
* *
* @param peer peer to request information about * @param peer peer to request information about
* @param pit desired information * @param pit desired information
* @param cb the convenience callback to be called when results for this
* operation are available
* @param cb_cls the closure for the above callback
* @return handle to the operation * @return handle to the operation
*/ */
struct GNUNET_TESTBED_Operation * struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_peer_get_information (struct GNUNET_TESTBED_Peer *peer, GNUNET_TESTBED_peer_get_information (struct GNUNET_TESTBED_Peer *peer,
enum GNUNET_TESTBED_PeerInformationType enum GNUNET_TESTBED_PeerInformationTyp
pit); e
pit,
GNUNET_TESTBED_PeerInfoCallback cb,
void *cb_cls);
/** /**
* Change peer configuration. Must only be called while the * Change peer configuration. Must only be called while the
* peer is stopped. Ports and paths cannot be changed this * peer is stopped. Ports and paths cannot be changed this
* way. * way.
* *
* @param peer peer to change configuration for * @param peer peer to change configuration for
* @param cfg new configuration (differences to existing * @param cfg new configuration (differences to existing
* configuration only) * configuration only)
* @return handle to the operation * @return handle to the operation
*/ */
struct GNUNET_TESTBED_Operation * struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_peer_update_configuration (struct GNUNET_TESTBED_Peer *peer, GNUNET_TESTBED_peer_update_configuration (struct GNUNET_TESTBED_Peer *peer,
const struct GNUNET_CONFIGURATION_ Handle *cfg); const struct GNUNET_CONFIGURATION _Handle *cfg);
/** /**
* Destroy the given peer; the peer should have been * Destroy the given peer; the peer should have been
* stopped first (if it was started). * stopped first (if it was started).
* *
* @param peer peer to stop * @param peer peer to stop
* @return handle to the operation * @return handle to the operation
*/ */
struct GNUNET_TESTBED_Operation * struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_peer_destroy (struct GNUNET_TESTBED_Peer *peer); GNUNET_TESTBED_peer_destroy (struct GNUNET_TESTBED_Peer *peer);
skipping to change at line 572 skipping to change at line 847
* @param op_cls closure argument to give with the operation event * @param op_cls closure argument to give with the operation event
* @param p1 first peer * @param p1 first peer
* @param p2 second peer * @param p2 second peer
* @param co option to change * @param co option to change
* @param ap option-specific values * @param ap option-specific values
* @return handle to the operation, NULL if configuring the link at this * @return handle to the operation, NULL if configuring the link at this
* time is not allowed * time is not allowed
*/ */
struct GNUNET_TESTBED_Operation * struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_underlay_configure_link_va (void *op_cls, GNUNET_TESTBED_underlay_configure_link_va (void *op_cls,
struct GNUNET_TESTBED_Peer *p1, struct GNUNET_TESTBED_Peer *p1,
struct GNUNET_TESTBED_Peer *p2, struct GNUNET_TESTBED_Peer *p2,
enum GNUNET_TESTBED_ConnectOption enum GNUNET_TESTBED_ConnectOptio
co, n co,
va_list ap); va_list ap);
/** /**
* Manipulate the P2P underlay topology by configuring a link * Manipulate the P2P underlay topology by configuring a link
* between two peers. * between two peers.
* *
* @param op_cls closure argument to give with the operation event * @param op_cls closure argument to give with the operation event
* @param p1 first peer * @param p1 first peer
* @param p2 second peer * @param p2 second peer
* @param co option to change * @param co option to change
* @param ... option-specific values * @param ... option-specific values
* @return handle to the operation, NULL if configuring the link at this * @return handle to the operation, NULL if configuring the link at this
* time is not allowed * time is not allowed
*/ */
struct GNUNET_TESTBED_Operation * struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_underlay_configure_link (void *op_cls, GNUNET_TESTBED_underlay_configure_link (void *op_cls,
struct GNUNET_TESTBED_Peer *p1, struct GNUNET_TESTBED_Peer *p1,
struct GNUNET_TESTBED_Peer *p2, struct GNUNET_TESTBED_Peer *p2,
enum GNUNET_TESTBED_ConnectOption co enum GNUNET_TESTBED_ConnectOption c
, ...); o, ...);
/** /**
* Topologies supported for testbeds. * Topologies and topology options supported for testbeds. Options should a
lways
* end with GNUNET_TESTBED_TOPOLOGY_OPTION_END
*/ */
enum GNUNET_TESTBED_TopologyOption enum GNUNET_TESTBED_TopologyOption
{ {
/** /**
* A clique (everyone connected to everyone else). No options. * A clique (everyone connected to everyone else). No options. If there
are N
* peers this topology results in (N * (N -1)) connections.
*/ */
GNUNET_TESTBED_TOPOLOGY_CLIQUE, GNUNET_TESTBED_TOPOLOGY_CLIQUE,
/** /**
* Small-world network (2d torus plus random links). Followed * Small-world network (2d torus plus random links). Followed
* by the number of random links to add (unsigned int). * by the number of random links to add (unsigned int).
*/ */
GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD, GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD,
/** /**
skipping to change at line 628 skipping to change at line 905
* Ring topology. No options. * Ring topology. No options.
*/ */
GNUNET_TESTBED_TOPOLOGY_RING, GNUNET_TESTBED_TOPOLOGY_RING,
/** /**
* 2-d torus. No options. * 2-d torus. No options.
*/ */
GNUNET_TESTBED_TOPOLOGY_2D_TORUS, GNUNET_TESTBED_TOPOLOGY_2D_TORUS,
/** /**
* Random graph. Followed by the link density, that is the * Random graph. Followed by the number of random links to be establishe
* percentage of links present in relation to a clique d
* (float). * (unsigned int)
*/ */
GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI,
/** /**
* Certain percentage of peers are unable to communicate directly * Certain percentage of peers are unable to communicate directly
* replicating NAT conditions. Followed by the fraction of * replicating NAT conditions. Followed by the fraction of
* NAT'ed peers (float). * NAT'ed peers (float).
*/ */
GNUNET_TESTBED_TOPOLOGY_INTERNAT, GNUNET_TESTBED_TOPOLOGY_INTERNAT,
skipping to change at line 659 skipping to change at line 935
GNUNET_TESTBED_TOPOLOGY_LINE, GNUNET_TESTBED_TOPOLOGY_LINE,
/** /**
* All peers are disconnected. No options. * All peers are disconnected. No options.
*/ */
GNUNET_TESTBED_TOPOLOGY_NONE, GNUNET_TESTBED_TOPOLOGY_NONE,
/** /**
* Read a topology from a given file. Followed by the name of the file ( const char *). * Read a topology from a given file. Followed by the name of the file ( const char *).
*/ */
GNUNET_TESTBED_TOPOLOGY_FROM_FILE GNUNET_TESTBED_TOPOLOGY_FROM_FILE,
/**
* The options should always end with this
*/
GNUNET_TESTBED_TOPOLOGY_OPTION_END,
/* The following are not topologies but influence how the topology has to
be
setup. These options should follow the topology specific options (if
required by the chosen topology). Note that these should be given befo
re
GNUNET_TESTBED_TOPOLOGY_OPTION_END */
/**
* Disable automatic retrying for failed overlay connections. The default
is
* to always retry failed overlay connections. This parameter takes no op
tions.
*/
GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY
}; };
/** /**
* Configure overall network topology to have a particular shape. * Configure overall network topology to have a particular shape.
* *
* @param op_cls closure argument to give with the operation event * @param op_cls closure argument to give with the operation event
* @param num_peers number of peers in 'peers' * @param num_peers number of peers in 'peers'
* @param peers array of 'num_peers' with the peers to configure * @param peers array of 'num_peers' with the peers to configure
* @param topo desired underlay topology to use * @param topo desired underlay topology to use
* @param ap topology-specific options * @param ap topology-specific options
* @return handle to the operation, NULL if configuring the topology * @return handle to the operation, NULL if configuring the topology
* is not allowed at this time * is not allowed at this time
*/ */
struct GNUNET_TESTBED_Operation * struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_underlay_configure_topology_va (void *op_cls, GNUNET_TESTBED_underlay_configure_topology_va (void *op_cls,
unsigned int num_peers, unsigned int num_peers,
struct GNUNET_TESTBED_Peer ** struct GNUNET_TESTBED_Peer *
peers, *peers,
enum GNUNET_TESTBED_TopologyO enum GNUNET_TESTBED_Topology
ption topo, Option topo,
va_list ap); va_list ap);
/** /**
* Configure overall network topology to have a particular shape. * Configure overall network topology to have a particular shape.
* *
* @param op_cls closure argument to give with the operation event * @param op_cls closure argument to give with the operation event
* @param num_peers number of peers in 'peers' * @param num_peers number of peers in 'peers'
* @param peers array of 'num_peers' with the peers to configure * @param peers array of 'num_peers' with the peers to configure
* @param topo desired underlay topology to use * @param topo desired underlay topology to use
* @param ... topology-specific options * @param ... topology-specific options
* @return handle to the operation, NULL if configuring the topology * @return handle to the operation, NULL if configuring the topology
* is not allowed at this time * is not allowed at this time
*/ */
struct GNUNET_TESTBED_Operation * struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_underlay_configure_topology (void *op_cls, GNUNET_TESTBED_underlay_configure_topology (void *op_cls,
unsigned int num_peers, unsigned int num_peers,
struct GNUNET_TESTBED_Peer **pee struct GNUNET_TESTBED_Peer **pe
rs, ers,
enum GNUNET_TESTBED_TopologyOpti enum GNUNET_TESTBED_TopologyOpt
on topo, ion topo,
...); ...);
/** /**
* Both peers must have been started before calling this function. * Both peers must have been started before calling this function.
* This function then obtains a HELLO from 'p1', gives it to 'p2' * This function then obtains a HELLO from 'p1', gives it to 'p2'
* and asks 'p2' to connect to 'p1'. * and asks 'p2' to connect to 'p1'.
* *
* @param op_cls closure argument to give with the operation event * @param op_cls closure argument to give with the operation event
* @param cb the callback to call when this operation has finished
* @param cb_cls the closure for the above callback
* @param p1 first peer * @param p1 first peer
* @param p2 second peer * @param p2 second peer
* @return handle to the operation, NULL if connecting these two * @return handle to the operation, NULL if connecting these two
* peers is fundamentally not possible at this time (peers * peers is fundamentally not possible at this time (peers
* not running or underlay disallows) * not running or underlay disallows)
*/ */
struct GNUNET_TESTBED_Operation * struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_overlay_connect (void *op_cls, GNUNET_TESTBED_overlay_connect (void *op_cls,
struct GNUNET_TESTBED_Peer *p1, GNUNET_TESTBED_OperationCompletionCallback
struct GNUNET_TESTBED_Peer *p2); cb,
void *cb_cls,
struct GNUNET_TESTBED_Peer *p1,
struct GNUNET_TESTBED_Peer *p2);
/** /**
* All peers must have been started before calling this function. * All peers must have been started before calling this function.
* This function then connects the given peers in the P2P overlay * This function then connects the given peers in the P2P overlay
* using the given topology. * using the given topology.
* *
* @param op_cls closure argument to give with the operation event * @param op_cls closure argument to give with the operation event
* @param num_peers number of peers in 'peers' * @param num_peers number of peers in 'peers'
* @param peers array of 'num_peers' with the peers to configure * @param peers array of 'num_peers' with the peers to configure
* @param topo desired underlay topology to use * @param topo desired underlay topology to use
* @param va topology-specific options * @param va topology-specific options
* @return handle to the operation, NULL if connecting these * @return handle to the operation, NULL if connecting these
* peers is fundamentally not possible at this time (peers * peers is fundamentally not possible at this time (peers
* not running or underlay disallows) * not running or underlay disallows) or if num_peers is less than 2
*/ */
struct GNUNET_TESTBED_Operation * struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls, GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
unsigned int num_peers, unsigned int num_peers,
struct GNUNET_TESTBED_Peer *pe struct GNUNET_TESTBED_Peer **
ers, peers,
enum GNUNET_TESTBED_TopologyOp enum GNUNET_TESTBED_TopologyO
tion topo, ption topo,
va_list va); va_list va);
/** /**
* All peers must have been started before calling this function. * All peers must have been started before calling this function.
* This function then connects the given peers in the P2P overlay * This function then connects the given peers in the P2P overlay
* using the given topology. * using the given topology.
* *
* @param op_cls closure argument to give with the operation event * @param op_cls closure argument to give with the operation event
* @param num_peers number of peers in 'peers' * @param num_peers number of peers in 'peers'
* @param peers array of 'num_peers' with the peers to configure * @param peers array of 'num_peers' with the peers to configure
* @param topo desired underlay topology to use * @param topo desired underlay topology to use
* @param ... topology-specific options * @param ... topology-specific options
* @return handle to the operation, NULL if connecting these * @return handle to the operation, NULL if connecting these
* peers is fundamentally not possible at this time (peers * peers is fundamentally not possible at this time (peers
* not running or underlay disallows) * not running or underlay disallows) or if num_peers is less than 2
*/ */
struct GNUNET_TESTBED_Operation * struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_overlay_configure_topology (void *op_cls, GNUNET_TESTBED_overlay_configure_topology (void *op_cls,
unsigned int num_peers, unsigned int num_peers,
struct GNUNET_TESTBED_Peer *peers struct GNUNET_TESTBED_Peer **pee
, rs,
enum GNUNET_TESTBED_TopologyOptio enum GNUNET_TESTBED_TopologyOpti
n topo, on topo,
...); ...);
/** /**
* Ask the testbed controller to write the current overlay topology to * Ask the testbed controller to write the current overlay topology to
* a file. Naturally, the file will only contain a snapshot as the * a file. Naturally, the file will only contain a snapshot as the
* topology may evolve all the time. * topology may evolve all the time.
* FIXME: needs continuation!?
* *
* @param controller overlay controller to inspect * @param controller overlay controller to inspect
* @param filename name of the file the topology should * @param filename name of the file the topology should
* be written to. * be written to.
*/ */
void void
GNUNET_TESTBED_overlay_write_topology_to_file (struct GNUNET_TESTBED_Contro ller *controller, GNUNET_TESTBED_overlay_write_topology_to_file (struct GNUNET_TESTBED_Contro ller *controller,
const char *filename); const char *filename);
/** /**
* Adapter function called to establish a connection to * Adapter function called to establish a connection to
* a service. * a service.
* *
* @param cls closure * @param cls closure
* @param cfg configuration of the peer to connect to * @param cfg configuration of the peer to connect to; will be available un
til
* GNUNET_TESTBED_operation_done() is called on the operation retu
rned
* from GNUNET_TESTBED_service_connect()
* @return service handle to return in 'op_result', NULL on error * @return service handle to return in 'op_result', NULL on error
*/ */
typedef void * (*GNUNET_TESTBED_ConnectAdapter)(void *cls, typedef void * (*GNUNET_TESTBED_ConnectAdapter)(void *cls,
const struct GNUNET_CONFIGUR ATION_Handle *cfg); const struct GNUNET_CONFIGU RATION_Handle *cfg);
/** /**
* Adapter function called to destroy a connection to * Adapter function called to destroy a connection to
* a service. * a service.
* *
* @param cls closure * @param cls closure
* @param op_result service handle returned from the connect adapter * @param op_result service handle returned from the connect adapter
*/ */
typedef void (*GNUNET_TESTBED_DisconnectAdapter)(void *cls, typedef void (*GNUNET_TESTBED_DisconnectAdapter)(void *cls,
void *op_result); void *op_result);
/**
* Callback to be called when a service connect operation is completed
*
* @param cls the callback closure from functions generating an operation
* @param op the operation that has been finished
* @param ca_result the service handle returned from GNUNET_TESTBED_Connect
Adapter()
* @param emsg error message in case the operation has failed; will be NULL
if
* operation has executed successfully.
*/
typedef void (*GNUNET_TESTBED_ServiceConnectCompletionCallback) (void *cls,
struct
GNUNET_TES
TBED_Operation
*op,
void
*ca_result
,
const char
*emsg );
/** /**
* Connect to a service offered by the given peer. Will ensure that * Connect to a service offered by the given peer. Will ensure that
* the request is queued to not overwhelm our ability to create and * the request is queued to not overwhelm our ability to create and
* maintain connections with other systems. The actual service * maintain connections with other systems. The actual service
* handle is then returned via the 'op_result' member in the event * handle is then returned via the 'op_result' member in the event
* callback. The 'ca' callback is used to create the connection * callback. The 'ca' callback is used to create the connection
* when the time is right; the 'da' callback will be used to * when the time is right; the 'da' callback will be used to
* destroy the connection (upon 'GNUNET_TESTBED_operation_done'). * destroy the connection (upon 'GNUNET_TESTBED_operation_done').
* 'GNUNET_TESTBED_operation_cancel' can be used to abort this * 'GNUNET_TESTBED_operation_cancel' can be used to abort this
* operation until the event callback has been called. * operation until the event callback has been called.
* *
* @param op_cls closure to pass in operation event * @param op_cls closure to pass in operation event
* @param peer peer that runs the service * @param peer peer that runs the service
* @param service_name name of the service to connect to * @param service_name name of the service to connect to
* @param cb the callback to call when this operation finishes
* @param cb_cls closure for the above callback
* @param ca helper function to establish the connection * @param ca helper function to establish the connection
* @param da helper function to close the connection * @param da helper function to close the connection
* @param cada_cls closure for ca and da * @param cada_cls closure for ca and da
* @return handle for the operation * @return handle for the operation
*/ */
struct GNUNET_TESTBED_Operation * struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_service_connect (void *op_cls, GNUNET_TESTBED_service_connect (void *op_cls,
struct GNUNET_TESTBED_Peer *peer, struct GNUNET_TESTBED_Peer *peer,
const char *service_name, const char *service_name,
GNUNET_TESTBED_ConnectAdapter ca, GNUNET_TESTBED_ServiceConnectCompletionCall
GNUNET_TESTBED_DisconnectAdapter da, back cb,
void *cada_cls); void *cb_cls,
GNUNET_TESTBED_ConnectAdapter ca,
/** GNUNET_TESTBED_DisconnectAdapter da,
* Cancel a pending operation. Releases all resources void *cada_cls);
* of the operation and will ensure that no event
* is generated for the operation. Does NOT guarantee /**
* that the operation will be fully undone (or that * This function is used to signal that the event information (struct
* GNUNET_TESTBED_EventInformation) from an operation has been fully proces
sed
* i.e. if the event callback is ever called for this operation. If the eve
nt
* callback for this operation has not yet been called, calling this functi
on
* cancels the operation, frees its resources and ensures the no event is
* generated with respect to this operation. Note that however cancelling a
n
* operation does NOT guarantee that the operation will be fully undone (or
that
* nothing ever happened). * nothing ever happened).
* *
* @param operation operation to cancel * This function MUST be called for every operation to fully remove the
*/ * operation from the operation queue. After calling this function, if
void * operation is completed and its event information is of type
GNUNET_TESTBED_operation_cancel (struct GNUNET_TESTBED_Operation *operation * GNUNET_TESTBED_ET_OPERATION_FINISHED, the 'op_result' becomes invalid (!
); ).
/** * If the operation is generated from GNUNET_TESTBED_service_connect() then
* Signal that the information from an operation has been fully * calling this function on such as operation calls the disconnect adapter
* processed. This function MUST be called for each event if
* of type 'operation_finished' to fully remove the operation * the connect adapter was ever called.
* from the operation queue. After calling this function, the
* 'op_result' becomes invalid (!).
* *
* @param operation operation to signal completion for * @param operation operation to signal completion or cancellation
*/ */
void void
GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation); GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation);
/** /**
* Configure and run a testbed using the given * Configure and run a testbed using the given
* master controller on 'num_hosts' starting * master controller on 'num_hosts' starting
* 'num_peers' using the given peer configuration. * 'num_peers' using the given peer configuration.
* *
* @param controller master controller for the testbed * @param controller master controller for the testbed
skipping to change at line 861 skipping to change at line 1182
* use 'localhost' * use 'localhost'
* @param hosts list of hosts to use for the testbed * @param hosts list of hosts to use for the testbed
* @param num_peers number of peers to start * @param num_peers number of peers to start
* @param peer_cfg peer configuration template to use * @param peer_cfg peer configuration template to use
* @param underlay_topology underlay topology to create * @param underlay_topology underlay topology to create
* @param va topology-specific options * @param va topology-specific options
* @return handle to the testbed * @return handle to the testbed
*/ */
struct GNUNET_TESTBED_Testbed * struct GNUNET_TESTBED_Testbed *
GNUNET_TESTBED_create_va (struct GNUNET_TESTBED_Controller *controller, GNUNET_TESTBED_create_va (struct GNUNET_TESTBED_Controller *controller,
unsigned int num_hosts, unsigned int num_hosts,
struct GNUNET_TESTBED_Host **hosts, struct GNUNET_TESTBED_Host **hosts,
unsigned int num_peers, unsigned int num_peers,
const struct GNUNET_CONFIGURATION_Handle *peer_cfg const struct GNUNET_CONFIGURATION_Handle *peer_cf
, g,
enum GNUNET_TESTBED_TopologyOption underlay_topolo enum GNUNET_TESTBED_TopologyOption underlay_topol
gy, ogy,
va_list va); va_list va);
/** /**
* Configure and run a testbed using the given * Configure and run a testbed using the given
* master controller on 'num_hosts' starting * master controller on 'num_hosts' starting
* 'num_peers' using the given peer configuration. * 'num_peers' using the given peer configuration.
* *
* @param controller master controller for the testbed * @param controller master controller for the testbed
* (must not be destroyed until after the * (must not be destroyed until after the
* testbed is destroyed). * testbed is destroyed).
* @param num_hosts number of hosts in 'hosts', 0 to only * @param num_hosts number of hosts in 'hosts', 0 to only
* use 'localhost' * use 'localhost'
* @param hosts list of hosts to use for the testbed * @param hosts list of hosts to use for the testbed
* @param num_peers number of peers to start * @param num_peers number of peers to start
* @param peer_cfg peer configuration template to use * @param peer_cfg peer configuration template to use
* @param underlay_topology underlay topology to create * @param underlay_topology underlay topology to create
* @param ... topology-specific options * @param ... topology-specific options
*/ */
struct GNUNET_TESTBED_Testbed * struct GNUNET_TESTBED_Testbed *
GNUNET_TESTBED_create (struct GNUNET_TESTBED_Controller *controller, GNUNET_TESTBED_create (struct GNUNET_TESTBED_Controller *controller,
unsigned int num_hosts, unsigned int num_hosts,
struct GNUNET_TESTBED_Host **hosts, struct GNUNET_TESTBED_Host **hosts,
unsigned int num_peers, unsigned int num_peers,
const struct GNUNET_CONFIGURATION_Handle *peer_cfg, const struct GNUNET_CONFIGURATION_Handle *peer_cfg,
enum GNUNET_TESTBED_TopologyOption underlay_topology, enum GNUNET_TESTBED_TopologyOption underlay_topology
...); ,
...);
/** /**
* Destroy a testbed. Stops all running peers and then * Destroy a testbed. Stops all running peers and then
* destroys all peers. Does NOT destroy the master controller. * destroys all peers. Does NOT destroy the master controller.
* *
* @param testbed testbed to destroy * @param testbed testbed to destroy
*/ */
void void
GNUNET_TESTBED_destroy (struct GNUNET_TESTBED_Testbed *testbed); GNUNET_TESTBED_destroy (struct GNUNET_TESTBED_Testbed *testbed);
/** /**
* Callback function to process statistic values from all peers.
*
* @param cls closure
* @param peer the peer the statistic belong to
* @param subsystem name of subsystem that created the statistic
* @param name the name of the datum
* @param value the current value
* @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if
not
* @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
*/
typedef int (*GNUNET_TESTBED_StatisticsIterator) (void *cls,
const struct GNUNET_TESTB
ED_Peer *peer,
const char *subsystem,
const char *name,
uint64_t value,
int is_persistent);
/**
* Convenience method that iterates over all (running) peers
* and retrieves all statistics from each peer.
*
* @param num_peers number of peers to iterate over
* @param peers array of peers to iterate over
* @param proc processing function for each statistic retrieved
* @param cont continuation to call once call is completed(?)
* @param cls closure to pass to proc and cont
* @return operation handle to cancel the operation
*/
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_get_statistics (unsigned int num_peers,
struct GNUNET_TESTBED_Peer **peers,
GNUNET_TESTBED_StatisticsIterator proc,
GNUNET_TESTBED_OperationCompletionCallback c
ont,
void *cls);
/**
* Convenience method for running a testbed with * Convenience method for running a testbed with
* a single call. Underlay and overlay topology * a single call. Underlay and overlay topology
* are configured using the "UNDERLAY" and "OVERLAY" * are configured using the "UNDERLAY" and "OVERLAY"
* options in the "[testbed]" section of the configuration\ * options in the "[testbed]" section of the configuration\
* (with possible options given in "UNDERLAY_XXX" and/or * (with possible options given in "UNDERLAY_XXX" and/or
* "OVERLAY_XXX"). * "OVERLAY_XXX").
* *
* The testbed is to be terminated using a call to * The testbed is to be terminated using a call to
* "GNUNET_SCHEDULER_shutdown". * "GNUNET_SCHEDULER_shutdown".
* *
* @param host_filename name of the file with the 'hosts', NULL * @param host_filename name of the file with the 'hosts', NULL
* to run everything on 'localhost' * to run everything on 'localhost'
* @param cfg configuration to use (for testbed, controller and peers) * @param cfg configuration to use (for testbed, controller and peers)
* @param num_peers number of peers to start; FIXME: maybe put that ALSO in * @param num_peers number of peers to start; FIXME: maybe put that ALSO in
to cfg? to
* cfg?; should be greater than 0
* @param event_mask bit mask with set of events to call 'cc' for; * @param event_mask bit mask with set of events to call 'cc' for;
* or-ed values of "1LL" shifted by the * or-ed values of "1LL" shifted by the
* respective 'enum GNUNET_TESTBED_EventType' * respective 'enum GNUNET_TESTBED_EventType'
* (i.e. "(1LL << GNUNET_TESTBED_ET_CONNECT) || ...") * (i.e. "(1LL << GNUNET_TESTBED_ET_CONNECT) || ...")
* @param cc controller callback to invoke on events * @param cc controller callback to invoke on events; This callback is call
ed
* for all peer start events even if GNUNET_TESTBED_ET_PEER_START is
n't
* set in the event_mask as this is the only way get access to the
* handle of each peer
* @param cc_cls closure for cc * @param cc_cls closure for cc
* @param master task to run once the testbed is ready * @param master task to run once the testbed is ready
* @param master_cls closure for 'task'. * @param master_cls closure for 'task'.
*/ */
void void
GNUNET_TESTBED_run (const char *host_filename, GNUNET_TESTBED_run (const char *host_filename,
const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_CONFIGURATION_Handle *cfg,
unsigned int num_peers, unsigned int num_peers,
uint64_t event_mask, uint64_t event_mask,
GNUNET_TESTBED_ControllerCallback cc, GNUNET_TESTBED_ControllerCallback cc,
void *cc_cls, void *cc_cls,
GNUNET_SCHEDULER_Task master, GNUNET_SCHEDULER_Task master,
void *master_cls); void *master_cls);
/** /**
* Signature of a main function for a testcase. * Signature of a main function for a testcase.
* *
* @param cls closure * @param cls closure
* @param num_peers number of peers in 'peers' * @param num_peers number of peers in 'peers'
* @param peers handle to peers run in the testbed * @param peers handle to peers run in the testbed
*/ */
typedef void (*GNUNET_TESTBED_TestMaster)(void *cls, typedef void (*GNUNET_TESTBED_TestMaster)(void *cls,
unsigned int num_peers, unsigned int num_peers,
struct GNUNET_TESTBED_Peer **peers struct GNUNET_TESTBED_Peer **peer
); s);
/** /**
* Convenience method for running a "simple" test on the local system * Convenience method for running a "simple" test on the local system
* with a single call from 'main'. Underlay and overlay topology are * with a single call from 'main'. Underlay and overlay topology are
* configured using the "UNDERLAY" and "OVERLAY" options in the * configured using the "UNDERLAY" and "OVERLAY" options in the
* "[testbed]" section of the configuration (with possible options * "[testbed]" section of the configuration (with possible options
* given in "UNDERLAY_XXX" and/or "OVERLAY_XXX"). * given in "UNDERLAY_XXX" and/or "OVERLAY_XXX").
* *
* The test is to be terminated using a call to * The test is to be terminated using a call to
* "GNUNET_SCHEDULER_shutdown". If starting the test fails, * "GNUNET_SCHEDULER_shutdown". If starting the test fails,
* the program is stopped without 'master' ever being run. * the program is stopped without 'master' ever being run.
* *
* NOTE: this function should be called from 'main', NOT from * NOTE: this function should be called from 'main', NOT from
* within a GNUNET_SCHEDULER-loop. This function will initialze * within a GNUNET_SCHEDULER-loop. This function will initialze
* the scheduler loop, the testbed and then pass control to * the scheduler loop, the testbed and then pass control to
* 'master'. * 'master'.
* *
* @param testname name of the testcase (to configure logging, etc.) * @param testname name of the testcase (to configure logging, etc.)
* @param cfg_filename configuration filename to use * @param cfg_filename configuration filename to use
* (for testbed, controller and peers) * (for testbed, controller and peers)
* @param num_peers number of peers to start * @param num_peers number of peers to start; should be greter than 0
* @param event_mask bit mask with set of events to call 'cc' for;
* or-ed values of "1LL" shifted by the
* respective 'enum GNUNET_TESTBED_EventType'
* (i.e. "(1LL << GNUNET_TESTBED_ET_CONNECT) || ...")
* @param cc controller callback to invoke on events; This callback is call
ed
* for all peer start events even if GNUNET_TESTBED_ET_PEER_START is
n't
* set in the event_mask as this is the only way get access to the
* handle of each peer
* @param cc_cls closure for cc
* @param test_master task to run once the test is ready * @param test_master task to run once the test is ready
* @param test_master_cls closure for 'task'. * @param test_master_cls closure for 'task'.
*/ */
void void
GNUNET_TESTBED_test_run (const char *testname, GNUNET_TESTBED_test_run (const char *testname,
const char *cfg_filename, const char *cfg_filename,
unsigned int num_peers, unsigned int num_peers,
GNUNET_TESTBED_TestMaster test_master, uint64_t event_mask,
void *test_master_cls); GNUNET_TESTBED_ControllerCallback cc,
void *cc_cls,
GNUNET_TESTBED_TestMaster test_master,
void *test_master_cls);
#if 0 /* keep Emacsens' auto-indent happy */ #if 0 /* keep Emacsens' auto-indent happy */
{ {
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
 End of changes. 64 change blocks. 
208 lines changed or deleted 657 lines changed or added


 gnunet_testing_lib-new.h   gnunet_testing_lib-new.h 
skipping to change at line 47 skipping to change at line 47
#include "gnunet_statistics_service.h" #include "gnunet_statistics_service.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {
#if 0 /* keep Emacsens' auto-indent happy */ #if 0 /* keep Emacsens' auto-indent happy */
} }
#endif #endif
#endif #endif
#define GNUNET_TESTING_HOSTKEYFILESIZE 914
/** /**
* Handle for a system on which GNUnet peers are executed; * Handle for a system on which GNUnet peers are executed;
* a system is used for reserving unique paths and ports. * a system is used for reserving unique paths and ports.
*/ */
struct GNUNET_TESTING_System; struct GNUNET_TESTING_System;
/** /**
* Handle for a GNUnet peer controlled by testing. * Handle for a GNUnet peer controlled by testing.
*/ */
struct GNUNET_TESTING_Peer; struct GNUNET_TESTING_Peer;
/** /**
* Create a system handle. There must only be one system handle per operat
ing
* system. Uses a default range for allowed ports. Ports are still tested
for
* availability.
*
* @param testdir only the directory name without any path. This is used fo
r all
* service homes; the directory will be created in a temporary loc
ation
* depending on the underlying OS
* @param controller hostname of the controlling host, service configuratio
ns
* are modified to allow control connections from this host; can be
NULL
* @param hostname the hostname of the system we are using for testing; NUL
L for
* localhost
* @return handle to this system, NULL on error
*/
struct GNUNET_TESTING_System *
GNUNET_TESTING_system_create (const char *testdir,
const char *controller,
const char *hostname);
/**
* Create a system handle. There must only be one system * Create a system handle. There must only be one system
* handle per operating system. * handle per operating system. Use this function directly
* * if multiple system objects are created for the same host
* @param tmppath prefix path to use for all service homes * (only really useful when testing --- or to make the port
* range configureable).
*
* @param testdir only the directory name without any path. This is used fo
r
* all service homes; the directory will be created in a temporary
* location depending on the underlying OS
* @param controller hostname of the controlling host, * @param controller hostname of the controlling host,
* service configurations are modified to allow * service configurations are modified to allow
* control connections from this host; can be NULL * control connections from this host; can be NULL
* @param hostname the hostname of the system we are using for testing; NUL
L for
* localhost
* @param lowport lowest port number this system is allowed to allocate (in
clusive)
* @param highport highest port number this system is allowed to allocate (
exclusive)
* @return handle to this system, NULL on error * @return handle to this system, NULL on error
*/ */
struct GNUNET_TESTING_System * struct GNUNET_TESTING_System *
GNUNET_TESTING_system_create (const char *tmppath, GNUNET_TESTING_system_create_with_portrange (const char *testdir,
const char *controller); const char *controller,
const char *hostname,
uint16_t lowport,
uint16_t highport);
/** /**
* Free system resources. * Free system resources.
* *
* @param system system to be freed * @param system system to be freed
* @param remove_paths should the 'tmppath' and all subdirectories * @param remove_paths should the 'testdir' and all subdirectories
* be removed (clean up on shutdown)? * be removed (clean up on shutdown)?
*/ */
void void
GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system, GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system,
int remove_paths); int remove_paths);
/** /**
* Testing includes a number of pre-created hostkeys for faster peer
* startup. This function loads such keys into memory from a file.
*
* @param system the testing system handle
* @param filename the path of the hostkeys file
* @return GNUNET_OK on success; GNUNET_SYSERR on error
*/
int
GNUNET_TESTING_hostkeys_load (struct GNUNET_TESTING_System *system,
const char *filename);
/**
* Function to remove the loaded hostkeys
*
* @param system the testing system handle
*/
void
GNUNET_TESTING_hostkeys_unload (struct GNUNET_TESTING_System *system);
/**
* Testing includes a number of pre-created hostkeys for * Testing includes a number of pre-created hostkeys for
* faster peer startup. This function can be used to * faster peer startup. This function can be used to
* access the n-th key of those pre-created hostkeys; note * access the n-th key of those pre-created hostkeys; note
* that these keys are ONLY useful for testing and not * that these keys are ONLY useful for testing and not
* secure as the private keys are part of the public * secure as the private keys are part of the public
* GNUnet source code. * GNUnet source code.
* *
* This is primarily a helper function used internally * This is primarily a helper function used internally
* by 'GNUNET_TESTING_peer_configure'. * by 'GNUNET_TESTING_peer_configure'.
* *
* @param system the testing system handle * @param system the testing system handle
* @param key_number desired pre-created hostkey to obtain * @param key_number desired pre-created hostkey to obtain
* @param id set to the peer's identity (hash of the public * @param id set to the peer's identity (hash of the public
* key; if NULL, GNUNET_SYSERR is returned immediately * key; if NULL, GNUNET_SYSERR is returned immediately
* @return GNUNET_SYSERR on error (not enough keys) * @return NULL on error (not enough keys)
*/ */
int struct GNUNET_CRYPTO_RsaPrivateKey *
GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system, GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system,
uint32_t key_number, uint32_t key_number,
struct GNUNET_PeerIdentity *id); struct GNUNET_PeerIdentity *id);
/** /**
* Reserve a TCP or UDP port for a peer. * Reserve a TCP or UDP port for a peer.
* *
* @param system system to use for reservation tracking * @param system system to use for reservation tracking
* @param is_tcp GNUNET_YES for TCP ports, GNUNET_NO for UDP * @param is_tcp GNUNET_YES for TCP ports, GNUNET_NO for UDP
* @return 0 if no free port was available * @return 0 if no free port was available
skipping to change at line 150 skipping to change at line 163
* @param system system to use for reservation tracking * @param system system to use for reservation tracking
* @param is_tcp GNUNET_YES for TCP ports, GNUNET_NO for UDP * @param is_tcp GNUNET_YES for TCP ports, GNUNET_NO for UDP
* @param port reserved port to release * @param port reserved port to release
*/ */
void void
GNUNET_TESTING_release_port (struct GNUNET_TESTING_System *system, GNUNET_TESTING_release_port (struct GNUNET_TESTING_System *system,
int is_tcp, int is_tcp,
uint16_t port); uint16_t port);
/** /**
* Create a new configuration using the given configuration * Create a new configuration using the given configuration as a template;
* as a template; ports and paths will be modified to select * ports and paths will be modified to select available ports on the local
* available ports on the local system. If we run * system. The default configuration will be available in PATHS section und
er
* the option DEFAULTCONFIG after the call. SERVICE_HOME is also set in PAT
HS
* section to the temporary directory specific to this configuration. If we
run
* out of "*port" numbers, return SYSERR. * out of "*port" numbers, return SYSERR.
* *
* This is primarily a helper function used internally * This is primarily a helper function used internally
* by 'GNUNET_TESTING_peer_configure'. * by 'GNUNET_TESTING_peer_configure'.
* *
* @param system system to use to coordinate resource usage * @param system system to use to coordinate resource usage
* @param cfg template configuration to update * @param cfg template configuration to update
* @return GNUNET_OK on success, GNUNET_SYSERR on error - the configuration will * @return GNUNET_OK on success, GNUNET_SYSERR on error - the configuration will
* be incomplete and should not be used there upon * be incomplete and should not be used there upon
*/ */
skipping to change at line 177 skipping to change at line 192
/** /**
* Configure a GNUnet peer. GNUnet must be installed on the local * Configure a GNUnet peer. GNUnet must be installed on the local
* system and available in the PATH. * system and available in the PATH.
* *
* @param system system to use to coordinate resource usage * @param system system to use to coordinate resource usage
* @param cfg configuration to use; will be UPDATED (to reflect needed * @param cfg configuration to use; will be UPDATED (to reflect needed
* changes in port numbers and paths) * changes in port numbers and paths)
* @param key_number number of the hostkey to use for the peer * @param key_number number of the hostkey to use for the peer
* @param id identifier for the daemon, will be set, can be NULL * @param id identifier for the daemon, will be set, can be NULL
* @param emsg set to error message (set to NULL on success), can be NULL * @param emsg set to freshly allocated error message (set to NULL on succe
ss),
* can be NULL
* @return handle to the peer, NULL on error * @return handle to the peer, NULL on error
*/ */
struct GNUNET_TESTING_Peer * struct GNUNET_TESTING_Peer *
GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system, GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_CONFIGURATION_Handle *cfg,
uint32_t key_number, uint32_t key_number,
struct GNUNET_PeerIdentity *id, struct GNUNET_PeerIdentity *id,
char **emsg); char **emsg);
/** /**
* Obtain the peer identity from a peer handle.
*
* @param peer peer handle for which we want the peer's identity
* @param id identifier for the daemon, will be set
*/
void
GNUNET_TESTING_peer_get_identity (const struct GNUNET_TESTING_Peer *peer,
struct GNUNET_PeerIdentity *id);
/**
* Start the peer. * Start the peer.
* *
* @param peer peer to start * @param peer peer to start
* @return GNUNET_OK on success, GNUNET_SYSERR on error (i.e. peer already running) * @return GNUNET_OK on success, GNUNET_SYSERR on error (i.e. peer already running)
*/ */
int int
GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer); GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer);
/** /**
* Stop the peer. * Stop the peer.
skipping to change at line 221 skipping to change at line 247
*/ */
void void
GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer *peer); GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer *peer);
/** /**
* Signature of the 'main' function for a (single-peer) testcase that * Signature of the 'main' function for a (single-peer) testcase that
* is run using 'GNUNET_TESTING_peer_run'. * is run using 'GNUNET_TESTING_peer_run'.
* *
* @param cls closure * @param cls closure
* @param cfg configuration of the peer that was started * @param cfg configuration of the peer that was started
* @param peer identity of the peer that was created
*/ */
typedef void (*GNUNET_TESTING_TestMain)(void *cls, typedef void (*GNUNET_TESTING_TestMain)(void *cls,
const struct GNUNET_CONFIGURATION_Ha const struct GNUNET_CONFIGURATION_Ha
ndle *cfg); ndle *cfg,
struct GNUNET_TESTING_Peer *peer);
/** /**
* Start a single peer and run a test using the testing library. * Start a single peer and run a test using the testing library.
* Starts a peer using the given configuration and then invokes the * Starts a peer using the given configuration and then invokes the
* given callback. This function ALSO initializes the scheduler loop * given callback. This function ALSO initializes the scheduler loop
* and should thus be called directly from "main". The testcase * and should thus be called directly from "main". The testcase
* should self-terminate by invoking 'GNUNET_SCHEDULER_shutdown'. * should self-terminate by invoking 'GNUNET_SCHEDULER_shutdown'.
* *
* @param tmppath path for storing temporary data for the test * @param testdir only the directory name without any path. This is used fo
r
* all service homes; the directory will be created in a temporary
* location depending on the underlying OS
* @param cfgfilename name of the configuration file to use; * @param cfgfilename name of the configuration file to use;
* use NULL to only run with defaults * use NULL to only run with defaults
* @param tm main function of the testcase * @param tm main function of the testcase
* @param tm_cls closure for 'tm' * @param tm_cls closure for 'tm'
* @return 0 on success, 1 on error * @return 0 on success, 1 on error
*/ */
int int
GNUNET_TESTING_peer_run (const char *tmppath, GNUNET_TESTING_peer_run (const char *testdir,
const char *cfgfilename, const char *cfgfilename,
GNUNET_TESTING_TestMain tm, GNUNET_TESTING_TestMain tm,
void *tm_cls); void *tm_cls);
/** /**
* Start a single service (no ARM, except of course if the given * Start a single service (no ARM, except of course if the given
* service name is 'arm') and run a test using the testing library. * service name is 'arm') and run a test using the testing library.
* Starts a service using the given configuration and then invokes the * Starts a service using the given configuration and then invokes the
* given callback. This function ALSO initializes the scheduler loop * given callback. This function ALSO initializes the scheduler loop
* and should thus be called directly from "main". The testcase * and should thus be called directly from "main". The testcase
* should self-terminate by invoking 'GNUNET_SCHEDULER_shutdown'. * should self-terminate by invoking 'GNUNET_SCHEDULER_shutdown'.
* *
* This function is useful if the testcase is for a single service * This function is useful if the testcase is for a single service
* and if that service doesn't itself depend on other services. * and if that service doesn't itself depend on other services.
* *
* @param tmppath path for storing temporary data for the test * @param testdir only the directory name without any path. This is used fo
r
* all service homes; the directory will be created in a temporary
* location depending on the underlying OS
* @param service_name name of the service to run * @param service_name name of the service to run
* @param cfgfilename name of the configuration file to use; * @param cfgfilename name of the configuration file to use;
* use NULL to only run with defaults * use NULL to only run with defaults
* @param tm main function of the testcase * @param tm main function of the testcase
* @param tm_cls closure for 'tm' * @param tm_cls closure for 'tm'
* @return 0 on success, 1 on error * @return 0 on success, 1 on error
*/ */
int int
GNUNET_TESTING_service_run (const char *tmppath, GNUNET_TESTING_service_run (const char *testdir,
const char *service_name, const char *service_name,
const char *cfgfilename, const char *cfgfilename,
GNUNET_TESTING_TestMain tm, GNUNET_TESTING_TestMain tm,
void *tm_cls); void *tm_cls);
/**
* Sometimes we use the binary name to determine which specific
* test to run. In those cases, the string after the last "_"
* in 'argv[0]' specifies a string that determines the configuration
* file or plugin to use.
*
* This function returns the respective substring, taking care
* of issues such as binaries ending in '.exe' on W32.
*
* @param argv0 the name of the binary
* @return string between the last '_' and the '.exe' (or the end of the st
ring),
* NULL if argv0 has no '_'
*/
char *
GNUNET_TESTING_get_testname_from_underscore (const char *argv0);
#if 0 /* keep Emacsens' auto-indent happy */ #if 0 /* keep Emacsens' auto-indent happy */
{ {
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
 End of changes. 19 change blocks. 
38 lines changed or deleted 104 lines changed or added


 gnunet_time_lib.h   gnunet_time_lib.h 
skipping to change at line 152 skipping to change at line 152
*/ */
#define GNUNET_TIME_UNIT_FOREVER_REL GNUNET_TIME_relative_get_forever_ () #define GNUNET_TIME_UNIT_FOREVER_REL GNUNET_TIME_relative_get_forever_ ()
/** /**
* Constant used to specify "forever". This constant * Constant used to specify "forever". This constant
* will be treated specially in all time operations. * will be treated specially in all time operations.
*/ */
#define GNUNET_TIME_UNIT_FOREVER_ABS GNUNET_TIME_absolute_get_forever_ () #define GNUNET_TIME_UNIT_FOREVER_ABS GNUNET_TIME_absolute_get_forever_ ()
/** /**
* Threshold after which exponential backoff should not increase (15 m).
*/
#define GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD GNUNET_TIME_relative_
multiply (GNUNET_TIME_UNIT_MINUTES, 15)
/**
* Perform our standard exponential back-off calculation, starting at 1mst
* and then going by a factor of 2 up unto a maximum of 1s.
*
* @param r current backoff time, initially zero
*/
#define GNUNET_TIME_STD_BACKOFF(r) GNUNET_TIME_relative_min (GNUNET_TIME_ST
D_EXPONENTIAL_BACKOFF_THRESHOLD, \
GNUNET_TIME_relative_multiply (GNUNET_TIME_relative_max (GNUNET_TIME_UNI
T_MILLISECONDS, (r)), 2));
/**
* Return relative time of 0ms. * Return relative time of 0ms.
*/ */
struct GNUNET_TIME_Relative struct GNUNET_TIME_Relative
GNUNET_TIME_relative_get_zero_ (void); GNUNET_TIME_relative_get_zero_ (void);
/** /**
* Return absolute time of 0ms. * Return absolute time of 0ms.
*/ */
struct GNUNET_TIME_Absolute struct GNUNET_TIME_Absolute
GNUNET_TIME_absolute_get_zero_ (void); GNUNET_TIME_absolute_get_zero_ (void);
skipping to change at line 413 skipping to change at line 427
/** /**
* Convert relative time from network byte order. * Convert relative time from network byte order.
* *
* @param a time to convert * @param a time to convert
* @return converted time value * @return converted time value
*/ */
struct GNUNET_TIME_Absolute struct GNUNET_TIME_Absolute
GNUNET_TIME_absolute_ntoh (struct GNUNET_TIME_AbsoluteNBO a); GNUNET_TIME_absolute_ntoh (struct GNUNET_TIME_AbsoluteNBO a);
/** /**
* Convert a relative time to a string.
* NOT reentrant!
*
* @param time the time to print
*
* @return string form of the time (as milliseconds)
*/
const char *
GNUNET_TIME_relative_to_string (struct GNUNET_TIME_Relative time);
/**
* Set the timestamp offset for this instance. * Set the timestamp offset for this instance.
* *
* @param offset the offset to skew the locale time by * @param offset the offset to skew the locale time by
*/ */
void void
GNUNET_TIME_set_offset (long long offset); GNUNET_TIME_set_offset (long long offset);
#if 0 /* keep Emacsens' auto-indent happy */ #if 0 /* keep Emacsens' auto-indent happy */
{ {
#endif #endif
 End of changes. 2 change blocks. 
11 lines changed or deleted 17 lines changed or added


 gnunet_transport_plugin.h   gnunet_transport_plugin.h 
skipping to change at line 47 skipping to change at line 47
#include "gnunet_transport_service.h" #include "gnunet_transport_service.h"
/** /**
* Opaque pointer that plugins can use to distinguish specific * Opaque pointer that plugins can use to distinguish specific
* connections to a given peer. Typically used by stateful plugins to * connections to a given peer. Typically used by stateful plugins to
* allow the service to refer to specific streams instead of a more * allow the service to refer to specific streams instead of a more
* general notion of "some connection" to the given peer. This is * general notion of "some connection" to the given peer. This is
* useful since sometimes (i.e. for inbound TCP connections) a * useful since sometimes (i.e. for inbound TCP connections) a
* connection may not have an address that can be used for meaningful * connection may not have an address that can be used for meaningful
* distinction between sessions to the same peer. * distinction between sessions to the same peer.
*
* Each 'struct Session' MUST start with the 'struct GNUNET_PeerIdentity'
* of the peer the session is for (which will be used for some error
* checking by the ATS code).
*/ */
struct Session; struct Session;
/** /**
* Every 'struct Session' must begin with this header. * Every 'struct Session' must begin with this header.
*/ */
struct SessionHeader struct SessionHeader
{ {
/** /**
skipping to change at line 152 skipping to change at line 156
/** /**
* Function that will be called for each address the transport * Function that will be called for each address the transport
* is aware that it might be reachable under. * is aware that it might be reachable under.
* *
* @param cls closure * @param cls closure
* @param add_remove should the address added (YES) or removed (NO) from th e * @param add_remove should the address added (YES) or removed (NO) from th e
* set of valid addresses? * set of valid addresses?
* @param addr one of the addresses of the host * @param addr one of the addresses of the host
* the specific address format depends on the transport * the specific address format depends on the transport
* @param addrlen length of the address * @param addrlen length of the address
* @param dest_plugin plugin to use this address with
*/ */
typedef void (*GNUNET_TRANSPORT_AddressNotification) (void *cls, int add_re move, typedef void (*GNUNET_TRANSPORT_AddressNotification) (void *cls, int add_re move,
const void *addr, const void *addr,
size_t addrlen); size_t addrlen,
const char *dest_plug
in);
/** /**
* Function that will be called whenever the plugin receives data over * Function that will be called whenever the plugin receives data over
* the network and wants to determine how long it should wait until * the network and wants to determine how long it should wait until
* the next time it reads from the given peer. Note that some plugins * the next time it reads from the given peer. Note that some plugins
* (such as UDP) may not be able to wait (for a particular peer), so * (such as UDP) may not be able to wait (for a particular peer), so
* the waiting part is optional. Plugins that can wait should call * the waiting part is optional. Plugins that can wait should call
* this function, sleep the given amount of time, and call it again * this function, sleep the given amount of time, and call it again
* (with zero bytes read) UNTIL it returns zero and only then read. * (with zero bytes read) UNTIL it returns zero and only then read.
* *
skipping to change at line 184 skipping to change at line 190
cons t cons t
stru ct stru ct
GNUN ET_PeerIdentity GNUN ET_PeerIdentity
* pe er, * pe er,
size _t size _t
amou nt_recved); amou nt_recved);
/** /**
* Function that returns a HELLO message. * Function that returns a HELLO message.
*/ */
typedef const struct GNUNET_MessageHeader typedef const struct GNUNET_MessageHeader *
*(*GNUNET_TRANSPORT_GetHelloCallback) (void); (*GNUNET_TRANSPORT_GetHelloCallback) (void);
/** /**
* The transport service will pass a pointer to a struct * The transport service will pass a pointer to a struct
* of this type as the first and only argument to the * of this type as the first and only argument to the
* entry point of each transport plugin. * entry point of each transport plugin.
*/ */
struct GNUNET_TRANSPORT_PluginEnvironment struct GNUNET_TRANSPORT_PluginEnvironment
{ {
/** /**
* Configuration to use. * Configuration to use.
skipping to change at line 272 skipping to change at line 278
* about the disconnect event (so that the service won't try * about the disconnect event (so that the service won't try
* to transmit more messages, believing the connection still * to transmit more messages, believing the connection still
* exists...). * exists...).
* *
* @param cls closure * @param cls closure
* @param target who was the recipient of the message? * @param target who was the recipient of the message?
* @param result GNUNET_OK on success * @param result GNUNET_OK on success
* 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.
* @param size_payload bytes of payload from transport service in message
* @param size_on_wire bytes required on wire for transmission,
* 0 if result == GNUNET_SYSERR
*/ */
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,
size_t size_payload,
size_t size_on_wire)
;
/** /**
* 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.
skipping to change at line 424 skipping to change at line 436
typedef const char *(*GNUNET_TRANSPORT_AddressToString) (void *cls, typedef const char *(*GNUNET_TRANSPORT_AddressToString) (void *cls,
const void *addr, const void *addr,
size_t addrlen); size_t addrlen);
/** /**
* Function called to convert a string address to * Function called to convert a string address to
* a binary address. * a binary address.
* *
* @param cls closure ('struct Plugin*') * @param cls closure ('struct Plugin*')
* @param addr string address * @param addr string address
* @param addrlen length of the address * @param addrlen length of the address including \0 termination
* @param buf location to store the buffer * @param buf location to store the buffer
* If the function returns GNUNET_SYSERR, its contents are undefined . * If the function returns GNUNET_SYSERR, its contents are undefined .
* @param added length of created address * @param added length of created address
* @return GNUNET_OK on success, GNUNET_SYSERR on failure * @return GNUNET_OK on success, GNUNET_SYSERR on failure
*/ */
typedef int (*GNUNET_TRANSPORT_StringToAddress) (void *cls, typedef int (*GNUNET_TRANSPORT_StringToAddress) (void *cls,
const char *addr, const char *addr,
uint16_t addrlen, uint16_t addrlen,
void **buf, void **buf,
size_t *added); size_t *added);
 End of changes. 7 change blocks. 
5 lines changed or deleted 19 lines changed or added


 gnunet_transport_service.h   gnunet_transport_service.h 
skipping to change at line 159 skipping to change at line 159
*/ */
void void
GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle); GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle);
/** /**
* Ask the transport service to establish a connection to * Ask the transport service to establish a connection to
* the given peer. * the given peer.
* *
* @param handle connection to transport service * @param handle connection to transport service
* @param target who we should try to connect to * @param target who we should try to connect to
* @return GNUNET_OK if request can be scheduled
* GNUNET_NO please retry later because we are reconnecting
* GNUNET_SYSERR on failure
*/ */
void int
GNUNET_TRANSPORT_try_connect (struct GNUNET_TRANSPORT_Handle *handle, GNUNET_TRANSPORT_try_connect (struct GNUNET_TRANSPORT_Handle *handle,
const struct GNUNET_PeerIdentity *target); const struct GNUNET_PeerIdentity *target);
/** /**
* Opaque handle for a transmission-ready request. * Opaque handle for a transmission-ready request.
*/ */
struct GNUNET_TRANSPORT_TransmitHandle; struct GNUNET_TRANSPORT_TransmitHandle;
/** /**
* Check if we could queue a message of the given size for * Check if we could queue a message of the given size for
skipping to change at line 297 skipping to change at line 300
* *
* @param alc handle for the request to cancel * @param alc handle for the request to cancel
*/ */
void void
GNUNET_TRANSPORT_address_to_string_cancel (struct GNUNET_TRANSPORT_address_to_string_cancel (struct
GNUNET_TRANSPORT_AddressToString Context GNUNET_TRANSPORT_AddressToString Context
*alc); *alc);
/** /**
* Return all the known addresses for a specific peer or all peers. * Return all the known addresses for a specific peer or all peers.
* Returns continously all address if one_shot is set to GNUNET_NO * Returns continuously all address if one_shot is set to GNUNET_NO
* *
* CHANGE: Returns the address(es) that we are currently using for this * CHANGE: Returns the address(es) that we are currently using for this
* peer. Upon completion, the 'AddressLookUpCallback' is called one more * peer. Upon completion, the 'AddressLookUpCallback' is called one more
* time with 'NULL' for the address and the peer. After this, the operatio n must no * time with 'NULL' for the address and the peer. After this, the operatio n must no
* longer be explicitly cancelled. * longer be explicitly cancelled.
* *
* @param cfg configuration to use * @param cfg configuration to use
* @param peer peer identity to look up the addresses of, CHANGE: allow NUL L for all (connected) peers * @param peer peer identity to look up the addresses of, CHANGE: allow NUL L for all (connected) peers
* @param one_shot GNUNET_YES to return the current state and then end (wit h NULL+NULL), * @param one_shot GNUNET_YES to return the current state and then end (wit h NULL+NULL),
* GNUNET_NO to monitor the set of addresses used (continuo usly, must be explicitly canceled, NOT implemented yet!) * GNUNET_NO to monitor the set of addresses used (continuo usly, must be explicitly canceled, NOT implemented yet!)
 End of changes. 3 change blocks. 
2 lines changed or deleted 5 lines changed or added


 gnunet_vpn_service.h   gnunet_vpn_service.h 
skipping to change at line 96 skipping to change at line 96
* @param cb_cls closure for cb * @param cb_cls closure for cb
* @return handle to cancel the request (means the callback won't be * @return handle to cancel the request (means the callback won't be
* invoked anymore; the mapping may or may not be established * invoked anymore; the mapping may or may not be established
* anyway) * anyway)
*/ */
struct GNUNET_VPN_RedirectionRequest * struct GNUNET_VPN_RedirectionRequest *
GNUNET_VPN_redirect_to_peer (struct GNUNET_VPN_Handle *vh, GNUNET_VPN_redirect_to_peer (struct GNUNET_VPN_Handle *vh,
int result_af, int result_af,
uint8_t protocol, uint8_t protocol,
const struct GNUNET_PeerIdentity *peer, const struct GNUNET_PeerIdentity *peer,
const GNUNET_HashCode *serv, const struct GNUNET_HashCode *serv,
int nac, int nac,
struct GNUNET_TIME_Absolute expiration_time, struct GNUNET_TIME_Absolute expiration_time,
GNUNET_VPN_AllocationCallback cb, GNUNET_VPN_AllocationCallback cb,
void *cb_cls); void *cb_cls);
/** /**
* Tell the VPN that forwarding to the Internet via some exit node is * Tell the VPN that forwarding to the Internet via some exit node is
* requested. Note that both UDP and TCP traffic will be forwarded, * requested. Note that both UDP and TCP traffic will be forwarded,
* but possibly to different exit nodes. The VPN is to reserve a * but possibly to different exit nodes. The VPN is to reserve a
* particular IP for the redirection and return it. The VPN will * particular IP for the redirection and return it. The VPN will
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 platform.h   platform.h 
/* /*
This file is part of GNUnet. This file is part of GNUnet.
(C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 Christian Grothoff (and other contributing authors) (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2012 Christian Gro thoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2, or (at your by the Free Software Foundation; either version 2, or (at your
option) any later version. option) any later version.
GNUnet is distributed in the hope that it will be useful, but GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the along with GNUnet; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330, Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. Boston, MA 02111-1307, USA.
*/ */
/** /**
* @file include/platform.h * @file include/platform.h
* @brief plaform specifics * @brief plaform specific includes and defines
*
* @author Nils Durner * @author Nils Durner
* * @author Christian Grothoff
* This file should never be included by installed * This file should never be included by installed
* header files (thos starting with "gnunet_"). * header files (those starting with "gnunet_").
*/ */
#ifndef PLATFORM_H #ifndef PLATFORM_H
#define PLATFORM_H #define PLATFORM_H
#ifndef HAVE_USED_CONFIG_H #ifndef HAVE_USED_CONFIG_H
#define HAVE_USED_CONFIG_H #define HAVE_USED_CONFIG_H
#if HAVE_CONFIG_H #if HAVE_CONFIG_H
#include "gnunet_config.h" #include "gnunet_config.h"
#endif #endif
#endif #endif
skipping to change at line 53 skipping to change at line 51
#define GNUNET_SIGCHLD 17 #define GNUNET_SIGCHLD 17
#else #else
#define BREAKPOINT #define BREAKPOINT
#define GNUNET_SIGCHLD SIGCHLD #define GNUNET_SIGCHLD SIGCHLD
#endif #endif
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#define ALLOW_EXTRA_CHECKS GNUNET_NO #define ALLOW_EXTRA_CHECKS GNUNET_YES
/** /**
* For strptime (glibc2 needs this). * For strptime (glibc2 needs this).
*/ */
#ifndef _XOPEN_SOURCE #ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE #define _XOPEN_SOURCE
#endif #endif
#ifndef _REENTRANT #ifndef _REENTRANT
#define _REENTRANT #define _REENTRANT
skipping to change at line 114 skipping to change at line 112
#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> #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
#ifdef HAVE_MALLOC_H
#include <malloc.h> /* for mallinfo on GNU */
#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 */
#endif #endif
#include <fcntl.h> #include <fcntl.h>
#include <math.h> #include <math.h>
skipping to change at line 141 skipping to change at line 142
#if HAVE_SYS_TIME_H #if HAVE_SYS_TIME_H
#include <sys/time.h> #include <sys/time.h>
#else #else
#include <time.h> #include <time.h>
#endif #endif
#endif #endif
#ifdef SOMEBSD #ifdef SOMEBSD
#include <net/if.h> #include <net/if.h>
#endif #endif
#ifdef GNUNET_freeBSD #ifdef FREEBSD
#include <semaphore.h> #include <semaphore.h>
#endif #endif
#ifdef DARWIN #ifdef DARWIN
#include <dlfcn.h> #include <dlfcn.h>
#include <semaphore.h> #include <semaphore.h>
#include <net/if.h> #include <net/if.h>
#endif #endif
#ifdef LINUX #if defined(LINUX) || defined(GNU)
#include <net/if.h> #include <net/if.h>
#endif #endif
#ifdef SOLARIS #ifdef SOLARIS
#include <sys/sockio.h> #include <sys/sockio.h>
#include <sys/filio.h> #include <sys/filio.h>
#include <sys/loadavg.h> #include <sys/loadavg.h>
#include <semaphore.h> #include <semaphore.h>
#endif #endif
#if HAVE_UCRED_H #if HAVE_UCRED_H
#include <ucred.h> #include <ucred.h>
 End of changes. 9 change blocks. 
9 lines changed or deleted 10 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/