[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r273 - in GNUnet: . src/applications/dht/tools src/applicat
From: |
grothoff |
Subject: |
[GNUnet-SVN] r273 - in GNUnet: . src/applications/dht/tools src/applications/fs/ecrs src/applications/fs/lib src/include src/util |
Date: |
Tue, 15 Feb 2005 19:52:25 -0800 (PST) |
Author: grothoff
Date: 2005-02-15 19:52:23 -0800 (Tue, 15 Feb 2005)
New Revision: 273
Modified:
GNUnet/src/applications/dht/tools/Makefile.am
GNUnet/src/applications/fs/ecrs/check.conf
GNUnet/src/applications/fs/ecrs/ecrstest.c
GNUnet/src/applications/fs/ecrs/keyspace.c
GNUnet/src/applications/fs/ecrs/search.c
GNUnet/src/applications/fs/ecrs/upload.c
GNUnet/src/applications/fs/ecrs/uri.c
GNUnet/src/applications/fs/lib/check.conf
GNUnet/src/include/gnunet_ecrs_lib.h
GNUnet/src/util/dso.c
GNUnet/todo
Log:
expanded ECRS testcase -- still failing
Modified: GNUnet/src/applications/dht/tools/Makefile.am
===================================================================
--- GNUnet/src/applications/dht/tools/Makefile.am 2005-02-15 18:30:17 UTC
(rev 272)
+++ GNUnet/src/applications/dht/tools/Makefile.am 2005-02-16 03:52:23 UTC
(rev 273)
@@ -1,15 +1,15 @@
INCLUDES = -I$(top_srcdir)/src/include
lib_LTLIBRARIES = \
- libgnunetmodule_dht_api.la
+ libgnunetdht_api.la
bin_PROGRAMS = \
gnunet-dht-join \
gnunet-dht-query
-libgnunetmodule_dht_api_la_SOURCES = \
+libgnunetdht_api_la_SOURCES = \
dht_api.c
-libgnunetmodule_dht_api_la_LIBADD = \
+libgnunetdht_api_la_LIBADD = \
$(top_builddir)/src/util/libgnunetutil.la
@@ -17,13 +17,13 @@
dht-join.c
gnunet_dht_join_LDADD = \
$(top_builddir)/src/applications/dht/module/libgnunetmodule_dht_datastore_memory.la
\
- $(top_builddir)/src/applications/dht/tools/libgnunetmodule_dht_api.la \
+ $(top_builddir)/src/applications/dht/tools/libgnunetdht_api.la \
$(top_builddir)/src/util/libgnunetutil.la
gnunet_dht_query_SOURCES = \
dht-query.c
gnunet_dht_query_LDADD = \
- $(top_builddir)/src/applications/dht/tools/libgnunetmodule_dht_api.la \
+ $(top_builddir)/src/applications/dht/tools/libgnunetdht_api.la \
$(top_builddir)/src/util/libgnunetutil.la
Modified: GNUnet/src/applications/fs/ecrs/check.conf
===================================================================
--- GNUnet/src/applications/fs/ecrs/check.conf 2005-02-15 18:30:17 UTC (rev
272)
+++ GNUnet/src/applications/fs/ecrs/check.conf 2005-02-16 03:52:23 UTC (rev
273)
@@ -1,16 +1,17 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
-GNUNETD_HOME = /tmp/gnunet-check
+GNUNETD_HOME = /tmp/gnunet-check-ecrs
[GNUNETD]
+VALGRIND = 300
HELOEXPIRES = 60
LOGLEVEL = NOTHING
LOGFILE = $GNUNETD_HOME/logs
KEEPLOG = 0
PIDFILE = $GNUNETD_HOME/gnunetd.pid
HOSTS = $GNUNETD_HOME/data/hosts/
-APPLICATIONS = "fs"
+APPLICATIONS = "fs getoption"
# TRANSPORTS = -- no transports!
[MODULES]
Modified: GNUnet/src/applications/fs/ecrs/ecrstest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/ecrstest.c 2005-02-15 18:30:17 UTC (rev
272)
+++ GNUnet/src/applications/fs/ecrs/ecrstest.c 2005-02-16 03:52:23 UTC (rev
273)
@@ -7,6 +7,7 @@
#include "platform.h"
#include "gnunet_util.h"
#include "gnunet_ecrs_lib.h"
+#include "tree.h"
#include <sys/wait.h>
#define CHECK(a) if (!(a)) { ok = NO; BREAK(); goto FAILURE; }
@@ -21,17 +22,181 @@
NULL));
FREENONNULL(setConfigurationString("GNUNET",
"LOGLEVEL",
- "WARNING"));
+ "DEBUG"));
return OK;
}
+static int testTerminate(void * unused) {
+ return OK;
+}
+static char * makeName(unsigned int i) {
+ char * name;
+ char * fn;
+
+ fn = STRDUP("/tmp/gnunet-ecrstest");
+ name = expandFileName(fn);
+ mkdirp(name);
+ FREE(fn);
+ fn = MALLOC(strlen(name) + 40);
+ SNPRINTF(fn,
+ strlen(name) + 40,
+ "%s%sECRSTEST%u",
+ DIR_SEPARATOR_STR,
+ name,
+ i);
+ FREE(name);
+ return fn;
+}
+
+static struct ECRS_URI * uploadFile(unsigned int size) {
+ int ret;
+ char * name;
+ int fd;
+ char * buf;
+ struct ECRS_URI * uri;
+ int i;
+
+ name = makeName(size);
+ fd = OPEN(name, O_WRONLY|O_CREAT, S_IWUSR|S_IRUSR);
+ buf = MALLOC(size);
+ memset(buf, size + size / 253, size);
+ for (i=0;i<(int) (size - 42 - sizeof(HashCode160));i+=sizeof(HashCode160))
+ hash(&buf[i+sizeof(HashCode160)],
+ 42,
+ (HashCode160*) &buf[i]);
+ write(fd, buf, size);
+ FREE(buf);
+ CLOSE(fd);
+ ret = ECRS_uploadFile(name,
+ YES, /* index */
+ 0, /* anon */
+ 0, /* prio */
+ cronTime(NULL) + 10 * cronMINUTES, /* expire */
+ NULL, /* progress */
+ NULL,
+ &testTerminate,
+ NULL,
+ &uri);
+ if (ret != SYSERR) {
+ struct ECRS_MetaData * meta;
+ struct ECRS_URI * key;
+ const char * keywords[2];
+
+ keywords[0] = name;
+ keywords[1] = NULL;
+
+ meta = ECRS_createMetaData();
+ key = ECRS_keywordsToUri(keywords);
+ ret = ECRS_addToKeyspace(key,
+ 0,
+ 0,
+ cronTime(NULL) + 10 * cronMINUTES, /* expire */
+ uri,
+ meta);
+ ECRS_freeMetaData(meta);
+ ECRS_freeUri(uri);
+ FREE(name);
+ if (ret == OK) {
+ return key;
+ } else {
+ ECRS_freeUri(key);
+ return NULL;
+ }
+ } else {
+ FREE(name);
+ return NULL;
+ }
+}
+
+static int searchCB(const ECRS_FileInfo * fi,
+ const HashCode160 * key,
+ void * closure) {
+ struct ECRS_URI ** my = closure;
+
+ LOG(LOG_DEBUG,
+ "Received search result!\n");
+ GNUNET_ASSERT(NULL == *my);
+ *my = ECRS_dupUri(fi->uri);
+ return SYSERR; /* abort search */
+}
+
+/**
+ * @param *uri In: keyword URI, out: file URI
+ * @return OK on success
+ */
+static int searchFile(struct ECRS_URI ** uri) {
+ int ret;
+ struct ECRS_URI * myURI;
+
+ myURI = NULL;
+ ECRS_search(*uri,
+ 0,
+ 15 * cronSECONDS,
+ &searchCB,
+ &myURI,
+ &testTerminate,
+ NULL);
+ ECRS_freeUri(*uri);
+ *uri = myURI;
+ if ( (ret != SYSERR) &&
+ (myURI != NULL) )
+ return OK;
+ else
+ return SYSERR;
+}
+
+static int downloadFile(unsigned int size,
+ struct ECRS_URI * uri) {
+ /* FIXME: initiate download,
+ verify file */
+ ECRS_freeUri(uri);
+ return OK;
+}
+
+
+static int unindexFile(unsigned int size) {
+ int ret;
+ char * name;
+
+ name = makeName(size);
+ ret = ECRS_unindexFile(name,
+ NULL,
+ NULL,
+ &testTerminate,
+ NULL);
+ if (0 != UNLINK(name))
+ ret = SYSERR;
+ FREE(name);
+ return ret;
+}
+
int main(int argc, char * argv[]){
+ static unsigned int filesizes[] = {
+ 1,
+ 2,
+ 4,
+ 16,
+ 32,
+ 1024,
+ DBLOCK_SIZE - 1,
+ DBLOCK_SIZE,
+ DBLOCK_SIZE + 1,
+ DBLOCK_SIZE * CHK_PER_INODE - 1,
+ DBLOCK_SIZE * CHK_PER_INODE,
+ DBLOCK_SIZE * CHK_PER_INODE + 1,
+ DBLOCK_SIZE * CHK_PER_INODE * CHK_PER_INODE - 1,
+ DBLOCK_SIZE * CHK_PER_INODE * CHK_PER_INODE,
+ DBLOCK_SIZE * CHK_PER_INODE * CHK_PER_INODE + 1,
+ 0
+ };
pid_t daemon;
int status;
int ok;
Mutex lock;
GNUNET_TCP_SOCKET * sock;
+ struct ECRS_URI * uri;
+ int i;
daemon = fork();
if (daemon == 0) {
@@ -41,6 +206,7 @@
if (0 != execlp("gnunetd", /* what binary to execute, must be in $PATH! */
"gnunetd", /* arg0, path to gnunet binary */
"-d", /* do not daemonize so we can easily kill you */
+ "-L", "DEBUG",
"-c",
"check.conf", /* configuration file */
NULL)) {
@@ -60,7 +226,14 @@
CHECK(sock != NULL);
/* ACTUAL TEST CODE */
- /* FIXME: actual test code is TO BE ADDED */
+ i = 0;
+ while (filesizes[i] != 0) {
+ uri = uploadFile(filesizes[i]);
+ CHECK(NULL != uri);
+ CHECK(OK == searchFile(&uri));
+ CHECK(OK == downloadFile(filesizes[i], uri));
+ CHECK(OK == unindexFile(filesizes[i]));
+ }
/* END OF TEST CODE */
FAILURE:
Modified: GNUnet/src/applications/fs/ecrs/keyspace.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/keyspace.c 2005-02-15 18:30:17 UTC (rev
272)
+++ GNUnet/src/applications/fs/ecrs/keyspace.c 2005-02-16 03:52:23 UTC (rev
273)
@@ -147,9 +147,7 @@
freePrivateKey(pk);
if (OK != FS_insert(sock, value))
ret = SYSERR;
- FREE(keywords[i]);
}
- GROW(keywords, keywordCount, 0);
FREE(dstURI);
releaseClientSocket(sock);
Modified: GNUnet/src/applications/fs/ecrs/search.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/search.c 2005-02-15 18:30:17 UTC (rev
272)
+++ GNUnet/src/applications/fs/ecrs/search.c 2005-02-16 03:52:23 UTC (rev
273)
@@ -197,6 +197,7 @@
&query,
&hc,
sqc);
+ freePrivateKey(pk);
}
LOG(LOG_DEBUG,
"Queries ready.\n");
Modified: GNUnet/src/applications/fs/ecrs/upload.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/upload.c 2005-02-15 18:30:17 UTC (rev
272)
+++ GNUnet/src/applications/fs/ecrs/upload.c 2005-02-16 03:52:23 UTC (rev
273)
@@ -442,6 +442,7 @@
FREE(uris);
/* free resources */
+ FREENONNULL(iblocks[treedepth]);
FREE(iblocks);
FREE(dblock);
CLOSE(fd);
Modified: GNUnet/src/applications/fs/ecrs/uri.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/uri.c 2005-02-15 18:30:17 UTC (rev
272)
+++ GNUnet/src/applications/fs/ecrs/uri.c 2005-02-16 03:52:23 UTC (rev
273)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- (C) 2003, 2004 Christian Grothoff (and other contributing authors)
+ (C) 2003, 2004, 2005 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
@@ -498,7 +498,34 @@
return ret;
}
+/**
+ * Convert a NULL-terminated array of keywords
+ * to an ECRS URI.
+ */
+struct ECRS_URI * ECRS_keywordsToUri(const char * keyword[]) {
+ unsigned int count;
+ URI * ret;
+ unsigned int i;
+
+ count = 0;
+ while (keyword[count] != NULL)
+ count++;
+ ret = MALLOC(sizeof(URI));
+ ret->type = ksk;
+ ret->data.ksk.keywordCount = 0;
+ ret->data.ksk.keywords = NULL;
+ GROW(ret->data.ksk.keywords,
+ ret->data.ksk.keywordCount,
+ count);
+ for (i=0;i<count;i++)
+ ret->data.ksk.keywords[i] = STRDUP(keyword[i]);
+ return ret;
+
+}
+
+
+
/**
* Are these two URIs equal? FIXME: not very efficient
* implementation. Also, for keyword URIs, we might
Modified: GNUnet/src/applications/fs/lib/check.conf
===================================================================
--- GNUnet/src/applications/fs/lib/check.conf 2005-02-15 18:30:17 UTC (rev
272)
+++ GNUnet/src/applications/fs/lib/check.conf 2005-02-16 03:52:23 UTC (rev
273)
@@ -1,9 +1,10 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
-GNUNETD_HOME = /tmp/gnunet-check
+GNUNETD_HOME = /tmp/gnunet-check-fslib
[GNUNETD]
+VALGRIND = 300
HELOEXPIRES = 60
LOGLEVEL = NOTHING
LOGFILE = $GNUNETD_HOME/logs
Modified: GNUnet/src/include/gnunet_ecrs_lib.h
===================================================================
--- GNUnet/src/include/gnunet_ecrs_lib.h 2005-02-15 18:30:17 UTC (rev
272)
+++ GNUnet/src/include/gnunet_ecrs_lib.h 2005-02-16 03:52:23 UTC (rev
273)
@@ -45,12 +45,12 @@
*/
#define AFS_VERSION "4.0.0"
-#define GNUNET_DIRECTORY_MIME "application/gnunet-directory"
+#define GNUNET_DIRECTORY_MIME "application/gnunet-directory"
#define GNUNET_DIRECTORY_MAGIC "\211GND\r\n\032\n"
-#define GNUNET_DIRECTORY_EXT ".gnd"
+#define GNUNET_DIRECTORY_EXT ".gnd"
-#define ECRS_URI_PREFIX "gnunet://ecrs/"
+#define ECRS_URI_PREFIX "gnunet://ecrs/"
#define ECRS_SEARCH_INFIX "ksk/"
#define ECRS_SUBSPACE_INFIX "sks/"
#define ECRS_FILE_INFIX "chk/"
@@ -188,6 +188,12 @@
char * ECRS_uriToString(const struct ECRS_URI * uri);
/**
+ * Convert a NULL-terminated array of keywords
+ * to an ECRS URI.
+ */
+struct ECRS_URI * ECRS_keywordsToUri(const char * keyword[]);
+
+/**
* Convert a UTF-8 String to a URI.
*/
struct ECRS_URI * ECRS_stringToUri(const char * uri);
Modified: GNUnet/src/util/dso.c
===================================================================
--- GNUnet/src/util/dso.c 2005-02-15 18:30:17 UTC (rev 272)
+++ GNUnet/src/util/dso.c 2005-02-16 03:52:23 UTC (rev 273)
@@ -101,7 +101,7 @@
}
void unloadDynamicLibrary(void * libhandle) {
- lt_dlclose(libhandle);
+// lt_dlclose(libhandle);
if (0 != lt_dlexit())
LOG_STRERROR(LOG_WARNING, "lt_dlexit");
}
Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2005-02-15 18:30:17 UTC (rev 272)
+++ GNUnet/todo 2005-02-16 03:52:23 UTC (rev 273)
@@ -1,4 +1,4 @@
-0.6.6a [2?'05] (aka "bugfixes"):
+0.6.6b [2?'05] (aka "bugfixes"):
- 828?
- 827??
- 823?
@@ -19,6 +19,10 @@
* gnunet-directory
* gnunet-pseudonym
- Resolve "@todo [WIN]" (Nils)
+- FSUI:
+ * API changes (Krista discussion, anonymity level)
+- UTIL:
+ * API changes (hostkey struct, other structs? HashCode160)
0.7.0pre1 [4'05] (aka "preview"):
- fslibtest: implement verify result
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r273 - in GNUnet: . src/applications/dht/tools src/applications/fs/ecrs src/applications/fs/lib src/include src/util,
grothoff <=