#!/bin/sh
find src/ -name "*.c" -exec indent {} \;
find src/ -name "*.h" -exec indent {} \;
+find src/ -name "*.c" -exec indent {} \;
+find src/ -name "*.h" -exec indent {} \;
+find src/ -name "*.c" -exec contrib/removetrailingwhitespace {} \;
+find src/ -name "*.h" -exec contrib/removetrailingwhitespace {} \;
if test -x "`which 'dos2unix'`"
then
find src/ -name "*.c" -exec dos2unix {} \;
time_t mtime;
/**
- * Process exponential backoff time
+ * Process exponential backoff time
*/
struct GNUNET_TIME_Relative backoff;
/**
- * Absolute time at which the process is scheduled to restart in case of death
+ * Absolute time at which the process is scheduled to restart in case of death
*/
struct GNUNET_TIME_Absolute restartAt;
/**
- * We are done with everything. Stop remaining
- * tasks, signal handler and the server.
+ * We are done with everything. Stop remaining
+ * tasks, signal handler and the server.
*/
static void
do_shutdown ()
/**
* Task triggered whenever we receive a SIGCHLD (child
- * process died).
+ * process died).
*
* @param cls closure, NULL if we need to self-restart
* @param tc context
* Start the specified service.
*
* @param client who is asking for this
- * @param servicename name of the service to start
+ * @param servicename name of the service to start
* @param lsocks -1 terminated list of listen sockets to pass (systemd style), or NULL
* @return GNUNET_OK on success
*/
/**
* Stop listening for connections to a service.
- *
+ *
* @param serviceName name of service to stop listening for
* @return GNUNET_OK if we stopped to listen, GNUNET_NO if we were
* not listening
* @file arm/gnunet-service-arm_interceptor.c
* @brief listen to incoming connections from clients to services,
* start services for which incoming an incoming connection occur,
- * and relay communication between the client and the service for
+ * and relay communication between the client and the service for
* that first incoming connection.
*
* @author Safey Abdel Halim
/**
* Put the default services represented by a space separated string into an array of strings
- *
+ *
* @param services space separated string of default services
*/
static void
/**
* Checks whether the serviceName is in the list of default services
- *
+ *
* @param serviceName string to check its existance in the list
* @return GNUNET_YES if the service is started by default
*/
/**
* Close forwarded connection (partial or full).
*
- * @param fc connection to close
+ * @param fc connection to close
* @param reason which direction to close
*/
static void
/**
* Read data from the client and then forward it to the service.
- *
+ *
* @param cls callback data, struct ForwardedConnection for the communication between client and service
- * @param tc context
+ * @param tc context
*/
static void
receiveFromClient (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
/**
* Receive service messages sent by the service and forward it to client
- *
+ *
* @param cls callback data, struct ForwardedConnection for the communication between client and service
* @param tc scheduler context
*/
/**
* Forward messages sent from service to client
- *
+ *
* @param cls callback data, struct ForwardedConnection for the communication between client and service
* @param tc context
*/
/**
* Receive service messages sent by the service and forward it to client
- *
+ *
* @param cls callback data, struct ForwardedConnection for the communication between client and service
* @param tc scheduler context
*/
/**
* Forward client message to service
- *
+ *
* @param cls callback data, struct ForwardedConnection for the communication between client and service
* @param tc scheduler context
*/
/**
* Read data from the client and then forward it to the service.
- *
+ *
* @param cls callback data, struct ForwardedConnection for the communication between client and service
- * @param tc context
+ * @param tc context
*/
static void
receiveFromClient (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
/**
* First connection has come to the listening socket associated with the service,
* create the service in order to relay the incoming connection to it
- *
+ *
* @param cls callback data, struct ServiceListeningInfo describing a listen socket
- * @param tc context
+ * @param tc context
*/
static void
acceptConnection (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
/**
* First connection has come to the listening socket associated with the service,
* create the service in order to relay the incoming connection to it
- *
+ *
* @param cls callback data, struct ServiceListeningInfo describing a listen socket
- * @param tc context
+ * @param tc context
*/
static void
acceptConnection (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
/**
* Creating a listening socket for each of the service's addresses and
* wait for the first incoming connection to it
- *
+ *
* @param sa address associated with the service
* @param addr_len length of sa
* @param serviceName the name of the service in question
/**
* Callback function, checks whether the current tokens are representing a service,
* gets its addresses and create listening socket for it.
- *
+ *
* @param cls callback data, not used
* @param section configuration section
* @param option configuration option
*
* @param cls pointer to counter
* @param key identity of the peer associated with the records
- * @param value a 'struct AllocationRecord'
+ * @param value a 'struct AllocationRecord'
* @return GNUNET_YES (continue iteration)
*/
static int
*
* @param cls 'struct SetBandwidthContext'
* @param key identity of the peer associated with the records
- * @param value a 'struct AllocationRecord'
+ * @param value a 'struct AllocationRecord'
* @return GNUNET_YES (continue iteration)
*/
static int
/* trivial strategy: pick first available address... */
asc->cb (asc->cb_cls, &asc->target, ar->plugin_name, ar->plugin_addr,
- ar->plugin_addr_len,
- ar->session,
+ ar->plugin_addr_len, ar->session,
GNUNET_BANDWIDTH_value_init (asc->atc->total_bps / 32), ar->ats,
ar->ats_count);
asc->cb = NULL;
*
* @param cls a new 'struct AllocationRecord'
* @param key identity of the peer associated with the records
- * @param value the old 'struct AllocationRecord'
- * @return GNUNET_YES if the records do not match,
+ * @param value the old 'struct AllocationRecord'
+ * @return GNUNET_YES if the records do not match,
* GNUNET_NO if the record do match and 'old' was updated
*/
static int
struct GNUNET_ATS_SuggestionContext *asc = value;
asc->cb (asc->cb_cls, &asc->target, ar->plugin_name, ar->plugin_addr,
- ar->plugin_addr_len,
- ar->session,
+ ar->plugin_addr_len, ar->session,
GNUNET_BANDWIDTH_value_init (asc->atc->total_bps / 32), ar->ats,
ar->ats_count);
GNUNET_ATS_suggest_address_cancel (asc);
/**
* Mingle hash with the mingle_number to produce different bits.
- *
+ *
* @param in original hash code
* @param mingle_number number for hash permutation
* @param hc where to store the result.
/**
* Function called to validate a reply or a request. For
* request evaluation, simply pass "NULL" for the reply_block.
- * Note that it is assumed that the reply has already been
+ * Note that it is assumed that the reply has already been
* matched to the key (and signatures checked) as it would
* be done with the "get_key" function.
*
/**
* Function called to validate a reply or a request. For
* request evaluation, simply pass "NULL" for the reply_block.
- * Note that it is assumed that the reply has already been
+ * Note that it is assumed that the reply has already been
* matched to the key (and signatures checked) as it would
* be done with the "get_key" function.
*
* @param room_name name of the room
* @param msg_options message options of the joining user
* @param joinCallback function to call on successful join
- * @param join_cls closure for joinCallback
+ * @param join_cls closure for joinCallback
* @param messageCallback which function to call if a message has
* been received?
* @param message_cls argument to callback
/**
* @file chat/gnunet-service-chat.c
- * @brief service providing chat functionality
+ * @brief service providing chat functionality
* @author Christian Grothoff
* @author Vitaly Minko
*/
/**
- * Core notifying client that it is allowed to now
+ * Core notifying client that it is allowed to now
* transmit a message to the given target
* (response to GNUNET_MESSAGE_TYPE_CORE_SEND_REQUEST).
*/
struct GNUNET_MessageHeader header;
/**
- * How many bytes are allowed for transmission?
+ * How many bytes are allowed for transmission?
* Guaranteed to be at least as big as the requested size,
- * or ZERO if the request is rejected (will timeout,
+ * or ZERO if the request is rejected (will timeout,
* peer disconnected, queue full, etc.).
*/
uint16_t size GNUNET_PACKED;
/**
* We generally do NOT keep peer records in a DLL; this
* DLL is only used IF this peer's 'pending_head' message
- * is ready for transmission.
+ * is ready for transmission.
*/
struct PeerRecord *prev;
/**
* We generally do NOT keep peer records in a DLL; this
* DLL is only used IF this peer's 'pending_head' message
- * is ready for transmission.
+ * is ready for transmission.
*/
struct PeerRecord *next;
/**
* ID of timeout task for the 'pending_head' handle
- * which is the one with the smallest timeout.
+ * which is the one with the smallest timeout.
*/
GNUNET_SCHEDULER_TaskIdentifier timeout_task;
* Entry in a doubly-linked list of control messages to be transmitted
* to the core service. Control messages include traffic allocation,
* connection requests and of course our initial 'init' request.
- *
+ *
* The actual message is allocated at the end of this struct.
*/
struct ControlMessage
struct PeerRecord *peer;
/**
- * Corresponding SEND_REQUEST message. Only non-NULL
+ * Corresponding SEND_REQUEST message. Only non-NULL
* while SEND_REQUEST message is pending.
*/
struct ControlMessage *cm;
/**
- * Notify clients about disconnect and free
+ * Notify clients about disconnect and free
* the entry for connected peer.
*
* @param cls the 'struct GNUNET_CORE_Handle*'
/**
- * Disconnect from the core service. This function can only
+ * Disconnect from the core service. This function can only
* be called *after* all pending 'GNUNET_CORE_notify_transmit_ready'
* requests have been explicitly canceled.
*
/**
* Cancel request for getting information about a peer.
* Note that an eventual change in preference, trust or bandwidth
- * assignment MAY have already been committed at the time,
+ * assignment MAY have already been committed at the time,
* so cancelling a request is NOT sure to undo the original
* request. The original request may or may not still commit.
* The only thing cancellation ensures is that the callback
/**
* After how much time past the "official" expiration time do
- * we discard messages? Should not be zero since we may
+ * we discard messages? Should not be zero since we may
* intentionally defer transmission until close to the deadline
* and then may be slightly past the deadline due to inaccuracy
* in sleep and our own CPU consumption.
/**
- * Record kept for each request for transmission issued by a
+ * Record kept for each request for transmission issued by a
* client that is still pending.
*/
struct ClientActiveRequest;
struct MessageEntry *encrypted_tail;
/**
- * Head of list of requests from clients for transmission to
+ * Head of list of requests from clients for transmission to
* this peer.
*/
struct ClientActiveRequest *active_client_request_head;
/**
- * Tail of list of requests from clients for transmission to
+ * Tail of list of requests from clients for transmission to
* this peer.
*/
struct ClientActiveRequest *active_client_request_tail;
/**
- * Record kept for each request for transmission issued by a
+ * Record kept for each request for transmission issued by a
* client that is still pending.
*/
struct ClientActiveRequest
/**
* Send a message to all of our current clients that have
* the right options set.
- *
+ *
* @param msg message to multicast
* @param can_drop can this message be discarded if the queue is too long
- * @param options mask to use
+ * @param options mask to use
*/
static void
send_to_all_clients (const struct GNUNET_MessageHeader *msg, int can_drop,
(n->status != PEER_STATE_KEY_CONFIRMED))
{
/* neighbour must have disconnected since request was issued,
- * ignore (client will realize it once it processes the
+ * ignore (client will realize it once it processes the
* disconnect notification) */
#if DEBUG_CORE_CLIENT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
else
{
/* Technically, this COULD happen (due to asynchronous behavior),
- * but it should be rare, so we should generate an info event
+ * but it should be rare, so we should generate an info event
* to help diagnosis of serious errors that might be masked by this */
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_
/**
- * Task triggered when a neighbour entry is about to time out
+ * Task triggered when a neighbour entry is about to time out
* (and we should prevent this by sending a PING).
*
* @param cls the 'struct Neighbour'
/**
* Function that recalculates the bandwidth quota for the
* given neighbour and transmits it to the transport service.
- *
+ *
* @param cls neighbour for the quota update
* @param tc context
*/
if ((n == NULL) || (GNUNET_YES != n->is_connected) ||
(n->status != PEER_STATE_KEY_CONFIRMED))
{
- /* attempt to send message to peer that is not connected anymore
+ /* attempt to send message to peer that is not connected anymore
* (can happen due to asynchrony) */
GNUNET_STATISTICS_update (stats,
gettext_noop
/**
* Function that recalculates the bandwidth quota for the
* given neighbour and transmits it to the transport service.
- *
+ *
* @param cls neighbour for the quota update
* @param tc context
*/
n->quota_update_task = GNUNET_SCHEDULER_NO_TASK;
/* calculate relative preference among all neighbours;
* divides by a bit more to avoid division by zero AND to
- * account for possibility of new neighbours joining any time
+ * account for possibility of new neighbours joining any time
* AND to convert to double... */
neighbour_count = GNUNET_CONTAINER_multihashmap_size (neighbours);
if (neighbour_count == 0)
/**
* Function called by plugins to notify the datacache
* about content deletions.
- *
+ *
* @param cls closure
* @param key key of the content that was deleted
* @param size number of bytes that were made available
/**
* Delete the entry with the lowest expiration value
* from the datacache right now.
- *
+ *
* @param cls closure (our "struct Plugin")
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
* Check if the result obtained from Postgres has
* the desired status code. If not, log an error, clear the
* result and return GNUNET_SYSERR.
- *
+ *
* @return GNUNET_OK if the result is acceptable
*/
static int
/**
* Delete the entry with the lowest expiration value
* from the datacache right now.
- *
+ *
* @param cls closure (our "struct Plugin")
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
/**
* Delete the entry with the lowest expiration value
* from the datacache right now.
- *
+ *
* @param cls closure (our "struct Plugin")
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
/**
* Delete the entry with the lowest expiration value
* from the datacache right now.
- *
+ *
* @param cls closure (our "struct Plugin")
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
{
/**
* Type is GNUNET_MESSAGE_TYPE_DATASTORE_GET. Size
- * can either be "sizeof(struct GetMessage)" or
+ * can either be "sizeof(struct GetMessage)" or
* "sizeof(struct GetMessage) - sizeof(GNUNET_HashCode)"!
*/
struct GNUNET_MessageHeader header;
/**
* If a client stopped asking for more results, how many more do
* we receive from the DB before killing the connection? Trade-off
- * between re-doing TCP handshakes and (needlessly) receiving
+ * between re-doing TCP handshakes and (needlessly) receiving
* useless results.
*/
#define MAX_EXCESS_RESULTS 8
/**
* Has this message been transmitted to the service?
* Only ever GNUNET_YES for the head of the queue.
- * Note that the overall struct should end at a
+ * Note that the overall struct should end at a
* multiple of 64 bits.
*/
int was_transmitted;
};
/**
- * Handle to the datastore service.
+ * Handle to the datastore service.
*/
struct GNUNET_DATASTORE_Handle
{
* @param timeout timeout for the operation
* @param response_proc function to call with replies (can be NULL)
* @param qc client context (NOT a closure for response_proc)
- * @return NULL if the queue is full
+ * @return NULL if the queue is full
*/
static struct GNUNET_DATASTORE_QueueEntry *
make_queue_entry (struct GNUNET_DATASTORE_Handle *h, size_t msize,
if ((pos->max_queue < h->queue_size) && (pos->was_transmitted == GNUNET_NO))
{
GNUNET_assert (pos->response_proc != NULL);
- /* move 'pos' element to head so that it will be
+ /* move 'pos' element to head so that it will be
* killed on 'NULL' call below */
#if DEBUG_DATASTORE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
/**
* Process entries in the queue (or do nothing if we are already
* doing so).
- *
+ *
* @param h handle to the datastore
*/
static void
/**
* Process entries in the queue (or do nothing if we are already
* doing so).
- *
+ *
* @param h handle to the datastore
*/
static void
* Dummy continuation used to do nothing (but be non-zero).
*
* @param cls closure
- * @param result result
+ * @param result result
* @param emsg error message
*/
static void
* Free a queue entry. Removes the given entry from the
* queue and releases associated resources. Does NOT
* call the callback.
- *
+ *
* @param qe entry to free.
*/
static void
/**
* Cancel a datastore operation. The final callback from the
* operation must not have been done yet.
- *
+ *
* @param qe operation to cancel
*/
void
/**
- * Synchronize our utilization statistics with the
+ * Synchronize our utilization statistics with the
* statistics service.
*/
static void
* maybe 0 if no unique identifier is available
*
* @return GNUNET_OK usually
- * GNUNET_NO to delete the item
+ * GNUNET_NO to delete the item
*/
static int
check_present (void *cls, const GNUNET_HashCode * key, uint32_t size,
* change in their disk utilization.
*
* @param cls closure (NULL)
- * @param delta change in disk utilization,
+ * @param delta change in disk utilization,
* 0 for "reset to empty"
*/
static void
* change in their disk utilization.
*
* @param cls closure (NULL)
- * @param delta change in disk utilization,
+ * @param delta change in disk utilization,
* 0 for "reset to empty"
*/
static void
/**
* Close database connection and all prepared statements (we got a DB
* disconnect error).
- *
+ *
* @param plugin plugin context
*/
static int
* Get one of the results for a particular key in the datastore.
*
* @param cls closure
- * @param offset offset of the result (modulo num-results);
+ * @param offset offset of the result (modulo num-results);
* specific ordering does not matter for the offset
* @param key key to match, never NULL
* @param vhash hash of the value, maybe NULL (to
* there may be!
* @param type entries of which type are relevant?
* Use 0 for any type.
- * @param proc function to call on the matching value,
+ * @param proc function to call on the matching value,
* with NULL for if no value matches
* @param proc_cls closure for proc
*/
* Check if the result obtained from Postgres has
* the desired status code. If not, log an error, clear the
* result and return GNUNET_SYSERR.
- *
+ *
* @param plugin global context
* @param ret result to check
* @param expected_status expected return value
* in the datastore.
*
* @param cls closure
- * @param offset offset of the result (modulo num-results);
+ * @param offset offset of the result (modulo num-results);
* specific ordering does not matter for the offset
* @param key maybe NULL (to match all entries)
* @param vhash hash of the value, maybe NULL (to
/**
* Get a random item for replication. Returns a single, not expired, random item
- * from those with the highest replication counters. The item's
+ * from those with the highest replication counters. The item's
* replication counter is decremented by one IF it was positive before.
* Call 'proc' with all values ZERO or NULL if the datastore is empty.
*
/*
* This file is part of GNUnet
* (C) 2009, 2011 Christian Grothoff (and other contributing authors)
- *
+ *
* GNUnet is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 3, or (at your
* option) any later version.
- *
+ *
* GNUnet is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNUnet; see the file COPYING. If not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
/**
* Create our database indices.
- *
+ *
* @param dbh handle to the database
*/
static void
* the given processor for the item.
*
* @param cls our plugin context
- * @param offset offset of the result (modulo num-results);
+ * @param offset offset of the result (modulo num-results);
* specific ordering does not matter for the offset
* @param type entries of which type should be considered?
* Use 0 for any type.
/**
* Get a random item for replication. Returns a single random item
- * from those with the highest replication counters. The item's
+ * from those with the highest replication counters. The item's
* replication counter is decremented by one IF it was positive before.
* Call 'proc' with all values ZERO or NULL if the datastore is empty.
*
* Get one of the results for a particular key in the datastore.
*
* @param cls closure
- * @param offset offset of the result (modulo num-results);
+ * @param offset offset of the result (modulo num-results);
* specific ordering does not matter for the offset
* @param key maybe NULL (to match all entries)
* @param vhash hash of the value, maybe NULL (to
* Call the given processor on an item with zero anonymity.
*
* @param cls our "struct Plugin*"
- * @param offset offset of the result (modulo num-results);
+ * @param offset offset of the result (modulo num-results);
* specific ordering does not matter for the offset
* @param type entries of which type should be considered?
* Use 0 for any type.
* change in their disk utilization.
*
* @param cls closure (NULL)
- * @param delta change in disk utilization,
+ * @param delta change in disk utilization,
* 0 for "reset to empty"
*/
static void
* two numbers being identical; furthermore, we need to
* guarantee that a difference in the number of matching
* bits is always represented in the result.
- *
+ *
* We use 2^32/2^9 numerical values to distinguish between
* hash codes that have the same LSB bit distance and
* use the highest 2^9 bits of the result to signify the
struct TestPutContext
{
/**
- * This is a linked list
+ * This is a linked list
*/
struct TestPutContext *next;
* Create a defragmentation context.
*
* @param stats statistics context
- * @param mtu the maximum message size for each fragment
+ * @param mtu the maximum message size for each fragment
* @param num_msgs how many fragmented messages
* to we defragment at most at the same time?
* @param cls closure for proc and ackp
/**
* Destroy a top-level activity entry.
- *
+ *
* @param h global fs handle
* @param top top level activity entry
*/
* @param offset offset to read from; it is possible
* that the caller might need to go backwards
* a bit at times
- * @param max maximum number of bytes that should be
+ * @param max maximum number of bytes that should be
* copied to buf; readers are not allowed
* to provide less data unless there is an error;
* a value of "0" will be used at the end to allow
* @param offset offset to read from; it is possible
* that the caller might need to go backwards
* a bit at times
- * @param max maximum number of bytes that should be
+ * @param max maximum number of bytes that should be
* copied to buf; readers are not allowed
* to provide less data unless there is an error;
* a value of "0" will be used at the end to allow
* (for serialization/deserialization).
*
* @param h master context
- * @param ext component of the path
+ * @param ext component of the path
* @param ent entity identifier (or emtpy string for the directory)
* @return NULL on error
*/
* parent operation.
*
* @param h master context
- * @param ext component of the path
+ * @param ext component of the path
* @param uni name of the parent operation
* @param ent entity identifier (or emtpy string for the directory)
* @return NULL on error
* Return a read handle for deserialization.
*
* @param h master context
- * @param ext component of the path
+ * @param ext component of the path
* @param ent entity identifier (or emtpy string for the directory)
* @return NULL on error
*/
* Return a write handle for serialization.
*
* @param h master context
- * @param ext component of the path
+ * @param ext component of the path
* @param ent entity identifier (or emtpy string for the directory)
* @return NULL on error
*/
* Return a write handle for serialization.
*
* @param h master context
- * @param ext component of the path
+ * @param ext component of the path
* @param uni name of parent
* @param ent entity identifier (or emtpy string for the directory)
* @return NULL on error
* Remove serialization/deserialization file from disk.
*
* @param h master context
- * @param ext component of the path
- * @param ent entity identifier
+ * @param ext component of the path
+ * @param ent entity identifier
*/
void
GNUNET_FS_remove_sync_file_ (struct GNUNET_FS_Handle *h, const char *ext,
* Remove serialization/deserialization file from disk.
*
* @param h master context
- * @param ext component of the path
+ * @param ext component of the path
* @param uni parent name
- * @param ent entity identifier
+ * @param ent entity identifier
*/
static void
remove_sync_file_in_dir (struct GNUNET_FS_Handle *h, const char *ext,
* Remove serialization/deserialization directory from disk.
*
* @param h master context
- * @param ext component of the path
- * @param uni unique name of parent
+ * @param ext component of the path
+ * @param uni unique name of parent
*/
void
GNUNET_FS_remove_sync_dir_ (struct GNUNET_FS_Handle *h, const char *ext,
* Given a serialization name (full absolute path), return the
* basename of the file (without the path), which must only
* consist of the 6 random characters.
- *
+ *
* @param fullname name to extract the basename from
* @return copy of the basename, NULL on error
*/
* is enabled and returns NULL if not.
*
* @param h master context
- * @param ext component of the path
+ * @param ext component of the path
* @return NULL on errror
*/
static char *
* is enabled and returns NULL if not.
*
* @param h master context
- * @param ext component of the path
+ * @param ext component of the path
* @param uni name of parent
* @return NULL on errror
*/
* on disk. Note that all internal FS-operations that change
* publishing structs should already call "sync" internally,
* so this function is likely not useful for clients.
- *
+ *
* @param pc the struct to sync
*/
void
* on disk. Note that all internal FS-operations that change
* publishing structs should already call "sync" internally,
* so this function is likely not useful for clients.
- *
+ *
* @param uc the struct to sync
*/
void
/**
* Serialize a download request.
- *
+ *
* @param wh the 'struct GNUNET_BIO_WriteHandle*'
* @param dr the 'struct DownloadRequest'
* @return GNUNET_YES on success, GNUNET_NO on error
/**
* Read a download request tree.
- *
+ *
* @param rh stream to read from
* @return value the 'struct DownloadRequest', NULL on error
*/
* on disk. Note that all internal FS-operations that change
* publishing structs should already call "sync" internally,
* so this function is likely not useful for clients.
- *
+ *
* @param dc the struct to sync
*/
void
* on disk. Note that all internal FS-operations that change
* publishing structs should already call "sync" internally,
* so this function is likely not useful for clients.
- *
+ *
* @param sr the struct to sync
*/
void
* on disk. Note that all internal FS-operations that change
* publishing structs should already call "sync" internally,
* so this function is likely not useful for clients.
- *
+ *
* @param sc the struct to sync
*/
void
/**
- * Deserialize a search.
+ * Deserialize a search.
*
* @param h overall context
* @param rh file to deserialize from
* resume the download (put it in the queue). Does this
* recursively for the top-level download and all child
* downloads.
- *
+ *
* @param dc download to resume
*/
static void
/**
- * Deserialize a search.
+ * Deserialize a search.
*
* @param h overall context
* @param rh file to deserialize from
* Setup a connection to the file-sharing service.
*
* @param cfg configuration to use
- * @param client_name unique identifier for this client
+ * @param client_name unique identifier for this client
* @param upcb function to call to notify about FS actions
* @param upcb_cls closure for upcb
* @param flags specific attributes for fs-operations
char *emsg;
/**
- * Name of the file or directory (must be an absolute path).
+ * Name of the file or directory (must be an absolute path).
*/
char *filename;
* @param offset offset to read from; it is possible
* that the caller might need to go backwards
* a bit at times
- * @param max maximum number of bytes that should be
+ * @param max maximum number of bytes that should be
* copied to buf; readers are not allowed
* to provide less data unless there is an error;
* a value of "0" will be used at the end to allow
* @param offset offset to read from; it is possible
* that the caller might need to go backwards
* a bit at times
- * @param max maximum number of bytes that should be
+ * @param max maximum number of bytes that should be
* copied to buf; readers are not allowed
* to provide less data unless there is an error;
* a value of "0" will be used at the end to allow
/**
- * Fill in all of the generic fields for
+ * Fill in all of the generic fields for
* an unindex event and call the callback.
*
* @param pi structure to fill in
* Remove serialization/deserialization file from disk.
*
* @param h master context
- * @param ext component of the path
- * @param ent entity identifier
+ * @param ext component of the path
+ * @param ent entity identifier
*/
void
GNUNET_FS_remove_sync_file_ (struct GNUNET_FS_Handle *h, const char *ext,
* Remove serialization/deserialization directory from disk.
*
* @param h master context
- * @param ext component of the path
- * @param uni unique name of parent
+ * @param ext component of the path
+ * @param uni unique name of parent
*/
void
GNUNET_FS_remove_sync_dir_ (struct GNUNET_FS_Handle *h, const char *ext,
* on disk. Note that all internal FS-operations that change
* file information data should already call "sync" internally,
* so this function is likely not useful for clients.
- *
+ *
* @param fi the struct to sync
*/
void
* on disk. Note that all internal FS-operations that change
* publishing structs should already call "sync" internally,
* so this function is likely not useful for clients.
- *
+ *
* @param pc the struct to sync
*/
void
* on disk. Note that all internal FS-operations that change
* publishing structs should already call "sync" internally,
* so this function is likely not useful for clients.
- *
+ *
* @param uc the struct to sync
*/
void
* on disk. Note that all internal FS-operations that change
* publishing structs should already call "sync" internally,
* so this function is likely not useful for clients.
- *
+ *
* @param sc the struct to sync
*/
void
* on disk. Note that all internal FS-operations that change
* publishing structs should already call "sync" internally,
* so this function is likely not useful for clients.
- *
+ *
* @param sr the struct to sync
*/
void
* on disk. Note that all internal FS-operations that change
* publishing structs should already call "sync" internally,
* so this function is likely not useful for clients.
- *
+ *
* @param dc the struct to sync
*/
void
/**
* Destroy a top-level activity entry.
- *
+ *
* @param h global fs handle
* @param top top level activity entry
*/
BRS_RECONSTRUCT_UP = 3,
/**
- * We've determined the real, desired CHK for this block
+ * We've determined the real, desired CHK for this block
* (full tree reconstruction failed), request is now pending.
* If the CHK that bubbled up through reconstruction did match
* the top-level request, the state machine for the subtree
* We've successfully downloaded this block, but the children
* still need to be either downloaded or verified (download
* request propagates down). If the download fails, the
- * state machine for this block may move to
+ * state machine for this block may move to
* BRS_DOWNLOAD_ERROR instead.
*/
BRS_DOWNLOAD_DOWN = 5,
struct IndexInfoMessage
{
/**
- * Message type will be
+ * Message type will be
* GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_ENTRY.
*/
struct GNUNET_MessageHeader header;
{
/**
- * Message type will be
+ * Message type will be
* GNUNET_MESSAGE_TYPE_FS_UNINDEX.
*/
struct GNUNET_MessageHeader header;
{
/**
- * Message type will be
+ * Message type will be
* GNUNET_MESSAGE_TYPE_FS_START_SEARCH.
*/
struct GNUNET_MessageHeader header;
/**
- * Bitmask with options. Zero for no options, one for loopback-only.
+ * Bitmask with options. Zero for no options, one for loopback-only.
* Other bits are currently not defined.
*/
int32_t options GNUNET_PACKED;
* or similar blunt actions in order to avoid exposing ourselves).
* <p>
* If the request is for an SBLOCK, this is the identity of the
- * pseudonym to which the SBLOCK belongs.
+ * pseudonym to which the SBLOCK belongs.
* <p>
* If the request is for a KBLOCK, "target" must be all zeros.
*/
uint32_t type GNUNET_PACKED;
/**
- * When does this result expire?
+ * When does this result expire?
*/
struct GNUNET_TIME_AbsoluteNBO expiration;
struct MigrationStopMessage
{
/**
- * Message type will be
+ * Message type will be
* GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP.
*/
struct GNUNET_MessageHeader header;
/**
* Set the MIMETYPE information for the given
* metadata to "application/gnunet-directory".
- *
+ *
* @param md metadata to add mimetype to
*/
void
* used in the main libextractor library and yielding
* 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);
* can be NULL (if mime-type is not known)
* @param data actual meta-data found
/**
* Create a directory builder.
- *
+ *
* @param mdir metadata for the directory
*/
struct GNUNET_FS_DirectoryBuilder *
/**
* Add an entry to a directory.
- *
+ *
* @param bld directory to extend
* @param uri uri of the entry (must not be a KSK)
* @param md metadata of the entry
* Given the offset of a block (with respect to the DBLOCKS) and its
* depth, return the offset where we would store this block in the
* file.
- *
+ *
* @param fsize overall file size
* @param off offset of the block in the file
* @param depth depth of the block in the tree, 0 for DBLOCK
/**
* We're ready to transmit a search request to the
- * file-sharing service. Do it. If there is
- * more than one request pending, try to send
+ * file-sharing service. Do it. If there is
+ * more than one request pending, try to send
* multiple or request another transmission.
*
* @param cls closure
* We've found a matching block without downloading it.
* Encrypt it and pass it to our "receive" function as
* if we had received it from the network.
- *
+ *
* @param dc download in question
* @param chk request this relates to
* @param dr request details
* used in the main libextractor library and yielding
* 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);
* can be NULL (if mime-type is not known)
* @param data actual meta-data found
dc->completed += app;
/* do recursive download if option is set and either meta data
- * says it is a directory or if no meta data is given AND filename
+ * says it is a directory or if no meta data is given AND filename
* ends in '.gnd' (top-level case) */
if (is_recursive_download (dc))
GNUNET_FS_directory_list_contents (prc->size, pt, off,
/**
* We're ready to transmit a search request to the
- * file-sharing service. Do it. If there is
- * more than one request pending, try to send
+ * file-sharing service. Do it. If there is
+ * more than one request pending, try to send
* multiple or request another transmission.
*
* @param cls closure
* @param depth depth of the current entry, 0 are the DBLOCKs,
* top level block is 'dc->treedepth - 1'
* @param dr_offset offset in the original file this block maps to
- * (as in, offset of the first byte of the first DBLOCK
+ * (as in, offset of the first byte of the first DBLOCK
* in the subtree rooted in the returned download request tree)
* @param file_start_offset desired starting offset for the download
* in the original file; requesting tree should not contain
*
* This function checks if the content on disk matches
* the expected content based on the URI.
- *
+ *
* @param cls closure
* @param chk content hash key for the block
* @param offset offset of the block
case BRS_CHK_SET:
if (0 == memcmp (chk, &dr->chk, sizeof (struct ContentHashKey)))
{
- /* block matches, hence tree below matches;
+ /* block matches, hence tree below matches;
* this request is done! */
dr->state = BRS_DOWNLOAD_UP;
/* calculate how many bytes of payload this block
/* already done entirely, party! */
if (dc->rfh != NULL)
{
- /* avoid hanging on to file handle longer than
+ /* avoid hanging on to file handle longer than
* necessary */
GNUNET_DISK_file_close (dc->rfh);
dc->rfh = NULL;
{
if (dc->rfh != NULL)
{
- /* avoid hanging on to file handle longer than
+ /* avoid hanging on to file handle longer than
* necessary */
GNUNET_DISK_file_close (dc->rfh);
dc->rfh = NULL;
* @param h handle to the file sharing subsystem
* @param client_info initial value for the client-info value for this entry
* @param length length of the file
- * @param reader function that can be used to obtain the data for the file
+ * @param reader function that can be used to obtain the data for the file
* @param reader_cls closure for "reader"
* @param keywords under which keywords should this file be available
* directly; can be NULL
*
* @param dir the directory
* @param ent the entry to add; the entry must not have been
- * added to any other directory at this point and
+ * added to any other directory at this point and
* must not include "dir" in its structure
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
/**
* Suggest a filename based on given metadata.
- *
+ *
* @param md given meta data
* @return NULL if meta data is useless for suggesting a filename
*/
* Return the name of the directory in which we store
* our local namespaces (or rather, their public keys).
*
- * @param h global fs handle
+ * @param h global fs handle
* @return NULL on error, otherwise the name of the directory
*/
static char *
* Return the name of the directory in which we store
* the update information graph for the given local namespace.
*
- * @param ns namespace handle
+ * @param ns namespace handle
* @return NULL on error, otherwise the name of the directory
*/
static char *
/**
* Write the namespace update node graph to a file.
- *
+ *
* @param ns namespace to dump
*/
static void
/**
* Read the namespace update node graph from a file.
- *
+ *
* @param ns namespace to read
*/
static void
/**
* Disconnect from the datastore.
- *
+ *
* @param cls datastore handle
* @param tc scheduler context
*/
/**
- * Publish an advertismement for a namespace.
+ * Publish an advertismement for a namespace.
*
* @param h handle to the file sharing subsystem
* @param ksk_uri keywords to use for advertisment
* head of an tree if it is in the 'tree_array' under its respective
* 'tree_id'.
*
- * In short, we're trying to find the smallest number of tree to
+ * In short, we're trying to find the smallest number of tree to
* cover a directed graph.
*
* @param cls closure (of type 'struct FindTreeClosure')
return GNUNET_YES; /* circular */
GNUNET_assert (nsn->tree_id < fc->tree_array_size);
if (fc->tree_array[nsn->tree_id] != nsn)
- return GNUNET_YES; /* part of "another" (directed) TREE,
+ return GNUNET_YES; /* part of "another" (directed) TREE,
* and not root of it, end trace */
if (nsn->tree_id == fc->id)
return GNUNET_YES; /* that's our own root (can this be?) */
* produce an update. Namespace updates form a graph where each node
* has a name. Each node can have any number of URI/meta-data entries
* which can each be linked to other nodes. Cycles are possible.
- *
+ *
* Calling this function with "next_id" NULL will cause the library to
* 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 Tree
* are reachable).
- *
+ *
* 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
* that cycles within the final tree are possible (including self-loops).
/**
- * Fill in all of the generic fields for
+ * Fill in all of the generic fields for
* a publish event and call the callback.
*
* @param pi structure to fill in
/**
* Datastore returns from reservation cancel request.
- *
+ *
* @param cls the 'struct GNUNET_FS_PublishContext'
* @param success success code (not used)
* @param msg error message (typically NULL, not used)
{
pt_size = GNUNET_MIN (max, p->data.file.file_size - offset);
if (pt_size == 0)
- return 0; /* calling reader with pt_size==0
+ return 0; /* calling reader with pt_size==0
* might free buf, so don't! */
if (pt_size !=
p->data.file.reader (p->data.file.reader_cls, offset, pt_size, buf,
* or (on error) "GNUNET_FS_tree_encode_finish".
*
* @param cls closure
- * @param chk content hash key for the block
+ * @param chk content hash key for the block
* @param offset offset of the block in the file
* @param depth depth of the block in the file, 0 for DBLOCK
* @param type type of the block (IBLOCK or DBLOCK)
/**
* We have gotten a reply for our space reservation request.
* Either fail (insufficient space) or start publishing for good.
- *
+ *
* @param cls the 'struct GNUNET_FS_PublishContext*'
* @param success positive reservation ID on success
* @param msg error message on error, otherwise NULL
* @param namespace namespace to publish the file in, NULL for no namespace
* @param nid identifier to use for the publishd content in the namespace
* (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)
- * @param options options for the publication
+ * @param options options for the publication
* @return context that can be used to control the publish operation
*/
struct GNUNET_FS_PublishContext *
/**
- * Stop an upload. Will abort incomplete uploads (but
+ * Stop an upload. Will abort incomplete uploads (but
* not remove blocks that have already been publishd) or
* simply clean up the state for completed uploads.
* Must NOT be called from within the event callback!
/**
* Check if the given result is identical
* to the given URI.
- *
+ *
* @param cls points to the URI we check against
* @param key not used
* @param value a "struct GNUNET_FS_SearchResult" who's URI we
/**
* We've found a new CHK result. Let the client
* know about it.
- *
+ *
* @param sc the search context
* @param sr the specific result
*/
/**
* We've found new information about an existing CHK result. Let the
* client know about it.
- *
+ *
* @param sc the search context
* @param sr the specific result
*/
/**
* Check if the given result is identical to the given URI and if so
* return it.
- *
+ *
* @param cls a "struct GetResultContext"
* @param key not used
* @param value a "struct GNUNET_FS_SearchResult" who's URI we
/**
- * Pause search.
+ * Pause search.
*
* @param sc context for the search that should be paused
*/
* In-memory cache of the current CHK tree.
* This struct will contain the CHK values
* from the root to the currently processed
- * node in the tree as identified by
+ * node in the tree as identified by
* "current_depth" and "publish_offset".
* The "chktree" will be initially NULL,
* then allocated to a sufficient number of
*
* @param depth depth of the IBlock in the tree, 0 would be a DBLOCK,
* must be > 0 (this function is for IBLOCKs only!)
- * @param end_offset current offset in the payload (!) of the overall file,
- * must be > 0 (since this function is called at the
+ * @param end_offset current offset in the payload (!) of the overall file,
+ * must be > 0 (since this function is called at the
* end of a block).
* @return size of the corresponding IBlock
*/
* @param cls closure for reader, proc, progress and cont
* @param reader function to call to read plaintext data
* @param proc function to call on each encrypted block
- * @param progress function to call with progress information
+ * @param progress function to call with progress information
* @param cont function to call when done
*/
struct GNUNET_FS_TreeEncoder *
*
* @param depth depth of the IBlock in the tree (aka overall
* number of tree levels minus depth); 0 == DBlock
- * @param end_offset current offset in the overall file,
+ * @param end_offset current offset in the overall file,
* at the *beginning* of the block for DBLOCKs (depth==0),
* otherwise at the *end* of the block (exclusive)
* @return (array of CHKs') offset in the above IBlock
/**
* Clean up a tree encoder and return information
* about the resulting URI or an error message.
- *
+ *
* @param te the tree encoder to clean up
* @param uri set to the resulting URI (if encoding finished)
* @param emsg set to an error message (if an error occured
#include "fs.h"
/**
- * Compute the depth of the CHK tree.
+ * Compute the depth of the CHK tree.
*
* @param flen file length for which to compute the depth
* @return depth of the tree, always > 0. A depth of 1 means only a DBLOCK.
* @param cls closure for reader, proc, progress and cont
* @param reader function to call to read plaintext data
* @param proc function to call on each encrypted block
- * @param progress function to call with progress information
+ * @param progress function to call with progress information
* @param cont function to call when done
* @return tree encoder context
*/
/**
- * Encrypt the next block of the file (and
- * call proc and progress accordingly; or
+ * Encrypt the next block of the file (and
+ * call proc and progress accordingly; or
* of course "cont" if we have already completed
* encoding of the entire file).
*
/**
* Clean up a tree encoder and return information
* about the resulting URI or an error message.
- *
+ *
* @param te the tree encoder to clean up
* @param uri set to the resulting URI (if encoding finished)
* @param emsg set to an error message (if an error occured
/**
* Get data that would be needed to resume
* the encoding later.
- *
+ *
* @param te encoding to resume
* @param data set to the resume data
* @param size set to the size of the resume data
/**
* Reset tree encoder to point previously
* obtained for resuming.
- *
+ *
* @param te encoding to resume
* @param data the resume data
* @param size the size of the resume data
/**
- * Fill in all of the generic fields for
+ * Fill in all of the generic fields for
* an unindex event and call the callback.
*
* @param pi structure to fill in
* @param h handle to the file sharing subsystem
* @param filename file to unindex
* @param cctx initial value for the client context
- * @return NULL on error, otherwise handle
+ * @return NULL on error, otherwise handle
*/
struct GNUNET_FS_UnindexContext *
GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h, const char *filename,
* Convert keyword URI to a human readable format
* (i.e. the search query that was used in the first place)
*
- * @param uri ksk uri to convert to a string
+ * @param uri ksk uri to convert to a string
* @return string with the keywords
*/
char *
* spaces), return a copy of the keyword without %-encoding and
* without double-quotes (%22). Also, add a space at the beginning
* if there is not a '+'.
- *
+ *
* @param in string with %-encoding
* @param emsg where to store the parser error message (if any)
* @return decodded string with leading space (or preserved plus)
/**
* Canonicalize a keyword.
- *
+ *
* @param in input string (the keyword)
* @return canonicalized keyword
*/
* as decapitalization and removal of certain characters.
* (useful for search).
*
- * @param uri the URI to canonicalize
+ * @param uri the URI to canonicalize
* @return canonicalized version of the URI, NULL on error
*/
struct GNUNET_FS_Uri *
* used in the main libextractor library and yielding
* 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);
* can be NULL (if mime-type is not known)
* @param data actual meta-data found
/**
- * Called by FS client to give information about the progress of an
+ * Called by FS client to give information about the progress of an
* operation.
*
* @param cls closure
/**
- * Called by FS client to give information about the progress of an
+ * Called by FS client to give information about the progress of an
* operation.
*
* @param cls closure
* used in the main libextractor library and yielding
* 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);
* can be NULL (if mime-type is not known)
* @param data actual meta-data found
/**
- * Called by FS client to give information about the progress of an
+ * Called by FS client to give information about the progress of an
* operation.
*
* @param cls closure
* @author Christian Grothoff
*
* To use:
- * - consider re-issue GSF_dht_lookup_ after non-DHT reply received
+ * - consider re-issue GSF_dht_lookup_ after non-DHT reply received
* - implement 'SUPPORT_DELAYS'
*
*/
/**
- * How quickly do we age cover traffic? At the given
+ * How quickly do we age cover traffic? At the given
* time interval, remaining cover traffic counters are
* decremented by 1/16th.
*/
double GSF_current_priorities;
/**
- * How many query messages have we received 'recently' that
+ * How many query messages have we received 'recently' that
* have not yet been claimed as cover traffic?
*/
unsigned int GSF_cover_query_count;
/**
- * How many content messages have we received 'recently' that
+ * How many content messages have we received 'recently' that
* have not yet been claimed as cover traffic?
*/
unsigned int GSF_cover_content_count;
/**
* Test if the DATABASE (GET) load on this peer is too high
* to even consider processing the query at
- * all.
- *
+ * all.
+ *
* @return GNUNET_YES if the load is too high to do anything (load high)
* GNUNET_NO to process normally (load normal)
* GNUNET_SYSERR to process for free (load low)
/**
* We're done with the local lookup, now consider
* P2P processing (depending on request options and
- * result status). Also signal that we can now
+ * result status). Also signal that we can now
* receive more request information from the client.
*
* @param cls the client doing the request ('struct GNUNET_SERVER_Client')
extern double GSF_current_priorities;
/**
- * How many query messages have we received 'recently' that
+ * How many query messages have we received 'recently' that
* have not yet been claimed as cover traffic?
*/
extern unsigned int GSF_cover_query_count;
/**
- * How many content messages have we received 'recently' that
+ * How many content messages have we received 'recently' that
* have not yet been claimed as cover traffic?
*/
extern unsigned int GSF_cover_content_count;
/**
* Test if the DATABASE (GET) load on this peer is too high
* to even consider processing the query at
- * all.
- *
+ * all.
+ *
* @return GNUNET_YES if the load is too high to do anything (load high)
* GNUNET_NO to process normally (load normal)
* GNUNET_SYSERR to process for free (load low)
/**
* Return the performance data record for the given peer
- *
+ *
* @param cp peer to query
* @return performance data record for the peer
*/
/**
* Get the randomized delay a response should be subjected to.
- *
+ *
* @return desired delay
*/
static struct GNUNET_TIME_Relative
* Handle a reply to a pending request. Also called if a request
* expires (then with data == NULL). The handler may be called
* many times (depending on the request type), but will not be
- * called during or after a call to GSF_pending_request_cancel
+ * called during or after a call to GSF_pending_request_cancel
* and will also not be called anymore after a call signalling
* expiration.
*
/**
* We've received a request with the specified priority. Bound it
* according to how much we trust the given peer.
- *
+ *
* @param prio_in requested priority
* @param cp the peer making the request
* @return effective priority
* Function called if there has been a timeout trying to satisfy
* a transmission request.
*
- * @param cls the 'struct GSF_PeerTransmitHandle' of the request
+ * @param cls the 'struct GSF_PeerTransmitHandle' of the request
* @param tc scheduler context
*/
static void
/**
* Ask a peer to stop migrating data to us until the given point
* in time.
- *
+ *
* @param cp peer to ask
* @param block_time until when to block
*/
/**
* Return the performance data record for the given peer
- *
+ *
* @param cp peer to query
* @return performance data record for the peer
*/
/**
* Ask a peer to stop migrating data to us until the given point
* in time.
- *
+ *
* @param cp peer to ask
* @param block_time until when to block
*/
* Handle a reply to a pending request. Also called if a request
* expires (then with data == NULL). The handler may be called
* many times (depending on the request type), but will not be
- * called during or after a call to GSF_pending_request_cancel
+ * called during or after a call to GSF_pending_request_cancel
* and will also not be called anymore after a call signalling
* expiration.
*
* @param eval evaluation of the result
* @param pr handle to the original pending request
* @param reply_anonymity_level anonymity level for the reply, UINT32_MAX for "unknown"
- * @param expiration when does 'data' expire?
+ * @param expiration when does 'data' expire?
* @param type type of the block
* @param data response data, NULL on request expiration
* @param data_len number of bytes in data
/**
- * List of GSF_PendingRequests this request plan
+ * List of GSF_PendingRequests this request plan
* participates with.
*/
struct PendingRequestList;
/**
- * List of GSF_PendingRequests this request plan
+ * List of GSF_PendingRequests this request plan
* participates with.
*/
struct PendingRequestList
gettext_noop ("# average retransmission delay (ms)"),
total_delay * 1000LL / plan_count, GNUNET_NO);
prd = GSF_pending_request_get_data_ (rp->prl_head->pr);
- // FIXME: calculate 'rp->priority'!
+ // FIXME: calculate 'rp->priority'!
if (rp->transmission_counter < 32)
delay =
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
* Notify the plan about a peer being no longer available;
* destroy all entries associated with this peer.
*
- * @param cp connected peer
+ * @param cp connected peer
*/
void
GSF_plan_notify_peer_disconnect_ (const struct GSF_ConnectedPeer *cp)
* Notify the plan about a peer being no longer available;
* destroy all entries associated with this peer.
*
- * @param cp connected peer
+ * @param cp connected peer
*/
void
GSF_plan_notify_peer_disconnect_ (const struct GSF_ConnectedPeer *cp);
/**
- * Create a new pending request.
+ * Create a new pending request.
*
* @param options request options
* @param type type of the block that is being requested
/**
* Obtain the public data associated with a pending request
- *
+ *
* @param pr pending request
* @return associated public data
*/
* Test if two pending requests are compatible (would generate
* the same query modulo filters and should thus be processed
* jointly).
- *
+ *
* @param pra a pending request
* @param pra another pending request
* @return GNUNET_OK if the requests are compatible
/**
* Test if the DATABASE (PUT) load on this peer is too high
* to even consider processing the query at
- * all.
- *
+ * all.
+ *
* @return GNUNET_YES if the load is too high to do anything (load high)
* GNUNET_NO to process normally (load normal or low)
*/
/**
* Task that issues a warning if the datastore lookup takes too long.
- *
+ *
* @param cls the 'struct GSF_PendingRequest'
* @param tc task context
*/
/**
* Task that issues a warning if the datastore lookup takes too long.
- *
+ *
* @param cls the 'struct GSF_PendingRequest'
* @param tc task context
*/
* Handle a reply to a pending request. Also called if a request
* expires (then with data == NULL). The handler may be called
* many times (depending on the request type), but will not be
- * called during or after a call to GSF_pending_request_cancel
+ * called during or after a call to GSF_pending_request_cancel
* and will also not be called anymore after a call signalling
* expiration.
*
/**
- * Create a new pending request.
+ * Create a new pending request.
*
* @param options request options
* @param type type of the block that is being requested
/**
* Obtain the public data associated with a pending request
- *
+ *
* @param pr pending request
* @return associated public data
*/
* Test if two pending requests are compatible (would generate
* the same query modulo filters and should thus be processed
* jointly).
- *
+ *
* @param pra a pending request
* @param pra another pending request
* @return GNUNET_OK if the requests are compatible
#define DEBUG_FS_MIGRATION GNUNET_NO
/**
- * How long must content remain valid for us to consider it for migration?
+ * How long must content remain valid for us to consider it for migration?
* If content will expire too soon, there is clearly no point in pushing
* it to other peers. This value gives the threshold for migration. Note
* that if this value is increased, the migration testcase may need to be
GNUNET_HashCode query;
/**
- * When does this block expire?
+ * When does this block expire?
*/
struct GNUNET_TIME_Absolute expiration;
/**
* Check if sending this block to this peer would
- * be a good idea.
+ * be a good idea.
*
* @param peer target peer
* @param block the block
/**
* Task that is run periodically to obtain blocks for content
* migration
- *
+ *
* @param cls unused
* @param tc scheduler context (also unused)
*/
/**
* Task that is run periodically to obtain blocks for content
* migration
- *
+ *
* @param cls unused
* @param tc scheduler context (also unused)
*/
/**
* Task that is run periodically to obtain blocks for DHT PUTs.
- *
+ *
* @param cls type of blocks to gather
* @param tc scheduler context (unused)
*/
/**
* Task that is run periodically to obtain blocks for DHT PUTs.
- *
+ *
* @param cls type of blocks to gather
* @param tc scheduler context (unused)
*/
/**
* Task that is run periodically to obtain blocks for DHT PUTs.
- *
+ *
* @param cls type of blocks to gather
* @param tc scheduler context (unused)
*/
}
/**
- * Called by FS client to give information about the progress of an
+ * Called by FS client to give information about the progress of an
* operation.
*
* @param cls closure
* Download speed of type `seeder 1' was 757 KiB/s
* Download speed of type `seeder 2' was 613 KiB/s
* Download speed of type `leach` was 539 KiB/s
- *
+ *
* - 10 MB, 3 peers, without delays:
* Download speed of type `seeder 1' was 1784 KiB/s
* Download speed of type `seeder 2' was 1604 KiB/s
/**
- * Consider scheduling the restart-task.
- * Only runs the restart task once per event
+ * Consider scheduling the restart-task.
+ * Only runs the restart task once per event
* category.
*
* @param ev type of the event to consider
/**
- * Consider scheduling the restart-task.
- * Only runs the restart task once per event
+ * Consider scheduling the restart-task.
+ * Only runs the restart task once per event
* category.
*
* @param ev type of the event to consider
/**
- * Consider scheduling the restart-task.
- * Only runs the restart task once per event
+ * Consider scheduling the restart-task.
+ * Only runs the restart task once per event
* category.
*
* @param ev type of the event to consider
/**
- * Consider scheduling the restart-task.
- * Only runs the restart task once per event
+ * Consider scheduling the restart-task.
+ * Only runs the restart task once per event
* category.
*
* @param ev type of the event to consider
* @param h2 the second HELLO message
* @param now time to use for deciding which addresses have
* expired and should not be considered at all
- * @return absolute time forever if the two HELLOs are
+ * @return absolute time forever if the two HELLOs are
* totally identical; smallest timestamp >= now if
- * they only differ in timestamps;
+ * they only differ in timestamps;
* zero if the some addresses with expirations >= now
* do not match at all
*/
/**
* Task that is run when we are ready to receive more data from the hostlist
- * server.
+ * server.
*
* @param cls closure, unused
* @param tc task context, unused
/**
- * Continuation called by the statistics code once
+ * Continuation called by the statistics code once
* we go the stat. Initiates hostlist download scheduling.
*
* @param cls closure
/**
- * @brief index block (indexing a DBlock that
+ * @brief index block (indexing a DBlock that
* can be obtained directly from reading
* the plaintext file)
*/
*
* TODO:
* - move GNUNET_TRANSPORT_ATS* in here and rename...
- * - extend API to express communication preferences to ATS
+ * - extend API to express communication preferences to ATS
* (to be called DIRECTLY from apps, not from transport/core!)
*/
#ifndef GNUNET_ATS_SERVICE_H
* Signature of a function called by ATS to notify the callee that the
* assigned bandwidth or address for a given peer was changed. If the
* callback is called with address/bandwidth assignments of zero, the
- * ATS disconnect function will still be called once the disconnect
+ * ATS disconnect function will still be called once the disconnect
* actually happened.
*
* @param cls closure
/**
- * Signature of a function that takes an address suggestion
+ * Signature of a function that takes an address suggestion
*
* @param cls closure
* @param peer identity of the new peer
const char *plugin_name,
const void *plugin_addr,
size_t plugin_addr_len,
- struct Session *session,
+ struct Session * session,
struct
GNUNET_BANDWIDTH_Value32NBO
bandwidth,
GNUNET_BLOCK_TYPE_FS_SBLOCK = 4,
/**
- * Type of a block that is used to advertise a namespace.
+ * Type of a block that is used to advertise a namespace.
*/
GNUNET_BLOCK_TYPE_FS_NBLOCK = 5,
/**
* Mingle hash with the mingle_number to produce different bits.
- *
+ *
* @param in original hash code
* @param mingle_number number for hash permutation
* @param hc where to store the result.
/**
* Function called to validate a reply or a request. For
* request evaluation, simply pass "NULL" for the reply_block.
- * Note that it is assumed that the reply has already been
+ * Note that it is assumed that the reply has already been
* matched to the key (and signatures checked) as it would
* be done with the "get_key" function.
*
* @param block block to get the key for
* @param block_size number of bytes in 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_SYSERR if type not supported
* (or if extracting a key from a block of this type does not work)
/**
* @file include/gnunet_block_plugin.h
- * @brief API for block plugins. Each block plugin must conform to
+ * @brief API for block plugins. Each block plugin must conform to
* the API specified by this header.
* @author Christian Grothoff
*/
/**
* Function called to validate a reply or a request. For
* request evaluation, simply pass "NULL" for the reply_block.
- * Note that it is assumed that the reply has already been
+ * Note that it is assumed that the reply has already been
* matched to the key (and signatures checked) as it would
* be done with the "get_key" function.
*
* @param block block to get the key for
* @param block_size number of bytes in 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_SYSERR if type not supported
* (or if extracting a key from a block of this type does not work)
const enum GNUNET_BLOCK_Type *types;
/**
- * Main function of a block plugin. Allows us to check if a
+ * Main function of a block plugin. Allows us to check if a
* block matches a query.
*/
GNUNET_BLOCK_EvaluationFunction evaluate;
/**
* @file include/gnunet_chat_service.h
- * @brief API for chatting via GNUnet
+ * @brief API for chatting via GNUnet
* @author Christian Grothoff
* @author Nathan Evans
* @author Vitaly Minko
/**
* Cancel a request for notification.
- *
+ *
* @param th handle from the original request.
*/
void
* if the caller does not care about temporary connection errors,
* for example because the protocol is stateless
* @param rn function to call with the response
- * @param rn_cls closure for rn
+ * @param rn_cls closure for rn
* @return GNUNET_OK on success, GNUNET_SYSERR if a request
* is already pending
*/
* NOT reentrant!
*
* @param hc the hash code
- * @return string
+ * @return string
*/
const char *
GNUNET_h2s (const GNUNET_HashCode * hc);
/**
* Allocate and initialize a block of memory.
- *
+ *
* @param buf data to initalize the block with
* @param size the number of bytes in buf (and size of the allocation)
* @return pointer to size bytes of memory, never NULL (!)
/**
* Close the socket and free associated resources. Pending
* transmissions may be completed or dropped depending on the
- * arguments. If a receive call is pending and should
+ * arguments. If a receive call is pending and should
* NOT be completed, 'GNUNET_CONNECTION_receive_cancel'
* should be called explicitly first.
*
#define GNUNET_CONSTANTS_EXEC_WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 200)
/**
- * After how long do we retry a service connection that was
+ * After how long do we retry a service connection that was
* unavailable? Used in cases where an exponential back-off
* seems inappropriate.
*/
/**
* 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_HashCode))
/**
- * Size of the 'struct OutboundMessage' of the transport
- * (which, in combination with the
+ * 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
*
* Could theoretically be 64k minus (GNUNET_CONSTANTS_CORE_SIZE_ENCRYPTED_MESSAGE +
* GNUNET_CONSTANTS_TRANSPORT_SIZE_OUTBOUND_MESSAGE), but we're going
- * to be more conservative for now.
+ * to be more conservative for now.
*/
#define GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE (63 * 1024)
/**
* Create a fresh MetaData token.
- *
+ *
* @return empty meta-data container
*/
struct GNUNET_CONTAINER_MetaData *
/**
* Duplicate a MetaData token.
- *
+ *
* @param md what to duplicate
* @return duplicate meta-data container
*/
* used in the main libextractor library and yielding
* 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);
* can be NULL (if mime-type is not known)
* @param data actual meta-data found
/**
* Removes a node from the heap.
- *
+ *
* @param node node to remove
* @return element data stored at the node, NULL if heap is empty
*/
/**
- * Handle to a singly linked list
+ * Handle to a singly linked list
*/
struct GNUNET_CONTAINER_SList;
/**
- * Handle to a singly linked list iterator
+ * Handle to a singly linked list iterator
*/
struct GNUNET_CONTAINER_SList_Iterator;
* can be used to improve efficiency, ignored if inbound_notify is NULL
* note that the core is allowed to drop notifications about inbound
* 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 outbound_notify function to call for all outbound messages, can be NULL;
* note that the core is allowed to drop notifications about outbound
* messages if the client does not process them fast enough (for this
/**
- * Disconnect from the core service. This function can only
+ * Disconnect from the core service. This function can only
* be called *after* all pending 'GNUNET_CORE_notify_transmit_ready'
* requests have been explicitly cancelled.
*
/**
* Cancel request for getting information about a peer.
* Note that an eventual change in preference, trust or bandwidth
- * assignment MAY have already been committed at the time,
+ * assignment MAY have already been committed at the time,
* so cancelling a request is NOT sure to undo the original
* request. The original request may or may not still commit.
* The only thing cancellation ensures is that the callback
* given number of bytes to the specified "target". Must only be
* called after a connection to the respective peer has been
* established (and the client has been informed about this).
- *
+ *
*
* @param handle connection to core service
* @param cork is corking allowed for this transmission?
/**
- * Random on unsigned 64-bit values.
+ * Random on unsigned 64-bit values.
*
* @param mode desired quality of the random number
* @param max value returned will be in range [0,max) (exclusive)
*
* @param a some hash code
* @param b some hash code
- * @param result set to b - a
+ * @param result set to b - a
*/
void
GNUNET_CRYPTO_hash_difference (const GNUNET_HashCode * a,
*
* @param a some hash code
* @param b some hash code
- * @param result set to a ^ b
+ * @param result set to a ^ b
*/
void
GNUNET_CRYPTO_hash_xor (const GNUNET_HashCode * a, const GNUNET_HashCode * b,
* 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.
+ * 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.
/**
* This function should only be called in testcases
* where strong entropy gathering is not desired
- * (for example, for hostkey generation).
+ * (for example, for hostkey generation).
*/
void
GNUNET_CRYPTO_random_disable_entropy_gathering (void);
/**
* Function called by plugins to notify the datacache
* about content deletions.
- *
+ *
* @param cls closure
* @param key key of the content that was deleted
* @param size number of bytes that were made available
/**
* Delete the entry with the lowest expiration value
* from the datacache right now.
- *
+ *
* @param cls closure (internal context for the plugin)
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
* changes.
*
* @param cls closure
- * @param delta change in disk utilization,
+ * @param delta change in disk utilization,
* 0 for "reset to empty"
*/
typedef void (*DiskUtilizationChange) (void *cls, int delta);
* Get one of the results for a particular key in the datastore.
*
* @param cls closure
- * @param offset offset of the result (modulo num-results);
+ * @param offset offset of the result (modulo num-results);
* specific ordering does not matter for the offset
* @param key key to match, never NULL
* @param vhash hash of the value, maybe NULL (to
* there may be!
* @param type entries of which type are relevant?
* Use 0 for any type.
- * @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
* @param proc_cls closure for proc
*/
/**
* Select a single item from the datastore at the specified offset
- * (among those applicable).
+ * (among those applicable).
*
* @param cls closure
- * @param offset offset of the result (modulo num-results);
+ * @param offset offset of the result (modulo num-results);
* specific ordering does not matter for the offset
* @param type entries of which type should be considered?
* Must not be zero (ANY).
/**
* Cancel a datastore operation. The final callback from the
* operation must not have been done yet.
- *
+ *
* @param qe operation to cancel
*/
void
{
/**
- * Open the file for reading
+ * Open the file for reading
*/
GNUNET_DISK_OPEN_READ = 1,
/**
- * Open the file for writing
+ * Open the file for writing
*/
GNUNET_DISK_OPEN_WRITE = 2,
/**
- * Open the file for both reading and writing
+ * Open the file for both reading and writing
*/
GNUNET_DISK_OPEN_READWRITE = 3,
/**
- * Fail if file already exists
+ * Fail if file already exists
*/
GNUNET_DISK_OPEN_FAILIFEXISTS = 4,
/**
- * Truncate file if it exists
+ * Truncate file if it exists
*/
GNUNET_DISK_OPEN_TRUNCATE = 8,
/**
- * Create file if it doesn't exist
+ * Create file if it doesn't exist
*/
GNUNET_DISK_OPEN_CREATE = 16,
/**
- * Append to the file
+ * Append to the file
*/
GNUNET_DISK_OPEN_APPEND = 32
};
* 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
* filename.
- *
+ *
* @param t component to use for the name;
* does NOT contain "XXXXXX" or "/tmp/".
* @return NULL on error, otherwise name of fresh
* @param fn file name
* @param buffer the data to write
* @param n number of bytes to write
- * @param mode file permissions
+ * @param mode file permissions
* @return number of bytes written on success, GNUNET_SYSERR on error
*/
ssize_t
* Create a defragmentation context.
*
* @param stats statistics context
- * @param mtu the maximum message size for each fragment
+ * @param mtu the maximum message size for each fragment
* @param num_msgs how many fragmented messages
* to we defragment at most at the same time?
* @param cls closure for proc and ackp
*/
/**
* @file include/gnunet_fs_service.h
- * @brief API for file-sharing via GNUnet
+ * @brief API for file-sharing via GNUnet
* @author Christian Grothoff
*/
#ifndef GNUNET_FS_LIB_H
* Convert keyword URI to a human readable format
* (i.e. the search query that was used in the first place)
*
- * @param uri ksk uri to convert to a string
+ * @param uri ksk uri to convert to a string
* @return string with the keywords
*/
char *
* as decapitalization and removal of certain characters.
* (useful for search).
*
- * @param uri the URI to canonicalize
+ * @param uri the URI to canonicalize
* @return canonicalized version of the URI, NULL on error
*/
struct GNUNET_FS_Uri *
/**
- * Possible status codes used in the callback for the
+ * Possible status codes used in the callback for the
* various file-sharing operations. On each file (or search),
* the callback is guaranteed to be called once with "START"
* and once with STOPPED; calls with PROGRESS, ERROR or COMPLETED
* are optional and depend on the circumstances; parent operations
* will be STARTED before child-operations and STOPPED after
- * their respective child-operations. START and STOP signals
+ * their respective child-operations. START and STOP signals
* are typically generated either due to explicit client requests
* or because of suspend/resume operations.
*/
GNUNET_FS_STATUS_DOWNLOAD_LOST_PARENT,
/**
- * First event generated when a client requests
+ * First event generated when a client requests
* a search to begin or when a namespace result
* automatically triggers the search for updates.
*/
/**
* How large is the file overall? For directories,
* this is only the size of the directory itself,
- * not of the other files contained within the
+ * not of the other files contained within the
* directory.
*/
uint64_t size;
uint64_t data_len;
/**
- * Depth of the given block in the tree;
+ * Depth of the given block in the tree;
* 0 would be the lowest level (DBLOCKs).
*/
unsigned int depth;
/**
* Client context pointer for the associated search operation
* (specifically, context pointer for the specific search
- * result, not the overall search); only set if this
+ * result, not the overall search); only set if this
* download was started from a search result.
*/
void *sctx;
uint64_t data_len;
/**
- * Depth of the given block in the tree;
+ * Depth of the given block in the tree;
* 0 would be the lowest level (DBLOCKS).
*/
unsigned int depth;
* These values are only valid for
* GNUNET_FS_STATUS_SEARCH_RESULT_SUSPEND events.
* These events are automatically triggered for
- * each search result before the
+ * each search result before the
* GNUNET_FS_STATUS_SEARCH_SUSPEND event. This
* happens primarily to give the client a chance
* to clean up the "cctx" (if needed).
* These values are only valid for
* GNUNET_FS_STATUS_SEARCH_RESULT_STOPPED events.
* These events are automatically triggered for
- * each search result before the
+ * each search result before the
* GNUNET_FS_STATUS_SEARCH_STOPPED event. This
* happens primarily to give the client a chance
* to clean up the "cctx" (if needed).
uint64_t data_len;
/**
- * Depth of the given block in the tree;
+ * Depth of the given block in the tree;
* 0 would be the lowest level (DBLOCKS).
*/
unsigned int depth;
/**
- * Notification of FS to a client about the progress of an
+ * Notification of FS to a client about the progress of an
* operation. Callbacks of this type will be used for uploads,
- * downloads and searches. Some of the arguments depend a bit
+ * downloads and searches. Some of the arguments depend a bit
* in their meaning on the context in which the callback is used.
*
* @param cls closure
* Setup a connection to the file-sharing service.
*
* @param cfg configuration to use
- * @param client_name unique identifier for this client
+ * @param client_name unique identifier for this client
* @param upcb function to call to notify about FS actions
* @param upcb_cls closure for upcb
* @param flags specific attributes for fs-operations
* @param offset offset to read from; it is possible
* that the caller might need to go backwards
* a bit at times
- * @param max maximum number of bytes that should be
+ * @param max maximum number of bytes that should be
* copied to buf; readers are not allowed
* to provide less data unless there is an error;
* a value of "0" will be used at the end to allow
* @param h handle to the file sharing subsystem
* @param client_info initial client-info value for this entry
* @param length length of the file
- * @param reader function that can be used to obtain the data for the file
+ * @param reader function that can be used to obtain the data for the file
* @param reader_cls closure for "reader"
* @param keywords under which keywords should this file be available
* directly; can be NULL
* for each entry in the directory.
*
* @param cls closure
- * @param filename name of the file (including path); must end
+ * @param filename name of the file (including path); must end
* in a "/" (even on W32) if this is a directory
* @param fi information about the file (should not be
* used henceforth by the caller)
/**
* Type of a function that will be used to scan a directory.
- *
+ *
* @param cls closure
* @param h handle to the file sharing subsystem
* @param dirname name of the directory to scan
*
* @param dir the directory
* @param ent the entry to add; the entry must not have been
- * added to any other directory at this point and
+ * added to any other directory at this point and
* must not include "dir" in its structure
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
* @param namespace namespace to publish the file in, NULL for no namespace
* @param nid identifier to use for the publishd content in the namespace
* (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)
- * @param options options for the publication
+ * @param options options for the publication
* @return context that can be used to control the publish operation
*/
struct GNUNET_FS_PublishContext *
/**
- * 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
* simply clean up the state for completed publications.
* Must NOT be called from within the event callback!
* @param h handle to the file sharing subsystem
* @param filename file to unindex
* @param cctx initial value for the client context
- * @return NULL on error, otherwise handle
+ * @return NULL on error, otherwise handle
*/
struct GNUNET_FS_UnindexContext *
GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h, const char *filename,
/**
- * Publish an advertismement for a namespace.
+ * Publish an advertismement for a namespace.
*
* @param h handle to the file sharing subsystem
* @param ksk_uri keywords to use for advertisment
* Function called on updateable identifiers.
*
* @param cls closure
- * @param last_id last identifier
+ * @param last_id last identifier
* @param last_uri uri used for the content published under the last_id
* @param last_meta metadata associated with last_uri
* @param next_id identifier that should be used for updates
* produce an update. Namespace updates form a graph where each node
* has a name. Each node can have any number of URI/meta-data entries
* which can each be linked to other nodes. Cycles are possible.
- *
+ *
* Calling this function with "next_id" NULL will cause the library to
* 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
* are reachable).
- *
+ *
* 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
* that cycles within an SCC are possible (including self-loops).
/**
- * Pause search.
+ * Pause search.
*
* @param sc context for the search that should be paused
*/
/**
* Set the MIMETYPE information for the given
* metadata to "application/gnunet-directory".
- *
+ *
* @param md metadata to add mimetype to
*/
void
/**
* Suggest a filename based on given metadata.
- *
+ *
* @param md given meta data
* @return NULL if meta data is useless for suggesting a filename
*/
/**
* Create a directory builder.
- *
+ *
* @param mdir metadata for the directory
*/
struct GNUNET_FS_DirectoryBuilder *
/**
* Add an entry to a directory.
- *
+ *
* @param bld directory to extend
* @param uri uri of the entry (must not be a KSK)
* @param md metadata of the entry
/**
- * Set an option of type 'int' from the command line to 1 if the
+ * Set an option of type 'int' from the command line to 1 if the
* given option is present.
* A pointer to this function should be passed as part of the
* 'struct GNUNET_GETOPT_CommandLineOption' array to initialize options
* @param scls additional closure (will point to the 'int')
* @param option name of the option
* @param value not used (NULL)
- * @return GNUNET_OK
+ * @return GNUNET_OK
*/
int
GNUNET_GETOPT_set_one (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
* which will be allocated)
* @param option name of the option
* @param value actual value of the option (a string)
- * @return GNUNET_OK
+ * @return GNUNET_OK
*/
int
GNUNET_GETOPT_set_string (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
* @param scls additional closure (will point to the 'int')
* @param option name of the option
* @param value not used (NULL)
- * @return GNUNET_OK
+ * @return GNUNET_OK
*/
int
GNUNET_GETOPT_increment_value (struct GNUNET_GETOPT_CommandLineProcessorContext
* @param h2 the second HELLO message
* @param now time to use for deciding which addresses have
* expired and should not be considered at all
- * @return absolute time forever if the two HELLOs are
+ * @return absolute time forever if the two HELLOs are
* totally identical; smallest timestamp >= now if
- * they only differ in timestamps;
+ * they only differ in timestamps;
* zero if the some addresses with expirations >= now
* do not match at all
*/
* messages if the client does not process them fast enough (for this
* notification type, a bounded queue is used)
* @param stypes Application Types the client claims to offer
- * @return handle to the mesh service
+ * @return handle to the mesh service
* NULL on error (in this case, init is never called)
*/
struct GNUNET_MESH_Handle *
/**
* Get the peer on the other side of this tunnel if it is just one. Return NULL otherwise
- *
+ *
* @param tunnel the tunnel
* @return the peer or NULL
*/
/**
* Cancel a pending request to connect to a particular peer. Destroys the
- * tunnel.
+ * tunnel.
*
* @param req request handle that was returned for the original request
*/
* @param cork is corking allowed for this transmission?
* @param priority how important is the message?
* @param maxdelay how long can the message wait?
- * @param target destination for the message, NULL for multicast to all tunnel targets
+ * @param target destination for the message, NULL for multicast to all tunnel targets
* @param notify_size how many bytes of buffer space does notify want?
* @param notify function to call when buffer space is available;
* will be called with NULL on timeout or if the overall queue
/**
* 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.
*
* @param tunnel tunnel to use for 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 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 function to call when buffer space is available;
* will be called with NULL on timeout or if the overall queue
* @param reversal_callback function to call if someone wants connection reversal from us,
* NULL if connection reversal is not supported
* @param callback_cls closure for callback
- * @return NULL on error, otherwise handle that can be used to unregister
+ * @return NULL on error, otherwise handle that can be used to unregister
*/
struct GNUNET_NAT_Handle *
GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, int is_tcp,
*
* @param cls closure
* @param success GNUNET_OK on success, GNUNET_NO on failure,
- * GNUNET_SYSERR if the test could not be
+ * GNUNET_SYSERR if the test could not be
* properly started (internal failure)
*/
typedef void (*GNUNET_NAT_TestCallback) (void *cls, int success);
* general-purpose 'GNUNET_NAT_register' code). However, it can be
* used if specifically UPnP-based NAT traversal is to be used or
* tested.
- *
+ *
* @param port port to map
* @param is_tcp GNUNET_YES to map TCP, GNUNET_NO for UDP
* @param ac function to call with mapping result
* this function will give 'upnpc' 1s to remove tha mapping,
* so while this function is non-blocking, a task will be
* left with the scheduler for up to 1s past this call.
- *
+ *
* @param mini the handle
*/
void
* Convert the logarithmic estimated returned to the 'GNUNET_NSE_Callback'
* into an absolute estimate in terms of the number of peers in the network.
*
- * @param loge logarithmic estimate
+ * @param loge logarithmic estimate
* @return absolute number of peers in the network (estimated)
*/
#define GNUNET_NSE_log_estimate_to_n(loge) pow(2.0, (loge))
* PATH environment variable as a search path.
*
* @param binary the name of the file to check
- * @return GNUNET_YES if the file is SUID,
+ * @return GNUNET_YES if the file is SUID,
* GNUNET_NO if not SUID (but binary exists)
* GNUNET_SYSERR on error (no such binary or not executable)
*/
/**
* Decrement multiple RCs of peer identities by one.
- *
+ *
* @param ids array of PIDs to decrement the RCs of
* @param count size of the ids array
*/
/**
- * Add a host to the persistent list. This method operates in
+ * Add a host to the persistent list. This method operates in
* semi-reliable mode: if the transmission is not completed by
* the time 'GNUNET_PEERINFO_disconnect' is called, it will be
* aborted. Furthermore, if a second HELLO is added for the
* host and then finally once with a NULL pointer. After that final
* invocation, the iterator context must no longer be used.
*
- * Instead of calling this function with 'peer == NULL'
+ * Instead of calling this function with 'peer == NULL'
* it is often better to use 'GNUNET_PEERINFO_notify'.
- *
+ *
* @param h handle to the peerinfo service
* @param peer restrict iteration to this peer only (can be NULL)
* @param timeout how long to wait until timing out
* @param callback the method to call for each peer
* @param callback_cls closure for callback
- * @return NULL on error (in this case, 'callback' is never called!),
+ * @return NULL on error (in this case, 'callback' is never called!),
* otherwise an iterator context
*/
struct GNUNET_PEERINFO_IteratorContext *
* Test if a plugin exists.
*
* Note that the library must export a symbol called
- * "library_name_init" for the test to succeed.
+ * "library_name_init" for the test to succeed.
*
* @param library_name name of the plugin to test if it is installed
* @return GNUNET_YES if the plugin exists, GNUNET_NO if not
#endif
/*******************************************************************************
- * UTIL message types
+ * UTIL message types
******************************************************************************/
/**
#define GNUNET_MESSAGE_TYPE_TEST 1
/*******************************************************************************
- * RESOLVER message types
+ * RESOLVER message types
******************************************************************************/
/**
#define GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE 5
/*******************************************************************************
- * ARM message types
+ * ARM message types
******************************************************************************/
/**
#define GNUNET_MESSAGE_TYPE_ARM_SHUTDOWN_ACK 14
/*******************************************************************************
- * HELLO message types
+ * HELLO message types
******************************************************************************/
/**
#define GNUNET_MESSAGE_TYPE_HELLO 16
/*******************************************************************************
- * FRAGMENTATION message types
+ * FRAGMENTATION message types
******************************************************************************/
/**
#define GNUNET_MESSAGE_TYPE_FRAGMENT_ACK 19
/*******************************************************************************
- * TRANSPORT message types
+ * TRANSPORT message types
******************************************************************************/
/**
#define GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE 39
/*******************************************************************************
- * Transport-WLAN message types
+ * Transport-WLAN message types
******************************************************************************/
/**
/*******************************************************************************
- * Transport-DV message types
+ * Transport-DV message types
******************************************************************************/
/**
#define GNUNET_MESSAGE_TYPE_DV_DISCONNECT 50
/*******************************************************************************
- * Transport-UDP message types
+ * Transport-UDP message types
******************************************************************************/
/**
#define GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_ACK 57
/*******************************************************************************
- * Transport-TCP message types
+ * Transport-TCP message types
******************************************************************************/
/**
#define GNUNET_MESSAGE_TYPE_TRANSPORT_ATS 62
/*******************************************************************************
- * NAT message types
+ * NAT message types
******************************************************************************/
/**
#define GNUNET_MESSAGE_TYPE_NAT_TEST 63
/*******************************************************************************
- * CORE message types
+ * CORE message types
******************************************************************************/
/**
#define GNUNET_MESSAGE_TYPE_CORE_BINARY_TYPE_MAP 87
/*******************************************************************************
- * DATASTORE message types
+ * DATASTORE message types
******************************************************************************/
/**
/*******************************************************************************
- * FS message types
+ * FS message types
******************************************************************************/
/**
/*******************************************************************************
- * DHT message types
+ * DHT message types
******************************************************************************/
/**
#define GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_DROP 156
/*******************************************************************************
- * HOSTLIST message types
+ * HOSTLIST message types
******************************************************************************/
/**
/*******************************************************************************
- * STATISTICS message types
+ * STATISTICS message types
******************************************************************************/
/**
/*******************************************************************************
- * VPN message types
+ * VPN message types
******************************************************************************/
/**
/*******************************************************************************
- * VPN-DNS message types
+ * VPN-DNS message types
******************************************************************************/
/**
/**
* List all known pseudonyms.
*
- * @param cfg overall configuration
+ * @param cfg overall configuration
* @param iterator function to call for each pseudonym
* @param closure closure for iterator
* @return number of pseudonyms found
/**
* Obtain the reason code for why the current task was
- * started. Will return the same value as
+ * started. Will return the same value as
* the GNUNET_SCHEDULER_TaskContext's reason field.
*
* * @return reason(s) why the current task is run
* @param access function for access control
* @param access_cls closure for access
* @param serverAddr address toes listen on (including port), NULL terminated array
- * @param socklen lengths of respective serverAddr
+ * @param socklen lengths of respective serverAddr
* @param idle_timeout after how long should we timeout idle connections?
* @param require_found if YES, connections sending messages of unknown type
* will be closed
* Ask the server to notify us whenever a client disconnects.
* This function is called whenever the actual network connection
* is closed; the reference count may be zero or larger than zero
- * at this point. If the server is destroyed before this
+ * at this point. If the server is destroyed before this
* notification is explicitly cancelled, the 'callback' will
* once be called with a 'client' argument of NULL to indicate
* that the server itself is now gone (and that the callback
* can be NULL (will be passed back to 'cb')
* @param buf input data to add
* @param size number of bytes in buf
- * @param purge should any excess bytes in the buffer be discarded
+ * @param purge should any excess bytes in the buffer be discarded
* (i.e. for packet-based services like UDP)
* @param one_shot only call callback once, keep rest of message in buffer
* @return GNUNET_OK if we are done processing (need more data)
/**
- * Cancel a 'get' request. Must be called before the 'cont'
+ * Cancel a 'get' request. Must be called before the 'cont'
* function is called.
*
* @param gh handle of the request to cancel
/**
- * Calculate the estimate time of arrival/completion
+ * Calculate the estimate time of arrival/completion
* for an operation.
*
* @param start when did the operation start?
/**
* Convert relative time to network byte order.
- *
+ *
* @param a time to convert
* @return converted time value
*/
* use NULL wherever a session pointer is needed. This function
* should be called BEFORE a potential "TransmitContinuation"
* from the "TransmitFunction".
- *
+ *
* @param cls closure
- * @param peer which peer was the session for
+ * @param peer which peer was the session for
* @param session which session is being destoyed
*/
typedef void (*GNUNET_TRANSPORT_SessionEnd) (void *cls,
/**
* Function called for a quick conversion of the binary address to
- * a numeric address. Note that the caller must not free the
+ * a numeric address. Note that the caller must not free the
* address and that the next call to this function is allowed
* to override the address again.
*
* @param cls closure
* @param addr binary address
* @param addr_len length of the address
- * @return string representing the same address
+ * @return string representing the same address
*/
typedef const char *(*GNUNET_TRANSPORT_AddressToString) (void *cls,
const void *addr,
/**
* Function that can be used to force the plugin to disconnect from
* the given peer and cancel all previous transmissions (and their
- * continuations).
+ * continuations).
*/
GNUNET_TRANSPORT_DisconnectFunction disconnect;
/**
- * Ask the transport service to establish a connection to
+ * Ask the transport service to establish a connection to
* the given peer.
*
* @param handle connection to transport service
* @param cfg configuration to use
* @param address address to convert (binary format)
* @param addressLen number of bytes in address
- * @param numeric should (IP) addresses be displayed in numeric form
+ * @param numeric should (IP) addresses be displayed in numeric form
* (otherwise do reverse DNS lookup)
* @param nameTrans name of the transport to which the address belongs
* @param timeout how long is the lookup allowed to take at most
* - MESH LOCAL HANDLER HELPERS
* - MESH LOCAL HANDLES
* - MAIN FUNCTIONS (main & run)
- *
+ *
* TODO:
* - error reporting (CREATE/CHANGE/ADD/DEL?) -- new message!
* - partial disconnect reporting -- same as error reporting?
/**
* Periodically announce what applications are provided by local clients
- *
+ *
* @param cls closure
* @param tc task context
*/
/**
* Periodically announce self id in the DHT
- *
+ *
* @param cls closure
* @param tc task context
*/
/**
* Send the message to all clients that have subscribed to its type
- *
+ *
* @param msg Pointer to the message itself
* @return number of clients this message was sent to
*/
struct MeshPeerInfo *orig_peer_info;
struct MeshTunnel *t;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: Received a MESH path create msg\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "MESH: Received a MESH path create msg\n");
size = ntohs (message->size);
if (size < sizeof (struct GNUNET_MESH_ManipulatePath))
{
/**
* Handler for new clients
- *
+ *
* @param cls closure
* @param client identification of the client
* @param message the actual message, which includes messages the client wants
}
}
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: client has %u+%u subscriptions\n",
- c->type_counter, c->app_counter);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "MESH: client has %u+%u subscriptions\n", c->type_counter,
+ c->app_counter);
GNUNET_CONTAINER_DLL_insert (clients, clients_tail, c);
c->tunnels = GNUNET_CONTAINER_multihashmap_create (32);
/**
* Handler for requests of new tunnels
- *
+ *
* @param cls closure
* @param client identification of the client
* @param message the actual message
/**
* Handler for requests of deleting tunnels
- *
+ *
* @param cls closure
* @param client identification of the client
* @param message the actual message
/**
* Handler for connection requests to new peers
- *
+ *
* @param cls closure
* @param client identification of the client
* @param message the actual message (PeerControl)
/**
* Handler for disconnection requests of peers in a tunnel
- *
+ *
* @param cls closure
* @param client identification of the client
* @param message the actual message (PeerControl)
/**
* Handler for connection requests to new peers by type
- *
+ *
* @param cls closure
* @param client identification of the client
* @param message the actual message (ConnectPeerByType)
/**
* Handler for client traffic directed to one peer
- *
+ *
* @param cls closure
* @param client identification of the client
* @param message the actual message
/**
* Handler for client traffic directed to all peers in a tunnel
- *
+ *
* @param cls closure
* @param client identification of the client
* @param message the actual message
GNUNET_SERVER_notification_context_destroy (nc);
nc = NULL;
}
- if (0 != announce_id_task) {
- GNUNET_SCHEDULER_cancel(announce_id_task);
- announce_id_task = 0;
+ if (0 != announce_id_task)
+ {
+ GNUNET_SCHEDULER_cancel (announce_id_task);
+ announce_id_task = 0;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: shut down\n");
}
/* Any API call should be documented in the folowing table under API CALL.
* Also, any message type should be documented in the following table, with the
* associated event.
- *
+ *
* API CALL (GNUNET_MESH_*) MESSAGE USED
* ------------------------ ------------
* connect GNUNET_MESH_ClientConnect
*
* notify_transmit_ready *GNUNET_MESH_TransmitReady?*
* notify_transmit_ready_cancel None (clear of internal data structures)
- *
- *
- *
+ *
+ *
+ *
* EVENT MESSAGE USED
* ----- ------------
* data GNUNET_MESH_Data OR
* (client to service, client created tunnel)
* GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_[CONNECTED|DISCONNECTED]
* (service to client)
- *
- * Size: sizeof(struct GNUNET_MESH_PeerControl)
+ *
+ * Size: sizeof(struct GNUNET_MESH_PeerControl)
*/
struct GNUNET_MessageHeader header;
MESH_TunnelNumber tunnel_id GNUNET_PACKED;
/**
- * Type specification
+ * Type specification
*/
GNUNET_MESH_ApplicationType type GNUNET_PACKED;
};
* @param cork is corking allowed for this transmission?
* @param priority how important is the message?
* @param maxdelay how long can the message wait?
- * @param target destination for the message, NULL for multicast to all tunnel targets
+ * @param target destination for the message, NULL for multicast to all tunnel targets
* @param notify_size how many bytes of buffer space does notify want?
* @param notify function to call when buffer space is available;
* will be called with NULL on timeout or if the overall queue
* @file mesh/mesh_api_new.c
* @brief mesh api: client implementation of mesh service
* @author Bartlomiej Polot
- *
+ *
* STRUCTURE:
* - CONSTANTS
* - DATA STRUCTURES
/**
* Process the new tunnel notification and add it to the tunnels in the handle
- *
+ *
* @param h The mesh handle
* @param msg A message with the details of the new incoming tunnel
*/
process_tunnel_create (struct GNUNET_MESH_Handle *h,
const struct GNUNET_MESH_TunnelMessage *msg)
{
- struct GNUNET_MESH_Tunnel *t;
- MESH_TunnelNumber tid;
+ struct GNUNET_MESH_Tunnel *t;
+ MESH_TunnelNumber tid;
- tid = ntohl (msg->tunnel_id);
- if (tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_MARK)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "MESH: received an incoming tunnel with tid in local range (%X)\n",
- tid);
- GNUNET_break_op (0);
- return; //FIXME abort? reconnect?
- }
- t = GNUNET_malloc (sizeof (struct GNUNET_MESH_Tunnel));
- t->cls = h->cls;
- t->mesh = h;
- t->tid = tid;
+ tid = ntohl (msg->tunnel_id);
+ if (tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_MARK)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "MESH: received an incoming tunnel with tid in local range (%X)\n",
+ tid);
+ GNUNET_break_op (0);
+ return; //FIXME abort? reconnect?
+ }
+ t = GNUNET_malloc (sizeof (struct GNUNET_MESH_Tunnel));
+ t->cls = h->cls;
+ t->mesh = h;
+ t->tid = tid;
- return;
+ return;
}
/**
* Process the new peer event and notify the upper level of it
- *
+ *
* @param h The mesh handle
* @param msg A message with the details of the peer event
*/
process_peer_event (struct GNUNET_MESH_Handle *h,
const struct GNUNET_MESH_PeerControl *msg)
{
- struct GNUNET_MESH_Tunnel *t;
- uint16_t size;
+ struct GNUNET_MESH_Tunnel *t;
+ uint16_t size;
- size = ntohs (msg->header.size);
- if (size != sizeof (struct GNUNET_MESH_PeerControl))
- {
- GNUNET_break_op (0);
- return;
- }
- t = retrieve_tunnel (h, ntohl (msg->tunnel_id));
- if (NULL == t)
- {
- GNUNET_break_op (0);
- return;
- }
- if (GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_CONNECTED == msg->header.type)
+ size = ntohs (msg->header.size);
+ if (size != sizeof (struct GNUNET_MESH_PeerControl))
+ {
+ GNUNET_break_op (0);
+ return;
+ }
+ t = retrieve_tunnel (h, ntohl (msg->tunnel_id));
+ if (NULL == t)
+ {
+ GNUNET_break_op (0);
+ return;
+ }
+ if (GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_CONNECTED == msg->header.type)
+ {
+ if (NULL != t->connect_handler)
{
- if (NULL != t->connect_handler)
- {
- t->connect_handler (t->cls, &msg->peer, NULL); /* FIXME atsi */
- }
+ t->connect_handler (t->cls, &msg->peer, NULL); /* FIXME atsi */
}
- else
+ }
+ else
+ {
+ if (NULL != t->disconnect_handler)
{
- if (NULL != t->disconnect_handler)
- {
- t->disconnect_handler (t->cls, &msg->peer);
- }
+ t->disconnect_handler (t->cls, &msg->peer);
}
+ }
}
/**
* Process the incoming data packets
- *
+ *
* @param h The mesh handle
* @param msh A message encapsulating the data
*/
process_incoming_data (struct GNUNET_MESH_Handle *h,
const struct GNUNET_MessageHeader *message)
{
- const struct GNUNET_MessageHeader *payload;
- const struct GNUNET_MESH_MessageHandler *handler;
- const struct GNUNET_PeerIdentity *peer;
- struct GNUNET_MESH_Unicast *ucast;
- struct GNUNET_MESH_Multicast *mcast;
- struct GNUNET_MESH_ToOrigin *to_orig;
- struct GNUNET_MESH_Tunnel *t;
- uint16_t type;
- int i;
-
- type = ntohs (message->type);
- switch (type)
- {
- case GNUNET_MESSAGE_TYPE_MESH_UNICAST:
- ucast = (struct GNUNET_MESH_Unicast *) message;
- t = retrieve_tunnel (h, ntohl (ucast->tid));
- payload = (struct GNUNET_MessageHeader *) &ucast[1];
- peer = &ucast->oid;
- break;
- case GNUNET_MESSAGE_TYPE_MESH_MULTICAST:
- mcast = (struct GNUNET_MESH_Multicast *) message;
- t = retrieve_tunnel (h, ntohl (mcast->tid));
- payload = (struct GNUNET_MessageHeader *) &mcast[1];
- peer = &mcast->oid;
- break;
- case GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN:
- to_orig = (struct GNUNET_MESH_ToOrigin *) message;
- t = retrieve_tunnel (h, ntohl (to_orig->tid));
- payload = (struct GNUNET_MessageHeader *) &to_orig[1];
- peer = &to_orig->sender;
- break;
- default:
- GNUNET_break_op (0);
- return;
- }
- if (NULL == t)
- {
- GNUNET_break_op (0);
- return;
- }
- for (i = 0; i < h->n_handlers; i++)
+ const struct GNUNET_MessageHeader *payload;
+ const struct GNUNET_MESH_MessageHandler *handler;
+ const struct GNUNET_PeerIdentity *peer;
+ struct GNUNET_MESH_Unicast *ucast;
+ struct GNUNET_MESH_Multicast *mcast;
+ struct GNUNET_MESH_ToOrigin *to_orig;
+ struct GNUNET_MESH_Tunnel *t;
+ uint16_t type;
+ int i;
+
+ type = ntohs (message->type);
+ switch (type)
+ {
+ case GNUNET_MESSAGE_TYPE_MESH_UNICAST:
+ ucast = (struct GNUNET_MESH_Unicast *) message;
+ t = retrieve_tunnel (h, ntohl (ucast->tid));
+ payload = (struct GNUNET_MessageHeader *) &ucast[1];
+ peer = &ucast->oid;
+ break;
+ case GNUNET_MESSAGE_TYPE_MESH_MULTICAST:
+ mcast = (struct GNUNET_MESH_Multicast *) message;
+ t = retrieve_tunnel (h, ntohl (mcast->tid));
+ payload = (struct GNUNET_MessageHeader *) &mcast[1];
+ peer = &mcast->oid;
+ break;
+ case GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN:
+ to_orig = (struct GNUNET_MESH_ToOrigin *) message;
+ t = retrieve_tunnel (h, ntohl (to_orig->tid));
+ payload = (struct GNUNET_MessageHeader *) &to_orig[1];
+ peer = &to_orig->sender;
+ break;
+ default:
+ GNUNET_break_op (0);
+ return;
+ }
+ if (NULL == t)
+ {
+ GNUNET_break_op (0);
+ return;
+ }
+ for (i = 0; i < h->n_handlers; i++)
+ {
+ handler = &h->message_handlers[i];
+ if (handler->type == type)
{
- handler = &h->message_handlers[i];
- if (handler->type == type)
- {
- if (GNUNET_OK == handler->callback (h->cls, t, NULL, /* FIXME ctx */
- peer, payload, NULL)) /* FIXME atsi */
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "MESH: callback completed successfully\n");
- }
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "MESH: callback caused disconnection\n");
- GNUNET_MESH_disconnect (h);
- }
- }
+ if (GNUNET_OK == handler->callback (h->cls, t, NULL, /* FIXME ctx */
+ peer, payload, NULL)) /* FIXME atsi */
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "MESH: callback completed successfully\n");
+ }
+ else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "MESH: callback caused disconnection\n");
+ GNUNET_MESH_disconnect (h);
+ }
}
- return;
+ }
+ return;
}
static void
msg_received (void *cls, const struct GNUNET_MessageHeader *msg)
{
- struct GNUNET_MESH_Handle *h = cls;
+ struct GNUNET_MESH_Handle *h = cls;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "mesh: received a message from MESH\n");
- if (msg == NULL)
- {
- GNUNET_break_op (0);
- return;
- }
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: received a message from MESH\n");
+ if (msg == NULL)
+ {
+ GNUNET_break_op (0);
+ return;
+ }
- switch (ntohs (msg->type))
- {
- /* Notify of a new incoming tunnel */
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATE:
- process_tunnel_create (h, (struct GNUNET_MESH_TunnelMessage *) msg);
- break;
- /* Notify of a new peer or a peer disconnect in the tunnel */
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_CONNECTED:
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_DISCONNECTED:
- process_peer_event (h, (struct GNUNET_MESH_PeerControl *) msg);
- break;
- /* Notify of a new data packet in the tunnel */
- case GNUNET_MESSAGE_TYPE_MESH_UNICAST:
- case GNUNET_MESSAGE_TYPE_MESH_MULTICAST:
- case GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN:
- process_incoming_data (h, msg);
- break;
- /* We shouldn't get any other packages, log and ignore */
- default:
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "MESH: unsolicited message form service (type %d)\n",
- ntohs (msg->type));
- }
+ switch (ntohs (msg->type))
+ {
+ /* Notify of a new incoming tunnel */
+ case GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATE:
+ process_tunnel_create (h, (struct GNUNET_MESH_TunnelMessage *) msg);
+ break;
+ /* Notify of a new peer or a peer disconnect in the tunnel */
+ case GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_CONNECTED:
+ case GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_DISCONNECTED:
+ process_peer_event (h, (struct GNUNET_MESH_PeerControl *) msg);
+ break;
+ /* Notify of a new data packet in the tunnel */
+ case GNUNET_MESSAGE_TYPE_MESH_UNICAST:
+ case GNUNET_MESSAGE_TYPE_MESH_MULTICAST:
+ case GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN:
+ process_incoming_data (h, msg);
+ break;
+ /* We shouldn't get any other packages, log and ignore */
+ default:
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "MESH: unsolicited message form service (type %d)\n",
+ ntohs (msg->type));
+ }
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: message processed\n");
- GNUNET_CLIENT_receive (h->client, &msg_received, h,
- GNUNET_TIME_UNIT_FOREVER_REL);
- return;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: message processed\n");
+ GNUNET_CLIENT_receive (h->client, &msg_received, h,
+ GNUNET_TIME_UNIT_FOREVER_REL);
+ return;
}
static size_t
send_connect_packet (void *cls, size_t size, void *buf)
{
- struct GNUNET_MESH_Handle *h = cls;
- struct GNUNET_MESH_ClientConnect *msg;
- GNUNET_MESH_ApplicationType *apps;
- uint16_t napps;
- uint16_t *types;
- uint16_t ntypes;
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "mesh: Send connect packet()\n", size);
- h->th = NULL;
- if (0 == size || NULL == buf)
- {
- // FIXME: disconnect, reconnect, retry?
- return 0;
- }
- if (sizeof (struct GNUNET_MessageHeader) > size)
- {
- GNUNET_break(0);
- // FIXME: disconnect, reconnect, retry!
- return 0;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "mesh: Send connect packet: %lu bytes buffer\n", size);
- msg = (struct GNUNET_MESH_ClientConnect *) buf;
- msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT);
-
- for (ntypes = 0, types = NULL; ntypes < h->n_handlers; ntypes++)
- {
- types = GNUNET_realloc (types, sizeof (uint16_t) * (ntypes + 1));
- types[ntypes] = h->message_handlers[ntypes].type;
- }
+ struct GNUNET_MESH_Handle *h = cls;
+ struct GNUNET_MESH_ClientConnect *msg;
+ GNUNET_MESH_ApplicationType *apps;
+ uint16_t napps;
+ uint16_t *types;
+ uint16_t ntypes;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: Send connect packet()\n", size);
+ h->th = NULL;
+ if (0 == size || NULL == buf)
+ {
+ // FIXME: disconnect, reconnect, retry?
+ return 0;
+ }
+ if (sizeof (struct GNUNET_MessageHeader) > size)
+ {
+ GNUNET_break (0);
+ // FIXME: disconnect, reconnect, retry!
+ return 0;
+ }
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "mesh: Send connect packet: %lu bytes buffer\n", size);
+ msg = (struct GNUNET_MESH_ClientConnect *) buf;
+ msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT);
- for (napps = 0, apps = NULL; napps < h->n_applications; napps++)
- {
- apps =
- GNUNET_realloc (apps,
- sizeof (GNUNET_MESH_ApplicationType) * (napps + 1));
- apps[napps] = h->applications[napps];
- }
+ for (ntypes = 0, types = NULL; ntypes < h->n_handlers; ntypes++)
+ {
+ types = GNUNET_realloc (types, sizeof (uint16_t) * (ntypes + 1));
+ types[ntypes] = h->message_handlers[ntypes].type;
+ }
- msg->header.size =
- htons (sizeof (struct GNUNET_MESH_ClientConnect) +
- sizeof (uint16_t) * ntypes +
- sizeof (GNUNET_MESH_ApplicationType) * napps);
- memcpy (&msg[1], types, sizeof (uint16_t) * ntypes);
- types = (uint16_t *) &msg[1];
- memcpy (&types[ntypes], apps, sizeof (GNUNET_MESH_ApplicationType) * napps);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "mesh: Sent %lu bytes long message %d types and %d apps\n",
- ntohs (msg->header.size), ntypes, napps);
- msg->applications = htons (napps);
- msg->types = htons (ntypes);
-
- /* start listening */
- GNUNET_CLIENT_receive (h->client, &msg_received, h,
- GNUNET_TIME_UNIT_FOREVER_REL);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "mesh: Send connect packet() END\n", size);
+ for (napps = 0, apps = NULL; napps < h->n_applications; napps++)
+ {
+ apps =
+ GNUNET_realloc (apps,
+ sizeof (GNUNET_MESH_ApplicationType) * (napps + 1));
+ apps[napps] = h->applications[napps];
+ }
- return ntohs (msg->header.size);
+ msg->header.size =
+ htons (sizeof (struct GNUNET_MESH_ClientConnect) +
+ sizeof (uint16_t) * ntypes +
+ sizeof (GNUNET_MESH_ApplicationType) * napps);
+ memcpy (&msg[1], types, sizeof (uint16_t) * ntypes);
+ types = (uint16_t *) & msg[1];
+ memcpy (&types[ntypes], apps, sizeof (GNUNET_MESH_ApplicationType) * napps);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "mesh: Sent %lu bytes long message %d types and %d apps\n",
+ ntohs (msg->header.size), ntypes, napps);
+ msg->applications = htons (napps);
+ msg->types = htons (ntypes);
+
+ /* start listening */
+ GNUNET_CLIENT_receive (h->client, &msg_received, h,
+ GNUNET_TIME_UNIT_FOREVER_REL);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: Send connect packet() END\n",
+ size);
+
+ return ntohs (msg->header.size);
}
}
if (sizeof (struct GNUNET_MESH_TunnelMessage) > size)
{
- GNUNET_break(0);
+ GNUNET_break (0);
// FIXME: disconnect, reconnect, retry?
return 0;
}
static size_t
send_tunnel_destroy_packet (void *cls, size_t size, void *buf)
{
- struct GNUNET_MESH_Tunnel *t = cls;
- struct GNUNET_MESH_Handle *h;
- struct GNUNET_MESH_TunnelMessage *msg;
+ struct GNUNET_MESH_Tunnel *t = cls;
+ struct GNUNET_MESH_Handle *h;
+ struct GNUNET_MESH_TunnelMessage *msg;
- h = t->mesh;
- h->th = NULL;
- if (0 == size || buf == NULL)
- {
- return 0;
- }
- if (sizeof (struct GNUNET_MESH_TunnelMessage) > size)
- {
- GNUNET_break(0);
- // FIXME: disconnect, reconnect, retry!
- return 0;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Send tunnel destroy packet: %lu bytes buffer\n", size);
- msg = (struct GNUNET_MESH_TunnelMessage *) buf;
- msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_DESTROY);
+ h = t->mesh;
+ h->th = NULL;
+ if (0 == size || buf == NULL)
+ {
+ return 0;
+ }
+ if (sizeof (struct GNUNET_MESH_TunnelMessage) > size)
+ {
+ GNUNET_break (0);
+ // FIXME: disconnect, reconnect, retry!
+ return 0;
+ }
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Send tunnel destroy packet: %lu bytes buffer\n", size);
+ msg = (struct GNUNET_MESH_TunnelMessage *) buf;
+ msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_DESTROY);
- msg->header.size = htons (sizeof (struct GNUNET_MESH_TunnelMessage));
- msg->tunnel_id = htonl (t->tid);
+ msg->header.size = htons (sizeof (struct GNUNET_MESH_TunnelMessage));
+ msg->tunnel_id = htonl (t->tid);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sent %lu bytes long message\n",
- ntohs (msg->header.size));
- GNUNET_free(t);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sent %lu bytes long message\n",
+ ntohs (msg->header.size));
+ GNUNET_free (t);
- return sizeof (struct GNUNET_MESH_TunnelMessage);
+ return sizeof (struct GNUNET_MESH_TunnelMessage);
}
* inbound messages if the client does not process them fast
* enough (for this notification type, a bounded queue is used)
* @param stypes Application Types the client claims to offer
- * @return handle to the mesh service
+ * @return handle to the mesh service
* NULL on error (in this case, init is never called)
*/
struct GNUNET_MESH_Handle *
const struct GNUNET_MESH_MessageHandler *handlers,
const GNUNET_MESH_ApplicationType *stypes)
{
- struct GNUNET_MESH_Handle *h;
- size_t size;
+ struct GNUNET_MESH_Handle *h;
+ size_t size;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: GNUNET_MESH_connect()\n");
h = GNUNET_malloc (sizeof (struct GNUNET_MESH_Handle));
h->client = GNUNET_CLIENT_connect ("mesh", cfg);
if (h->client == NULL)
{
- GNUNET_break(0);
+ GNUNET_break (0);
GNUNET_free (h);
return NULL;
}
size += h->n_handlers * sizeof (uint16_t);
size += h->n_applications * sizeof (GNUNET_MESH_ApplicationType);
- if (NULL != h->th) {
- /* FIXME implement queue system instead */
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
- "mesh: overwriting th of mesh\n");
- GNUNET_CLIENT_notify_transmit_ready_cancel(h->th);
+ if (NULL != h->th)
+ {
+ /* FIXME implement queue system instead */
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "mesh: overwriting th of mesh\n");
+ GNUNET_CLIENT_notify_transmit_ready_cancel (h->th);
}
h->th =
GNUNET_CLIENT_notify_transmit_ready (h->client, size,
tunnel->mesh = h;
tunnel->tid = h->next_tid++;
h->next_tid |= GNUNET_MESH_LOCAL_TUNNEL_ID_MARK; // keep in range
- if (NULL != h->th) {
- /* FIXME implement queue system instead */
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
- "mesh: overwriting th of mesh\n");
- GNUNET_CLIENT_notify_transmit_ready_cancel(h->th);
+ if (NULL != h->th)
+ {
+ /* FIXME implement queue system instead */
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "mesh: overwriting th of mesh\n");
+ GNUNET_CLIENT_notify_transmit_ready_cancel (h->th);
}
h->th =
GNUNET_CLIENT_notify_transmit_ready (h->client,
void
GNUNET_MESH_tunnel_destroy (struct GNUNET_MESH_Tunnel *tun)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: Destroying tunnel\n");
- if (NULL != tun->mesh->th) {
- /* FIXME implement queue system instead */
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
- "mesh: overwriting th of mesh\n");
- GNUNET_CLIENT_notify_transmit_ready_cancel(tun->mesh->th);
- }
- tun->mesh->th = GNUNET_CLIENT_notify_transmit_ready (
- tun->mesh->client,
- sizeof (struct
- GNUNET_MESH_TunnelMessage),
- GNUNET_TIME_UNIT_FOREVER_REL,
- GNUNET_YES,
- &send_tunnel_destroy_packet,
- (void *) tun);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: Destroying tunnel\n");
+ if (NULL != tun->mesh->th)
+ {
+ /* FIXME implement queue system instead */
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "mesh: overwriting th of mesh\n");
+ GNUNET_CLIENT_notify_transmit_ready_cancel (tun->mesh->th);
+ }
+ tun->mesh->th =
+ GNUNET_CLIENT_notify_transmit_ready (tun->mesh->client,
+ sizeof (struct
+ GNUNET_MESH_TunnelMessage),
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ GNUNET_YES,
+ &send_tunnel_destroy_packet,
+ (void *) tun);
}
* @param priority how important is the message?
* @param maxdelay how long can the message wait?
* @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 function to call when buffer space is available;
* will be called with NULL on timeout or if the overall queue
static void
do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- fprintf(stderr, "++++++++ STARTING SHUTDOWN\n");
- fprintf(stderr, "+++++++++ ABORT TASK\n");
+ fprintf (stderr, "++++++++ STARTING SHUTDOWN\n");
+ fprintf (stderr, "+++++++++ ABORT TASK\n");
if (0 != abort_task)
{
GNUNET_SCHEDULER_cancel (abort_task);
}
- fprintf(stderr, "+++++++++ DISCONNECT MESH\n");
+ fprintf (stderr, "+++++++++ DISCONNECT MESH\n");
if (NULL != mesh)
{
GNUNET_MESH_disconnect (mesh);
}
- fprintf(stderr, "+++++++++ KILL PROCESS\n");
+ fprintf (stderr, "+++++++++ KILL PROCESS\n");
if (0 != GNUNET_OS_process_kill (arm_pid, SIGTERM))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
}
- fprintf(stderr, "+++++++++ WAIT\n");
+ fprintf (stderr, "+++++++++ WAIT\n");
GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (arm_pid));
- fprintf(stderr, "+++++++++ PROCESS CLOSE\n");
+ fprintf (stderr, "+++++++++ PROCESS CLOSE\n");
GNUNET_OS_process_close (arm_pid);
- fprintf(stderr, "++++++++ END SHUTDOWN\n");
+ fprintf (stderr, "++++++++ END SHUTDOWN\n");
}
static void
do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- fprintf(stderr, "++++++++ STARTING ABORT\n");
+ fprintf (stderr, "++++++++ STARTING ABORT\n");
if (0 != test_task)
{
GNUNET_SCHEDULER_cancel (test_task);
result = GNUNET_SYSERR;
abort_task = 0;
do_shutdown (cls, tc);
- fprintf(stderr, "++++++++ END ABORT\n");
+ fprintf (stderr, "++++++++ END ABORT\n");
}
static void
test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct GNUNET_CONFIGURATION_Handle *cfg = cls;
- static const GNUNET_MESH_ApplicationType app[] = {1,2,3,0};
+ static const GNUNET_MESH_ApplicationType app[] = { 1, 2, 3, 0 };
- fprintf(stderr, "++++++++ STARTING TEST\n");
+ fprintf (stderr, "++++++++ STARTING TEST\n");
test_task = (GNUNET_SCHEDULER_TaskIdentifier) 0;
mesh = GNUNET_MESH_connect (cfg, NULL, NULL, handlers, app);
if (NULL == mesh)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "YAY! CONNECTED TO MESH :D\n");
}
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 3), &do_shutdown, NULL);
- fprintf(stderr, "++++++++ END TEST\n");
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_SECONDS, 3), &do_shutdown,
+ NULL);
+ fprintf (stderr, "++++++++ END TEST\n");
}
run (void *cls, char *const *args, const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
- fprintf(stderr, "++++++++ STARTING RUN\n");
+ fprintf (stderr, "++++++++ STARTING RUN\n");
GNUNET_log_setup ("test_mesh_small",
#if VERBOSE
- "DEBUG",
+ "DEBUG",
#else
- "WARNING",
+ "WARNING",
#endif
- NULL);
+ NULL);
arm_pid =
GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm",
"gnunet-service-arm",
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 20), &do_abort,
NULL);
- test_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &test, (void *)cfg);
+ test_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &test,
+ (void *) cfg);
// GNUNET_SCHEDULER_add_now (&test, (void *)cfg);
- fprintf(stderr, "++++++++ END RUN\n");
+ fprintf (stderr, "++++++++ END RUN\n");
}
main (int argc, char *argv[])
{
int ret;
+
char *const argv2[] = { "test-mesh-api",
"-c", "test_mesh.conf",
#if VERBOSE
GNUNET_GETOPT_OPTION_END
};
- fprintf(stderr, "++++++++ STARTING TEST_API\n");
+ fprintf (stderr, "++++++++ STARTING TEST_API\n");
ret =
GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
"test-mesh-api", "nohelp", options, &run, NULL);
return 1;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test ok\n");
- fprintf(stderr, "++++++++ END TEST_API\n");
+ fprintf (stderr, "++++++++ END TEST_API\n");
return 0;
}
// static struct MeshPeer *peer_head;
-//
+//
// static struct MeshPeer *peer_tail;
/**
if (data_file != NULL)
GNUNET_DISK_file_close (data_file);
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
- GNUNET_CONFIGURATION_destroy(testing_cfg);
+ GNUNET_CONFIGURATION_destroy (testing_cfg);
}
*/
static struct GNUNET_MESH_MessageHandler handlers[] = {
// {&callback, 1, 0},
- {NULL, 0, 0}
+ {NULL, 0, 0}
};
* with the tunnel is stored
*/
static void
-tunnel_cleaner (void *cls,
- const struct GNUNET_MESH_Tunnel * tunnel,
+tunnel_cleaner (void *cls, const struct GNUNET_MESH_Tunnel *tunnel,
void **tunnel_ctx)
{
#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "tunnel disconnected\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tunnel disconnected\n");
#endif
- return;
+ return;
}
/**
static void
dh (void *cls, const struct GNUNET_PeerIdentity *peer)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "peer disconnected\n");
- return;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "peer disconnected\n");
+ return;
}
* @param atsi performance data for the connection
*/
static void
-ch (void *cls,
- const struct GNUNET_PeerIdentity * peer,
- const struct GNUNET_TRANSPORT_ATS_Information * atsi)
+ch (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_TRANSPORT_ATS_Information *atsi)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "peer connected\n");
- return;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "peer connected\n");
+ return;
}
/**
* connect_mesh_service: connect to the mesh service of one of the peers
- *
+ *
*/
static void
connect_mesh_service (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct GNUNET_TESTING_Daemon *d;
- struct GNUNET_MESH_Handle *h;
- struct GNUNET_MESH_Tunnel *t;
- GNUNET_MESH_ApplicationType app;
+ struct GNUNET_TESTING_Daemon *d;
+ struct GNUNET_MESH_Handle *h;
+ struct GNUNET_MESH_Tunnel *t;
+ GNUNET_MESH_ApplicationType app;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "connect_mesh_service\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "connect_mesh_service\n");
- d = GNUNET_TESTING_daemon_get(pg, 1);
- app = (GNUNET_MESH_ApplicationType) 0;
+ d = GNUNET_TESTING_daemon_get (pg, 1);
+ app = (GNUNET_MESH_ApplicationType) 0;
#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "connecting to mesh service of peer %s\n",
- GNUNET_i2s(&d->id));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "connecting to mesh service of peer %s\n", GNUNET_i2s (&d->id));
#endif
- h = GNUNET_MESH_connect(d->cfg, NULL, &tunnel_cleaner, handlers, &app);
+ h = GNUNET_MESH_connect (d->cfg, NULL, &tunnel_cleaner, handlers, &app);
#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "connected to mesh service of peer %s\n",
- GNUNET_i2s(&d->id));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "connected to mesh service of peer %s\n",
+ GNUNET_i2s (&d->id));
#endif
- t = GNUNET_MESH_tunnel_create(h, &ch, &dh, NULL);
- GNUNET_MESH_tunnel_destroy(t);
- GNUNET_MESH_disconnect(h);
+ t = GNUNET_MESH_tunnel_create (h, &ch, &dh, NULL);
+ GNUNET_MESH_tunnel_destroy (t);
+ GNUNET_MESH_disconnect (h);
}
{
struct StatsContext *stats_context = cls;
-//
-// if ( (0 == strstr(subsystem, "nse")) &&
+//
+// if ( (0 == strstr(subsystem, "nse")) &&
// (0 == strstr(name, "# flood messages received")) )
stats_context->total_mesh_bytes += 1; //value;
return GNUNET_OK;
static void
peergroup_ready (void *cls, const char *emsg)
{
- char *buf;
- int buf_len;
+ char *buf;
+ int buf_len;
- if (emsg != NULL)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Peergroup callback called with error, aborting test!\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Error from testing: `%s'\n");
- ok = 1;
- GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
- return;
- }
+ if (emsg != NULL)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Peergroup callback called with error, aborting test!\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Error from testing: `%s'\n");
+ ok = 1;
+ GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
+ return;
+ }
#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer Group started successfully!\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer Group started successfully!\n");
#endif
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Have %u connections\n",
- total_connections);
- if (data_file != NULL)
- {
- buf = NULL;
- buf_len = GNUNET_asprintf (&buf, "CONNECTIONS_0: %u\n", total_connections);
- if (buf_len > 0)
- GNUNET_DISK_file_write (data_file, buf, buf_len);
- GNUNET_free (buf);
- }
- peers_running = GNUNET_TESTING_daemons_running (pg);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Have %u connections\n",
+ total_connections);
+ if (data_file != NULL)
+ {
+ buf = NULL;
+ buf_len = GNUNET_asprintf (&buf, "CONNECTIONS_0: %u\n", total_connections);
+ if (buf_len > 0)
+ GNUNET_DISK_file_write (data_file, buf, buf_len);
+ GNUNET_free (buf);
+ }
+ peers_running = GNUNET_TESTING_daemons_running (pg);
- GNUNET_SCHEDULER_add_now (&connect_mesh_service, NULL);
- disconnect_task =
- GNUNET_SCHEDULER_add_delayed (wait_time, &disconnect_mesh_peers, NULL);
+ GNUNET_SCHEDULER_add_now (&connect_mesh_service, NULL);
+ disconnect_task =
+ GNUNET_SCHEDULER_add_delayed (wait_time, &disconnect_mesh_peers, NULL);
}
run (void *cls, char *const *args, const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
- char *temp_str;
- unsigned long long temp_wait;
- struct GNUNET_TESTING_Host *hosts;
+ char *temp_str;
+ unsigned long long temp_wait;
+ struct GNUNET_TESTING_Host *hosts;
- ok = 1;
- testing_cfg = GNUNET_CONFIGURATION_dup(cfg);
+ ok = 1;
+ testing_cfg = GNUNET_CONFIGURATION_dup (cfg);
- GNUNET_log_setup ("test_mesh_small",
+ GNUNET_log_setup ("test_mesh_small",
#if VERBOSE
- "DEBUG",
+ "DEBUG",
#else
- "WARNING",
+ "WARNING",
#endif
- NULL);
+ NULL);
#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting daemons.\n");
- GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing",
- "use_progressbars", "YES");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting daemons.\n");
+ GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing",
+ "use_progressbars", "YES");
#endif
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (testing_cfg, "testing",
+ "num_peers", &num_peers))
+ {
+ GNUNET_CONFIGURATION_load (testing_cfg, "test_mesh_small.conf");
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (testing_cfg, "testing",
- "num_peers", &num_peers))
+ "num_peers", &num_peers))
{
- GNUNET_CONFIGURATION_load(testing_cfg, "test_mesh_small.conf");
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_number (testing_cfg, "testing",
- "num_peers", &num_peers))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Option TESTING:NUM_PEERS is required!\n");
- return;
- }
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Option TESTING:NUM_PEERS is required!\n");
+ return;
}
+ }
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_number (testing_cfg, "test_mesh_small",
- "wait_time", &temp_wait))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Option nsetest_mesh_small:wait_time is required!\n");
- return;
- }
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (testing_cfg, "test_mesh_small",
+ "wait_time", &temp_wait))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Option nsetest_mesh_small:wait_time is required!\n");
+ return;
+ }
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_string (testing_cfg, "testing",
- "topology_output_file",
- &topology_file))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Option test_mesh_small:topology_output_file is required!\n");
- return;
- }
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (testing_cfg, "testing",
+ "topology_output_file",
+ &topology_file))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Option test_mesh_small:topology_output_file is required!\n");
+ return;
+ }
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_string (testing_cfg, "test_mesh_small",
- "data_output_file",
- &data_filename))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Option test_mesh_small:data_output_file is required!\n");
- return;
- }
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (testing_cfg, "test_mesh_small",
+ "data_output_file",
+ &data_filename))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Option test_mesh_small:data_output_file is required!\n");
+ return;
+ }
- data_file = GNUNET_DISK_file_open (data_filename,
- GNUNET_DISK_OPEN_READWRITE |
- GNUNET_DISK_OPEN_CREATE,
- GNUNET_DISK_PERM_USER_READ |
- GNUNET_DISK_PERM_USER_WRITE);
- if (data_file == NULL) {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Failed to open %s for output!\n",
- data_filename);
- GNUNET_free (data_filename);
- }
+ data_file =
+ GNUNET_DISK_file_open (data_filename,
+ GNUNET_DISK_OPEN_READWRITE |
+ GNUNET_DISK_OPEN_CREATE,
+ GNUNET_DISK_PERM_USER_READ |
+ GNUNET_DISK_PERM_USER_WRITE);
+ if (data_file == NULL)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to open %s for output!\n",
+ data_filename);
+ GNUNET_free (data_filename);
+ }
- wait_time =
- GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, temp_wait);
+ wait_time =
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, temp_wait);
- if (GNUNET_YES ==
- GNUNET_CONFIGURATION_get_value_string (cfg, "test_mesh_small",
- "output_file", &temp_str))
- {
- output_file = GNUNET_DISK_file_open (temp_str,
- GNUNET_DISK_OPEN_READWRITE |
- GNUNET_DISK_OPEN_CREATE,
- GNUNET_DISK_PERM_USER_READ |
- GNUNET_DISK_PERM_USER_WRITE);
- if (output_file == NULL)
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Failed to open %s for output!\n",
- temp_str);
- }
- GNUNET_free_non_null (temp_str);
+ if (GNUNET_YES ==
+ GNUNET_CONFIGURATION_get_value_string (cfg, "test_mesh_small",
+ "output_file", &temp_str))
+ {
+ output_file =
+ GNUNET_DISK_file_open (temp_str,
+ GNUNET_DISK_OPEN_READWRITE |
+ GNUNET_DISK_OPEN_CREATE,
+ GNUNET_DISK_PERM_USER_READ |
+ GNUNET_DISK_PERM_USER_WRITE);
+ if (output_file == NULL)
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to open %s for output!\n",
+ temp_str);
+ }
+ GNUNET_free_non_null (temp_str);
- hosts = GNUNET_TESTING_hosts_load (testing_cfg);
+ hosts = GNUNET_TESTING_hosts_load (testing_cfg);
- pg = GNUNET_TESTING_peergroup_start (testing_cfg, num_peers, TIMEOUT,
- &connect_cb, &peergroup_ready, NULL, hosts);
- GNUNET_assert (pg != NULL);
- shutdown_handle = GNUNET_SCHEDULER_add_delayed (
- GNUNET_TIME_relative_get_forever (),
- &shutdown_task, NULL);
+ pg = GNUNET_TESTING_peergroup_start (testing_cfg, num_peers, TIMEOUT,
+ &connect_cb, &peergroup_ready, NULL,
+ hosts);
+ GNUNET_assert (pg != NULL);
+ shutdown_handle =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_get_forever (),
+ &shutdown_task, NULL);
}
int
main (int argc, char *argv[])
{
- GNUNET_PROGRAM_run (argc, argv, "test_mesh_small",
+ GNUNET_PROGRAM_run (argc, argv, "test_mesh_small",
gettext_noop ("Test mesh in a small network."), options,
&run, NULL);
#if REMOVE_DIR
- GNUNET_DISK_directory_remove ("/tmp/test_mesh_small");
+ GNUNET_DISK_directory_remove ("/tmp/test_mesh_small");
#endif
- return ok;
+ return ok;
}
/* end of test_mesh_small.c */
*/
struct GNUNET_NETWORK_Handle *s;
- /**
+ /**
* Data to transmit.
*/
uint16_t data;
/**
* Try to send 'data' to the
* IP 'dst_ipv4' at port 'dport' via TCP.
- *
+ *
* @param dst_ivp4 target IP
* @param dport target port
* @param data data to send
/**
* Try to send 'data' to the
* IP 'dst_ipv4' at port 'dport' via UDP.
- *
+ *
* @param dst_ivp4 target IP
* @param dport target port
* @param data data to send
/**
* We've received a request to probe a NAT
* traversal. Do it.
- *
+ *
* @param cls unused
* @param client handle to client (we always close)
* @param msg message with details about what to test
/**
* Where did the given local address originate from?
- * To be used for debugging as well as in the future
+ * To be used for debugging as well as in the future
* to remove all addresses from a certain source when
* we reevaluate the source.
*/
/**
* Remove all addresses from the list of 'local' addresses
* that originated from the given source.
- *
+ *
* @param plugin the plugin
* @param src source that identifies addresses to remove
*/
/**
* Add the given address to the list of 'local' addresses, thereby
- * making it a 'legal' address for this peer to have.
- *
+ * making it a 'legal' address for this peer to have.
+ *
* @param plugin the plugin
* @param src where did the local address originate from?
* @param arg the address, some 'struct sockaddr'
* making it a 'legal' address for this peer to have. Set the
* port number in the process to the advertised port and possibly
* also to zero (if we have the gnunet-helper-nat-server).
- *
+ *
* @param plugin the plugin
* @param src where did the local address originate from?
* @param arg the address, some 'struct sockaddr'
/**
* Add the given IP address to the list of 'local' addresses, thereby
- * making it a 'legal' address for this peer to have.
- *
+ * making it a 'legal' address for this peer to have.
+ *
* @param plugin the plugin
* @param src where did the local address originate from?
* @param arg the address, some 'struct in_addr' or 'struct in6_addr'
* @param address_callback function to call everytime the public IP address changes
* @param reversal_callback function to call if someone wants connection reversal from us
* @param callback_cls closure for callbacks
- * @return NULL on error, otherwise handle that can be used to unregister
+ * @return NULL on error, otherwise handle that can be used to unregister
*/
struct GNUNET_NAT_Handle *
GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, int is_tcp,
}
/*
* we're looking for output of the form:
- *
+ *
* "0 TCP 3000->192.168.2.150:3000 'libminiupnpc' ''"
* "1 UDP 3001->192.168.2.150:3001 'libminiupnpc' ''"
- *
+ *
* the pattern we look for is:
- *
+ *
* "%s TCP PORT->STRING:OURPORT *" or
* "%s UDP PORT->STRING:OURPORT *"
*/
}
/*
* The upnpc output we're after looks like this:
- *
+ *
* "external 87.123.42.204:3000 TCP is redirected to internal 192.168.2.150:3000"
*/
if ((NULL == (ipaddr = strstr (line, " "))) ||
* general-purpose 'GNUNET_NAT_register' code). However, it can be
* used if specifically UPnP-based NAT traversal is to be used or
* tested.
- *
+ *
* @param port port to map
* @param is_tcp GNUNET_YES to map TCP, GNUNET_NO for UDP
* @param ac function to call with mapping result
* this function will give 'upnpc' 1s to remove tha mapping,
* so while this function is non-blocking, a task will be
* left with the scheduler for up to 1s past this call.
- *
+ *
* @param mini the handle
*/
void
/**
- * Time to wait before stopping NAT, in seconds
+ * Time to wait before stopping NAT, in seconds
*/
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
/**
* Return the address of the default interface,
- * or any interface with a valid address if the default is not valid
+ * or any interface with a valid address if the default is not valid
*
* @param cls the 'struct addr_cls'
* @param name name of the interface
* Testcase for port redirection and public IP address retrieval.
* This test never fails, because there need to be a NAT box set up for tha *
* @file nat/test_nat_mini.c
- * @brief Testcase for NAT library - mini
+ * @brief Testcase for NAT library - mini
* @author Christian Grothoff
*
* TODO: actually use ARM to start resolver service to make DNS work!
/**
- * Time to wait before stopping NAT test, in seconds
+ * Time to wait before stopping NAT test, in seconds
*/
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15)
/*
This file is part of GNUnet.
(C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors)
-
+
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 3, or (at your
option) any later version.
-
+
GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
/**
* The current network size estimate. Number of bits matching on
- * average thus far.
+ * average thus far.
*/
static double current_size_estimate;
* What delay randomization should we apply for a given number of matching bits?
*
* @param matching_bits number of matching bits
- * @return random delay to apply
+ * @return random delay to apply
*/
static struct GNUNET_TIME_Relative
get_delay_randomization (uint32_t matching_bits)
/**
- * Get the transmission delay that should be applied for a
+ * Get the transmission delay that should be applied for a
* particular round.
*
* @param round_offset -1 for the previous round (random delay between 0 and 50ms)
return GNUNET_OK; /* trigger of the update */
if (peer_entry->previous_round == GNUNET_NO)
{
- /* still stuck in previous round, no point to update, check that
+ /* still stuck in previous round, no point to update, check that
* we are active here though... */
GNUNET_break ((peer_entry->transmit_task != GNUNET_SCHEDULER_NO_TASK) ||
(peer_entry->th != NULL));
/**
- * Broadcast information about the given entry to all
+ * Broadcast information about the given entry to all
* clients that care.
*
* @param entry entry to broadcast about
/**
* Function to call after transmission has succeeded.
- *
+ *
* @param cls closure
* @param success GNUNET_OK if transmission worked, GNUNET_SYSERR on error
*/
/**
- * Add a host to the persistent list. This method operates in
+ * Add a host to the persistent list. This method operates in
* semi-reliable mode: if the transmission is not completed by
* the time 'GNUNET_PEERINFO_disconnect' is called, it will be
* aborted. Furthermore, if a second HELLO is added for the
/**
- * Peerinfo iteration request has timed out.
+ * Peerinfo iteration request has timed out.
*
* @param cls the 'struct GNUNET_PEERINFO_IteratorContext*'
* @param tc scheduler context
*
* Instead of calling this function with 'peer == NULL' it is often
* better to use 'GNUNET_PEERINFO_notify'.
- *
+ *
* @param h handle to the peerinfo service
* @param peer restrict iteration to this peer only (can be NULL)
* @param timeout how long to wait until timing out
* @file statistics/gnunet-service-statistics.c
* @brief program that tracks statistics
* @author Christian Grothoff
- *
+ *
* TODO:
* - use BIO for IO operations
*/
/**
* Unique watch identification number (watch
- * requests are enumerated in the order they
- * are received, the first request having
- * a wid of zero).
+ * requests are enumerated in the order they
+ * are received, the first request having
+ * a wid of zero).
*/
uint32_t wid GNUNET_PACKED;
/**
* How long do we wait until a statistics request for setting
* a value times out? (The update will be lost if the
- * service does not react within this timeframe).
+ * service does not react within this timeframe).
*/
#define SET_TRANSMIT_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2)
/**
- * Cancel a 'get' request. Must be called before the 'cont'
+ * Cancel a 'get' request. Must be called before the 'cont'
* function is called.
*
* @param gh handle of the request to cancel
/**
- * Function that decides if a connection is acceptable or not.
+ * Function that decides if a connection is acceptable or not.
* If we have a blacklist, only friends are allowed, so the check
* is rather simple.
*
/**
* Check if an additional connection from the given peer is allowed.
- *
+ *
* @param peer connection to check
* @return GNUNET_OK if the connection is allowed
*/
*
* @param cls closure
* @param pid identity of a peer
- * @param value 'struct Peer*' for the peer we are considering
+ * @param value 'struct Peer*' for the peer we are considering
* @return GNUNET_YES (continue iteration)
*/
static int
/**
* @file transport/gnunet-service-transport-new.c
- * @brief
+ * @brief
* @author Christian Grothoff
*/
#include "platform.h"
plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
const struct GNUNET_TRANSPORT_ATS_Information *ats,
- uint32_t ats_count,
- struct Session *session,
+ uint32_t ats_count, struct Session *session,
const char *sender_address,
uint16_t sender_address_len)
{
case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT:
(void) GST_blacklist_test_allowed (peer, NULL, &try_connect_if_allowed,
NULL);
- /* TODO: if 'session != NULL', maybe notify ATS that this is now the preferred
+ /* TODO: if 'session != NULL', maybe notify ATS that this is now the preferred
* way to communicate with this peer (other peer switched transport) */
break;
case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT:
&do_forward);
if (do_forward == GNUNET_YES)
{
- struct InboundMessage * im;
- size_t size =
- sizeof (struct InboundMessage) +
- ntohs (message->size);
+ struct InboundMessage *im;
+ size_t size = sizeof (struct InboundMessage) + ntohs (message->size);
im = GNUNET_malloc (size);
im->header.size = htons (size);
im->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RECV);
im->ats_count = htonl (0);
- memcpy (&(im->peer), peer, sizeof(struct GNUNET_PeerIdentity));
+ memcpy (&(im->peer), peer, sizeof (struct GNUNET_PeerIdentity));
memcpy (&im[1], message, ntohs (message->size));
- GST_clients_broadcast ((const struct GNUNET_MessageHeader *) im, GNUNET_YES);
+ GST_clients_broadcast ((const struct GNUNET_MessageHeader *) im,
+ GNUNET_YES);
- GNUNET_free(im);
+ GNUNET_free (im);
}
break;
}
* use NULL wherever a session pointer is needed. This function
* should be called BEFORE a potential "TransmitContinuation"
* from the "TransmitFunction".
- *
+ *
* @param cls closure
- * @param peer which peer was the session for
+ * @param peer which peer was the session for
* @param session which session is being destoyed
*/
static void
* Function called by ATS to notify the callee that the
* assigned bandwidth or address for a given peer was changed. If the
* callback is called with address/bandwidth assignments of zero, the
- * ATS disconnect function will still be called once the disconnect
+ * ATS disconnect function will still be called once the disconnect
* actually happened.
*
* @param cls closure
/**
- * Entry in neighbours.
+ * Entry in neighbours.
*/
struct NeighbourMapEntry
{
* quickly (much faster than timeout) `if a connection was lost and
* could not be re-established (i.e. other peer went down or is
* unable / refuses to communicate);
- *
+ *
* So we should consider:
* 1) ideally: our own willingness / need to connect
* 2) prior failures to connect to this peer (by plugin)
* 3) ideally: reasons why other peer terminated (as far as knowable)
- *
+ *
* Most importantly, it must be POSSIBLE for another peer to terminate
* a connection for a while (without us instantly re-establishing it).
* Similarly, if another peer is gone we should quickly notify CORE.
* services never even notice.
* Furthermore, the same mechanism (or small variation) could be used
* to switch to a better-performing plugin (ATS).
- *
+ *
* Finally, this needs to be tested throughly... */
/*
GNUNET_i2s (&pong->pid), a2s (ve->transport_name, &addr[slen],
alen));
/* FIXME: since the sender of the PONG currently uses the
- * wrong address (see FIMXE there!), we cannot run a
+ * wrong address (see FIMXE there!), we cannot run a
* proper check here... */
#if FIXME_URGENT
return GNUNET_NO;
bl->waiting_for_reply = GNUNET_NO;
if (NULL != bc)
{
- /* only run this if the blacklist check has not been
+ /* only run this if the blacklist check has not been
* cancelled in the meantime... */
if (ntohl (msg->is_allowed) == GNUNET_SYSERR)
{
/**
* Add the given peer to the blacklist (for the given transport).
- *
+ *
* @param peer peer to blacklist
* @param transport_name transport to blacklist for this peer, NULL for all
*/
/**
* Cancel a blacklist check.
- *
+ *
* @param bc check to cancel
*/
void
/**
* Add the given peer to the blacklist (for the given transport).
- *
+ *
* @param peer peer to blacklist
* @param transport_name transport to blacklist for this peer, NULL for all
*/
/**
* Cancel a blacklist check.
- *
+ *
* @param bc check to cancel
*/
void
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
"TransportClient %X ServerClient %X sent multiple START messages\n",
- tc,
- tc->client);
+ tc, tc->client);
#endif
GNUNET_break (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
/**
* Add an address from the 'OwnAddressList' to the buffer.
- *
+ *
* @param cls the 'struct GeneratorContext'
* @param max maximum number of bytes left
* @param buf where to write the address
/**
- * Entry in neighbours.
+ * Entry in neighbours.
*/
struct NeighbourMapEntry;
/**
- * Entry in neighbours.
+ * Entry in neighbours.
*/
struct NeighbourMapEntry
{
/**
* ID of task scheduled to run when we should try transmitting
- * the head of the message queue.
+ * the head of the message queue.
*/
GNUNET_SCHEDULER_TaskIdentifier transmission_task;
/**
* Test if we're connected to the given peer.
- *
+ *
* @param target peer to test
* @return GNUNET_YES if we are connected, GNUNET_NO if not
*/
* Change the incoming quota for the given peer.
*
* @param neighbour identity of peer to change qutoa for
- * @param quota new quota
+ * @param quota new quota
*/
void
GST_neighbours_set_incoming_quota (const struct GNUNET_PeerIdentity *neighbour,
/**
* Iterate over all connected neighbours.
*
- * @param cb function to call
+ * @param cb function to call
* @param cb_cls closure for cb
*/
void
/**
* Test if we're connected to the given peer.
- *
+ *
* @param target peer to test
* @return GNUNET_YES if we are connected, GNUNET_NO if not
*/
* Change the incoming quota for the given peer.
*
* @param neighbour identity of peer to change qutoa for
- * @param quota new quota
+ * @param quota new quota
*/
void
GST_neighbours_set_incoming_quota (const struct GNUNET_PeerIdentity *neighbour,
/**
* Iterate over all connected neighbours.
*
- * @param cb function to call
+ * @param cb function to call
* @param cb_cls closure for cb
*/
void
/**
* Convert a given address to a human-readable format. Note that the
* return value will be overwritten on the next call to this function.
- *
+ *
* @param name plugin name
* @param addr binary address in plugin-specific format
* @param addrlen number of bytes in 'addr'
/**
* Convert a given address to a human-readable format. Note that the
* return value will be overwritten on the next call to this function.
- *
+ *
* @param name plugin name
* @param addr binary address in plugin-specific format
* @param addrlen number of bytes in 'addr'
/**
- * Function called for any HELLO known to PEERINFO.
+ * Function called for any HELLO known to PEERINFO.
*
* @param cls unused
* @param peer id of the peer, NULL for last call
hsize = ntohs (hello->size);
tsize = sizeof (struct TransportPingMessage) + ve->addrlen + slen + hsize;
- ping.header.size = htons (sizeof (struct TransportPingMessage) + ve->addrlen + slen);
+ ping.header.size =
+ htons (sizeof (struct TransportPingMessage) + ve->addrlen + slen);
ping.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_PING);
ping.challenge = htonl (ve->challenge);
ping.target = *pid;
rtheader.rate = header->rate;
memcpy (write_pout->buf, &rtheader, sizeof (rtheader));
memcpy (write_pout->buf + sizeof (rtheader), &header[1], sendsize);
- /* payload contains MAC address, but we don't trust it, so we'll
+ /* payload contains MAC address, but we don't trust it, so we'll
* overwrite it with OUR MAC address again to prevent mischief */
wlanheader = (struct ieee80211_frame *) (write_pout->buf + sizeof (rtheader));
mac_set (wlanheader, dev);
/**
* Function to check if an inbound connection is acceptable.
- * Mostly used to limit the total number of open connections
+ * Mostly used to limit the total number of open connections
* we can have.
*
* @param cls the 'struct Plugin'
/**
* Data structure to track defragmentation contexts based
- * on the source of the UDP traffic.
+ * on the source of the UDP traffic.
*/
struct ReceiveContext
{
struct GNUNET_NETWORK_Handle *sockv6;
/**
- * expected delay for ACKs
+ * expected delay for ACKs
*/
struct GNUNET_TIME_Relative last_expected_delay;
/**
- * Message tokenizer has broken up an incomming message. Pass it on
+ * Message tokenizer has broken up an incomming message. Pass it on
* to the service.
*
* @param cls the 'struct Plugin'
*
* @param plugin plugin context
* @param msg the message
- * @param sender_addr sender address
+ * @param sender_addr sender address
* @param sender_addr_len number of bytes in sender_addr
*/
static void
if (send_task != GNUNET_SCHEDULER_NO_TASK)
GNUNET_SCHEDULER_cancel (send_task);
- if (cc != NULL)
- GNUNET_TRANSPORT_TESTING_connect_peers_cancel(cc);
+ if (cc != NULL)
+ GNUNET_TRANSPORT_TESTING_connect_peers_cancel (cc);
if (th != NULL)
GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
p2 = GNUNET_TRANSPORT_TESTING_start_peer (cfg_file_p2, ¬ify_receive,
¬ify_connect, ¬ify_disconnect,
NULL);
- cc = GNUNET_TRANSPORT_TESTING_connect_peers (p1, p2, &testing_connect_cb, NULL);
+ cc = GNUNET_TRANSPORT_TESTING_connect_peers (p1, p2, &testing_connect_cb,
+ NULL);
}
static int
run (void *cls, char *const *args, const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
- timeout_task =
- GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
+ timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
i = 1;
- fprintf(stderr,"%i",i);
+ fprintf (stderr, "%i", i);
while (i <= ITERATIONS)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting peer\n");
//sleep (5);
- GNUNET_TRANSPORT_TESTING_stop_peer(p1);
+ GNUNET_TRANSPORT_TESTING_stop_peer (p1);
i++;
if (i <= ITERATIONS)
- fprintf(stderr,"..%i",i);
+ fprintf (stderr, "..%i", i);
}
- fprintf(stderr,"\n");
- end();
+ fprintf (stderr, "\n");
+ end ();
}
int
* Tou MUST cancel the request if you stop the peers before the peers connected succesfully
* @param cc a connect request handle
*/
-void
-GNUNET_TRANSPORT_TESTING_connect_peers_cancel (GNUNET_TRANSPORT_TESTING_ConnectRequest ccr)
+void GNUNET_TRANSPORT_TESTING_connect_peers_cancel
+ (GNUNET_TRANSPORT_TESTING_ConnectRequest ccr)
{
struct ConnectingContext *cc = ccr;
+
/* clean up */
GNUNET_TRANSPORT_get_hello_cancel (cc->th_p2, &exchange_hello_last, cc);
GNUNET_TRANSPORT_get_hello_cancel (cc->th_p1, &exchange_hello, cc);
struct GNUNET_TIME_Absolute timeout;
/**
- * Task to trigger request timeout if the request is stalled due to
+ * Task to trigger request timeout if the request is stalled due to
* congestion.
*/
GNUNET_SCHEDULER_TaskIdentifier timeout_task;
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != n->th->timeout_task);
GNUNET_SCHEDULER_cancel (n->th->timeout_task);
n->th->timeout_task = GNUNET_SCHEDULER_NO_TASK;
- /* we've been waiting for this (congestion, not quota,
+ /* we've been waiting for this (congestion, not quota,
* caused delayed transmission) */
n->hn = GNUNET_CONTAINER_heap_insert (h->ready_heap, n, 0);
schedule_transmission (h);
/**
- * Ask the transport service to establish a connection to
+ * Ask the transport service to establish a connection to
* the given peer.
*
* @param handle connection to transport service
#ifndef __int8_t_defined
typedef uint64_t u_int64_t;
-\rtypedef uint32_t u_int32_t;
-\rtypedef uint16_t u_int16_t;
-\rtypedef uint8_t u_int8_t;
+typedef uint32_t u_int32_t;
+typedef uint16_t u_int16_t;
+typedef uint8_t u_int8_t;
-#endif /* \r */
+#endif /* */
#ifndef htole16
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define htole64(x) (x)
#define be64toh(x) ___my_swab64 (x)
#define le64toh(x) (x)
-#else /* \r */
+#else /* */
#define htobe16(x) (x)
#define htole16(x) ___my_swab16 (x)
#define be16toh(x) (x)
#define htole64(x) ___my_swab64 (x)
#define be64toh(x) (x)
#define le64toh(x) ___my_swab64 (x)
-#endif /* \r */
-#endif /* \r */
+#endif /* */
+#endif /* */
-#endif /* \r */
+#endif /* */
/*
* Cygwin
*/
#define __cpu_to_le32(x) (x)
#define __cpu_to_le16(x) (x)
#define AIRCRACK_NG_BYTE_ORDER_DEFINED
-#endif /* \r */
+#endif /* */
/*
* Windows (DDK)
*/
#define __cpu_to_le32(x) (x)
#define __cpu_to_le16(x) (x)
#define AIRCRACK_NG_BYTE_ORDER_DEFINED
-#endif /* \r */
+#endif /* */
/*
* MAC (Darwin)
*/
#define __cpu_to_le64(x) (unsigned long long) OSSwapHostToLittleInt64((uint64_t)x)
#define __cpu_to_le32(x) (unsigned long) OSSwapHostToLittleInt32((uint32_t)x)
#define __cpu_to_le16(x) (unsigned short) OSSwapHostToLittleInt16((uint16_t)x)
-#else /* \r */
+#else /* */
#include <architecture/byte_order.h>
#define __swab64(x) NXSwapLongLong(x)
#define __swab32(x) NXSwapLong(x)
#define __cpu_to_le64(x) NXSwapHostLongLongToLittle(x)
#define __cpu_to_le32(x) NXSwapHostLongToLittle(x)
#define __cpu_to_le16(x) NXSwapHostShortToLittle(x)
-#endif /* \r */
+#endif /* */
#define __LITTLE_ENDIAN 1234
#define __BIG_ENDIAN 4321
#define __PDP_ENDIAN 3412
#define __BYTE_ORDER __BIG_ENDIAN
#define AIRCRACK_NG_BYTE_ORDER_DEFINED
-#endif /* \r */
+#endif /* */
/*
* Solaris
* -------
#define __cpu_to_le64(x) ___my_swab64(x)
#define __cpu_to_le32(x) ___my_swab32(x)
#define __cpu_to_le16(x) ___my_swab16(x)
-\rtypedef uint64_t u_int64_t;
-\rtypedef uint32_t u_int32_t;
-\rtypedef uint16_t u_int16_t;
-\rtypedef uint8_t u_int8_t;
+typedef uint64_t u_int64_t;
+typedef uint32_t u_int32_t;
+typedef uint16_t u_int16_t;
+typedef uint8_t u_int8_t;
#define AIRCRACK_NG_BYTE_ORDER_DEFINED
-#endif /* \r */
+#endif /* */
/*
* Custom stuff
*/
#define __cpu_to_be64(x) = OSSwapHostToBigInt64(x)
#define __cpu_to_be32(x) = OSSwapHostToBigInt32(x)
#define AIRCRACK_NG_BYTE_ORDER_DEFINED
-#endif /* \r */
+#endif /* */
// FreeBSD
#ifdef __FreeBSD__
#include <machine/endian.h>
-#endif /* \r */
+#endif /* */
// XXX: Is there anything to include on OpenBSD/NetBSD/DragonFlyBSD/...?
// XXX: Mac: Check http://www.opensource.apple.com/source/CF/CF-476.18/CFByteOrder.h
#define AIRCRACK_NG_LITTLE_ENDIAN __LITTLE_ENDIAN
#elif defined(_LITTLE_ENDIAN)
#define AIRCRACK_NG_LITTLE_ENDIAN _LITTLE_ENDIAN
-#endif /* \r */
+#endif /* */
#if defined(BIG_ENDIAN)
#define AIRCRACK_NG_BIG_ENDIAN BIG_ENDIAN
#elif defined(__BIG_ENDIAN)
#define AIRCRACK_NG_BIG_ENDIAN __BIG_ENDIAN
#elif defined(_BIG_ENDIAN)
#define AIRCRACK_NG_BIG_ENDIAN _BIG_ENDIAN
-#endif /* \r */
+#endif /* */
#if !defined(AIRCRACK_NG_LITTLE_ENDIAN) && !defined(AIRCRACK_NG_BIG_ENDIAN)
#error Impossible to determine endianness (Little or Big endian), please contact the author.
-#endif /* \r */
+#endif /* */
#if defined(BYTE_ORDER)
#if (BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN)
#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_LITTLE_ENDIAN
#elif (BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN)
#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_BIG_ENDIAN
-#endif /* \r */
+#endif /* */
#elif defined(__BYTE_ORDER)
#if (__BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN)
#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_LITTLE_ENDIAN
#elif (__BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN)
#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_BIG_ENDIAN
-#endif /* \r */
+#endif /* */
#elif defined(_BYTE_ORDER)
#if (_BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN)
#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_LITTLE_ENDIAN
#elif (_BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN)
#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_BIG_ENDIAN
-#endif /* \r */
-#endif /* \r */
+#endif /* */
+#endif /* */
#ifndef AIRCRACK_NG_BYTE_ORDER
#error Impossible to determine endianness (Little or Big endian), please contact the author.
-#endif /* \r */
+#endif /* */
#if (AIRCRACK_NG_BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN)
#ifndef AIRCRACK_NG_BYTE_ORDER_DEFINED
#define __be64_to_cpu(x) ___my_swab64(x)
#define __cpu_to_le64(x) (x)
#define __cpu_to_le32(x) (x)
#define __cpu_to_le16(x) (x)
-#endif /* \r */
+#endif /* */
#ifndef htobe16
#define htobe16 ___my_swab16
-#endif /* \r */
+#endif /* */
#ifndef htobe32
#define htobe32 ___my_swab32
-#endif /* \r */
+#endif /* */
#ifndef betoh16
#define betoh16 ___my_swab16
-#endif /* \r */
+#endif /* */
#ifndef betoh32
#define betoh32 ___my_swab32
-#endif /* \r */
+#endif /* */
#ifndef htole16
#define htole16(x) (x)
-#endif /* \r */
+#endif /* */
#ifndef htole32
#define htole32(x) (x)
-#endif /* \r */
+#endif /* */
#ifndef letoh16
#define letoh16(x) (x)
-#endif /* \r */
+#endif /* */
#ifndef letoh32
#define letoh32(x) (x)
-#endif /* \r */
-#endif /* \r */
+#endif /* */
+#endif /* */
#if (AIRCRACK_NG_BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN)
#ifndef AIRCRACK_NG_BYTE_ORDER_DEFINED
#define __be64_to_cpu(x) (x)
#define __cpu_to_le64(x) ___my_swab64(x)
#define __cpu_to_le32(x) ___my_swab32(x)
#define __cpu_to_le16(x) ___my_swab16(x)
-#endif /* \r */
+#endif /* */
#ifndef htobe16
#define htobe16(x) (x)
-#endif /* \r */
+#endif /* */
#ifndef htobe32
#define htobe32(x) (x)
-#endif /* \r */
+#endif /* */
#ifndef betoh16
#define betoh16(x) (x)
-#endif /* \r */
+#endif /* */
#ifndef betoh32
#define betoh32(x) (x)
-#endif /* \r */
+#endif /* */
#ifndef htole16
#define htole16 ___my_swab16
-#endif /* \r */
+#endif /* */
#ifndef htole32
#define htole32 ___my_swab32
-#endif /* \r */
+#endif /* */
#ifndef letoh16
#define letoh16 ___my_swab16
-#endif /* \r */
+#endif /* */
#ifndef letoh32
#define letoh32 ___my_swab32
-#endif /* \r */
-#endif /* \r */
+#endif /* */
+#endif /* */
// Common defines
#define cpu_to_le64 __cpu_to_le64
#define le64_to_cpu __le64_to_cpu
#define be16_to_cpu __be16_to_cpu
#ifndef le16toh
#define le16toh le16_to_cpu
-#endif /* \r */
+#endif /* */
#ifndef be16toh
#define be16toh be16_to_cpu
-#endif /* \r */
+#endif /* */
#ifndef le32toh
#define le32toh le32_to_cpu
-#endif /* \r */
+#endif /* */
#ifndef be32toh
#define be32toh be32_to_cpu
-#endif /* \r */
+#endif /* */
#ifndef htons
#define htons be16_to_cpu
-#endif /* \r */
+#endif /* */
#ifndef htonl
#define htonl cpu_to_be16
-#endif /* \r */
+#endif /* */
#ifndef ntohs
#define ntohs cpu_to_be16
-#endif /* \r */
+#endif /* */
#ifndef ntohl
#define ntohl cpu_to_be32
-#endif /* \r */
-#endif /* \r */
+#endif /* */
+#endif /* */
#define IEEE80211_AID(b) ((b) &~ 0xc000)
-/*
+/*
* RTS frame length parameters. The default is specified in
* the 802.11 spec as 512; we treat it as implementation-dependent
* so it's defined in ieee80211_var.h. The max may be wrong
#define IEEE80211_RTS_MIN 1
#define IEEE80211_RTS_MAX 2346
-/*
+/*
* TX fragmentation parameters. As above for RTS, we treat
* default as implementation-dependent so define it elsewhere.
*/
/**
* @file util/bandwidth.c
- * @brief functions related to bandwidth (unit)
+ * @brief functions related to bandwidth (unit)
* @author Christian Grothoff
*/
#include "platform.h"
/**
- * Context for processing
+ * Context for processing
* "GNUNET_CLIENT_transmit_and_get_response" requests.
*/
struct TransmitGetResponseContext
*
* @param service name of the service to wait for
* @param cfg configuration to use
- * @param timeout how long to wait at most
+ * @param timeout how long to wait at most
* @param task task to run if service is running
* (reason will be "PREREQ_DONE" (service running)
* or "TIMEOUT" (service not known to be running))
/**
* Cancel a request for notification.
- *
+ *
* @param th handle from the original request.
*/
void
* if the caller does not care about temporary connection errors,
* for example because the protocol is stateless
* @param rn function to call with the response
- * @param rn_cls closure for rn
+ * @param rn_cls closure for rn
* @return GNUNET_OK on success, GNUNET_SYSERR if a request
* is already pending
*/
* @param cls the destination configuration (struct GNUNET_CONFIGURATION_Handle*)
* @param section section for the value
* @param option option name of the value
- * @param value value to copy
+ * @param value value to copy
*/
static void
copy_entry (void *cls, const char *section, const char *option,
/**
* During connect, we try multiple possible IP addresses
- * to find out which one might work.
+ * to find out which one might work.
*/
struct AddressProbe
{
const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
- * Linked list of sockets we are currently trying out
+ * Linked list of sockets we are currently trying out
* (during connect).
*/
struct AddressProbe *ap_head;
/**
- * Linked list of sockets we are currently trying out
+ * Linked list of sockets we are currently trying out
* (during connect).
*/
struct AddressProbe *ap_tail;
/**
* Close the socket and free associated resources. Pending
* transmissions may be completed or dropped depending on the
- * arguments. If a receive call is pending and should
+ * arguments. If a receive call is pending and should
* NOT be completed, 'GNUNET_CONNECTION_receive_cancel'
* should be called explicitly first.
*
/*
This file is part of GNUnet.
(C) 2008, 2009 Christian Grothoff (and other contributing authors)
-
+
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2, or (at your
option) any later version.
-
+
GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
/**
* Removes a node from the heap.
- *
+ *
* @param node node to remove
* @return element data stored at the node
*/
/**
* Create a fresh struct CONTAINER_MetaData token.
- *
+ *
* @return empty meta-data container
*/
struct GNUNET_CONTAINER_MetaData *
* used in the main libextractor library and yielding
* 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);
* can be NULL (if mime-type is not known)
* @param data actual meta-data found
* used in the main libextractor library and yielding
* 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);
* can be NULL (if mime-type is not known)
* @param data actual meta-data found
/**
* Duplicate struct GNUNET_CONTAINER_MetaData.
- *
+ *
* @param md what to duplicate
* @return duplicate meta-data container
*/
/**
- * Handle to a singly linked list
+ * Handle to a singly linked list
*/
struct GNUNET_CONTAINER_SList
{
/**
- * Handle to a singly linked list iterator
+ * Handle to a singly linked list iterator
*/
struct GNUNET_CONTAINER_SList_Iterator
{
* fast, not involve bits[0] or bits[4] (they're used elsewhere), and be
* somewhat consistent. And of course, the result should be a positive
* number.
- *
+ *
* @param a some hash code
* @param b some hash code
* @return a positive number which is a measure for
* setting. Second, as shown in Section 6, using HMAC with a truncated output as an extractor
* allows to prove the security of HKDF under considerably weaker assumptions on the underlying
* hash function."
- *
+ *
* http://eprint.iacr.org/2010/264
*/
/**
* Create a cryptographically weak pseudo-random number in the interval of 0 to 1.
- *
+ *
* @return number between 0 and 1.
*/
static double
* 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.
+ * 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.
/**
- * Iterate over all files in the given directory and
+ * Iterate over all files in the given directory and
* accumulate their size.
*
* @param cls closure of type "struct GetFileSizeData"
* 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
* filename.
- *
+ *
* @param t component to use for the name;
* does NOT contain "XXXXXX" or "/tmp/".
* @return NULL on error, otherwise name of fresh
* @param fn file name
* @param buffer the data to write
* @param n number of bytes to write
- * @param mode file permissions
+ * @param mode file permissions
* @return number of bytes written on success, GNUNET_SYSERR on error
*/
ssize_t
}
/**
- * Scan a directory for files.
+ * Scan a directory for files.
*
* @param dirName the name of the directory
* @param callback the method to call for each file,
/* Decode the current option-ARGV-element. */
/* Check whether the ARGV-element is a long option.
- *
+ *
* If long_only and the ARGV-element has the form "-f", where f is
* a valid short option, don't consider it an abbreviated form of
* a long option that starts with f. Otherwise there would be no
* way to give the -f short option.
- *
+ *
* On the other hand, if there's a long option "fubar" and
* the ARGV-element is "-fu", do consider that an abbreviation of
* the long option, just like "--fu", and not "-f" with arg "u".
- *
+ *
* This distinction seems to be the most useful approach. */
if (longopts != NULL &&
* @param scls additional closure (will point to the 'int')
* @param option name of the option
* @param value not used (NULL)
- * @return GNUNET_OK
+ * @return GNUNET_OK
*/
int
GNUNET_GETOPT_increment_value (struct GNUNET_GETOPT_CommandLineProcessorContext
/**
- * Set an option of type 'int' from the command line to 1 if the
+ * Set an option of type 'int' from the command line to 1 if the
* given option is present.
* A pointer to this function should be passed as part of the
* 'struct GNUNET_GETOPT_CommandLineOption' array to initialize options
* @param scls additional closure (will point to the 'int')
* @param option name of the option
* @param value not used (NULL)
- * @return GNUNET_OK
+ * @return GNUNET_OK
*/
int
GNUNET_GETOPT_set_one (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
* which will be allocated)
* @param option name of the option
* @param value actual value of the option (a string)
- * @return GNUNET_OK
+ * @return GNUNET_OK
*/
int
GNUNET_GETOPT_set_string (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
if (load->cummulative_request_count <= 1)
return;
/* calcuate std dev of latency; we have for n values of "i" that:
- *
+ *
* avg = (sum val_i) / n
* stddev = (sum (val_i - avg)^2) / (n-1)
* = (sum (val_i^2 - 2 avg val_i + avg^2) / (n-1)
* PATH environment variable as a search path.
*
* @param binary the name of the file to check
- * @return GNUNET_YES if the file is SUID,
+ * @return GNUNET_YES if the file is SUID,
* GNUNET_NO if not SUID (but binary exists)
* GNUNET_SYSERR on error (no such binary or not executable)
*/
/**
* Decrement multiple RCs of peer identities by one.
- *
+ *
* @param ids array of PIDs to decrement the RCs of
* @param count size of the ids array
*/
* Test if a plugin exists.
*
* Note that the library must export a symbol called
- * "library_name_init" for the test to succeed.
+ * "library_name_init" for the test to succeed.
*
* @param library_name name of the plugin to test if it is installed
* @return GNUNET_YES if the plugin exists, GNUNET_NO if not
#include "gnunet_pseudonym_lib.h"
#include "gnunet_bio_lib.h"
-/**
+/**
* Name of the directory which stores meta data for pseudonym
*/
#define PS_METADATA_DIR DIR_SEPARATOR_STR "data" DIR_SEPARATOR_STR "pseudonyms" DIR_SEPARATOR_STR "metadata" DIR_SEPARATOR_STR
-/**
+/**
* Name of the directory which stores names for pseudonyms
*/
#define PS_NAMES_DIR DIR_SEPARATOR_STR "data" DIR_SEPARATOR_STR "pseudonyms" DIR_SEPARATOR_STR "names" DIR_SEPARATOR_STR
-/**
+/**
* Registered callbacks for discovery of pseudonyms.
*/
struct DiscoveryCallback
{
- /**
+ /**
* This is a linked list.
*/
struct DiscoveryCallback *next;
- /**
+ /**
* Function to call each time a pseudonym is discovered.
*/
GNUNET_PSEUDONYM_Iterator callback;
- /**
+ /**
* Closure for callback.
*/
void *closure;
};
-/**
- * Head of the linked list of functions to call when
+/**
+ * Head of the linked list of functions to call when
* new pseudonyms are added.
*/
static struct DiscoveryCallback *head;
/**
* Return the unique, human readable name for the given namespace.
*
- * @param cfg configuration
+ * @param cfg configuration
* @param nsid cryptographic ID of the namespace
* @return NULL on failure (should never happen)
*/
/**
* List all available pseudonyms.
*
- * @param cfg overall configuration
+ * @param cfg overall configuration
* @param iterator function to call for each pseudonym
* @param closure closure for iterator
* @return number of pseudonyms found
/**
* Convert IP address to string without DNS resolution.
*
- * @param sa the address
+ * @param sa the address
* @param salen number of bytes in sa
* @return address as a string, NULL on error
*/
/**
- * We've been asked to lookup the address for a hostname and were
+ * We've been asked to lookup the address for a hostname and were
* given a valid numeric string. Perform the callbacks for the
* numeric addresses.
*
/**
- * We've been asked to lookup the address for a hostname and were
+ * We've been asked to lookup the address for a hostname and were
* given a variant of "loopback". Perform the callbacks for the
* respective loopback numeric addresses.
*
* empty. Keep running tasks until we are either no longer running
* "URGENT" tasks or until we have at least one "pending" task (which
* may become ready, hence we should select on it). Naturally, if
- * there are no more ready tasks, we also return.
+ * there are no more ready tasks, we also return.
*
* @param rs FDs ready for reading
* @param ws FDs ready for writing
/**
* Check if the system is still life. Trigger shutdown if we
- * have tasks, but none of them give us lifeness.
+ * have tasks, but none of them give us lifeness.
*
* @return GNUNET_OK to continue the main loop,
* GNUNET_NO to exit
/**
* Obtain the reason code for why the current task was
- * started. Will return the same value as
+ * started. Will return the same value as
* the GNUNET_SCHEDULER_TaskContext's reason field.
*
* @return reason(s) why the current task is run
* will be scheduled for execution once the delay has expired. It
* will be run with the priority of the calling task.
*
- * @param delay when should this operation time out? Use
+ * @param delay when should this operation time out? Use
* GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown"
* @param task main function of the task
* @param task_cls closure of task
* socket operation is ready. It will be run with the priority of
* the calling task.
*
- * @param delay when should this operation time out? Use
+ * @param delay when should this operation time out? Use
* GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown"
* @param rfd read file-descriptor
* @param task main function of the task
* socket operation is ready. It will be run with the priority of
* the calling task.
*
- * @param delay when should this operation time out? Use
+ * @param delay when should this operation time out? Use
* GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown"
* @param wfd write file-descriptor
* @param task main function of the task
* socket operation is ready. It will be run with the priority of
* the calling task.
*
- * @param delay when should this operation time out? Use
+ * @param delay when should this operation time out? Use
* GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown"
* @param rfd read file-descriptor
* @param task main function of the task
* socket operation is ready. It will be run with the priority of
* the calling task.
*
- * @param delay when should this operation time out? Use
+ * @param delay when should this operation time out? Use
* GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown"
* @param wfd write file-descriptor
* @param task main function of the task
/**
* Process messages from the client's message tokenizer until either
- * the tokenizer is empty (and then schedule receiving more), or
+ * the tokenizer is empty (and then schedule receiving more), or
* until some handler is not immediately done (then wait for restart_processing)
* or shutdown.
*
/**
* Wrapper for transmission notification that calls the original
* callback and update the last activity time for our connection.
- *
+ *
* @param cls the 'struct GNUNET_SERVER_Client'
* @param size number of bytes we can transmit
- * @param buf where to copy the message
+ * @param buf where to copy the message
* @return number of bytes actually transmitted
*/
static size_t
* @param client_identity ID of client for which this is a buffer
* @param buf input data to add
* @param size number of bytes in buf
- * @param purge should any excess bytes in the buffer be discarded
+ * @param purge should any excess bytes in the buffer be discarded
* (i.e. for packet-based services like UDP)
* @param one_shot only call callback once, keep rest of message in buffer
* @return GNUNET_OK if we are done processing (need more data)
/**
* @file util/server_nc.c
* @brief convenience functions for transmission of
- * a notification stream
+ * a notification stream
* @author Christian Grothoff
*/
struct ClientList *next;
/**
- * Overall context this client belongs to.
+ * Overall context this client belongs to.
*/
struct GNUNET_SERVER_NotificationContext *nc;
*saddrs = (struct sockaddr *) un;
*saddrlens = slen;
#else
- /* this function should never be called
+ /* this function should never be called
* unless AF_UNIX is defined! */
GNUNET_assert (0);
#endif
n1 = GNUNET_CONTAINER_heap_peek (myHeap);
GNUNET_assert (NULL == n1);
- // GNUNET_CONTAINER_heap_walk_get_next: heap empty, taking if-branch
+ // GNUNET_CONTAINER_heap_walk_get_next: heap empty, taking if-branch
n1 = GNUNET_CONTAINER_heap_walk_get_next (myHeap);
GNUNET_assert (NULL == n1);
GNUNET_assert (NULL != n1);
- // GNUNET_CONTAINER_heap_peek not empty, taking if-branch
+ // GNUNET_CONTAINER_heap_peek not empty, taking if-branch
n2 = NULL;
n2 = GNUNET_CONTAINER_heap_peek (myHeap);
GNUNET_assert (NULL != n2);
GNUNET_CONTAINER_heap_destroy (myHeap);
- // My additions to a complete testcase
+ // My additions to a complete testcase
// Testing a GNUNET_CONTAINER_HEAP_ORDER_MIN
// Testing remove_node
#define DEBUG GNUNET_NO
/**
- * A list of Peer ID's to play with
+ * A list of Peer ID's to play with
*/
static struct GNUNET_PeerIdentity pidArr[NUMBER_OF_PEERS];
GNUNET_PEER_resolve (1, &res);
GNUNET_assert (0 == memcmp (&res, &pidArr[0], sizeof (res)));
- /*
- * Attempt to convert pid = 0 (which is reserved)
+ /*
+ * Attempt to convert pid = 0 (which is reserved)
* into a peer identity object, the peer identity memory
- * is expected to be set to zero
+ * is expected to be set to zero
*/
memset (&zero, 0, sizeof (struct GNUNET_PeerIdentity));
GNUNET_log_skip (1, GNUNET_YES);
#define VERBOSE GNUNET_NO
-/**
+/**
* Using DNS root servers to check gnunet's resolver service
* a.root-servers.net <-> 198.41.0.4 is a fix 1:1 mapping that should not change over years
* For more information have a look at IANA's website http://www.root-servers.org/
/**
- * Calculate the estimate time of arrival/completion
+ * Calculate the estimate time of arrival/completion
* for an operation.
*
* @param start when did the operation start?
* @param udp_redirects
* @param tcp_redirects
*
- * @return
+ * @return
*/
uint64_t
get_port_from_redirects (const char *udp_redirects, const char *tcp_redirects)