[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r4799 - in GNUnet: . src/applications/dht/module src/applic
From: |
gnunet |
Subject: |
[GNUnet-SVN] r4799 - in GNUnet: . src/applications/dht/module src/applications/dht/tools src/applications/dstore src/applications/fragmentation src/applications/fs/collection src/applications/fs/ecrs src/applications/fs/fsui src/applications/fs/lib src/applications/fs/module src/applications/fs/namespace src/applications/fs/uritrack src/applications/gap src/applications/identity src/applications/kvstore_sqlite src/applications/rpc src/applications/session src/applications/sqstore_mysql src/applications/sqstore_sqlite src/applications/tbench src/applications/traffic src/include src/server src/util src/util/config_impl src/util/disk src/util/network src/util/network_client src/util/os |
Date: |
Sat, 26 May 2007 19:03:54 -0600 (MDT) |
Author: grothoff
Date: 2007-05-26 19:03:54 -0600 (Sat, 26 May 2007)
New Revision: 4799
Added:
GNUnet/src/applications/fs/module/dht_push.c
GNUnet/src/applications/fs/module/dht_push.h
GNUnet/src/applications/identity/clientapi.c
GNUnet/src/applications/identity/identity.h
GNUnet/src/include/gnunet_identity_lib.h
Modified:
GNUnet/ChangeLog
GNUnet/src/applications/dht/module/Makefile.am
GNUnet/src/applications/dht/tools/check.conf
GNUnet/src/applications/dht/tools/peer1.conf
GNUnet/src/applications/dht/tools/peer2.conf
GNUnet/src/applications/dstore/check.conf
GNUnet/src/applications/fragmentation/check.conf
GNUnet/src/applications/fs/collection/check.conf
GNUnet/src/applications/fs/collection/collection.c
GNUnet/src/applications/fs/collection/collectiontest.c
GNUnet/src/applications/fs/collection/peer.conf
GNUnet/src/applications/fs/ecrs/check.conf
GNUnet/src/applications/fs/ecrs/download.c
GNUnet/src/applications/fs/ecrs/namespace.c
GNUnet/src/applications/fs/ecrs/namespacetest.c
GNUnet/src/applications/fs/ecrs/peer.conf
GNUnet/src/applications/fs/ecrs/search.c
GNUnet/src/applications/fs/ecrs/upload.c
GNUnet/src/applications/fs/fsui/check.conf
GNUnet/src/applications/fs/fsui/download.c
GNUnet/src/applications/fs/fsui/fsuitest.c
GNUnet/src/applications/fs/fsui/fsuitest2.c
GNUnet/src/applications/fs/fsui/peer.conf
GNUnet/src/applications/fs/fsui/search.c
GNUnet/src/applications/fs/fsui/upload.c
GNUnet/src/applications/fs/lib/check.conf
GNUnet/src/applications/fs/lib/fslib.c
GNUnet/src/applications/fs/lib/fslibtest.c
GNUnet/src/applications/fs/lib/peer.conf
GNUnet/src/applications/fs/module/Makefile.am
GNUnet/src/applications/fs/module/fs.c
GNUnet/src/applications/fs/module/migration.h
GNUnet/src/applications/fs/namespace/check.conf
GNUnet/src/applications/fs/namespace/namespace_infotest.c
GNUnet/src/applications/fs/namespace/peer.conf
GNUnet/src/applications/fs/uritrack/check.conf
GNUnet/src/applications/gap/check.conf
GNUnet/src/applications/gap/gap.c
GNUnet/src/applications/gap/peer1.conf
GNUnet/src/applications/gap/peer2.conf
GNUnet/src/applications/identity/Makefile.am
GNUnet/src/applications/identity/check.conf
GNUnet/src/applications/identity/identity.c
GNUnet/src/applications/kvstore_sqlite/check.conf
GNUnet/src/applications/rpc/Makefile.am
GNUnet/src/applications/session/check.conf
GNUnet/src/applications/session/peer1.conf
GNUnet/src/applications/session/peer2.conf
GNUnet/src/applications/sqstore_mysql/mysql.c
GNUnet/src/applications/sqstore_sqlite/sqlite.c
GNUnet/src/applications/tbench/check.conf
GNUnet/src/applications/tbench/peer1.conf
GNUnet/src/applications/tbench/peer1udp.conf
GNUnet/src/applications/tbench/peer2.conf
GNUnet/src/applications/tbench/peer2udp.conf
GNUnet/src/applications/traffic/Makefile.am
GNUnet/src/applications/traffic/clientapi.c
GNUnet/src/applications/traffic/traffic.c
GNUnet/src/include/Makefile.am
GNUnet/src/include/fs.h
GNUnet/src/include/gnunet_fs_lib.h
GNUnet/src/include/gnunet_gap_service.h
GNUnet/src/include/gnunet_protocols.h
GNUnet/src/include/gnunet_sqstore_service.h
GNUnet/src/include/gnunet_traffic_lib.h
GNUnet/src/include/gnunet_uritrack_lib.h
GNUnet/src/include/gnunet_util.h
GNUnet/src/server/tcpserver.c
GNUnet/src/util/check.conf
GNUnet/src/util/config_impl/impl.c
GNUnet/src/util/disk/storage.c
GNUnet/src/util/network/select.c
GNUnet/src/util/network_client/check.conf
GNUnet/src/util/network_client/tcpio.c
GNUnet/src/util/os/check.conf
GNUnet/todo
Log:
fixing various bugs, towards integrating DHT into FS
Modified: GNUnet/ChangeLog
===================================================================
--- GNUnet/ChangeLog 2007-05-23 15:53:44 UTC (rev 4798)
+++ GNUnet/ChangeLog 2007-05-27 01:03:54 UTC (rev 4799)
@@ -1,3 +1,17 @@
+Sat May 26 18:24:15 MDT 2007
+ Fixed bugs with testcases (changes in names and
+ structure of options were not reflected in .conf
+ files for various testcases).
+ Fixed issues with command-line option handling (failed to
+ override configuration file options).
+ Fixed bogus nesting in GAP routing algorithm (caused
+ random request drops).
+
+Fri May 25 12:23:38 MDT 2007
+ Finished extended URITRACK API.
+ Renamed various (minor) libraries and function calls to
+ get somewhat more consistent naming conventions.
+
Sun Apr 15 22:15:37 MDT 2007
Implemented heuristic for better packing of gnunet-directories.
Modified: GNUnet/src/applications/dht/module/Makefile.am
===================================================================
--- GNUnet/src/applications/dht/module/Makefile.am 2007-05-23 15:53:44 UTC
(rev 4798)
+++ GNUnet/src/applications/dht/module/Makefile.am 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -17,7 +17,7 @@
$(top_builddir)/src/util/containers/libgnunetutil_containers.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/util/cron/libgnunetutil_cron.la \
- $(top_builddir)/src/applications/rpc/libgnunetmodule_rpc_util.la
+ $(top_builddir)/src/applications/rpc/libgnunetrpc_util.la
libgnunetmodule_dht_la_LDFLAGS = \
-export-dynamic -avoid-version -module
Modified: GNUnet/src/applications/dht/tools/check.conf
===================================================================
--- GNUnet/src/applications/dht/tools/check.conf 2007-05-23 15:53:44 UTC
(rev 4798)
+++ GNUnet/src/applications/dht/tools/check.conf 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -7,6 +7,5 @@
# Network options for the clients
[NETWORK]
-CLIENT-PORT = 2087
-HOST = "localhost"
+HOST = "localhost:2087"
Modified: GNUnet/src/applications/dht/tools/peer1.conf
===================================================================
--- GNUnet/src/applications/dht/tools/peer1.conf 2007-05-23 15:53:44 UTC
(rev 4798)
+++ GNUnet/src/applications/dht/tools/peer1.conf 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -1,6 +1,9 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
+[PATHS]
+GNUNETD_HOME = peer1
+
[GNUNETD]
GNUNETD_HOME = peer1
# VALGRIND = 300
Modified: GNUnet/src/applications/dht/tools/peer2.conf
===================================================================
--- GNUnet/src/applications/dht/tools/peer2.conf 2007-05-23 15:53:44 UTC
(rev 4798)
+++ GNUnet/src/applications/dht/tools/peer2.conf 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -1,6 +1,9 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
+[PATHS]
+GNUNETD_HOME = peer2
+
[GNUNETD]
GNUNETD_HOME = peer2
# VALGRIND = 300
Modified: GNUnet/src/applications/dstore/check.conf
===================================================================
--- GNUnet/src/applications/dstore/check.conf 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/dstore/check.conf 2007-05-27 01:03:54 UTC (rev
4799)
@@ -1,3 +1,4 @@
+[PATHS]
GNUNETD_HOME = /tmp/gnunet-sqlite-sqstore-test
[GNUNETD]
Modified: GNUnet/src/applications/fragmentation/check.conf
===================================================================
--- GNUnet/src/applications/fragmentation/check.conf 2007-05-23 15:53:44 UTC
(rev 4798)
+++ GNUnet/src/applications/fragmentation/check.conf 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -1,3 +1,6 @@
+[PATHS]
+GNUNETD_HOME = "/tmp/gnunet-fragmentation-test"
+
[GNUNETD]
GNUNETD_HOME = "/tmp/gnunet-fragmentation-test"
HELLOEXPIRES = 1440
Modified: GNUnet/src/applications/fs/collection/check.conf
===================================================================
--- GNUnet/src/applications/fs/collection/check.conf 2007-05-23 15:53:44 UTC
(rev 4798)
+++ GNUnet/src/applications/fs/collection/check.conf 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -7,6 +7,5 @@
# Network options for the clients
[NETWORK]
-CLIENT-PORT = 12087
-HOST = "localhost"
+HOST = "localhost:12087"
Modified: GNUnet/src/applications/fs/collection/collection.c
===================================================================
--- GNUnet/src/applications/fs/collection/collection.c 2007-05-23 15:53:44 UTC
(rev 4798)
+++ GNUnet/src/applications/fs/collection/collection.c 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -453,7 +453,7 @@
meta,
anonymityLevel,
prio,
- now + COLLECTION_ADV_LIFETIME,
+ get_time() + COLLECTION_ADV_LIFETIME,
advertisement,
&nextId);
if (rootURI == NULL) {
@@ -622,7 +622,7 @@
NO, /* indexing */
ntohl(collectionData->data.anonymityLevel),
ntohl(collectionData->data.priority),
- now + COLLECTION_ADV_LIFETIME,
+ get_time() + COLLECTION_ADV_LIFETIME,
NULL,
NULL,
NULL,
@@ -640,7 +640,7 @@
collectionData->name,
ntohl(collectionData->data.anonymityLevel),
ntohl(collectionData->data.priority),
- now + COLLECTION_ADV_LIFETIME,
+ get_time() + COLLECTION_ADV_LIFETIME,
now,
ntohl(collectionData->data.updateInterval),
&collectionData->data.lastId,
Modified: GNUnet/src/applications/fs/collection/collectiontest.c
===================================================================
--- GNUnet/src/applications/fs/collection/collectiontest.c 2007-05-23
15:53:44 UTC (rev 4798)
+++ GNUnet/src/applications/fs/collection/collectiontest.c 2007-05-27
01:03:54 UTC (rev 4799)
@@ -62,7 +62,7 @@
GE_ASSERT(NULL, daemon > 0);
CHECK(OK == connection_wait_for_running(NULL,
cfg,
- 30 * cronSECONDS));
+ 60 * cronSECONDS));
PTHREAD_SLEEP(5 * cronSECONDS); /* give apps time to start */
#endif
ok = YES;
Modified: GNUnet/src/applications/fs/collection/peer.conf
===================================================================
--- GNUnet/src/applications/fs/collection/peer.conf 2007-05-23 15:53:44 UTC
(rev 4798)
+++ GNUnet/src/applications/fs/collection/peer.conf 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -1,6 +1,7 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
+[PATHS]
GNUNETD_HOME = /tmp/gnunet-check-collection
[GNUNETD]
Modified: GNUnet/src/applications/fs/ecrs/check.conf
===================================================================
--- GNUnet/src/applications/fs/ecrs/check.conf 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/fs/ecrs/check.conf 2007-05-27 01:03:54 UTC (rev
4799)
@@ -2,11 +2,14 @@
[GNUNET]
GNUNET_HOME = "/tmp/gnunet-ecrs-test-driver"
LOGLEVEL = "WARNING"
-LOGFILE = ""
PROCESS-PRIORITY = "NORMAL"
+[LOGGING]
+USER-LEVEL = ERROR
+ADMIN-LEVEL = WARNING
+
+
# Network options for the clients
[NETWORK]
-CLIENT-PORT = 2087
-HOST = "localhost"
+HOST = "localhost:2087"
Modified: GNUnet/src/applications/fs/ecrs/download.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/download.c 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/fs/ecrs/download.c 2007-05-27 01:03:54 UTC (rev
4799)
@@ -375,6 +375,8 @@
struct GC_Configuration * cfg;
+ PeerIdentity target;
+
/**
* Number of pending requests (highest used index)
*/
@@ -418,6 +420,12 @@
*/
int shutdown;
+ /**
+ * Do we have a specific peer from which we download
+ * from?
+ */
+ int have_target;
+
} RequestManager;
/**
@@ -1150,6 +1158,7 @@
entry->searchHandle);
entry->searchHandle
= FS_start_search(rm->sctx,
+ rm->have_target == NO ? NULL : &rm->target,
D_BLOCK,
1,
&entry->node->chk.query,
@@ -1352,6 +1361,8 @@
return OK;
}
fid = uri->data.fi;
+
+
if (! ECRS_isFileUri(uri)) {
GE_BREAK(ectx, 0);
FREE(realFN);
Modified: GNUnet/src/applications/fs/ecrs/namespace.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/namespace.c 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/fs/ecrs/namespace.c 2007-05-27 01:03:54 UTC (rev
4799)
@@ -405,6 +405,7 @@
char * dst;
unsigned long long len;
HashCode512 hc;
+ int ret;
/* FIRST: read pseudonym! */
fileName = getPseudonymFileName(ectx, cfg, name);
@@ -518,17 +519,19 @@
- sizeof(PublicKey)
- sizeof(HashCode512));
/* FINALLY: sign & publish SBlock */
- GE_ASSERT(ectx, OK == sign(hk,
- size
- - sizeof(Signature)
- - sizeof(PublicKey)
- - sizeof(unsigned int),
- &sb->identifier,
- &sb->signature));
+ GE_ASSERT(ectx,
+ OK == sign(hk,
+ size
+ - sizeof(Signature)
+ - sizeof(PublicKey)
+ - sizeof(unsigned int),
+ &sb->identifier,
+ &sb->signature));
freePrivateKey(hk);
sock = client_connection_create(ectx, cfg);
- if (OK != FS_insert(sock, value)) {
+ ret = FS_insert(sock, value);
+ if (ret != OK) {
FREE(uri);
uri = NULL;
}
Modified: GNUnet/src/applications/fs/ecrs/namespacetest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/namespacetest.c 2007-05-23 15:53:44 UTC
(rev 4798)
+++ GNUnet/src/applications/fs/ecrs/namespacetest.c 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -78,9 +78,9 @@
CHECKNAME,
0,
0,
+ 5 * cronMINUTES + get_time(),
TIME(NULL) + 300,
- TIME(NULL),
- 1 * cronMINUTES,
+ 0,
&thisId,
&nextId,
uri,
Modified: GNUnet/src/applications/fs/ecrs/peer.conf
===================================================================
--- GNUnet/src/applications/fs/ecrs/peer.conf 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/fs/ecrs/peer.conf 2007-05-27 01:03:54 UTC (rev
4799)
@@ -1,6 +1,6 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
-
+[PATHS]
GNUNETD_HOME = /tmp/gnunet-check-ecrs
[GNUNETD]
Modified: GNUnet/src/applications/fs/ecrs/search.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/search.c 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/fs/ecrs/search.c 2007-05-27 01:03:54 UTC (rev
4799)
@@ -629,6 +629,7 @@
#endif
ps->handle
= FS_start_search(ctx.sctx,
+ NULL,
ps->type,
ps->keyCount,
ps->keys,
Modified: GNUnet/src/applications/fs/ecrs/upload.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/upload.c 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/fs/ecrs/upload.c 2007-05-27 01:03:54 UTC (rev
4799)
@@ -429,9 +429,10 @@
iblocks[i] = NULL;
}
#if DEBUG_UPLOAD
- IF_GELOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
- hash2enc(&mchk.query,
- &enc));
+ IF_GELOG(ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ hash2enc(&mchk.query,
+ &enc));
GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
"Query for top block is %s\n",
&enc);
Modified: GNUnet/src/applications/fs/fsui/check.conf
===================================================================
--- GNUnet/src/applications/fs/fsui/check.conf 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/fs/fsui/check.conf 2007-05-27 01:03:54 UTC (rev
4799)
@@ -1,56 +1,22 @@
-# This is the configuration for the GNUnet daemon when running
+# This is the configuration for the GNUnet clients when running
# the test in this directory (make check).
-GNUNETD_HOME = /tmp/gnunet-check-fsui
-[GNUNETD]
-GNUNETD_HOME = /tmp/gnunet-check-fsui
-# VALGRIND = 300
-HELLOEXPIRES = 60
-LOGFILE = $GNUNETD_HOME/logs
-KEEPLOG = 0
-PIDFILE = $GNUNETD_HOME/gnunetd.pid
-HOSTS = $GNUNETD_HOME/data/hosts/
-APPLICATIONS = "fs getoption stats"
-# TRANSPORTS = -- no transports!
+[PATHS]
+GNUNET_HOME = /tmp/gnunet-check-fsui-client
+[GNUNET]
+GNUNET_HOME = /tmp/gnunet-check-fsui
+LOGFILE = $GNUNET_HOME/logs
+PROCESS-PRIORITY = "NORMAL"
+
[LOGGING]
USER-LEVEL = ERROR
-ADMIN-LEVEL = ERROR
+ADMIN-LEVEL = WARNING
-[MODULES]
-sqstore = "sqstore_sqlite"
-# you can also use sqstore_mysql here if
-# that DB is available...
-topology = "topology_default"
[NETWORK]
-PORT = 12087
-INTERFACE = eth0
-HELOEXCHANGE = NO
-TRUSTED = 127.0.0.0/8;
+HOST = "localhost:12087"
-[LOAD]
-INTERFACES = eth0
-BASICLIMITING = YES
-MAXNETUPBPSTOTAL = 50000
-MAXNETDOWNBPSTOTAL = 50000
-MAXCPULOAD = 100
+[DAEMON]
+CONFIGFILE = peer.conf
-[FS]
-QUOTA = 1024
-ACTIVEMIGRATION = NO
-DIR = /tmp/gnunet-fsui-test/
-INDEX-DIRECTORY = $GNUNETD_HOME/data/shared/
-INDEX-QUOTA = 8192
-
-[MYSQL]
-DELAYED = NO
-DATABASE = gnunetcheck
-
-[GAP]
-TABLESIZE = 65536
-
-[DHT]
-BUCKETCOUNT = 160
-MASTER-TABLE-SIZE = 65536
-
Modified: GNUnet/src/applications/fs/fsui/download.c
===================================================================
--- GNUnet/src/applications/fs/fsui/download.c 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/fs/fsui/download.c 2007-05-27 01:03:54 UTC (rev
4799)
@@ -35,6 +35,28 @@
#define DEBUG_DTM NO
/**
+ * Mark the given URI as found in a directory
+ * in URITRACK.
+ */
+static int listURIfoundDirectory(const ECRS_FileInfo * fi,
+ const HashCode512 * key,
+ int isRoot,
+ void * prnt) {
+ FSUI_DownloadList * dl = prnt;
+
+ if (isRoot == YES)
+ return OK; /* namespace ad, ignore */
+ URITRACK_addState(dl->ctx->ectx,
+ dl->ctx->cfg,
+ fi->uri,
+ URITRACK_DIRECTORY_FOUND);
+
+ return OK;
+}
+
+
+
+/**
* Start to download a file.
*/
static FSUI_DownloadList *
@@ -47,6 +69,10 @@
struct FSUI_SearchList * psearch,
FSUI_DownloadList * parent);
+/**
+ * Initiate a (recursive) download of the given
+ * directory entry.
+ */
static int triggerRecursiveDownload(const ECRS_FileInfo * fi,
const HashCode512 * key,
int isRoot,
@@ -172,6 +198,17 @@
else
dl->is_directory = NO;
}
+ if (dl->is_directory == YES) {
+ md = NULL;
+ ECRS_listDirectory(dl->ctx->ectx,
+ lastBlock,
+ lastBlockSize,
+ &md,
+ &listURIfoundDirectory,
+ dl);
+ if (md != NULL)
+ ECRS_freeMetaData(md);
+ }
if ( (dl->is_recursive == YES) &&
(dl->is_directory == YES) ) {
md = NULL;
@@ -248,6 +285,10 @@
event.data.DownloadCompleted.total = dl->total;
event.data.DownloadCompleted.filename = dl->filename;
event.data.DownloadCompleted.uri = dl->fi.uri;
+ URITRACK_addState(dl->ctx->ectx,
+ dl->ctx->cfg,
+ dl->fi.uri,
+ URITRACK_DOWNLOAD_COMPLETED);
dl->ctx->ecb(dl->ctx->ecbClosure,
&event);
} else if (dl->state == FSUI_ACTIVE) {
@@ -266,7 +307,10 @@
if (error == NULL)
error = _("Download failed (no reason given)");
event.data.DownloadError.message = error;
-
+ URITRACK_addState(dl->ctx->ectx,
+ dl->ctx->cfg,
+ dl->fi.uri,
+ URITRACK_DOWNLOAD_ABORTED);
dl->ctx->ecb(dl->ctx->ecbClosure,
&event);
} else if (dl->state == FSUI_ABORTED) { /* aborted */
@@ -277,6 +321,10 @@
event.data.DownloadAborted.dc.pcctx = dl->parent->cctx;
event.data.DownloadAborted.dc.spos = dl->search;
event.data.DownloadAborted.dc.sctx = dl->search == NULL ? NULL :
dl->search->cctx;
+ URITRACK_addState(dl->ctx->ectx,
+ dl->ctx->cfg,
+ dl->fi.uri,
+ URITRACK_DOWNLOAD_ABORTED);
dl->ctx->ecb(dl->ctx->ecbClosure,
&event);
} else {
@@ -286,7 +334,6 @@
if ( (ret == OK) &&
- (dl->is_recursive) &&
(dl->is_directory == YES) &&
(ECRS_fileSize(dl->fi.uri) > 0) ) {
char * dirBlock;
@@ -319,18 +366,30 @@
"mmap",
fn);
} else {
- /* load directory, start downloads */
md = NULL;
- MUTEX_LOCK(dl->ctx->lock);
ECRS_listDirectory(dl->ctx->ectx,
dirBlock,
totalBytes,
&md,
- &triggerRecursiveDownload,
+ &listURIfoundDirectory,
dl);
- MUTEX_UNLOCK(dl->ctx->lock);
- ECRS_freeMetaData(md);
- MUNMAP(dirBlock, totalBytes);
+ if (md != NULL)
+ ECRS_freeMetaData(md);
+
+ if (dl->is_recursive) {
+ /* load directory, start downloads */
+ md = NULL;
+ MUTEX_LOCK(dl->ctx->lock);
+ ECRS_listDirectory(dl->ctx->ectx,
+ dirBlock,
+ totalBytes,
+ &md,
+ &triggerRecursiveDownload,
+ dl);
+ MUTEX_UNLOCK(dl->ctx->lock);
+ ECRS_freeMetaData(md);
+ MUNMAP(dirBlock, totalBytes);
+ }
}
CLOSE(fd);
}
@@ -403,6 +462,10 @@
event.data.DownloadStarted.fi.uri = dl->fi.uri;
event.data.DownloadStarted.fi.meta = dl->fi.meta;
event.data.DownloadStarted.anonymityLevel = dl->anonymityLevel;
+ URITRACK_addState(ctx->ectx,
+ ctx->cfg,
+ uri,
+ URITRACK_DOWNLOAD_STARTED);
dl->cctx = dl->ctx->ecb(dl->ctx->ecbClosure,
&event);
dl->next = parent->child;
Modified: GNUnet/src/applications/fs/fsui/fsuitest.c
===================================================================
--- GNUnet/src/applications/fs/fsui/fsuitest.c 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/fs/fsui/fsuitest.c 2007-05-27 01:03:54 UTC (rev
4799)
@@ -137,7 +137,7 @@
GE_ASSERT(NULL, daemon > 0);
CHECK(OK == connection_wait_for_running(NULL,
cfg,
- 30 * cronSECONDS));
+ 60 * cronSECONDS));
#endif
PTHREAD_SLEEP(5 * cronSECONDS); /* give apps time to start */
ok = YES;
Modified: GNUnet/src/applications/fs/fsui/fsuitest2.c
===================================================================
--- GNUnet/src/applications/fs/fsui/fsuitest2.c 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/fs/fsui/fsuitest2.c 2007-05-27 01:03:54 UTC (rev
4799)
@@ -63,7 +63,7 @@
GE_ASSERT(NULL, daemon > 0);
CHECK(OK == connection_wait_for_running(NULL,
cfg,
- 30 * cronSECONDS));
+ 60 * cronSECONDS));
#endif
ok = YES;
PTHREAD_SLEEP(5 * cronSECONDS); /* give apps time to start */
Modified: GNUnet/src/applications/fs/fsui/peer.conf
===================================================================
--- GNUnet/src/applications/fs/fsui/peer.conf 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/fs/fsui/peer.conf 2007-05-27 01:03:54 UTC (rev
4799)
@@ -1,18 +1,17 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
-
+[PATHS]
GNUNETD_HOME = /tmp/gnunet-check-fsui
[GNUNETD]
GNUNETD_HOME = /tmp/gnunet-check-fsui
-# VALGRIND = 300
HELLOEXPIRES = 60
LOGFILE = $GNUNETD_HOME/logs
KEEPLOG = 0
PIDFILE = $GNUNETD_HOME/gnunetd.pid
HOSTS = $GNUNETD_HOME/data/hosts/
APPLICATIONS = "fs getoption stats"
- TRANSPORTS = ""
+TRANSPORTS = ""
[LOGGING]
USER-LEVEL = ERROR
Modified: GNUnet/src/applications/fs/fsui/search.c
===================================================================
--- GNUnet/src/applications/fs/fsui/search.c 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/fs/fsui/search.c 2007-05-27 01:03:54 UTC (rev
4799)
@@ -62,6 +62,10 @@
event.data.SearchResult.searchURI = pos->uri;
pos->ctx->ecb(pos->ctx->ecbClosure,
&event);
+ URITRACK_addState(pos->ctx->ectx,
+ pos->ctx->cfg,
+ pos->uri,
+ URITRACK_SEARCH_RESULT);
}
static void setNamespaceRoot(struct GE_Context * ectx,
@@ -252,7 +256,9 @@
struct GE_Context * ee;
mem = GE_memory_create(2);
- ee = GE_create_context_memory(GE_USER | GE_ADMIN | GE_ERROR | GE_WARNING |
GE_FATAL | GE_BULK | GE_IMMEDIATE,
+ ee = GE_create_context_memory(GE_USER | GE_ADMIN |
+ GE_ERROR | GE_WARNING | GE_FATAL |
+ GE_BULK | GE_IMMEDIATE,
mem);
ret = ECRS_search(ee,
pos->ctx->cfg,
Modified: GNUnet/src/applications/fs/fsui/upload.c
===================================================================
--- GNUnet/src/applications/fs/fsui/upload.c 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/fs/fsui/upload.c 2007-05-27 01:03:54 UTC (rev
4799)
@@ -95,6 +95,7 @@
*/
static char *
createDirectoryHelper(struct GE_Context * ectx,
+ struct GC_Configuration * cfg,
struct FSUI_UploadList * children,
struct ECRS_MetaData * meta,
char ** error) {
@@ -155,6 +156,15 @@
GE_memory_free(mem);
return NULL;
}
+ pos = children;
+ while (pos != NULL) {
+ if (pos->uri != NULL)
+ URITRACK_addState(ectx,
+ cfg,
+ pos->uri,
+ URITRACK_DIRECTORY_ADDED);
+ pos = pos->next;
+ }
GE_memory_reset(mem);
tempName = STRDUP("/tmp/gnunet-upload-dir.XXXXXX");
handle = mkstemp(tempName);
@@ -261,6 +271,7 @@
if (utc->child != NULL) {
error = NULL;
filename = createDirectoryHelper(ectx,
+ utc->shared->ctx->cfg,
utc->child,
utc->meta,
&error);
@@ -384,6 +395,10 @@
URITRACK_trackURI(ectx,
utc->shared->ctx->cfg,
&fi);
+ URITRACK_addState(ectx,
+ utc->shared->ctx->cfg,
+ utc->uri,
+ utc->shared->doIndex == YES ? URITRACK_INDEXED :
URITRACK_INSERTED);
event.type = FSUI_upload_completed;
event.data.UploadCompleted.uc.pos = utc;
event.data.UploadCompleted.uc.cctx = utc->cctx;
Modified: GNUnet/src/applications/fs/lib/check.conf
===================================================================
--- GNUnet/src/applications/fs/lib/check.conf 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/fs/lib/check.conf 2007-05-27 01:03:54 UTC (rev
4799)
@@ -1,12 +1,13 @@
# General settings
+[PATHS]
+GNUNET_HOME = "/tmp/gnunet-session-test-driver"
+
[GNUNET]
-GNUNET_HOME = "/tmp/gnunet-session-test-driver"
LOGLEVEL = "WARNING"
LOGFILE = ""
PROCESS-PRIORITY = "NORMAL"
# Network options for the clients
[NETWORK]
-CLIENT-PORT = 2087
-HOST = "localhost"
+HOST = "localhost:2087"
Modified: GNUnet/src/applications/fs/lib/fslib.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslib.c 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/fs/lib/fslib.c 2007-05-27 01:03:54 UTC (rev
4799)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet
- (C) 2004, 2005, 2006 Christian Grothoff (and other contributing authors)
+ (C) 2004, 2005, 2006, 2007 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
@@ -209,6 +209,7 @@
*/
SEARCH_HANDLE *
FS_start_search(SEARCH_CONTEXT * ctx,
+ const PeerIdentity * target,
unsigned int type,
unsigned int keyCount,
const HashCode512 * keys,
@@ -237,6 +238,12 @@
req->anonymityLevel = htonl(anonymityLevel);
req->expiration = htonll(timeout);
req->type = htonl(type);
+ if (target != NULL)
+ req->target = *target;
+ else
+ memset(&req->target,
+ 0,
+ sizeof(PeerIdentity));
memcpy(&req->query[0],
keys,
keyCount * sizeof(HashCode512));
Modified: GNUnet/src/applications/fs/lib/fslibtest.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslibtest.c 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/fs/lib/fslibtest.c 2007-05-27 01:03:54 UTC (rev
4799)
@@ -131,9 +131,6 @@
int ret;
blk = makeBlock(cls->i);
- blk->prio = htonl(0);
- blk->anonymityLevel = htonl(0);
- blk->expirationTime = htonll(0);
fileBlockGetQuery((DBlock*) &blk[1],
ntohl(blk->size) - sizeof(Datastore_Value),
&ekey);
@@ -145,9 +142,9 @@
if ( (equalsHashCode512(&ekey,
key)) &&
(value->size == blk->size) &&
- (0 == memcmp(value,
- eblk,
- ntohl(value->size))) ) {
+ (0 == memcmp(&value[1],
+ &eblk[1],
+ ntohl(value->size) - sizeof(Datastore_Value))) ) {
cls->found = YES;
SEMAPHORE_UP(cls->sem);
ret = SYSERR;
@@ -181,6 +178,7 @@
closure.sem = SEMAPHORE_CREATE(0);
now = get_time();
handle = FS_start_search(ctx,
+ NULL,
D_BLOCK,
1,
&query,
@@ -266,6 +264,8 @@
ntohl(block->size) - sizeof(Datastore_Value),
&query,
&eblock));
+ eblock->expirationTime = block->expirationTime;
+ eblock->prio = block->prio;
CHECK(OK == FS_insert(sock,
eblock));
CHECK(OK == trySearch(ctx, i));
@@ -317,6 +317,8 @@
ntohl(block->size) - sizeof(Datastore_Value),
&query,
&eblock));
+ eblock->expirationTime = block->expirationTime;
+ eblock->prio = block->prio;
CHECK(OK == FS_insert(sock,
eblock));
CHECK(OK == trySearch(ctx, i));
@@ -351,6 +353,7 @@
i = 2;
mainThread = PTHREAD_GET_SELF();
hnd = FS_start_search(ctx,
+ NULL,
ANY_BLOCK,
1,
&query,
Modified: GNUnet/src/applications/fs/lib/peer.conf
===================================================================
--- GNUnet/src/applications/fs/lib/peer.conf 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/fs/lib/peer.conf 2007-05-27 01:03:54 UTC (rev
4799)
@@ -1,7 +1,9 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
+[PATHS]
HOME = /tmp/gnunet-check-fslib
+GNUNETD_HOME = /tmp/gnunet-check-fslib
[GNUNETD]
GNUNETD_HOME = $HOME
Modified: GNUnet/src/applications/fs/module/Makefile.am
===================================================================
--- GNUnet/src/applications/fs/module/Makefile.am 2007-05-23 15:53:44 UTC
(rev 4798)
+++ GNUnet/src/applications/fs/module/Makefile.am 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -8,6 +8,7 @@
libgnunetmodule_fs_la_SOURCES = \
anonymity.c anonymity.h \
+ dht_push.c dht_push.h \
fs.c \
ondemand.c ondemand.h \
migration.c migration.h \
Added: GNUnet/src/applications/fs/module/dht_push.c
===================================================================
--- GNUnet/src/applications/fs/module/dht_push.c
(rev 0)
+++ GNUnet/src/applications/fs/module/dht_push.c 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -0,0 +1,148 @@
+/*
+ This file is part of GNUnet.
+ (C) 2007 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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+/**
+ * @file applications/fs/module/dht_push.c
+ * @brief This module is responsible for pushing non-anonymous
+ * inserted (not indexed!) content out into the DHT.
+ * @author Christian Grothoff
+ */
+
+#include "platform.h"
+#include "dht_push.h"
+#include "gnunet_stats_service.h"
+#include "gnunet_sqstore_service.h"
+
+/**
+ * DHT service. Set to NULL to terminate
+ */
+static DHT_ServiceAPI * dht;
+
+/**
+ * Global core API.
+ */
+static CoreAPIForApplication * coreAPI;
+
+/**
+ * SQStore service.
+ */
+static SQstore_ServiceAPI * sqstore;
+
+
+/**
+ * Thread that does the pushing.
+ */
+static struct PTHREAD * thread;
+
+/**
+ * Total number of entries with anonymity 0.
+ * Used to calculate how long we should wait
+ * between iterations.
+ */
+static int total;
+
+static Stats_ServiceAPI * stats;
+
+static int stat_push_count;
+
+
+static int push_callback(const HashCode512 * key,
+ const Datastore_Value * value,
+ void * closure) {
+ cron_t delay;
+
+ if (dht == NULL)
+ return SYSERR;
+ /* try pushing out everything every 6h,
+ but do not push more often than every 5s */
+ delay = 6 * cronHOURS / total;
+ if (delay < 5 * cronSECONDS)
+ delay = 5 * cronSECONDS;
+ PTHREAD_SLEEP(delay);
+ if (dht == NULL)
+ return SYSERR;
+ dht->put(key,
+ ntohl(value->type),
+ ntohl(value->size) - sizeof(Datastore_Value),
+ ntohll(value->expirationTime),
+ (const char*) &value[1]);
+ if (stats != NULL)
+ stats->change(stat_push_count, 1);
+ return OK;
+}
+
+static void * push_thread(void * cls) {
+ while ( (dht != NULL) &&
+ (sqstore != NULL) ) {
+ if (total == 0)
+ total = 1;
+ total = sqstore->iterateNonAnonymous(0,
+ YES,
+ &push_callback,
+ NULL);
+ if ( (dht != NULL) &&
+ (total == 0) )
+ PTHREAD_SLEEP(15 * cronMINUTES);
+ }
+ return NULL;
+}
+
+
+/**
+ * Initialize the migration module.
+ */
+void init_dht_push(CoreAPIForApplication * capi,
+ DHT_ServiceAPI * d) {
+ coreAPI = capi;
+ dht = d;
+ sqstore = capi->requestService("sqstore");
+ if (sqstore == NULL) {
+ GE_BREAK(capi->ectx, 0);
+ return;
+ }
+ stats = capi->requestService("stats");
+ if (stats != NULL)
+ stat_push_count
+ = stats->create(gettext_noop("# blocks pushed into DHT"));
+ thread = PTHREAD_CREATE(&push_thread,
+ NULL,
+ 1024 * 16);
+}
+
+void done_dht_push(void) {
+ void * unused;
+
+ if (sqstore == NULL)
+ return;
+ dht = NULL;
+ if (thread != NULL) {
+ PTHREAD_STOP_SLEEP(thread);
+ PTHREAD_JOIN(thread, &unused);
+ }
+ coreAPI->releaseService(sqstore);
+ if (stats != NULL) {
+ coreAPI->releaseService(stats);
+ stats = NULL;
+ }
+ coreAPI = NULL;
+}
+
+
+/* end of dht_push.c */
Property changes on: GNUnet/src/applications/fs/module/dht_push.c
___________________________________________________________________
Name: svn:eol-style
+ native
Added: GNUnet/src/applications/fs/module/dht_push.h
===================================================================
--- GNUnet/src/applications/fs/module/dht_push.h
(rev 0)
+++ GNUnet/src/applications/fs/module/dht_push.h 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -0,0 +1,43 @@
+/*
+ This file is part of GNUnet.
+ (C) 2007 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,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * This module is responsible for pushing non-anonymous
+ * content out into the DHT.
+ *
+ * @author Christian Grothoff
+ * @file applications/fs/module/dht_push.h
+ */
+#ifndef DHT_PUSH_H
+#define DHT_PUSH_H
+
+#include "gnunet_core.h"
+#include "gnunet_dht_service.h"
+
+/**
+ * Initialize the migration module.
+ */
+void init_dht_push(CoreAPIForApplication * capi,
+ DHT_ServiceAPI * s);
+
+void done_dht_push(void);
+
+/* end of dht_push.h */
+#endif
Property changes on: GNUnet/src/applications/fs/module/dht_push.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: GNUnet/src/applications/fs/module/fs.c
===================================================================
--- GNUnet/src/applications/fs/module/fs.c 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/fs/module/fs.c 2007-05-27 01:03:54 UTC (rev
4799)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- (C) 2001, 2002, 2003, 2004, 2005, 2006 Christian Grothoff (and other
contributing authors)
+ (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 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
@@ -35,6 +35,7 @@
#include "gnunet_datastore_service.h"
#include "gnunet_traffic_service.h"
#include "anonymity.h"
+#include "dht_push.h"
#include "ecrs_core.h"
#include "migration.h"
#include "ondemand.h"
@@ -48,10 +49,6 @@
unsigned int prio;
} DHT_GET_CLS;
-typedef struct {
- struct DHT_PUT_RECORD * rec;
-} DHT_PUT_CLS;
-
typedef struct LG_Job {
unsigned int keyCount;
unsigned int type;
@@ -100,7 +97,7 @@
gapWrapperToDatastoreValue(const DataContainer * value,
int prio) {
Datastore_Value * dv;
- GapWrapper * gw;
+ const GapWrapper * gw;
unsigned int size;
cron_t et;
cron_t now;
@@ -109,7 +106,7 @@
GE_BREAK(ectx, 0);
return NULL;
}
- gw = (GapWrapper*) value;
+ gw = (const GapWrapper*) value;
size = ntohl(gw->dc.size)
- sizeof(GapWrapper)
+ sizeof(Datastore_Value);
@@ -150,7 +147,7 @@
const DataContainer * value,
unsigned int prio) {
Datastore_Value * dv;
- GapWrapper * gw;
+ const GapWrapper * gw;
unsigned int size;
int ret;
HashCode512 hc;
@@ -163,10 +160,10 @@
GE_BREAK(ectx, 0);
return SYSERR;
}
- gw = (GapWrapper*) value;
+ gw = (const GapWrapper*) value;
size = ntohl(gw->dc.size) - sizeof(GapWrapper);
if ( (OK != getQueryFor(size,
- (DBlock*) &gw[1],
+ (const DBlock*) &gw[1],
YES,
&hc)) ||
(! equalsHashCode512(&hc, query)) ) {
@@ -176,7 +173,7 @@
}
if (YES != isDatumApplicable(ntohl(dv->type),
ntohl(dv->size) - sizeof(Datastore_Value),
- (DBlock*) &dv[1],
+ (const DBlock*) &dv[1],
&hc,
0,
query)) {
@@ -218,7 +215,8 @@
static int get_result_callback(const HashCode512 * query,
const DataContainer * value,
- DHT_GET_CLS * cls) {
+ void * ctx) {
+ DHT_GET_CLS * cls = ctx;
#if DEBUG_FS
EncName enc;
@@ -238,7 +236,8 @@
return OK;
}
-static void get_complete_callback(DHT_GET_CLS * cls) {
+static void get_complete_callback(void * ctx) {
+ DHT_GET_CLS * cls = ctx;
dht->get_stop(cls->rec);
FREE(cls);
}
@@ -250,7 +249,7 @@
*/
static int csHandleRequestQueryStop(struct ClientHandle * sock,
const MESSAGE_HEADER * req) {
- CS_fs_request_search_MESSAGE * rs;
+ const CS_fs_request_search_MESSAGE * rs;
#if DEBUG_FS
EncName enc;
#endif
@@ -259,7 +258,7 @@
GE_BREAK(ectx, 0);
return SYSERR;
}
- rs = (CS_fs_request_search_MESSAGE*) req;
+ rs = (const CS_fs_request_search_MESSAGE*) req;
#if DEBUG_FS
IF_GELOG(ectx,
GE_DEBUG | GE_REQUEST | GE_USER,
@@ -270,9 +269,6 @@
"FS received QUERY STOP (query: `%s')\n",
&enc);
#endif
- if (ntohl(rs->anonymityLevel) == 0) {
- /* FIXME 0.7.1: cancel with dht? */
- }
gap->get_stop(ntohl(rs->type),
1 + (ntohs(req->size) - sizeof(CS_fs_request_search_MESSAGE)) /
sizeof(HashCode512),
&rs->query[0]);
@@ -353,8 +349,7 @@
cron_t et;
size = sizeof(GapWrapper) +
- ntohs(ri->header.size) - sizeof(CS_fs_request_insert_MESSAGE) -
- sizeof(Datastore_Value);
+ ntohs(ri->header.size) - sizeof(CS_fs_request_insert_MESSAGE);
gw = MALLOC(size);
gw->reserved = 0;
gw->dc.size = htonl(size);
@@ -373,7 +368,7 @@
&ri[1],
size - sizeof(GapWrapper));
dht->put(&query,
- 0, /* FIXME 0.7.1: type? */
+ type,
size,
et,
(const char*) gw);
@@ -594,7 +589,7 @@
static int csHandleCS_fs_request_unindex_MESSAGE(struct ClientHandle * sock,
const MESSAGE_HEADER * req) {
int ret;
- CS_fs_request_unindex_MESSAGE * ru;
+ const CS_fs_request_unindex_MESSAGE * ru;
struct GE_Context * cectx;
cectx = coreAPI->createClientLogContext(GE_USER | GE_EVENTKIND |
GE_ROUTEKIND,
@@ -605,7 +600,7 @@
GE_free_context(cectx);
return SYSERR;
}
- ru = (CS_fs_request_unindex_MESSAGE*) req;
+ ru = (const CS_fs_request_unindex_MESSAGE*) req;
#if DEBUG_FS
GE_LOG(ectx,
GE_DEBUG | GE_REQUEST | GE_USER,
@@ -627,13 +622,13 @@
static int csHandleCS_fs_request_test_index_MESSAGEed(struct ClientHandle *
sock,
const MESSAGE_HEADER *
req) {
int ret;
- RequestTestindex * ru;
+ const RequestTestindex * ru;
if (ntohs(req->size) != sizeof(RequestTestindex)) {
GE_BREAK(ectx, 0);
return SYSERR;
}
- ru = (RequestTestindex*) req;
+ ru = (const RequestTestindex*) req;
#if DEBUG_FS
GE_LOG(ectx,
GE_DEBUG | GE_REQUEST | GE_USER,
@@ -1021,6 +1016,7 @@
*/
static int csHandleRequestQueryStart(struct ClientHandle * sock,
const MESSAGE_HEADER * req) {
+ static PeerIdentity all_zeros;
const CS_fs_request_search_MESSAGE * rs;
unsigned int keyCount;
#if DEBUG_FS
@@ -1028,12 +1024,19 @@
#endif
unsigned int type;
int done;
+ int have_target;
if (ntohs(req->size) < sizeof(CS_fs_request_search_MESSAGE)) {
GE_BREAK(ectx, 0);
return SYSERR;
}
rs = (const CS_fs_request_search_MESSAGE*) req;
+ if (memcmp(&all_zeros,
+ &rs->target,
+ sizeof(PeerIdentity)) == 0)
+ have_target = NO;
+ else
+ have_target = YES;
#if DEBUG_FS
IF_GELOG(ectx,
GE_DEBUG | GE_REQUEST | GE_USER,
@@ -1076,13 +1079,15 @@
queueLG_Job(type,
keyCount,
&rs->query[0]);
- gap->get_start(type,
+ gap->get_start(have_target == NO ? NULL : &rs->target,
+ type,
ntohl(rs->anonymityLevel),
keyCount,
&rs->query[0],
ntohll(rs->expiration),
ntohl(rs->prio));
if ( (ntohl(rs->anonymityLevel) == 0) &&
+ (have_target == NO) &&
(dht != NULL) ) {
DHT_GET_CLS * cls;
@@ -1091,10 +1096,12 @@
cls->rec = dht->get_start(type,
&rs->query[0],
ntohll(rs->expiration),
- (DataProcessor) &get_result_callback,
+ &get_result_callback,
cls,
- (DHT_OP_Complete) &get_complete_callback,
+ &get_complete_callback,
cls);
+ if (cls->rec == NULL)
+ FREE(cls); /* should never happen...*/
}
return OK;
}
@@ -1152,8 +1159,9 @@
capi->releaseService(datastore);
return SYSERR;
}
- /* dht = capi->requestService("dht"); */
- dht = NULL;
+ dht = capi->requestService("dht");
+ if (dht != NULL)
+ init_dht_push(capi, dht);
ltgSignal = SEMAPHORE_CREATE(0);
localGetProcessor = PTHREAD_CREATE(&localGetter,
NULL,
@@ -1259,6 +1267,7 @@
coreAPI->releaseService(gap);
gap = NULL;
if (dht != NULL) {
+ done_dht_push();
coreAPI->releaseService(dht);
dht = NULL;
}
Modified: GNUnet/src/applications/fs/module/migration.h
===================================================================
--- GNUnet/src/applications/fs/module/migration.h 2007-05-23 15:53:44 UTC
(rev 4798)
+++ GNUnet/src/applications/fs/module/migration.h 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -87,7 +87,7 @@
DHT_ServiceAPI * d,
Traffic_ServiceAPI * t);
-void doneMigration();
+void doneMigration(void);
/* end of migration.h */
#endif
Modified: GNUnet/src/applications/fs/namespace/check.conf
===================================================================
--- GNUnet/src/applications/fs/namespace/check.conf 2007-05-23 15:53:44 UTC
(rev 4798)
+++ GNUnet/src/applications/fs/namespace/check.conf 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -7,6 +7,5 @@
# Network options for the clients
[NETWORK]
-CLIENT-PORT = 2087
-HOST = "localhost"
+HOST = "localhost:2087"
Modified: GNUnet/src/applications/fs/namespace/namespace_infotest.c
===================================================================
--- GNUnet/src/applications/fs/namespace/namespace_infotest.c 2007-05-23
15:53:44 UTC (rev 4798)
+++ GNUnet/src/applications/fs/namespace/namespace_infotest.c 2007-05-27
01:03:54 UTC (rev 4799)
@@ -84,7 +84,7 @@
cfg,
1,
1,
- 5000,
+ get_time() + 10 * cronMINUTES,
"test",
meta,
NULL,
@@ -104,7 +104,7 @@
cfg,
1,
1,
- 5000,
+ get_time() + 10 * cronMINUTES,
"test",
42,
NULL,
Modified: GNUnet/src/applications/fs/namespace/peer.conf
===================================================================
--- GNUnet/src/applications/fs/namespace/peer.conf 2007-05-23 15:53:44 UTC
(rev 4798)
+++ GNUnet/src/applications/fs/namespace/peer.conf 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -1,6 +1,6 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
-
+[PATHS]
GNUNETD_HOME = /tmp/gnunet-check-ecrs
[GNUNETD]
Modified: GNUnet/src/applications/fs/uritrack/check.conf
===================================================================
--- GNUnet/src/applications/fs/uritrack/check.conf 2007-05-23 15:53:44 UTC
(rev 4798)
+++ GNUnet/src/applications/fs/uritrack/check.conf 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -7,6 +7,5 @@
# Network options for the clients
[NETWORK]
-CLIENT-PORT = 2087
-HOST = "localhost"
+HOST = "localhost:2087"
Modified: GNUnet/src/applications/gap/check.conf
===================================================================
--- GNUnet/src/applications/gap/check.conf 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/gap/check.conf 2007-05-27 01:03:54 UTC (rev
4799)
@@ -7,6 +7,5 @@
# Network options for the clients
[NETWORK]
-CLIENT-PORT = 2087
-HOST = "localhost"
+HOST = "localhost:2087"
Modified: GNUnet/src/applications/gap/gap.c
===================================================================
--- GNUnet/src/applications/gap/gap.c 2007-05-23 15:53:44 UTC (rev 4798)
+++ GNUnet/src/applications/gap/gap.c 2007-05-27 01:03:54 UTC (rev 4799)
@@ -591,6 +591,7 @@
* (depending on load, queue, etc).
*/
static void forwardQuery(const P2P_gap_query_MESSAGE * msg,
+ const PeerIdentity * target,
const PeerIdentity * excludePeer) {
cron_t now;
QueryRecord * qr;
@@ -604,7 +605,15 @@
unsigned long long rankingSum;
unsigned long long sel;
unsigned long long pos;
+ PID_INDEX tpid;
+ if (target != NULL) {
+ /* connect to target host -- if known */
+ coreAPI->unicast(target,
+ NULL,
+ ntohl(msg->priority),
+ 0);
+ }
now = get_time();
MUTEX_LOCK(lock);
@@ -669,57 +678,62 @@
memcpy(qr->msg,
msg,
ntohs(msg->header.size));
- if (noclear == NO) {
+ if (noclear == NO)
memset(&qr->bitmap[0],
0,
BITMAP_SIZE);
- if (qr->noTarget != 0)
- change_pid_rc(qr->noTarget, -1);
- if (excludePeer != NULL)
- qr->noTarget = intern_pid(excludePeer);
- else
- qr->noTarget = intern_pid(coreAPI->myIdentity);
- qr->totalDistance = 0;
- qr->rankings = MALLOC(sizeof(int)*8*BITMAP_SIZE);
- qr->activeConnections
- = coreAPI->forAllConnectedNodes
- (&hotpathSelectionCode,
- qr);
- /* actual selection, proportional to rankings
- assigned by hotpathSelectionCode ... */
- rankingSum = 0;
- for (i=0;i<8*BITMAP_SIZE;i++)
- rankingSum += qr->rankings[i];
- if (qr->activeConnections > 0) {
- /* select 4 peers for forwarding */
- for (i=0;i<4;i++) {
- if (rankingSum == 0)
+
+ if (qr->noTarget != 0)
+ change_pid_rc(qr->noTarget, -1);
+ if (excludePeer != NULL)
+ qr->noTarget = intern_pid(excludePeer);
+ else
+ qr->noTarget = intern_pid(coreAPI->myIdentity);
+ qr->totalDistance = 0;
+ qr->rankings = MALLOC(sizeof(int)*8*BITMAP_SIZE);
+ qr->activeConnections
+ = coreAPI->forAllConnectedNodes
+ (&hotpathSelectionCode,
+ qr);
+ /* actual selection, proportional to rankings
+ assigned by hotpathSelectionCode ... */
+ rankingSum = 0;
+ for (i=0;i<8*BITMAP_SIZE;i++)
+ rankingSum += qr->rankings[i];
+ if (qr->activeConnections > 0) {
+ /* select 4 peers for forwarding */
+ for (i=0;i<4;i++) {
+ if (rankingSum == 0)
+ break;
+ sel = weak_randomi64(rankingSum);
+ pos = 0;
+ for (j=0;j<8*BITMAP_SIZE;j++) {
+ pos += qr->rankings[j];
+ if (pos > sel) {
+ setBit(qr, j);
+ GE_ASSERT(ectx, rankingSum >= qr->rankings[j]);
+ rankingSum -= qr->rankings[j];
+ qr->rankings[j] = 0;
break;
- sel = weak_randomi64(rankingSum);
- pos = 0;
- for (j=0;j<8*BITMAP_SIZE;j++) {
- pos += qr->rankings[j];
- if (pos > sel) {
- setBit(qr, j);
- GE_ASSERT(ectx, rankingSum >= qr->rankings[j]);
- rankingSum -= qr->rankings[j];
- qr->rankings[j] = 0;
- break;
- }
}
}
}
- FREE(qr->rankings);
- qr->rankings = NULL;
- /* now forward to a couple of selected nodes */
- coreAPI->forAllConnectedNodes
- (&sendToSelected,
- qr);
- if (qr == &dummy) {
- change_pid_rc(dummy.noTarget, -1);
- FREE(dummy.msg);
- }
}
+ FREE(qr->rankings);
+ qr->rankings = NULL;
+ if (target != NULL) {
+ tpid = intern_pid(target);
+ setBit(qr, tpid);
+ change_pid_rc(tpid, -1);
+ }
+ /* now forward to a couple of selected nodes */
+ coreAPI->forAllConnectedNodes
+ (&sendToSelected,
+ qr);
+ if (qr == &dummy) {
+ change_pid_rc(dummy.noTarget, -1);
+ FREE(dummy.msg);
+ }
MUTEX_UNLOCK(lock);
}
@@ -1431,6 +1445,7 @@
* subsequently be routed to other peers.
*
* @param sender next hop in routing of the reply, NULL for us
+ * @param target peer to ask primarily (maybe NULL)
* @param prio the effective priority of the query
* @param ttl the relative ttl of the query
* @param query the query itself
@@ -1439,6 +1454,7 @@
* SYSERR if not (out of resources)
*/
static int execQuery(const PeerIdentity * sender,
+ const PeerIdentity * target,
unsigned int prio,
QUERY_POLICY policy,
int ttl,
@@ -1579,6 +1595,7 @@
MUTEX_UNLOCK(lookup_exclusion);
if (doForward) {
forwardQuery(query,
+ target,
sender);
}
change_pid_rc(senderID, -1);
@@ -1824,6 +1841,7 @@
* datastore on anything that is received, and the caller will be
* listening for these puts.
*
+ * @param target peer to ask primarily (maybe NULL)
* @param type the type of the block that we're looking for
* @param anonymityLevel how much cover traffic is required? 1 for none
* (0 does not require GAP, 1 requires GAP but no cover traffic)
@@ -1834,7 +1852,8 @@
* buffers are full or other error, NO if we already
* returned the one and only reply (local hit)
*/
-static int get_start(unsigned int type,
+static int get_start(const PeerIdentity * target,
+ unsigned int type,
unsigned int anonymityLevel,
unsigned int keyCount,
const HashCode512 * keys,
@@ -1919,6 +1938,7 @@
msg->returnTo
= *coreAPI->myIdentity;
ret = execQuery(NULL,
+ target,
prio,
QUERY_ANSWER|QUERY_FORWARD|QUERY_INDIRECT,
timeout - get_time(),
@@ -2112,6 +2132,7 @@
if (ttl < 0)
ttl = 0;
execQuery(sender,
+ NULL,
prio,
policy,
ttl,
Modified: GNUnet/src/applications/gap/peer1.conf
===================================================================
--- GNUnet/src/applications/gap/peer1.conf 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/gap/peer1.conf 2007-05-27 01:03:54 UTC (rev
4799)
@@ -1,5 +1,6 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
+[PATHS]
GNUNETD_HOME = peer1
[GNUNETD]
Modified: GNUnet/src/applications/gap/peer2.conf
===================================================================
--- GNUnet/src/applications/gap/peer2.conf 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/gap/peer2.conf 2007-05-27 01:03:54 UTC (rev
4799)
@@ -1,5 +1,6 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
+[PATHS]
GNUNETD_HOME = peer2
[GNUNETD]
Modified: GNUnet/src/applications/identity/Makefile.am
===================================================================
--- GNUnet/src/applications/identity/Makefile.am 2007-05-23 15:53:44 UTC
(rev 4798)
+++ GNUnet/src/applications/identity/Makefile.am 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -2,6 +2,9 @@
plugindir = $(libdir)/GNUnet
+lib_LTLIBRARIES = \
+ libgnunetidentity_api.la
+
plugin_LTLIBRARIES = \
libgnunetmodule_identity.la
@@ -9,9 +12,8 @@
check.conf
libgnunetmodule_identity_la_SOURCES = \
- identity.c \
- hostkey.c \
- hostkey.h
+ identity.c identity.h \
+ hostkey.c hostkey.h
libgnunetmodule_identity_la_LIBADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/util/cron/libgnunetutil_cron.la \
@@ -20,6 +22,13 @@
-export-dynamic -avoid-version -module
+libgnunetidentity_api_la_SOURCES = \
+ clientapi.c
+libgnunetidentity_api_la_LIBADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/network_client/libgnunetutil_network_client.la
+
+
check_PROGRAMS = \
identitytest
Modified: GNUnet/src/applications/identity/check.conf
===================================================================
--- GNUnet/src/applications/identity/check.conf 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/identity/check.conf 2007-05-27 01:03:54 UTC (rev
4799)
@@ -1,5 +1,7 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
+[PATHS]
+GNUNETD_HOME = /tmp/gnunet-check-identity
[GNUNETD]
GNUNETD_HOME = /tmp/gnunet-check-identity
Added: GNUnet/src/applications/identity/clientapi.c
===================================================================
--- GNUnet/src/applications/identity/clientapi.c
(rev 0)
+++ GNUnet/src/applications/identity/clientapi.c 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -0,0 +1,74 @@
+/*
+ This file is part of GNUnet.
+ (C) 2007 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,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file identity/clientapi.c
+ * @author Christian Grothoff
+ * @brief API for clients to talk to the identity module
+ */
+
+#include "platform.h"
+#include "gnunet_protocols.h"
+#include "gnunet_identity_lib.h"
+#include "identity.h"
+
+/**
+ * Inform gnunetd about another peer.
+ *
+ * @param sock socket to talk to gnunetd over
+ * @return OK on success, SYSERR on error
+ */
+int gnunet_identity_peer_add(struct ClientServerConnection * sock,
+ const PublicKey * key,
+ TIME_T expirationTime,
+ unsigned short proto,
+ unsigned short sas,
+ unsigned int mtu,
+ const char * address,
+ const Signature * signature) {
+ CS_identity_hello_MESSAGE * msg;
+
+ msg = MALLOC(sizeof(CS_identity_hello_MESSAGE) + sas);
+ msg->header.type = htons(CS_PROTO_identity_HELLO);
+ msg->header.size = htons(sizeof(CS_identity_hello_MESSAGE) + sas);
+ msg->signature = *signature;
+ msg->publicKey = *key;
+ hash(key,
+ sizeof(PublicKey),
+ &msg->senderIdentity.hashPubKey);
+ msg->expirationTime = expirationTime;
+ msg->MTU = mtu;
+ msg->senderAddressSize = sas;
+ msg->protocol = proto;
+ memcpy(&msg[1],
+ address,
+ sas);
+ /* FIXME: check that signature is valid! */
+ if (SYSERR == connection_write(sock,
+ &msg->header)) {
+ FREE(msg);
+ return SYSERR;
+ }
+ FREE(msg);
+ return OK;
+}
+
+
+/* end of clientapi.c */
Property changes on: GNUnet/src/applications/identity/clientapi.c
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: GNUnet/src/applications/identity/identity.c
===================================================================
--- GNUnet/src/applications/identity/identity.c 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/identity/identity.c 2007-05-27 01:03:54 UTC (rev
4799)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- (C) 2001, 2002, 2004, 2005 Christian Grothoff (and other contributing
authors)
+ (C) 2001, 2002, 2004, 2005, 2007 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
@@ -36,7 +36,7 @@
#include "gnunet_protocols.h"
#include "gnunet_directories.h"
#include "gnunet_identity_service.h"
-
+#include "identity.h"
#include "hostkey.h"
#define DEBUG_IDENTITY NO
@@ -1100,6 +1100,27 @@
}
+static int identityHelloHandler(struct ClientHandle * sock,
+ const MESSAGE_HEADER * message) {
+ const CS_identity_hello_MESSAGE * msg;
+ P2P_hello_MESSAGE * hello;
+
+ if (sizeof(CS_identity_hello_MESSAGE) < ntohs(message->size))
+ return SYSERR;
+ msg = (const CS_identity_hello_MESSAGE*) message;
+ hello = MALLOC(ntohs(msg->header.size));
+ memcpy(hello, msg, ntohs(msg->header.size));
+ hello->header.type = htons(p2p_PROTO_hello);
+ coreAPI->injectMessage(NULL,
+ (const char*) hello,
+ ntohs(msg->header.size),
+ NO,
+ NULL);
+ FREE(hello);
+ return OK;
+}
+
+
/**
* Provide the Identity service.
*
@@ -1191,6 +1212,8 @@
0,
CRON_DISCARD_HOSTS_INTERVAL,
NULL);
+ coreAPI->registerClientHandler(CS_PROTO_identity_HELLO,
+ &identityHelloHandler);
return &id;
}
@@ -1202,6 +1225,8 @@
int j;
HostEntry * entry;
+ coreAPI->unregisterClientHandler(CS_PROTO_identity_HELLO,
+ &identityHelloHandler);
for (i=0;i<MAX_TEMP_HOSTS;i++) {
entry = &tempHosts[i];
for (j=0;j<entry->heloCount;j++)
Added: GNUnet/src/applications/identity/identity.h
===================================================================
--- GNUnet/src/applications/identity/identity.h (rev 0)
+++ GNUnet/src/applications/identity/identity.h 2007-05-27 01:03:54 UTC (rev
4799)
@@ -0,0 +1,80 @@
+/*
+ This file is part of GNUnet.
+ (C) 2007 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,
+ Boston, MA 02111-1307, USA.
+*/
+/**
+ * @file identity/identity.h
+ * @author Christian Grothoff
+ */
+#ifndef IDENTITY_H
+#define IDENTITY_H
+
+/**
+ * Format of the message to inform gnunetd about a
+ * HELLO from the client-side.
+ *
+ * @see P2P_hello_MESSAGE!
+ */
+typedef struct {
+ MESSAGE_HEADER header;
+
+ /**
+ * The signature
+ */
+ Signature signature;
+
+ /**
+ * The public key
+ */
+ PublicKey publicKey;
+
+ /**
+ * Whose identity follows? No, this is NOT a duplicate
+ * as a node may send us the identity of ANOTHER node!
+ */
+ PeerIdentity senderIdentity;
+
+ /**
+ * time this address expires (network byte order)
+ */
+ TIME_T expirationTime;
+
+ /**
+ * advertised MTU for sending (replies can have a different
+ * MTU!)
+ */
+ unsigned int MTU;
+
+ /**
+ * size of the sender address
+ */
+ unsigned short senderAddressSize;
+
+ /**
+ * protocol supported by the node (only one protocol
+ * can be advertised by the same hello)
+ * Examples are UDP, TCP, etc. This field is
+ * in network byte order
+ */
+ unsigned short protocol;
+
+
+} CS_identity_hello_MESSAGE;
+
+
+#endif
Property changes on: GNUnet/src/applications/identity/identity.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: GNUnet/src/applications/kvstore_sqlite/check.conf
===================================================================
--- GNUnet/src/applications/kvstore_sqlite/check.conf 2007-05-23 15:53:44 UTC
(rev 4798)
+++ GNUnet/src/applications/kvstore_sqlite/check.conf 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -1,3 +1,4 @@
+[PATHS]
GNUNETD_HOME = /tmp/gnunet-sqlite-sqstore-test
[GNUNETD]
Modified: GNUnet/src/applications/rpc/Makefile.am
===================================================================
--- GNUnet/src/applications/rpc/Makefile.am 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/rpc/Makefile.am 2007-05-27 01:03:54 UTC (rev
4799)
@@ -3,7 +3,7 @@
plugindir = $(libdir)/GNUnet
lib_LTLIBRARIES = \
- libgnunetmodule_rpc_util.la
+ libgnunetrpc_util.la
plugin_LTLIBRARIES = \
libgnunetmodule_rpc.la
@@ -15,15 +15,15 @@
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/util/cron/libgnunetutil_cron.la \
$(top_builddir)/src/util/containers/libgnunetutil_containers.la \
- $(top_builddir)/src/applications/rpc/libgnunetmodule_rpc_util.la
+ $(top_builddir)/src/applications/rpc/libgnunetrpc_util.la
libgnunetmodule_rpc_la_LDFLAGS = \
-export-dynamic -avoid-version -module
-libgnunetmodule_rpc_util_la_SOURCES = \
+libgnunetrpc_util_la_SOURCES = \
parameters.c
-libgnunetmodule_rpc_util_la_LIBADD = \
+libgnunetrpc_util_la_LIBADD = \
$(top_builddir)/src/util/containers/libgnunetutil_containers.la \
$(top_builddir)/src/util/libgnunetutil.la
Modified: GNUnet/src/applications/session/check.conf
===================================================================
--- GNUnet/src/applications/session/check.conf 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/session/check.conf 2007-05-27 01:03:54 UTC (rev
4799)
@@ -7,6 +7,5 @@
# Network options for the clients
[NETWORK]
-CLIENT-PORT = 2087
-HOST = "localhost"
+HOST = "localhost:2087"
Modified: GNUnet/src/applications/session/peer1.conf
===================================================================
--- GNUnet/src/applications/session/peer1.conf 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/session/peer1.conf 2007-05-27 01:03:54 UTC (rev
4799)
@@ -1,5 +1,7 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
+[PATHS]
+GNUNETD_HOME = peer1
[GNUNETD]
GNUNETD_HOME = peer1
Modified: GNUnet/src/applications/session/peer2.conf
===================================================================
--- GNUnet/src/applications/session/peer2.conf 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/session/peer2.conf 2007-05-27 01:03:54 UTC (rev
4799)
@@ -1,5 +1,7 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
+[PATHS]
+GNUNETD_HOME = peer2
[GNUNETD]
GNUNETD_HOME = peer2
Modified: GNUnet/src/applications/sqstore_mysql/mysql.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysql.c 2007-05-23 15:53:44 UTC
(rev 4798)
+++ GNUnet/src/applications/sqstore_mysql/mysql.c 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -122,6 +122,7 @@
#include "platform.h"
#include "gnunet_util.h"
+#include "gnunet_protocols.h"
#include "gnunet_sqstore_service.h"
#include "gnunet_stats_service.h"
#include "gnunet_state_service.h"
@@ -194,7 +195,7 @@
MYSQL_STMT * update;
- MYSQL_BIND ubind[4];
+ MYSQL_BIND ubind[5];
struct MUTEX * DATABASE_Lock_;
@@ -219,7 +220,7 @@
#define DELETE_GENERIC_SAMPLE "DELETE FROM gn070 WHERE hash=? AND size=? AND
type=? AND prio=? AND anonLevel=? AND expire=? AND value=? ORDER BY prio ASC
LIMIT 1"
-#define UPDATE_SAMPLE "UPDATE gn070 SET prio=prio+?,expire=MAX(expire,?) WHERE
hash=? AND value=?"
+#define UPDATE_SAMPLE "UPDATE gn070 SET
prio=prio+?,expire=IF(expire>=?,expire,?) WHERE hash=? AND value=?"
static mysqlHandle * dbh;
@@ -420,10 +421,17 @@
DELETE_GENERIC_SAMPLE,
strlen(DELETE_GENERIC_SAMPLE)) ) {
GE_LOG(ectx, GE_ERROR | GE_BULK | GE_USER,
- _("`%s' failed at %s:%d with error: %s\n"),
- "mysql_stmt_prepare",
- __FILE__, __LINE__,
- mysql_stmt_error(dbhI->insert));
+ _("`%s' failed at %s:%d with error: I/%s S/%s SC/%s SS/%s SSC/%s U/%s
D/%s DG/%s\n"),
+ "mysql_stmt_prepare",
+ __FILE__, __LINE__,
+ mysql_stmt_error(dbhI->insert),
+ mysql_stmt_error(dbhI->select),
+ mysql_stmt_error(dbhI->selectc),
+ mysql_stmt_error(dbhI->selects),
+ mysql_stmt_error(dbhI->selectsc),
+ mysql_stmt_error(dbhI->update),
+ mysql_stmt_error(dbhI->deleteh),
+ mysql_stmt_error(dbhI->deleteg));
mysql_stmt_close(dbhI->insert);
mysql_stmt_close(dbhI->select);
mysql_stmt_close(dbhI->selectc);
@@ -466,8 +474,9 @@
sizeof(dbhI->ubind));
dbhI->ubind[0].buffer_type = MYSQL_TYPE_LONG;
dbhI->ubind[1].buffer_type = MYSQL_TYPE_LONG;
- dbhI->ubind[2].buffer_type = MYSQL_TYPE_BLOB;
+ dbhI->ubind[2].buffer_type = MYSQL_TYPE_LONG;
dbhI->ubind[3].buffer_type = MYSQL_TYPE_BLOB;
+ dbhI->ubind[4].buffer_type = MYSQL_TYPE_BLOB;
dbhI->prepare = YES;
} else
dbhI->prepare = NO;
@@ -628,6 +637,38 @@
}
/**
+ * Iterate over the items in the datastore that
+ * have anonymity level 0.
+ *
+ * @param type entries of which type should be considered?
+ * Use 0 for any type.
+ * @param iter never NULL
+ * @return the number of results, SYSERR if the
+ * iter is non-NULL and aborted the iteration
+ */
+static int iterateNonAnonymous(unsigned int type,
+ int on_demand,
+ Datum_Iterator iter,
+ void * closure) {
+ char limit[512];
+
+ if (on_demand == YES)
+ SNPRINTF(limit,
+ 512,
+ "SELECT SQL_NO_CACHE * FROM gn070"
+ " %s WHERE expire > %llu AND anonLevel == 0 AND type != %d",
+ ONDEMAND_BLOCK);
+ else
+ strcpy(limit,
+ "SELECT SQL_NO_CACHE * FROM gn070"
+ " %s WHERE expire > %llu AND anonLevel == 0");
+ return iterateHelper(type,
+ limit,
+ iter,
+ closure);
+}
+
+/**
* Iterate over the items in the datastore in ascending
* order of expiration time.
*
@@ -1221,12 +1262,13 @@
contentSize = ntohl(value->size)-sizeof(Datastore_Value);
dbh->ubind[0].buffer = (char*) δ
dbh->ubind[1].buffer = (char*) &expire;
- dbh->ubind[2].buffer = (char*) key;
- dbh->ubind[2].length = &twenty;
- dbh->ubind[3].buffer = (char*) &value[1];
- dbh->ubind[3].length = &contentSize;
+ dbh->ubind[2].buffer = (char*) &expire;
+ dbh->ubind[3].buffer = (char*) key;
+ dbh->ubind[3].length = &twenty;
+ dbh->ubind[4].buffer = (char*) &value[1];
+ dbh->ubind[4].length = &contentSize;
GE_ASSERT(ectx,
- mysql_stmt_param_count(dbh->update) <= 4);
+ mysql_stmt_param_count(dbh->update) <= 5);
if (mysql_stmt_bind_param(dbh->update,
dbh->ubind)) {
GE_LOG(ectx,
@@ -1415,6 +1457,7 @@
api.put = &put;
api.get = &get;
api.iterateLowPriority = &iterateLowPriority;
+ api.iterateNonAnonymous = &iterateNonAnonymous;
api.iterateExpirationTime = &iterateExpirationTime;
api.iterateMigrationOrder = &iterateMigrationOrder;
api.iterateAllNow = &iterateAllNow;
Modified: GNUnet/src/applications/sqstore_sqlite/sqlite.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlite.c 2007-05-23 15:53:44 UTC
(rev 4798)
+++ GNUnet/src/applications/sqstore_sqlite/sqlite.c 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -530,7 +530,9 @@
void * closure,
int sortByPriority,
int inverseOrder,
- int include_expired) {
+ int include_expired,
+ int limit_nonanonymous,
+ int limit_ondemand) {
sqlite3_stmt * stmt;
int count;
char scratch[512];
@@ -568,15 +570,22 @@
strcat(scratch,
"(prio > :4 AND expire == :5) OR expire > :6)");
}
- if (type != 0)
+ if (type != 0) {
strcat(scratch, " AND type = :7");
- else
+ } else if (limit_ondemand == YES) {
SNPRINTF(&scratch[strlen(scratch)],
512 - strlen(scratch),
+ " AND type != %d AND type != %d",
+ RESERVED_BLOCK,
+ ONDEMAND_BLOCK);
+ } else {
+ SNPRINTF(&scratch[strlen(scratch)],
+ 512 - strlen(scratch),
" AND type != %d",
RESERVED_BLOCK); /* otherwise we iterate over
the stats entry, which would
be bad */
+ }
if (NO == include_expired) {
if (type != 0)
strcat(scratch, " AND expire > :8");
@@ -675,23 +684,26 @@
lastPrio,
lastExp);
#endif
- if (iter != NULL) {
- MUTEX_UNLOCK(db->DATABASE_Lock_);
- if (SYSERR == iter(&datum->key,
- &datum->value,
- closure) ) {
- FREE(datum);
+ if ( (NO == limit_nonanonymous) ||
+ (ntohl(datum->value.anonymityLevel) == 0) ) {
+ count++;
+ if (iter != NULL) {
+ MUTEX_UNLOCK(db->DATABASE_Lock_);
+ if (SYSERR == iter(&datum->key,
+ &datum->value,
+ closure) ) {
+ FREE(datum);
+ MUTEX_LOCK(db->DATABASE_Lock_);
+ count = SYSERR;
+ break;
+ }
MUTEX_LOCK(db->DATABASE_Lock_);
- count = SYSERR;
- break;
}
- MUTEX_LOCK(db->DATABASE_Lock_);
}
key = datum->key;
lastPrio = ntohl(datum->value.prio);
lastExp = ntohll(datum->value.expirationTime);
FREE(datum);
- count++;
} else {
if (ret != SQLITE_DONE) {
LOG_SQLITE(handle,
@@ -725,10 +737,29 @@
static int iterateLowPriority(unsigned int type,
Datum_Iterator iter,
void * closure) {
- return sqlite_iterate(type, iter, closure, YES, NO, YES);
+ return sqlite_iterate(type, iter, closure, YES, NO, YES, NO, NO);
}
/**
+ * Call a method on content with zero anonymity.
+ *
+ * @param type limit the iteration to entries of this
+ * type. 0 for all entries.
+ * @param on_demand limit the iteration to entries
+ * that not on-demand?
+ * @param iter the callback method
+ * @param closure argument to all callback calls
+ * @return the number of results, SYSERR if the
+ * iter is non-NULL and aborted the iteration
+ */
+static int iterateNonAnonymous(unsigned int type,
+ int on_demand,
+ Datum_Iterator iter,
+ void * closure) {
+ return sqlite_iterate(0, iter, closure, NO, NO, NO, YES, on_demand);
+}
+
+/**
* Call a method for each key in the database and
* call the callback method on it.
*
@@ -740,7 +771,7 @@
static int iterateExpirationTime(unsigned int type,
Datum_Iterator iter,
void * closure) {
- return sqlite_iterate(type, iter, closure, NO, NO, YES);
+ return sqlite_iterate(type, iter, closure, NO, NO, YES, NO, NO);
}
/**
@@ -753,7 +784,7 @@
*/
static int iterateMigrationOrder(Datum_Iterator iter,
void * closure) {
- return sqlite_iterate(0, iter, closure, NO, YES, NO);
+ return sqlite_iterate(0, iter, closure, NO, YES, NO, NO, NO);
}
/**
@@ -1341,6 +1372,7 @@
api.put = &put;
api.get = &get;
api.iterateLowPriority = &iterateLowPriority;
+ api.iterateNonAnonymous = &iterateNonAnonymous;
api.iterateExpirationTime = &iterateExpirationTime;
api.iterateMigrationOrder = &iterateMigrationOrder;
api.iterateAllNow = &iterateAllNow;
Modified: GNUnet/src/applications/tbench/check.conf
===================================================================
--- GNUnet/src/applications/tbench/check.conf 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/tbench/check.conf 2007-05-27 01:03:54 UTC (rev
4799)
@@ -7,6 +7,5 @@
# Network options for the clients
[NETWORK]
-CLIENT-PORT = 2087
-HOST = "localhost"
+HOST = "localhost:2087"
Modified: GNUnet/src/applications/tbench/peer1.conf
===================================================================
--- GNUnet/src/applications/tbench/peer1.conf 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/tbench/peer1.conf 2007-05-27 01:03:54 UTC (rev
4799)
@@ -1,5 +1,7 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
+[PATHS]
+GNUNETD_HOME = peer1
[GNUNETD]
GNUNETD_HOME = peer1
Modified: GNUnet/src/applications/tbench/peer1udp.conf
===================================================================
--- GNUnet/src/applications/tbench/peer1udp.conf 2007-05-23 15:53:44 UTC
(rev 4798)
+++ GNUnet/src/applications/tbench/peer1udp.conf 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -1,6 +1,9 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
+[PATHS]
+GNUNETD_HOME = peer1-udp
+
[GNUNETD]
GNUNETD_HOME = peer1-udp
# VALGRIND = 300
Modified: GNUnet/src/applications/tbench/peer2.conf
===================================================================
--- GNUnet/src/applications/tbench/peer2.conf 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/tbench/peer2.conf 2007-05-27 01:03:54 UTC (rev
4799)
@@ -1,5 +1,7 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
+[PATHS]
+GNUNETD_HOME = peer2
[GNUNETD]
GNUNETD_HOME = peer2
Modified: GNUnet/src/applications/tbench/peer2udp.conf
===================================================================
--- GNUnet/src/applications/tbench/peer2udp.conf 2007-05-23 15:53:44 UTC
(rev 4798)
+++ GNUnet/src/applications/tbench/peer2udp.conf 2007-05-27 01:03:54 UTC
(rev 4799)
@@ -1,6 +1,9 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
+[PATHS]
+GNUNETD_HOME = peer2-udp
+
[GNUNETD]
GNUNETD_HOME = peer2-udp
# VALGRIND = 300
Modified: GNUnet/src/applications/traffic/Makefile.am
===================================================================
--- GNUnet/src/applications/traffic/Makefile.am 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/traffic/Makefile.am 2007-05-27 01:03:54 UTC (rev
4799)
@@ -3,15 +3,15 @@
plugindir = $(libdir)/GNUnet
lib_LTLIBRARIES = \
- libgnunetmodule_traffic_api.la
+ libgnunettraffic_api.la
plugin_LTLIBRARIES = \
libgnunetmodule_traffic.la
-libgnunetmodule_traffic_api_la_SOURCES = \
+libgnunettraffic_api_la_SOURCES = \
clientapi.c
-libgnunetmodule_traffic_api_la_LIBADD = \
+libgnunettraffic_api_la_LIBADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/util/network_client/libgnunetutil_network_client.la
Modified: GNUnet/src/applications/traffic/clientapi.c
===================================================================
--- GNUnet/src/applications/traffic/clientapi.c 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/traffic/clientapi.c 2007-05-27 01:03:54 UTC (rev
4799)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- (C) 2001, 2002, 2004 Christian Grothoff (and other contributing authors)
+ (C) 2001, 2002, 2004, 2007 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
@@ -43,14 +43,14 @@
* @param peers set to number of peers involved
* @return OK on success, SYSERR on error
*/
-int pollSocket(struct ClientServerConnection * sock,
- unsigned int timeframe,
- unsigned short type,
- unsigned short direction,
- unsigned int * count,
- unsigned int * avg_size,
- unsigned int * peers,
- unsigned int * time) {
+int gnunet_traffic_poll(struct ClientServerConnection * sock,
+ unsigned int timeframe,
+ unsigned short type,
+ unsigned short direction,
+ unsigned int * count,
+ unsigned int * avg_size,
+ unsigned int * peers,
+ unsigned int * time) {
CS_traffic_info_MESSAGE * info;
CS_traffic_request_MESSAGE req;
int i;
@@ -77,7 +77,7 @@
}
for (i=ntohl(info->count)-1;i>=0;i--) {
- TRAFFIC_COUNTER * tc =
&((CS_traffic_info_MESSAGE_GENERIC*)info)->counters[i];
+ const TRAFFIC_COUNTER * tc =
&((CS_traffic_info_MESSAGE_GENERIC*)info)->counters[i];
if ((tc->flags & TC_TYPE_MASK) == direction) {
*count = ntohl(tc->count);
*avg_size = ntohl(tc->avrg_size);
Modified: GNUnet/src/applications/traffic/traffic.c
===================================================================
--- GNUnet/src/applications/traffic/traffic.c 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/applications/traffic/traffic.c 2007-05-27 01:03:54 UTC (rev
4799)
@@ -330,13 +330,13 @@
static int trafficQueryHandler(struct ClientHandle * sock,
const MESSAGE_HEADER * message) {
- CS_traffic_request_MESSAGE * msg;
+ const CS_traffic_request_MESSAGE * msg;
CS_traffic_info_MESSAGE * reply;
int ret;
if (sizeof(CS_traffic_request_MESSAGE) != ntohs(message->size))
return SYSERR;
- msg = (CS_traffic_request_MESSAGE*) message;
+ msg = (const CS_traffic_request_MESSAGE*) message;
reply = buildReply(ntohl(msg->timePeriod));
ret = coreAPI->sendToClient(sock, &reply->header);
FREE(reply);
@@ -525,7 +525,8 @@
/**
* Initialize the traffic module.
*/
-Traffic_ServiceAPI * provide_module_traffic(CoreAPIForApplication * capi) {
+Traffic_ServiceAPI *
+provide_module_traffic(CoreAPIForApplication * capi) {
static Traffic_ServiceAPI api;
#if KEEP_RECEIVE_STATS || KEEP_TRANSMITTED_STATS
int i;
Modified: GNUnet/src/include/Makefile.am
===================================================================
--- GNUnet/src/include/Makefile.am 2007-05-23 15:53:44 UTC (rev 4798)
+++ GNUnet/src/include/Makefile.am 2007-05-27 01:03:54 UTC (rev 4799)
@@ -28,6 +28,7 @@
gnunet_fsui_lib.h \
gnunet_gap_service.h \
gnunet_getoption_lib.h \
+ gnunet_identity_lib.h \
gnunet_identity_service.h \
gnunet_kvstore_service.h \
gnunet_namespace_lib.h \
Modified: GNUnet/src/include/fs.h
===================================================================
--- GNUnet/src/include/fs.h 2007-05-23 15:53:44 UTC (rev 4798)
+++ GNUnet/src/include/fs.h 2007-05-27 01:03:54 UTC (rev 4799)
@@ -1,5 +1,6 @@
/*
This file is part of GNUnet
+ (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 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
@@ -60,6 +61,13 @@
unsigned int anonymityLevel;
/**
+ * Identity of the peer that is known to have the
+ * response. Set to all-zeros if target is not
+ * known.
+ */
+ PeerIdentity target;
+
+ /**
* What are the queries?
*/
HashCode512 query[1];
Modified: GNUnet/src/include/gnunet_fs_lib.h
===================================================================
--- GNUnet/src/include/gnunet_fs_lib.h 2007-05-23 15:53:44 UTC (rev 4798)
+++ GNUnet/src/include/gnunet_fs_lib.h 2007-05-27 01:03:54 UTC (rev 4799)
@@ -45,9 +45,10 @@
struct FS_SEARCH_CONTEXT;
-struct FS_SEARCH_CONTEXT * FS_SEARCH_makeContext(struct GE_Context * ectx,
- struct GC_Configuration * cfg,
- struct MUTEX * lock);
+struct FS_SEARCH_CONTEXT *
+FS_SEARCH_makeContext(struct GE_Context * ectx,
+ struct GC_Configuration * cfg,
+ struct MUTEX * lock);
void FS_SEARCH_destroyContext(struct FS_SEARCH_CONTEXT * ctx);
@@ -56,6 +57,8 @@
/**
* Search for blocks matching the given key and type.
*
+ * @param target identity of host known to have the
+ * content, NULL if no such identity is known
* @param timeout how long to search
* @param anonymityLevel what are the anonymity
* requirements for this request? 0 for no
@@ -63,15 +66,17 @@
* @param callback method to call for each result
* @param prio priority to use for the search
*/
-struct FS_SEARCH_HANDLE * FS_start_search(struct FS_SEARCH_CONTEXT * ctx,
- unsigned int type,
- unsigned int keyCount,
- const HashCode512 * keys,
- unsigned int anonymityLevel,
- unsigned int prio,
- cron_t timeout,
- Datum_Iterator callback,
- void * closure);
+struct FS_SEARCH_HANDLE *
+FS_start_search(struct FS_SEARCH_CONTEXT * ctx,
+ const PeerIdentity * target,
+ unsigned int type,
+ unsigned int keyCount,
+ const HashCode512 * keys,
+ unsigned int anonymityLevel,
+ unsigned int prio,
+ cron_t timeout,
+ Datum_Iterator callback,
+ void * closure);
/**
* Stop searching.
Modified: GNUnet/src/include/gnunet_gap_service.h
===================================================================
--- GNUnet/src/include/gnunet_gap_service.h 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/include/gnunet_gap_service.h 2007-05-27 01:03:54 UTC (rev
4799)
@@ -87,6 +87,7 @@
* datastore on anything that is received, and the caller will be
* listening for these puts.
*
+ * @param target peer to ask primarily (maybe NULL)
* @param type the type of the block that we're looking for
* @param keys the keys to query for
* @param timeout how long to wait until this operation should
@@ -94,7 +95,8 @@
* @return OK if we will start to query, SYSERR if all of our
* buffers are full or other error
*/
- int (*get_start)(unsigned int type,
+ int (*get_start)(const PeerIdentity * target,
+ unsigned int type,
unsigned int anonymityLevel,
unsigned int keyCount,
const HashCode512 * keys,
Added: GNUnet/src/include/gnunet_identity_lib.h
===================================================================
--- GNUnet/src/include/gnunet_identity_lib.h (rev 0)
+++ GNUnet/src/include/gnunet_identity_lib.h 2007-05-27 01:03:54 UTC (rev
4799)
@@ -0,0 +1,64 @@
+/*
+ This file is part of GNUnet
+ (C) 2007 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,
+ Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * @file include/gnunet_identity_lib.h
+ * @brief convenience API to the IDENTITIY service
+ * @author Christian Grothoff
+ */
+
+#ifndef GNUNET_IDENTITY_LIB_H
+#define GNUNET_IDENTITY_LIB_H
+
+#include "gnunet_util.h"
+#include "gnunet_util_network_client.h"
+#include "gnunet_util_crypto.h"
+
+#ifdef __cplusplus
+extern "C" {
+#if 0 /* keep Emacsens' auto-indent happy */
+}
+#endif
+#endif
+
+/**
+ * Inform gnunetd about another peer.
+ *
+ * @param sock socket to talk to gnunetd over
+ * @return OK on success, SYSERR on error
+ */
+int gnunet_identity_peer_add(struct ClientServerConnection * sock,
+ const PublicKey * key,
+ TIME_T expirationTime,
+ unsigned short proto,
+ unsigned short sas,
+ unsigned int mtu,
+ const char * address,
+ const Signature * signature);
+
+#if 0 /* keep Emacsens' auto-indent happy */
+{
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
Property changes on: GNUnet/src/include/gnunet_identity_lib.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: GNUnet/src/include/gnunet_protocols.h
===================================================================
--- GNUnet/src/include/gnunet_protocols.h 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/include/gnunet_protocols.h 2007-05-27 01:03:54 UTC (rev
4799)
@@ -135,8 +135,13 @@
*/
#define CS_PROTO_RETURN_ERROR 4
+/**
+ * Client informs the Daemon about how to contact
+ * a particular peer.
+ */
+#define CS_PROTO_identity_HELLO 5
-/* ********** CS AFS application messages ********** */
+/* ********** CS FS application messages ********** */
/**
* client to gnunetd: send queries
Modified: GNUnet/src/include/gnunet_sqstore_service.h
===================================================================
--- GNUnet/src/include/gnunet_sqstore_service.h 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/include/gnunet_sqstore_service.h 2007-05-27 01:03:54 UTC (rev
4799)
@@ -126,6 +126,22 @@
void * closure);
/**
+ * Iterate over content with anonymity zero.
+ *
+ * @param type entries of which type should be considered?
+ * Use 0 for any type.
+ * @param on_demand limit the iteration to entries
+ * that not on-demand?
+ * @param iter never NULL
+ * @return the number of results, SYSERR if the
+ * iter is non-NULL and aborted the iteration
+ */
+ int (*iterateNonAnonymous)(unsigned int type,
+ int on_demand,
+ Datum_Iterator iter,
+ void * closure);
+
+ /**
* Iterate over the items in the datastore in ascending
* order of expiration time.
*
Modified: GNUnet/src/include/gnunet_traffic_lib.h
===================================================================
--- GNUnet/src/include/gnunet_traffic_lib.h 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/include/gnunet_traffic_lib.h 2007-05-27 01:03:54 UTC (rev
4799)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet
- (C) 2004, 2005, 2006 Christian Grothoff (and other contributing authors)
+ (C) 2004, 2005, 2006, 2007 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
@@ -53,14 +53,14 @@
* highest bit is current time-unit, bit 1 is 32 time-units ago (set)
* @return OK on success, SYSERR on error
*/
-int pollSocket(struct ClientServerConnection * sock,
- unsigned int timeframe,
- unsigned short type,
- unsigned short direction,
- unsigned int * count,
- unsigned int * avg_size,
- unsigned int * peers,
- unsigned int * time);
+int gnunet_traffic_poll(struct ClientServerConnection * sock,
+ unsigned int timeframe,
+ unsigned short type,
+ unsigned short direction,
+ unsigned int * count,
+ unsigned int * avg_size,
+ unsigned int * peers,
+ unsigned int * time);
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_uritrack_lib.h
===================================================================
--- GNUnet/src/include/gnunet_uritrack_lib.h 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/include/gnunet_uritrack_lib.h 2007-05-27 01:03:54 UTC (rev
4799)
@@ -105,13 +105,13 @@
*/
enum URITRACK_STATE {
URITRACK_FRESH = 0,
- URITRACK_INSERTED = 1,
- URITRACK_INDEXED = 2,
- URITRACK_DIRECTORY_ADDED = 4,
- URITRACK_DOWNLOAD_STARTED = 8,
- URITRACK_DOWNLOAD_ABORTED = 16,
- URITRACK_DOWNLOAD_COMPLETED = 32,
- URITRACK_SEARCH_RESULT = 64,
+ URITRACK_INSERTED = 1, // done, FSUI
+ URITRACK_INDEXED = 2, // done, FSUI
+ URITRACK_DIRECTORY_ADDED = 4, // done, FSUI
+ URITRACK_DOWNLOAD_STARTED = 8, // done, FSUI
+ URITRACK_DOWNLOAD_ABORTED = 16, // done, FSUI
+ URITRACK_DOWNLOAD_COMPLETED = 32, // done, FSUI
+ URITRACK_SEARCH_RESULT = 64, // done, FSUI
URITRACK_DIRECTORY_FOUND = 128,
};
Modified: GNUnet/src/include/gnunet_util.h
===================================================================
--- GNUnet/src/include/gnunet_util.h 2007-05-23 15:53:44 UTC (rev 4798)
+++ GNUnet/src/include/gnunet_util.h 2007-05-27 01:03:54 UTC (rev 4799)
@@ -75,7 +75,7 @@
* especially the least significant bits may change
* frequently, even between different SVN versions.
*/
-#define GNUNET_UTIL_VERSION 0x00070102
+#define GNUNET_UTIL_VERSION 0x00070200
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/server/tcpserver.c
===================================================================
--- GNUnet/src/server/tcpserver.c 2007-05-23 15:53:44 UTC (rev 4798)
+++ GNUnet/src/server/tcpserver.c 2007-05-27 01:03:54 UTC (rev 4799)
@@ -348,8 +348,6 @@
not gnunetd */
unregisterCSHandler(CS_PROTO_SHUTDOWN_REQUEST,
&shutdownHandler);
- MUTEX_DESTROY(handlerlock);
- handlerlock = NULL;
GROW(handlers,
max_registeredType,
0);
@@ -360,6 +358,15 @@
return OK;
}
+void __attribute__ ((constructor)) gnunet_tcpserver_ltdl_init() {
+ handlerlock = MUTEX_CREATE(YES);
+}
+
+void __attribute__ ((destructor)) gnunet_tcpserver_ltdl_fini() {
+ MUTEX_DESTROY(handlerlock);
+ handlerlock = NULL;
+}
+
/**
* Initialize the TCP port and listen for incoming client connections.
*/
@@ -392,7 +399,6 @@
return SYSERR;
}
FREE(ch);
- handlerlock = MUTEX_CREATE(YES);
registerCSHandler(CS_PROTO_SHUTDOWN_REQUEST,
&shutdownHandler);
Modified: GNUnet/src/util/check.conf
===================================================================
--- GNUnet/src/util/check.conf 2007-05-23 15:53:44 UTC (rev 4798)
+++ GNUnet/src/util/check.conf 2007-05-27 01:03:54 UTC (rev 4799)
@@ -1,5 +1,7 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
+[PATHS]
+GNUNETD_HOME = /tmp/gnunet-util-test
[GNUNETD]
GNUNETD_HOME = /tmp/gnunet-util-test
Modified: GNUnet/src/util/config_impl/impl.c
===================================================================
--- GNUnet/src/util/config_impl/impl.c 2007-05-23 15:53:44 UTC (rev 4798)
+++ GNUnet/src/util/config_impl/impl.c 2007-05-27 01:03:54 UTC (rev 4799)
@@ -252,21 +252,35 @@
} else
i = 0;
}
- if (0 != GC_set_configuration_value_string(cfg,
- cfg->data->ectx,
- section,
- tag,
- &value[i]))
+ /* first check if we have this value already;
+ this could happen if the value was changed
+ using a command-line option; only set it
+ if we do not have a value already... */
+ if ( (NO == GC_have_configuration_value(cfg,
+ section,
+ tag)) &&
+ (0 != GC_set_configuration_value_string(cfg,
+ cfg->data->ectx,
+ section,
+ tag,
+ &value[i])) )
ret = -1; /* could not set value */
} else if (1 == sscanf(line,
" %63[^= ] =[^\n]",
tag)) {
/* tag = */
- if (0 != GC_set_configuration_value_string(cfg,
- cfg->data->ectx,
- section,
- tag,
- ""))
+ /* first check if we have this value already;
+ this could happen if the value was changed
+ using a command-line option; only set it
+ if we do not have a value already... */
+ if ( (NO == GC_have_configuration_value(cfg,
+ section,
+ tag)) &&
+ (0 != GC_set_configuration_value_string(cfg,
+ cfg->data->ectx,
+ section,
+ tag,
+ "")) )
ret = -1; /* could not set value */
} else {
/* parse error */
Modified: GNUnet/src/util/disk/storage.c
===================================================================
--- GNUnet/src/util/disk/storage.c 2007-05-23 15:53:44 UTC (rev 4798)
+++ GNUnet/src/util/disk/storage.c 2007-05-27 01:03:54 UTC (rev 4799)
@@ -127,6 +127,7 @@
(gfsd->include_sym_links == YES) )
gfsd->total += buf.st_size;
if ( (S_ISDIR(buf.st_mode)) &&
+ (0 == ACCESS(fn, X_OK)) &&
( (!S_ISLNK(buf.st_mode)) ||
(gfsd->include_sym_links == YES) ) ) {
if (SYSERR ==
Modified: GNUnet/src/util/network/select.c
===================================================================
--- GNUnet/src/util/network/select.c 2007-05-23 15:53:44 UTC (rev 4798)
+++ GNUnet/src/util/network/select.c 2007-05-27 01:03:54 UTC (rev 4799)
@@ -789,20 +789,21 @@
* queueing messages (in bytes)
* @return NULL on error
*/
-SelectHandle * select_create(const char * description,
- int is_udp,
- struct GE_Context * ectx,
- struct LoadMonitor * mon,
- int sock,
- unsigned int max_addr_len,
- cron_t timeout,
- SelectMessageHandler mh,
- void * mh_cls,
- SelectAcceptHandler ah,
- void * ah_cls,
- SelectCloseHandler ch,
- void * ch_cls,
- unsigned int memory_quota) {
+SelectHandle *
+select_create(const char * description,
+ int is_udp,
+ struct GE_Context * ectx,
+ struct LoadMonitor * mon,
+ int sock,
+ unsigned int max_addr_len,
+ cron_t timeout,
+ SelectMessageHandler mh,
+ void * mh_cls,
+ SelectAcceptHandler ah,
+ void * ah_cls,
+ SelectCloseHandler ch,
+ void * ch_cls,
+ unsigned int memory_quota) {
SelectHandle * sh;
if ( (is_udp == NO) &&
@@ -859,7 +860,7 @@
sh->listen_sock = NULL;
sh->thread = PTHREAD_CREATE(&selectThread,
sh,
- 4 * 1024);
+ 16 * 1024);
if (sh->thread == NULL) {
GE_LOG_STRERROR(ectx,
GE_ERROR | GE_IMMEDIATE | GE_ADMIN,
Modified: GNUnet/src/util/network_client/check.conf
===================================================================
--- GNUnet/src/util/network_client/check.conf 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/util/network_client/check.conf 2007-05-27 01:03:54 UTC (rev
4799)
@@ -1,5 +1,7 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
+[PATHS]
+GNUNETD_HOME = /tmp/gnunet-util-test
[GNUNETD]
GNUNETD_HOME = /tmp/gnunet-util-test
Modified: GNUnet/src/util/network_client/tcpio.c
===================================================================
--- GNUnet/src/util/network_client/tcpio.c 2007-05-23 15:53:44 UTC (rev
4798)
+++ GNUnet/src/util/network_client/tcpio.c 2007-05-27 01:03:54 UTC (rev
4799)
@@ -362,7 +362,7 @@
size_t size;
size_t sent;
int res;
-
+
MUTEX_LOCK(sock->destroylock);
MUTEX_LOCK(sock->writelock);
if (SYSERR == connection_ensure_connected(sock)) {
Modified: GNUnet/src/util/os/check.conf
===================================================================
--- GNUnet/src/util/os/check.conf 2007-05-23 15:53:44 UTC (rev 4798)
+++ GNUnet/src/util/os/check.conf 2007-05-27 01:03:54 UTC (rev 4799)
@@ -1,6 +1,9 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
+[PATHS]
+GNUNETD_HOME = /tmp/gnunet-util-os-test
+
[GNUNETD]
GNUNETD_HOME = /tmp/gnunet-util-os-test
HELLOEXPIRES = 60
Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2007-05-23 15:53:44 UTC (rev 4798)
+++ GNUnet/todo 2007-05-27 01:03:54 UTC (rev 4799)
@@ -11,13 +11,22 @@
Oh, and this is of course just a plan. And plans always change.
-0.7.2 [4'07]:
+0.7.2 [5'07]:
- new features:
- * USE new URITRACK_STATE database
- * track 0-anonymity indexed content (for DHT-advertising!)
* XFS / support for location URIs [CG]
- + dht/gap integration (search routing) [RC]
+ fsui/fs/location URI support (download routing) [RC]
+ => FSUI/ECRS/FS need to support passing of LOC URI with request
+
+ - ECRS download file -- use new identity lib to give HELLO to gnunetd
+ - ECRS download file -- set RM target iff Location URI given
+ - fslib: pass target through to other side
+ - FS/routing code should *use* target if given (and available) during
routing
+
+ - identity/clientapi.c: add (sanity) check for valid signature!
+ + location URI generation (for search routing) [RC]
+ => ECRS needs to generate location URI for *indexed* non-anonymous
content!
+ - extend identity API to allow creation of (certain) signatures by
clients!
+ - generate and publish location URI
* HTTP transport (libcurl, libmicrohttpd)
- testcases (fix, add):
* dht/tools
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r4799 - in GNUnet: . src/applications/dht/module src/applications/dht/tools src/applications/dstore src/applications/fragmentation src/applications/fs/collection src/applications/fs/ecrs src/applications/fs/fsui src/applications/fs/lib src/applications/fs/module src/applications/fs/namespace src/applications/fs/uritrack src/applications/gap src/applications/identity src/applications/kvstore_sqlite src/applications/rpc src/applications/session src/applications/sqstore_mysql src/applications/sqstore_sqlite src/applications/tbench src/applications/traffic src/include src/server src/util src/util/config_impl src/util/disk src/util/network src/util/network_client src/util/os,
gnunet <=