GNUnet  0.10.x
Typedefs | Functions
fs_test_lib.h File Reference

library routines for testing FS publishing and downloading; this code is limited to flat files and no keywords (those functions can be tested with single-peer setups; this is for testing routing). More...

#include "gnunet_util_lib.h"
#include "gnunet_fs_service.h"
#include "gnunet_testbed_service.h"
Include dependency graph for fs_test_lib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef void(* GNUNET_FS_TEST_UriContinuation) (void *cls, const struct GNUNET_FS_Uri *uri, const char *fn)
 Function signature. More...
 

Functions

void GNUNET_FS_TEST_publish (struct GNUNET_TESTBED_Peer *peer, struct GNUNET_TIME_Relative timeout, uint32_t anonymity, int do_index, uint64_t size, uint32_t seed, unsigned int verbose, GNUNET_FS_TEST_UriContinuation cont, void *cont_cls)
 Publish a file at the given daemon. More...
 
void GNUNET_FS_TEST_download (struct GNUNET_TESTBED_Peer *peer, struct GNUNET_TIME_Relative timeout, uint32_t anonymity, uint32_t seed, const struct GNUNET_FS_Uri *uri, unsigned int verbose, GNUNET_SCHEDULER_TaskCallback cont, void *cont_cls)
 Perform test download. More...
 

Detailed Description

library routines for testing FS publishing and downloading; this code is limited to flat files and no keywords (those functions can be tested with single-peer setups; this is for testing routing).

Author
Christian Grothoff

Definition in file fs_test_lib.h.

Typedef Documentation

◆ GNUNET_FS_TEST_UriContinuation

typedef void(* GNUNET_FS_TEST_UriContinuation) (void *cls, const struct GNUNET_FS_Uri *uri, const char *fn)

Function signature.

Parameters
clsclosure (user defined)
uria URI, NULL for errors
fnname of the file on disk to be removed upon completion, or NULL for inserted files (also NULL on error)

Definition at line 46 of file fs_test_lib.h.

Function Documentation

◆ GNUNET_FS_TEST_publish()

void GNUNET_FS_TEST_publish ( struct GNUNET_TESTBED_Peer peer,
struct GNUNET_TIME_Relative  timeout,
uint32_t  anonymity,
int  do_index,
uint64_t  size,
uint32_t  seed,
unsigned int  verbose,
GNUNET_FS_TEST_UriContinuation  cont,
void *  cont_cls 
)

Publish a file at the given daemon.

Parameters
peerwhere to publish
timeoutif this operation cannot be completed within the given period, call the continuation with an error code
anonymityoption for publication
do_indexGNUNET_YES for index, GNUNET_NO for insertion, GNUNET_SYSERR for simulation
sizesize of the file to publish
seedseed to use for file generation
verbosehow verbose to be in reporting
contfunction to call when done
cont_clsclosure for cont

Publish a file at the given daemon.

Parameters
peerwhere to publish
timeoutif this operation cannot be completed within the given period, call the continuation with an error code
anonymityoption for publication
do_indexGNUNET_YES for index, GNUNET_NO for insertion, GNUNET_SYSERR for simulation
sizesize of the file to publish
seedseed to use for file generation
verbosehow verbose to be in reporting
contfunction to call when done
cont_clsclosure for cont

Definition at line 444 of file fs_test_lib.c.

References TestPublishOperation::anonymity, TestPublishOperation::do_index, fs_disconnect_adapter(), TestPublishOperation::fs_op, GNUNET_new, GNUNET_SCHEDULER_add_delayed(), GNUNET_TESTBED_service_connect(), publish_connect_adapter(), TestPublishOperation::publish_cont, TestPublishOperation::publish_cont_cls, publish_fs_connect_complete_cb(), TestPublishOperation::publish_seed, publish_timeout(), TestPublishOperation::publish_timeout_task, TestPublishOperation::size, and TestPublishOperation::verbose.

449 {
450  struct TestPublishOperation *po;
451 
452  po = GNUNET_new(struct TestPublishOperation);
453  po->publish_cont = cont;
454  po->publish_cont_cls = cont_cls;
455  po->publish_seed = seed;
456  po->anonymity = anonymity;
457  po->size = size;
458  po->verbose = verbose;
459  po->do_index = do_index;
461  peer,
462  "fs",
464  po,
467  po);
470 }
static void * publish_connect_adapter(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect adapter for publishing operation.
Definition: fs_test_lib.c:318
int do_index
Are we testing indexing? (YES: index, NO: insert, SYSERR: simulate)
Definition: fs_test_lib.c:104
void * publish_cont_cls
Closure for publish_cont.
Definition: fs_test_lib.c:59
uint32_t publish_seed
Seed for file generation.
Definition: fs_test_lib.c:69
#define GNUNET_new(type)
Allocate a struct or union of the given type.
GNUNET_FS_TEST_UriContinuation publish_cont
Function to call when upload is done.
Definition: fs_test_lib.c:54
static void publish_timeout(void *cls)
Task scheduled to run when publish operation times out.
Definition: fs_test_lib.c:207
struct GNUNET_TESTBED_Operation * fs_op
Handle for the operation to connect to the peer's 'fs' service.
Definition: fs_test_lib.c:44
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_service_connect(void *op_cls, struct GNUNET_TESTBED_Peer *peer, const char *service_name, GNUNET_TESTBED_ServiceConnectCompletionCallback cb, void *cb_cls, GNUNET_TESTBED_ConnectAdapter ca, GNUNET_TESTBED_DisconnectAdapter da, void *cada_cls)
Connect to a service offered by the given peer.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1237
static int verbose
uint32_t anonymity
Anonymity level used.
Definition: fs_test_lib.c:94
Handle for a publishing operation started for testing FS.
Definition: fs_test_lib.c:40
unsigned int verbose
Verbosity level of the current operation.
Definition: fs_test_lib.c:99
static unsigned int size
Size of the "table".
Definition: peer.c:66
static void publish_fs_connect_complete_cb(void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, const char *emsg)
Callback to be called when testbed has connected to the fs service.
Definition: fs_test_lib.c:357
static void fs_disconnect_adapter(void *cls, void *op_result)
Adapter function called to destroy connection to file-sharing service.
Definition: fs_test_lib.c:338
struct GNUNET_SCHEDULER_Task * publish_timeout_task
Task to abort publishing (timeout).
Definition: fs_test_lib.c:64
uint64_t size
Size of the file.
Definition: fs_test_lib.c:89
static unsigned int anonymity
Here is the call graph for this function:

◆ GNUNET_FS_TEST_download()

void GNUNET_FS_TEST_download ( struct GNUNET_TESTBED_Peer peer,
struct GNUNET_TIME_Relative  timeout,
uint32_t  anonymity,
uint32_t  seed,
const struct GNUNET_FS_Uri uri,
unsigned int  verbose,
GNUNET_SCHEDULER_TaskCallback  cont,
void *  cont_cls 
)

Perform test download.

Parameters
peerwhich peer to download from
timeoutif this operation cannot be completed within the given period, call the continuation with an error code
anonymityoption for download
seedused for file validation
uriURI of file to download (CHK/LOC only)
verbosehow verbose to be in reporting
contfunction to call when done
cont_clsclosure for cont
peerwhich peer to download from
timeoutif this operation cannot be completed within the given period, call the continuation with an error code
anonymityoption for download
seedused for file validation
uriURI of file to download (CHK/LOC only)
verbosehow verbose to be in reporting
contfunction to call when done
cont_clsclosure for cont

Definition at line 624 of file fs_test_lib.c.

References TestPublishOperation::anonymity, TestDownloadOperation::anonymity, download_connect_adapter(), TestDownloadOperation::download_cont, TestDownloadOperation::download_cont_cls, download_fs_connect_complete_cb(), TestDownloadOperation::download_seed, download_timeout(), TestDownloadOperation::download_timeout_task, fs_disconnect_adapter(), TestDownloadOperation::fs_op, GNUNET_FS_uri_chk_get_file_size(), GNUNET_FS_uri_dup(), GNUNET_new, GNUNET_SCHEDULER_add_delayed(), GNUNET_TESTBED_service_connect(), TestDownloadOperation::size, TestDownloadOperation::uri, TestPublishOperation::verbose, and TestDownloadOperation::verbose.

629 {
630  struct TestDownloadOperation *dop;
631 
632  dop = GNUNET_new(struct TestDownloadOperation);
633  dop->uri = GNUNET_FS_uri_dup(uri);
635  dop->verbose = verbose;
636  dop->anonymity = anonymity;
637  dop->download_cont = cont;
638  dop->download_cont_cls = cont_cls;
639  dop->download_seed = seed;
640 
642  peer,
643  "fs",
645  dop,
648  dop);
649  dop->download_timeout_task =
651 }
uint64_t size
Size of the file.
Definition: fs_test_lib.c:155
uint32_t anonymity
Anonymity level used.
Definition: fs_test_lib.c:160
GNUNET_SCHEDULER_TaskCallback download_cont
Function to call when download is done.
Definition: fs_test_lib.c:130
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct GNUNET_FS_Uri * uri
URI to download.
Definition: fs_test_lib.c:140
struct GNUNET_FS_Uri * GNUNET_FS_uri_dup(const struct GNUNET_FS_Uri *uri)
Duplicate URI.
Definition: fs_uri.c:995
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_service_connect(void *op_cls, struct GNUNET_TESTBED_Peer *peer, const char *service_name, GNUNET_TESTBED_ServiceConnectCompletionCallback cb, void *cb_cls, GNUNET_TESTBED_ConnectAdapter ca, GNUNET_TESTBED_DisconnectAdapter da, void *cada_cls)
Connect to a service offered by the given peer.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1237
static int verbose
unsigned int verbose
Verbosity level of the current operation.
Definition: fs_test_lib.c:170
uint32_t download_seed
Seed for download verification.
Definition: fs_test_lib.c:165
struct GNUNET_TESTBED_Operation * fs_op
Handle for the operation to connect to the peer's 'fs' service.
Definition: fs_test_lib.c:115
static void * download_connect_adapter(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect adapter for download operation.
Definition: fs_test_lib.c:571
static void fs_disconnect_adapter(void *cls, void *op_result)
Adapter function called to destroy connection to file-sharing service.
Definition: fs_test_lib.c:338
uint64_t GNUNET_FS_uri_chk_get_file_size(const struct GNUNET_FS_Uri *uri)
What is the size of the file that this URI refers to?
Definition: fs_uri.c:1368
void * download_cont_cls
Closure for download_cont.
Definition: fs_test_lib.c:135
static unsigned int anonymity
struct GNUNET_SCHEDULER_Task * download_timeout_task
Task to abort downloading (timeout).
Definition: fs_test_lib.c:145
Handle for a download operation started for testing FS.
Definition: fs_test_lib.c:111
static void download_timeout(void *cls)
Task scheduled to run when download operation times out.
Definition: fs_test_lib.c:482
static void download_fs_connect_complete_cb(void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, const char *emsg)
Callback to be called when testbed has connected to the fs service.
Definition: fs_test_lib.c:594
Here is the call graph for this function: