GNUnet  0.17.6
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 45 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

Definition at line 434 of file fs_test_lib.c.

439 {
440  struct TestPublishOperation *po;
441 
442  po = GNUNET_new (struct TestPublishOperation);
443  po->publish_cont = cont;
444  po->publish_cont_cls = cont_cls;
445  po->publish_seed = seed;
446  po->anonymity = anonymity;
447  po->size = size;
448  po->verbose = verbose;
449  po->do_index = do_index;
451  peer,
452  "fs",
454  po,
457  po);
460 }
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:340
static void * publish_connect_adapter(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect adapter for publishing operation.
Definition: fs_test_lib.c:320
static void publish_timeout(void *cls)
Task scheduled to run when publish operation times out.
Definition: fs_test_lib.c:209
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:359
static struct GNUNET_TIME_Relative timeout
Desired timeout for the lookup (default is no timeout).
Definition: gnunet-abd.c:61
static int verbose
static unsigned int anonymity
#define GNUNET_new(type)
Allocate a struct or union of the given type.
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:1254
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.
static unsigned int size
Size of the "table".
Definition: peer.c:67
Handle for a publishing operation started for testing FS.
Definition: fs_test_lib.c:41
void * publish_cont_cls
Closure for publish_cont.
Definition: fs_test_lib.c:60
uint32_t anonymity
Anonymity level used.
Definition: fs_test_lib.c:95
GNUNET_FS_TEST_UriContinuation publish_cont
Function to call when upload is done.
Definition: fs_test_lib.c:55
struct GNUNET_TESTBED_Operation * fs_op
Handle for the operation to connect to the peer's 'fs' service.
Definition: fs_test_lib.c:45
uint32_t publish_seed
Seed for file generation.
Definition: fs_test_lib.c:70
uint64_t size
Size of the file.
Definition: fs_test_lib.c:90
int do_index
Are we testing indexing? (YES: index, NO: insert, SYSERR: simulate)
Definition: fs_test_lib.c:105
unsigned int verbose
Verbosity level of the current operation.
Definition: fs_test_lib.c:100
struct GNUNET_SCHEDULER_Task * publish_timeout_task
Task to abort publishing (timeout).
Definition: fs_test_lib.c:65
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.

References TestPublishOperation::anonymity, anonymity, TestPublishOperation::do_index, fs_disconnect_adapter(), TestPublishOperation::fs_op, GNUNET_new, GNUNET_SCHEDULER_add_delayed(), GNUNET_TESTBED_service_connect(), peer, 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, size, timeout, verbose, and TestPublishOperation::verbose.

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

Definition at line 601 of file fs_test_lib.c.

606 {
607  struct TestDownloadOperation *dop;
608 
609  dop = GNUNET_new (struct TestDownloadOperation);
610  dop->uri = GNUNET_FS_uri_dup (uri);
612  dop->verbose = verbose;
613  dop->anonymity = anonymity;
614  dop->download_cont = cont;
615  dop->download_cont_cls = cont_cls;
616  dop->download_seed = seed;
617 
619  peer,
620  "fs",
622  dop,
625  dop);
626  dop->download_timeout_task =
628 }
static void download_timeout(void *cls)
Task scheduled to run when download operation times out.
Definition: fs_test_lib.c:472
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:584
static void * download_connect_adapter(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect adapter for download operation.
Definition: fs_test_lib.c:561
static struct GNUNET_FS_Uri * uri
Value of URI provided on command-line (when not publishing a file but just creating UBlocks to refer ...
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:1376
struct GNUNET_FS_Uri * GNUNET_FS_uri_dup(const struct GNUNET_FS_Uri *uri)
Duplicate URI.
Definition: fs_uri.c:1003
Handle for a download operation started for testing FS.
Definition: fs_test_lib.c:113
uint32_t download_seed
Seed for download verification.
Definition: fs_test_lib.c:167
uint32_t anonymity
Anonymity level used.
Definition: fs_test_lib.c:162
unsigned int verbose
Verbosity level of the current operation.
Definition: fs_test_lib.c:172
struct GNUNET_FS_Uri * uri
URI to download.
Definition: fs_test_lib.c:142
struct GNUNET_SCHEDULER_Task * download_timeout_task
Task to abort downloading (timeout).
Definition: fs_test_lib.c:147
void * download_cont_cls
Closure for download_cont.
Definition: fs_test_lib.c:137
struct GNUNET_TESTBED_Operation * fs_op
Handle for the operation to connect to the peer's 'fs' service.
Definition: fs_test_lib.c:117
uint64_t size
Size of the file.
Definition: fs_test_lib.c:157
GNUNET_SCHEDULER_TaskCallback download_cont
Function to call when download is done.
Definition: fs_test_lib.c:132

References TestDownloadOperation::anonymity, 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(), peer, TestDownloadOperation::size, timeout, TestDownloadOperation::uri, uri, verbose, and TestDownloadOperation::verbose.

Here is the call graph for this function: