44 #define CLIENT_RETRY_TIMEOUT \ 45 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) 340 "Received bogus reply of type %u with %u bytes via cadet from peer %s\n",
348 "Received reply `%s' via cadet from peer %s\n",
369 "# replies received via cadet dropped"),
453 "Resetting cadet channel to %s\n",
497 "Timeout on cadet channel to %s\n",
546 "Sending query for %s via cadet to %s\n",
582 "Creating cadet channel to %s\n",
640 "Preparing to send query for %s via cadet to %s\n",
676 "Cancelled query for %s via cadet to %s\n",
710 "Timeout on cadet channel to %s\n",
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
static void window_change_cb(void *cls, const struct GNUNET_CADET_Channel *channel, int window_size)
Function called whenever an MQ-channel's transmission window size changes.
#define GNUNET_MESSAGE_TYPE_FS_CADET_REPLY
P2P answer for content (one FS to another via a cadet).
struct GNUNET_TIME_Absolute expiration
Expiration time for the block.
struct GNUNET_CONTAINER_MultiPeerMap * cadet_map
Map from peer identities to 'struct CadetHandles' with cadet channels to those peers.
Query from one peer, asking the other for CHK-data.
int found
Did we have a matching query?
static int check_reply(void *cls, const struct CadetReplyMessage *srm)
Functions with this signature are called whenever a complete reply is received.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_ntoh(struct GNUNET_TIME_AbsoluteNBO a)
Convert absolute time from network byte order.
#define GNUNET_TIME_UNIT_ZERO_ABS
Absolute time zero.
struct GSF_CadetRequest * GSF_cadet_query(const struct GNUNET_PeerIdentity *target, const struct GNUNET_HashCode *query, enum GNUNET_BLOCK_Type type, GSF_CadetReplyProcessor proc, void *proc_cls)
Look for a block by directly contacting a particular peer.
unsigned int GNUNET_CONTAINER_multihashmap_size(const struct GNUNET_CONTAINER_MultiHashMap *map)
Get the number of key-value pairs in the map.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
Any type of block, used as a wildcard when searching.
Opaque handle to the service.
GNUNET_BLOCK_Type
Blocks in the datastore and the datacache must have a unique type.
static void disconnect_cb(void *cls, const struct GNUNET_CADET_Channel *channel)
Function called by cadet when a client disconnects.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
Handle for a cadet to another peer.
#define GNUNET_TIME_UNIT_SECONDS
One second.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_FS_CADET_REPLY.
void GNUNET_MQ_env_set_options(struct GNUNET_MQ_Envelope *env, enum GNUNET_MQ_PriorityPreferences pp)
Set application-specific options for this envelope.
static int process_reply(void *cls, const struct GNUNET_HashCode *key, void *value)
Iterator called on each entry in a waiting map to process a result.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
static int move_to_pending(void *cls, const struct GNUNET_HashCode *key, void *value)
Iterator called on each entry in a waiting map to move it back to the pending list.
uint32_t type
Block type must be DBLOCK or IBLOCK.
struct GNUNET_STATISTICS_Handle * GSF_stats
Handle for reporting statistics.
int GNUNET_CONTAINER_multipeermap_remove(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, const void *value)
Remove the given key-value pair from the map.
shared data structures of gnunet-service-fs.c
Opaque handle to a channel.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static void handle_reply(void *cls, const struct CadetReplyMessage *srm)
Functions with this signature are called whenever a complete reply is received.
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
Internal representation of the hash map.
struct GNUNET_HashCode query
Query to transmit to the other peer.
int GNUNET_BLOCK_get_key(struct GNUNET_BLOCK_Context *ctx, enum GNUNET_BLOCK_Type type, const void *block, size_t block_size, struct GNUNET_HashCode *key)
Function called to obtain the key for a block.
static void reset_cadet_async(struct CadetHandle *mh)
We had a serious error, tear down and re-create cadet from scratch, but do so asynchronously.
const void * data
Reply payload.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Flag to indicate that high bandwidth is desired.
#define CLIENT_RETRY_TIMEOUT
After how long do we reset connections without replies?
static struct GNUNET_OS_Process * p
Helper process we started.
struct GNUNET_HashCode query
Query hash from CHK (hash of encrypted block).
void GNUNET_MQ_notify_sent(struct GNUNET_MQ_Envelope *ev, GNUNET_SCHEDULER_TaskCallback cb, void *cb_cls)
Call a callback once the envelope has been sent, that is, sending it can not be canceled anymore...
static char * value
Value of the record to add/remove.
int was_transmitted
Did we transmit this request already? GNUNET_YES if we are in the 'waiting_map', GNUNET_NO if we are ...
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
unsigned int GNUNET_MQ_get_length(struct GNUNET_MQ_Handle *mq)
Obtain the current length of the message queue.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
struct GSF_CadetRequest * next
DLL.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
struct GSF_CadetRequest * prev
DLL.
struct GNUNET_BLOCK_Context * GSF_block_ctx
Our block context.
static void reset_cadet_task(void *cls)
Task called when it is time to reset an cadet.
non-anonymous file-transfer
int GNUNET_CONTAINER_multihashmap_remove(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, const void *value)
Remove the given key-value pair from the map.
void * proc_cls
Closure for proc.
Closure for handle_reply().
Internal representation of the hash map.
struct GNUNET_PeerIdentity target
Which peer does this cadet go to?
static char * expiration
Credential TTL.
Message handler for a specific message type.
struct GNUNET_SCHEDULER_Task * timeout_task
Task to kill inactive cadets (we keep them around for a few seconds to give the application a chance ...
struct GNUNET_SCHEDULER_Task * reset_task
Task to reset cadets that had errors (asynchronously, as we may not be able to do it immediately duri...
There must only be one value per key; storing a value should fail if a value under the same key alrea...
Handle for a request that is going out via cadet API.
struct GNUNET_HashCode key
The key used in the DHT.
struct GNUNET_MQ_Envelope * env
struct GNUNET_TIME_AbsoluteNBO expiration
Expiration time for the block.
indexing for the file-sharing service
int GNUNET_CONTAINER_multihashmap_put(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
GSF_CadetReplyProcessor proc
Function to call with the result.
Allow multiple values with the same key.
Handle to a message queue.
int GNUNET_CONTAINER_multipeermap_put(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
The identity of the host (wraps the signing key of the peer).
void GNUNET_CADET_receive_done(struct GNUNET_CADET_Channel *channel)
Send an ack on the channel to confirm the processing of a message.
int GNUNET_CONTAINER_multihashmap_get_multiple(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map that match a particular key.
struct GNUNET_CADET_Channel * GNUNET_CADET_channel_create(struct GNUNET_CADET_Handle *h, void *channel_cls, const struct GNUNET_PeerIdentity *destination, const struct GNUNET_HashCode *port, GNUNET_CADET_WindowSizeEventHandler window_changes, GNUNET_CADET_DisconnectEventHandler disconnects, const struct GNUNET_MQ_MessageHandler *handlers)
Create a new channel towards a remote peer.
struct GNUNET_CADET_Channel * channel
Channel to the other peer.
struct GSF_CadetRequest * pending_head
Head of DLL of pending requests on this cadet.
struct GSF_CadetRequest * pending_tail
Tail of DLL of pending requests on this cadet.
static void reset_cadet(struct CadetHandle *mh)
We had a serious error, tear down and re-create cadet from scratch.
void * GNUNET_CONTAINER_multipeermap_get(const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key)
Given a key find a value in the map matching the key.
struct GNUNET_MQ_Handle * mq
#define GNUNET_MESSAGE_TYPE_FS_CADET_QUERY
P2P request for content (one FS to another via a cadet).
#define GNUNET_log(kind,...)
Entry in list of pending tasks.
Flag to indicate that out-of-order delivery is OK.
static void cadet_timeout(void *cls)
Task called when it is time to destroy an inactive cadet channel.
static int free_waiting_entry(void *cls, const struct GNUNET_HashCode *key, void *value)
Iterator called on each entry in a waiting map to call the 'proc' continuation and release associated...
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
#define GNUNET_APPLICATION_PORT_FS_BLOCK_TRANSFER
Transfer of blocks for non-anonymmous file-sharing.
Flag to indicate that CORKing is acceptable.
Time for absolute times used by GNUnet, in microseconds.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
uint32_t type
Block type must be DBLOCK or IBLOCK.
int GSF_cadet_release_clients(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Function called on each active cadets to shut them down.
static void transmit_pending(void *cls)
Transmit pending requests via the cadet.
struct GNUNET_CADET_Handle * cadet_handle
Cadet channel for creating outbound channels.
enum GNUNET_BLOCK_Type type
Type of the block.
struct CadetHandle * mh
Which cadet is this request associated with?
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
size_t data_size
Number of bytes in data.
Reply to a CadetQueryMessage.
void GNUNET_CADET_channel_destroy(struct GNUNET_CADET_Channel *channel)
Destroy an existing channel.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
struct GNUNET_CONTAINER_MultiHashMap * waiting_map
Map from query to struct GSF_CadetRequests waiting for a reply.
enum GNUNET_BLOCK_Type type
Desired type for the reply.
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
void(* GSF_CadetReplyProcessor)(void *cls, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute expiration, size_t data_size, const void *data)
Function called with a reply from the cadet.
void GSF_cadet_query_cancel(struct GSF_CadetRequest *sr)
Cancel an active request; must not be called after 'proc' was calld.
#define GNUNET_free(ptr)
Wrapper around free.
static struct CadetHandle * get_cadet(const struct GNUNET_PeerIdentity *target)
Get (or create) a cadet to talk to the given peer.
#define gettext_noop(String)
struct GNUNET_MQ_Handle * GNUNET_CADET_get_mq(const struct GNUNET_CADET_Channel *channel)
Obtain the message queue for a connected peer.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.