[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r5755 - in GNUnet: . src/applications/advertising src/appli
From: |
gnunet |
Subject: |
[GNUnet-SVN] r5755 - in GNUnet: . src/applications/advertising src/applications/bootstrap_http src/applications/chat src/applications/datastore src/applications/dht/module src/applications/dht/tools src/applications/dstore src/applications/fragmentation src/applications/fs 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/tools src/applications/fs/uritrack src/applications/gap src/applications/getoption src/applications/identity src/applications/kvstore_sqlite src/applications/pingpong src/applications/rpc src/applications/session src/applications/sqstore_mysql src/applications/sqstore_sqlite src/applications/state src/applications/stats src/applications/tbench src/applications/template src/applications/testbed src/applications/testing src/applications/topology_default src/applications/topology_f2f src/applications/tracekit src/applications/traffic src/applications/transport src/applications/vpn src/include src/server src/setup src/setup/gtk src/setup/lib src/setup/ncurses src/setup/text src/transports src/transports/upnp src/util/boot src/util/config src/util/config_impl src/util/containers src/util/cron src/util/crypto src/util/disk src/util/error src/util/getopt src/util/loggers src/util/network src/util/network_client src/util/os src/util/string src/util/threads src/util/win |
Date: |
Sun, 25 Nov 2007 05:04:49 -0700 (MST) |
Author: grothoff
Date: 2007-11-25 05:04:45 -0700 (Sun, 25 Nov 2007)
New Revision: 5755
Added:
GNUnet/src/include/gnunet_rpc_lib.h
Modified:
GNUnet/HACKING
GNUnet/src/applications/advertising/advertising.c
GNUnet/src/applications/advertising/advertising_test.c
GNUnet/src/applications/advertising/bootstrap.c
GNUnet/src/applications/advertising/bootstrap.h
GNUnet/src/applications/bootstrap_http/http.c
GNUnet/src/applications/bootstrap_http/httptest.c
GNUnet/src/applications/chat/chat.c
GNUnet/src/applications/chat/chat.h
GNUnet/src/applications/chat/clientapi.c
GNUnet/src/applications/chat/gnunet-chat.c
GNUnet/src/applications/datastore/datastore.c
GNUnet/src/applications/datastore/filter.c
GNUnet/src/applications/datastore/filter.h
GNUnet/src/applications/datastore/prefetch.c
GNUnet/src/applications/datastore/prefetch.h
GNUnet/src/applications/dht/module/cs.c
GNUnet/src/applications/dht/module/dstore.c
GNUnet/src/applications/dht/module/dstore.h
GNUnet/src/applications/dht/module/routing.c
GNUnet/src/applications/dht/module/routing.h
GNUnet/src/applications/dht/module/service.c
GNUnet/src/applications/dht/module/table.c
GNUnet/src/applications/dht/module/table.h
GNUnet/src/applications/dht/tools/dht-query.c
GNUnet/src/applications/dht/tools/dht_api.c
GNUnet/src/applications/dht/tools/dhttest.c
GNUnet/src/applications/dht/tools/dhttest2.c
GNUnet/src/applications/dstore/dstore.c
GNUnet/src/applications/dstore/dstore_test.c
GNUnet/src/applications/fragmentation/fragmentation.c
GNUnet/src/applications/fragmentation/fragmentationtest.c
GNUnet/src/applications/fs/collection/collection.c
GNUnet/src/applications/fs/collection/collectiontest.c
GNUnet/src/applications/fs/ecrs/bincoder.c
GNUnet/src/applications/fs/ecrs/directory.c
GNUnet/src/applications/fs/ecrs/directorytest.c
GNUnet/src/applications/fs/ecrs/download.c
GNUnet/src/applications/fs/ecrs/downloadtest.c
GNUnet/src/applications/fs/ecrs/ecrs.c
GNUnet/src/applications/fs/ecrs/ecrs.h
GNUnet/src/applications/fs/ecrs/ecrstest.c
GNUnet/src/applications/fs/ecrs/helper.c
GNUnet/src/applications/fs/ecrs/indexinfo.c
GNUnet/src/applications/fs/ecrs/keyspace.c
GNUnet/src/applications/fs/ecrs/meta.c
GNUnet/src/applications/fs/ecrs/metatest.c
GNUnet/src/applications/fs/ecrs/metatest2.c
GNUnet/src/applications/fs/ecrs/namespace.c
GNUnet/src/applications/fs/ecrs/namespacetest.c
GNUnet/src/applications/fs/ecrs/parser.c
GNUnet/src/applications/fs/ecrs/search.c
GNUnet/src/applications/fs/ecrs/searchtest.c
GNUnet/src/applications/fs/ecrs/tree.c
GNUnet/src/applications/fs/ecrs/unindex.c
GNUnet/src/applications/fs/ecrs/upload.c
GNUnet/src/applications/fs/ecrs/uri.c
GNUnet/src/applications/fs/ecrs/uritest.c
GNUnet/src/applications/fs/ecrs_core.c
GNUnet/src/applications/fs/ecrs_core_test.c
GNUnet/src/applications/fs/fsui/deserialize.c
GNUnet/src/applications/fs/fsui/download.c
GNUnet/src/applications/fs/fsui/downloadtest.c
GNUnet/src/applications/fs/fsui/fsui-loader.c
GNUnet/src/applications/fs/fsui/fsui.c
GNUnet/src/applications/fs/fsui/fsui.h
GNUnet/src/applications/fs/fsui/fsuitest.c
GNUnet/src/applications/fs/fsui/fsuitest2.c
GNUnet/src/applications/fs/fsui/search.c
GNUnet/src/applications/fs/fsui/searchtest.c
GNUnet/src/applications/fs/fsui/serialize.c
GNUnet/src/applications/fs/fsui/serializetest.c
GNUnet/src/applications/fs/fsui/serializetest2.c
GNUnet/src/applications/fs/fsui/serializetest3.c
GNUnet/src/applications/fs/fsui/serializetest4.c
GNUnet/src/applications/fs/fsui/unindex.c
GNUnet/src/applications/fs/fsui/upload.c
GNUnet/src/applications/fs/lib/fslib.c
GNUnet/src/applications/fs/lib/fslibtest.c
GNUnet/src/applications/fs/module/anonymity.c
GNUnet/src/applications/fs/module/anonymity.h
GNUnet/src/applications/fs/module/dht_push.c
GNUnet/src/applications/fs/module/dht_push.h
GNUnet/src/applications/fs/module/fs.c
GNUnet/src/applications/fs/module/migration.c
GNUnet/src/applications/fs/module/migration.h
GNUnet/src/applications/fs/module/ondemand.c
GNUnet/src/applications/fs/module/ondemand.h
GNUnet/src/applications/fs/module/querymanager.c
GNUnet/src/applications/fs/module/querymanager.h
GNUnet/src/applications/fs/namespace/namespace_info.c
GNUnet/src/applications/fs/namespace/namespace_infotest.c
GNUnet/src/applications/fs/tools/gnunet-directory.c
GNUnet/src/applications/fs/tools/gnunet-download.c
GNUnet/src/applications/fs/tools/gnunet-insert.c
GNUnet/src/applications/fs/tools/gnunet-pseudonym.c
GNUnet/src/applications/fs/tools/gnunet-search.c
GNUnet/src/applications/fs/tools/gnunet-unindex.c
GNUnet/src/applications/fs/uritrack/callbacks.c
GNUnet/src/applications/fs/uritrack/callbacks.h
GNUnet/src/applications/fs/uritrack/file_info.c
GNUnet/src/applications/fs/uritrack/tracktest.c
GNUnet/src/applications/fs/uritrack/uri_info.c
GNUnet/src/applications/gap/gap.c
GNUnet/src/applications/gap/gaptest.c
GNUnet/src/applications/gap/gaptest2.c
GNUnet/src/applications/gap/gaptest3.c
GNUnet/src/applications/gap/pid_table.c
GNUnet/src/applications/gap/pid_table.h
GNUnet/src/applications/getoption/clientapi.c
GNUnet/src/applications/getoption/getoption.c
GNUnet/src/applications/getoption/getoption.h
GNUnet/src/applications/identity/clientapi.c
GNUnet/src/applications/identity/hostkey.c
GNUnet/src/applications/identity/hostkey.h
GNUnet/src/applications/identity/identity.c
GNUnet/src/applications/identity/identitytest.c
GNUnet/src/applications/kvstore_sqlite/kv_sqlite.c
GNUnet/src/applications/kvstore_sqlite/kv_sqlitetest.c
GNUnet/src/applications/pingpong/pingpong.c
GNUnet/src/applications/rpc/parameters.c
GNUnet/src/applications/rpc/parameterstest.c
GNUnet/src/applications/rpc/rpc.c
GNUnet/src/applications/session/connect.c
GNUnet/src/applications/session/sessiontest.c
GNUnet/src/applications/session/sessiontest2.c
GNUnet/src/applications/session/sessiontest_http.c
GNUnet/src/applications/sqstore_mysql/mysql.c
GNUnet/src/applications/sqstore_mysql/mysqltest.c
GNUnet/src/applications/sqstore_mysql/mysqltest2.c
GNUnet/src/applications/sqstore_mysql/mysqltest3.c
GNUnet/src/applications/sqstore_sqlite/sqlite.c
GNUnet/src/applications/sqstore_sqlite/sqlitetest.c
GNUnet/src/applications/sqstore_sqlite/sqlitetest2.c
GNUnet/src/applications/sqstore_sqlite/sqlitetest3.c
GNUnet/src/applications/state/state.c
GNUnet/src/applications/stats/clientapi.c
GNUnet/src/applications/stats/gnunet-stats.c
GNUnet/src/applications/stats/sqstats.c
GNUnet/src/applications/stats/statistics.c
GNUnet/src/applications/stats/statistics.h
GNUnet/src/applications/tbench/gnunet-tbench.c
GNUnet/src/applications/tbench/tbench.c
GNUnet/src/applications/tbench/tbenchtest.c
GNUnet/src/applications/template/gnunet-template.c
GNUnet/src/applications/template/template.c
GNUnet/src/applications/testbed/commands.c
GNUnet/src/applications/testbed/gnunet-testbed.c
GNUnet/src/applications/testbed/testbed.c
GNUnet/src/applications/testbed/testbed.h
GNUnet/src/applications/testing/testing.c
GNUnet/src/applications/topology_default/topology.c
GNUnet/src/applications/topology_f2f/topology.c
GNUnet/src/applications/tracekit/gnunet-tracekit.c
GNUnet/src/applications/tracekit/tracekit.c
GNUnet/src/applications/tracekit/tracekit.h
GNUnet/src/applications/traffic/clientapi.c
GNUnet/src/applications/traffic/traffic.c
GNUnet/src/applications/traffic/traffic.h
GNUnet/src/applications/transport/check.c
GNUnet/src/applications/transport/transport.c
GNUnet/src/applications/vpn/gnunet-vpn.c
GNUnet/src/applications/vpn/vpn.c
GNUnet/src/include/Makefile.am
GNUnet/src/include/core.h
GNUnet/src/include/ecrs_core.h
GNUnet/src/include/fs.h
GNUnet/src/include/gnunet_blockstore.h
GNUnet/src/include/gnunet_bootstrap_service.h
GNUnet/src/include/gnunet_chat_lib.h
GNUnet/src/include/gnunet_collection_lib.h
GNUnet/src/include/gnunet_core.h
GNUnet/src/include/gnunet_datastore_service.h
GNUnet/src/include/gnunet_dht_lib.h
GNUnet/src/include/gnunet_dht_service.h
GNUnet/src/include/gnunet_directories.h
GNUnet/src/include/gnunet_dstore_service.h
GNUnet/src/include/gnunet_ecrs_lib.h
GNUnet/src/include/gnunet_fragmentation_service.h
GNUnet/src/include/gnunet_fs_lib.h
GNUnet/src/include/gnunet_fsui_lib.h
GNUnet/src/include/gnunet_gap_service.h
GNUnet/src/include/gnunet_identity_service.h
GNUnet/src/include/gnunet_kvstore_service.h
GNUnet/src/include/gnunet_namespace_lib.h
GNUnet/src/include/gnunet_peerinfo_lib.h
GNUnet/src/include/gnunet_pingpong_service.h
GNUnet/src/include/gnunet_protocols.h
GNUnet/src/include/gnunet_rpc_service.h
GNUnet/src/include/gnunet_session_service.h
GNUnet/src/include/gnunet_setup_lib.h
GNUnet/src/include/gnunet_sqstore_service.h
GNUnet/src/include/gnunet_state_service.h
GNUnet/src/include/gnunet_stats_lib.h
GNUnet/src/include/gnunet_stats_service.h
GNUnet/src/include/gnunet_topology_service.h
GNUnet/src/include/gnunet_traffic_lib.h
GNUnet/src/include/gnunet_traffic_service.h
GNUnet/src/include/gnunet_transport.h
GNUnet/src/include/gnunet_transport_service.h
GNUnet/src/include/gnunet_upnp_service.h
GNUnet/src/include/gnunet_uritrack_lib.h
GNUnet/src/include/gnunet_util_boot.h
GNUnet/src/include/gnunet_util_config.h
GNUnet/src/include/gnunet_util_containers.h
GNUnet/src/include/gnunet_util_cron.h
GNUnet/src/include/gnunet_util_crypto.h
GNUnet/src/include/gnunet_util_disk.h
GNUnet/src/include/gnunet_util_error.h
GNUnet/src/include/gnunet_util_error_loggers.h
GNUnet/src/include/gnunet_util_getopt.h
GNUnet/src/include/gnunet_util_network.h
GNUnet/src/include/gnunet_util_network_client.h
GNUnet/src/include/gnunet_util_os.h
GNUnet/src/include/gnunet_util_string.h
GNUnet/src/include/plibc.h
GNUnet/src/server/connection.c
GNUnet/src/server/connection.h
GNUnet/src/server/core.c
GNUnet/src/server/gnunet-peer-info.c
GNUnet/src/server/gnunet-transport-check.c
GNUnet/src/server/gnunet-update.c
GNUnet/src/server/gnunetd.c
GNUnet/src/server/handler.c
GNUnet/src/server/handler.h
GNUnet/src/server/startup.c
GNUnet/src/server/startup.h
GNUnet/src/server/tcpserver.c
GNUnet/src/server/tcpserver.h
GNUnet/src/server/version.c
GNUnet/src/server/version.h
GNUnet/src/setup/gnunet-setup.c
GNUnet/src/setup/gnunet-win-tool.c
GNUnet/src/setup/gtk/gconf.c
GNUnet/src/setup/gtk/gconf.h
GNUnet/src/setup/gtk/glade_support.c
GNUnet/src/setup/gtk/glade_support.h
GNUnet/src/setup/gtk/ngconf.c
GNUnet/src/setup/gtk/wizard_gtk.c
GNUnet/src/setup/gtk/wizard_gtk.h
GNUnet/src/setup/lib/gns.c
GNUnet/src/setup/lib/tree.c
GNUnet/src/setup/lib/tree.h
GNUnet/src/setup/lib/wizard_util.c
GNUnet/src/setup/lib/wizard_util.h
GNUnet/src/setup/ncurses/mconf.c
GNUnet/src/setup/ncurses/mconf.h
GNUnet/src/setup/ncurses/wizard_curs.c
GNUnet/src/setup/ncurses/wizard_curs.h
GNUnet/src/setup/text/conf.c
GNUnet/src/setup/text/conf.h
GNUnet/src/transports/http.c
GNUnet/src/transports/ip.c
GNUnet/src/transports/ip.h
GNUnet/src/transports/ip6.c
GNUnet/src/transports/ip6.h
GNUnet/src/transports/nat.c
GNUnet/src/transports/smtp.c
GNUnet/src/transports/tcp.c
GNUnet/src/transports/tcp6.c
GNUnet/src/transports/tcp_helper.c
GNUnet/src/transports/test.c
GNUnet/src/transports/test_repeat.c
GNUnet/src/transports/udp.c
GNUnet/src/transports/udp6.c
GNUnet/src/transports/udp_helper.c
GNUnet/src/transports/upnp/error.c
GNUnet/src/transports/upnp/init.c
GNUnet/src/transports/upnp/ip.c
GNUnet/src/transports/upnp/ip.h
GNUnet/src/transports/upnp/upnp.c
GNUnet/src/transports/upnp/upnp.h
GNUnet/src/transports/upnp/upnptest.c
GNUnet/src/util/boot/startup.c
GNUnet/src/util/config/config.c
GNUnet/src/util/config/configtest.c
GNUnet/src/util/config_impl/configtest.c
GNUnet/src/util/containers/bloomfilter.c
GNUnet/src/util/cron/cron.c
GNUnet/src/util/crypto/crc32.c
GNUnet/src/util/crypto/hashing.c
GNUnet/src/util/crypto/hostkey_gcrypt.c
GNUnet/src/util/crypto/kblockkey.c
GNUnet/src/util/crypto/kblockkey_test.c
GNUnet/src/util/crypto/random.c
GNUnet/src/util/crypto/symcipher_gcrypt.c
GNUnet/src/util/crypto/symciphertest.c
GNUnet/src/util/crypto/weakkeytest.c
GNUnet/src/util/disk/storage.c
GNUnet/src/util/error/error.c
GNUnet/src/util/getopt/getopt.c
GNUnet/src/util/getopt/setoption.c
GNUnet/src/util/loggers/file.c
GNUnet/src/util/loggers/memory.c
GNUnet/src/util/loggers/smtp.c
GNUnet/src/util/network/io.c
GNUnet/src/util/network/ip.c
GNUnet/src/util/network/ipcheck.c
GNUnet/src/util/network/network.h
GNUnet/src/util/network/select.c
GNUnet/src/util/network/selecttest.c
GNUnet/src/util/network_client/daemon.c
GNUnet/src/util/network_client/tcpio.c
GNUnet/src/util/network_client/tcpiotest.c
GNUnet/src/util/os/console.c
GNUnet/src/util/os/cpustatus.c
GNUnet/src/util/os/daemon.c
GNUnet/src/util/os/daemontest.c
GNUnet/src/util/os/dso.c
GNUnet/src/util/os/init.c
GNUnet/src/util/os/installpath.c
GNUnet/src/util/os/osconfig.c
GNUnet/src/util/os/priority.c
GNUnet/src/util/os/semaphore.c
GNUnet/src/util/os/semaphoretest.c
GNUnet/src/util/os/statuscalls.c
GNUnet/src/util/os/statuscallstest.c
GNUnet/src/util/os/user.c
GNUnet/src/util/string/string.c
GNUnet/src/util/string/xmalloc.c
GNUnet/src/util/threads/mutex.c
GNUnet/src/util/threads/pthread.c
GNUnet/src/util/threads/semaphore.c
GNUnet/src/util/threads/shutdown.c
GNUnet/src/util/threads/signal.c
GNUnet/src/util/win/winproc.c
Log:
2nd round of renaming
Modified: GNUnet/HACKING
===================================================================
--- GNUnet/HACKING 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/HACKING 2007-11-25 12:04:45 UTC (rev 5755)
@@ -2,16 +2,6 @@
1) All exported symbols (function names, macros and structures) should begin
with the prefix "GNUNET_". No global variables should be exported.
- Accepted exceptions (for now, to be reconsidered):
- a) This rule only applies to exported symbols in normal shared libraries.
- For all plugins, the exported symbols must end in "_libraryname" (and
- follow other conventions as established by the plugin API). Plugins
- should avoid exporting symbols other than those used by the plugin API.
- b) Error handling and logging functions have the prefix "GE_" (for now).
- c) Configuration functions have the prefix "GC_" (for now).
- d) Certain very specific libraries (ECRS, FSUI, DHT) have their own
- prefix. This can be ok if the prefix alone is long enough and the
- library is highly application specific.
2) All function names should use lower-caps names with underscores. Common
abbreviations like "RSA" should be in all-caps in function names. Example:
"GNUNET_semaphore_create".
@@ -26,15 +16,24 @@
conventions (except for the "GNUNET_" prefix).
6) Global symbols that are exported but should not usually be used directly
(i.e., because a convenience macro is provided), should end with an
underscore.
+7) For all plugins, the exported symbols must end in "_libraryname" (and
+ follow other conventions as established by the plugin API). Plugins should
+ avoid exporting symbols other than those used by the plugin API.
+8) Libraries (other than gnunetutil and plugins) should add a second prefix
after
+ the "GNUNET_" to indicate the specific GNUnet library that the functions
+ belong to, for example, "GNUNET_ECRS_foo_bar" for "libgnunetecrs".
NOTE:
=====
The existing codebase does not yet follow these conventions in many
-places (especially with respect to local symbols). libgnunetutil.so
-should be clean. Patches to fix things are welcome.
+places (especially with respect to local symbols and exported symbols
+from plugins). Patches to fix these are welcome.
-Also, we should have a naming convention for fields of a struct.
+Also, the above does not specify a naming convention for fields of structs.
Using the simple no-caps with underscores notation that is also
-used for local functions would make sense.
+used for local functions would make sense. An open question is if
+we should distinguish function pointer in structs and normal value
+fields by using a different naming convention for one of these.
+Comments on this would be welcome.
Modified: GNUnet/src/applications/advertising/advertising.c
===================================================================
--- GNUnet/src/applications/advertising/advertising.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/advertising/advertising.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -62,19 +62,19 @@
#define DEBUG_ADVERTISING GNUNET_NO
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
-static Transport_ServiceAPI *transport;
+static GNUNET_Transport_ServiceAPI *transport;
-static Identity_ServiceAPI *identity;
+static GNUNET_Identity_ServiceAPI *identity;
-static Pingpong_ServiceAPI *pingpong;
+static GNUNET_Pingpong_ServiceAPI *pingpong;
-static Topology_ServiceAPI *topology;
+static GNUNET_Topology_ServiceAPI *topology;
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
static int stat_hello_in;
@@ -151,7 +151,7 @@
receivedhello (const GNUNET_PeerIdentity * sender,
const GNUNET_MessageHeader * message)
{
- TSession *tsession;
+ GNUNET_TSession *tsession;
GNUNET_MessageHello *copy;
GNUNET_PeerIdentity foreignId;
const GNUNET_MessageHello *msg;
@@ -168,14 +168,14 @@
if ((ntohs (msg->header.size) < sizeof (GNUNET_MessageHello)) ||
(ntohs (msg->header.size) != GNUNET_sizeof_hello (msg)))
{
- GE_BREAK_OP (ectx, 0);
+ GNUNET_GE_BREAK_OP (ectx, 0);
return GNUNET_SYSERR;
}
identity->getPeerIdentity (&msg->publicKey, &foreignId);
if (0 != memcmp (&msg->senderIdentity.hashPubKey,
&foreignId.hashPubKey, sizeof (GNUNET_HashCode)))
{
- GE_BREAK_OP (ectx, 0);
+ GNUNET_GE_BREAK_OP (ectx, 0);
return GNUNET_SYSERR; /* public key and host GNUNET_hash do not
match */
}
if (GNUNET_SYSERR == GNUNET_RSA_verify (&msg->senderIdentity,
@@ -186,34 +186,34 @@
&msg->signature, &msg->publicKey))
{
IF_GELOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
GNUNET_hash_to_enc (&msg->senderIdentity.hashPubKey, &enc));
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_
("HELLO message from `%s' has an invalid signature.
Dropping.\n"),
(char *) &enc);
- GE_BREAK_OP (ectx, 0);
+ GNUNET_GE_BREAK_OP (ectx, 0);
return GNUNET_SYSERR; /* message invalid */
}
if ((GNUNET_Int32Time) ntohl (msg->expirationTime) >
- GNUNET_get_time_int32 (NULL) + MAX_HELLO_EXPIRES)
+ GNUNET_get_time_int32 (NULL) + GNUNET_MAX_HELLO_EXPIRES)
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_
("HELLO message has expiration too far in the future.
Dropping.\n"));
- GE_BREAK_OP (ectx, 0);
+ GNUNET_GE_BREAK_OP (ectx, 0);
return GNUNET_SYSERR;
}
if (GNUNET_SYSERR == transport->verifyhello (msg))
{
#if DEBUG_ADVERTISING
IF_GELOG (ectx,
- GE_INFO | GE_BULK | GE_USER,
+ GNUNET_GE_INFO | GNUNET_GE_BULK | GNUNET_GE_USER,
GNUNET_hash_to_enc (&msg->senderIdentity.hashPubKey, &enc));
- GE_LOG (ectx,
- GE_DEBUG | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_USER,
"Transport verification of HELLO message from `%s' failed
(%u).\n",
&enc, ntohs (msg->protocol));
#endif
@@ -223,14 +223,14 @@
stats->change (stat_hello_in, 1);
#if DEBUG_ADVERTISING
IF_GELOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&msg->senderIdentity.hashPubKey, &enc));
- GE_LOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"HELLO advertisement from `%s' for protocol %d received.\n",
&enc, ntohs (msg->protocol));
#endif
- if (ntohs (msg->protocol) == NAT_PROTOCOL_NUMBER)
+ if (ntohs (msg->protocol) == GNUNET_TRANSPORT_PROTOCOL_NUMBER_NAT)
{
/* We *can* not verify NAT. Ever. So all we
can do is just accept it. The best thing
@@ -247,10 +247,10 @@
stats->change (stat_hello_nat_in, 1);
#if DEBUG_ADVERTISING
IF_GELOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&msg->senderIdentity.hashPubKey, &enc));
- GE_LOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"HELLO advertisement from `%s' for NAT, no verification
required.\n",
&enc);
#endif
@@ -280,25 +280,25 @@
GNUNET_free (copy);
#if DEBUG_ADVERTISING
IF_GELOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&msg->senderIdentity.hashPubKey,
&enc));
- GE_LOG (ectx, GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_INFO | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"HELLO advertisement from `%s' for protocol %d updates old
advertisement, no verification required.\n",
&enc, ntohs (msg->protocol));
#endif
return GNUNET_OK;
}
#if DEBUG_ADVERTISING
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"HELLO advertisement differs from prior knowledge,"
" requireing ping-pong confirmation.\n");
#endif
GNUNET_free (copy);
}
- if (GNUNET_YES == GC_get_configuration_value_yesno (coreAPI->cfg,
+ if (GNUNET_YES == GNUNET_GC_get_configuration_value_yesno (coreAPI->cfg,
"GNUNETD",
"PRIVATE-NETWORK",
GNUNET_NO))
@@ -318,8 +318,8 @@
a couple of lines above would need some minor
editing :-). */
#if DEBUG_ADVERTISING
- GE_LOG (ectx,
- GE_INFO | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_BULK | GNUNET_GE_USER,
"Private network, discarding unknown advertisements\n");
#endif
return GNUNET_SYSERR;
@@ -347,8 +347,8 @@
we don't want to follow that up with massive
hello-ing by ourselves. */
#if DEBUG_ADVERTISING
- GE_LOG (ectx,
- GE_INFO | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_BULK | GNUNET_GE_USER,
"Not enough resources to verify HELLO message at this time (%u *
%u < %u * 10)\n",
(unsigned int) ((now - lasthelloMsg) / GNUNET_CRON_SECONDS),
(unsigned int) GNUNET_network_monitor_get_limit (coreAPI->
@@ -371,10 +371,10 @@
stats->change (stat_hello_no_transport, 1);
#if DEBUG_ADVERTISING
IF_GELOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&msg->senderIdentity.hashPubKey, &enc));
- GE_LOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Failed to connect to `%s'. Verification failed.\n", &enc);
#endif
return GNUNET_SYSERR; /* could not connect */
@@ -389,8 +389,8 @@
}
else
{
- GE_ASSERT (ectx, mtu > P2P_MESSAGE_OVERHEAD);
- mtu -= P2P_MESSAGE_OVERHEAD;
+ GNUNET_GE_ASSERT (ectx, mtu > GNUNET_P2P_MESSAGNUNET_GE_OVERHEAD);
+ mtu -= GNUNET_P2P_MESSAGNUNET_GE_OVERHEAD;
}
copy = GNUNET_malloc (GNUNET_sizeof_hello (msg));
memcpy (copy, msg, GNUNET_sizeof_hello (msg));
@@ -399,8 +399,8 @@
if (ping == NULL)
{
res = GNUNET_SYSERR;
- GE_LOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("Could not send HELLO+PING, ping buffer full.\n"));
transport->disconnect (tsession, __FILE__);
if (stats != NULL)
@@ -412,7 +412,7 @@
{
helloEnd = transport->getAdvertisedhellos (mtu - ntohs (ping->size),
buffer);
- GE_ASSERT (ectx, mtu - ntohs (ping->size) >= helloEnd);
+ GNUNET_GE_ASSERT (ectx, mtu - ntohs (ping->size) >= helloEnd);
}
else
{
@@ -420,8 +420,8 @@
}
if (helloEnd <= 0)
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_
("Failed to create an advertisement for this peer. Will not send
PING.\n"));
GNUNET_free (buffer);
@@ -430,10 +430,10 @@
transport->disconnect (tsession, __FILE__);
#if DEBUG_ADVERTISING
IF_GELOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&msg->senderIdentity.hashPubKey, &enc));
- GE_LOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Failed to connect advertisement for myself. Verification
failed.\n",
&enc);
#endif
@@ -453,10 +453,10 @@
stats->change (stat_hello_send_error, 1);
#if DEBUG_ADVERTISING
IF_GELOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&msg->senderIdentity.hashPubKey, &enc));
- GE_LOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Failed to transmit advertisement for myself. Verification
failed.\n",
&enc);
#endif
@@ -487,7 +487,7 @@
{
SendData *sd = cls;
GNUNET_MessageHello *hello;
- TSession *tsession;
+ GNUNET_TSession *tsession;
int prio;
#if DEBUG_ADVERTISING
GNUNET_EncName other;
@@ -495,7 +495,7 @@
if (confirmed == GNUNET_NO)
return GNUNET_OK;
- if (proto == NAT_PROTOCOL_NUMBER)
+ if (proto == GNUNET_TRANSPORT_PROTOCOL_NUMBER_NAT)
{
sd->n--;
return GNUNET_OK; /* don't advertise NAT addresses via broadcast
*/
@@ -505,17 +505,17 @@
return GNUNET_OK;
#if DEBUG_ADVERTISING
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&hi->hashPubKey, &other));
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Entering `%s' with target `%s'.\n", __FUNCTION__, &other);
#endif
if (0 == memcmp (hi, coreAPI->myIdentity, sizeof (GNUNET_PeerIdentity)))
return GNUNET_OK; /* never advertise to myself... */
prio = (int) getConnectPriority ();
- if (prio >= EXTREME_PRIORITY)
- prio = EXTREME_PRIORITY / 4;
+ if (prio >= GNUNET_EXTREME_PRIORITY)
+ prio = GNUNET_EXTREME_PRIORITY / 4;
if (GNUNET_OK == coreAPI->queryPeerStatus (hi, NULL, NULL))
{
coreAPI->unicast (hi, &sd->m->header, prio, HELLO_BROADCAST_FREQUENCY);
@@ -537,7 +537,7 @@
if (NULL == hello)
{
#if DEBUG_ADVERTISING
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"Exit from `%s' (error: `%s' failed).\n",
__FUNCTION__, "identity2Hello");
#endif
@@ -548,8 +548,8 @@
if (tsession == NULL)
{
#if DEBUG_ADVERTISING
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Exit from `%s' (%s error).\n",
__FUNCTION__, "transportConnect");
#endif
@@ -562,8 +562,8 @@
GNUNET_sizeof_hello (sd->m));
transport->disconnect (tsession, __FILE__);
#if DEBUG_ADVERTISING
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER, "Exit from %s.\n", __FUNCTION__);
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, "Exit from
%s.\n", __FUNCTION__);
#endif
return GNUNET_OK;
}
@@ -591,8 +591,8 @@
if (sd.m == NULL)
return;
#if DEBUG_ADVERTISING
- GE_LOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("Advertising my transport %d to selected peers.\n"),
tapi->protocolNumber);
#endif
@@ -600,8 +600,8 @@
if (sd.n < 1)
{
if (identity->forEachHost (0, NULL, NULL) == 0)
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Announcing ourselves pointless: "
"no other peers are known to us so far.\n"));
GNUNET_free (sd.m);
@@ -675,7 +675,7 @@
return GNUNET_SYSERR; /* network load too high... */
if (confirmed == GNUNET_NO)
return GNUNET_OK;
- if (protocol == NAT_PROTOCOL_NUMBER)
+ if (protocol == GNUNET_TRANSPORT_PROTOCOL_NUMBER_NAT)
return GNUNET_OK; /* don't forward NAT addresses */
hello = identity->identity2Hello (peer, protocol, GNUNET_NO);
if (NULL == hello)
@@ -688,10 +688,10 @@
GNUNET_EncName enc;
/* remove hellos that expired */
IF_GELOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&peer->hashPubKey, &enc));
- GE_LOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Removing HELLO from peer `%s' (expired %ds ago).\n",
&enc, now - ntohl (hello->expirationTime));
#endif
@@ -760,7 +760,7 @@
*/
static int
phelloHandler (const GNUNET_PeerIdentity * sender,
- const GNUNET_MessageHeader * message, TSession * session)
+ const GNUNET_MessageHeader * message, GNUNET_TSession * session)
{
receivedhello (sender, message);
return GNUNET_OK;
@@ -773,15 +773,15 @@
*/
static int
configurationUpdateCallback (void *ctx,
- struct GC_Configuration *cfg,
- struct GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
const char *section, const char *option)
{
if (0 != strcmp (section, "NETWORK"))
return 0;
if (ACJ_ANNOUNCE == (activeCronJobs & ACJ_ANNOUNCE))
{
- if (GNUNET_YES == GC_get_configuration_value_yesno (cfg,
+ if (GNUNET_YES == GNUNET_GC_get_configuration_value_yesno (cfg,
"NETWORK",
"DISABLE-ADVERTISEMENTS",
GNUNET_NO))
@@ -792,7 +792,7 @@
}
else
{
- if (GNUNET_YES != GC_get_configuration_value_yesno (cfg,
+ if (GNUNET_YES != GNUNET_GC_get_configuration_value_yesno (cfg,
"NETWORK",
"DISABLE-ADVERTISEMENTS",
GNUNET_NO))
@@ -804,7 +804,7 @@
}
if (ACJ_FORWARD == (activeCronJobs & ACJ_FORWARD))
{
- if (GNUNET_YES != GC_get_configuration_value_yesno (cfg,
+ if (GNUNET_YES != GNUNET_GC_get_configuration_value_yesno (cfg,
"NETWORK",
"HELLOEXCHANGE",
GNUNET_YES))
@@ -815,7 +815,7 @@
}
else
{
- if (GNUNET_YES == GC_get_configuration_value_yesno (cfg,
+ if (GNUNET_YES == GNUNET_GC_get_configuration_value_yesno (cfg,
"NETWORK",
"HELLOEXCHANGE",
GNUNET_YES))
@@ -834,20 +834,20 @@
* Start advertising.
*/
int
-initialize_module_advertising (CoreAPIForApplication * capi)
+initialize_module_advertising (GNUNET_CoreAPIForPlugins * capi)
{
coreAPI = capi;
ectx = capi->ectx;
identity = capi->requestService ("identity");
if (identity == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
transport = capi->requestService ("transport");
if (transport == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
capi->releaseService (identity);
identity = NULL;
return GNUNET_SYSERR;
@@ -855,7 +855,7 @@
pingpong = capi->requestService ("pingpong");
if (pingpong == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
capi->releaseService (identity);
identity = NULL;
capi->releaseService (transport);
@@ -865,7 +865,7 @@
topology = capi->requestService ("topology");
if (topology == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
capi->releaseService (identity);
identity = NULL;
capi->releaseService (transport);
@@ -916,19 +916,19 @@
stats->create (gettext_noop ("# plaintext PING messages sent"));
}
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("`%s' registering handler %d (plaintext and ciphertext)\n"),
- "advertising", p2p_PROTO_hello);
+ "advertising", GNUNET_P2P_PROTO_HELLO);
- capi->registerHandler (p2p_PROTO_hello, &ehelloHandler);
- capi->registerPlaintextHandler (p2p_PROTO_hello, &phelloHandler);
- if (0 != GC_attach_change_listener (capi->cfg,
+ capi->registerHandler (GNUNET_P2P_PROTO_HELLO, &ehelloHandler);
+ capi->registerPlaintextHandler (GNUNET_P2P_PROTO_HELLO, &phelloHandler);
+ if (0 != GNUNET_GC_attach_change_listener (capi->cfg,
&configurationUpdateCallback, NULL))
- GE_BREAK (capi->ectx, 0);
+ GNUNET_GE_BREAK (capi->ectx, 0);
startBootstrap (capi);
- GE_ASSERT (capi->ectx,
- 0 == GC_set_configuration_value_string (capi->cfg,
+ GNUNET_GE_ASSERT (capi->ectx,
+ 0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
capi->ectx,
"ABOUT",
"advertising",
@@ -945,7 +945,7 @@
done_module_advertising ()
{
stopBootstrap ();
- GC_detach_change_listener (coreAPI->cfg,
+ GNUNET_GC_detach_change_listener (coreAPI->cfg,
&configurationUpdateCallback, NULL);
if (ACJ_ANNOUNCE == (activeCronJobs & ACJ_ANNOUNCE))
{
@@ -958,8 +958,8 @@
GNUNET_cron_del_job (coreAPI->cron, &forwardhello,
HELLO_FORWARD_FREQUENCY, NULL); /* seven minutes: exchange */
activeCronJobs -= ACJ_FORWARD;
}
- coreAPI->unregisterHandler (p2p_PROTO_hello, &ehelloHandler);
- coreAPI->unregisterPlaintextHandler (p2p_PROTO_hello, &phelloHandler);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_HELLO, &ehelloHandler);
+ coreAPI->unregisterPlaintextHandler (GNUNET_P2P_PROTO_HELLO, &phelloHandler);
coreAPI->releaseService (transport);
transport = NULL;
coreAPI->releaseService (identity);
Modified: GNUnet/src/applications/advertising/advertising_test.c
===================================================================
--- GNUnet/src/applications/advertising/advertising_test.c 2007-11-25
03:50:33 UTC (rev 5754)
+++ GNUnet/src/applications/advertising/advertising_test.c 2007-11-25
12:04:45 UTC (rev 5755)
@@ -63,8 +63,8 @@
{
struct GNUNET_TESTING_DaemonContext *peers;
int ret = 0;
- struct GE_Context *ectx;
- struct GC_Configuration *cfg;
+ struct GNUNET_GE_Context *ectx;
+ struct GNUNET_GC_Configuration *cfg;
struct GNUNET_ClientServerConnection *sock;
int i;
int k;
@@ -74,10 +74,10 @@
int min;
ectx = NULL;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
peers =
@@ -87,7 +87,7 @@
NUM_PEERS);
if (peers == NULL)
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
/* do circular connect */
@@ -102,7 +102,7 @@
fprintf (stderr,
"Failed to connect peers %d and %d!\n",
i, (i + 1) % NUM_PEERS);
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
}
@@ -118,10 +118,10 @@
for (i = 0; i < NUM_PEERS; i++)
{
GNUNET_snprintf (buf, 128, "localhost:%u", 2087 + i * 10);
- GC_set_configuration_value_string (cfg,
+ GNUNET_GC_set_configuration_value_string (cfg,
ectx, "NETWORK", "HOST", buf);
sock = GNUNET_client_connection_create (NULL, cfg);
- STATS_getStatistics (NULL, sock, &countConnections, &have);
+ GNUNET_STATS_get_statistics (NULL, sock, &countConnections, &have);
GNUNET_client_connection_destroy (sock);
found += have;
if (have < min)
@@ -134,7 +134,7 @@
GNUNET_thread_sleep (45 * GNUNET_CRON_SECONDS); /* one hello-forward
round is 45s! */
}
GNUNET_TESTING_stop_daemons (peers);
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return ret;
}
Modified: GNUnet/src/applications/advertising/bootstrap.c
===================================================================
--- GNUnet/src/applications/advertising/bootstrap.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/advertising/bootstrap.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -35,11 +35,11 @@
#define hello_HELPER_TABLE_START_SIZE 64
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
-static Bootstrap_ServiceAPI *bootstrap;
+static GNUNET_Bootstrap_ServiceAPI *bootstrap;
-static State_ServiceAPI *state;
+static GNUNET_State_ServiceAPI *state;
static struct GNUNET_ThreadHandle *pt;
@@ -69,7 +69,7 @@
if (NULL == hcq)
{
- GE_BREAK (coreAPI->ectx, 0);
+ GNUNET_GE_BREAK (coreAPI->ectx, 0);
return;
}
while ((!hcq->do_shutdown) && (hcq->hellosCount > 0))
@@ -78,8 +78,8 @@
rndidx =
GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, hcq->hellosCount);
#if DEBUG_BOOTSTRAP
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"%s chose hello %d of %d\n",
__FUNCTION__, rndidx, hcq->hellosCount);
#endif
@@ -205,7 +205,7 @@
if (GNUNET_YES == hlc.do_shutdown)
break;
#if DEBUG_BOOTSTRAP
- GE_LOG (coreAPI->ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"Starting bootstrap.\n");
#endif
hlc.hellosLen = 0;
@@ -223,16 +223,16 @@
* advertisements if needed.
*/
void
-startBootstrap (CoreAPIForApplication * capi)
+startBootstrap (GNUNET_CoreAPIForPlugins * capi)
{
coreAPI = capi;
state = capi->requestService ("state");
- GE_ASSERT (capi->ectx, state != NULL);
+ GNUNET_GE_ASSERT (capi->ectx, state != NULL);
bootstrap = capi->requestService ("bootstrap");
- GE_ASSERT (capi->ectx, bootstrap != NULL);
+ GNUNET_GE_ASSERT (capi->ectx, bootstrap != NULL);
hlc.do_shutdown = GNUNET_NO;
pt = GNUNET_thread_create (&processThread, NULL, 64 * 1024);
- GE_ASSERT (capi->ectx, pt != NULL);
+ GNUNET_GE_ASSERT (capi->ectx, pt != NULL);
}
/**
Modified: GNUnet/src/applications/advertising/bootstrap.h
===================================================================
--- GNUnet/src/applications/advertising/bootstrap.h 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/advertising/bootstrap.h 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -34,7 +34,7 @@
* Start using the bootstrap service to obtain
* advertisements if needed.
*/
-void startBootstrap (CoreAPIForApplication * capi);
+void startBootstrap (GNUNET_CoreAPIForPlugins * capi);
/**
* Stop the bootstap service.
Modified: GNUnet/src/applications/bootstrap_http/http.c
===================================================================
--- GNUnet/src/applications/bootstrap_http/http.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/bootstrap_http/http.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -36,22 +36,22 @@
/**
* Stats service (maybe NULL!)
*/
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
static int stat_hellodownloaded;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
typedef struct
{
- bootstrap_hello_callback callback;
+ GNUNET_BootstrapHelloCallback callback;
void *arg;
- bootstrap_terminate_callback termTest;
+ GNUNET_BootstrapTerminateCallback termTest;
void *targ;
@@ -100,12 +100,12 @@
hs = ntohs (hello->header.size);
if (bctx->bsize < hs)
break; /* incomplete */
- if ((ntohs (hello->header.type) != p2p_PROTO_hello) ||
+ if ((ntohs (hello->header.type) != GNUNET_P2P_PROTO_HELLO) ||
(ntohs (hello->header.size) != GNUNET_sizeof_hello (hello)) ||
(GNUNET_sizeof_hello (hello) >= GNUNET_MAX_BUFFER_SIZE))
{
- GE_LOG (ectx,
- GE_WARNING | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
_("Bootstrap data obtained from `%s' is invalid.\n"),
bctx->url);
return 0; /* Error: invalid format! */
@@ -119,13 +119,13 @@
return size * nmemb;
}
-#define CURL_EASY_SETOPT(c, a, b) do { ret = curl_easy_setopt(c, a, b); if
(ret != CURLE_OK) GE_LOG(ectx, GE_WARNING | GE_USER | GE_BULK, _("%s failed at
%s:%d: `%s'\n"), "curl_easy_setopt", __FILE__, __LINE__,
curl_easy_strerror(ret)); } while (0);
+#define CURL_EASY_SETOPT(c, a, b) do { ret = curl_easy_setopt(c, a, b); if
(ret != CURLE_OK) GNUNET_GE_LOG(ectx, GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK, _("%s failed at %s:%d: `%s'\n"), "curl_easy_setopt", __FILE__,
__LINE__, curl_easy_strerror(ret)); } while (0);
static void
-downloadHostlist (bootstrap_hello_callback callback,
+downloadHostlist (GNUNET_BootstrapHelloCallback callback,
void *arg,
- bootstrap_terminate_callback termTest, void *targ)
+ GNUNET_BootstrapTerminateCallback termTest, void *targ)
{
BootstrapContext bctx;
char *url;
@@ -148,7 +148,7 @@
if (0 != curl_global_init (CURL_GLOBAL_WIN32))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return;
}
bctx.callback = callback;
@@ -163,16 +163,16 @@
#endif
if (curl == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return;
}
url = NULL;
- if (0 != GC_get_configuration_value_string (coreAPI->cfg,
+ if (0 != GNUNET_GC_get_configuration_value_string (coreAPI->cfg,
"GNUNETD",
"HOSTLISTURL", "", &url))
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_
("No hostlist URL specified in configuration, will not
bootstrap.\n"));
GNUNET_free (url);
@@ -213,12 +213,12 @@
}
pos--;
}
- GE_LOG (ectx,
- GE_INFO | GE_BULK | GE_USER, _("Bootstrapping using `%s'.\n"), url);
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_BULK | GNUNET_GE_USER, _("Bootstrapping
using `%s'.\n"), url);
bctx.url = url;
bctx.total = 0;
proxy = NULL;
- GC_get_configuration_value_string (coreAPI->cfg,
+ GNUNET_GC_get_configuration_value_string (coreAPI->cfg,
"GNUNETD", "HTTP-PROXY", "", &proxy);
CURL_EASY_SETOPT (curl, CURLOPT_WRITEFUNCTION, &downloadHostlistHelper);
CURL_EASY_SETOPT (curl, CURLOPT_WRITEDATA, &bctx);
@@ -226,8 +226,8 @@
goto cleanup;
CURL_EASY_SETOPT (curl, CURLOPT_FAILONERROR, 1);
CURL_EASY_SETOPT (curl, CURLOPT_URL, &url[pos]);
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Trying to download hostlist from `%s'\n"), &url[pos]);
if (strlen (proxy) > 0)
CURL_EASY_SETOPT (curl, CURLOPT_PROXY, proxy);
@@ -243,14 +243,14 @@
multi = curl_multi_init ();
if (multi == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
goto cleanup;
}
mret = curl_multi_add_handle (multi, curl);
if (mret != CURLM_OK)
{
- GE_LOG (ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
_("%s failed at %s:%d: `%s'\n"),
"curl_multi_add_handle",
__FILE__, __LINE__, curl_multi_strerror (mret));
@@ -266,8 +266,8 @@
mret = curl_multi_fdset (multi, &rs, &ws, &es, &max);
if (mret != CURLM_OK)
{
- GE_LOG (ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
_("%s failed at %s:%d: `%s'\n"),
"curl_multi_fdset",
__FILE__, __LINE__, curl_multi_strerror (mret));
@@ -290,15 +290,15 @@
do
{
msg = curl_multi_info_read (multi, &running);
- GE_BREAK (ectx, msg != NULL);
+ GNUNET_GE_BREAK (ectx, msg != NULL);
if (msg == NULL)
break;
switch (msg->msg)
{
case CURLMSG_DONE:
if (msg->data.result != CURLE_OK)
- GE_LOG (ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_USER | GNUNET_GE_BULK,
_("%s failed at %s:%d: `%s'\n"),
"curl_multi_perform",
__FILE__,
@@ -317,8 +317,8 @@
&& (GNUNET_YES == termTest (targ)));
if ((mret != CURLM_OK) && (mret != CURLM_CALL_MULTI_PERFORM))
{
- GE_LOG (ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
_("%s failed at %s:%d: `%s'\n"),
"curl_multi_perform",
__FILE__, __LINE__, curl_multi_strerror (mret));
@@ -330,8 +330,8 @@
mret = curl_multi_remove_handle (multi, curl);
if (mret != CURLM_OK)
{
- GE_LOG (ectx,
- GE_ERROR | GE_ADMIN | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK,
_("%s failed at %s:%d: `%s'\n"),
"curl_multi_remove_handle",
__FILE__, __LINE__, curl_multi_strerror (mret));
@@ -340,8 +340,8 @@
#else
ret = curl_easy_perform (curl);
if (ret != CURLE_OK)
- GE_LOG (ectx,
- GE_ERROR | GE_ADMIN | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK,
_("%s failed at %s:%d: `%s'\n"),
"curl_easy_perform",
__FILE__, __LINE__, curl_easy_strerror (ret));
@@ -350,21 +350,21 @@
#if USE_MULTI
mret = curl_multi_cleanup (multi);
if (mret != CURLM_OK)
- GE_LOG (ectx,
- GE_ERROR | GE_ADMIN | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK,
_("%s failed at %s:%d: `%s'\n"),
"curl_multi_cleanup",
__FILE__, __LINE__, curl_multi_strerror (mret));
#endif
- GE_LOG (ectx,
- GE_INFO | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Downloaded %llu bytes from `%s'.\n"), bctx.total, url);
GNUNET_free (url);
GNUNET_free (proxy);
curl_global_cleanup ();
return;
cleanup:
- GE_BREAK (ectx, ret != CURLE_OK);
+ GNUNET_GE_BREAK (ectx, ret != CURLE_OK);
#if USE_MULTI
if (multi != NULL)
curl_multi_remove_handle (multi, curl);
@@ -380,10 +380,10 @@
}
-Bootstrap_ServiceAPI *
-provide_module_bootstrap (CoreAPIForApplication * capi)
+GNUNET_Bootstrap_ServiceAPI *
+provide_module_bootstrap (GNUNET_CoreAPIForPlugins * capi)
{
- static Bootstrap_ServiceAPI api;
+ static GNUNET_Bootstrap_ServiceAPI api;
coreAPI = capi;
ectx = capi->ectx;
Modified: GNUnet/src/applications/bootstrap_http/httptest.c
===================================================================
--- GNUnet/src/applications/bootstrap_http/httptest.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/bootstrap_http/httptest.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -34,7 +34,7 @@
void release_module_bootstrap ();
-Bootstrap_ServiceAPI *provide_module_bootstrap (CoreAPIForApplication * capi);
+GNUNET_Bootstrap_ServiceAPI *provide_module_bootstrap
(GNUNET_CoreAPIForPlugins * capi);
static void *
rs (const char *name)
@@ -68,7 +68,7 @@
static void *
pt (void *b)
{
- Bootstrap_ServiceAPI *boot = b;
+ GNUNET_Bootstrap_ServiceAPI *boot = b;
boot->bootstrap (&hello, NULL, &terminate, NULL);
return NULL;
@@ -77,23 +77,23 @@
int
main (int argc, char **argv)
{
- static CoreAPIForApplication capi;
- struct GC_Configuration *cfg;
+ static GNUNET_CoreAPIForPlugins capi;
+ struct GNUNET_GC_Configuration *cfg;
struct GNUNET_PluginHandle *plugin;
- Bootstrap_ServiceAPI *boot;
+ GNUNET_Bootstrap_ServiceAPI *boot;
struct GNUNET_ThreadHandle *p;
void *unused;
- ServiceInitMethod init;
- ServiceDoneMethod done;
+ GNUNET_ServicePluginInitializationMethod init;
+ GNUNET_ServicePluginShutdownMethod done;
count = 0;
- cfg = GC_create ();
- GC_set_configuration_value_string (cfg,
+ cfg = GNUNET_GC_create ();
+ GNUNET_GC_set_configuration_value_string (cfg,
NULL,
"GNUNETD",
"HOSTLISTURL",
"http://gnunet.org/hostlist");
- memset (&capi, 0, sizeof (CoreAPIForApplication));
+ memset (&capi, 0, sizeof (GNUNET_CoreAPIForPlugins));
capi.cfg = cfg;
capi.requestService = &rs;
capi.releaseService = &rsx;
@@ -107,7 +107,7 @@
GNUNET_plugin_resolve_function (plugin, "release_module_", GNUNET_YES);
done ();
GNUNET_plugin_unload (plugin);
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
if (count == 0)
return 1;
return 0;
Modified: GNUnet/src/applications/chat/chat.c
===================================================================
--- GNUnet/src/applications/chat/chat.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/applications/chat/chat.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -30,12 +30,12 @@
#include "gnunet_protocols.h"
#include "chat.h"
-static CoreAPIForApplication *coreAPI = NULL;
+static GNUNET_CoreAPIForPlugins *coreAPI = NULL;
#define MAX_LAST_MESSAGES 12
#define MAX_CLIENTS 4
-static ClientHandle clients[MAX_CLIENTS];
+static GNUNET_ClientHandle clients[MAX_CLIENTS];
static int clientCount;
static GNUNET_HashCode lastMsgs[MAX_LAST_MESSAGES];
static int ringIndex;
@@ -70,7 +70,7 @@
bcc.message = message;
bcc.prio = prio;
bcc.delay = delay;
- coreAPI->forAllConnectedNodes ((PerNodeCallback) bccHelper, &bcc);
+ coreAPI->forAllConnectedNodes ((GNUNET_NodeIteratorCallback) bccHelper,
&bcc);
}
static int
@@ -85,7 +85,7 @@
if (ntohs (message->size) != sizeof (P2P_chat_MESSAGE))
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Message received from peer is invalid.\n"));
return GNUNET_SYSERR;
}
@@ -105,13 +105,13 @@
and broadcast to all peers */
markSeen (&hc);
broadcastToConnected (message, 5, 1);
- cmsg->header.type = htons (CS_PROTO_chat_MSG);
+ cmsg->header.type = htons (GNUNET_CS_PROTO_CHAT_MSG);
for (j = 0; j < clientCount; j++)
coreAPI->sendToClient (clients[j], &cmsg->header);
pmsg->nick[CHAT_NICK_LENGTH - 1] = '\0';
pmsg->message[CHAT_MSG_LENGTH - 1] = '\0';
/*
- GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG(ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
" CHAT: received new message from %s: %s\n",
&pmsg->nick[0],
&pmsg->message[0]);
@@ -122,7 +122,7 @@
}
static int
-csHandleChatRequest (ClientHandle client, const CS_MESSAGE_HEADER * message)
+csHandleChatRequest (GNUNET_ClientHandle client, const
CS_MESSAGNUNET_GE_HEADER * message)
{
int i;
int j;
@@ -132,7 +132,7 @@
if (ntohs (message->size) != sizeof (CS_chat_MESSAGE))
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Message received from client is invalid\n"));
return GNUNET_SYSERR; /* invalid message */
}
@@ -152,32 +152,32 @@
if (j == -1)
{
if (clientCount == MAX_CLIENTS)
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("Maximum number of chat clients reached.\n"));
else
{
clients[clientCount++] = client;
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
_("Now %d of %d chat clients at this node.\n"),
clientCount, MAX_CLIENTS);
}
}
/* forward to all other nodes in the network */
- pmsg->header.type = htons (P2P_PROTO_chat_MSG);
+ pmsg->header.type = htons (GNUNET_P2P_PROTO_CHAT_MSG);
broadcastToConnected (&pmsg->header, 5, 1);
GNUNET_mutex_unlock (&chatMutex);
return GNUNET_OK;
}
static void
-chatClientExitHandler (ClientHandle client)
+chatClientExitHandler (GNUNET_ClientHandle client)
{
int i;
GNUNET_mutex_lock (&chatMutex);
for (i = 0; i < clientCount; i++)
if (clients[i] == client)
{
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"Chat client exits.\n");
clients[i] = clients[--clientCount];
break;
@@ -191,30 +191,30 @@
* @return GNUNET_SYSERR on errors
*/
int
-initialize_module_chat (CoreAPIForApplication * capi)
+initialize_module_chat (GNUNET_CoreAPIForPlugins * capi)
{
int ok = GNUNET_OK;
- GE_ASSERT (ectx, sizeof (P2P_chat_MESSAGE) == sizeof (CS_chat_MESSAGE));
+ GNUNET_GE_ASSERT (ectx, sizeof (P2P_chat_MESSAGE) == sizeof
(CS_chat_MESSAGE));
GNUNET_mutex_create (&chatMutex);
clientCount = 0;
coreAPI = capi;
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("`%s' registering handlers %d and %d\n"),
- "chat", P2P_PROTO_chat_MSG, CS_PROTO_chat_MSG);
+ "chat", GNUNET_P2P_PROTO_CHAT_MSG, GNUNET_CS_PROTO_CHAT_MSG);
if (GNUNET_SYSERR ==
- capi->registerHandler (P2P_PROTO_chat_MSG, &handleChatMSG))
+ capi->registerHandler (GNUNET_P2P_PROTO_CHAT_MSG, &handleChatMSG))
ok = GNUNET_SYSERR;
if (GNUNET_SYSERR ==
capi->registerClientExitHandler (&chatClientExitHandler))
ok = GNUNET_SYSERR;
- if (GNUNET_SYSERR == capi->registerClientHandler (CS_PROTO_chat_MSG,
+ if (GNUNET_SYSERR == capi->registerClientHandler (GNUNET_CS_PROTO_CHAT_MSG,
&csHandleChatRequest))
ok = GNUNET_SYSERR;
- GE_ASSERT (capi->ectx,
- 0 == GC_set_configuration_value_string (capi->cfg,
+ GNUNET_GE_ASSERT (capi->ectx,
+ 0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
capi->ectx,
"ABOUT",
"chat",
@@ -226,9 +226,9 @@
void
done_module_chat ()
{
- coreAPI->unregisterHandler (P2P_PROTO_chat_MSG, &handleChatMSG);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_CHAT_MSG, &handleChatMSG);
coreAPI->unregisterClientExitHandler (&chatClientExitHandler);
- coreAPI->unregisterClientHandler (CS_PROTO_chat_MSG, &csHandleChatRequest);
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_CHAT_MSG,
&csHandleChatRequest);
GNUNET_mutex_destroy (&chatMutex);
coreAPI = NULL;
}
Modified: GNUnet/src/applications/chat/chat.h
===================================================================
--- GNUnet/src/applications/chat/chat.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/applications/chat/chat.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -39,7 +39,7 @@
typedef struct
{
- CS_MESSAGE_HEADER header;
+ CS_MESSAGNUNET_GE_HEADER header;
char nick[CHAT_NICK_LENGTH];
char message[CHAT_MSG_LENGTH];
} CS_chat_MESSAGE;
Modified: GNUnet/src/applications/chat/clientapi.c
===================================================================
--- GNUnet/src/applications/chat/clientapi.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/chat/clientapi.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -39,9 +39,9 @@
struct GNUNET_ThreadHandle *listen_thread;
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
char *nickname;
@@ -69,8 +69,8 @@
* @return number of rooms on success, GNUNET_SYSERR if iterator aborted
*/
int
-GNUNET_CHAT_list_rooms (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+GNUNET_CHAT_list_rooms (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
GNUNET_CHAT_RoomIterator it, void *cls)
{
return GNUNET_SYSERR;
@@ -87,8 +87,8 @@
* @return NULL on error
*/
struct GNUNET_CHAT_Room *
-GNUNET_CHAT_join_room (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+GNUNET_CHAT_join_room (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *nickname,
const GNUNET_RSA_PublicKey * me,
const struct GNUNET_RSA_PrivateKey *key,
Modified: GNUnet/src/applications/chat/gnunet-chat.c
===================================================================
--- GNUnet/src/applications/chat/gnunet-chat.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/chat/gnunet-chat.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -28,11 +28,11 @@
#include "gnunet_protocols.h"
#include "gnunet_chat_lib.h"
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static char *cfgFilename = DEFAULT_CLIENT_CONFIG_FILE;
+static char *cfgFilename = GNUNET_DEFAULT_CLIENT_CONFIG_FILE;
static char *nickname;
@@ -51,7 +51,7 @@
{'r', "room", "NAME",
gettext_noop ("set the chat room to join (requred)"),
1, &GNUNET_getopt_configure_set_string, &roomname},
- COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
+ COMMAND_LINE_OPTION_VERSION (PACKAGNUNET_GE_VERSION), /* -v */
GNUNET_COMMAND_LINE_OPTION_VERBOSE,
GNUNET_COMMAND_LINE_OPTION_END,
};
Modified: GNUnet/src/applications/datastore/datastore.c
===================================================================
--- GNUnet/src/applications/datastore/datastore.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/datastore/datastore.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -43,12 +43,12 @@
/**
* SQ-store handle
*/
-static SQstore_ServiceAPI *sq;
+static GNUNET_SQstore_ServiceAPI *sq;
/**
* Core API handle.
*/
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
/**
* Minimum priority in the DB.
@@ -67,7 +67,7 @@
static struct GNUNET_CronManager *cron;
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
static int stat_filtered;
@@ -106,7 +106,7 @@
static int
get (const GNUNET_HashCode * query,
- unsigned int type, Datum_Iterator iter, void *closure)
+ unsigned int type, GNUNET_DatastoreValueIterator iter, void *closure)
{
int ret;
@@ -116,9 +116,9 @@
GNUNET_EncName enc;
IF_GELOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER, GNUNET_hash_to_enc (query,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (query,
&enc));
- GE_LOG (coreAPI->ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"Datastore availability pre-test failed for `%s'.\n", &enc);
#endif
if (stats != NULL)
@@ -134,16 +134,16 @@
static int
deleteCB (const GNUNET_HashCode * key,
- const Datastore_Value * value, void *closure,
+ const GNUNET_DatastoreValue * value, void *closure,
unsigned long long uid)
{
- const Datastore_Value *have = closure;
+ const GNUNET_DatastoreValue *have = closure;
if (have == NULL)
return GNUNET_NO;
if ((value->size == have->size) &&
(0 == memcmp (&have[1],
&value[1],
- ntohl (value->size) - sizeof (Datastore_Value))))
+ ntohl (value->size) - sizeof (GNUNET_DatastoreValue))))
return GNUNET_NO;
return GNUNET_OK;
}
@@ -152,7 +152,7 @@
* Explicitly remove some content from the database.
*/
static int
-del (const GNUNET_HashCode * query, const Datastore_Value * value)
+del (const GNUNET_HashCode * query, const GNUNET_DatastoreValue * value)
{
int ok;
GNUNET_EncName enc;
@@ -160,9 +160,9 @@
if (!testAvailable (query))
{
IF_GELOG (coreAPI->ectx,
- GE_WARNING | GE_BULK | GE_USER, GNUNET_hash_to_enc (query,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
GNUNET_hash_to_enc (query,
&enc));
- GE_LOG (coreAPI->ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("Availability test failed for `%s' at %s:%d.\n"), &enc,
__FILE__, __LINE__);
return 0;
@@ -186,24 +186,24 @@
* other serious error (i.e. IO permission denied)
*/
static int
-put (const GNUNET_HashCode * key, const Datastore_Value * value)
+put (const GNUNET_HashCode * key, const GNUNET_DatastoreValue * value)
{
int ok;
- Datastore_Value *nvalue;
+ GNUNET_DatastoreValue *nvalue;
/* check if we have enough space / priority */
if (GNUNET_ntohll (value->expirationTime) < GNUNET_get_time ())
{
- GE_LOG (coreAPI->ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Received content for put already expired!\n");
return GNUNET_NO;
}
if ((available < ntohl (value->size)) &&
(minPriority > ntohl (value->prio) + comp_priority ()))
{
- GE_LOG (coreAPI->ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Datastore full (%llu/%llu) and content priority too low to kick
out other content. Refusing put.\n",
sq->getSize (), quota);
return GNUNET_NO; /* new content has such a low priority that
@@ -229,21 +229,21 @@
typedef struct
{
int exists;
- const Datastore_Value *value;
+ const GNUNET_DatastoreValue *value;
unsigned long long uid;
unsigned long long expiration;
} CE;
static int
checkExists (const GNUNET_HashCode * key,
- const Datastore_Value * value, void *cls, unsigned long long uid)
+ const GNUNET_DatastoreValue * value, void *cls, unsigned long
long uid)
{
CE *ce = cls;
if ((value->size != ce->value->size) ||
(0 != memcmp (&value[1],
&ce->value[1],
- ntohl (value->size) - sizeof (Datastore_Value))))
+ ntohl (value->size) - sizeof (GNUNET_DatastoreValue))))
return GNUNET_OK; /* found another value, but different content!
*/
ce->uid = uid;
ce->expiration = GNUNET_ntohll (value->expirationTime);
@@ -262,19 +262,19 @@
* other serious error (i.e. IO permission denied)
*/
static int
-putUpdate (const GNUNET_HashCode * key, const Datastore_Value * value)
+putUpdate (const GNUNET_HashCode * key, const GNUNET_DatastoreValue * value)
{
CE cls;
int ok;
int comp_prio;
- Datastore_Value *nvalue;
+ GNUNET_DatastoreValue *nvalue;
/* check if it already exists... */
cls.exists = GNUNET_NO;
cls.value = value;
sq->get (key, ntohl (value->type), &checkExists, &cls);
- if (ntohl (value->type) == D_BLOCK)
- sq->get (key, ONDEMAND_BLOCK, &checkExists, &cls);
+ if (ntohl (value->type) == GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA)
+ sq->get (key, GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND, &checkExists, &cls);
if (cls.exists)
{
@@ -290,8 +290,8 @@
}
comp_prio = comp_priority ();
#if DEBUG_DATASTORE
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Migration: available %llu (need %u), min priority %u have %u\n",
available, ntohl (value->size), minPriority,
ntohl (value->prio) + comp_prio);
@@ -325,7 +325,7 @@
*/
static int
freeSpaceExpired (const GNUNET_HashCode * key,
- const Datastore_Value * value, void *closure,
+ const GNUNET_DatastoreValue * value, void *closure,
unsigned long long uid)
{
if ((available > 0) && (available >= MIN_GNUNET_free))
@@ -338,7 +338,7 @@
static int
freeSpaceLow (const GNUNET_HashCode * key,
- const Datastore_Value * value, void *closure,
+ const GNUNET_DatastoreValue * value, void *closure,
unsigned long long uid)
{
if ((available > 0) && (available >= MIN_GNUNET_free))
@@ -360,9 +360,9 @@
available = quota - sq->getSize ();
if ((available < 0) || (available < MIN_GNUNET_free))
{
- sq->iterateExpirationTime (ANY_BLOCK, &freeSpaceExpired, NULL);
+ sq->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
&freeSpaceExpired, NULL);
if ((available < 0) || (available < MIN_GNUNET_free))
- sq->iterateLowPriority (ANY_BLOCK, &freeSpaceLow, NULL);
+ sq->iterateLowPriority (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
&freeSpaceLow, NULL);
}
else
{
@@ -373,24 +373,24 @@
/**
* Initialize the manager-module.
*/
-Datastore_ServiceAPI *
-provide_module_datastore (CoreAPIForApplication * capi)
+GNUNET_Datastore_ServiceAPI *
+provide_module_datastore (GNUNET_CoreAPIForPlugins * capi)
{
- static Datastore_ServiceAPI api;
+ static GNUNET_Datastore_ServiceAPI api;
unsigned long long lquota;
unsigned long long sqot;
- State_ServiceAPI *state;
+ GNUNET_State_ServiceAPI *state;
struct stat sbuf;
char *fsdir;
- if (-1 == GC_get_configuration_value_number (capi->cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_number (capi->cfg,
"FS",
"QUOTA",
0,
((unsigned long long) -1) /
1024 / 1024, 1024, &lquota))
{
- GE_BREAK (capi->ectx, 0);
+ GNUNET_GE_BREAK (capi->ectx, 0);
return NULL; /* OOPS */
}
quota = lquota * 1024 * 1024; /* MB to bytes */
@@ -416,8 +416,8 @@
}
else
{
- GE_LOG (capi->ectx,
- GE_USER | GE_ADMIN | GE_ERROR | GE_BULK,
+ GNUNET_GE_LOG (capi->ectx,
+ GNUNET_GE_USER | GNUNET_GE_ADMIN | GNUNET_GE_ERROR |
GNUNET_GE_BULK,
_("Failed to load state service. Trying to do without.\n"));
}
sq = capi->requestService ("sqstore");
@@ -428,14 +428,14 @@
capi->releaseService (stats);
stats = NULL;
}
- GE_BREAK (capi->ectx, 0);
+ GNUNET_GE_BREAK (capi->ectx, 0);
return NULL;
}
coreAPI = capi;
initPrefetch (capi->ectx, capi->cfg, sq);
if (GNUNET_OK != initFilters (capi->ectx, capi->cfg))
{
- GE_BREAK (capi->ectx, 0);
+ GNUNET_GE_BREAK (capi->ectx, 0);
donePrefetch ();
capi->releaseService (sq);
if (stats != NULL)
@@ -446,10 +446,10 @@
return NULL;
}
fsdir = NULL;
- GC_get_configuration_value_filename (capi->cfg,
+ GNUNET_GC_get_configuration_value_filename (capi->cfg,
"FS",
"DIR",
- VAR_DAEMON_DIRECTORY "/data/fs/",
+ GNUNET_DEFAULT_DAEMON_VAR_DIRECTORY
"/data/fs/",
&fsdir);
/* just in case dir does not exist ... */
GNUNET_disk_directory_create (NULL, fsdir);
@@ -503,7 +503,7 @@
*/
static int
filterAddAll (const GNUNET_HashCode * key,
- const Datastore_Value * value, void *closure,
+ const GNUNET_DatastoreValue * value, void *closure,
unsigned long long uid)
{
makeAvailable (key);
@@ -516,14 +516,14 @@
* different sqstore's here, too.
*/
void
-update_module_datastore (UpdateAPI * uapi)
+update_module_datastore (GNUNET_UpdateAPI * uapi)
{
unsigned long long quota;
unsigned long long lastQuota;
unsigned long long *lq;
- State_ServiceAPI *state;
+ GNUNET_State_ServiceAPI *state;
- if (-1 == GC_get_configuration_value_number (uapi->cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_number (uapi->cfg,
"FS",
"QUOTA",
0,
@@ -554,8 +554,8 @@
}
else
{
- GE_LOG (uapi->ectx,
- GE_USER | GE_ADMIN | GE_ERROR | GE_BULK,
+ GNUNET_GE_LOG (uapi->ectx,
+ GNUNET_GE_USER | GNUNET_GE_ADMIN | GNUNET_GE_ERROR |
GNUNET_GE_BULK,
_
("Failed to load sqstore service. Check your
configuration!\n"));
}
Modified: GNUnet/src/applications/datastore/filter.c
===================================================================
--- GNUnet/src/applications/datastore/filter.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/datastore/filter.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -36,16 +36,16 @@
static struct GNUNET_BloomFilter *filter;
static char *
-getFilterName (struct GE_Context *ectx, struct GC_Configuration *cfg)
+getFilterName (struct GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration
*cfg)
{
char *fn;
char *bf;
fn = NULL;
- if (-1 == GC_get_configuration_value_filename (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_filename (cfg,
"FS",
"DIR",
- VAR_DAEMON_DIRECTORY "/fs",
+
GNUNET_DEFAULT_DAEMON_VAR_DIRECTORY "/fs",
&fn))
return NULL;
if (GNUNET_OK != GNUNET_disk_directory_create (ectx, fn))
@@ -61,13 +61,13 @@
}
int
-initFilters (struct GE_Context *ectx, struct GC_Configuration *cfg)
+initFilters (struct GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration
*cfg)
{
char *bf;
unsigned long long quota; /* in kb */
unsigned int bf_size;
- if (-1 == GC_get_configuration_value_number (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_number (cfg,
"FS",
"QUOTA",
0,
@@ -94,11 +94,11 @@
}
void
-deleteFilter (struct GE_Context *ectx, struct GC_Configuration *cfg)
+deleteFilter (struct GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration
*cfg)
{
char *fn;
- GE_ASSERT (ectx, filter == NULL);
+ GNUNET_GE_ASSERT (ectx, filter == NULL);
fn = getFilterName (ectx, cfg);
UNLINK (fn);
GNUNET_free (fn);
Modified: GNUnet/src/applications/datastore/filter.h
===================================================================
--- GNUnet/src/applications/datastore/filter.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/datastore/filter.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -28,11 +28,11 @@
#include "gnunet_util.h"
-int initFilters (struct GE_Context *ectx, struct GC_Configuration *cfg);
+int initFilters (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg);
void doneFilters (void);
-void deleteFilter (struct GE_Context *ectx, struct GC_Configuration *cfg);
+void deleteFilter (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg);
void makeAvailable (const GNUNET_HashCode * key);
Modified: GNUnet/src/applications/datastore/prefetch.c
===================================================================
--- GNUnet/src/applications/datastore/prefetch.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/datastore/prefetch.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -33,12 +33,12 @@
static GNUNET_HashCode rkey;
-static Datastore_Value *rvalue;
+static GNUNET_DatastoreValue *rvalue;
/**
* SQ-store handle
*/
-static SQstore_ServiceAPI *sq;
+static GNUNET_SQstore_ServiceAPI *sq;
/**
* Semaphore on which the RCB acquire thread waits
@@ -58,14 +58,14 @@
static struct GNUNET_ThreadHandle *gather_thread;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static int
acquire (const GNUNET_HashCode * key,
- const Datastore_Value * value, void *closure, unsigned long long uid)
+ const GNUNET_DatastoreValue * value, void *closure, unsigned long
long uid)
{
if (doneSignal)
return GNUNET_SYSERR;
@@ -73,7 +73,7 @@
if (doneSignal)
return GNUNET_SYSERR;
GNUNET_mutex_lock (lock);
- GE_ASSERT (NULL, rvalue == NULL);
+ GNUNET_GE_ASSERT (NULL, rvalue == NULL);
rkey = *key;
rvalue = GNUNET_malloc (ntohl (value->size));
memcpy (rvalue, value, ntohl (value->size));
@@ -113,7 +113,7 @@
* @return GNUNET_SYSERR if the RCB is empty
*/
int
-getRandom (GNUNET_HashCode * key, Datastore_Value ** value)
+getRandom (GNUNET_HashCode * key, GNUNET_DatastoreValue ** value)
{
GNUNET_mutex_lock (lock);
if (rvalue == NULL)
@@ -130,8 +130,8 @@
}
void
-initPrefetch (struct GE_Context *e,
- struct GC_Configuration *c, SQstore_ServiceAPI * s)
+initPrefetch (struct GNUNET_GE_Context *e,
+ struct GNUNET_GC_Configuration *c, GNUNET_SQstore_ServiceAPI * s)
{
ectx = e;
cfg = c;
@@ -141,8 +141,8 @@
lock = GNUNET_mutex_create (GNUNET_NO);
gather_thread = GNUNET_thread_create (&rcbAcquire, NULL, 64 * 1024);
if (gather_thread == NULL)
- GE_LOG_STRERROR (ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE,
"pthread_create");
}
Modified: GNUnet/src/applications/datastore/prefetch.h
===================================================================
--- GNUnet/src/applications/datastore/prefetch.h 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/datastore/prefetch.h 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -33,8 +33,8 @@
/**
* Initialize the migration module.
*/
-void initPrefetch (struct GE_Context *ectx,
- struct GC_Configuration *cfg, SQstore_ServiceAPI * sq);
+void initPrefetch (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
GNUNET_SQstore_ServiceAPI * sq);
void donePrefetch (void);
@@ -47,7 +47,7 @@
* for any type.
* @return GNUNET_OK if a value was found, GNUNET_SYSERR if not
*/
-int getRandom (GNUNET_HashCode * key, Datastore_Value ** value);
+int getRandom (GNUNET_HashCode * key, GNUNET_DatastoreValue ** value);
/* end of prefetch.h */
Modified: GNUnet/src/applications/dht/module/cs.c
===================================================================
--- GNUnet/src/applications/dht/module/cs.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/dht/module/cs.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -38,19 +38,19 @@
/**
* Global core API.
*/
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
/**
* Reference to the DHT service API.
*/
-static DHT_ServiceAPI *dhtAPI;
+static GNUNET_DHT_ServiceAPI *dhtAPI;
typedef struct
{
- struct ClientHandle *client;
+ struct GNUNET_ClientHandle *client;
- struct DHT_GET_RECORD *get_record;
+ struct GNUNET_DHT_GetHandle *get_record;
} DHT_CLIENT_GET_RECORD;
@@ -67,22 +67,22 @@
* CS handler for inserting <key,value>-pair into DHT-table.
*/
static int
-csPut (struct ClientHandle *client, const GNUNET_MessageHeader * message)
+csPut (struct GNUNET_ClientHandle *client, const GNUNET_MessageHeader *
message)
{
const CS_dht_request_put_MESSAGE *req;
unsigned int size;
if (ntohs (message->size) < sizeof (CS_dht_request_put_MESSAGE))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
req = (const CS_dht_request_put_MESSAGE *) message;
size = ntohs (req->header.size) - sizeof (CS_dht_request_put_MESSAGE);
- GE_ASSERT (NULL, size < GNUNET_MAX_BUFFER_SIZE);
+ GNUNET_GE_ASSERT (NULL, size < GNUNET_MAX_BUFFER_SIZE);
#if DEBUG_CS
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"`%s' at %s:%d processes put '%.*s'\n",
__FUNCTION__, __FILE__, __LINE__, size, &req[1]);
#endif
@@ -92,41 +92,41 @@
}
int
-get_result (const GNUNET_HashCode * key, const DataContainer * value,
+get_result (const GNUNET_HashCode * key, const GNUNET_DataContainer * value,
void *cls)
{
DHT_CLIENT_GET_RECORD *record = cls;
CS_dht_request_put_MESSAGE *msg;
size_t n;
- GE_ASSERT (NULL, ntohl (value->size) >= sizeof (DataContainer));
+ GNUNET_GE_ASSERT (NULL, ntohl (value->size) >= sizeof
(GNUNET_DataContainer));
n =
sizeof (CS_dht_request_put_MESSAGE) + ntohl (value->size) -
- sizeof (DataContainer);
+ sizeof (GNUNET_DataContainer);
if (n > GNUNET_MAX_BUFFER_SIZE)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
msg = GNUNET_malloc (n);
msg->header.size = htons (n);
- msg->header.type = htons (CS_PROTO_dht_REQUEST_PUT);
+ msg->header.type = htons (GNUNET_CS_PROTO_DHT_REQUEST_PUT);
msg->expire = 0; /* unknown */
msg->key = *key;
- memcpy (&msg[1], &value[1], ntohl (value->size) - sizeof (DataContainer));
+ memcpy (&msg[1], &value[1], ntohl (value->size) - sizeof
(GNUNET_DataContainer));
#if DEBUG_CS
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"`%s' at %s:%d processes reply '%.*s'\n",
__FUNCTION__,
__FILE__,
- __LINE__, ntohl (value->size) - sizeof (DataContainer), &value[1]);
+ __LINE__, ntohl (value->size) - sizeof (GNUNET_DataContainer),
&value[1]);
#endif
if (GNUNET_OK !=
coreAPI->sendToClient (record->client, &msg->header, GNUNET_YES))
{
- GE_LOG (coreAPI->ectx,
- GE_ERROR | GE_IMMEDIATE | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_IMMEDIATE | GNUNET_GE_USER,
_("`%s' failed. Terminating connection to client.\n"),
"sendToClient");
coreAPI->terminateClientConnection (record->client);
@@ -164,19 +164,19 @@
* CS handler for inserting <key,value>-pair into DHT-table.
*/
static int
-csGet (struct ClientHandle *client, const GNUNET_MessageHeader * message)
+csGet (struct GNUNET_ClientHandle *client, const GNUNET_MessageHeader *
message)
{
const CS_dht_request_get_MESSAGE *get;
DHT_CLIENT_GET_RECORD *cpc;
if (ntohs (message->size) != sizeof (CS_dht_request_get_MESSAGE))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
#if DEBUG_CS
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"`%s' at %s:%d processes get\n", __FUNCTION__, __FILE__, __LINE__);
#endif
get = (const CS_dht_request_get_MESSAGE *) message;
@@ -197,10 +197,10 @@
* get_stop for all operations that rely on this client.
*/
static void
-csClientExit (struct ClientHandle *client)
+csClientExit (struct GNUNET_ClientHandle *client)
{
int i;
- struct DHT_GET_RECORD *gr;
+ struct GNUNET_DHT_GetHandle *gr;
DHT_CLIENT_GET_RECORD *cgr;
GNUNET_mutex_lock (lock);
for (i = 0; i < getRecordsSize; i++)
@@ -222,7 +222,7 @@
}
int
-initialize_module_dht (CoreAPIForApplication * capi)
+initialize_module_dht (GNUNET_CoreAPIForPlugins * capi)
{
int status;
@@ -230,22 +230,22 @@
if (dhtAPI == NULL)
return GNUNET_SYSERR;
coreAPI = capi;
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("`%s' registering client handlers: %d %d\n"),
- "dht", CS_PROTO_dht_REQUEST_PUT, CS_PROTO_dht_REQUEST_GET);
+ "dht", GNUNET_CS_PROTO_DHT_REQUEST_PUT,
GNUNET_CS_PROTO_DHT_REQUEST_GET);
status = GNUNET_OK;
lock = GNUNET_mutex_create (GNUNET_NO);
- if (GNUNET_SYSERR == capi->registerClientHandler (CS_PROTO_dht_REQUEST_PUT,
+ if (GNUNET_SYSERR == capi->registerClientHandler
(GNUNET_CS_PROTO_DHT_REQUEST_PUT,
&csPut))
status = GNUNET_SYSERR;
- if (GNUNET_SYSERR == capi->registerClientHandler (CS_PROTO_dht_REQUEST_GET,
+ if (GNUNET_SYSERR == capi->registerClientHandler
(GNUNET_CS_PROTO_DHT_REQUEST_GET,
&csGet))
status = GNUNET_SYSERR;
if (GNUNET_SYSERR == capi->registerClientExitHandler (&csClientExit))
status = GNUNET_SYSERR;
- GE_ASSERT (capi->ectx,
- 0 == GC_set_configuration_value_string (capi->cfg,
+ GNUNET_GE_ASSERT (capi->ectx,
+ 0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
capi->ectx,
"ABOUT",
"dht",
@@ -263,11 +263,11 @@
int status;
status = GNUNET_OK;
- GE_LOG (coreAPI->ectx, GE_DEBUG | GE_REQUEST | GE_USER, "DHT: shutdown\n");
- if (GNUNET_OK != coreAPI->unregisterClientHandler (CS_PROTO_dht_REQUEST_PUT,
+ GNUNET_GE_LOG (coreAPI->ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER, "DHT: shutdown\n");
+ if (GNUNET_OK != coreAPI->unregisterClientHandler
(GNUNET_CS_PROTO_DHT_REQUEST_PUT,
&csPut))
status = GNUNET_SYSERR;
- if (GNUNET_OK != coreAPI->unregisterClientHandler (CS_PROTO_dht_REQUEST_GET,
+ if (GNUNET_OK != coreAPI->unregisterClientHandler
(GNUNET_CS_PROTO_DHT_REQUEST_GET,
&csGet))
status = GNUNET_SYSERR;
if (GNUNET_OK != coreAPI->unregisterClientExitHandler (&csClientExit))
Modified: GNUnet/src/applications/dht/module/dstore.c
===================================================================
--- GNUnet/src/applications/dht/module/dstore.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/dht/module/dstore.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -30,9 +30,9 @@
#define DEBUG_DSTORE GNUNET_NO
-static Dstore_ServiceAPI *dstore;
+static GNUNET_Dstore_ServiceAPI *dstore;
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
/**
* Lookup in the local datastore.
@@ -40,7 +40,7 @@
*/
int
dht_store_get (const GNUNET_HashCode * key,
- unsigned int type, ResultHandler handler, void *cls)
+ unsigned int type, GNUNET_ResultProcessor handler, void *cls)
{
return dstore->get (key, type, handler, cls);
}
@@ -57,8 +57,8 @@
if (discard_time < GNUNET_get_time ())
{
#if DEBUG_DSTORE
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"Content already expired (%llu < %llu), will not keep.\n",
discard_time, GNUNET_get_time ());
#endif
@@ -74,7 +74,7 @@
* @return GNUNET_OK on success
*/
int
-init_dht_store (size_t max_size, CoreAPIForApplication * capi)
+init_dht_store (size_t max_size, GNUNET_CoreAPIForPlugins * capi)
{
coreAPI = capi;
dstore = coreAPI->requestService ("dstore");
Modified: GNUnet/src/applications/dht/module/dstore.h
===================================================================
--- GNUnet/src/applications/dht/module/dstore.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/dht/module/dstore.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -35,7 +35,7 @@
* @return total number of results found
*/
int dht_store_get (const GNUNET_HashCode * key,
- unsigned int type, ResultHandler handler, void *cls);
+ unsigned int type, GNUNET_ResultProcessor handler, void
*cls);
/**
* Store the given data in the local datastore.
@@ -51,7 +51,7 @@
* @param capi the core API
* @return GNUNET_OK on success
*/
-int init_dht_store (size_t max_size, CoreAPIForApplication * capi);
+int init_dht_store (size_t max_size, GNUNET_CoreAPIForPlugins * capi);
/**
* Shutdown dstore DHT component.
Modified: GNUnet/src/applications/dht/module/routing.c
===================================================================
--- GNUnet/src/applications/dht/module/routing.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/dht/module/routing.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -60,7 +60,7 @@
* If local peer is NOT interested in results, this callback
* will be NULL.
*/
- ResultHandler receiver;
+ GNUNET_ResultProcessor receiver;
void *receiver_closure;
@@ -198,11 +198,11 @@
/**
* Statistics service.
*/
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
static struct GNUNET_Mutex *lock;
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
static unsigned int stat_replies_routed;
@@ -241,7 +241,7 @@
{
result = GNUNET_malloc (sizeof (DHT_RESULT_MESSAGE) + size);
result->header.size = htons (sizeof (DHT_RESULT_MESSAGE) + size);
- result->header.type = htons (P2P_PROTO_DHT_RESULT);
+ result->header.type = htons (GNUNET_P2P_PROTO_DHT_RESULT);
result->type = htonl (type);
result->key = *key;
memcpy (&result[1], data, size);
@@ -278,8 +278,8 @@
coreAPI->myIdentity, sizeof (GNUNET_PeerIdentity)))
{
#if DEBUG_ROUTING
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_DEVELOPER,
"Routing result to other peer\n");
#endif
coreAPI->unicast (&pos->source, &result->header, 0, /*
FIXME: priority */
@@ -290,8 +290,8 @@
else if (pos->receiver != NULL)
{
#if DEBUG_ROUTING
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_DEVELOPER,
"Routing result to local client\n");
#endif
pos->receiver (key, type, size, data, pos->receiver_closure);
@@ -303,8 +303,8 @@
}
GNUNET_mutex_unlock (lock);
#if DEBUG_ROUTING
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"Routed result to %u out of %u pending requests\n",
routed, tracked);
#endif
@@ -317,7 +317,7 @@
*/
static int
addRoute (const GNUNET_PeerIdentity * sender,
- ResultHandler handler, void *cls, const DHT_GET_MESSAGE * get)
+ GNUNET_ResultProcessor handler, void *cls, const DHT_GET_MESSAGE *
get)
{
DHTQueryRecord *q;
unsigned int i;
@@ -398,8 +398,8 @@
pos->receiver = handler;
pos->receiver_closure = cls;
#if DEBUG_ROUTING
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"Tracking request in slot %u\n", rt_pos);
#endif
rt_pos = (rt_pos + 1) % rt_size;
@@ -435,14 +435,14 @@
if (ntohs (msg->size) != sizeof (DHT_GET_MESSAGE))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
get = (const DHT_GET_MESSAGE *) msg;
#if DEBUG_ROUTING
GNUNET_hash_to_enc (&get->key, &enc);
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"Received DHT GET for key `%s'.\n", &enc);
#endif
if (stats != NULL)
@@ -453,8 +453,8 @@
if ((total > GET_TRIES) && (sender != NULL))
{
#if DEBUG_ROUTING
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"Found %d results locally, will not route GET any further\n",
total);
#endif
@@ -512,7 +512,7 @@
if (ntohs (msg->size) < sizeof (DHT_PUT_MESSAGE))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
if (stats != NULL)
@@ -520,8 +520,8 @@
put = (const DHT_PUT_MESSAGE *) msg;
#if DEBUG_ROUTING
GNUNET_hash_to_enc (&put->key, &enc);
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"Received DHT PUT for key `%s'.\n", &enc);
#endif
store = 0;
@@ -544,8 +544,8 @@
{
now = GNUNET_get_time ();
#if DEBUG_ROUTING
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"Decided to cache data `%.*s' locally until %llu (for %llu
ms)\n",
ntohs (put->header.size) - sizeof (DHT_PUT_MESSAGE),
&put[1], GNUNET_ntohll (put->timeout) + now,
@@ -560,8 +560,8 @@
else
{
#if DEBUG_ROUTING
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"Decided NOT to cache data `%.*s' locally\n",
ntohs (put->header.size) - sizeof (DHT_PUT_MESSAGE), &put[1]);
#endif
@@ -583,7 +583,7 @@
if (ntohs (msg->size) < sizeof (DHT_RESULT_MESSAGE))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
if (stats != NULL)
@@ -591,8 +591,8 @@
result = (const DHT_RESULT_MESSAGE *) msg;
#if DEBUG_ROUTING
GNUNET_hash_to_enc (&result->key, &enc);
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"Received DHT RESULT for key `%s'.\n", &enc);
#endif
routeResult (&result->key,
@@ -607,12 +607,12 @@
*/
void
dht_get_start (const GNUNET_HashCode * key,
- unsigned int type, ResultHandler handler, void *cls)
+ unsigned int type, GNUNET_ResultProcessor handler, void *cls)
{
DHT_GET_MESSAGE get;
get.header.size = htons (sizeof (DHT_GET_MESSAGE));
- get.header.type = htons (P2P_PROTO_DHT_GET);
+ get.header.type = htons (GNUNET_P2P_PROTO_DHT_GET);
get.type = htonl (type);
get.prio = htonl (0); /* FIXME */
get.ttl = htonl (MAX_TTL); /* FIXME? */
@@ -627,7 +627,7 @@
*/
void
dht_get_stop (const GNUNET_HashCode * key,
- unsigned int type, ResultHandler handler, void *cls)
+ unsigned int type, GNUNET_ResultProcessor handler, void *cls)
{
int i;
struct DHT_Source_Route *pos;
@@ -690,7 +690,7 @@
put = GNUNET_malloc (sizeof (DHT_PUT_MESSAGE) + size);
put->header.size = htons (sizeof (DHT_PUT_MESSAGE) + size);
- put->header.type = htons (P2P_PROTO_DHT_PUT);
+ put->header.type = htons (GNUNET_P2P_PROTO_DHT_PUT);
put->key = *key;
put->type = htonl (type);
put->timeout = GNUNET_htonll (expirationTime - GNUNET_get_time ()); /*
convert to relative time */
@@ -721,13 +721,13 @@
* @return GNUNET_OK on success
*/
int
-init_dht_routing (CoreAPIForApplication * capi)
+init_dht_routing (GNUNET_CoreAPIForPlugins * capi)
{
unsigned long long rts;
coreAPI = capi;
rts = 65536;
- GC_get_configuration_value_number (coreAPI->cfg,
+ GNUNET_GC_get_configuration_value_number (coreAPI->cfg,
"DHT",
"TABLESIZE",
128, 1024 * 1024, 1024, &rts);
@@ -747,13 +747,13 @@
stat_results_received =
stats->create (gettext_noop ("# dht results received"));
}
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("`%s' registering p2p handlers: %d %d %d\n"),
- "dht", P2P_PROTO_DHT_GET, P2P_PROTO_DHT_PUT, P2P_PROTO_DHT_RESULT);
- coreAPI->registerHandler (P2P_PROTO_DHT_GET, &handleGet);
- coreAPI->registerHandler (P2P_PROTO_DHT_PUT, &handlePut);
- coreAPI->registerHandler (P2P_PROTO_DHT_RESULT, &handleResult);
+ "dht", GNUNET_P2P_PROTO_DHT_GET, GNUNET_P2P_PROTO_DHT_PUT,
GNUNET_P2P_PROTO_DHT_RESULT);
+ coreAPI->registerHandler (GNUNET_P2P_PROTO_DHT_GET, &handleGet);
+ coreAPI->registerHandler (GNUNET_P2P_PROTO_DHT_PUT, &handlePut);
+ coreAPI->registerHandler (GNUNET_P2P_PROTO_DHT_RESULT, &handleResult);
coreAPI->registerSendCallback (sizeof (DHT_GET_MESSAGE),
&extra_get_callback);
return GNUNET_OK;
@@ -771,9 +771,9 @@
coreAPI->unregisterSendCallback (sizeof (DHT_GET_MESSAGE),
&extra_get_callback);
- coreAPI->unregisterHandler (P2P_PROTO_DHT_GET, &handleGet);
- coreAPI->unregisterHandler (P2P_PROTO_DHT_PUT, &handlePut);
- coreAPI->unregisterHandler (P2P_PROTO_DHT_RESULT, &handleResult);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_DHT_GET, &handleGet);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_DHT_PUT, &handlePut);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_DHT_RESULT, &handleResult);
if (stats != NULL)
{
coreAPI->releaseService (stats);
Modified: GNUnet/src/applications/dht/module/routing.h
===================================================================
--- GNUnet/src/applications/dht/module/routing.h 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/dht/module/routing.h 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -36,14 +36,14 @@
* Start a DHT get operation.
*/
void dht_get_start (const GNUNET_HashCode * key,
- unsigned int type, ResultHandler handler, void *cls);
+ unsigned int type, GNUNET_ResultProcessor handler, void
*cls);
/**
* Stop a DHT get operation (prevents calls to
* the given iterator).
*/
void dht_get_stop (const GNUNET_HashCode * key,
- unsigned int type, ResultHandler handler, void *cls);
+ unsigned int type, GNUNET_ResultProcessor handler, void
*cls);
/**
* Perform a DHT put operation. Note that PUT operations always
@@ -65,7 +65,7 @@
* @param capi the core API
* @return GNUNET_OK on success
*/
-int init_dht_routing (CoreAPIForApplication * capi);
+int init_dht_routing (GNUNET_CoreAPIForPlugins * capi);
/**
* Shutdown routing DHT component.
Modified: GNUnet/src/applications/dht/module/service.c
===================================================================
--- GNUnet/src/applications/dht/module/service.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/dht/module/service.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -34,11 +34,11 @@
/**
* Global core API.
*/
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
static struct GNUNET_CronManager *cron;
-typedef struct DHT_GET_RECORD
+typedef struct GNUNET_DHT_GetHandle
{
/**
* Key that we are looking for.
@@ -48,7 +48,7 @@
/**
* Function to call for each result.
*/
- DataProcessor callback;
+ GNUNET_DataProcessor callback;
/**
* Extra argument to callback.
@@ -58,7 +58,7 @@
/**
* Function to call once we are done
*/
- DHT_OP_Complete callbackComplete;
+ GNUNET_DHT_OperationCompleteCallback callbackComplete;
/**
* Extra argument to callbackComplete
@@ -77,11 +77,11 @@
unsigned int type,
unsigned int size, const char *data, void *cls)
{
- struct DHT_GET_RECORD *get = cls;
- DataContainer *dc;
+ struct GNUNET_DHT_GetHandle *get = cls;
+ GNUNET_DataContainer *dc;
- dc = GNUNET_malloc (sizeof (DataContainer) + size);
- dc->size = ntohl (sizeof (DataContainer) + size);
+ dc = GNUNET_malloc (sizeof (GNUNET_DataContainer) + size);
+ dc->size = ntohl (sizeof (GNUNET_DataContainer) + size);
memcpy (&dc[1], data, size);
get->callback (key, dc, get->cls);
GNUNET_free (dc);
@@ -93,7 +93,7 @@
static void
timeout_callback (void *cls)
{
- struct DHT_GET_RECORD *rec = cls;
+ struct GNUNET_DHT_GetHandle *rec = cls;
rec->callbackComplete (rec->closure);
}
@@ -116,15 +116,15 @@
* (but not on explicit async_stop).
* @return handle to stop the async get
*/
-static struct DHT_GET_RECORD *
+static struct GNUNET_DHT_GetHandle *
dht_get_async_start (unsigned int type,
const GNUNET_HashCode * key,
GNUNET_CronTime timeout,
- DataProcessor callback,
+ GNUNET_DataProcessor callback,
void *cls,
- DHT_OP_Complete callbackComplete, void *closure)
+ GNUNET_DHT_OperationCompleteCallback callbackComplete,
void *closure)
{
- struct DHT_GET_RECORD *ret;
+ struct GNUNET_DHT_GetHandle *ret;
ret = GNUNET_malloc (sizeof (DHT_GET_RECORD));
ret->key = *key;
@@ -142,7 +142,7 @@
* Stop async DHT-get. Frees associated resources.
*/
static int
-dht_get_async_stop (struct DHT_GET_RECORD *record)
+dht_get_async_stop (struct GNUNET_DHT_GetHandle *record)
{
GNUNET_cron_suspend_jobs (cron, GNUNET_YES);
GNUNET_cron_del_job (cron, &timeout_callback, 0, record);
@@ -159,27 +159,27 @@
* @param capi the core API
* @return NULL on errors, DHT_API otherwise
*/
-DHT_ServiceAPI *
-provide_module_dht (CoreAPIForApplication * capi)
+GNUNET_DHT_ServiceAPI *
+provide_module_dht (GNUNET_CoreAPIForPlugins * capi)
{
- static DHT_ServiceAPI api;
+ static GNUNET_DHT_ServiceAPI api;
cron = cron_create (capi->ectx);
GNUNET_cron_start (cron);
if (GNUNET_OK != init_dht_store (1024 * 1024, capi))
{
- GE_BREAK (capi->ectx, 0);
+ GNUNET_GE_BREAK (capi->ectx, 0);
return NULL;
}
if (GNUNET_OK != init_dht_table (capi))
{
- GE_BREAK (capi->ectx, 0);
+ GNUNET_GE_BREAK (capi->ectx, 0);
done_dht_store ();
return NULL;
}
if (GNUNET_OK != init_dht_routing (capi))
{
- GE_BREAK (capi->ectx, 0);
+ GNUNET_GE_BREAK (capi->ectx, 0);
done_dht_table ();
done_dht_store ();
return NULL;
Modified: GNUnet/src/applications/dht/module/table.c
===================================================================
--- GNUnet/src/applications/dht/module/table.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/dht/module/table.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -150,7 +150,7 @@
/**
* Global core API.
*/
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
/**
* The buckets (Kademlia style routing table).
@@ -175,17 +175,17 @@
/**
* Identity service.
*/
-static Identity_ServiceAPI *identity;
+static GNUNET_Identity_ServiceAPI *identity;
/**
* Statistics service.
*/
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
/**
* Pingpong service.
*/
-static Pingpong_ServiceAPI *pingpong;
+static GNUNET_Pingpong_ServiceAPI *pingpong;
static int stat_dht_total_peers;
@@ -403,7 +403,7 @@
selected -= distance;
}
}
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
@@ -427,7 +427,7 @@
{
coreAPI->unicast (other,
&disco->header,
- EXTREME_PRIORITY / 4,
+ GNUNET_EXTREME_PRIORITY / 4,
MAINTAIN_FREQUENCY * MAINTAIN_CHANCE / 2);
return;
}
@@ -439,7 +439,7 @@
disco =
GNUNET_malloc (pc * sizeof (GNUNET_PeerIdentity) +
sizeof (P2P_DHT_Discovery));
- disco->header.type = htons (P2P_PROTO_DHT_DISCOVERY);
+ disco->header.type = htons (GNUNET_P2P_PROTO_DHT_DISCOVERY);
disco->space_available = -1; /* FIXME */
pos = (GNUNET_PeerIdentity *) & disco[1];
i = 0;
@@ -483,7 +483,7 @@
if (total_peers == 0)
{
disc.header.size = htons (sizeof (P2P_DHT_Discovery));
- disc.header.type = htons (P2P_PROTO_DHT_DISCOVERY);
+ disc.header.type = htons (GNUNET_P2P_PROTO_DHT_DISCOVERY);
disc.space_available = -1; /* FIXME */
coreAPI->forAllConnectedNodes (&broadcast_dht_discovery_prob, &disc);
}
@@ -599,12 +599,12 @@
if (NULL != findPeerEntryInBucket (bucket, peer))
return; /* already have this peer in buckets */
/* do we know how to contact this peer? */
- hello = identity->identity2Hello (peer, ANY_PROTOCOL_NUMBER, GNUNET_NO);
+ hello = identity->identity2Hello (peer,
GNUNET_TRANSPORT_PROTOCOL_NUMBER_ANY, GNUNET_NO);
if (hello == NULL)
{
/* if identity not known, ask sender for HELLO of other peer */
ask.header.size = htons (sizeof (P2P_DHT_ASK_HELLO));
- ask.header.type = htons (sizeof (P2P_PROTO_DHT_ASK_HELLO));
+ ask.header.type = htons (sizeof (GNUNET_P2P_PROTO_DHT_ASK_HELLO));
ask.reserved = 0;
ask.peer = *peer;
coreAPI->unicast (sender, &ask.header, 0, /* FIXME: priority */
@@ -649,13 +649,13 @@
sizeof (P2P_DHT_Discovery)) / sizeof (GNUNET_PeerIdentity);
if (pc > MAINTAIN_ADV_CAP * 8)
{
- GE_BREAK (coreAPI->ectx, 0);
+ GNUNET_GE_BREAK (coreAPI->ectx, 0);
return GNUNET_SYSERR; /* far too big */
}
if (ntohs (msg->size) !=
sizeof (P2P_DHT_Discovery) + pc * sizeof (GNUNET_PeerIdentity))
{
- GE_BREAK (coreAPI->ectx, 0);
+ GNUNET_GE_BREAK (coreAPI->ectx, 0);
return GNUNET_SYSERR; /* malformed */
}
disco = (const P2P_DHT_Discovery *) msg;
@@ -691,7 +691,7 @@
if (NULL == findBucketFor (&ask->peer))
return GNUNET_OK;
hello =
- identity->identity2Hello (&ask->peer, ANY_PROTOCOL_NUMBER, GNUNET_NO);
+ identity->identity2Hello (&ask->peer,
GNUNET_TRANSPORT_PROTOCOL_NUMBER_ANY, GNUNET_NO);
if (hello == NULL)
return GNUNET_OK;
coreAPI->unicast (sender, &hello->header, 0, 5 * GNUNET_CRON_SECONDS);
@@ -706,7 +706,7 @@
* @return GNUNET_OK on success
*/
int
-init_dht_table (CoreAPIForApplication * capi)
+init_dht_table (GNUNET_CoreAPIForPlugins * capi)
{
unsigned long long i;
@@ -736,11 +736,11 @@
stats->create (gettext_noop ("# dht discovery messages sent"));
}
identity = coreAPI->requestService ("identity");
- GE_ASSERT (coreAPI->ectx, identity != NULL);
+ GNUNET_GE_ASSERT (coreAPI->ectx, identity != NULL);
pingpong = coreAPI->requestService ("pingpong");
- GE_ASSERT (coreAPI->ectx, pingpong != NULL);
- capi->registerHandler (P2P_PROTO_DHT_DISCOVERY, &handleDiscovery);
- capi->registerHandler (P2P_PROTO_DHT_ASK_HELLO, &handleAskHello);
+ GNUNET_GE_ASSERT (coreAPI->ectx, pingpong != NULL);
+ capi->registerHandler (GNUNET_P2P_PROTO_DHT_DISCOVERY, &handleDiscovery);
+ capi->registerHandler (GNUNET_P2P_PROTO_DHT_ASK_HELLO, &handleAskHello);
GNUNET_cron_add_job (coreAPI->cron,
&maintain_dht_job,
MAINTAIN_FREQUENCY, MAINTAIN_FREQUENCY, NULL);
@@ -758,8 +758,8 @@
unsigned int i;
unsigned int j;
- coreAPI->unregisterHandler (P2P_PROTO_DHT_DISCOVERY, &handleDiscovery);
- coreAPI->unregisterHandler (P2P_PROTO_DHT_ASK_HELLO, &handleAskHello);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_DHT_DISCOVERY,
&handleDiscovery);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_DHT_ASK_HELLO, &handleAskHello);
GNUNET_cron_del_job (coreAPI->cron, &maintain_dht_job, MAINTAIN_FREQUENCY,
NULL);
if (stats != NULL)
Modified: GNUnet/src/applications/dht/module/table.h
===================================================================
--- GNUnet/src/applications/dht/module/table.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/dht/module/table.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -53,7 +53,7 @@
* @param capi the core API
* @return GNUNET_OK on success
*/
-int init_dht_table (CoreAPIForApplication * capi);
+int init_dht_table (GNUNET_CoreAPIForPlugins * capi);
/**
* Shutdown table DHT component.
Modified: GNUnet/src/applications/dht/tools/dht-query.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht-query.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/dht/tools/dht-query.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -38,11 +38,11 @@
*/
static GNUNET_CronTime timeout;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
-static char *cfgFilename = DEFAULT_CLIENT_CONFIG_FILE;
+static char *cfgFilename = GNUNET_DEFAULT_CLIENT_CONFIG_FILE;
/**
* All gnunet-dht-query command line options
@@ -56,20 +56,20 @@
gettext_noop
("allow TIME ms to process a GET command or expire PUT content after ms
TIME"),
1, &GNUNET_getopt_configure_set_ulong, &timeout},
- GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
+ GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGNUNET_GE_VERSION), /* -v */
GNUNET_COMMAND_LINE_OPTION_VERBOSE,
GNUNET_COMMAND_LINE_OPTION_END,
};
static int
printCallback (const GNUNET_HashCode * hash,
- const DataContainer * data, void *cls)
+ const GNUNET_DataContainer * data, void *cls)
{
char *key = cls;
printf ("%s(%s): '%.*s'\n",
"get",
key,
- (int) (ntohl (data->size) - sizeof (DataContainer)),
+ (int) (ntohl (data->size) - sizeof (GNUNET_DataContainer)),
(char *) &data[1]);
return GNUNET_OK;
}
@@ -82,15 +82,15 @@
GNUNET_hash (key, strlen (key), &hc);
#if DEBUG_DHT_QUERY
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Issuing '%s(%s)' command.\n", "get", key);
#endif
if (timeout == 0)
timeout = 30 * GNUNET_CRON_SECONDS;
- ret = DHT_LIB_get (cfg,
+ ret = GNUNET_DHT_get (cfg,
ectx,
- DHT_STRING2STRING_BLOCK,
+ GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
&hc, timeout, &printCallback, (void *) key);
if (ret == 0)
printf (_("%s(%s) operation returned no results.\n"), "get", key);
@@ -100,21 +100,21 @@
do_put (struct GNUNET_ClientServerConnection *sock,
const char *key, const char *value)
{
- DataContainer *dc;
+ GNUNET_DataContainer *dc;
GNUNET_HashCode hc;
GNUNET_hash (key, strlen (key), &hc);
- dc = GNUNET_malloc (sizeof (DataContainer) + strlen (value));
- dc->size = htonl (strlen (value) + sizeof (DataContainer));
+ dc = GNUNET_malloc (sizeof (GNUNET_DataContainer) + strlen (value));
+ dc->size = htonl (strlen (value) + sizeof (GNUNET_DataContainer));
memcpy (&dc[1], value, strlen (value));
#if DEBUG_DHT_QUERY
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("Issuing '%s(%s,%s)' command.\n"), "put", key, value);
#endif
if (timeout == 0)
timeout = 30 * GNUNET_CRON_MINUTES;
- if (GNUNET_OK == DHT_LIB_put (cfg, ectx, &hc, DHT_STRING2STRING_BLOCK,
timeout + GNUNET_get_time (), /* convert to absolute time */
+ if (GNUNET_OK == GNUNET_DHT_put (cfg, ectx, &hc,
GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING, timeout + GNUNET_get_time (),
/* convert to absolute time */
dc))
{
printf (_("'%s(%s,%s)' succeeded\n"), "put", key, value);
@@ -146,8 +146,8 @@
if (handle == NULL)
{
fprintf (stderr, _("Failed to connect to gnunetd.\n"));
- GC_free (cfg);
- GE_free_context (ectx);
+ GNUNET_GC_free (cfg);
+ GNUNET_GE_free_context (ectx);
return 1;
}
Modified: GNUnet/src/applications/dht/tools/dht_api.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht_api.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/dht/tools/dht_api.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -46,7 +46,7 @@
/**
* Callback to call for each result.
*/
- DataProcessor processor;
+ GNUNET_DataProcessor processor;
/**
* Extra argument for processor.
@@ -80,7 +80,7 @@
GetInfo *info = cls;
GNUNET_MessageHeader *reply;
CS_dht_request_put_MESSAGE *put;
- DataContainer *cont;
+ GNUNET_DataContainer *cont;
unsigned short size;
while (info->aborted == GNUNET_NO)
@@ -91,20 +91,20 @@
if (GNUNET_OK != GNUNET_client_connection_read (info->sock, &reply))
break;
if ((sizeof (CS_dht_request_put_MESSAGE) > ntohs (reply->size)) ||
- (CS_PROTO_dht_REQUEST_PUT != ntohs (reply->type)))
+ (GNUNET_CS_PROTO_DHT_REQUEST_PUT != ntohs (reply->type)))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
info->total = GNUNET_SYSERR;
break; /* invalid reply */
}
put = (CS_dht_request_put_MESSAGE *) reply;
/* re-use "expire" field of the reply (which is 0 anyway)
- for the header of DataContainer (which fits) to avoid
+ for the header of GNUNET_DataContainer (which fits) to avoid
copying -- go C pointer arithmetic! */
- cont = (DataContainer *) & ((char *) &put[1])[-sizeof (DataContainer)];
+ cont = (GNUNET_DataContainer *) & ((char *) &put[1])[-sizeof
(GNUNET_DataContainer)];
size = ntohs (reply->size) - sizeof (CS_dht_request_put_MESSAGE);
- cont->size = htonl (size + sizeof (DataContainer));
+ cont->size = htonl (size + sizeof (GNUNET_DataContainer));
if ((info->processor != NULL) &&
(GNUNET_OK != info->processor (&put->key, cont, info->closure)))
info->aborted = GNUNET_YES;
@@ -137,11 +137,11 @@
* @return number of results on success, GNUNET_SYSERR on error (i.e. timeout)
*/
int
-DHT_LIB_get (struct GC_Configuration *cfg,
- struct GE_Context *ectx,
+GNUNET_DHT_get (struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
unsigned int type,
const GNUNET_HashCode * key,
- GNUNET_CronTime timeout, DataProcessor processor, void *closure)
+ GNUNET_CronTime timeout, GNUNET_DataProcessor processor, void
*closure)
{
struct GNUNET_ClientServerConnection *sock;
CS_dht_request_get_MESSAGE req;
@@ -156,7 +156,7 @@
if (sock == NULL)
return GNUNET_SYSERR;
req.header.size = htons (sizeof (CS_dht_request_get_MESSAGE));
- req.header.type = htons (CS_PROTO_dht_REQUEST_GET);
+ req.header.type = htons (GNUNET_CS_PROTO_DHT_REQUEST_GET);
req.type = htonl (type);
req.timeout = GNUNET_htonll (timeout);
req.key = *key;
@@ -202,11 +202,11 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
int
-DHT_LIB_put (struct GC_Configuration *cfg,
- struct GE_Context *ectx,
+GNUNET_DHT_put (struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
const GNUNET_HashCode * key,
unsigned int type, GNUNET_CronTime expire,
- const DataContainer * value)
+ const GNUNET_DataContainer * value)
{
struct GNUNET_ClientServerConnection *sock;
CS_dht_request_put_MESSAGE *req;
@@ -216,29 +216,29 @@
now = GNUNET_get_time ();
if (expire < now)
{
- GE_BREAK (ectx, 0); /* content already expired!? */
+ GNUNET_GE_BREAK (ectx, 0); /* content already expired!? */
return GNUNET_SYSERR;
}
#if DEBUG_DHT_API
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"DHT_LIB_put called with value '%.*s'\n",
ntohl (value->size), &value[1]);
#endif
sock = GNUNET_client_connection_create (ectx, cfg);
if (sock == NULL)
return GNUNET_SYSERR;
- GE_ASSERT (NULL, ntohl (value->size) >= sizeof (DataContainer));
+ GNUNET_GE_ASSERT (NULL, ntohl (value->size) >= sizeof
(GNUNET_DataContainer));
req = GNUNET_malloc (sizeof (CS_dht_request_put_MESSAGE) +
- ntohl (value->size) - sizeof (DataContainer));
+ ntohl (value->size) - sizeof (GNUNET_DataContainer));
req->header.size
= htons (sizeof (CS_dht_request_put_MESSAGE) +
- ntohl (value->size) - sizeof (DataContainer));
- req->header.type = htons (CS_PROTO_dht_REQUEST_PUT);
+ ntohl (value->size) - sizeof (GNUNET_DataContainer));
+ req->header.type = htons (GNUNET_CS_PROTO_DHT_REQUEST_PUT);
req->key = *key;
req->type = htonl (type);
req->expire = GNUNET_htonll (expire - now); /* convert to relative time */
- memcpy (&req[1], &value[1], ntohl (value->size) - sizeof (DataContainer));
+ memcpy (&req[1], &value[1], ntohl (value->size) - sizeof
(GNUNET_DataContainer));
ret = GNUNET_client_connection_write (sock, &req->header);
GNUNET_client_connection_destroy (sock);
GNUNET_free (req);
Modified: GNUnet/src/applications/dht/tools/dhttest.c
===================================================================
--- GNUnet/src/applications/dht/tools/dhttest.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/dht/tools/dhttest.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -50,7 +50,7 @@
return GNUNET_OK;
}
-#define CHECK(a) do { if (!(a)) { ret = 1; GE_BREAK(ectx, 0); goto FAILURE; }
} while(0)
+#define CHECK(a) do { if (!(a)) { ret = 1; GNUNET_GE_BREAK(ectx, 0); goto
FAILURE; } } while(0)
/**
* Testcase to test DHT routing (many peers).
@@ -62,9 +62,9 @@
struct GNUNET_TESTING_DaemonContext *peers;
int ret = 0;
GNUNET_HashCode key;
- DataContainer *value;
- struct GE_Context *ectx;
- struct GC_Configuration *cfg;
+ GNUNET_DataContainer *value;
+ struct GNUNET_GE_Context *ectx;
+ struct GNUNET_GC_Configuration *cfg;
struct GNUNET_ClientServerConnection *sock;
int left;
int i;
@@ -74,10 +74,10 @@
char buf[128];
ectx = NULL;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
peers = GNUNET_TESTING_start_daemons ("tcp",
@@ -86,7 +86,7 @@
2087, 10, NUM_PEERS);
if (peers == NULL)
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
for (i = 0; i < NUM_PEERS; i++)
@@ -98,7 +98,7 @@
{
GNUNET_TESTING_stop_daemons (peers);
fprintf (stderr, "Failed to connect the peers!\n");
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
}
@@ -107,7 +107,7 @@
/* wait for some DHT's to find each other! */
sock = GNUNET_client_connection_create (NULL, cfg);
left = 30; /* how many iterations should we wait? */
- while (GNUNET_OK == STATS_getStatistics (NULL, sock, &waitForConnect, NULL))
+ while (GNUNET_OK == GNUNET_STATS_get_statistics (NULL, sock,
&waitForConnect, NULL))
{
printf ("Waiting for peers to DHT-connect (%u iterations left)...\n",
left);
@@ -121,7 +121,7 @@
{
GNUNET_TESTING_stop_daemons (peers);
fprintf (stderr, "Peers' DHTs failed to DHT-connect!\n");
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
@@ -129,15 +129,15 @@
for (i = 0; i < NUM_PEERS; i++)
{
GNUNET_snprintf (buf, 128, "localhost:%u", 2087 + i * 10);
- GC_set_configuration_value_string (cfg, ectx, "NETWORK", "HOST", buf);
+ GNUNET_GC_set_configuration_value_string (cfg, ectx, "NETWORK", "HOST",
buf);
GNUNET_hash (buf, 4, &key);
value = GNUNET_malloc (8);
value->size = ntohl (8);
memset (&value[1], 'A' + i, 4);
- CHECK (GNUNET_OK == DHT_LIB_put (cfg,
+ CHECK (GNUNET_OK == GNUNET_DHT_put (cfg,
ectx,
&key,
- DHT_STRING2STRING_BLOCK,
+
GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
GNUNET_get_time () +
15 * GNUNET_CRON_MINUTES * NUM_ROUNDS *
NUM_PEERS * NUM_PEERS, value));
@@ -150,16 +150,16 @@
for (i = 0; i < NUM_PEERS; i++)
{
GNUNET_snprintf (buf, 128, "localhost:%u", 2087 + i * 10);
- GC_set_configuration_value_string (cfg,
+ GNUNET_GC_set_configuration_value_string (cfg,
ectx, "NETWORK", "HOST", buf);
for (j = 0; j < NUM_PEERS; j++)
{
GNUNET_snprintf (buf, 128, "localhost:%u", 2087 + j * 10);
GNUNET_hash (buf, 4, &key);
fprintf (stderr, "Peer %d gets key %d", i, j);
- if (0 < DHT_LIB_get (cfg,
+ if (0 < GNUNET_DHT_get (cfg,
ectx,
- DHT_STRING2STRING_BLOCK,
+
GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
&key,
(NUM_ROUNDS - k) * GNUNET_CRON_SECONDS,
NULL, NULL))
@@ -178,7 +178,7 @@
}
FAILURE:
GNUNET_TESTING_stop_daemons (peers);
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return ret;
}
Modified: GNUnet/src/applications/dht/tools/dhttest2.c
===================================================================
--- GNUnet/src/applications/dht/tools/dhttest2.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/dht/tools/dhttest2.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -50,7 +50,7 @@
return GNUNET_OK;
}
-#define CHECK(a) do { if (!(a)) { ret = 1; GE_BREAK(ectx, 0); goto FAILURE; }
} while(0)
+#define CHECK(a) do { if (!(a)) { ret = 1; GNUNET_GE_BREAK(ectx, 0); goto
FAILURE; } } while(0)
/**
* Testcase to test DHT routing (2 peers only).
@@ -64,17 +64,17 @@
#endif
int ret = 0;
GNUNET_HashCode key;
- DataContainer *value;
- struct GE_Context *ectx;
- struct GC_Configuration *cfg;
+ GNUNET_DataContainer *value;
+ struct GNUNET_GE_Context *ectx;
+ struct GNUNET_GC_Configuration *cfg;
struct GNUNET_ClientServerConnection *sock;
int left;
ectx = NULL;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#if START_PEERS
@@ -84,7 +84,7 @@
2087, 10000, 2);
if (peers == NULL)
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#endif
@@ -92,14 +92,14 @@
{
GNUNET_TESTING_stop_daemons (peers);
fprintf (stderr, "Failed to connect the peers!\n");
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
/* wait for DHT's to find each other! */
sock = GNUNET_client_connection_create (NULL, cfg);
left = 30; /* how many iterations should we wait? */
- while (GNUNET_OK == STATS_getStatistics (NULL, sock, &waitForConnect, NULL))
+ while (GNUNET_OK == GNUNET_STATS_get_statistics (NULL, sock,
&waitForConnect, NULL))
{
printf ("Waiting for peers to DHT-connect (%u iterations left)...\n",
left);
@@ -113,19 +113,19 @@
{
GNUNET_TESTING_stop_daemons (peers);
fprintf (stderr, "Peers' DHTs failed to DHT-connect!\n");
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
/* switch to peer2 */
- GC_set_configuration_value_string (cfg,
+ GNUNET_GC_set_configuration_value_string (cfg,
ectx,
"NETWORK", "HOST", "localhost:12087");
/* verify that peer2 also sees the other DHT! */
ok = 0;
sock = GNUNET_client_connection_create (NULL, cfg);
left = 30; /* how many iterations should we wait? */
- while (GNUNET_OK == STATS_getStatistics (NULL, sock, &waitForConnect, NULL))
+ while (GNUNET_OK == GNUNET_STATS_get_statistics (NULL, sock,
&waitForConnect, NULL))
{
printf ("Waiting for peers to DHT-connect (%u iterations left)...\n",
left);
@@ -139,13 +139,13 @@
{
GNUNET_TESTING_stop_daemons (peers);
fprintf (stderr, "Peers' DHTs failed to DHT-connect!\n");
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
/* switch to peer1 */
- GC_set_configuration_value_string (cfg,
+ GNUNET_GC_set_configuration_value_string (cfg,
ectx,
"NETWORK", "HOST", "localhost:2087");
@@ -155,19 +155,19 @@
value->size = ntohl (8);
memset (&value[1], 'A', 4);
printf ("Peer1 stores key2\n");
- CHECK (GNUNET_OK == DHT_LIB_put (cfg,
+ CHECK (GNUNET_OK == GNUNET_DHT_put (cfg,
ectx,
&key,
- DHT_STRING2STRING_BLOCK,
+
GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
GNUNET_get_time () +
5 * GNUNET_CRON_MINUTES, value));
printf ("Peer1 gets key2\n");
- CHECK (1 == DHT_LIB_get (cfg,
+ CHECK (1 == GNUNET_DHT_get (cfg,
ectx,
- DHT_STRING2STRING_BLOCK,
+ GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
&key, 2 * GNUNET_CRON_SECONDS, NULL, NULL));
/* switch to peer2 */
- GC_set_configuration_value_string (cfg,
+ GNUNET_GC_set_configuration_value_string (cfg,
ectx,
"NETWORK", "HOST", "localhost:12087");
GNUNET_hash ("key", 3, &key);
@@ -175,32 +175,32 @@
value->size = ntohl (8);
memset (&value[1], 'B', 4);
printf ("Peer2 stores key.\n");
- CHECK (GNUNET_OK == DHT_LIB_put (cfg,
+ CHECK (GNUNET_OK == GNUNET_DHT_put (cfg,
ectx,
&key,
- DHT_STRING2STRING_BLOCK,
+
GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
GNUNET_get_time () +
5 * GNUNET_CRON_MINUTES, value));
printf ("Peer2 gets key.\n");
- CHECK (1 == DHT_LIB_get (cfg,
+ CHECK (1 == GNUNET_DHT_get (cfg,
ectx,
- DHT_STRING2STRING_BLOCK,
+ GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
&key, 2 * GNUNET_CRON_SECONDS, NULL, NULL));
GNUNET_hash ("key2", 4, &key);
printf ("Peer2 gets key2.\n");
- CHECK (1 == DHT_LIB_get (cfg,
+ CHECK (1 == GNUNET_DHT_get (cfg,
ectx,
- DHT_STRING2STRING_BLOCK,
+ GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
&key, 30 * GNUNET_CRON_SECONDS, NULL, NULL));
/* switch to peer1 */
- GC_set_configuration_value_string (cfg,
+ GNUNET_GC_set_configuration_value_string (cfg,
ectx,
"NETWORK", "HOST", "localhost:2087");
printf ("Peer1 gets key\n");
- CHECK (1 == DHT_LIB_get (cfg,
+ CHECK (1 == GNUNET_DHT_get (cfg,
ectx,
- DHT_STRING2STRING_BLOCK,
+ GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
&key, 30 * GNUNET_CRON_SECONDS, NULL, NULL));
/* end of actual test code */
@@ -208,7 +208,7 @@
#if START_PEERS
GNUNET_TESTING_stop_daemons (peers);
#endif
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return ret;
}
Modified: GNUnet/src/applications/dstore/dstore.c
===================================================================
--- GNUnet/src/applications/dstore/dstore.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/dstore/dstore.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -56,14 +56,14 @@
*/
static char *fn;
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
static struct GNUNET_Mutex *lock;
/**
* Statistics service.
*/
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
static unsigned int stat_dstore_size;
@@ -89,14 +89,14 @@
strlen (zSql), ppStmt, (const char **) &dummy);
}
-#define SQLITE3_EXEC(db, cmd) do { if (SQLITE_OK != sqlite3_exec(db, cmd,
NULL, NULL, &emsg)) { GE_LOG(coreAPI->ectx, GE_ERROR | GE_ADMIN | GE_BULK,
_("`%s' failed at %s:%d with error: %s\n"), "sqlite3_exec", __FILE__, __LINE__,
emsg); sqlite3_free(emsg); } } while(0)
+#define SQLITE3_EXEC(db, cmd) do { if (SQLITE_OK != sqlite3_exec(db, cmd,
NULL, NULL, &emsg)) { GNUNET_GE_LOG(coreAPI->ectx, GNUNET_GE_ERROR |
GNUNET_GE_ADMIN | GNUNET_GE_BULK, _("`%s' failed at %s:%d with error: %s\n"),
"sqlite3_exec", __FILE__, __LINE__, emsg); sqlite3_free(emsg); } } while(0)
/**
* Log an error message at log-level 'level' that indicates
* a failure of the command 'cmd' on file 'filename'
* with the message given by strerror(errno).
*/
-#define LOG_SQLITE(db, level, cmd) do { GE_LOG(coreAPI->ectx, level, _("`%s'
failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__,
sqlite3_errmsg(db)); } while(0)
+#define LOG_SQLITE(db, level, cmd) do { GNUNET_GE_LOG(coreAPI->ectx, level,
_("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__,
sqlite3_errmsg(db)); } while(0)
static void
db_init (sqlite3 * dbh)
@@ -142,7 +142,7 @@
fd = mkstemp (fn);
if (fd == -1)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
GNUNET_free (fn);
fn = NULL;
return GNUNET_SYSERR;
@@ -175,8 +175,8 @@
if (payload * 10 <= quota * 9)
return GNUNET_OK; /* we seem to be about 10% off */
#if DEBUG_DSTORE
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"DStore above qutoa (have %llu, allowed %llu), will delete some
data.\n",
payload, quota);
#endif
@@ -190,11 +190,11 @@
"WHERE size = ? AND type = ? AND puttime = ? AND expire = ?
AND key = ? AND value = ?",
&dstmt) != SQLITE_OK))
{
- GE_LOG (coreAPI->ectx,
- GE_ERROR | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
_("`%s' failed at %s:%d with error: %s\n"),
"sq_prepare", __FILE__, __LINE__, sqlite3_errmsg (dbh));
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
if (dstmt != NULL)
sqlite3_finalize (dstmt);
if (stmt != NULL)
@@ -210,13 +210,13 @@
dtype = sqlite3_column_int (stmt, 1);
dputtime = sqlite3_column_int64 (stmt, 2);
dexpire = sqlite3_column_int64 (stmt, 3);
- GE_BREAK (NULL,
+ GNUNET_GE_BREAK (NULL,
sqlite3_column_bytes (stmt, 4) == sizeof (GNUNET_HashCode));
- GE_BREAK (NULL, dsize == sqlite3_column_bytes (stmt, 5));
+ GNUNET_GE_BREAK (NULL, dsize == sqlite3_column_bytes (stmt, 5));
memcpy (&dkey, sqlite3_column_blob (stmt, 4), sizeof (GNUNET_HashCode));
if (dsize >= MAX_CONTENT_SIZE)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
dsize = MAX_CONTENT_SIZE;
}
memcpy (dcontent, sqlite3_column_blob (stmt, 5), dsize);
@@ -231,18 +231,18 @@
sqlite3_bind_blob (dstmt, 6, dcontent, dsize, SQLITE_TRANSIENT);
if ((err = sqlite3_step (dstmt)) != SQLITE_DONE)
{
- GE_LOG (coreAPI->ectx,
- GE_ERROR | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
_("`%s' failed at %s:%d with error: %s\n"),
"sqlite3_step", __FILE__, __LINE__, sqlite3_errmsg (dbh));
sqlite3_reset (dstmt);
- GE_BREAK (NULL, 0); /* should delete but cannot!? */
+ GNUNET_GE_BREAK (NULL, 0); /* should delete but cannot!? */
break;
}
payload -= (dsize + OVERHEAD);
#if DEBUG_DSTORE
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"Deleting %u bytes decreases DStore payload to %llu out of
%llu\n",
dsize, payload, quota);
#endif
@@ -250,8 +250,8 @@
}
if (err != SQLITE_DONE)
{
- GE_LOG (coreAPI->ectx,
- GE_ERROR | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
_("`%s' failed at %s:%d with error: %s\n"),
"sqlite3_step", __FILE__, __LINE__, sqlite3_errmsg (dbh));
}
@@ -261,8 +261,8 @@
if (payload * 10 > quota * 9)
{
/* we seem to be about 10% off */
- GE_LOG (coreAPI->ectx,
- GE_ERROR | GE_BULK | GE_DEVELOPER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_DEVELOPER,
"Failed to delete content to drop below quota (bug?).\n",
payload, quota);
return GNUNET_SYSERR;
@@ -294,8 +294,8 @@
return GNUNET_SYSERR;
}
#if DEBUG_DSTORE
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"dstore processes put `%.*s\n", size, data);
#endif
@@ -305,8 +305,8 @@
"WHERE key=? AND type=? AND size=? AND value=?",
&stmt) != SQLITE_OK)
{
- GE_LOG (coreAPI->ectx,
- GE_ERROR | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
_("`%s' failed at %s:%d with error: %s\n"),
"sq_prepare", __FILE__, __LINE__, sqlite3_errmsg (dbh));
sqlite3_close (dbh);
@@ -323,8 +323,8 @@
|| (SQLITE_OK !=
sqlite3_bind_blob (stmt, 6, data, size, SQLITE_TRANSIENT)))
{
- GE_LOG (coreAPI->ectx,
- GE_ERROR | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
_("`%s' failed at %s:%d with error: %s\n"),
"sqlite3_bind_xxx", __FILE__, __LINE__, sqlite3_errmsg (dbh));
sqlite3_finalize (stmt);
@@ -334,8 +334,8 @@
}
if (SQLITE_DONE != sqlite3_step (stmt))
{
- GE_LOG (coreAPI->ectx,
- GE_ERROR | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
_("`%s' failed at %s:%d with error: %s\n"),
"sqlite3_step", __FILE__, __LINE__, sqlite3_errmsg (dbh));
sqlite3_finalize (stmt);
@@ -365,8 +365,8 @@
"(size, type, puttime, expire, key, value) "
"VALUES (?, ?, ?, ?, ?, ?)", &stmt) != SQLITE_OK)
{
- GE_LOG (coreAPI->ectx,
- GE_ERROR | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
_("`%s' failed at %s:%d with error: %s\n"),
"sq_prepare", __FILE__, __LINE__, sqlite3_errmsg (dbh));
sqlite3_close (dbh);
@@ -385,24 +385,24 @@
{
if (SQLITE_DONE != sqlite3_step (stmt))
LOG_SQLITE (dbh,
- GE_ERROR | GE_DEVELOPER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_ERROR | GNUNET_GE_DEVELOPER | GNUNET_GE_ADMIN |
GNUNET_GE_BULK,
"sqlite3_step");
else
payload += size + OVERHEAD;
if (SQLITE_OK != sqlite3_finalize (stmt))
LOG_SQLITE (dbh,
- GE_ERROR | GE_DEVELOPER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_ERROR | GNUNET_GE_DEVELOPER | GNUNET_GE_ADMIN |
GNUNET_GE_BULK,
"sqlite3_finalize");
}
else
{
LOG_SQLITE (dbh,
- GE_ERROR | GE_DEVELOPER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_ERROR | GNUNET_GE_DEVELOPER | GNUNET_GE_ADMIN |
GNUNET_GE_BULK,
"sqlite3_bind_xxx");
}
#if DEBUG_DSTORE
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"Storing %u bytes increases DStore payload to %llu out of %llu\n",
size, payload, quota);
#endif
@@ -426,7 +426,7 @@
*/
static int
d_get (const GNUNET_HashCode * key,
- unsigned int type, ResultHandler handler, void *closure)
+ unsigned int type, GNUNET_ResultProcessor handler, void *closure)
{
sqlite3 *dbh;
sqlite3_stmt *stmt;
@@ -448,16 +448,16 @@
return GNUNET_SYSERR;
}
#if DEBUG_DSTORE
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER, "dstore processes get\n");
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER, "dstore
processes get\n");
#endif
now = GNUNET_get_time ();
if (sq_prepare (dbh,
"SELECT size, value FROM ds071 WHERE key=? AND type=? AND
expire >= ?",
&stmt) != SQLITE_OK)
{
- GE_LOG (coreAPI->ectx,
- GE_ERROR | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
_("`%s' failed at %s:%d with error: %s\n"),
"sq_prepare", __FILE__, __LINE__, sqlite3_errmsg (dbh));
sqlite3_close (dbh);
@@ -474,7 +474,7 @@
size = sqlite3_column_int (stmt, 0);
if (size != sqlite3_column_bytes (stmt, 1))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
continue;
}
dat = sqlite3_column_blob (stmt, 1);
@@ -487,20 +487,20 @@
return cnt;
}
-Dstore_ServiceAPI *
-provide_module_dstore (CoreAPIForApplication * capi)
+GNUNET_Dstore_ServiceAPI *
+provide_module_dstore (GNUNET_CoreAPIForPlugins * capi)
{
- static Dstore_ServiceAPI api;
+ static GNUNET_Dstore_ServiceAPI api;
int fd;
#if DEBUG_SQLITE
- GE_LOG (capi->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (capi->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"SQLite Dstore: initializing database\n");
#endif
if (GNUNET_OK != db_reset ())
{
- GE_BREAK (capi->ectx, 0);
+ GNUNET_GE_BREAK (capi->ectx, 0);
return NULL;
}
lock = GNUNET_mutex_create (GNUNET_NO);
@@ -509,7 +509,7 @@
coreAPI = capi;
api.get = &d_get;
api.put = &d_put;
- GC_get_configuration_value_number (coreAPI->cfg,
+ GNUNET_GC_get_configuration_value_number (coreAPI->cfg,
"DSTORE", "QUOTA", 1, 1024, 1, "a);
if (quota == 0) /* error */
quota = 1;
@@ -552,8 +552,8 @@
stats = NULL;
}
#if DEBUG_SQLITE
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"SQLite Dstore: database shutdown\n");
#endif
GNUNET_mutex_destroy (lock);
Modified: GNUnet/src/applications/dstore/dstore_test.c
===================================================================
--- GNUnet/src/applications/dstore/dstore_test.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/dstore/dstore_test.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -55,7 +55,7 @@
* Add testcode here!
*/
static int
-test (Dstore_ServiceAPI * api)
+test (GNUNET_Dstore_ServiceAPI * api)
{
GNUNET_HashCode k;
GNUNET_HashCode n;
@@ -90,15 +90,15 @@
int
main (int argc, char *argv[])
{
- Dstore_ServiceAPI *api;
+ GNUNET_Dstore_ServiceAPI *api;
int ok;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
struct GNUNET_CronManager *cron;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
cron = cron_create (NULL);
Modified: GNUnet/src/applications/fragmentation/fragmentation.c
===================================================================
--- GNUnet/src/applications/fragmentation/fragmentation.c 2007-11-25
03:50:33 UTC (rev 5754)
+++ GNUnet/src/applications/fragmentation/fragmentation.c 2007-11-25
12:04:45 UTC (rev 5755)
@@ -98,9 +98,9 @@
#define FRAGSIZE(fl)
((ntohs(fl->frag->header.size)-sizeof(P2P_fragmentation_MESSAGE)))
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
static int stat_defragmented;
@@ -195,7 +195,7 @@
unsigned short len;
char *msg;
- GE_ASSERT (NULL, pep != NULL);
+ GNUNET_GE_ASSERT (NULL, pep != NULL);
pos = pep->head;
if (pos == NULL)
return;
@@ -269,7 +269,7 @@
FL *tmp;
unsigned short end;
- GE_ASSERT (NULL, entry != NULL);
+ GNUNET_GE_ASSERT (NULL, entry != NULL);
if (0 != memcmp (sender, &entry->sender, sizeof (GNUNET_PeerIdentity)))
return GNUNET_SYSERR; /* wrong fragment list, try another! */
if (ntohl (packet->id) != entry->id)
@@ -299,8 +299,8 @@
sizeof (P2P_fragmentation_MESSAGE);
if (end <= ntohs (packet->off))
{
- GE_LOG (NULL,
- GE_DEVELOPER | GE_DEBUG | GE_BULK,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_DEVELOPER | GNUNET_GE_DEBUG | GNUNET_GE_BULK,
"Received invalid fragment at %s:%d\n", __FILE__, __LINE__);
return GNUNET_SYSERR; /* yuck! integer overflow! */
}
@@ -454,7 +454,7 @@
* Send a message that had to be fragmented (right now!). First grabs
* the first part of the message (obtained from ctx->se) and stores
* that in a P2P_fragmentation_MESSAGE envelope. The remaining fragments are
- * added to the send queue with EXTREME_PRIORITY (to ensure that they
+ * added to the send queue with GNUNET_EXTREME_PRIORITY (to ensure that they
* will be transmitted next). The logic here is that if the priority
* for the first fragment was sufficiently high, the priority should
* also have been sufficiently high for all of the other fragments (at
@@ -484,7 +484,7 @@
/* write first fragment to buf */
frag = (P2P_fragmentation_MESSAGE *) buf;
frag->header.size = htons (len);
- frag->header.type = htons (P2P_PROTO_fragment);
+ frag->header.type = htons (GNUNET_P2P_PROTO_MESSAGNUNET_GE_FRAGMENT);
frag->id = id;
frag->off = htons (0);
frag->len = htons (ctx->len);
@@ -498,9 +498,9 @@
mlen = sizeof (P2P_fragmentation_MESSAGE) + ctx->len - pos;
if (mlen > ctx->mtu)
mlen = ctx->mtu;
- GE_ASSERT (NULL, mlen > sizeof (P2P_fragmentation_MESSAGE));
+ GNUNET_GE_ASSERT (NULL, mlen > sizeof (P2P_fragmentation_MESSAGE));
frag->header.size = htons (mlen);
- frag->header.type = htons (P2P_PROTO_fragment);
+ frag->header.type = htons (GNUNET_P2P_PROTO_MESSAGNUNET_GE_FRAGMENT);
frag->id = id;
frag->off = htons (pos);
frag->len = htons (ctx->len);
@@ -509,11 +509,11 @@
mlen - sizeof (P2P_fragmentation_MESSAGE));
coreAPI->unicast (&ctx->sender,
&frag->header,
- EXTREME_PRIORITY,
+ GNUNET_EXTREME_PRIORITY,
ctx->transmissionTime - GNUNET_get_time ());
pos += mlen - sizeof (P2P_fragmentation_MESSAGE);
}
- GE_ASSERT (NULL, pos == ctx->len);
+ GNUNET_GE_ASSERT (NULL, pos == ctx->len);
GNUNET_free (frag);
GNUNET_free (ctx);
return GNUNET_OK;
@@ -530,13 +530,13 @@
unsigned int mtu,
unsigned int prio,
unsigned int targetTime,
- unsigned int len, BuildMessageCallback bmc, void *bmcClosure)
+ unsigned int len, GNUNET_BuildMessageCallback bmc, void *bmcClosure)
{
FragmentBMC *fbmc;
int xlen;
- GE_ASSERT (NULL, len > mtu);
- GE_ASSERT (NULL, mtu > sizeof (P2P_fragmentation_MESSAGE));
+ GNUNET_GE_ASSERT (NULL, len > mtu);
+ GNUNET_GE_ASSERT (NULL, mtu > sizeof (P2P_fragmentation_MESSAGE));
fbmc = GNUNET_malloc (sizeof (FragmentBMC) + len);
fbmc->mtu = mtu;
fbmc->sender = *peer;
@@ -563,10 +563,10 @@
/**
* Initialize Fragmentation module.
*/
-Fragmentation_ServiceAPI *
-provide_module_fragmentation (CoreAPIForApplication * capi)
+GNUNET_Fragmentation_ServiceAPI *
+provide_module_fragmentation (GNUNET_CoreAPIForPlugins * capi)
{
- static Fragmentation_ServiceAPI ret;
+ static GNUNET_Fragmentation_ServiceAPI ret;
int i;
coreAPI = capi;
@@ -586,10 +586,10 @@
&defragmentationPurgeCron,
60 * GNUNET_CRON_SECONDS, 60 * GNUNET_CRON_SECONDS,
NULL);
- GE_LOG (capi->ectx, GE_INFO | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (capi->ectx, GNUNET_GE_INFO | GNUNET_GE_USER |
GNUNET_GE_REQUEST,
_("`%s' registering handler %d\n"), "fragmentation",
- P2P_PROTO_fragment);
- capi->registerHandler (P2P_PROTO_fragment, &processFragment);
+ GNUNET_P2P_PROTO_MESSAGNUNET_GE_FRAGMENT);
+ capi->registerHandler (GNUNET_P2P_PROTO_MESSAGNUNET_GE_FRAGMENT,
&processFragment);
ret.fragment = &fragment;
return &ret;
@@ -603,7 +603,7 @@
{
int i;
- coreAPI->unregisterHandler (P2P_PROTO_fragment, &processFragment);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_MESSAGNUNET_GE_FRAGMENT,
&processFragment);
GNUNET_cron_del_job (coreAPI->cron,
&defragmentationPurgeCron, 60 * GNUNET_CRON_SECONDS,
NULL);
Modified: GNUnet/src/applications/fragmentation/fragmentationtest.c
===================================================================
--- GNUnet/src/applications/fragmentation/fragmentationtest.c 2007-11-25
03:50:33 UTC (rev 5754)
+++ GNUnet/src/applications/fragmentation/fragmentationtest.c 2007-11-25
12:04:45 UTC (rev 5755)
@@ -57,9 +57,9 @@
static void
handleHelper (const GNUNET_PeerIdentity * sender,
const char *msg,
- const unsigned int len, int wasEncrypted, TSession * ts)
+ const unsigned int len, int wasEncrypted, GNUNET_TSession * ts)
{
- GE_ASSERT (NULL,
+ GNUNET_GE_ASSERT (NULL,
0 == memcmp (sender, &mySender, sizeof (GNUNET_PeerIdentity)));
myMsg = resultBuffer;
memcpy (resultBuffer, msg, len);
@@ -115,10 +115,10 @@
{
int i;
- GE_ASSERT (NULL, myMsg != NULL);
- GE_ASSERT (NULL, myMsgLen == len);
+ GNUNET_GE_ASSERT (NULL, myMsg != NULL);
+ GNUNET_GE_ASSERT (NULL, myMsgLen == len);
for (i = 0; i < len; i++)
- GE_ASSERT (NULL, myMsg[i] == (char) (i + id));
+ GNUNET_GE_ASSERT (NULL, myMsg[i] == (char) (i + id));
myMsgLen = 0;
myMsg = NULL;
}
@@ -133,7 +133,7 @@
pep = makeFragment (0, 16, 32, 42);
processFragment (&mySender, pep);
- GE_ASSERT (NULL, myMsg == NULL);
+ GNUNET_GE_ASSERT (NULL, myMsg == NULL);
pep = makeFragment (16, 16, 32, 42);
processFragment (&mySender, pep);
checkPacket (42, 32);
@@ -146,11 +146,11 @@
pep = makeFragment (0, 16, 32, 42);
processFragment (&mySender, pep);
- GE_ASSERT (NULL, myMsg == NULL);
+ GNUNET_GE_ASSERT (NULL, myMsg == NULL);
makeTimeout ();
pep = makeFragment (16, 16, 32, 42);
processFragment (&mySender, pep);
- GE_ASSERT (NULL, myMsg == NULL);
+ GNUNET_GE_ASSERT (NULL, myMsg == NULL);
pep = makeFragment (0, 16, 32, 42);
processFragment (&mySender, pep);
checkPacket (42, 32);
@@ -163,7 +163,7 @@
pep = makeFragment (16, 16, 32, 42);
processFragment (&mySender, pep);
- GE_ASSERT (NULL, myMsg == NULL);
+ GNUNET_GE_ASSERT (NULL, myMsg == NULL);
pep = makeFragment (0, 16, 32, 42);
processFragment (&mySender, pep);
checkPacket (42, 32);
@@ -179,7 +179,7 @@
{
pep = makeFragment (i * 16, 16, 51 * 16, 42);
processFragment (&mySender, pep);
- GE_ASSERT (NULL, myMsg == NULL);
+ GNUNET_GE_ASSERT (NULL, myMsg == NULL);
}
pep = makeFragment (50 * 16, 16, 51 * 16, 42);
processFragment (&mySender, pep);
@@ -196,7 +196,7 @@
{
pep = makeFragment (i * 16, 16, 4001 * 16, 42);
processFragment (&mySender, pep);
- GE_ASSERT (NULL, myMsg == NULL);
+ GNUNET_GE_ASSERT (NULL, myMsg == NULL);
}
pep = makeFragment (4000 * 16, 16, 4001 * 16, 42);
processFragment (&mySender, pep);
@@ -213,7 +213,7 @@
{
pep = makeFragment (i * 16, 8, 6 * 16 + 8, 42);
processFragment (&mySender, pep);
- GE_ASSERT (NULL, myMsg == NULL);
+ GNUNET_GE_ASSERT (NULL, myMsg == NULL);
}
pep = makeFragment (5 * 16, 24, 6 * 16 + 8, 42);
processFragment (&mySender, pep);
@@ -235,13 +235,13 @@
{
pep = makeFragment (i * 16, 8, 51 * 16 + 8, 42);
processFragment (&mySender, pep);
- GE_ASSERT (NULL, myMsg == NULL);
+ GNUNET_GE_ASSERT (NULL, myMsg == NULL);
}
for (i = 0; i < 50; i++)
{
pep = makeFragment (i * 16 + 8, 8, 51 * 16 + 8, 42);
processFragment (&mySender, pep);
- GE_ASSERT (NULL, myMsg == NULL);
+ GNUNET_GE_ASSERT (NULL, myMsg == NULL);
}
pep = makeFragment (50 * 16, 24, 51 * 16 + 8, 42);
processFragment (&mySender, pep);
@@ -258,13 +258,13 @@
{
pep = makeFragment (i * 32, 16, 51 * 32, 42);
processFragment (&mySender, pep);
- GE_ASSERT (NULL, myMsg == NULL);
+ GNUNET_GE_ASSERT (NULL, myMsg == NULL);
}
for (i = 0; i < 50; i++)
{
pep = makeFragment (i * 32 + 8, 24, 51 * 32, 42);
processFragment (&mySender, pep);
- GE_ASSERT (NULL, myMsg == NULL);
+ GNUNET_GE_ASSERT (NULL, myMsg == NULL);
}
pep = makeFragment (50 * 32, 32, 51 * 32, 42);
processFragment (&mySender, pep);
@@ -281,7 +281,7 @@
{
pep = makeFragment (0, i * 16 + 16, 51 * 16, 42);
processFragment (&mySender, pep);
- GE_ASSERT (NULL, myMsg == NULL);
+ GNUNET_GE_ASSERT (NULL, myMsg == NULL);
}
pep = makeFragment (50 * 16, 16, 51 * 16, 42);
processFragment (&mySender, pep);
@@ -298,12 +298,12 @@
{
pep = makeFragment (0, i * 16 + 16, 51 * 16 + 8, 42);
processFragment (&mySender, pep);
- GE_ASSERT (NULL, myMsg == NULL);
+ GNUNET_GE_ASSERT (NULL, myMsg == NULL);
}
makeTimeout ();
pep = makeFragment (50 * 16, 24, 51 * 16 + 8, 42);
processFragment (&mySender, pep);
- GE_ASSERT (NULL, myMsg == NULL);
+ GNUNET_GE_ASSERT (NULL, myMsg == NULL);
for (i = 0; i < 50; i++)
{
pep = makeFragment (0, i * 16 + 16, 51 * 16 + 8, 42);
@@ -326,7 +326,7 @@
pep = makeFragment (i * 16, 16, 51 * 16, id + 5);
mySender.hashPubKey.bits[0] = id;
processFragment (&mySender, pep);
- GE_ASSERT (NULL, myMsg == NULL);
+ GNUNET_GE_ASSERT (NULL, myMsg == NULL);
}
}
for (id = 0; id < DEFRAG_BUCKET_COUNT; id++)
@@ -352,7 +352,7 @@
pep = makeFragment (i * 16, 16, 6 * 16, id + 5);
mySender.hashPubKey.bits[0] = id;
processFragment (&mySender, pep);
- GE_ASSERT (NULL, myMsg == NULL);
+ GNUNET_GE_ASSERT (NULL, myMsg == NULL);
}
}
for (id = 0; id < DEFRAG_BUCKET_COUNT * 4; id++)
@@ -367,13 +367,13 @@
/* ************* driver ****************** */
static int
-registerp2pHandler (const unsigned short type, MessagePartHandler callback)
+registerp2pHandler (const unsigned short type, GNUNET_P2PRequestHandler
callback)
{
return GNUNET_OK;
}
static int
-unregisterp2pHandler (const unsigned short type, MessagePartHandler callback)
+unregisterp2pHandler (const unsigned short type, GNUNET_P2PRequestHandler
callback)
{
return GNUNET_OK;
}
@@ -388,9 +388,9 @@
int
main (int argc, char *argv[])
{
- CoreAPIForApplication capi;
+ GNUNET_CoreAPIForPlugins capi;
- memset (&capi, 0, sizeof (CoreAPIForApplication));
+ memset (&capi, 0, sizeof (GNUNET_CoreAPIForPlugins));
capi.cron = cron_create (NULL);
capi.injectMessage = &handleHelper;
capi.requestService = &requestService;
Modified: GNUnet/src/applications/fs/collection/collection.c
===================================================================
--- GNUnet/src/applications/fs/collection/collection.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/collection/collection.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -103,12 +103,12 @@
/**
* Metadata describing the collection
*/
- struct ECRS_MetaData *meta;
+ struct GNUNET_ECRS_MetaData *meta;
/**
* Files in the collection.
*/
- ECRS_FileInfo *files;
+ GNUNET_ECRS_FileInfo *files;
/**
* How many files are in files?
@@ -126,9 +126,9 @@
static struct GNUNET_Mutex *lock;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static char *
getCollectionFileName ()
@@ -136,10 +136,10 @@
char *fn;
char *fnBase;
- GC_get_configuration_value_filename (cfg,
+ GNUNET_GC_get_configuration_value_filename (cfg,
"GNUNET",
"GNUNET_HOME",
- GNUNET_HOME_DIRECTORY, &fnBase);
+ GNUNET_DEFAULT_HOME_DIRECTORY, &fnBase);
fn = GNUNET_malloc (strlen (fnBase) + strlen (COLLECTION) + 4);
strcpy (fn, fnBase);
GNUNET_disk_directory_create (ectx, fn);
@@ -153,7 +153,7 @@
* Initialize collection module.
*/
void
-CO_init (struct GE_Context *e, struct GC_Configuration *c)
+GNUNET_CO_init (struct GNUNET_GE_Context *e, struct GNUNET_GC_Configuration *c)
{
char *fn;
int len;
@@ -184,7 +184,7 @@
if ((size > 0x7FFFFFFF) ||
(size < sizeof (CollectionData) + 4 * sizeof (int)))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
UNLINK (fn);
GNUNET_free (fn);
return;
@@ -192,7 +192,7 @@
fd = OPEN (fn, O_RDONLY | O_LARGEFILE);
if (fd == -1)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
UNLINK (fn);
GNUNET_free (fn);
return;
@@ -201,8 +201,8 @@
buf = MMAP (NULL, rsize, PROT_READ, MAP_SHARED, fd, 0);
if (buf == MAP_FAILED)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER
| GNUNET_GE_BULK,
"mmap", fn);
CLOSE (fd);
GNUNET_free (fn);
@@ -215,7 +215,7 @@
len = ntohl (*(int *) pos);
if (len > 1024 * 1024 * 4)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
len = 1024 * 1024 * 4;
}
GNUNET_array_grow (collectionData->files, collectionData->file_count, len);
@@ -227,7 +227,7 @@
len = ntohl (*(int *) pos);
if (len > 1024)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
len = 1024;
}
collectionData->name = GNUNET_malloc (len + 1);
@@ -235,7 +235,7 @@
rsize -= 4 * sizeof (int);
if (len > rsize)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
len = rsize;
}
memcpy (collectionData->name, pos, len);
@@ -243,18 +243,18 @@
pos += len;
if (mlen > rsize)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
mlen = rsize;
}
- collectionData->meta = ECRS_deserializeMetaData (ectx, pos, mlen);
+ collectionData->meta = GNUNET_ECRS_meta_data_deserialize (ectx, pos, mlen);
rsize -= mlen;
pos += mlen;
- GE_BREAK (ectx, collectionData->meta != NULL);
+ GNUNET_GE_BREAK (ectx, collectionData->meta != NULL);
for (i = 0; i < collectionData->file_count; i++)
{
if (rsize < 2 * sizeof (int))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
break;
}
len = ntohl (*(int *) pos);
@@ -264,12 +264,12 @@
rsize -= 2 * sizeof (int);
if (rsize < mlen + len)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
break;
}
if (len > 1024 * 16)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
len = 1024 * 16;
}
tmp = GNUNET_malloc (len + 1);
@@ -277,16 +277,16 @@
memcpy (tmp, pos, len);
pos += len;
rsize -= len;
- collectionData->files[i].uri = ECRS_stringToUri (ectx, tmp);
- GE_ASSERT (ectx, collectionData->files[i].uri != NULL);
+ collectionData->files[i].uri = GNUNET_ECRS_string_to_uri (ectx, tmp);
+ GNUNET_GE_ASSERT (ectx, collectionData->files[i].uri != NULL);
GNUNET_free (tmp);
collectionData->files[i].meta
- = ECRS_deserializeMetaData (ectx, pos, mlen);
- GE_ASSERT (ectx, collectionData->files[i].meta != NULL);
+ = GNUNET_ECRS_meta_data_deserialize (ectx, pos, mlen);
+ GNUNET_GE_ASSERT (ectx, collectionData->files[i].meta != NULL);
pos += mlen;
rsize -= mlen;
}
- GE_ASSERT (ectx, rsize == 0);
+ GNUNET_GE_ASSERT (ectx, rsize == 0);
MUNMAP (buf, (size_t) size);
CLOSE (fd);
GNUNET_free (fn);
@@ -297,9 +297,9 @@
(collectionData->files[i].meta != NULL))
continue;
if (collectionData->files[i].uri != NULL)
- ECRS_freeUri (collectionData->files[i].uri);
+ GNUNET_ECRS_uri_destroy (collectionData->files[i].uri);
if (collectionData->files[i].meta != NULL)
- ECRS_freeMetaData (collectionData->files[i].meta);
+ GNUNET_ECRS_meta_data_destroy (collectionData->files[i].meta);
collectionData->files[i]
= collectionData->files[collectionData->file_count - 1];
GNUNET_array_grow (collectionData->files,
@@ -331,13 +331,13 @@
return;
/* write collection data */
- mlen = ECRS_sizeofMetaData (collectionData->meta, GNUNET_NO);
+ mlen = GNUNET_ECRS_meta_data_get_serialized_size (collectionData->meta,
GNUNET_NO);
buf = GNUNET_malloc (mlen);
- if (mlen != ECRS_serializeMetaData (ectx,
+ if (mlen != GNUNET_ECRS_meta_data_serialize (ectx,
collectionData->meta, buf, mlen,
GNUNET_NO))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_free (buf);
return;
}
@@ -347,39 +347,39 @@
O_CREAT | O_LARGEFILE | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR);
if (fd == -1)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_USER | GE_ADMIN | GE_ERROR | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_USER | GNUNET_GE_ADMIN | GNUNET_GE_ERROR
| GNUNET_GE_BULK,
"open", fn);
GNUNET_free (fn);
GNUNET_free (buf);
return;
}
- GE_BREAK (ectx, collectionData->file_count <= 1024 * 1024 * 4);
+ GNUNET_GE_BREAK (ectx, collectionData->file_count <= 1024 * 1024 * 4);
WRITE (fd, collectionData, sizeof (CollectionData));
WRITEINT (fd, collectionData->file_count);
WRITEINT (fd, collectionData->changed);
WRITEINT (fd, mlen);
- GE_BREAK (ectx, strlen (collectionData->name) < 1024);
+ GNUNET_GE_BREAK (ectx, strlen (collectionData->name) < 1024);
WRITEINT (fd, strlen (collectionData->name));
WRITE (fd, collectionData->name, strlen (collectionData->name));
WRITE (fd, buf, mlen);
GNUNET_free (buf);
for (i = 0; i < collectionData->file_count; i++)
{
- mlen = ECRS_sizeofMetaData (collectionData->files[i].meta, GNUNET_NO);
+ mlen = GNUNET_ECRS_meta_data_get_serialized_size
(collectionData->files[i].meta, GNUNET_NO);
buf = GNUNET_malloc (mlen);
- if (mlen != ECRS_serializeMetaData (ectx,
+ if (mlen != GNUNET_ECRS_meta_data_serialize (ectx,
collectionData->files[i].meta,
buf, mlen, GNUNET_NO))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_free (buf);
break;
}
- tmp = ECRS_uriToString (collectionData->files[i].uri);
+ tmp = GNUNET_ECRS_uri_to_string (collectionData->files[i].uri);
WRITEINT (fd, strlen (tmp));
WRITEINT (fd, mlen);
- GE_BREAK (ectx, strlen (tmp) < 16 * 1024);
+ GNUNET_GE_BREAK (ectx, strlen (tmp) < 16 * 1024);
WRITE (fd, tmp, strlen (tmp));
GNUNET_free (tmp);
WRITE (fd, buf, mlen);
@@ -393,10 +393,10 @@
* Shutdown collection module.
*/
void
-CO_done ()
+GNUNET_CO_done ()
{
writeCO ();
- CO_stopCollection ();
+ GNUNET_CO_collection_stop ();
GNUNET_mutex_destroy (lock);
lock = NULL;
ectx = NULL;
@@ -407,31 +407,31 @@
/**
* Start collection.
*
- * @param updateInterval of ECRS_SBLOCK_UPDATE_NONE
+ * @param updateInterval of GNUNET_ECRS_SBLOCK_UPDATE_NONE
* means to update _immediately_ on any change,
- * wherease ECRS_SBLOCK_UPDATE_SPORADIC means
+ * wherease GNUNET_ECRS_SBLOCK_UPDATE_SPORADIC means
* to publish updates when the CO_Context
* is destroyed (i.e. on exit from the UI).
*/
int
-CO_startCollection (unsigned int anonymityLevel,
+GNUNET_CO_collection_start (unsigned int anonymityLevel,
unsigned int prio,
GNUNET_Int32Time updateInterval,
- const char *name, const struct ECRS_MetaData *meta)
+ const char *name, const struct GNUNET_ECRS_MetaData *meta)
{
- struct ECRS_URI *advertisement;
- struct ECRS_URI *rootURI;
+ struct GNUNET_ECRS_URI *advertisement;
+ struct GNUNET_ECRS_URI *rootURI;
GNUNET_HashCode nextId;
GNUNET_Int32Time now;
GNUNET_mutex_lock (lock);
- CO_stopCollection (); /* cancel old collection */
- GE_ASSERT (ectx, name != NULL);
- advertisement = ECRS_parseCharKeywordURI (ectx, COLLECTION);
- GE_ASSERT (ectx, advertisement != NULL);
+ GNUNET_CO_collection_stop (); /* cancel old collection */
+ GNUNET_GE_ASSERT (ectx, name != NULL);
+ advertisement = GNUNET_ECRS_keyword_string_to_uri (ectx, COLLECTION);
+ GNUNET_GE_ASSERT (ectx, advertisement != NULL);
GNUNET_get_time_int32 (&now);
GNUNET_create_random_hash (&nextId);
- rootURI = ECRS_createNamespace (ectx,
+ rootURI = GNUNET_ECRS_namespace_create (ectx,
cfg,
name,
meta,
@@ -442,12 +442,12 @@
&nextId);
if (rootURI == NULL)
{
- ECRS_freeUri (advertisement);
+ GNUNET_ECRS_uri_destroy (advertisement);
GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
- ECRS_freeUri (advertisement);
- ECRS_freeUri (rootURI);
+ GNUNET_ECRS_uri_destroy (advertisement);
+ GNUNET_ECRS_uri_destroy (rootURI);
collectionData = GNUNET_malloc (sizeof (CollectionInfo));
memset (collectionData, 0, sizeof (CollectionInfo));
GNUNET_create_random_hash (&collectionData->data.lastId);
@@ -455,7 +455,7 @@
collectionData->data.updateInterval = htonl (updateInterval);
collectionData->data.anonymityLevel = htonl (anonymityLevel);
collectionData->data.priority = htonl (prio);
- collectionData->meta = ECRS_dupMetaData (meta);
+ collectionData->meta = GNUNET_ECRS_meta_data_duplicate (meta);
collectionData->name = GNUNET_strdup (name);
GNUNET_mutex_unlock (lock);
return GNUNET_OK;
@@ -467,7 +467,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if no collection is active
*/
int
-CO_stopCollection ()
+GNUNET_CO_collection_stop ()
{
unsigned int i;
@@ -477,12 +477,12 @@
GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
- ECRS_deleteNamespace (ectx, cfg, collectionData->name);
- ECRS_freeMetaData (collectionData->meta);
+ GNUNET_ECRS_namespace_delete (ectx, cfg, collectionData->name);
+ GNUNET_ECRS_meta_data_destroy (collectionData->meta);
for (i = 0; i < collectionData->file_count; i++)
{
- ECRS_freeMetaData (collectionData->files[i].meta);
- ECRS_freeUri (collectionData->files[i].uri);
+ GNUNET_ECRS_meta_data_destroy (collectionData->files[i].meta);
+ GNUNET_ECRS_uri_destroy (collectionData->files[i].uri);
}
GNUNET_array_grow (collectionData->files, collectionData->file_count, 0);
GNUNET_free (collectionData->name);
@@ -498,7 +498,7 @@
* @return NULL if there is no collection, otherwise its name
*/
char *
-CO_getCollection ()
+GNUNET_CO_collection_get_name ()
{
char *name;
@@ -531,12 +531,12 @@
* time is desired.
*/
void
-CO_publishCollectionNow ()
+GNUNET_CO_collection_publish_now ()
{
GNUNET_HashCode delta;
GNUNET_Int32Time now;
- struct ECRS_URI *uri;
- struct ECRS_URI *directoryURI;
+ struct GNUNET_ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *directoryURI;
unsigned long long dirLen;
char *tmpName;
int fd;
@@ -549,18 +549,18 @@
return;
}
GNUNET_get_time_int32 (&now);
- if ((ntohl (collectionData->data.updateInterval) != ECRS_SBLOCK_UPDATE_NONE)
+ if ((ntohl (collectionData->data.updateInterval) !=
GNUNET_ECRS_SBLOCK_UPDATE_NONE)
&& (ntohl (collectionData->data.updateInterval) !=
- ECRS_SBLOCK_UPDATE_SPORADIC)
+ GNUNET_ECRS_SBLOCK_UPDATE_SPORADIC)
&& (ntohl (collectionData->data.lastPublication) +
ntohl (collectionData->data.updateInterval) < now))
{
GNUNET_mutex_unlock (lock);
return;
}
- if ((ntohl (collectionData->data.updateInterval) != ECRS_SBLOCK_UPDATE_NONE)
+ if ((ntohl (collectionData->data.updateInterval) !=
GNUNET_ECRS_SBLOCK_UPDATE_NONE)
&& (ntohl (collectionData->data.updateInterval) !=
- ECRS_SBLOCK_UPDATE_SPORADIC))
+ GNUNET_ECRS_SBLOCK_UPDATE_SPORADIC))
{
GNUNET_hash_difference (&collectionData->data.nextId,
&collectionData->data.lastId, &delta);
@@ -577,14 +577,14 @@
fd = mkstemp (tmpName);
if (fd == -1)
{
- GE_LOG_STRERROR (ectx, GE_ERROR | GE_ADMIN | GE_BULK, "mkstemp");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "mkstemp");
GNUNET_free (tmpName);
GNUNET_mutex_unlock (lock);
return;
}
dirData = NULL;
- GE_ASSERT (ectx,
- GNUNET_OK == ECRS_createDirectory (ectx,
+ GNUNET_GE_ASSERT (ectx,
+ GNUNET_OK == GNUNET_ECRS_directory_create (ectx,
&dirData,
&dirLen,
collectionData->file_count,
@@ -592,7 +592,7 @@
collectionData->meta));
if (-1 == WRITE (fd, dirData, dirLen))
{
- GE_LOG_STRERROR (ectx, GE_ERROR | GE_ADMIN | GE_BULK, "write");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "write");
GNUNET_free (tmpName);
GNUNET_free (dirData);
GNUNET_mutex_unlock (lock);
@@ -600,7 +600,7 @@
}
GNUNET_free (dirData);
CLOSE (fd);
- if (GNUNET_OK != ECRS_uploadFile (ectx, cfg, tmpName, GNUNET_NO, /*
indexing */
+ if (GNUNET_OK != GNUNET_ECRS_file_upload (ectx, cfg, tmpName, GNUNET_NO,
/* indexing */
ntohl (collectionData->data.
anonymityLevel),
ntohl (collectionData->data.priority),
@@ -615,7 +615,7 @@
}
UNLINK (tmpName);
GNUNET_free (tmpName);
- uri = ECRS_addToNamespace (ectx,
+ uri = GNUNET_ECRS_namespace_add_content (ectx,
cfg,
collectionData->name,
ntohl (collectionData->data.anonymityLevel),
@@ -630,7 +630,7 @@
{
collectionData->data.lastPublication = htonl (now);
collectionData->changed = GNUNET_NO;
- ECRS_freeUri (uri);
+ GNUNET_ECRS_uri_destroy (uri);
}
GNUNET_mutex_unlock (lock);
}
@@ -649,19 +649,19 @@
* ways to explicitly extend a collection.
*/
void
-CO_publishToCollection (const ECRS_FileInfo * fi)
+GNUNET_CO_collection_add_item (const GNUNET_ECRS_FileInfo * fi)
{
unsigned int i;
- ECRS_FileInfo fc;
+ GNUNET_ECRS_FileInfo fc;
- if ((ECRS_isKeywordUri (fi->uri)))
+ if ((GNUNET_ECRS_uri_test_ksk (fi->uri)))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return;
}
if (lock == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return;
}
GNUNET_mutex_lock (lock);
@@ -672,18 +672,18 @@
}
for (i = 0; i < collectionData->file_count; i++)
{
- if (ECRS_equalsUri (fi->uri, collectionData->files[i].uri))
+ if (GNUNET_ECRS_uri_test_equal (fi->uri, collectionData->files[i].uri))
{
GNUNET_mutex_unlock (lock);
return;
}
}
- fc.uri = ECRS_dupUri (fi->uri);
- fc.meta = ECRS_dupMetaData (fi->meta);
+ fc.uri = GNUNET_ECRS_uri_duplicate (fi->uri);
+ fc.meta = GNUNET_ECRS_meta_data_duplicate (fi->meta);
GNUNET_array_append (collectionData->files, collectionData->file_count, fc);
collectionData->changed = GNUNET_YES;
- if (ntohl (collectionData->data.updateInterval) == ECRS_SBLOCK_UPDATE_NONE)
- CO_publishCollectionNow ();
+ if (ntohl (collectionData->data.updateInterval) ==
GNUNET_ECRS_SBLOCK_UPDATE_NONE)
+ GNUNET_CO_collection_publish_now ();
GNUNET_mutex_unlock (lock);
}
Modified: GNUnet/src/applications/fs/collection/collectiontest.c
===================================================================
--- GNUnet/src/applications/fs/collection/collectiontest.c 2007-11-25
03:50:33 UTC (rev 5754)
+++ GNUnet/src/applications/fs/collection/collectiontest.c 2007-11-25
12:04:45 UTC (rev 5755)
@@ -30,86 +30,86 @@
#include "gnunet_util_config_impl.h"
#include "gnunet_util_network_client.h"
-#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GE_BREAK(NULL, 0); goto FAILURE; }
+#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GNUNET_GE_BREAK(NULL, 0); goto
FAILURE; }
#define START_DAEMON 1
int
main (int argc, char *argv[])
{
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
#if START_DAEMON
pid_t daemon;
#endif
int ok;
struct GNUNET_ClientServerConnection *sock;
- struct ECRS_MetaData *meta;
- ECRS_FileInfo fi;
+ struct GNUNET_ECRS_MetaData *meta;
+ GNUNET_ECRS_FileInfo fi;
char *have;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
sock = NULL;
meta = NULL;
#if START_DAEMON
daemon = GNUNET_daemon_start (NULL, cfg, "peer.conf", GNUNET_NO);
- GE_ASSERT (NULL, daemon > 0);
+ GNUNET_GE_ASSERT (NULL, daemon > 0);
CHECK (GNUNET_OK ==
GNUNET_wait_for_daemon_running (NULL, cfg,
300 * GNUNET_CRON_SECONDS));
GNUNET_thread_sleep (5 * GNUNET_CRON_SECONDS); /* give apps time to
start */
#endif
ok = GNUNET_YES;
- meta = ECRS_createMetaData ();
- ECRS_addToMetaData (meta, EXTRACTOR_MIMETYPE, "test/foo");
+ meta = GNUNET_ECRS_meta_data_create ();
+ GNUNET_ECRS_meta_data_inser (meta, EXTRACTOR_MIMETYPE, "test/foo");
sock = GNUNET_client_connection_create (NULL, cfg);
CHECK (sock != NULL);
- CO_init (NULL, cfg);
+ GNUNET_CO_init (NULL, cfg);
/* ACTUAL TEST CODE */
- CO_stopCollection ();
- ECRS_deleteNamespace (NULL, cfg, "test-collection");
- CHECK (NULL == CO_getCollection ());
- CHECK (GNUNET_OK == CO_startCollection (1, 100, 60, /* 60s */
+ GNUNET_CO_collection_stop ();
+ GNUNET_ECRS_namespace_delete (NULL, cfg, "test-collection");
+ CHECK (NULL == GNUNET_CO_collection_get_name ());
+ CHECK (GNUNET_OK == GNUNET_CO_collection_start (1, 100, 60, /* 60s */
"test-collection", meta));
- have = CO_getCollection ();
+ have = GNUNET_CO_collection_get_name ();
CHECK (NULL != have);
CHECK (0 == strcmp (have, "test-collection"));
GNUNET_free (have);
fi.meta = meta;
fi.uri =
- ECRS_stringToUri (NULL,
+ GNUNET_ECRS_string_to_uri (NULL,
"gnunet://ecrs/chk/0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0");
- CO_publishToCollection (&fi);
- ECRS_freeUri (fi.uri);
- CO_done ();
- CO_init (NULL, cfg);
- have = CO_getCollection ();
+ GNUNET_CO_collection_add_item (&fi);
+ GNUNET_ECRS_uri_destroy (fi.uri);
+ GNUNET_CO_done ();
+ GNUNET_CO_init (NULL, cfg);
+ have = GNUNET_CO_collection_get_name ();
CHECK (NULL != have);
CHECK (0 == strcmp (have, "test-collection"));
GNUNET_free (have);
- CO_publishCollectionNow ();
- CO_stopCollection ();
- ECRS_deleteNamespace (NULL, cfg, "test-collection");
- CHECK (NULL == CO_getCollection ());
+ GNUNET_CO_collection_publish_now ();
+ GNUNET_CO_collection_stop ();
+ GNUNET_ECRS_namespace_delete (NULL, cfg, "test-collection");
+ CHECK (NULL == GNUNET_CO_collection_get_name ());
/* END OF TEST CODE */
FAILURE:
if (sock != NULL)
{
- CO_done ();
+ GNUNET_CO_done ();
GNUNET_client_connection_destroy (sock);
}
if (meta != NULL)
- ECRS_freeMetaData (meta);
+ GNUNET_ECRS_meta_data_destroy (meta);
#if START_DAEMON
- GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
+ GNUNET_GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
#endif
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return (ok == GNUNET_YES) ? 0 : 1;
}
Modified: GNUnet/src/applications/fs/ecrs/bincoder.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/bincoder.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs/bincoder.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -62,7 +62,7 @@
unsigned int hbits;
char *ret;
- GE_ASSERT (NULL, strlen (encTable__) == 64);
+ GNUNET_GE_ASSERT (NULL, strlen (encTable__) == 64);
len = size * 8 / 6;
if (((size * 8) % 6) != 0)
len++;
Modified: GNUnet/src/applications/fs/ecrs/directory.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/directory.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs/directory.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -33,7 +33,7 @@
* are structured such that it is possible to iterate over the
* individual blocks as well as over the entire directory. Thus
* a client can call this function on the lastBlock in the
- * ECRS_DownloadProgressCallback. Note that if a directory entry
+ * GNUNET_ECRS_DownloadProgressCallback. Note that if a directory entry
* spans multiple blocks, listDirectory may signal an error when
* run on individual blocks even if the final directory is intact.
* <p>
@@ -50,17 +50,17 @@
* directory is malformed
*/
int
-ECRS_listDirectory (struct GE_Context *ectx,
+GNUNET_ECRS_directory_list_contents (struct GNUNET_GE_Context *ectx,
const char *data,
unsigned long long len,
- struct ECRS_MetaData **md,
- ECRS_SearchProgressCallback spcb, void *spcbClosure)
+ struct GNUNET_ECRS_MetaData **md,
+ GNUNET_ECRS_SearchResultProcessor spcb, void *spcbClosure)
{
unsigned long long pos;
unsigned long long align;
unsigned int mdSize;
unsigned long long epos;
- ECRS_FileInfo fi;
+ GNUNET_ECRS_FileInfo fi;
int count;
count = 0;
@@ -73,12 +73,12 @@
mdSize = ntohl (mdSize);
if (mdSize > len - 8 - sizeof (unsigned int))
return GNUNET_SYSERR; /* invalid size */
- *md = ECRS_deserializeMetaData (ectx,
+ *md = GNUNET_ECRS_meta_data_deserialize (ectx,
&data[8 + sizeof (unsigned int)],
mdSize);
if (*md == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR; /* malformed ! */
}
pos = 8 + sizeof (unsigned int) + mdSize;
@@ -109,17 +109,17 @@
if (epos >= len)
return GNUNET_SYSERR; /* malformed - or partial download */
- fi.uri = ECRS_stringToUri (ectx, &data[pos]);
+ fi.uri = GNUNET_ECRS_string_to_uri (ectx, &data[pos]);
pos = epos + 1;
if (fi.uri == NULL)
{
pos--; /* go back to '\0' to force going to next
alignment */
continue;
}
- if (ECRS_isKeywordUri (fi.uri))
+ if (GNUNET_ECRS_uri_test_ksk (fi.uri))
{
- ECRS_freeUri (fi.uri);
- GE_BREAK (ectx, 0);
+ GNUNET_ECRS_uri_destroy (fi.uri);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR; /* illegal in directory! */
}
@@ -129,23 +129,23 @@
pos += sizeof (unsigned int);
if (pos + mdSize > len)
{
- ECRS_freeUri (fi.uri);
+ GNUNET_ECRS_uri_destroy (fi.uri);
return GNUNET_SYSERR; /* malformed - or partial download */
}
- fi.meta = ECRS_deserializeMetaData (ectx, &data[pos], mdSize);
+ fi.meta = GNUNET_ECRS_meta_data_deserialize (ectx, &data[pos], mdSize);
if (fi.meta == NULL)
{
- ECRS_freeUri (fi.uri);
- GE_BREAK (ectx, 0);
+ GNUNET_ECRS_uri_destroy (fi.uri);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR; /* malformed ! */
}
pos += mdSize;
count++;
if (spcb != NULL)
spcb (&fi, NULL, GNUNET_NO, spcbClosure);
- ECRS_freeMetaData (fi.meta);
- ECRS_freeUri (fi.uri);
+ GNUNET_ECRS_meta_data_destroy (fi.meta);
+ GNUNET_ECRS_uri_destroy (fi.uri);
}
return count;
}
@@ -259,11 +259,11 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
int
-ECRS_createDirectory (struct GE_Context *ectx,
+GNUNET_ECRS_directory_create (struct GNUNET_GE_Context *ectx,
char **data,
unsigned long long *len,
unsigned int count,
- const ECRS_FileInfo * fis, struct ECRS_MetaData *meta)
+ const GNUNET_ECRS_FileInfo * fis, struct
GNUNET_ECRS_MetaData *meta)
{
int i;
int j;
@@ -277,26 +277,26 @@
for (i = 0; i < count; i++)
{
- if (ECRS_isKeywordUri (fis[i].uri))
+ if (GNUNET_ECRS_uri_test_ksk (fis[i].uri))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR; /* illegal in directory! */
}
}
ucs = GNUNET_malloc (sizeof (char *) * count);
size = 8 + sizeof (unsigned int);
- size += ECRS_sizeofMetaData (meta, ECRS_SERIALIZE_FULL);
+ size += GNUNET_ECRS_meta_data_get_serialized_size (meta,
GNUNET_ECRS_SERIALIZE_FULL);
sizes = GNUNET_malloc (count * sizeof (unsigned long long));
perm = GNUNET_malloc (count * sizeof (int));
for (i = 0; i < count; i++)
{
perm[i] = i;
- ucs[i] = ECRS_uriToString (fis[i].uri);
- GE_ASSERT (ectx, ucs[i] != NULL);
- psize = ECRS_sizeofMetaData (fis[i].meta, ECRS_SERIALIZE_FULL);
+ ucs[i] = GNUNET_ECRS_uri_to_string (fis[i].uri);
+ GNUNET_GE_ASSERT (ectx, ucs[i] != NULL);
+ psize = GNUNET_ECRS_meta_data_get_serialized_size (fis[i].meta,
GNUNET_ECRS_SERIALIZE_FULL);
if (psize == -1)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_free (sizes);
GNUNET_free (perm);
while (i >= 0)
@@ -323,12 +323,12 @@
pos = 8;
memcpy (*data, GNUNET_DIRECTORY_MAGIC, 8);
- ret = ECRS_serializeMetaData (ectx,
+ ret = GNUNET_ECRS_meta_data_serialize (ectx,
meta,
&(*data)[pos + sizeof (unsigned int)],
size - pos - sizeof (unsigned int),
- ECRS_SERIALIZE_FULL);
- GE_ASSERT (ectx, ret != GNUNET_SYSERR);
+ GNUNET_ECRS_SERIALIZE_FULL);
+ GNUNET_GE_ASSERT (ectx, ret != GNUNET_SYSERR);
ret = htonl (ret);
memcpy (&(*data)[pos], &ret, sizeof (unsigned int));
pos += ntohl (ret) + sizeof (unsigned int);
@@ -343,12 +343,12 @@
memcpy (&(*data)[pos], ucs[i], strlen (ucs[i]) + 1);
pos += strlen (ucs[i]) + 1;
GNUNET_free (ucs[i]);
- ret = ECRS_serializeMetaData (ectx,
+ ret = GNUNET_ECRS_meta_data_serialize (ectx,
fis[i].meta,
&(*data)[pos + sizeof (unsigned int)],
size - pos - sizeof (unsigned int),
- ECRS_SERIALIZE_FULL);
- GE_ASSERT (ectx, ret != GNUNET_SYSERR);
+ GNUNET_ECRS_SERIALIZE_FULL);
+ GNUNET_GE_ASSERT (ectx, ret != GNUNET_SYSERR);
ret = htonl (ret);
memcpy (&(*data)[pos], &ret, sizeof (unsigned int));
pos += ntohl (ret) + sizeof (unsigned int);
@@ -356,7 +356,7 @@
GNUNET_free (sizes);
GNUNET_free (perm);
GNUNET_free (ucs);
- GE_ASSERT (ectx, pos == size);
+ GNUNET_GE_ASSERT (ectx, pos == size);
return GNUNET_OK;
}
Modified: GNUnet/src/applications/fs/ecrs/directorytest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/directorytest.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/ecrs/directorytest.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -34,13 +34,13 @@
struct PCLS
{
- ECRS_FileInfo *fi;
+ GNUNET_ECRS_FileInfo *fi;
unsigned int pos;
unsigned int max;
};
static int
-processor (const ECRS_FileInfo * fi,
+processor (const GNUNET_ECRS_FileInfo * fi,
const GNUNET_HashCode * key, int isRoot, void *cls)
{
struct PCLS *p = cls;
@@ -48,9 +48,9 @@
for (i = 0; i < p->max; i++)
{
- if (ECRS_equalsMetaData (p->fi[i].meta,
+ if (GNUNET_ECRS_meta_data_test_equal (p->fi[i].meta,
fi->meta) &&
- ECRS_equalsUri (p->fi[i].uri, fi->uri))
+ GNUNET_ECRS_uri_test_equal (p->fi[i].uri, fi->uri))
{
p->pos++;
return GNUNET_OK;
@@ -65,9 +65,9 @@
{
char *data;
unsigned long long dlen;
- ECRS_FileInfo *fis;
- struct ECRS_MetaData *meta;
- struct ECRS_MetaData *meta2;
+ GNUNET_ECRS_FileInfo *fis;
+ struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_ECRS_MetaData *meta2;
struct PCLS cls;
int p;
int q;
@@ -76,14 +76,14 @@
int ret = 0;
cls.max = i;
- fis = GNUNET_malloc (sizeof (ECRS_FileInfo) * i);
+ fis = GNUNET_malloc (sizeof (GNUNET_ECRS_FileInfo) * i);
for (p = 0; p < i; p++)
{
- fis[p].meta = ECRS_createMetaData ();
+ fis[p].meta = GNUNET_ECRS_meta_data_create ();
for (q = 0; q <= p; q++)
{
GNUNET_snprintf (txt, 128, "%u -- %u\n", p, q);
- ECRS_addToMetaData (fis[p].meta,
+ GNUNET_ECRS_meta_data_inser (fis[p].meta,
q % EXTRACTOR_getHighestKeywordTypeNumber (),
txt);
}
@@ -91,54 +91,54 @@
512,
"gnunet://ecrs/chk/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820.RNVVVVOOLCLK065B5D04HTNVNSIB2AI022RG8200HSLK1CO1000ATQ98824DMA2032LIMG50CG0K057NVUVG200000H000004400000.%u",
p);
- fis[p].uri = ECRS_stringToUri (NULL, uri);
+ fis[p].uri = GNUNET_ECRS_string_to_uri (NULL, uri);
if (fis[p].uri == NULL)
{
- ECRS_freeMetaData (fis[p].meta);
+ GNUNET_ECRS_meta_data_destroy (fis[p].meta);
while (--p > 0)
{
- ECRS_freeMetaData (fis[p].meta);
- ECRS_freeUri (fis[p].uri);
+ GNUNET_ECRS_meta_data_destroy (fis[p].meta);
+ GNUNET_ECRS_uri_destroy (fis[p].uri);
}
GNUNET_free (fis);
ABORT (); /* error in testcase */
}
}
- meta = ECRS_createMetaData ();
- ECRS_addToMetaData (meta, EXTRACTOR_TITLE, "A title");
- ECRS_addToMetaData (meta, EXTRACTOR_AUTHOR, "An author");
- if (GNUNET_OK != ECRS_createDirectory (NULL, &data, &dlen, i, fis, meta))
+ meta = GNUNET_ECRS_meta_data_create ();
+ GNUNET_ECRS_meta_data_inser (meta, EXTRACTOR_TITLE, "A title");
+ GNUNET_ECRS_meta_data_inser (meta, EXTRACTOR_AUTHOR, "An author");
+ if (GNUNET_OK != GNUNET_ECRS_directory_create (NULL, &data, &dlen, i, fis,
meta))
{
- ECRS_freeMetaData (meta);
+ GNUNET_ECRS_meta_data_destroy (meta);
for (p = 0; p < i; p++)
{
- ECRS_freeMetaData (fis[p].meta);
- ECRS_freeUri (fis[p].uri);
+ GNUNET_ECRS_meta_data_destroy (fis[p].meta);
+ GNUNET_ECRS_uri_destroy (fis[p].uri);
}
GNUNET_free (fis);
ABORT ();
}
cls.pos = 0;
cls.fi = fis;
- if (i != ECRS_listDirectory (NULL, data, dlen, &meta2, &processor, &cls))
+ if (i != GNUNET_ECRS_directory_list_contents (NULL, data, dlen, &meta2,
&processor, &cls))
{
printf ("expected %u\n", i);
ret = 1;
goto END;
}
- if (!ECRS_equalsMetaData (meta, meta2))
+ if (!GNUNET_ECRS_meta_data_test_equal (meta, meta2))
{
ret = 1;
goto END;
}
END:
GNUNET_free (data);
- ECRS_freeMetaData (meta);
- ECRS_freeMetaData (meta2);
+ GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_ECRS_meta_data_destroy (meta2);
for (p = 0; p < i; p++)
{
- ECRS_freeMetaData (fis[p].meta);
- ECRS_freeUri (fis[p].uri);
+ GNUNET_ECRS_meta_data_destroy (fis[p].meta);
+ GNUNET_ECRS_uri_destroy (fis[p].uri);
}
GNUNET_free (fis);
return ret;
Modified: GNUnet/src/applications/fs/ecrs/download.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/download.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs/download.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -67,7 +67,7 @@
typedef struct IOContext
{
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
/**
* A lock for synchronizing access.
@@ -126,8 +126,8 @@
strcat (fn, ".A");
fn[strlen (fn) - 1] += i;
if (0 != UNLINK (fn))
- GE_LOG (this->ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (this->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Could not unlink temporary file `%s': %s\n"),
fn, STRERROR (errno));
GNUNET_free (fn);
@@ -147,7 +147,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on failure
*/
static int
-createIOContext (struct GE_Context *ectx,
+createIOContext (struct GNUNET_GE_Context *ectx,
IOContext * this,
int no_temporaries,
unsigned long long filesize, const char *filename)
@@ -157,7 +157,7 @@
struct stat st;
this->ectx = ectx;
- GE_ASSERT (ectx, filename != NULL);
+ GNUNET_GE_ASSERT (ectx, filename != NULL);
this->treedepth = computeDepth (filesize);
this->lock = GNUNET_mutex_create (GNUNET_NO);
this->handles = GNUNET_malloc (sizeof (int) * (this->treedepth + 1));
@@ -168,8 +168,8 @@
/* if exists and oversized, truncate */
if (truncate (filename, filesize) != 0)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_BULK,
"truncate", filename);
return GNUNET_SYSERR;
}
@@ -231,8 +231,8 @@
ret = READ (this->handles[level], buf, len);
GNUNET_mutex_unlock (this->lock);
#if DEBUG_DOWNLOAD
- GE_LOG (this->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (this->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"IOC read at level %u offset %llu wanted %u got %d\n",
level, pos, len, ret);
#endif
@@ -266,15 +266,15 @@
ret = WRITE (this->handles[level], buf, len);
if (ret != len)
{
- GE_LOG (this->ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (this->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Write(%d, %p, %d) failed: %s\n"),
this->handles[level], buf, len, STRERROR (errno));
}
GNUNET_mutex_unlock (this->lock);
#if DEBUG_DOWNLOAD
- GE_LOG (this->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (this->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"IOC write at level %u offset %llu writes %u\n", level, pos, len);
#endif
return ret;
@@ -336,7 +336,7 @@
* Search handle of the last request (NULL if never
* requested).
*/
- struct FS_SEARCH_HANDLE *searchHandle;
+ struct GNUNET_FS_SearchHandle *searchHandle;
/**
* Last time the query was send.
@@ -383,13 +383,13 @@
*/
RequestEntry **requestList;
- struct FS_SEARCH_CONTEXT *sctx;
+ struct GNUNET_FS_SearchContext *sctx;
struct GNUNET_ThreadHandle *requestThread;
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
GNUNET_PeerIdentity target;
@@ -452,14 +452,14 @@
* @return NULL on error
*/
static RequestManager *
-createRequestManager (struct GE_Context *ectx, struct GC_Configuration *cfg)
+createRequestManager (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg)
{
RequestManager *rm;
rm = GNUNET_malloc (sizeof (RequestManager));
rm->shutdown = GNUNET_NO;
rm->lock = GNUNET_mutex_create (GNUNET_YES);
- rm->sctx = FS_SEARCH_makeContext (ectx, cfg, rm->lock);
+ rm->sctx = GNUNET_FS_create_search_context (ectx, cfg, rm->lock);
if (rm->sctx == NULL)
{
GNUNET_mutex_destroy (rm->lock);
@@ -486,8 +486,8 @@
rm->congestionWindow = 1; /* RSS is 1 */
rm->ssthresh = 65535;
#if DEBUG_DOWNLOAD
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"created request manager %p\n", rm);
#endif
return rm;
@@ -506,8 +506,8 @@
int i;
#if DEBUG_DOWNLOAD
- GE_LOG (rm->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (rm->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"destroying request manager %p\n", rm);
#endif
GNUNET_mutex_lock (rm->lock);
@@ -520,12 +520,12 @@
for (i = 0; i < rm->requestListIndex; i++)
{
if (rm->requestList[i]->searchHandle != NULL)
- FS_stop_search (rm->sctx, rm->requestList[i]->searchHandle);
+ GNUNET_FS_stop_search (rm->sctx, rm->requestList[i]->searchHandle);
GNUNET_free (rm->requestList[i]->node);
GNUNET_free (rm->requestList[i]);
}
GNUNET_array_grow (rm->requestList, rm->requestListSize, 0);
- FS_SEARCH_destroyContext (rm->sctx);
+ GNUNET_FS_destroy_search_context (rm->sctx);
rm->sctx = NULL;
GNUNET_mutex_destroy (rm->lock);
GNUNET_thread_release_self (rm->requestThread);
@@ -568,14 +568,14 @@
GNUNET_EncName enc;
IF_GELOG (rm->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&node->chk.query, &enc));
- GE_LOG (rm->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (rm->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Queuing request (query: %s)\n", &enc);
#endif
- GE_ASSERT (rm->ectx, node != NULL);
+ GNUNET_GE_ASSERT (rm->ectx, node != NULL);
entry = GNUNET_malloc (sizeof (RequestEntry));
entry->node = node;
entry->lasttime = 0; /* never sent */
@@ -586,7 +586,7 @@
GNUNET_mutex_lock (rm->lock);
if (rm->shutdown == GNUNET_NO)
{
- GE_ASSERT (rm->ectx, rm->requestListSize > 0);
+ GNUNET_GE_ASSERT (rm->ectx, rm->requestListSize > 0);
if (rm->requestListSize == rm->requestListIndex)
GNUNET_array_grow (rm->requestList, rm->requestListSize,
rm->requestListSize * 2);
@@ -594,7 +594,7 @@
}
else
{
- GE_BREAK (rm->ectx, 0);
+ GNUNET_GE_BREAK (rm->ectx, 0);
GNUNET_free (entry);
}
GNUNET_mutex_unlock (rm->lock);
@@ -625,14 +625,14 @@
rm->requestList[rm->requestListIndex] = NULL;
GNUNET_mutex_unlock (rm->lock);
if (NULL != re->searchHandle)
- FS_stop_search (rm->sctx, re->searchHandle);
+ GNUNET_FS_stop_search (rm->sctx, re->searchHandle);
GNUNET_free (re);
return;
}
}
}
GNUNET_mutex_unlock (rm->lock);
- GE_BREAK (rm->ectx, 0); /* uh uh - at least a memory leak... */
+ GNUNET_GE_BREAK (rm->ectx, 0); /* uh uh - at least a memory leak... */
}
@@ -652,7 +652,7 @@
GNUNET_CronTime TTL_DECREMENT;
RequestManager *rm;
IOContext *ioc;
- ECRS_DownloadProgressCallback dpcb;
+ GNUNET_ECRS_DownloadProgressCallback dpcb;
void *dpcbClosure;
unsigned int anonymityLevel;
} CommonCtx;
@@ -670,15 +670,15 @@
unsigned long long spos;
unsigned long long epos;
- GE_ASSERT (node->ctx->rm->ectx, node->offset < node->ctx->total);
+ GNUNET_GE_ASSERT (node->ctx->rm->ectx, node->offset < node->ctx->total);
if (node->level == 0)
{
ret = DBLOCK_SIZE;
if (node->offset + (unsigned long long) ret > node->ctx->total)
ret = (unsigned int) (node->ctx->total - node->offset);
#if DEBUG_DOWNLOAD
- GE_LOG (node->ctx->rm->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (node->ctx->rm->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Node at offset %llu and level %d has size %u\n",
node->offset, node->level, ret);
#endif
@@ -695,8 +695,8 @@
if (ret * rsize < epos - spos)
ret++; /* need to round up! */
#if DEBUG_DOWNLOAD
- GE_LOG (node->ctx->rm->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (node->ctx->rm->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Node at offset %llu and level %d has size %u\n",
node->offset, node->level, ret * sizeof (CHK));
#endif
@@ -754,7 +754,7 @@
pos = i;
if (pos == -1)
{
- /* GE_BREAK(ectx, 0); *//* should never happen */
+ /* GNUNET_GE_BREAK(ectx, 0); *//* should never happen */
GNUNET_mutex_unlock (rm->lock);
return;
}
@@ -864,8 +864,8 @@
ret = GNUNET_NO;
GNUNET_free (data);
#if DEBUG_DOWNLOAD
- GE_LOG (node->ctx->rm->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (node->ctx->rm->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Checked presence of block at %llu level %u. Result: %s\n",
node->offset, node->level, ret == GNUNET_YES ? "YES" : "NO");
#endif
@@ -881,7 +881,7 @@
static void
iblock_download_children (NodeClosure * node, char *data, unsigned int size)
{
- struct GE_Context *ectx = node->ctx->rm->ectx;
+ struct GNUNET_GE_Context *ectx = node->ctx->rm->ectx;
int i;
NodeClosure *child;
unsigned int childcount;
@@ -889,11 +889,11 @@
unsigned int levelSize;
unsigned long long baseOffset;
- GE_ASSERT (ectx, node->level > 0);
+ GNUNET_GE_ASSERT (ectx, node->level > 0);
childcount = size / sizeof (CHK);
if (size != childcount * sizeof (CHK))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return;
}
if (node->level == 1)
@@ -913,9 +913,9 @@
child->ctx = node->ctx;
child->chk = chks[i];
child->offset = baseOffset + i * levelSize;
- GE_ASSERT (ectx, child->offset < node->ctx->total);
+ GNUNET_GE_ASSERT (ectx, child->offset < node->ctx->total);
child->level = node->level - 1;
- GE_ASSERT (ectx, (child->level != 0) ||
+ GNUNET_GE_ASSERT (ectx, (child->level != 0) ||
((child->offset % DBLOCK_SIZE) == 0));
if (GNUNET_NO == checkPresent (child))
addRequest (node->ctx->rm, child);
@@ -942,7 +942,7 @@
GNUNET_AES_InitializationVector iv;
GNUNET_AES_SessionKey skey;
- GE_ASSERT (NULL, (data != NULL) && (hashcode != NULL) && (result != NULL));
+ GNUNET_GE_ASSERT (NULL, (data != NULL) && (hashcode != NULL) && (result !=
NULL));
/* get key and init value from the GNUNET_hash code */
GNUNET_hash_to_AES_key (hashcode, &skey, &iv);
return GNUNET_AES_decrypt (&skey, data, size, &iv, result);
@@ -964,10 +964,10 @@
*/
static int
nodeReceive (const GNUNET_HashCode * query,
- const Datastore_Value * reply, void *cls, unsigned long long uid)
+ const GNUNET_DatastoreValue * reply, void *cls, unsigned long
long uid)
{
NodeClosure *node = cls;
- struct GE_Context *ectx = node->ctx->rm->ectx;
+ struct GNUNET_GE_Context *ectx = node->ctx->rm->ectx;
GNUNET_HashCode hc;
unsigned int size;
int i;
@@ -975,32 +975,32 @@
#if DEBUG_DOWNLOAD
GNUNET_EncName enc;
- IF_GELOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (query, &enc));
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Receiving reply to query `%s'\n", &enc);
#endif
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
0 == memcmp (query, &node->chk.query, sizeof (GNUNET_HashCode)));
- size = ntohl (reply->size) - sizeof (Datastore_Value);
+ size = ntohl (reply->size) - sizeof (GNUNET_DatastoreValue);
if ((size <= sizeof (DBlock)) ||
(size - sizeof (DBlock) != getNodeSize (node)))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR; /* invalid size! */
}
size -= sizeof (DBlock);
data = GNUNET_malloc (size);
if (GNUNET_SYSERR == decryptContent ((char *) &((DBlock *) & reply[1])[1],
size, &node->chk.key, data))
- GE_ASSERT (ectx, 0);
+ GNUNET_GE_ASSERT (ectx, 0);
GNUNET_hash (data, size, &hc);
if (0 != memcmp (&hc, &node->chk.key, sizeof (GNUNET_HashCode)))
{
delRequest (node->ctx->rm, node);
GNUNET_free (data);
- GE_BREAK (ectx, 0);
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_BREAK (ectx, 0);
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Decrypted content does not match key. "
"This is either a bug or a maliciously inserted "
"file. Download aborted.\n"));
@@ -1010,8 +1010,8 @@
if (size != writeToIOC (node->ctx->ioc,
node->level, node->offset, data, size))
{
- GE_LOG_STRERROR (ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "WRITE");
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "WRITE");
node->ctx->rm->abortFlag = GNUNET_YES;
return GNUNET_SYSERR;
}
@@ -1032,7 +1032,7 @@
requestManagerEndgame (node->ctx->rm);
}
}
- GE_ASSERT (node->ctx->rm->ectx, node->ctx->rm->requestThread != NULL);
+ GNUNET_GE_ASSERT (node->ctx->rm->ectx, node->ctx->rm->requestThread != NULL);
GNUNET_thread_stop_sleep (node->ctx->rm->requestThread);
GNUNET_free (data);
GNUNET_free (node);
@@ -1074,7 +1074,7 @@
struct GNUNET_ClientServerConnection *sock;
sock = GNUNET_client_connection_create (rm->ectx, rm->cfg);
- lastmpriority = FS_getAveragePriority (sock);
+ lastmpriority = GNUNET_FS_get_current_average_priority (sock);
lastmpritime = now;
GNUNET_client_connection_destroy (sock);
}
@@ -1101,7 +1101,7 @@
TTL_DECREMENT = entry->node->ctx->TTL_DECREMENT;
if (entry->lastTimeout + TTL_DECREMENT > now)
- GE_BREAK (rm->ectx, 0);
+ GNUNET_GE_BREAK (rm->ectx, 0);
if (entry->lasttime == 0)
{
timeout = now + rm->initialTTL;
@@ -1145,21 +1145,21 @@
#if DEBUG_DOWNLOAD
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&entry->node->chk.query, &enc));
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Starting FS search for %s:%llu:%u `%s'\n",
entry->node->ctx->ioc->filename,
entry->node->offset, entry->node->level, &enc);
#endif
if (entry->searchHandle != NULL)
- FS_stop_search (rm->sctx, entry->searchHandle);
+ GNUNET_FS_stop_search (rm->sctx, entry->searchHandle);
entry->searchHandle
- = FS_start_search (rm->sctx,
+ = GNUNET_FS_start_search (rm->sctx,
rm->have_target == GNUNET_NO ? NULL : &rm->target,
- D_BLOCK,
+ GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA,
1,
&entry->node->chk.query,
entry->node->ctx->anonymityLevel,
@@ -1189,10 +1189,10 @@
{
GNUNET_EncName enc;
IF_GELOG (rm->ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
GNUNET_hash_to_enc (&entry->node->chk.key, &enc));
- GE_LOG (rm->ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (rm->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_
("Content `%s' seems to be not available on the network (tried
%u times).\n"),
&enc, entry->tries);
@@ -1235,7 +1235,7 @@
}
else if (rm->requestList[i]->searchHandle != NULL)
{
- FS_stop_search (rm->sctx, rm->requestList[i]->searchHandle);
+ GNUNET_FS_stop_search (rm->sctx, rm->requestList[i]->searchHandle);
rm->requestList[i]->searchHandle = NULL;
}
}
@@ -1293,20 +1293,20 @@
* @param filename where to store the file
*/
int
-ECRS_downloadFile (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- const struct ECRS_URI *uri,
+GNUNET_ECRS_file_download (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const struct GNUNET_ECRS_URI *uri,
const char *filename,
unsigned int anonymityLevel,
- ECRS_DownloadProgressCallback dpcb,
- void *dpcbClosure, ECRS_TestTerminate tt, void *ttClosure)
+ GNUNET_ECRS_DownloadProgressCallback dpcb,
+ void *dpcbClosure, GNUNET_ECRS_TestTerminate tt, void
*ttClosure)
{
- return ECRS_downloadPartialFile (ectx,
+ return GNUNET_ECRS_file_download_partial (ectx,
cfg,
uri,
filename,
0,
- ECRS_fileSize (uri),
+ GNUNET_ECRS_uri_get_file_siz (uri),
anonymityLevel,
GNUNET_NO, dpcb, dpcbClosure, tt,
ttClosure);
@@ -1333,17 +1333,17 @@
* @param length length of the download (starting at offset)
*/
int
-ECRS_downloadPartialFile (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- const struct ECRS_URI *uri,
+GNUNET_ECRS_file_download_partial (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const struct GNUNET_ECRS_URI *uri,
const char *filename,
unsigned long long offset,
unsigned long long length,
unsigned int anonymityLevel,
int no_temporaries,
- ECRS_DownloadProgressCallback dpcb,
+ GNUNET_ECRS_DownloadProgressCallback dpcb,
void *dpcbClosure,
- ECRS_TestTerminate tt, void *ttClosure)
+ GNUNET_ECRS_TestTerminate tt, void *ttClosure)
{
IOContext ioc;
RequestManager *rm;
@@ -1358,11 +1358,11 @@
struct stat buf;
#if DEBUG_DOWNLOAD
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"`%s' running for file `%s'\n", __FUNCTION__, filename);
#endif
- GE_ASSERT (ectx, filename != NULL);
+ GNUNET_GE_ASSERT (ectx, filename != NULL);
if ((filename[strlen (filename) - 1] == '/') ||
(filename[strlen (filename) - 1] == '\\'))
{
@@ -1408,7 +1408,7 @@
GNUNET_free (realFN);
return GNUNET_SYSERR;
}
- if (0 == ECRS_fileSize (uri))
+ if (0 == GNUNET_ECRS_uri_get_file_siz (uri))
{
ret = GNUNET_disk_file_open (ectx,
realFN,
@@ -1423,9 +1423,9 @@
}
fid = uri->data.fi;
- if ((!ECRS_isFileUri (uri)) && (!ECRS_isLocationUri (uri)))
+ if ((!GNUNET_ECRS_uri_test_chk (uri)) && (!GNUNET_ECRS_uri_test_loc (uri)))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_free (realFN);
return GNUNET_SYSERR;
}
@@ -1436,8 +1436,8 @@
GNUNET_ntohll (fid.file_length), realFN))
{
#if DEBUG_DOWNLOAD
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"`%s' aborted for file `%s'\n", __FUNCTION__, realFN);
#endif
GNUNET_free (realFN);
@@ -1450,7 +1450,7 @@
GNUNET_free (realFN);
return GNUNET_SYSERR;
}
- if (ECRS_isLocationUri (uri))
+ if (GNUNET_ECRS_uri_test_loc (uri))
{
GNUNET_hash (&uri->data.loc.peer, sizeof (GNUNET_RSA_PublicKey),
&rm->target.hashPubKey);
@@ -1496,8 +1496,8 @@
else
{
#if 0
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
"Download ends prematurely: %d %llu == %llu %d TT: %d\n",
rm->requestListIndex,
ctx.completed, ctx.total, rm->abortFlag, tt (ttClosure));
@@ -1514,8 +1514,8 @@
freeIOC (&ioc, GNUNET_YES);
if (0 != UNLINK (realFN))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK,
"unlink", realFN);
}
else
@@ -1540,8 +1540,8 @@
freeIOC (&ioc, GNUNET_NO); /* aborted */
}
#if DEBUG_DOWNLOAD
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"`%s' terminating for file `%s' with result %s\n",
__FUNCTION__, filename,
ret == GNUNET_OK ? "SUCCESS" : "INCOMPLETE");
Modified: GNUnet/src/applications/fs/ecrs/downloadtest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/downloadtest.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/ecrs/downloadtest.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -31,7 +31,7 @@
#include "gnunet_util_network_client.h"
#include "tree.h"
-#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GE_BREAK(NULL, 0); goto FAILURE; }
+#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GNUNET_GE_BREAK(NULL, 0); goto
FAILURE; }
/**
* Must be a multiple of 16k.
@@ -58,7 +58,7 @@
}
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static char *
makeName (unsigned int i)
@@ -73,14 +73,14 @@
return fn;
}
-static struct ECRS_URI *
+static struct GNUNET_ECRS_URI *
uploadFile (unsigned int size)
{
int ret;
char *name;
int fd;
char *buf;
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
int i;
name = makeName (size);
@@ -95,7 +95,7 @@
WRITE (fd, buf, size);
GNUNET_free (buf);
CLOSE (fd);
- ret = ECRS_uploadFile (NULL, cfg, name, GNUNET_YES, /* index */
+ ret = GNUNET_ECRS_file_upload (NULL, cfg, name, GNUNET_YES, /* index */
0, /* anon */
0, /* prio */
GNUNET_get_time () + 10 * GNUNET_CRON_MINUTES, /*
expire */
@@ -106,7 +106,7 @@
}
static int
-downloadFile (unsigned int size, const struct ECRS_URI *uri)
+downloadFile (unsigned int size, const struct GNUNET_ECRS_URI *uri)
{
int ret;
char *tmpName;
@@ -117,16 +117,16 @@
int j;
char *tmp;
- tmp = ECRS_uriToString (uri);
- GE_LOG (NULL,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ tmp = GNUNET_ECRS_uri_to_string (uri);
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Starting download of `%s'\n", tmp);
GNUNET_free (tmp);
tmpName = makeName (0);
ret = GNUNET_SYSERR;
for (j = SIZE - 16 * 1024; j >= 0; j -= 16 * 1024)
{
- if (GNUNET_OK == ECRS_downloadPartialFile (NULL,
+ if (GNUNET_OK == GNUNET_ECRS_file_download_partial (NULL,
cfg,
uri,
tmpName,
@@ -168,7 +168,7 @@
char *name;
name = makeName (size);
- ret = ECRS_unindexFile (NULL, cfg, name, NULL, NULL, &testTerminate, NULL);
+ ret = GNUNET_ECRS_file_uninde (NULL, cfg, name, NULL, NULL, &testTerminate,
NULL);
if (0 != UNLINK (name))
ret = GNUNET_SYSERR;
GNUNET_free (name);
@@ -181,16 +181,16 @@
pid_t daemon;
int ok;
struct GNUNET_ClientServerConnection *sock;
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
daemon = GNUNET_daemon_start (NULL, cfg, "peer.conf", GNUNET_NO);
- GE_ASSERT (NULL, daemon > 0);
+ GNUNET_GE_ASSERT (NULL, daemon > 0);
sock = NULL;
CHECK (GNUNET_OK ==
GNUNET_wait_for_daemon_running (NULL, cfg,
@@ -204,7 +204,7 @@
uri = uploadFile (SIZE);
CHECK (NULL != uri);
CHECK (GNUNET_OK == downloadFile (SIZE, uri));
- ECRS_freeUri (uri);
+ GNUNET_ECRS_uri_destroy (uri);
CHECK (GNUNET_OK == unindexFile (SIZE));
fprintf (stderr, " Ok.\n");
@@ -213,8 +213,8 @@
FAILURE:
if (sock != NULL)
GNUNET_client_connection_destroy (sock);
- GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
- GC_free (cfg);
+ GNUNET_GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
+ GNUNET_GC_free (cfg);
return (ok == GNUNET_YES) ? 0 : 1;
}
Modified: GNUnet/src/applications/fs/ecrs/ecrs.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/ecrs.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs/ecrs.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -30,7 +30,7 @@
#include "ecrs.h"
void
-ECRS_encryptInPlace (const GNUNET_HashCode * hc, void *data, unsigned int len)
+GNUNET_ECRS_encryptInPlace (const GNUNET_HashCode * hc, void *data, unsigned
int len)
{
char *tmp;
GNUNET_AES_SessionKey skey;
@@ -38,13 +38,13 @@
GNUNET_hash_to_AES_key (hc, &skey, &iv);
tmp = GNUNET_malloc (len);
- GE_ASSERT (NULL, len == GNUNET_AES_encrypt (data, len, &skey, &iv, tmp));
+ GNUNET_GE_ASSERT (NULL, len == GNUNET_AES_encrypt (data, len, &skey, &iv,
tmp));
memcpy (data, tmp, len);
GNUNET_free (tmp);
}
void
-ECRS_decryptInPlace (const GNUNET_HashCode * hc, void *data, unsigned int len)
+GNUNET_ECRS_decryptInPlace (const GNUNET_HashCode * hc, void *data, unsigned
int len)
{
char *tmp;
GNUNET_AES_SessionKey skey;
@@ -52,7 +52,7 @@
GNUNET_hash_to_AES_key (hc, &skey, &iv);
tmp = GNUNET_malloc (len);
- GE_ASSERT (NULL, len == GNUNET_AES_decrypt (&skey, data, len, &iv, tmp));
+ GNUNET_GE_ASSERT (NULL, len == GNUNET_AES_decrypt (&skey, data, len, &iv,
tmp));
memcpy (data, tmp, len);
GNUNET_free (tmp);
}
Modified: GNUnet/src/applications/fs/ecrs/ecrs.h
===================================================================
--- GNUnet/src/applications/fs/ecrs/ecrs.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs/ecrs.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -24,8 +24,8 @@
* @author Igor Wronsky, Christian Grothoff
*/
-#ifndef ECRS_H
-#define ECRS_H
+#ifndef GNUNET_ECRS_H
+#define GNUNET_ECRS_H
#include "ecrs_core.h"
#include "tree.h"
@@ -39,8 +39,8 @@
* are interpreted as durations (in seconds) for periodical
* updates.
*/
-#define SBLOCK_UPDATE_SPORADIC ECRS_SBLOCK_UPDATE_SPORADIC
-#define SBLOCK_UPDATE_NONE ECRS_SBLOCK_UPDATE_NONE
+#define SBLOCK_UPDATE_SPORADIC GNUNET_ECRS_SBLOCK_UPDATE_SPORADIC
+#define SBLOCK_UPDATE_NONE GNUNET_ECRS_SBLOCK_UPDATE_NONE
#define BLOCK_ALIGN_SIZE (DBLOCK_SIZE)
@@ -75,7 +75,7 @@
enum uri_types
{ chk, sks, ksk, loc };
-typedef struct ECRS_URI
+typedef struct GNUNET_ECRS_URI
{
enum uri_types type;
union
@@ -104,17 +104,17 @@
/**
* Meta data to associate with a file, directory or namespace.
*/
-typedef struct ECRS_MetaData
+typedef struct GNUNET_ECRS_MetaData
{
unsigned int itemCount;
Item *items;
} MetaData;
-void ECRS_encryptInPlace (const GNUNET_HashCode * hc,
+void GNUNET_ECRS_encryptInPlace (const GNUNET_HashCode * hc,
void *data, unsigned int len);
-void ECRS_decryptInPlace (const GNUNET_HashCode * hc,
+void GNUNET_ECRS_decryptInPlace (const GNUNET_HashCode * hc,
void *data, unsigned int len);
Modified: GNUnet/src/applications/fs/ecrs/ecrstest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/ecrstest.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs/ecrstest.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -31,7 +31,7 @@
#include "gnunet_util_network_client.h"
#include "tree.h"
-#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GE_BREAK(NULL, 0); goto FAILURE; }
+#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GNUNET_GE_BREAK(NULL, 0); goto
FAILURE; }
static int
testTerminate (void *unused)
@@ -39,7 +39,7 @@
return GNUNET_OK;
}
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static char *
makeName (unsigned int i)
@@ -54,14 +54,14 @@
return fn;
}
-static struct ECRS_URI *
+static struct GNUNET_ECRS_URI *
uploadFile (unsigned int size)
{
int ret;
char *name;
int fd;
char *buf;
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
int i;
name = makeName (size);
@@ -76,7 +76,7 @@
WRITE (fd, buf, size);
GNUNET_free (buf);
CLOSE (fd);
- ret = ECRS_uploadFile (NULL, cfg, name, GNUNET_YES, /* index */
+ ret = GNUNET_ECRS_file_upload (NULL, cfg, name, GNUNET_YES, /* index */
0, /* anon */
0, /* prio */
GNUNET_get_time () + 10 * GNUNET_CRON_MINUTES, /*
expire */
@@ -84,19 +84,19 @@
NULL, &testTerminate, NULL, &uri);
if (ret != GNUNET_SYSERR)
{
- struct ECRS_MetaData *meta;
- struct ECRS_URI *key;
+ struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_ECRS_URI *key;
const char *keywords[2];
keywords[0] = name;
keywords[1] = NULL;
- meta = ECRS_createMetaData ();
- key = ECRS_keywordsToUri (keywords);
- ret = ECRS_addToKeyspace (NULL, cfg, key, 0, 0, GNUNET_get_time () + 10
* GNUNET_CRON_MINUTES, /* expire */
+ meta = GNUNET_ECRS_meta_data_create ();
+ key = GNUNET_ECRS_keyword_strings_to_uri (keywords);
+ ret = GNUNET_ECRS_publish_under_keyword (NULL, cfg, key, 0, 0,
GNUNET_get_time () + 10 * GNUNET_CRON_MINUTES, /* expire */
uri, meta);
- ECRS_freeMetaData (meta);
- ECRS_freeUri (uri);
+ GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_ECRS_uri_destroy (uri);
GNUNET_free (name);
if (ret == GNUNET_OK)
{
@@ -104,7 +104,7 @@
}
else
{
- ECRS_freeUri (key);
+ GNUNET_ECRS_uri_destroy (key);
return NULL;
}
}
@@ -116,18 +116,18 @@
}
static int
-searchCB (const ECRS_FileInfo * fi,
+searchCB (const GNUNET_ECRS_FileInfo * fi,
const GNUNET_HashCode * key, int isRoot, void *closure)
{
- struct ECRS_URI **my = closure;
+ struct GNUNET_ECRS_URI **my = closure;
char *tmp;
- tmp = ECRS_uriToString (fi->uri);
- GE_LOG (NULL,
- GE_DEBUG | GE_REQUEST | GE_USER, "Search found URI `%s'\n", tmp);
+ tmp = GNUNET_ECRS_uri_to_string (fi->uri);
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, "Search found
URI `%s'\n", tmp);
GNUNET_free (tmp);
- GE_ASSERT (NULL, NULL == *my);
- *my = ECRS_dupUri (fi->uri);
+ GNUNET_GE_ASSERT (NULL, NULL == *my);
+ *my = GNUNET_ECRS_uri_duplicate (fi->uri);
return GNUNET_SYSERR; /* abort search */
}
@@ -136,19 +136,19 @@
* @return GNUNET_OK on success
*/
static int
-searchFile (struct ECRS_URI **uri)
+searchFile (struct GNUNET_ECRS_URI **uri)
{
int ret;
- struct ECRS_URI *myURI;
+ struct GNUNET_ECRS_URI *myURI;
myURI = NULL;
- ret = ECRS_search (NULL,
+ ret = GNUNET_ECRS_search (NULL,
cfg,
*uri,
0,
15 * GNUNET_CRON_SECONDS,
&searchCB, &myURI, &testTerminate, NULL);
- ECRS_freeUri (*uri);
+ GNUNET_ECRS_uri_destroy (*uri);
*uri = myURI;
if ((ret != GNUNET_SYSERR) && (myURI != NULL))
return GNUNET_OK;
@@ -157,7 +157,7 @@
}
static int
-downloadFile (unsigned int size, const struct ECRS_URI *uri)
+downloadFile (unsigned int size, const struct GNUNET_ECRS_URI *uri)
{
int ret;
char *tmpName;
@@ -167,14 +167,14 @@
int i;
char *tmp;
- tmp = ECRS_uriToString (uri);
- GE_LOG (NULL,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ tmp = GNUNET_ECRS_uri_to_string (uri);
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Starting download of `%s'\n", tmp);
GNUNET_free (tmp);
tmpName = makeName (0);
ret = GNUNET_SYSERR;
- if (GNUNET_OK == ECRS_downloadFile (NULL,
+ if (GNUNET_OK == GNUNET_ECRS_file_download (NULL,
cfg,
uri,
tmpName, 0, NULL, NULL, &testTerminate,
@@ -210,7 +210,7 @@
char *name;
name = makeName (size);
- ret = ECRS_unindexFile (NULL, cfg, name, NULL, NULL, &testTerminate, NULL);
+ ret = GNUNET_ECRS_file_uninde (NULL, cfg, name, NULL, NULL, &testTerminate,
NULL);
if (0 != UNLINK (name))
ret = GNUNET_SYSERR;
GNUNET_free (name);
@@ -238,17 +238,17 @@
pid_t daemon;
int ok;
struct GNUNET_ClientServerConnection *sock;
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
int i;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
daemon = GNUNET_daemon_start (NULL, cfg, "peer.conf", GNUNET_NO);
- GE_ASSERT (NULL, daemon > 0);
+ GNUNET_GE_ASSERT (NULL, daemon > 0);
sock = NULL;
CHECK (GNUNET_OK ==
GNUNET_wait_for_daemon_running (NULL, cfg,
@@ -267,7 +267,7 @@
CHECK (NULL != uri);
CHECK (GNUNET_OK == searchFile (&uri));
CHECK (GNUNET_OK == downloadFile (filesizes[i], uri));
- ECRS_freeUri (uri);
+ GNUNET_ECRS_uri_destroy (uri);
CHECK (GNUNET_OK == unindexFile (filesizes[i]));
fprintf (stderr, " Ok.\n");
i++;
@@ -277,8 +277,8 @@
FAILURE:
if (sock != NULL)
GNUNET_client_connection_destroy (sock);
- GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
- GC_free (cfg);
+ GNUNET_GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
+ GNUNET_GC_free (cfg);
return (ok == GNUNET_YES) ? 0 : 1;
}
Modified: GNUnet/src/applications/fs/ecrs/helper.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/helper.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs/helper.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -36,19 +36,19 @@
* @return an ECRS URI for the given keywords, NULL
* if keywords is not legal (i.e. empty).
*/
-struct ECRS_URI *
-ECRS_parseCharKeywordURI (struct GE_Context *ectx, const char *input)
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_keyword_string_to_uri (struct GNUNET_GE_Context *ectx, const char
*input)
{
char **keywords;
unsigned int num_Words;
int inWord;
char *c;
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
char *searchString;
if (input == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return NULL;
}
searchString = GNUNET_strdup (input);
@@ -69,8 +69,8 @@
if (num_Words == 0)
{
GNUNET_free_non_null (searchString);
- GE_LOG (ectx,
- GE_ERROR | GE_IMMEDIATE | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_IMMEDIATE | GNUNET_GE_USER,
_("No keywords specified!\n"));
return NULL;
}
@@ -90,7 +90,7 @@
++num_Words;
}
}
- uri = ECRS_parseArgvKeywordURI (ectx, num_Words, (const char **) keywords);
+ uri = GNUNET_ECRS_keyword_command_line_to_uri (ectx, num_Words, (const char
**) keywords);
GNUNET_free (keywords);
GNUNET_free (searchString);
return uri;
@@ -104,22 +104,22 @@
* @return an ECRS URI for the given keywords, NULL
* if keywords is not legal (i.e. empty).
*/
-struct ECRS_URI *
-ECRS_parseArgvKeywordURI (struct GE_Context *ectx,
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_keyword_command_line_to_uri (struct GNUNET_GE_Context *ectx,
unsigned int num_keywords, const char **keywords)
{
unsigned int i;
unsigned int uriLen;
char *uriString;
unsigned int uriSize;
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
uriString = NULL;
uriSize = 0;
GNUNET_array_grow (uriString, uriSize, 4096);
- strcpy (uriString, ECRS_URI_PREFIX);
- strcat (uriString, ECRS_SEARCH_INFIX);
- uriLen = 1 + strlen (ECRS_URI_PREFIX) + strlen (ECRS_SEARCH_INFIX);
+ strcpy (uriString, GNUNET_ECRS_URI_PREFIX);
+ strcat (uriString, GNUNET_ECRS_SEARCH_INFIX);
+ uriLen = 1 + strlen (GNUNET_ECRS_URI_PREFIX) + strlen
(GNUNET_ECRS_SEARCH_INFIX);
for (i = 0; i < num_keywords; i++)
@@ -145,7 +145,7 @@
uriLen += strlen (keywords[i]);
}
}
- uri = ECRS_stringToUri (ectx, uriString);
+ uri = GNUNET_ECRS_string_to_uri (ectx, uriString);
GNUNET_array_grow (uriString, uriSize, 0);
return uri;
}
@@ -158,22 +158,22 @@
* @return an ECRS URI for the given keywords, NULL
* if keywords is not legal (i.e. empty).
*/
-struct ECRS_URI *
-ECRS_parseListKeywordURI (struct GE_Context *ectx,
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_keyword_list_to_uri (struct GNUNET_GE_Context *ectx,
unsigned int num_keywords, const char **keywords)
{
unsigned int i;
unsigned int uriLen;
char *uriString;
unsigned int uriSize;
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
uriString = NULL;
uriSize = 0;
GNUNET_array_grow (uriString, uriSize, 4096);
- strcpy (uriString, ECRS_URI_PREFIX);
- strcat (uriString, ECRS_SEARCH_INFIX);
- uriLen = 1 + strlen (ECRS_URI_PREFIX) + strlen (ECRS_SEARCH_INFIX);
+ strcpy (uriString, GNUNET_ECRS_URI_PREFIX);
+ strcat (uriString, GNUNET_ECRS_SEARCH_INFIX);
+ uriLen = 1 + strlen (GNUNET_ECRS_URI_PREFIX) + strlen
(GNUNET_ECRS_SEARCH_INFIX);
for (i = 0; i < num_keywords; i++)
@@ -189,7 +189,7 @@
strcat (uriString, keywords[i]);
uriLen += strlen (keywords[i]);
}
- uri = ECRS_stringToUri (ectx, uriString);
+ uri = GNUNET_ECRS_string_to_uri (ectx, uriString);
GNUNET_array_grow (uriString, uriSize, 0);
return uri;
}
Modified: GNUnet/src/applications/fs/ecrs/indexinfo.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/indexinfo.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs/indexinfo.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -39,8 +39,8 @@
* be notified that 'something is wrong')
*/
int
-ECRS_isFileIndexed (struct GE_Context *ectx,
- struct GC_Configuration *cfg, const char *filename)
+GNUNET_ECRS_file_test_indexed (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg, const char *filename)
{
GNUNET_HashCode hc;
struct GNUNET_ClientServerConnection *sock;
@@ -51,15 +51,15 @@
sock = GNUNET_client_connection_create (ectx, cfg);
if (sock == NULL)
return GNUNET_SYSERR;
- ret = FS_testIndexed (sock, &hc);
+ ret = GNUNET_FS_test_indexed (sock, &hc);
GNUNET_client_connection_destroy (sock);
return ret;
}
struct iiC
{
- struct GE_Context *ectx;
- ECRS_FileIterator iterator;
+ struct GNUNET_GE_Context *ectx;
+ GNUNET_ECRS_FileProcessor iterator;
void *closure;
int cnt;
};
@@ -97,8 +97,8 @@
}
if (errno != EINVAL)
{
- GE_LOG_STRERROR_FILE (cls->ectx,
- GE_WARNING | GE_BULK | GE_ADMIN | GE_USER,
+ GNUNET_GE_LOG_STRERROR_FILE (cls->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK |
GNUNET_GE_ADMIN | GNUNET_GE_USER,
"readlink", fullName);
}
GNUNET_free (lnkName);
@@ -137,9 +137,9 @@
* @return number of files indexed, GNUNET_SYSERR if iterator aborted
*/
int
-ECRS_iterateIndexedFiles (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- ECRS_FileIterator iterator, void *closure)
+GNUNET_ECRS_get_indexed_files (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ GNUNET_ECRS_FileProcessor iterator, void *closure)
{
char *tmp;
char *indexDirectory;
Modified: GNUnet/src/applications/fs/ecrs/keyspace.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/keyspace.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs/keyspace.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -52,11 +52,11 @@
* @return GNUNET_SYSERR if the entry is malformed
*/
static int
-verifyKBlock (struct GE_Context *ectx,
- const GNUNET_HashCode * key, Datastore_Value * value)
+verifyKBlock (struct GNUNET_GE_Context *ectx,
+ const GNUNET_HashCode * key, GNUNET_DatastoreValue * value)
{
unsigned int type;
- ECRS_FileInfo fi;
+ GNUNET_ECRS_FileInfo fi;
unsigned int size;
GNUNET_HashCode query;
KBlock *kb;
@@ -64,42 +64,42 @@
int j;
type = ntohl (value->type);
- size = ntohl (value->size) - sizeof (Datastore_Value);
+ size = ntohl (value->size) - sizeof (GNUNET_DatastoreValue);
if (GNUNET_OK !=
getQueryFor (size, (DBlock *) & value[1], GNUNET_YES, &query))
return GNUNET_SYSERR;
- GE_ASSERT (ectx, type == K_BLOCK);
+ GNUNET_GE_ASSERT (ectx, type == GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD);
if (size < sizeof (KBlock))
return GNUNET_SYSERR;
kb = (KBlock *) & value[1];
- ECRS_decryptInPlace (key, &kb[1], size - sizeof (KBlock));
+ GNUNET_ECRS_decryptInPlace (key, &kb[1], size - sizeof (KBlock));
j = sizeof (KBlock);
while ((j < size) && (((const char *) kb)[j] != '\0'))
j++;
if (j == size)
{
- GE_BREAK (NULL, 0); /* kblock malformed */
+ GNUNET_GE_BREAK (NULL, 0); /* kblock malformed */
return GNUNET_SYSERR;
}
dstURI = (const char *) &kb[1];
j++;
- fi.meta = ECRS_deserializeMetaData (ectx,
+ fi.meta = GNUNET_ECRS_meta_data_deserialize (ectx,
&((const char *) kb)[j], size - j);
if (fi.meta == NULL)
{
- GE_BREAK (ectx, 0); /* kblock malformed */
+ GNUNET_GE_BREAK (ectx, 0); /* kblock malformed */
return GNUNET_SYSERR;
}
- fi.uri = ECRS_stringToUri (ectx, dstURI);
+ fi.uri = GNUNET_ECRS_string_to_uri (ectx, dstURI);
if (fi.uri == NULL)
{
- GE_BREAK (ectx, 0); /* kblock malformed */
- ECRS_freeMetaData (fi.meta);
+ GNUNET_GE_BREAK (ectx, 0); /* kblock malformed */
+ GNUNET_ECRS_meta_data_destroy (fi.meta);
return GNUNET_SYSERR;
}
- ECRS_freeUri (fi.uri);
- ECRS_freeMetaData (fi.meta);
+ GNUNET_ECRS_uri_destroy (fi.uri);
+ GNUNET_ECRS_meta_data_destroy (fi.meta);
return GNUNET_OK;
}
@@ -116,17 +116,17 @@
* entry?
*/
int
-ECRS_addToKeyspace (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- const struct ECRS_URI *uri,
+GNUNET_ECRS_publish_under_keyword (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const struct GNUNET_ECRS_URI *uri,
unsigned int anonymityLevel,
unsigned int priority,
GNUNET_CronTime expirationTime,
- const struct ECRS_URI *dst,
- const struct ECRS_MetaData *md)
+ const struct GNUNET_ECRS_URI *dst,
+ const struct GNUNET_ECRS_MetaData *md)
{
struct GNUNET_ClientServerConnection *sock;
- Datastore_Value *value;
+ GNUNET_DatastoreValue *value;
int ret;
unsigned int size;
unsigned int mdsize;
@@ -144,32 +144,32 @@
#endif
GNUNET_HashCode key;
char *cpy; /* copy of the encrypted portion */
- struct ECRS_URI *xuri;
+ struct GNUNET_ECRS_URI *xuri;
- if (!ECRS_isKeywordUri (uri))
+ if (!GNUNET_ECRS_uri_test_ksk (uri))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
- mdsize = ECRS_sizeofMetaData (md, ECRS_SERIALIZE_PART);
- dstURI = ECRS_uriToString (dst);
+ mdsize = GNUNET_ECRS_meta_data_get_serialized_size (md,
GNUNET_ECRS_SERIALIZE_PART);
+ dstURI = GNUNET_ECRS_uri_to_string (dst);
size = mdsize + sizeof (KBlock) + strlen (dstURI) + 1;
if (size > MAX_KBLOCK_SIZE)
{
size = MAX_KBLOCK_SIZE;
- value = GNUNET_malloc (sizeof (Datastore_Value) + size);
+ value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
kb = (KBlock *) & value[1];
- kb->type = htonl (K_BLOCK);
+ kb->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD);
memcpy (&kb[1], dstURI, strlen (dstURI) + 1);
mdsize = size - sizeof (KBlock) - strlen (dstURI) - 1;
- mdsize = ECRS_serializeMetaData (ectx,
+ mdsize = GNUNET_ECRS_meta_data_serialize (ectx,
md,
&((char *) &kb[1])[strlen (dstURI) +
1], mdsize,
- ECRS_SERIALIZE_PART);
+ GNUNET_ECRS_SERIALIZE_PART);
if (mdsize == -1)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_free (dstURI);
return GNUNET_SYSERR;
}
@@ -177,33 +177,33 @@
}
else
{
- value = GNUNET_malloc (sizeof (Datastore_Value) + size);
+ value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
kb = (KBlock *) & value[1];
- kb->type = htonl (K_BLOCK);
+ kb->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD);
memcpy (&kb[1], dstURI, strlen (dstURI) + 1);
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
mdsize ==
- ECRS_serializeMetaData (ectx,
+ GNUNET_ECRS_meta_data_serialize (ectx,
md,
&((char *) &kb[1])[strlen (dstURI) +
1], mdsize,
- ECRS_SERIALIZE_FULL));
+ GNUNET_ECRS_SERIALIZE_FULL));
}
- value->size = htonl (sizeof (Datastore_Value) + size);
- value->type = htonl (K_BLOCK);
+ value->size = htonl (sizeof (GNUNET_DatastoreValue) + size);
+ value->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD);
value->prio = htonl (priority);
value->anonymityLevel = htonl (anonymityLevel);
value->expirationTime = GNUNET_htonll (expirationTime);
sock = GNUNET_client_connection_create (ectx, cfg);
ret = GNUNET_OK;
- if (GC_get_configuration_value_yesno (cfg,
+ if (GNUNET_GC_get_configuration_value_yesno (cfg,
"FS",
"DISABLE-CREATION-TIME",
GNUNET_NO) == GNUNET_YES)
- xuri = ECRS_dupUri (uri);
+ xuri = GNUNET_ECRS_uri_duplicate (uri);
else
- xuri = ECRS_dateExpandKeywordUri (uri);
+ xuri = GNUNET_ECRS_uri_expand_keywords_with_date (uri);
keywords = xuri->data.ksk.keywords;
keywordCount = xuri->data.ksk.keywordCount;
cpy = GNUNET_malloc (mdsize + strlen (dstURI) + 1);
@@ -213,32 +213,32 @@
memcpy (&kb[1], cpy, mdsize + strlen (dstURI) + 1);
GNUNET_hash (keywords[i], strlen (keywords[i]), &key);
#if DEBUG_KEYSPACE
- IF_GELOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&key, &enc));
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"Encrypting KBlock with key %s.\n", &enc);
#endif
- ECRS_encryptInPlace (&key, &kb[1], mdsize + strlen (dstURI) + 1);
+ GNUNET_ECRS_encryptInPlace (&key, &kb[1], mdsize + strlen (dstURI) + 1);
pk = GNUNET_RSA_create_key_from_hash (&key);
GNUNET_RSA_get_public_key (pk, &kb->keyspace);
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_OK == GNUNET_RSA_sign (pk,
mdsize + strlen (dstURI) + 1,
&kb[1], &kb->signature));
#if EXTRA_CHECKS
/* extra check: verify sig */
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_OK == getQueryFor (size, (DBlock *) kb, GNUNET_YES,
&hc));
#endif
GNUNET_RSA_free_key (pk);
- if (GNUNET_OK != FS_insert (sock, value))
+ if (GNUNET_OK != GNUNET_FS_insert (sock, value))
ret = GNUNET_SYSERR;
#if EXTRA_CHECKS
- GE_ASSERT (ectx, GNUNET_OK == verifyKBlock (ectx, &key, value))
+ GNUNET_GE_ASSERT (ectx, GNUNET_OK == verifyKBlock (ectx, &key, value))
#endif
}
- ECRS_freeUri (xuri);
+ GNUNET_ECRS_uri_destroy (xuri);
GNUNET_free (cpy);
GNUNET_free (dstURI);
GNUNET_client_connection_destroy (sock);
Modified: GNUnet/src/applications/fs/ecrs/meta.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/meta.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs/meta.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -35,7 +35,7 @@
* Create a fresh MetaData token.
*/
MetaData *
-ECRS_createMetaData ()
+GNUNET_ECRS_meta_data_create ()
{
MetaData *ret;
ret = GNUNET_malloc (sizeof (MetaData));
@@ -48,7 +48,7 @@
* Free meta data.
*/
void
-ECRS_freeMetaData (MetaData * md)
+GNUNET_ECRS_meta_data_destroy (MetaData * md)
{
int i;
for (i = 0; i < md->itemCount; i++)
@@ -62,15 +62,15 @@
* to the meta-data.
*/
void
-ECRS_addPublicationDateToMetaData (MetaData * md)
+GNUNET_ECRS_meta_data_add_publication_date (MetaData * md)
{
char *dat;
GNUNET_Int32Time t;
GNUNET_get_time_int32 (&t);
- ECRS_delFromMetaData (md, EXTRACTOR_PUBLICATION_DATE, NULL);
+ GNUNET_ECRS_meta_data_delete (md, EXTRACTOR_PUBLICATION_DATE, NULL);
dat = GNUNET_int32_time_to_string (&t);
- ECRS_addToMetaData (md, EXTRACTOR_PUBLICATION_DATE, dat);
+ GNUNET_ECRS_meta_data_inser (md, EXTRACTOR_PUBLICATION_DATE, dat);
GNUNET_free (dat);
}
@@ -79,12 +79,12 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if this entry already exists
*/
int
-ECRS_addToMetaData (MetaData * md,
+GNUNET_ECRS_meta_data_inser (MetaData * md,
EXTRACTOR_KeywordType type, const char *data)
{
int idx;
- GE_ASSERT (NULL, data != NULL);
+ GNUNET_GE_ASSERT (NULL, data != NULL);
for (idx = 0; idx < md->itemCount; idx++)
{
if ((md->items[idx].type == type) &&
@@ -103,7 +103,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist in md
*/
int
-ECRS_delFromMetaData (MetaData * md,
+GNUNET_ECRS_meta_data_delete (MetaData * md,
EXTRACTOR_KeywordType type, const char *data)
{
int idx;
@@ -133,8 +133,8 @@
* @return number of entries
*/
int
-ECRS_getMetaData (const MetaData * md,
- ECRS_MetaDataIterator iterator, void *closure)
+GNUNET_ECRS_meta_data_get_contents (const MetaData * md,
+ GNUNET_ECRS_MetaDataProcessor iterator, void *closure)
{
int i;
int sub;
@@ -161,7 +161,7 @@
* @return number of entries
*/
char *
-ECRS_getFromMetaData (const MetaData * md, EXTRACTOR_KeywordType type)
+GNUNET_ECRS_meta_data_get_by_type (const MetaData * md, EXTRACTOR_KeywordType
type)
{
int i;
@@ -177,7 +177,7 @@
* @return number of entries
*/
char *
-ECRS_getFirstFromMetaData (const MetaData * md, ...)
+GNUNET_ECRS_meta_data_get_first_by_types (const MetaData * md, ...)
{
char *ret;
va_list args;
@@ -190,7 +190,7 @@
type = va_arg (args, EXTRACTOR_KeywordType);
if (type == -1)
break;
- ret = ECRS_getFromMetaData (md, type);
+ ret = GNUNET_ECRS_meta_data_get_by_type (md, type);
if (ret != NULL)
break;
}
@@ -252,14 +252,14 @@
* @return number of bytes in thumbnail, 0 if not available
*/
size_t
-ECRS_getThumbnailFromMetaData (const struct ECRS_MetaData * md,
+GNUNET_ECRS_meta_data_get_thumbnail (const struct GNUNET_ECRS_MetaData * md,
unsigned char **thumb)
{
char *encoded;
int ret;
size_t size;
- encoded = ECRS_getFromMetaData (md, EXTRACTOR_THUMBNAIL_DATA);
+ encoded = GNUNET_ECRS_meta_data_get_by_type (md, EXTRACTOR_THUMBNAIL_DATA);
if (encoded == NULL)
return 0;
if (strlen (encoded) == 0)
@@ -280,16 +280,16 @@
* Duplicate MetaData.
*/
MetaData *
-ECRS_dupMetaData (const MetaData * md)
+GNUNET_ECRS_meta_data_duplicate (const MetaData * md)
{
int i;
MetaData *ret;
if (md == NULL)
return NULL;
- ret = ECRS_createMetaData ();
+ ret = GNUNET_ECRS_meta_data_create ();
for (i = md->itemCount - 1; i >= 0; i--)
- ECRS_addToMetaData (ret, md->items[i].type, md->items[i].data);
+ GNUNET_ECRS_meta_data_inser (ret, md->items[i].type, md->items[i].data);
return ret;
}
@@ -300,7 +300,7 @@
* of meta-data items obtained
*/
int
-ECRS_extractMetaData (struct GE_Context *ectx,
+GNUNET_ECRS_meta_data_extract_from_file (struct GNUNET_GE_Context *ectx,
MetaData * md,
const char *filename,
EXTRACTOR_ExtractorList * extractors)
@@ -321,7 +321,7 @@
while (pos != NULL)
{
if (GNUNET_OK ==
- ECRS_addToMetaData (md, pos->keywordType, pos->keyword))
+ GNUNET_ECRS_meta_data_inser (md, pos->keywordType, pos->keyword))
ret++;
pos = pos->next;
}
@@ -435,7 +435,7 @@
* space)
*/
int
-ECRS_serializeMetaData (struct GE_Context *ectx,
+GNUNET_ECRS_meta_data_serialize (struct GNUNET_GE_Context *ectx,
const MetaData * md,
char *target, unsigned int max, int part)
{
@@ -474,7 +474,7 @@
}
hdr->size = htonl (size);
- if ((part & ECRS_SERIALIZE_NO_COMPRESS) == 0)
+ if ((part & GNUNET_ECRS_SERIALIZE_NO_COMPRESS) == 0)
{
pos = tryCompression ((char *) &hdr[1],
size - sizeof (MetaDataHeader));
@@ -493,7 +493,7 @@
GNUNET_free (hdr);
hdr = NULL;
- if ((part & ECRS_SERIALIZE_PART) == 0)
+ if ((part & GNUNET_ECRS_SERIALIZE_PART) == 0)
{
return GNUNET_SYSERR; /* does not fit! */
}
@@ -503,16 +503,16 @@
else
ic--; /* small steps, we're close */
}
- GE_ASSERT (ectx, size <= max);
+ GNUNET_GE_ASSERT (ectx, size <= max);
memcpy (target, hdr, size);
GNUNET_free (hdr);
/* extra check: deserialize! */
#if EXTRA_CHECKS
{
MetaData *mdx;
- mdx = ECRS_deserializeMetaData (ectx, target, size);
- GE_ASSERT (ectx, NULL != mdx);
- ECRS_freeMetaData (mdx);
+ mdx = GNUNET_ECRS_meta_data_deserialize (ectx, target, size);
+ GNUNET_GE_ASSERT (ectx, NULL != mdx);
+ GNUNET_ECRS_meta_data_destroy (mdx);
}
#endif
return size;
@@ -524,7 +524,7 @@
* than what is strictly needed.
*/
unsigned int
-ECRS_sizeofMetaData (const MetaData * md, int part)
+GNUNET_ECRS_meta_data_get_serialized_size (const MetaData * md, int part)
{
MetaDataHeader *hdr;
size_t size;
@@ -553,7 +553,7 @@
memcpy (&((char *) hdr)[pos], md->items[i].data, len);
pos += len;
}
- if ((part & ECRS_SERIALIZE_NO_COMPRESS) == 0)
+ if ((part & GNUNET_ECRS_SERIALIZE_NO_COMPRESS) == 0)
{
pos = tryCompression ((char *) &hdr[1], size - sizeof (MetaDataHeader));
}
@@ -575,8 +575,8 @@
* @return MD on success, NULL on error (i.e.
* bad format)
*/
-struct ECRS_MetaData *
-ECRS_deserializeMetaData (struct GE_Context *ectx,
+struct GNUNET_ECRS_MetaData *
+GNUNET_ECRS_meta_data_deserialize (struct GNUNET_GE_Context *ectx,
const char *input, unsigned int size)
{
MetaData *md;
@@ -602,7 +602,7 @@
dataSize = ntohl (MAKE_UNALIGNED (hdr->size)) - sizeof (MetaDataHeader);
if (dataSize > 2 * 1042 * 1024)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return NULL; /* only 2 MB allowed [to make sure we don't
blow
our memory limit because of a mal-formed
message... ] */
@@ -611,7 +611,7 @@
size - sizeof (MetaDataHeader), dataSize);
if (data == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return NULL;
}
}
@@ -621,23 +621,23 @@
dataSize = size - sizeof (MetaDataHeader);
if (size != ntohl (MAKE_UNALIGNED (hdr->size)))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return NULL;
}
}
if ((sizeof (unsigned int) * ic + ic) > dataSize)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
goto FAILURE;
}
if ((ic > 0) && (data[dataSize - 1] != '\0'))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
goto FAILURE;
}
- md = ECRS_createMetaData ();
+ md = GNUNET_ECRS_meta_data_create ();
GNUNET_array_grow (md->items, md->itemCount, ic);
i = 0;
pos = sizeof (unsigned int) * ic;
@@ -652,7 +652,7 @@
}
if (i < ic)
{ /* oops */
- ECRS_freeMetaData (md);
+ GNUNET_ECRS_meta_data_destroy (md);
goto FAILURE;
}
if (compressed)
@@ -669,7 +669,7 @@
* Checks if the mime-type is that of a GNUnet directory.
*/
int
-ECRS_isDirectory (const MetaData * md)
+GNUNET_ECRS_meta_data_test_for_directory (const MetaData * md)
{
int i;
@@ -758,7 +758,7 @@
* @return the new filename
*/
char *
-ECRS_suggestFilename (struct GE_Context *ectx, const char *filename)
+GNUNET_ECRS_suggest_better_filename (struct GNUNET_GE_Context *ectx, const
char *filename)
{
EXTRACTOR_ExtractorList *l;
EXTRACTOR_KeywordList *list;
@@ -797,7 +797,7 @@
while ((mimeMap[i][0] != NULL) && (0 != strcmp (mime, mimeMap[i][0])))
i++;
if (mimeMap[i][1] == NULL)
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"Did not find mime type `%s' in extension list.\n", mime);
mime = mimeMap[i][1];
}
@@ -873,7 +873,7 @@
if (0 != STAT (renameTo, &filestat))
{
if (0 != RENAME (filename, renameTo))
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("Renaming of file `%s' to `%s' failed: %s\n"),
filename, renameTo, STRERROR (errno));
else
@@ -881,7 +881,7 @@
}
else
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("Could not rename file `%s' to `%s': file exists\n"),
filename, renameTo);
}
@@ -897,8 +897,8 @@
* Test if two MDs are equal.
*/
int
-ECRS_equalsMetaData (const struct ECRS_MetaData *md1,
- const struct ECRS_MetaData *md2)
+GNUNET_ECRS_meta_data_test_equal (const struct GNUNET_ECRS_MetaData *md1,
+ const struct GNUNET_ECRS_MetaData *md2)
{
int i;
int j;
Modified: GNUnet/src/applications/fs/ecrs/metatest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/metatest.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs/metatest.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -30,64 +30,64 @@
#include "gnunet_ecrs_lib.h"
#include "ecrs.h"
-#define ABORT(m) { fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); if
(m != NULL) ECRS_freeMetaData(m); return 1; }
+#define ABORT(m) { fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); if
(m != NULL) GNUNET_ECRS_meta_data_destroy(m); return 1; }
static int
testMeta (int i)
{
- struct ECRS_MetaData *m;
+ struct GNUNET_ECRS_MetaData *m;
char *val;
int j;
unsigned int size;
- m = ECRS_createMetaData ();
- if (GNUNET_OK != ECRS_addToMetaData (m, EXTRACTOR_TITLE, "TestTitle"))
+ m = GNUNET_ECRS_meta_data_create ();
+ if (GNUNET_OK != GNUNET_ECRS_meta_data_inser (m, EXTRACTOR_TITLE,
"TestTitle"))
ABORT (m);
- if (GNUNET_OK != ECRS_addToMetaData (m, EXTRACTOR_AUTHOR, "TestTitle"))
+ if (GNUNET_OK != GNUNET_ECRS_meta_data_inser (m, EXTRACTOR_AUTHOR,
"TestTitle"))
ABORT (m);
- if (GNUNET_OK == ECRS_addToMetaData (m, EXTRACTOR_TITLE, "TestTitle"))
/* dup! */
+ if (GNUNET_OK == GNUNET_ECRS_meta_data_inser (m, EXTRACTOR_TITLE,
"TestTitle")) /* dup! */
ABORT (m);
- if (GNUNET_OK == ECRS_addToMetaData (m, EXTRACTOR_AUTHOR, "TestTitle"))
/* dup! */
+ if (GNUNET_OK == GNUNET_ECRS_meta_data_inser (m, EXTRACTOR_AUTHOR,
"TestTitle")) /* dup! */
ABORT (m);
- if (2 != ECRS_getMetaData (m, NULL, NULL))
+ if (2 != GNUNET_ECRS_meta_data_get_contents (m, NULL, NULL))
ABORT (m);
- if (GNUNET_OK != ECRS_delFromMetaData (m, EXTRACTOR_AUTHOR, "TestTitle"))
+ if (GNUNET_OK != GNUNET_ECRS_meta_data_delete (m, EXTRACTOR_AUTHOR,
"TestTitle"))
ABORT (m);
- if (GNUNET_OK == ECRS_delFromMetaData (m, EXTRACTOR_AUTHOR, "TestTitle"))
/* already gone */
+ if (GNUNET_OK == GNUNET_ECRS_meta_data_delete (m, EXTRACTOR_AUTHOR,
"TestTitle")) /* already gone */
ABORT (m);
- if (1 != ECRS_getMetaData (m, NULL, NULL))
+ if (1 != GNUNET_ECRS_meta_data_get_contents (m, NULL, NULL))
ABORT (m);
- if (GNUNET_OK != ECRS_delFromMetaData (m, EXTRACTOR_TITLE, "TestTitle"))
+ if (GNUNET_OK != GNUNET_ECRS_meta_data_delete (m, EXTRACTOR_TITLE,
"TestTitle"))
ABORT (m);
- if (GNUNET_OK == ECRS_delFromMetaData (m, EXTRACTOR_TITLE, "TestTitle"))
/* already gone */
+ if (GNUNET_OK == GNUNET_ECRS_meta_data_delete (m, EXTRACTOR_TITLE,
"TestTitle")) /* already gone */
ABORT (m);
- if (0 != ECRS_getMetaData (m, NULL, NULL))
+ if (0 != GNUNET_ECRS_meta_data_get_contents (m, NULL, NULL))
ABORT (m);
val = GNUNET_malloc (256);
for (j = 0; j < i; j++)
{
GNUNET_snprintf (val, 256, "%s.%d",
"A teststring that should compress well.", j);
- if (GNUNET_OK != ECRS_addToMetaData (m, EXTRACTOR_UNKNOWN, val))
+ if (GNUNET_OK != GNUNET_ECRS_meta_data_inser (m, EXTRACTOR_UNKNOWN, val))
{
GNUNET_free (val);
ABORT (m);
}
}
GNUNET_free (val);
- if (i != ECRS_getMetaData (m, NULL, NULL))
+ if (i != GNUNET_ECRS_meta_data_get_contents (m, NULL, NULL))
ABORT (m);
- size = ECRS_sizeofMetaData (m, ECRS_SERIALIZE_FULL);
+ size = GNUNET_ECRS_meta_data_get_serialized_size (m,
GNUNET_ECRS_SERIALIZE_FULL);
val = GNUNET_malloc (size);
- if (size != ECRS_serializeMetaData (NULL,
- m, val, size, ECRS_SERIALIZE_FULL))
+ if (size != GNUNET_ECRS_meta_data_serialize (NULL,
+ m, val, size,
GNUNET_ECRS_SERIALIZE_FULL))
{
GNUNET_free (val);
ABORT (m);
}
- ECRS_freeMetaData (m);
- m = ECRS_deserializeMetaData (NULL, val, size);
+ GNUNET_ECRS_meta_data_destroy (m);
+ m = GNUNET_ECRS_meta_data_deserialize (NULL, val, size);
GNUNET_free (val);
if (m == NULL)
ABORT (m);
@@ -96,47 +96,47 @@
{
GNUNET_snprintf (val, 256, "%s.%d",
"A teststring that should compress well.", j);
- if (GNUNET_OK != ECRS_delFromMetaData (m, EXTRACTOR_UNKNOWN, val))
+ if (GNUNET_OK != GNUNET_ECRS_meta_data_delete (m, EXTRACTOR_UNKNOWN,
val))
{
GNUNET_free (val);
ABORT (m);
}
}
GNUNET_free (val);
- if (0 != ECRS_getMetaData (m, NULL, NULL))
+ if (0 != GNUNET_ECRS_meta_data_get_contents (m, NULL, NULL))
{
ABORT (m);
}
- ECRS_freeMetaData (m);
+ GNUNET_ECRS_meta_data_destroy (m);
return 0;
}
int
testMetaMore (int i)
{
- struct ECRS_MetaData *meta;
+ struct GNUNET_ECRS_MetaData *meta;
int q;
char txt[128];
char *data;
unsigned long long size;
- meta = ECRS_createMetaData ();
+ meta = GNUNET_ECRS_meta_data_create ();
for (q = 0; q <= i; q++)
{
GNUNET_snprintf (txt, 128, "%u -- %u\n", i, q);
- ECRS_addToMetaData (meta,
+ GNUNET_ECRS_meta_data_inser (meta,
q % EXTRACTOR_getHighestKeywordTypeNumber (), txt);
}
- size = ECRS_sizeofMetaData (meta, ECRS_SERIALIZE_FULL);
+ size = GNUNET_ECRS_meta_data_get_serialized_size (meta,
GNUNET_ECRS_SERIALIZE_FULL);
data = GNUNET_malloc (size * 4);
- if (size != ECRS_serializeMetaData (NULL,
+ if (size != GNUNET_ECRS_meta_data_serialize (NULL,
meta,
- data, size * 4, ECRS_SERIALIZE_FULL))
+ data, size * 4,
GNUNET_ECRS_SERIALIZE_FULL))
{
GNUNET_free (data);
ABORT (meta);
}
- ECRS_freeMetaData (meta);
+ GNUNET_ECRS_meta_data_destroy (meta);
GNUNET_free (data);
return 0;
}
Modified: GNUnet/src/applications/fs/ecrs/metatest2.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/metatest2.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs/metatest2.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -35,36 +35,36 @@
static int
testMeta ()
{
- struct ECRS_MetaData *m;
+ struct GNUNET_ECRS_MetaData *m;
char *val;
unsigned int size;
- m = ECRS_createMetaData ();
- if (GNUNET_OK != ECRS_addToMetaData (m, EXTRACTOR_UNKNOWN, "link"))
+ m = GNUNET_ECRS_meta_data_create ();
+ if (GNUNET_OK != GNUNET_ECRS_meta_data_inser (m, EXTRACTOR_UNKNOWN, "link"))
{
- ECRS_freeMetaData (m);
+ GNUNET_ECRS_meta_data_destroy (m);
ABORT ();
}
- if (GNUNET_OK != ECRS_addToMetaData (m, EXTRACTOR_FILENAME, "lib-link.m4"))
+ if (GNUNET_OK != GNUNET_ECRS_meta_data_inser (m, EXTRACTOR_FILENAME,
"lib-link.m4"))
{
- ECRS_freeMetaData (m);
+ GNUNET_ECRS_meta_data_destroy (m);
ABORT ();
}
- size = ECRS_sizeofMetaData (m, ECRS_SERIALIZE_FULL);
+ size = GNUNET_ECRS_meta_data_get_serialized_size (m,
GNUNET_ECRS_SERIALIZE_FULL);
val = GNUNET_malloc (size);
- if (size != ECRS_serializeMetaData (NULL,
- m, val, size, ECRS_SERIALIZE_FULL))
+ if (size != GNUNET_ECRS_meta_data_serialize (NULL,
+ m, val, size,
GNUNET_ECRS_SERIALIZE_FULL))
{
- ECRS_freeMetaData (m);
+ GNUNET_ECRS_meta_data_destroy (m);
GNUNET_free (val);
ABORT ();
}
- ECRS_freeMetaData (m);
- m = ECRS_deserializeMetaData (NULL, val, size);
+ GNUNET_ECRS_meta_data_destroy (m);
+ m = GNUNET_ECRS_meta_data_deserialize (NULL, val, size);
GNUNET_free (val);
if (m == NULL)
ABORT ();
- ECRS_freeMetaData (m);
+ GNUNET_ECRS_meta_data_destroy (m);
return 0;
}
Modified: GNUnet/src/applications/fs/ecrs/namespace.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/namespace.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs/namespace.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -38,16 +38,16 @@
#define MAX_SBLOCK_SIZE 32000
static char *
-getPseudonymFileName (struct GE_Context *ectx,
- struct GC_Configuration *cfg, const char *name)
+getPseudonymFileName (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg, const char *name)
{
char *gnHome;
char *fileName;
- GC_get_configuration_value_filename (cfg,
+ GNUNET_GC_get_configuration_value_filename (cfg,
"GNUNET",
"GNUNET_HOME",
- GNUNET_HOME_DIRECTORY, &fileName);
+ GNUNET_DEFAULT_HOME_DIRECTORY,
&fileName);
gnHome = GNUNET_expand_file_name (ectx, fileName);
GNUNET_free (fileName);
fileName =
@@ -67,8 +67,8 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
int
-ECRS_deleteNamespace (struct GE_Context *ectx,
- struct GC_Configuration *cfg, const char *name)
+GNUNET_ECRS_namespace_delete (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg, const char *name)
{
char *fileName;
@@ -80,8 +80,8 @@
}
if (0 != UNLINK (fileName))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK,
"unlink", fileName);
GNUNET_free (fileName);
return GNUNET_SYSERR;
@@ -110,18 +110,18 @@
*
* @return GNUNET_OK on success, GNUNET_SYSERR on error (namespace already
exists)
*/
-struct ECRS_URI *
-ECRS_createNamespace (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_namespace_create (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *name,
- const struct ECRS_MetaData *meta,
+ const struct GNUNET_ECRS_MetaData *meta,
unsigned int anonymityLevel,
unsigned int priority,
GNUNET_CronTime expiration,
- const struct ECRS_URI *advertisementURI,
+ const struct GNUNET_ECRS_URI *advertisementURI,
const GNUNET_HashCode * rootEntry)
{
- struct ECRS_URI *rootURI;
+ struct GNUNET_ECRS_URI *rootURI;
char *fileName;
struct GNUNET_RSA_PrivateKey *hk;
GNUNET_RSA_PrivateKeyEncoded *hke;
@@ -129,8 +129,8 @@
unsigned short len;
GNUNET_HashCode hc;
struct GNUNET_ClientServerConnection *sock;
- Datastore_Value *value;
- Datastore_Value *knvalue;
+ GNUNET_DatastoreValue *value;
+ GNUNET_DatastoreValue *knvalue;
unsigned int size;
unsigned int mdsize;
struct GNUNET_RSA_PrivateKey *pk;
@@ -141,16 +141,16 @@
int i;
char *cpy;
- if ((advertisementURI != NULL) && (!ECRS_isKeywordUri (advertisementURI)))
+ if ((advertisementURI != NULL) && (!GNUNET_ECRS_uri_test_ksk
(advertisementURI)))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return NULL;
}
fileName = getPseudonymFileName (ectx, cfg, name);
if (GNUNET_YES == GNUNET_disk_file_test (ectx, fileName))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Cannot create pseudonym `%s', file `%s' exists.\n"),
name, fileName);
GNUNET_free (fileName);
@@ -166,23 +166,23 @@
/* create advertisements */
- mdsize = ECRS_sizeofMetaData (meta, ECRS_SERIALIZE_PART);
+ mdsize = GNUNET_ECRS_meta_data_get_serialized_size (meta,
GNUNET_ECRS_SERIALIZE_PART);
size = mdsize + sizeof (NBlock);
if (size > MAX_NBLOCK_SIZE)
{
size = MAX_NBLOCK_SIZE;
- value = GNUNET_malloc (sizeof (Datastore_Value) + size);
+ value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
nb = (NBlock *) & value[1];
- nb->type = htonl (N_BLOCK);
+ nb->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_NAMESPACE);
mdsize = size - sizeof (NBlock);
- mdsize = ECRS_serializeMetaData (ectx,
+ mdsize = GNUNET_ECRS_meta_data_serialize (ectx,
meta,
(char *) &nb[1],
- mdsize, ECRS_SERIALIZE_PART);
+ mdsize, GNUNET_ECRS_SERIALIZE_PART);
if (mdsize == -1)
{
- GE_BREAK (ectx, 0);
- ECRS_deleteNamespace (ectx, cfg, name);
+ GNUNET_GE_BREAK (ectx, 0);
+ GNUNET_ECRS_namespace_delete (ectx, cfg, name);
GNUNET_RSA_free_key (hk);
return NULL;
}
@@ -190,15 +190,15 @@
}
else
{
- value = GNUNET_malloc (sizeof (Datastore_Value) + size);
+ value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
nb = (NBlock *) & value[1];
- nb->type = htonl (N_BLOCK);
- ECRS_serializeMetaData (ectx,
+ nb->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_NAMESPACE);
+ GNUNET_ECRS_meta_data_serialize (ectx,
meta,
- (char *) &nb[1], mdsize, ECRS_SERIALIZE_FULL);
+ (char *) &nb[1], mdsize,
GNUNET_ECRS_SERIALIZE_FULL);
}
- value->size = htonl (sizeof (Datastore_Value) + size);
- value->type = htonl (N_BLOCK);
+ value->size = htonl (sizeof (GNUNET_DatastoreValue) + size);
+ value->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_NAMESPACE);
value->prio = htonl (priority);
value->anonymityLevel = htonl (anonymityLevel);
value->expirationTime = GNUNET_htonll (expiration);
@@ -215,31 +215,31 @@
nb->rootEntry = *rootEntry;
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_OK == GNUNET_RSA_sign (hk,
mdsize +
3 * sizeof (GNUNET_HashCode),
&nb->identifier, &nb->signature));
- if (GNUNET_OK != FS_insert (sock, value))
+ if (GNUNET_OK != GNUNET_FS_insert (sock, value))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_free (rootURI);
GNUNET_free (value);
GNUNET_client_connection_destroy (sock);
GNUNET_RSA_free_key (hk);
- ECRS_deleteNamespace (ectx, cfg, name);
+ GNUNET_ECRS_namespace_delete (ectx, cfg, name);
return NULL;
}
/* publish KNBlocks */
size += sizeof (KNBlock) - sizeof (NBlock);
- knvalue = GNUNET_malloc (sizeof (Datastore_Value) + size);
+ knvalue = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
*knvalue = *value;
- knvalue->type = htonl (KN_BLOCK);
- knvalue->size = htonl (sizeof (Datastore_Value) + size);
+ knvalue->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE);
+ knvalue->size = htonl (sizeof (GNUNET_DatastoreValue) + size);
knb = (KNBlock *) & knvalue[1];
- knb->type = htonl (KN_BLOCK);
+ knb->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE);
memcpy (&knb->nblock, nb, sizeof (NBlock) + mdsize);
if (advertisementURI != NULL)
@@ -254,25 +254,25 @@
GNUNET_hash (keywords[i], strlen (keywords[i]), &hc);
pk = GNUNET_RSA_create_key_from_hash (&hc);
GNUNET_RSA_get_public_key (pk, &knb->kblock.keyspace);
- GE_ASSERT (ectx, size - sizeof (KBlock) - sizeof (unsigned int)
+ GNUNET_GE_ASSERT (ectx, size - sizeof (KBlock) - sizeof (unsigned
int)
== sizeof (NBlock) + mdsize);
- ECRS_encryptInPlace (&hc,
+ GNUNET_ECRS_encryptInPlace (&hc,
&knb->nblock,
size - sizeof (KBlock) -
sizeof (unsigned int));
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_OK == GNUNET_RSA_sign (pk,
sizeof (NBlock) + mdsize,
&knb->nblock,
&knb->kblock.signature));
/* extra check: verify sig */
GNUNET_RSA_free_key (pk);
- if (GNUNET_OK != FS_insert (sock, knvalue))
+ if (GNUNET_OK != GNUNET_FS_insert (sock, knvalue))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_free (rootURI);
- ECRS_deleteNamespace (ectx, cfg, name);
+ GNUNET_ECRS_namespace_delete (ectx, cfg, name);
GNUNET_free (cpy);
GNUNET_free (knvalue);
GNUNET_free (value);
@@ -302,8 +302,8 @@
* @return GNUNET_OK if the namespace exists, GNUNET_SYSERR if not
*/
int
-ECRS_testNamespaceExists (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+GNUNET_ECRS_namespace_test_exists (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *name, const GNUNET_HashCode * hc)
{
struct GNUNET_RSA_PrivateKey *hk;
@@ -323,7 +323,7 @@
}
if (len < 2)
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("File `%s' does not contain a pseudonym.\n"), fileName);
GNUNET_free (fileName);
return GNUNET_SYSERR;
@@ -334,8 +334,8 @@
hke = (GNUNET_RSA_PrivateKeyEncoded *) dst;
if (ntohs (hke->len) != len)
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Format of pseudonym `%s' is invalid.\n"), name);
GNUNET_free (hke);
return GNUNET_SYSERR;
@@ -363,9 +363,9 @@
* @param md what meta-data should be associated with the
* entry?
*/
-struct ECRS_URI *
-ECRS_addToNamespace (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_namespace_add_content (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *name,
unsigned int anonymityLevel,
unsigned int priority,
@@ -374,12 +374,12 @@
GNUNET_Int32Time updateInterval,
const GNUNET_HashCode * thisId,
const GNUNET_HashCode * nextId,
- const struct ECRS_URI *dstU,
- const struct ECRS_MetaData *md)
+ const struct GNUNET_ECRS_URI *dstU,
+ const struct GNUNET_ECRS_MetaData *md)
{
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
struct GNUNET_ClientServerConnection *sock;
- Datastore_Value *value;
+ GNUNET_DatastoreValue *value;
unsigned int size;
unsigned int mdsize;
struct GNUNET_RSA_PrivateKey *hk;
@@ -403,7 +403,7 @@
}
if (len < 2)
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("File `%s' does not contain a pseudonym.\n"), fileName);
GNUNET_free (fileName);
return NULL;
@@ -414,7 +414,7 @@
hke = (GNUNET_RSA_PrivateKeyEncoded *) dst;
if (ntohs (hke->len) != len)
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Format of pseudonym `%s' is invalid.\n"), name);
GNUNET_free (hke);
return NULL;
@@ -425,25 +425,25 @@
return NULL;
/* THEN: construct SBlock */
- dstURI = ECRS_uriToString (dstU);
- mdsize = ECRS_sizeofMetaData (md, ECRS_SERIALIZE_PART);
+ dstURI = GNUNET_ECRS_uri_to_string (dstU);
+ mdsize = GNUNET_ECRS_meta_data_get_serialized_size (md,
GNUNET_ECRS_SERIALIZE_PART);
size = mdsize + sizeof (SBlock) + strlen (dstURI) + 1;
if (size > MAX_SBLOCK_SIZE)
{
size = MAX_SBLOCK_SIZE;
- value = GNUNET_malloc (sizeof (Datastore_Value) + size);
+ value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
sb = (SBlock *) & value[1];
- sb->type = htonl (S_BLOCK);
+ sb->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_SIGNED);
destPos = (char *) &sb[1];
memcpy (destPos, dstURI, strlen (dstURI) + 1);
mdsize = size - sizeof (SBlock) - strlen (dstURI) - 1;
- mdsize = ECRS_serializeMetaData (ectx,
+ mdsize = GNUNET_ECRS_meta_data_serialize (ectx,
md,
&destPos[strlen (dstURI) + 1],
- mdsize, ECRS_SERIALIZE_PART);
+ mdsize, GNUNET_ECRS_SERIALIZE_PART);
if (mdsize == -1)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_free (dstURI);
GNUNET_RSA_free_key (hk);
return NULL;
@@ -452,18 +452,18 @@
}
else
{
- value = GNUNET_malloc (sizeof (Datastore_Value) + size);
+ value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
sb = (SBlock *) & value[1];
- sb->type = htonl (S_BLOCK);
+ sb->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_SIGNED);
destPos = (char *) &sb[1];
memcpy (destPos, dstURI, strlen (dstURI) + 1);
- ECRS_serializeMetaData (ectx,
+ GNUNET_ECRS_meta_data_serialize (ectx,
md,
&destPos[strlen (dstURI) + 1],
- mdsize, ECRS_SERIALIZE_FULL);
+ mdsize, GNUNET_ECRS_SERIALIZE_FULL);
}
- value->size = htonl (sizeof (Datastore_Value) + size);
- value->type = htonl (S_BLOCK);
+ value->size = htonl (sizeof (GNUNET_DatastoreValue) + size);
+ value->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_SIGNED);
value->prio = htonl (priority);
value->anonymityLevel = htonl (anonymityLevel);
value->expirationTime = GNUNET_htonll (expiration);
@@ -484,7 +484,7 @@
uri->data.sks.namespace = namespace;
uri->data.sks.identifier = *thisId;
- ECRS_encryptInPlace (thisId,
+ GNUNET_ECRS_encryptInPlace (thisId,
&sb->creationTime,
size
- sizeof (unsigned int)
@@ -492,7 +492,7 @@
- sizeof (GNUNET_RSA_PublicKey) -
sizeof (GNUNET_HashCode));
/* FINALLY: GNUNET_RSA_sign & publish SBlock */
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_OK == GNUNET_RSA_sign (hk,
size
- sizeof (GNUNET_RSA_Signature)
@@ -502,7 +502,7 @@
GNUNET_RSA_free_key (hk);
sock = GNUNET_client_connection_create (ectx, cfg);
- ret = FS_insert (sock, value);
+ ret = GNUNET_FS_insert (sock, value);
if (ret != GNUNET_OK)
{
GNUNET_free (uri);
@@ -517,9 +517,9 @@
struct lNCLS
{
- struct GE_Context *ectx;
- struct GC_Configuration *cfg;
- ECRS_NamespaceInfoCallback cb;
+ struct GNUNET_GE_Context *ectx;
+ struct GNUNET_GC_Configuration *cfg;
+ GNUNET_ECRS_NamespaceInfoProcessor cb;
void *cls;
int cnt;
};
@@ -545,8 +545,8 @@
}
if (len < 2)
{
- GE_LOG (c->ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (c->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("File `%s' does not contain a pseudonym.\n"), fileName);
GNUNET_free (fileName);
return GNUNET_OK;
@@ -556,8 +556,8 @@
hke = (GNUNET_RSA_PrivateKeyEncoded *) dst;
if (ntohs (hke->len) != len)
{
- GE_LOG (c->ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (c->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Format of file `%s' is invalid.\n"), fileName);
GNUNET_free (hke);
GNUNET_free (fileName);
@@ -567,11 +567,11 @@
GNUNET_free (hke);
if (hk == NULL)
{
- GE_LOG (c->ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (c->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Format of file `%s' is invalid.\n"), fileName);
GNUNET_free (fileName);
- GE_BREAK (c->ectx, 0);
+ GNUNET_GE_BREAK (c->ectx, 0);
return GNUNET_SYSERR;
}
GNUNET_free (fileName);
@@ -597,9 +597,9 @@
* @return GNUNET_SYSERR on error, otherwise the number of pseudonyms in list
*/
int
-ECRS_listNamespaces (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- ECRS_NamespaceInfoCallback cb, void *cls)
+GNUNET_ECRS_get_namespaces (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ GNUNET_ECRS_NamespaceInfoProcessor cb, void *cls)
{
char *dirName;
struct lNCLS myCLS;
Modified: GNUnet/src/applications/fs/ecrs/namespacetest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/namespacetest.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/ecrs/namespacetest.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -36,22 +36,22 @@
#define CHECKNAME "gnunet-namespace-test"
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static int match;
static int
-spcb (const ECRS_FileInfo * fi,
+spcb (const GNUNET_ECRS_FileInfo * fi,
const GNUNET_HashCode * key, int isRoot, void *closure)
{
- struct ECRS_URI *want = closure;
+ struct GNUNET_ECRS_URI *want = closure;
- if (ECRS_equalsUri (want, fi->uri))
+ if (GNUNET_ECRS_uri_test_equal (want, fi->uri))
match = 1;
else
fprintf (stderr,
"Namespace search returned unexpected result: \nHAVE: %s\nWANT:
%s...\n",
- ECRS_uriToString (fi->uri), ECRS_uriToString (want));
+ GNUNET_ECRS_uri_to_string (fi->uri), GNUNET_ECRS_uri_to_string
(want));
return GNUNET_OK;
}
@@ -61,23 +61,23 @@
GNUNET_HashCode root;
GNUNET_HashCode thisId;
GNUNET_HashCode nextId;
- struct ECRS_URI *adv;
- struct ECRS_URI *uri;
- struct ECRS_URI *advURI;
- struct ECRS_URI *rootURI;
- struct ECRS_MetaData *meta;
+ struct GNUNET_ECRS_URI *adv;
+ struct GNUNET_ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *advURI;
+ struct GNUNET_ECRS_URI *rootURI;
+ struct GNUNET_ECRS_MetaData *meta;
const char *keys[] = {
"testNamespace",
NULL,
};
- ECRS_deleteNamespace (NULL, cfg, CHECKNAME); /* make sure old one is
deleted */
- meta = ECRS_createMetaData ();
- adv = ECRS_keywordsToUri (keys);
+ GNUNET_ECRS_namespace_delete (NULL, cfg, CHECKNAME); /* make sure old one
is deleted */
+ meta = GNUNET_ECRS_meta_data_create ();
+ adv = GNUNET_ECRS_keyword_strings_to_uri (keys);
GNUNET_hash ("root", 4, &root);
rootURI =
- ECRS_createNamespace (NULL,
+ GNUNET_ECRS_namespace_create (NULL,
cfg,
CHECKNAME,
meta,
@@ -87,24 +87,24 @@
GNUNET_hash ("this", 4, &thisId);
GNUNET_hash ("next", 4, &nextId);
uri = rootURI; /* just for fun: NS::this advertises NS::root
*/
- advURI = ECRS_addToNamespace (NULL, cfg, CHECKNAME, 1, /* anonymity */
+ advURI = GNUNET_ECRS_namespace_add_content (NULL, cfg, CHECKNAME, 1,
/* anonymity */
1000, /* priority */
5 * GNUNET_CRON_MINUTES + GNUNET_get_time (),
GNUNET_get_time_int32 (NULL) + 300,
0, &thisId, &nextId, uri, meta);
CHECK (NULL != advURI);
fprintf (stderr, "Starting namespace search...\n");
- CHECK (GNUNET_OK == ECRS_search (NULL,
+ CHECK (GNUNET_OK == GNUNET_ECRS_search (NULL,
cfg,
advURI,
1, 60 * GNUNET_CRON_SECONDS, &spcb, uri,
NULL, NULL));
fprintf (stderr, "Completed namespace search...\n");
- CHECK (GNUNET_OK == ECRS_deleteNamespace (NULL, cfg, CHECKNAME));
- CHECK (GNUNET_SYSERR == ECRS_deleteNamespace (NULL, cfg, CHECKNAME));
- ECRS_freeMetaData (meta);
- ECRS_freeUri (rootURI);
- ECRS_freeUri (advURI);
+ CHECK (GNUNET_OK == GNUNET_ECRS_namespace_delete (NULL, cfg, CHECKNAME));
+ CHECK (GNUNET_SYSERR == GNUNET_ECRS_namespace_delete (NULL, cfg, CHECKNAME));
+ GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_ECRS_uri_destroy (rootURI);
+ GNUNET_ECRS_uri_destroy (advURI);
CHECK (match == 1);
return 0;
}
@@ -115,14 +115,14 @@
pid_t daemon;
int failureCount = 0;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
daemon = GNUNET_daemon_start (NULL, cfg, "peer.conf", GNUNET_NO);
- GE_ASSERT (NULL, daemon > 0);
+ GNUNET_GE_ASSERT (NULL, daemon > 0);
if (GNUNET_OK !=
GNUNET_wait_for_daemon_running (NULL, cfg, 60 * GNUNET_CRON_SECONDS))
{
@@ -133,7 +133,7 @@
GNUNET_thread_sleep (5 * GNUNET_CRON_SECONDS);
failureCount += testNamespace ();
}
- GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
+ GNUNET_GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
return (failureCount == 0) ? 0 : 1;
}
Modified: GNUnet/src/applications/fs/ecrs/parser.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/parser.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs/parser.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -29,19 +29,19 @@
#include "gnunet_ecrs_lib.h"
/**
- * @param scls must be of type "struct ECRS_URI **"
+ * @param scls must be of type "struct GNUNET_ECRS_URI **"
*/
int
-gnunet_getopt_configure_set_keywords (GNUNET_CommandLineProcessorContext *
+GNUNET_ECRS_getopt_configure_set_keywords (GNUNET_CommandLineProcessorContext *
ctx, void *scls, const char *option,
const char *value)
{
- struct ECRS_URI **uri = scls;
- struct ECRS_URI *u = *uri;
+ struct GNUNET_ECRS_URI **uri = scls;
+ struct GNUNET_ECRS_URI *u = *uri;
if (u == NULL)
{
- u = GNUNET_malloc (sizeof (struct ECRS_URI));
+ u = GNUNET_malloc (sizeof (struct GNUNET_ECRS_URI));
*uri = u;
u->type = ksk;
u->data.ksk.keywordCount = 0;
@@ -49,7 +49,7 @@
}
else
{
- GE_ASSERT (NULL, u->type == ksk);
+ GNUNET_GE_ASSERT (NULL, u->type == ksk);
}
GNUNET_array_grow (u->data.ksk.keywords,
u->data.ksk.keywordCount, u->data.ksk.keywordCount + 1);
@@ -59,24 +59,24 @@
/**
- * @param scls must be of type "struct ECRS_MetaData **"
+ * @param scls must be of type "struct GNUNET_ECRS_MetaData **"
*/
int
-gnunet_getopt_configure_set_metadata (GNUNET_CommandLineProcessorContext *
+GNUNET_ECRS_getopt_configure_set_metadata (GNUNET_CommandLineProcessorContext *
ctx, void *scls, const char *option,
const char *value)
{
- struct ECRS_MetaData **mm = scls;
+ struct GNUNET_ECRS_MetaData **mm = scls;
EXTRACTOR_KeywordType type;
const char *typename;
const char *typename_i18n;
- struct ECRS_MetaData *meta;
+ struct GNUNET_ECRS_MetaData *meta;
char *tmp;
meta = *mm;
if (meta == NULL)
{
- meta = ECRS_createMetaData ();
+ meta = GNUNET_ECRS_meta_data_create ();
*mm = meta;
}
@@ -97,7 +97,7 @@
(tmp[strlen (typename)] == ':') &&
(0 == strncmp (typename, tmp, strlen (typename))))
{
- ECRS_addToMetaData (meta, type, &tmp[strlen (typename) + 1]);
+ GNUNET_ECRS_meta_data_inser (meta, type, &tmp[strlen (typename) +
1]);
GNUNET_free (tmp);
tmp = NULL;
break;
@@ -106,7 +106,7 @@
(tmp[strlen (typename_i18n)] == ':') &&
(0 == strncmp (typename_i18n, tmp, strlen (typename_i18n))))
{
- ECRS_addToMetaData (meta, type, &tmp[strlen (typename_i18n) + 1]);
+ GNUNET_ECRS_meta_data_inser (meta, type, &tmp[strlen (typename_i18n)
+ 1]);
GNUNET_free (tmp);
tmp = NULL;
break;
@@ -114,7 +114,7 @@
}
if (tmp != NULL)
{
- ECRS_addToMetaData (meta, EXTRACTOR_UNKNOWN, tmp);
+ GNUNET_ECRS_meta_data_inser (meta, EXTRACTOR_UNKNOWN, tmp);
GNUNET_free (tmp);
printf (_
("Unknown metadata type in metadata option `%s'. Using metadata
type `unknown' instead.\n"),
Modified: GNUnet/src/applications/fs/ecrs/search.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/search.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs/search.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -39,7 +39,7 @@
/**
* The handle for the query.
*/
- struct FS_SEARCH_HANDLE *handle;
+ struct GNUNET_FS_SearchHandle *handle;
/**
* The keys (for the search).
@@ -98,22 +98,22 @@
/**
* Search context
*/
- struct FS_SEARCH_CONTEXT *sctx;
+ struct GNUNET_FS_SearchContext *sctx;
/**
* queryCount pending searches.
*/
PendingSearch **queries;
- ECRS_SearchProgressCallback spcb;
+ GNUNET_ECRS_SearchResultProcessor spcb;
void *spcbClosure;
struct GNUNET_Mutex *lock;
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
int aborted;
@@ -156,15 +156,15 @@
* to the SQC.
*/
static void
-addQueryForURI (const struct ECRS_URI *uri, SendQueriesContext * sqc)
+addQueryForURI (const struct GNUNET_ECRS_URI *uri, SendQueriesContext * sqc)
{
- struct GE_Context *ectx = sqc->ectx;
+ struct GNUNET_GE_Context *ectx = sqc->ectx;
switch (uri->type)
{
case chk:
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("CHK URI not allowed for search.\n"));
break;
case sks:
@@ -176,7 +176,7 @@
&hk);
GNUNET_hash_xor (&hk, &uri->data.sks.namespace, &keys[0]); /*
compute routing key r = H(identifier) ^ namespace */
keys[1] = uri->data.sks.namespace;
- addPS (S_BLOCK, 2, &keys[0], &uri->data.sks.identifier, /* identifier
= decryption key */
+ addPS (GNUNET_GNUNET_ECRS_BLOCKTYPE_SIGNED, 2, &keys[0],
&uri->data.sks.identifier, /* identifier = decryption key */
sqc);
break;
}
@@ -189,8 +189,8 @@
int i;
#if DEBUG_SEARCH
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Computing queries (this may take a while).\n");
#endif
for (i = 0; i < uri->data.ksk.keywordCount; i++)
@@ -200,22 +200,22 @@
pk = GNUNET_RSA_create_key_from_hash (&hc);
GNUNET_RSA_get_public_key (pk, &pub);
GNUNET_hash (&pub, sizeof (GNUNET_RSA_PublicKey), &query);
- addPS (ANY_BLOCK, /* K_BLOCK, N_BLOCK or KN_BLOCK ok */
+ addPS (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY, /*
GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD, GNUNET_GNUNET_ECRS_BLOCKTYPE_NAMESPACE or
GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE ok */
1, &query, &hc, sqc);
GNUNET_RSA_free_key (pk);
}
#if DEBUG_SEARCH
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER, "Queries ready.\n");
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER, "Queries ready.\n");
#endif
break;
}
case loc:
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("LOC URI not allowed for search.\n"));
break;
default:
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
/* unknown URI type */
break;
}
@@ -250,7 +250,7 @@
c);
return GNUNET_OK;
}
- GE_ASSERT (NULL, ntohl (sb->updateInterval) != 0);
+ GNUNET_GE_ASSERT (NULL, ntohl (sb->updateInterval) != 0);
pos = ntohl (sb->creationTime);
GNUNET_hash_difference (&sb->identifierIncrement, &sb->nextIdentifier, c);
@@ -278,17 +278,17 @@
const GNUNET_HashCode * key,
unsigned int size, SendQueriesContext * sqc)
{
- struct GE_Context *ectx = sqc->ectx;
- ECRS_FileInfo fi;
- struct ECRS_URI uri;
+ struct GNUNET_GE_Context *ectx = sqc->ectx;
+ GNUNET_ECRS_FileInfo fi;
+ struct GNUNET_ECRS_URI uri;
int ret;
- fi.meta = ECRS_deserializeMetaData (ectx,
+ fi.meta = GNUNET_ECRS_meta_data_deserialize (ectx,
(const char *) &nb[1],
size - sizeof (NBlock));
if (fi.meta == NULL)
{
- GE_BREAK (ectx, 0); /* nblock malformed */
+ GNUNET_GE_BREAK (ectx, 0); /* nblock malformed */
return GNUNET_SYSERR;
}
fi.uri = &uri;
@@ -303,7 +303,7 @@
}
else
ret = GNUNET_OK;
- ECRS_freeMetaData (fi.meta);
+ GNUNET_ECRS_meta_data_destroy (fi.meta);
return ret;
}
@@ -316,11 +316,11 @@
*/
static int
receiveReplies (const GNUNET_HashCode * key,
- const Datastore_Value * value, SendQueriesContext * sqc)
+ const GNUNET_DatastoreValue * value, SendQueriesContext * sqc)
{
- struct GE_Context *ectx = sqc->ectx;
+ struct GNUNET_GE_Context *ectx = sqc->ectx;
unsigned int type;
- ECRS_FileInfo fi;
+ GNUNET_ECRS_FileInfo fi;
int i;
unsigned int size;
PendingSearch *ps;
@@ -328,10 +328,10 @@
GNUNET_HashCode query;
type = ntohl (value->type);
- size = ntohl (value->size) - sizeof (Datastore_Value);
+ size = ntohl (value->size) - sizeof (GNUNET_DatastoreValue);
#if DEBUG_SEARCH
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Search received reply of type %u and size %u.\n", type, size);
#endif
if (GNUNET_OK !=
@@ -343,7 +343,7 @@
if ((0 == memcmp (&query,
&ps->keys[0], sizeof (GNUNET_HashCode))) &&
((ps->type == type) ||
- (ps->type == ANY_BLOCK)) &&
+ (ps->type == GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY)) &&
(GNUNET_YES == isDatumApplicable (type,
size,
(const DBlock *) &value[1],
@@ -351,7 +351,7 @@
{
switch (type)
{
- case K_BLOCK:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD:
{
KBlock *kb;
const char *dstURI;
@@ -365,39 +365,39 @@
kb = GNUNET_malloc (size);
memcpy (kb, &value[1], size);
#if DEBUG_SEARCH
- IF_GELOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
GNUNET_hash_to_enc (&ps->decryptKey, &enc));
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Decrypting KBlock with key %s.\n", &enc);
#endif
- ECRS_decryptInPlace (&ps->decryptKey,
+ GNUNET_ECRS_decryptInPlace (&ps->decryptKey,
&kb[1], size - sizeof (KBlock));
j = sizeof (KBlock);
while ((j < size) && (((const char *) kb)[j] != '\0'))
j++;
if (j == size)
{
- GE_BREAK (ectx, 0); /* kblock malformed */
+ GNUNET_GE_BREAK (ectx, 0); /* kblock malformed */
GNUNET_free (kb);
return GNUNET_SYSERR;
}
dstURI = (const char *) &kb[1];
j++;
- fi.meta = ECRS_deserializeMetaData (ectx,
+ fi.meta = GNUNET_ECRS_meta_data_deserialize (ectx,
&((const char *) kb)[j],
size - j);
if (fi.meta == NULL)
{
- GE_BREAK (ectx, 0); /* kblock malformed */
+ GNUNET_GE_BREAK (ectx, 0); /* kblock malformed */
GNUNET_free (kb);
return GNUNET_SYSERR;
}
- fi.uri = ECRS_stringToUri (ectx, dstURI);
+ fi.uri = GNUNET_ECRS_string_to_uri (ectx, dstURI);
if (fi.uri == NULL)
{
- GE_BREAK (ectx, 0); /* kblock malformed */
- ECRS_freeMetaData (fi.meta);
+ GNUNET_GE_BREAK (ectx, 0); /* kblock malformed */
+ GNUNET_ECRS_meta_data_destroy (fi.meta);
GNUNET_free (kb);
return GNUNET_SYSERR;
}
@@ -411,12 +411,12 @@
}
else
ret = GNUNET_OK;
- ECRS_freeUri (fi.uri);
- ECRS_freeMetaData (fi.meta);
+ GNUNET_ECRS_uri_destroy (fi.uri);
+ GNUNET_ECRS_meta_data_destroy (fi.meta);
GNUNET_free (kb);
return ret;
}
- case N_BLOCK:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_NAMESPACE:
{
const NBlock *nb;
@@ -425,7 +425,7 @@
nb = (const NBlock *) &value[1];
return processNBlock (nb, NULL, size, sqc);
}
- case KN_BLOCK:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE:
{
KNBlock *kb;
int ret;
@@ -434,7 +434,7 @@
return GNUNET_SYSERR;
kb = GNUNET_malloc (size);
memcpy (kb, &value[1], size);
- ECRS_decryptInPlace (&ps->decryptKey,
+ GNUNET_ECRS_decryptInPlace (&ps->decryptKey,
&kb->nblock,
size - sizeof (KBlock) -
sizeof (unsigned int));
@@ -445,7 +445,7 @@
GNUNET_free (kb);
return ret;
}
- case S_BLOCK:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_SIGNED:
{
SBlock *sb;
const char *dstURI;
@@ -458,7 +458,7 @@
return GNUNET_SYSERR;
sb = GNUNET_malloc (size);
memcpy (sb, &value[1], size);
- ECRS_decryptInPlace (&ps->decryptKey,
+ GNUNET_ECRS_decryptInPlace (&ps->decryptKey,
&sb->creationTime,
size
- sizeof (unsigned int)
@@ -471,27 +471,27 @@
j++;
if (j == size - sizeof (SBlock))
{
- GE_BREAK (ectx, 0); /* sblock malformed */
+ GNUNET_GE_BREAK (ectx, 0); /* sblock malformed */
GNUNET_free (sb);
return GNUNET_SYSERR;
}
j++;
/* j == strlen(dstURI) + 1 */
- fi.meta = ECRS_deserializeMetaData (ectx,
+ fi.meta = GNUNET_ECRS_meta_data_deserialize (ectx,
&dstURI[j],
size - j -
sizeof (SBlock));
if (fi.meta == NULL)
{
- GE_BREAK (ectx, 0); /* sblock malformed */
+ GNUNET_GE_BREAK (ectx, 0); /* sblock malformed */
GNUNET_free (sb);
return GNUNET_SYSERR;
}
- fi.uri = ECRS_stringToUri (ectx, dstURI);
+ fi.uri = GNUNET_ECRS_string_to_uri (ectx, dstURI);
if (fi.uri == NULL)
{
- GE_BREAK (ectx, 0); /* sblock malformed */
- ECRS_freeMetaData (fi.meta);
+ GNUNET_GE_BREAK (ectx, 0); /* sblock malformed */
+ GNUNET_ECRS_meta_data_destroy (fi.meta);
GNUNET_free (sb);
return GNUNET_SYSERR;
}
@@ -503,8 +503,8 @@
}
else
ret = GNUNET_OK;
- ECRS_freeUri (fi.uri);
- ECRS_freeMetaData (fi.meta);
+ GNUNET_ECRS_uri_destroy (fi.uri);
+ GNUNET_ECRS_meta_data_destroy (fi.meta);
/* compute current/NEXT URI (if updateable SBlock) and issue
respective query automatically! */
@@ -523,7 +523,7 @@
}
if (ps->keyCount != 2)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_free (sb);
return GNUNET_SYSERR;
}
@@ -536,7 +536,7 @@
return ret;
}
default:
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
break;
} /* end switch */
} /* for all matches */
@@ -553,13 +553,13 @@
* @param uri set to the URI of the uploaded file
*/
int
-ECRS_search (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- const struct ECRS_URI *uri,
+GNUNET_ECRS_search (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const struct GNUNET_ECRS_URI *uri,
unsigned int anonymityLevel,
GNUNET_CronTime timeout,
- ECRS_SearchProgressCallback spcb,
- void *spcbClosure, ECRS_TestTerminate tt, void *ttClosure)
+ GNUNET_ECRS_SearchResultProcessor spcb,
+ void *spcbClosure, GNUNET_ECRS_TestTerminate tt, void *ttClosure)
{
SendQueriesContext ctx;
PendingSearch *ps;
@@ -581,7 +581,7 @@
ctx.spcbClosure = spcbClosure;
ctx.aborted = GNUNET_NO;
ctx.lock = GNUNET_mutex_create (GNUNET_YES);
- ctx.sctx = FS_SEARCH_makeContext (ectx, cfg, ctx.lock);
+ ctx.sctx = GNUNET_FS_create_search_context (ectx, cfg, ctx.lock);
addQueryForURI (uri, &ctx);
while (((NULL == tt) ||
(GNUNET_OK == tt (ttClosure))) &&
@@ -597,7 +597,7 @@
if ((now < ps->timeout) && (ps->timeout != 0))
continue;
if (ps->handle != NULL)
- FS_stop_search (ctx.sctx, ps->handle);
+ GNUNET_FS_stop_search (ctx.sctx, ps->handle);
/* increase ttl/priority */
new_ttl = ps->timeout - ps->lastTransmission;
if (new_ttl < 4 * 5 * GNUNET_CRON_SECONDS)
@@ -623,13 +623,13 @@
ps->priority = new_priority;
ps->lastTransmission = now;
#if DEBUG_SEARCH
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"ECRS initiating FS search with timeout %llus and priority
%u.\n",
(ps->timeout - now) / GNUNET_CRON_SECONDS, ps->priority);
#endif
ps->handle
- = FS_start_search (ctx.sctx,
+ = GNUNET_FS_start_search (ctx.sctx,
NULL,
ps->type,
ps->keyCount,
@@ -637,7 +637,7 @@
anonymityLevel,
ps->priority,
ps->timeout,
- (Datum_Iterator) & receiveReplies, &ctx);
+ (GNUNET_DatastoreValueIterator) &
receiveReplies, &ctx);
}
GNUNET_mutex_unlock (ctx.lock);
if (((NULL != tt) &&
@@ -650,12 +650,12 @@
for (i = 0; i < ctx.queryCount; i++)
{
if (ctx.queries[i]->handle != NULL)
- FS_stop_search (ctx.sctx, ctx.queries[i]->handle);
+ GNUNET_FS_stop_search (ctx.sctx, ctx.queries[i]->handle);
GNUNET_free (ctx.queries[i]->keys);
GNUNET_free (ctx.queries[i]);
}
GNUNET_array_grow (ctx.queries, ctx.queryCount, 0);
- FS_SEARCH_destroyContext (ctx.sctx);
+ GNUNET_FS_destroy_search_context (ctx.sctx);
GNUNET_mutex_destroy (ctx.lock);
return GNUNET_OK;
}
Modified: GNUnet/src/applications/fs/ecrs/searchtest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/searchtest.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/ecrs/searchtest.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -31,7 +31,7 @@
#include "gnunet_util_network_client.h"
#include "tree.h"
-#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GE_BREAK(NULL, 0); goto FAILURE; }
+#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GNUNET_GE_BREAK(NULL, 0); goto
FAILURE; }
static int
testTerminate (void *unused)
@@ -39,17 +39,17 @@
return GNUNET_OK;
}
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static int
-searchCB (const ECRS_FileInfo * fi,
+searchCB (const GNUNET_ECRS_FileInfo * fi,
const GNUNET_HashCode * key, int isRoot, void *closure)
{
int *cnt = closure;
#if 1
char *st;
- st = ECRS_uriToString (fi->uri);
+ st = GNUNET_ECRS_uri_to_string (fi->uri);
printf ("Got result `%s'\n", st);
GNUNET_free (st);
#endif
@@ -64,9 +64,9 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
static int
-searchFile (const struct ECRS_URI *uri, int resultCount)
+searchFile (const struct GNUNET_ECRS_URI *uri, int resultCount)
{
- ECRS_search (NULL,
+ GNUNET_ECRS_search (NULL,
cfg,
uri,
0,
@@ -83,21 +83,21 @@
pid_t daemon;
int ok;
struct GNUNET_ClientServerConnection *sock;
- struct ECRS_URI *uri;
- struct ECRS_MetaData *meta;
- struct ECRS_URI *key;
+ struct GNUNET_ECRS_URI *uri;
+ struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_ECRS_URI *key;
const char *keywords[6];
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
sock = NULL;
daemon = GNUNET_daemon_start (NULL, cfg, "peer.conf", GNUNET_NO);
- GE_ASSERT (NULL, daemon > 0);
+ GNUNET_GE_ASSERT (NULL, daemon > 0);
CHECK (GNUNET_OK ==
GNUNET_wait_for_daemon_running (NULL, cfg,
30 * GNUNET_CRON_SECONDS));
@@ -110,50 +110,50 @@
#if 1
printf ("Testing search for 'XXtest' with one result.\n");
#endif
- uri = ECRS_stringToUri (NULL,
+ uri = GNUNET_ECRS_string_to_uri (NULL,
"gnunet://ecrs/sks/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820/test");
- meta = ECRS_createMetaData ();
+ meta = GNUNET_ECRS_meta_data_create ();
keywords[0] = "XXtest";
keywords[1] = NULL;
- key = ECRS_keywordsToUri (keywords);
- CHECK (GNUNET_OK == ECRS_addToKeyspace (NULL, cfg, key, 0, 0,
GNUNET_get_time () + 10 * GNUNET_CRON_MINUTES, /* expire */
+ key = GNUNET_ECRS_keyword_strings_to_uri (keywords);
+ CHECK (GNUNET_OK == GNUNET_ECRS_publish_under_keyword (NULL, cfg, key, 0, 0,
GNUNET_get_time () + 10 * GNUNET_CRON_MINUTES, /* expire */
uri, meta));
CHECK (GNUNET_OK == searchFile (key, 1));
- ECRS_freeUri (key);
- ECRS_freeUri (uri);
+ GNUNET_ECRS_uri_destroy (key);
+ GNUNET_ECRS_uri_destroy (uri);
/* inserting another URI under the 'XXtest' keyword and under 'binary'
should give both URIs since ECRS knows nothing about 'AND'ing: */
#if 1
printf ("Testing search for 'XXtest AND binary' with two results.\n");
#endif
- uri = ECRS_stringToUri (NULL,
+ uri = GNUNET_ECRS_string_to_uri (NULL,
"gnunet://ecrs/sks/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820/test-different");
keywords[1] = "binary";
keywords[2] = NULL;
- key = ECRS_keywordsToUri (keywords);
- CHECK (GNUNET_OK == ECRS_addToKeyspace (NULL, cfg, key, 0, 0,
GNUNET_get_time () + 10 * GNUNET_CRON_MINUTES, /* expire */
+ key = GNUNET_ECRS_keyword_string_to_uri (keywords);
+ CHECK (GNUNET_OK == GNUNET_ECRS_publish_under_keyword (NULL, cfg, key, 0, 0,
GNUNET_get_time () + 10 * GNUNET_CRON_MINUTES, /* expire */
uri, meta));
CHECK (GNUNET_OK == searchFile (key, 2));
- ECRS_freeUri (key);
- ECRS_freeUri (uri);
- ECRS_freeMetaData (meta);
+ GNUNET_ECRS_uri_destroy (key);
+ GNUNET_ECRS_uri_destroy (uri);
+ GNUNET_ECRS_meta_data_destroy (meta);
/* now searching just for 'XXtest' should again give 2 results! */
#if 0
printf ("Testing search for 'XXtest' with two results.\n");
#endif
keywords[1] = NULL;
- key = ECRS_keywordsToUri (keywords);
+ key = GNUNET_ECRS_keyword_string_to_uri (keywords);
CHECK (GNUNET_OK == searchFile (key, 2));
- ECRS_freeUri (key);
+ GNUNET_ECRS_uri_destroy (key);
/* END OF TEST CODE */
FAILURE:
if (sock != NULL)
GNUNET_client_connection_destroy (sock);
- GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
+ GNUNET_GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
return (ok == GNUNET_YES) ? 0 : 1;
}
Modified: GNUnet/src/applications/fs/ecrs/tree.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/tree.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs/tree.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -33,8 +33,8 @@
unsigned int treeDepth;
unsigned long long fl;
- GE_ASSERT (NULL, DBLOCK_SIZE < GNUNET_MAX_BUFFER_SIZE);
- GE_ASSERT (NULL, IBLOCK_SIZE < GNUNET_MAX_BUFFER_SIZE);
+ GNUNET_GE_ASSERT (NULL, DBLOCK_SIZE < GNUNET_MAX_BUFFER_SIZE);
+ GNUNET_GE_ASSERT (NULL, IBLOCK_SIZE < GNUNET_MAX_BUFFER_SIZE);
treeDepth = 0;
fl = DBLOCK_SIZE;
while (fl < flen)
Modified: GNUnet/src/applications/fs/ecrs/unindex.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/unindex.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs/unindex.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -48,21 +48,21 @@
* be big enough.
*
* This function matches exactly upload.c::pushBlock,
- * except in the call to 'FS_delete'. TODO: refactor
+ * except in the call to 'GNUNET_FS_delete'. TODO: refactor
* to avoid code duplication (move to block.c, pass
- * FS_delete as argument!).
+ * GNUNET_FS_delete as argument!).
*/
static int
pushBlock (struct GNUNET_ClientServerConnection *sock,
- const CHK * chk, unsigned int level, Datastore_Value ** iblocks)
+ const CHK * chk, unsigned int level, GNUNET_DatastoreValue **
iblocks)
{
unsigned int size;
unsigned int present;
- Datastore_Value *value;
+ GNUNET_DatastoreValue *value;
DBlock *db;
CHK ichk;
- size = ntohl (iblocks[level]->size) - sizeof (Datastore_Value);
+ size = ntohl (iblocks[level]->size) - sizeof (GNUNET_DatastoreValue);
present = (size - sizeof (DBlock)) / sizeof (CHK);
db = (DBlock *) & iblocks[level][1];
if (present == CHK_PER_INODE)
@@ -71,19 +71,19 @@
fileBlockGetQuery (db, size, &ichk.query);
if (GNUNET_OK != pushBlock (sock, &ichk, level + 1, iblocks))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
fileBlockEncode (db, size, &ichk.query, &value);
#if STRICT_CHECKS
- if (GNUNET_SYSERR == FS_delete (sock, value))
+ if (GNUNET_SYSERR == GNUNET_FS_delete (sock, value))
{
GNUNET_free (value);
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
#else
- FS_delete (sock, value);
+ GNUNET_FS_delete (sock, value);
#endif
GNUNET_free (value);
size = sizeof (DBlock);
@@ -91,7 +91,7 @@
/* append CHK */
memcpy (&((char *) db)[size], chk, sizeof (CHK));
iblocks[level]->size = htonl (size +
- sizeof (CHK) + sizeof (Datastore_Value));
+ sizeof (CHK) + sizeof (GNUNET_DatastoreValue));
return GNUNET_OK;
}
@@ -103,7 +103,7 @@
* b) delete symbolic link
*/
static int
-undoSymlinking (struct GE_Context *ectx,
+undoSymlinking (struct GNUNET_GE_Context *ectx,
const char *fn,
const GNUNET_HashCode * fileId,
struct GNUNET_ClientServerConnection *sock)
@@ -119,8 +119,8 @@
#endif
if (0 != LSTAT (fn, &buf))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_BULK | GE_USER | GE_ADMIN,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER
| GNUNET_GE_ADMIN,
"stat", fn);
return GNUNET_SYSERR;
}
@@ -141,8 +141,8 @@
if (0 != UNLINK (serverFN))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_BULK | GE_USER | GE_ADMIN,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER
| GNUNET_GE_ADMIN,
"unlink", serverFN);
GNUNET_free (serverFN);
return GNUNET_SYSERR;
@@ -159,11 +159,11 @@
* @return GNUNET_SYSERR if the unindexing failed (i.e. not indexed)
*/
int
-ECRS_unindexFile (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+GNUNET_ECRS_file_uninde (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *filename,
- ECRS_UploadProgressCallback upcb,
- void *upcbClosure, ECRS_TestTerminate tt, void *ttClosure)
+ GNUNET_ECRS_UploadProgressCallback upcb,
+ void *upcbClosure, GNUNET_ECRS_TestTerminate tt, void
*ttClosure)
{
unsigned long long filesize;
unsigned long long pos;
@@ -171,10 +171,10 @@
int fd;
int i;
unsigned int size;
- Datastore_Value **iblocks;
- Datastore_Value *dblock;
+ GNUNET_DatastoreValue **iblocks;
+ GNUNET_DatastoreValue *dblock;
DBlock *db;
- Datastore_Value *value;
+ GNUNET_DatastoreValue *value;
struct GNUNET_ClientServerConnection *sock;
GNUNET_HashCode fileId;
CHK chk;
@@ -186,7 +186,7 @@
start = GNUNET_get_time ();
if (GNUNET_YES != GNUNET_disk_file_test (ectx, filename))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
@@ -201,7 +201,7 @@
if (GNUNET_SYSERR == GNUNET_hash_file (ectx, filename, &fileId))
{
GNUNET_client_connection_destroy (sock);
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
now = GNUNET_get_time ();
@@ -216,33 +216,33 @@
treedepth = computeDepth (filesize);
/* Test if file is indexed! */
- wasIndexed = FS_testIndexed (sock, &fileId);
+ wasIndexed = GNUNET_FS_test_indexed (sock, &fileId);
fd = GNUNET_disk_file_open (ectx, filename, O_RDONLY | O_LARGEFILE);
if (fd == -1)
return GNUNET_SYSERR;
dblock =
- GNUNET_malloc (sizeof (Datastore_Value) + DBLOCK_SIZE + sizeof (DBlock));
+ GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + DBLOCK_SIZE + sizeof
(DBlock));
dblock->size =
- htonl (sizeof (Datastore_Value) + DBLOCK_SIZE + sizeof (DBlock));
+ htonl (sizeof (GNUNET_DatastoreValue) + DBLOCK_SIZE + sizeof (DBlock));
dblock->anonymityLevel = htonl (0);
dblock->prio = htonl (0);
- dblock->type = htonl (D_BLOCK);
+ dblock->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
dblock->expirationTime = GNUNET_htonll (0);
db = (DBlock *) & dblock[1];
- db->type = htonl (D_BLOCK);
- iblocks = GNUNET_malloc (sizeof (Datastore_Value *) * (treedepth + 1));
+ db->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
+ iblocks = GNUNET_malloc (sizeof (GNUNET_DatastoreValue *) * (treedepth + 1));
for (i = 0; i <= treedepth; i++)
{
iblocks[i] =
- GNUNET_malloc (sizeof (Datastore_Value) + IBLOCK_SIZE +
+ GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + IBLOCK_SIZE +
sizeof (DBlock));
- iblocks[i]->size = htonl (sizeof (Datastore_Value) + sizeof (DBlock));
+ iblocks[i]->size = htonl (sizeof (GNUNET_DatastoreValue) + sizeof
(DBlock));
iblocks[i]->anonymityLevel = htonl (0);
iblocks[i]->prio = htonl (0);
- iblocks[i]->type = htonl (D_BLOCK);
+ iblocks[i]->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
iblocks[i]->expirationTime = GNUNET_htonll (0);
- ((DBlock *) & iblocks[i][1])->type = htonl (D_BLOCK);
+ ((DBlock *) & iblocks[i][1])->type = htonl
(GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
}
pos = 0;
@@ -260,11 +260,11 @@
memset (&db[1], 0, DBLOCK_SIZE);
}
dblock->size =
- htonl (sizeof (Datastore_Value) + size + sizeof (DBlock));
+ htonl (sizeof (GNUNET_DatastoreValue) + size + sizeof (DBlock));
if (size != READ (fd, &db[1], size))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"READ", filename);
goto FAILURE;
}
@@ -276,7 +276,7 @@
if (GNUNET_OK != pushBlock (sock, &chk, 0, /* dblocks are on
level 0 */
iblocks))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
goto FAILURE;
}
if (!wasIndexed)
@@ -285,14 +285,14 @@
{
*value = *dblock; /* copy options! */
#if STRICT_CHECKS
- if (GNUNET_OK != FS_delete (sock, value))
+ if (GNUNET_OK != GNUNET_FS_delete (sock, value))
{
GNUNET_free (value);
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
goto FAILURE;
}
#else
- FS_delete (sock, value);
+ GNUNET_FS_delete (sock, value);
#endif
GNUNET_free (value);
}
@@ -312,25 +312,25 @@
goto FAILURE;
for (i = 0; i < treedepth; i++)
{
- size = ntohl (iblocks[i]->size) - sizeof (Datastore_Value);
+ size = ntohl (iblocks[i]->size) - sizeof (GNUNET_DatastoreValue);
db = (DBlock *) & iblocks[i][1];
fileBlockGetKey (db, size, &chk.key);
fileBlockGetQuery (db, size, &chk.query);
if (GNUNET_OK != pushBlock (sock, &chk, i + 1, iblocks))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
goto FAILURE;
}
fileBlockEncode (db, size, &chk.query, &value);
#if STRICT_CHECKS
- if (GNUNET_OK != FS_delete (sock, value))
+ if (GNUNET_OK != GNUNET_FS_delete (sock, value))
{
GNUNET_free (value);
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
goto FAILURE;
}
#else
- FS_delete (sock, value);
+ GNUNET_FS_delete (sock, value);
#endif
GNUNET_free (value);
GNUNET_free (iblocks[i]);
@@ -341,15 +341,15 @@
{
if (GNUNET_OK == undoSymlinking (ectx, filename, &fileId, sock))
{
- if (GNUNET_OK != FS_unindex (sock, DBLOCK_SIZE, &fileId))
+ if (GNUNET_OK != GNUNET_FS_unindex (sock, DBLOCK_SIZE, &fileId))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
goto FAILURE;
}
}
else
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
goto FAILURE;
}
}
Modified: GNUnet/src/applications/fs/ecrs/upload.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/upload.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs/upload.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -50,12 +50,12 @@
pushBlock (struct GNUNET_ClientServerConnection *sock,
const CHK * chk,
unsigned int level,
- Datastore_Value ** iblocks,
+ GNUNET_DatastoreValue ** iblocks,
unsigned int prio, GNUNET_CronTime expirationTime)
{
unsigned int size;
unsigned int present;
- Datastore_Value *value;
+ GNUNET_DatastoreValue *value;
DBlock *db;
CHK ichk;
#if DEBUG_UPLOAD
@@ -63,9 +63,9 @@
#endif
size = ntohl (iblocks[level]->size);
- GE_ASSERT (NULL, size > sizeof (Datastore_Value));
- size -= sizeof (Datastore_Value);
- GE_ASSERT (NULL, size - sizeof (DBlock) <= IBLOCK_SIZE);
+ GNUNET_GE_ASSERT (NULL, size > sizeof (GNUNET_DatastoreValue));
+ size -= sizeof (GNUNET_DatastoreValue);
+ GNUNET_GE_ASSERT (NULL, size - sizeof (DBlock) <= IBLOCK_SIZE);
present = (size - sizeof (DBlock)) / sizeof (CHK);
db = (DBlock *) & iblocks[level][1];
if (present == CHK_PER_INODE)
@@ -79,12 +79,12 @@
fileBlockEncode (db, size, &ichk.query, &value);
if (value == NULL)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
value->prio = htonl (prio);
value->expirationTime = GNUNET_htonll (expirationTime);
- if (GNUNET_OK != FS_insert (sock, value))
+ if (GNUNET_OK != GNUNET_FS_insert (sock, value))
{
GNUNET_free (value);
return GNUNET_SYSERR;
@@ -94,8 +94,8 @@
}
/* append CHK */
memcpy (&((char *) db)[size], chk, sizeof (CHK));
- size += sizeof (CHK) + sizeof (Datastore_Value);
- GE_ASSERT (NULL, size < GNUNET_MAX_BUFFER_SIZE);
+ size += sizeof (CHK) + sizeof (GNUNET_DatastoreValue);
+ GNUNET_GE_ASSERT (NULL, size < GNUNET_MAX_BUFFER_SIZE);
iblocks[level]->size = htonl (size);
return GNUNET_OK;
@@ -113,17 +113,17 @@
* or gnunetd not running)
*/
int
-ECRS_uploadFile (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+GNUNET_ECRS_file_upload (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *filename,
int doIndex,
unsigned int anonymityLevel,
unsigned int priority,
GNUNET_CronTime expirationTime,
- ECRS_UploadProgressCallback upcb,
+ GNUNET_ECRS_UploadProgressCallback upcb,
void *upcbClosure,
- ECRS_TestTerminate tt,
- void *ttClosure, struct ECRS_URI **uri)
+ GNUNET_ECRS_TestTerminate tt,
+ void *ttClosure, struct GNUNET_ECRS_URI **uri)
{
unsigned long long filesize;
unsigned long long pos;
@@ -131,10 +131,10 @@
int fd;
int i;
unsigned int size;
- Datastore_Value **iblocks;
- Datastore_Value *dblock;
+ GNUNET_DatastoreValue **iblocks;
+ GNUNET_DatastoreValue *dblock;
DBlock *db;
- Datastore_Value *value;
+ GNUNET_DatastoreValue *value;
struct GNUNET_ClientServerConnection *sock;
GNUNET_HashCode fileId;
CHK mchk;
@@ -146,21 +146,21 @@
GNUNET_EncName enc;
#endif
- GE_ASSERT (ectx, cfg != NULL);
+ GNUNET_GE_ASSERT (ectx, cfg != NULL);
start = GNUNET_get_time ();
memset (&mchk, 0, sizeof (CHK));
if (GNUNET_YES != GNUNET_disk_file_test (ectx, filename))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' is not a file.\n"), filename);
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
GNUNET_disk_file_size (ectx, filename, &filesize, GNUNET_YES))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Cannot get size of file `%s'"), filename);
return GNUNET_SYSERR;
@@ -168,8 +168,8 @@
sock = GNUNET_client_connection_create (ectx, cfg);
if (sock == NULL)
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Failed to connect to gnunetd."));
return GNUNET_SYSERR;
}
@@ -180,8 +180,8 @@
{
if (GNUNET_SYSERR == GNUNET_hash_file (ectx, filename, &fileId))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Cannot hash `%s'.\n"), filename);
GNUNET_client_connection_destroy (sock);
return GNUNET_SYSERR;
@@ -196,18 +196,18 @@
/* reset the counter since the formula later does not
take the time for GNUNET_hash_file into account */
- switch (FS_initIndex (sock, &fileId, filename))
+ switch (GNUNET_FS_prepare_to_inde (sock, &fileId, filename))
{
case GNUNET_SYSERR:
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Initialization for indexing file `%s' failed.\n"),
filename);
GNUNET_client_connection_destroy (sock);
return GNUNET_SYSERR;
case GNUNET_NO:
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Indexing file `%s' failed. Trying to insert file...\n"),
filename);
doIndex = GNUNET_YES;
@@ -220,8 +220,8 @@
fd = GNUNET_disk_file_open (ectx, filename, O_RDONLY | O_LARGEFILE);
if (fd == -1)
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Cannot open file `%s': `%s'"), filename, STRERROR (errno));
GNUNET_client_connection_destroy (sock);
@@ -229,27 +229,27 @@
}
dblock =
- GNUNET_malloc (sizeof (Datastore_Value) + DBLOCK_SIZE + sizeof (DBlock));
+ GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + DBLOCK_SIZE + sizeof
(DBlock));
dblock->size =
- htonl (sizeof (Datastore_Value) + DBLOCK_SIZE + sizeof (DBlock));
+ htonl (sizeof (GNUNET_DatastoreValue) + DBLOCK_SIZE + sizeof (DBlock));
dblock->anonymityLevel = htonl (anonymityLevel);
dblock->prio = htonl (priority);
- dblock->type = htonl (D_BLOCK);
+ dblock->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
dblock->expirationTime = GNUNET_htonll (expirationTime);
db = (DBlock *) & dblock[1];
- db->type = htonl (D_BLOCK);
- iblocks = GNUNET_malloc (sizeof (Datastore_Value *) * (treedepth + 1));
+ db->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
+ iblocks = GNUNET_malloc (sizeof (GNUNET_DatastoreValue *) * (treedepth + 1));
for (i = 0; i <= treedepth; i++)
{
iblocks[i] =
- GNUNET_malloc (sizeof (Datastore_Value) + IBLOCK_SIZE +
+ GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + IBLOCK_SIZE +
sizeof (DBlock));
- iblocks[i]->size = htonl (sizeof (Datastore_Value) + sizeof (DBlock));
+ iblocks[i]->size = htonl (sizeof (GNUNET_DatastoreValue) + sizeof
(DBlock));
iblocks[i]->anonymityLevel = htonl (anonymityLevel);
iblocks[i]->prio = htonl (priority);
- iblocks[i]->type = htonl (D_BLOCK);
+ iblocks[i]->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
iblocks[i]->expirationTime = GNUNET_htonll (expirationTime);
- ((DBlock *) & iblocks[i][1])->type = htonl (D_BLOCK);
+ ((DBlock *) & iblocks[i][1])->type = htonl
(GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
}
pos = 0;
@@ -266,15 +266,15 @@
size = filesize - pos;
memset (&db[1], 0, DBLOCK_SIZE);
}
- GE_ASSERT (ectx,
- sizeof (Datastore_Value) + size + sizeof (DBlock) <
+ GNUNET_GE_ASSERT (ectx,
+ sizeof (GNUNET_DatastoreValue) + size + sizeof (DBlock) <
GNUNET_MAX_BUFFER_SIZE);
dblock->size =
- htonl (sizeof (Datastore_Value) + size + sizeof (DBlock));
+ htonl (sizeof (GNUNET_DatastoreValue) + size + sizeof (DBlock));
if (size != READ (fd, &db[1], size))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_BULK | GE_ADMIN | GE_USER,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_ADMIN | GNUNET_GE_USER,
"READ", filename);
goto FAILURE;
}
@@ -285,18 +285,18 @@
fileBlockGetQuery (db, size + sizeof (DBlock), &mchk.query);
#if DEBUG_UPLOAD
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&mchk.query, &enc));
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Query for current block of size %u is %s\n", size, &enc);
#endif
if (doIndex)
{
- if (GNUNET_SYSERR == FS_index (sock, &fileId, dblock, pos))
+ if (GNUNET_SYSERR == GNUNET_FS_index (sock, &fileId, dblock, pos))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Indexing data failed at position %i.\n"), pos);
goto FAILURE;
}
@@ -308,15 +308,15 @@
fileBlockEncode (db,
size + sizeof (DBlock), &mchk.query, &value))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
goto FAILURE;
}
- GE_ASSERT (ectx, value != NULL);
+ GNUNET_GE_ASSERT (ectx, value != NULL);
*value = *dblock; /* copy options! */
- if (GNUNET_SYSERR == FS_insert (sock, value))
+ if (GNUNET_SYSERR == GNUNET_FS_insert (sock, value))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_free (value);
goto FAILURE;
}
@@ -338,56 +338,56 @@
if (GNUNET_OK != tt (ttClosure))
goto FAILURE;
#if DEBUG_UPLOAD
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Tree depth is %u, walking up tree.\n", treedepth);
#endif
for (i = 0; i < treedepth; i++)
{
- size = ntohl (iblocks[i]->size) - sizeof (Datastore_Value);
- GE_ASSERT (ectx, size < GNUNET_MAX_BUFFER_SIZE);
+ size = ntohl (iblocks[i]->size) - sizeof (GNUNET_DatastoreValue);
+ GNUNET_GE_ASSERT (ectx, size < GNUNET_MAX_BUFFER_SIZE);
if (size == sizeof (DBlock))
{
#if DEBUG_UPLOAD
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER, "Level %u is empty\n", i);
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, "Level
%u is empty\n", i);
#endif
continue;
}
db = (DBlock *) & iblocks[i][1];
fileBlockGetKey (db, size, &mchk.key);
#if DEBUG_UPLOAD
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Computing query for %u bytes content.\n", size);
#endif
fileBlockGetQuery (db, size, &mchk.query);
#if DEBUG_UPLOAD
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&mchk.query, &enc));
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Query for current block at level %u is `%s'.\n", i, &enc);
#endif
if (GNUNET_OK != pushBlock (sock,
&mchk, i + 1, iblocks, priority,
expirationTime))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
goto FAILURE;
}
fileBlockEncode (db, size, &mchk.query, &value);
if (value == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
goto FAILURE;
}
value->expirationTime = GNUNET_htonll (expirationTime);
value->prio = htonl (priority);
- if (GNUNET_SYSERR == FS_insert (sock, value))
+ if (GNUNET_SYSERR == GNUNET_FS_insert (sock, value))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_free (value);
goto FAILURE;
}
@@ -397,9 +397,9 @@
}
#if DEBUG_UPLOAD
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER, GNUNET_hash_to_enc (&mchk.query,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&mchk.query,
&enc));
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Query for top block is %s\n", &enc);
#endif
/* build URI */
Modified: GNUnet/src/applications/fs/ecrs/uri.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/uri.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs/uri.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -97,12 +97,12 @@
unsigned int i;
n =
- keywordCount + strlen (ECRS_URI_PREFIX) + strlen (ECRS_SEARCH_INFIX) + 1;
+ keywordCount + strlen (GNUNET_ECRS_URI_PREFIX) + strlen
(GNUNET_ECRS_SEARCH_INFIX) + 1;
for (i = 0; i < keywordCount; i++)
n += strlen (keywords[i]);
ret = GNUNET_malloc (n);
- strcpy (ret, ECRS_URI_PREFIX);
- strcat (ret, ECRS_SEARCH_INFIX);
+ strcpy (ret, GNUNET_ECRS_URI_PREFIX);
+ strcat (ret, GNUNET_ECRS_SEARCH_INFIX);
for (i = 0; i < keywordCount; i++)
{
strcat (ret, keywords[i]);
@@ -125,14 +125,14 @@
GNUNET_EncName id;
n =
- sizeof (GNUNET_EncName) * 2 + strlen (ECRS_URI_PREFIX) +
- strlen (ECRS_SUBSPACE_INFIX) + 1;
+ sizeof (GNUNET_EncName) * 2 + strlen (GNUNET_ECRS_URI_PREFIX) +
+ strlen (GNUNET_ECRS_SUBSPACE_INFIX) + 1;
ret = GNUNET_malloc (n);
GNUNET_hash_to_enc (namespace, &ns);
GNUNET_hash_to_enc (identifier, &id);
GNUNET_snprintf (ret, n,
"%s%s%s/%s",
- ECRS_URI_PREFIX, ECRS_SUBSPACE_INFIX, (char *) &ns,
+ GNUNET_ECRS_URI_PREFIX, GNUNET_ECRS_SUBSPACE_INFIX, (char
*) &ns,
(char *) &id);
return ret;
}
@@ -152,14 +152,14 @@
GNUNET_hash_to_enc (&fi->chk.query, &queryhash);
n =
- strlen (ECRS_URI_PREFIX) + 2 * sizeof (GNUNET_EncName) + 8 + 16 + 32 +
- strlen (ECRS_FILE_INFIX);
+ strlen (GNUNET_ECRS_URI_PREFIX) + 2 * sizeof (GNUNET_EncName) + 8 + 16 +
32 +
+ strlen (GNUNET_ECRS_FILE_INFIX);
ret = GNUNET_malloc (n);
GNUNET_snprintf (ret,
n,
"%s%s%s.%s.%llu",
- ECRS_URI_PREFIX,
- ECRS_FILE_INFIX,
+ GNUNET_ECRS_URI_PREFIX,
+ GNUNET_ECRS_FILE_INFIX,
(char *) &keyhash, (char *) &queryhash,
GNUNET_ntohll (fi->file_length));
return ret;
@@ -189,8 +189,8 @@
GNUNET_snprintf (ret,
n,
"%s%s%s.%s.%llu.%s.%s.%u",
- ECRS_URI_PREFIX,
- ECRS_LOCATION_INFIX,
+ GNUNET_ECRS_URI_PREFIX,
+ GNUNET_ECRS_LOCATION_INFIX,
(char *) &keyhash,
(char *) &queryhash,
GNUNET_ntohll (loc->fi.file_length),
@@ -204,11 +204,11 @@
* Convert a URI to a UTF-8 String.
*/
char *
-ECRS_uriToString (const struct ECRS_URI *uri)
+GNUNET_ECRS_uri_to_string (const struct GNUNET_ECRS_URI *uri)
{
if (uri == NULL)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return NULL;
}
switch (uri->type)
@@ -224,7 +224,7 @@
case loc:
return createLocURI (&uri->data.loc);
default:
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return NULL;
}
}
@@ -238,7 +238,7 @@
* the number of keywords placed in the array
*/
static int
-parseKeywordURI (struct GE_Context *ectx, const char *uri, char ***keywords)
+parseKeywordURI (struct GNUNET_GE_Context *ectx, const char *uri, char
***keywords)
{
unsigned int pos;
int ret;
@@ -247,16 +247,16 @@
size_t slen;
char *dup;
- GE_ASSERT (ectx, uri != NULL);
+ GNUNET_GE_ASSERT (ectx, uri != NULL);
slen = strlen (uri);
- pos = strlen (ECRS_URI_PREFIX);
+ pos = strlen (GNUNET_ECRS_URI_PREFIX);
- if (0 != strncmp (uri, ECRS_URI_PREFIX, pos))
+ if (0 != strncmp (uri, GNUNET_ECRS_URI_PREFIX, pos))
return GNUNET_SYSERR;
- if (0 != strncmp (&uri[pos], ECRS_SEARCH_INFIX, strlen (ECRS_SEARCH_INFIX)))
+ if (0 != strncmp (&uri[pos], GNUNET_ECRS_SEARCH_INFIX, strlen
(GNUNET_ECRS_SEARCH_INFIX)))
return GNUNET_SYSERR;
- pos += strlen (ECRS_SEARCH_INFIX);
+ pos += strlen (GNUNET_ECRS_SEARCH_INFIX);
if (slen == pos)
{
/* no keywords */
@@ -288,7 +288,7 @@
}
}
(*keywords)[--ret] = GNUNET_strdup (&dup[pos]);
- GE_ASSERT (ectx, ret == 0);
+ GNUNET_GE_ASSERT (ectx, ret == 0);
GNUNET_free (dup);
return iret;
}
@@ -302,7 +302,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if this is not a namespace URI
*/
static int
-parseSubspaceURI (struct GE_Context *ectx,
+parseSubspaceURI (struct GNUNET_GE_Context *ectx,
const char *uri,
GNUNET_HashCode * namespace, GNUNET_HashCode * identifier)
{
@@ -310,17 +310,17 @@
size_t slen;
char *up;
- GE_ASSERT (ectx, uri != NULL);
+ GNUNET_GE_ASSERT (ectx, uri != NULL);
slen = strlen (uri);
- pos = strlen (ECRS_URI_PREFIX);
+ pos = strlen (GNUNET_ECRS_URI_PREFIX);
- if (0 != strncmp (uri, ECRS_URI_PREFIX, pos))
+ if (0 != strncmp (uri, GNUNET_ECRS_URI_PREFIX, pos))
return GNUNET_SYSERR;
if (0 != strncmp (&uri[pos],
- ECRS_SUBSPACE_INFIX, strlen (ECRS_SUBSPACE_INFIX)))
+ GNUNET_ECRS_SUBSPACE_INFIX, strlen
(GNUNET_ECRS_SUBSPACE_INFIX)))
return GNUNET_SYSERR;
- pos += strlen (ECRS_SUBSPACE_INFIX);
+ pos += strlen (GNUNET_ECRS_SUBSPACE_INFIX);
if ((slen < pos + sizeof (GNUNET_EncName) + 1) ||
(!((uri[pos + sizeof (GNUNET_EncName) - 1] == '/') ||
(uri[pos + sizeof (GNUNET_EncName) - 1] == '\\'))))
@@ -354,22 +354,22 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if this is not a file URI
*/
static int
-parseFileURI (struct GE_Context *ectx, const char *uri, FileIdentifier * fi)
+parseFileURI (struct GNUNET_GE_Context *ectx, const char *uri, FileIdentifier
* fi)
{
unsigned int pos;
size_t slen;
char *dup;
- GE_ASSERT (ectx, uri != NULL);
+ GNUNET_GE_ASSERT (ectx, uri != NULL);
slen = strlen (uri);
- pos = strlen (ECRS_URI_PREFIX);
+ pos = strlen (GNUNET_ECRS_URI_PREFIX);
- if (0 != strncmp (uri, ECRS_URI_PREFIX, pos))
+ if (0 != strncmp (uri, GNUNET_ECRS_URI_PREFIX, pos))
return GNUNET_SYSERR;
- if (0 != strncmp (&uri[pos], ECRS_FILE_INFIX, strlen (ECRS_FILE_INFIX)))
+ if (0 != strncmp (&uri[pos], GNUNET_ECRS_FILE_INFIX, strlen
(GNUNET_ECRS_FILE_INFIX)))
return GNUNET_SYSERR;
- pos += strlen (ECRS_FILE_INFIX);
+ pos += strlen (GNUNET_ECRS_FILE_INFIX);
if ((slen < pos + 2 * sizeof (GNUNET_EncName) + 1) ||
(uri[pos + sizeof (GNUNET_EncName) - 1] != '.') ||
(uri[pos + sizeof (GNUNET_EncName) * 2 - 1] != '.'))
@@ -402,7 +402,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if this is not a file URI
*/
static int
-parseLocationURI (struct GE_Context *ectx, const char *uri, Location * loc)
+parseLocationURI (struct GNUNET_GE_Context *ectx, const char *uri, Location *
loc)
{
unsigned int pos;
unsigned int npos;
@@ -412,17 +412,17 @@
char *addr;
- GE_ASSERT (ectx, uri != NULL);
+ GNUNET_GE_ASSERT (ectx, uri != NULL);
addr = NULL;
slen = strlen (uri);
- pos = strlen (ECRS_URI_PREFIX);
+ pos = strlen (GNUNET_ECRS_URI_PREFIX);
- if (0 != strncmp (uri, ECRS_URI_PREFIX, pos))
+ if (0 != strncmp (uri, GNUNET_ECRS_URI_PREFIX, pos))
return GNUNET_SYSERR;
if (0 != strncmp (&uri[pos],
- ECRS_LOCATION_INFIX, strlen (ECRS_LOCATION_INFIX)))
+ GNUNET_ECRS_LOCATION_INFIX, strlen
(GNUNET_ECRS_LOCATION_INFIX)))
return GNUNET_SYSERR;
- pos += strlen (ECRS_LOCATION_INFIX);
+ pos += strlen (GNUNET_ECRS_LOCATION_INFIX);
if ((slen < pos + 2 * sizeof (GNUNET_EncName) + 1) ||
(uri[pos + sizeof (GNUNET_EncName) - 1] != '.') ||
(uri[pos + sizeof (GNUNET_EncName) * 2 - 1] != '.'))
@@ -480,7 +480,7 @@
* Convert a UTF-8 String to a URI.
*/
URI *
-ECRS_stringToUri (struct GE_Context * ectx, const char *uri)
+GNUNET_ECRS_string_to_uri (struct GNUNET_GE_Context * ectx, const char *uri)
{
URI *ret;
int len;
@@ -519,11 +519,11 @@
* Free URI.
*/
void
-ECRS_freeUri (struct ECRS_URI *uri)
+GNUNET_ECRS_uri_destroy (struct GNUNET_ECRS_URI *uri)
{
int i;
- GE_ASSERT (NULL, uri != NULL);
+ GNUNET_GE_ASSERT (NULL, uri != NULL);
switch (uri->type)
{
case ksk:
@@ -545,7 +545,7 @@
* Is this a namespace URI?
*/
int
-ECRS_isNamespaceUri (const struct ECRS_URI *uri)
+GNUNET_ECRS_uri_test_sks (const struct GNUNET_ECRS_URI *uri)
{
return uri->type == sks;
}
@@ -557,7 +557,7 @@
* must free it.
*/
char *
-ECRS_getNamespaceName (const GNUNET_HashCode * id)
+GNUNET_ECRS_get_namespace_name (const GNUNET_HashCode * id)
{
char *ret;
@@ -573,11 +573,11 @@
* @return GNUNET_OK on success
*/
int
-ECRS_getNamespaceId (const struct ECRS_URI *uri, GNUNET_HashCode * id)
+GNUNET_ECRS_uri_get_namespace_from_sks (const struct GNUNET_ECRS_URI *uri,
GNUNET_HashCode * id)
{
- if (!ECRS_isNamespaceUri (uri))
+ if (!GNUNET_ECRS_uri_test_sks (uri))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
*id = uri->data.sks.namespace;
@@ -590,11 +590,11 @@
* @return GNUNET_OK on success
*/
int
-ECRS_getSKSContentHash (const struct ECRS_URI *uri, GNUNET_HashCode * id)
+GNUNET_ECRS_uri_get_content_hash_from_sks (const struct GNUNET_ECRS_URI *uri,
GNUNET_HashCode * id)
{
- if (!ECRS_isNamespaceUri (uri))
+ if (!GNUNET_ECRS_uri_test_sks (uri))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
*id = uri->data.sks.identifier;
@@ -605,7 +605,7 @@
* Is this a keyword URI?
*/
int
-ECRS_isKeywordUri (const struct ECRS_URI *uri)
+GNUNET_ECRS_uri_test_ksk (const struct GNUNET_ECRS_URI *uri)
{
#if EXTRA_CHECKS
int i;
@@ -613,7 +613,7 @@
if (uri->type == ksk)
{
for (i = uri->data.ksk.keywordCount - 1; i >= 0; i--)
- GE_ASSERT (NULL, uri->data.ksk.keywords[i] != NULL);
+ GNUNET_GE_ASSERT (NULL, uri->data.ksk.keywords[i] != NULL);
}
#endif
return uri->type == ksk;
@@ -625,7 +625,7 @@
* @return 0 if this is not a keyword URI
*/
unsigned int
-ECRS_countKeywordsOfUri (const struct ECRS_URI *uri)
+GNUNET_ECRS_uri_get_keyword_count_from_ksk (const struct GNUNET_ECRS_URI *uri)
{
if (uri->type != ksk)
return 0;
@@ -638,8 +638,8 @@
* keywords iterated over until iterator aborted
*/
int
-ECRS_getKeywordsFromUri (const struct ECRS_URI *uri,
- ECRS_KeywordIterator iterator, void *cls)
+GNUNET_ECRS_uri_get_keywords_from_ksk (const struct GNUNET_ECRS_URI *uri,
+ GNUNET_ECRS_KeywordIterator iterator, void *cls)
{
int i;
if (uri->type != ksk)
@@ -661,7 +661,7 @@
* Is this a file (or directory) URI?
*/
int
-ECRS_isFileUri (const struct ECRS_URI *uri)
+GNUNET_ECRS_uri_test_chk (const struct GNUNET_ECRS_URI *uri)
{
return uri->type == chk;
}
@@ -670,7 +670,7 @@
* Is this a location URI? (DHT specific!)
*/
int
-ECRS_isLocationUri (const struct ECRS_URI *uri)
+GNUNET_ECRS_uri_test_loc (const struct GNUNET_ECRS_URI *uri)
{
return uri->type == loc;
}
@@ -681,7 +681,7 @@
* refers to?
*/
unsigned long long
-ECRS_fileSize (const struct ECRS_URI *uri)
+GNUNET_ECRS_uri_get_file_siz (const struct GNUNET_ECRS_URI *uri)
{
switch (uri->type)
{
@@ -690,7 +690,7 @@
case loc:
return GNUNET_ntohll (uri->data.loc.fi.file_length);
default:
- GE_ASSERT (NULL, 0);
+ GNUNET_GE_ASSERT (NULL, 0);
}
return 0; /* unreachable */
}
@@ -700,9 +700,9 @@
* Duplicate URI.
*/
URI *
-ECRS_dupUri (const URI * uri)
+GNUNET_ECRS_uri_duplicate (const URI * uri)
{
- struct ECRS_URI *ret;
+ struct GNUNET_ECRS_URI *ret;
int i;
ret = GNUNET_malloc (sizeof (URI));
@@ -733,7 +733,7 @@
* keyword.
*/
URI *
-ECRS_dateExpandKeywordUri (const URI * uri)
+GNUNET_ECRS_uri_expand_keywords_with_date (const URI * uri)
{
URI *ret;
int i;
@@ -743,7 +743,7 @@
time_t now;
unsigned int keywordCount;
- GE_ASSERT (NULL, uri->type == ksk);
+ GNUNET_GE_ASSERT (NULL, uri->type == ksk);
time (&now);
#ifdef HAVE_GMTIME_R
gmtime_r (&now, &t);
@@ -762,7 +762,7 @@
for (i = 0; i < keywordCount; i++)
{
key = uri->data.ksk.keywords[i];
- GE_ASSERT (NULL, key != NULL);
+ GNUNET_GE_ASSERT (NULL, key != NULL);
ret->data.ksk.keywords[2 * i] = GNUNET_strdup (key);
kd = GNUNET_malloc (strlen (key) + 13);
memset (kd, 0, strlen (key) + 13);
@@ -784,7 +784,7 @@
* that lists all keywords that can be found in the meta-data).
*/
URI *
-ECRS_metaDataToUri (const MetaData * md)
+GNUNET_ECRS_meta_data_to_uri (const MetaData * md)
{
URI *ret;
int i;
@@ -839,7 +839,7 @@
}
if (add == 1)
{
- GE_ASSERT (NULL, md->items[i].data != NULL);
+ GNUNET_GE_ASSERT (NULL, md->items[i].data != NULL);
ret->data.ksk.keywords[i - havePreview]
= GNUNET_strdup (md->items[i].data);
}
@@ -852,8 +852,8 @@
* Convert a NULL-terminated array of keywords
* to an ECRS URI.
*/
-struct ECRS_URI *
-ECRS_keywordsToUri (const char *keyword[])
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_keyword_strings_to_uri (const char *keyword[])
{
unsigned int count;
URI *ret;
@@ -880,14 +880,14 @@
* Are these two URIs equal?
*/
int
-ECRS_equalsUri (const struct ECRS_URI *uri1, const struct ECRS_URI *uri2)
+GNUNET_ECRS_uri_test_equal (const struct GNUNET_ECRS_URI *uri1, const struct
GNUNET_ECRS_URI *uri2)
{
int ret;
int i;
int j;
- GE_ASSERT (NULL, uri1 != NULL);
- GE_ASSERT (NULL, uri2 != NULL);
+ GNUNET_GE_ASSERT (NULL, uri1 != NULL);
+ GNUNET_GE_ASSERT (NULL, uri2 != NULL);
if (uri1->type != uri2->type)
return GNUNET_NO;
switch (uri1->type)
@@ -945,7 +945,7 @@
* @return -1 if this is not a location URI, otherwise GNUNET_OK
*/
int
-ECRS_getPeerFromUri (const struct ECRS_URI *uri, GNUNET_PeerIdentity * peer)
+GNUNET_ECRS_uri_get_peer_identity_from_loc (const struct GNUNET_ECRS_URI *uri,
GNUNET_PeerIdentity * peer)
{
if (uri->type != loc)
return -1;
@@ -959,14 +959,14 @@
*
* @return NULL if argument is not a location URI
*/
-struct ECRS_URI *
-ECRS_getContentUri (const struct ECRS_URI *uri)
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_uri_get_content_uri_from_loc (const struct GNUNET_ECRS_URI *uri)
{
- struct ECRS_URI *ret;
+ struct GNUNET_ECRS_URI *ret;
if (uri->type != loc)
return NULL;
- ret = GNUNET_malloc (sizeof (struct ECRS_URI));
+ ret = GNUNET_malloc (sizeof (struct GNUNET_ECRS_URI));
ret->type = chk;
ret->data.fi = uri->data.loc.fi;
return ret;
@@ -985,18 +985,18 @@
* RSA signatures for "sender".
* @return the location URI
*/
-struct ECRS_URI *
-ECRS_uriFromLocation (const struct ECRS_URI *baseUri,
+struct GNUNET_ECRS_URI *
+GNUNET_ECRS_location_to_uri (const struct GNUNET_ECRS_URI *baseUri,
const GNUNET_RSA_PublicKey * sender,
GNUNET_Int32Time expirationTime,
- ECRS_SignFunction signer, void *signer_cls)
+ GNUNET_ECRS_SignFunction signer, void *signer_cls)
{
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
if (baseUri->type != chk)
return NULL;
- uri = GNUNET_malloc (sizeof (struct ECRS_URI));
+ uri = GNUNET_malloc (sizeof (struct GNUNET_ECRS_URI));
uri->type = loc;
uri->data.loc.fi = baseUri->data.fi;
uri->data.loc.peer = *sender;
Modified: GNUnet/src/applications/fs/ecrs/uritest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/uritest.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs/uritest.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -36,103 +36,103 @@
testKeyword ()
{
char *uri;
- struct ECRS_URI *ret;
+ struct GNUNET_ECRS_URI *ret;
- if (NULL != ECRS_stringToUri (NULL, "gnunet://ecrs/ksk/++"))
+ if (NULL != GNUNET_ECRS_string_to_uri (NULL, "gnunet://ecrs/ksk/++"))
ABORT ();
- ret = ECRS_stringToUri (NULL, "gnunet://ecrs/ksk/foo+bar");
+ ret = GNUNET_ECRS_string_to_uri (NULL, "gnunet://ecrs/ksk/foo+bar");
if (ret == NULL)
ABORT ();
- if (!ECRS_isKeywordUri (ret))
+ if (!GNUNET_ECRS_uri_test_ksk (ret))
{
- ECRS_freeUri (ret);
+ GNUNET_ECRS_uri_destroy (ret);
ABORT ();
}
if ((2 != ret->data.ksk.keywordCount) ||
(0 != strcmp ("foo", ret->data.ksk.keywords[0])) ||
(0 != strcmp ("bar", ret->data.ksk.keywords[1])))
{
- ECRS_freeUri (ret);
+ GNUNET_ECRS_uri_destroy (ret);
ABORT ();
}
- uri = ECRS_uriToString (ret);
+ uri = GNUNET_ECRS_uri_to_string (ret);
if (0 != strcmp (uri, "gnunet://ecrs/ksk/foo+bar"))
{
GNUNET_free (uri);
- ECRS_freeUri (ret);
+ GNUNET_ECRS_uri_destroy (ret);
ABORT ();
}
GNUNET_free (uri);
- ECRS_freeUri (ret);
+ GNUNET_ECRS_uri_destroy (ret);
return 0;
}
static int
testLocation ()
{
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
char *uric;
- struct ECRS_URI *uri2;
+ struct GNUNET_ECRS_URI *uri2;
GNUNET_RSA_PublicKey pk;
struct GNUNET_RSA_PrivateKey *hk;
- struct ECRS_URI *baseURI;
+ struct GNUNET_ECRS_URI *baseURI;
baseURI =
- ECRS_stringToUri (NULL,
+ GNUNET_ECRS_string_to_uri (NULL,
"gnunet://ecrs/chk/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820.RNVVVVOOLCLK065B5D04HTNVNSIB2AI022RG8200HSLK1CO1000ATQ98824DMA2032LIMG50CG0K057NVUVG200000H000004400000.42");
hk = GNUNET_RSA_create_key ();
GNUNET_RSA_get_public_key (hk, &pk);
- uri = ECRS_uriFromLocation (baseURI,
- &pk, 43, (ECRS_SignFunction) & GNUNET_RSA_sign,
+ uri = GNUNET_ECRS_location_to_uri (baseURI,
+ &pk, 43, (GNUNET_ECRS_SignFunction) &
GNUNET_RSA_sign,
hk);
GNUNET_RSA_free_key (hk);
if (uri == NULL)
{
- GE_BREAK (NULL, 0);
- ECRS_freeUri (baseURI);
+ GNUNET_GE_BREAK (NULL, 0);
+ GNUNET_ECRS_uri_destroy (baseURI);
return 1;
}
- if (!ECRS_isLocationUri (uri))
+ if (!GNUNET_ECRS_uri_test_loc (uri))
{
- GE_BREAK (NULL, 0);
- ECRS_freeUri (uri);
- ECRS_freeUri (baseURI);
+ GNUNET_GE_BREAK (NULL, 0);
+ GNUNET_ECRS_uri_destroy (uri);
+ GNUNET_ECRS_uri_destroy (baseURI);
return 1;
}
- uri2 = ECRS_getContentUri (uri);
- if (!ECRS_equalsUri (baseURI, uri2))
+ uri2 = GNUNET_ECRS_uri_get_content_uri_from_loc (uri);
+ if (!GNUNET_ECRS_uri_test_equal (baseURI, uri2))
{
- GE_BREAK (NULL, 0);
- ECRS_freeUri (uri);
- ECRS_freeUri (uri2);
- ECRS_freeUri (baseURI);
+ GNUNET_GE_BREAK (NULL, 0);
+ GNUNET_ECRS_uri_destroy (uri);
+ GNUNET_ECRS_uri_destroy (uri2);
+ GNUNET_ECRS_uri_destroy (baseURI);
return 1;
}
- ECRS_freeUri (uri2);
- ECRS_freeUri (baseURI);
- uric = ECRS_uriToString (uri);
+ GNUNET_ECRS_uri_destroy (uri2);
+ GNUNET_ECRS_uri_destroy (baseURI);
+ uric = GNUNET_ECRS_uri_to_string (uri);
#if 0
/* not for the faint of heart: */
printf ("URI: `%s'\n", uric);
#endif
- uri2 = ECRS_stringToUri (NULL, uric);
+ uri2 = GNUNET_ECRS_string_to_uri (NULL, uric);
GNUNET_free (uric);
if (uri2 == NULL)
{
- GE_BREAK (NULL, 0);
- ECRS_freeUri (uri);
+ GNUNET_GE_BREAK (NULL, 0);
+ GNUNET_ECRS_uri_destroy (uri);
return 1;
}
- if (GNUNET_YES != ECRS_equalsUri (uri, uri2))
+ if (GNUNET_YES != GNUNET_ECRS_uri_test_equal (uri, uri2))
{
- GE_BREAK (NULL, 0);
- ECRS_freeUri (uri);
- ECRS_freeUri (uri2);
+ GNUNET_GE_BREAK (NULL, 0);
+ GNUNET_ECRS_uri_destroy (uri);
+ GNUNET_ECRS_uri_destroy (uri2);
return 1;
}
- ECRS_freeUri (uri2);
- ECRS_freeUri (uri);
+ GNUNET_ECRS_uri_destroy (uri2);
+ GNUNET_ECRS_uri_destroy (uri);
return 0;
}
@@ -140,44 +140,44 @@
testNamespace (int i)
{
char *uri;
- struct ECRS_URI *ret;
+ struct GNUNET_ECRS_URI *ret;
if (NULL !=
- ECRS_stringToUri (NULL,
+ GNUNET_ECRS_string_to_uri (NULL,
"gnunet://ecrs/sks/D1KJS9H2A82Q65VKQ0ML3RFU6U1D3VUK"))
ABORT ();
if (NULL !=
- ECRS_stringToUri (NULL,
+ GNUNET_ECRS_string_to_uri (NULL,
"gnunet://ecrs/sks/D1KJS9H2A82Q65VKQ0ML3RFU6U1D3V/test"))
ABORT ();
- if (NULL != ECRS_stringToUri (NULL, "gnunet://ecrs/sks/test"))
+ if (NULL != GNUNET_ECRS_string_to_uri (NULL, "gnunet://ecrs/sks/test"))
ABORT ();
ret =
- ECRS_stringToUri (NULL,
+ GNUNET_ECRS_string_to_uri (NULL,
"gnunet://ecrs/sks/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820/test");
if (ret == NULL)
ABORT ();
- if (ECRS_isKeywordUri (ret))
+ if (GNUNET_ECRS_uri_test_ksk (ret))
{
- ECRS_freeUri (ret);
+ GNUNET_ECRS_uri_destroy (ret);
ABORT ();
}
- if (!ECRS_isNamespaceUri (ret))
+ if (!GNUNET_ECRS_uri_test_sks (ret))
{
- ECRS_freeUri (ret);
+ GNUNET_ECRS_uri_destroy (ret);
ABORT ();
}
- uri = ECRS_uriToString (ret);
+ uri = GNUNET_ECRS_uri_to_string (ret);
if (0 != strcmp (uri,
"gnunet://ecrs/sks/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820/TOJB1NAAUVJKJAGQHRHS22N9I8VM32C0ESN4EFS836IT950E1MP7LGC5V2GE3LFO9U4BP23VQPTH8DPIOC2CONT9LM76ULVL00KAHVO"))
{
- ECRS_freeUri (ret);
+ GNUNET_ECRS_uri_destroy (ret);
GNUNET_free (uri);
ABORT ();
}
GNUNET_free (uri);
- ECRS_freeUri (ret);
+ GNUNET_ECRS_uri_destroy (ret);
return 0;
}
@@ -185,51 +185,51 @@
testFile (int i)
{
char *uri;
- struct ECRS_URI *ret;
+ struct GNUNET_ECRS_URI *ret;
if (NULL !=
- ECRS_stringToUri (NULL,
+ GNUNET_ECRS_string_to_uri (NULL,
"gnunet://ecrs/chk/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820.RNVVVVOOLCLK065B5D04HTNVNSIB2AI022RG8200HSLK1CO1000ATQ98824DMA2032LIMG50CG0K057NVUVG200000H00000440000.42"))
ABORT ();
if (NULL !=
- ECRS_stringToUri (NULL,
+ GNUNET_ECRS_string_to_uri (NULL,
"gnunet://ecrs/chk/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820.RNVVVVOOLCLK065B5D04HTNVNSIB2AI022RG8200HSLK1CO1000ATQ98824DMA2032LIMG50CG0K057NVUVG200000H000004400000"))
ABORT ();
if (NULL !=
- ECRS_stringToUri (NULL,
+ GNUNET_ECRS_string_to_uri (NULL,
"gnunet://ecrs/chk/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820.RNVVVVOOLCLK065B5D04HTNVNSIB2AI022RG8200HSLK1CO1000ATQ98824DMA2032LIMG50CG0K057NVUVG200000H000004400000.FGH"))
ABORT ();
ret =
- ECRS_stringToUri (NULL,
+ GNUNET_ECRS_string_to_uri (NULL,
"gnunet://ecrs/chk/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820.RNVVVVOOLCLK065B5D04HTNVNSIB2AI022RG8200HSLK1CO1000ATQ98824DMA2032LIMG50CG0K057NVUVG200000H000004400000.42");
if (ret == NULL)
ABORT ();
- if (ECRS_isKeywordUri (ret))
+ if (GNUNET_ECRS_uri_test_ksk (ret))
{
- ECRS_freeUri (ret);
+ GNUNET_ECRS_uri_destroy (ret);
ABORT ();
}
- if (ECRS_isNamespaceUri (ret))
+ if (GNUNET_ECRS_uri_test_sks (ret))
{
- ECRS_freeUri (ret);
+ GNUNET_ECRS_uri_destroy (ret);
ABORT ();
}
if (GNUNET_ntohll (ret->data.fi.file_length) != 42)
{
- ECRS_freeUri (ret);
+ GNUNET_ECRS_uri_destroy (ret);
ABORT ();
}
- uri = ECRS_uriToString (ret);
+ uri = GNUNET_ECRS_uri_to_string (ret);
if (0 != strcmp (uri,
"gnunet://ecrs/chk/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820.RNVVVVOOLCLK065B5D04HTNVNSIB2AI022RG8200HSLK1CO1000ATQ98824DMA2032LIMG50CG0K057NVUVG200000H000004400000.42"))
{
GNUNET_free (uri);
- ECRS_freeUri (ret);
+ GNUNET_ECRS_uri_destroy (ret);
ABORT ();
}
GNUNET_free (uri);
- ECRS_freeUri (ret);
+ GNUNET_ECRS_uri_destroy (ret);
return 0;
}
Modified: GNUnet/src/applications/fs/ecrs_core.c
===================================================================
--- GNUnet/src/applications/fs/ecrs_core.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs_core.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -46,28 +46,28 @@
int
fileBlockEncode (const DBlock * data,
unsigned int len,
- const GNUNET_HashCode * query, Datastore_Value ** value)
+ const GNUNET_HashCode * query, GNUNET_DatastoreValue ** value)
{
GNUNET_HashCode hc;
GNUNET_AES_SessionKey skey;
GNUNET_AES_InitializationVector iv; /* initial value */
- Datastore_Value *val;
+ GNUNET_DatastoreValue *val;
DBlock *db;
- GE_ASSERT (NULL, len >= sizeof (DBlock));
- GE_ASSERT (NULL, (data != NULL) && (query != NULL));
+ GNUNET_GE_ASSERT (NULL, len >= sizeof (DBlock));
+ GNUNET_GE_ASSERT (NULL, (data != NULL) && (query != NULL));
GNUNET_hash (&data[1], len - sizeof (DBlock), &hc);
GNUNET_hash_to_AES_key (&hc, &skey, &iv);
- val = GNUNET_malloc (sizeof (Datastore_Value) + len);
- val->size = htonl (sizeof (Datastore_Value) + len);
- val->type = htonl (D_BLOCK);
+ val = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + len);
+ val->size = htonl (sizeof (GNUNET_DatastoreValue) + len);
+ val->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
val->prio = htonl (0);
val->anonymityLevel = htonl (0);
val->expirationTime = GNUNET_htonll (0);
db = (DBlock *) & val[1];
- db->type = htonl (D_BLOCK);
- GE_ASSERT (NULL, len - sizeof (DBlock) < GNUNET_MAX_BUFFER_SIZE);
- GE_ASSERT (NULL,
+ db->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
+ GNUNET_GE_ASSERT (NULL, len - sizeof (DBlock) < GNUNET_MAX_BUFFER_SIZE);
+ GNUNET_GE_ASSERT (NULL,
len - sizeof (DBlock)
== GNUNET_AES_encrypt (&data[1],
len - sizeof (DBlock), &skey, &iv,
@@ -90,7 +90,7 @@
void
fileBlockGetKey (const DBlock * data, unsigned int len, GNUNET_HashCode * key)
{
- GE_ASSERT (NULL, len >= sizeof (DBlock));
+ GNUNET_GE_ASSERT (NULL, len >= sizeof (DBlock));
GNUNET_hash (&data[1], len - sizeof (DBlock), key);
}
@@ -110,14 +110,14 @@
GNUNET_AES_SessionKey skey;
GNUNET_AES_InitializationVector iv;
- GE_ASSERT (NULL, len >= sizeof (DBlock));
+ GNUNET_GE_ASSERT (NULL, len >= sizeof (DBlock));
data = (const char *) &db[1];
len -= sizeof (DBlock);
- GE_ASSERT (NULL, len < GNUNET_MAX_BUFFER_SIZE);
+ GNUNET_GE_ASSERT (NULL, len < GNUNET_MAX_BUFFER_SIZE);
GNUNET_hash (data, len, &hc);
GNUNET_hash_to_AES_key (&hc, &skey, &iv);
tmp = GNUNET_malloc (len);
- GE_ASSERT (NULL, len == GNUNET_AES_encrypt (data, len, &skey, &iv, tmp));
+ GNUNET_GE_ASSERT (NULL, len == GNUNET_AES_encrypt (data, len, &skey, &iv,
tmp));
GNUNET_hash (tmp, len, query);
GNUNET_free (tmp);
}
@@ -127,8 +127,8 @@
{
if (size <= 4)
{
- GE_BREAK (NULL, 0);
- return ANY_BLOCK; /* signal error */
+ GNUNET_GE_BREAK (NULL, 0);
+ return GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY; /* signal error */
}
return ntohl (*((const unsigned int *) data));
}
@@ -149,23 +149,23 @@
unsigned int type;
type = getTypeOfBlock (size, data);
- if (type == ANY_BLOCK)
+ if (type == GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
switch (type)
{
- case D_BLOCK:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA:
/* CHK: GNUNET_hash of content == query */
GNUNET_hash (&data[1], size - sizeof (DBlock), query);
return GNUNET_OK;
- case S_BLOCK:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_SIGNED:
{
const SBlock *sb;
if (size < sizeof (SBlock))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
sb = (const SBlock *) data;
@@ -177,18 +177,18 @@
- sizeof (unsigned int),
&sb->signature, &sb->subspace)))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
*query = sb->identifier;
return GNUNET_OK;
}
- case K_BLOCK:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD:
{
const KBlock *kb;
if (size < sizeof (KBlock))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
kb = (const KBlock *) data;
@@ -198,18 +198,18 @@
&kb->signature,
&kb->keyspace))))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
GNUNET_hash (&kb->keyspace, sizeof (GNUNET_RSA_PublicKey), query);
return GNUNET_OK;
}
- case N_BLOCK:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_NAMESPACE:
{
const NBlock *nb;
if (size < sizeof (NBlock))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
nb = (const NBlock *) data;
@@ -221,18 +221,18 @@
- sizeof (unsigned int),
&nb->signature, &nb->subspace)))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
*query = nb->namespace; /* XOR with all zeros makes no difference... */
return GNUNET_OK;
}
- case KN_BLOCK:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE:
{
const KNBlock *kb;
if (size < sizeof (KNBlock))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
kb = (const KNBlock *) data;
@@ -244,21 +244,21 @@
&kb->kblock.signature,
&kb->kblock.keyspace))))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
GNUNET_hash (&kb->kblock.keyspace, sizeof (GNUNET_RSA_PublicKey),
query);
return GNUNET_OK;
}
- case ONDEMAND_BLOCK:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND:
{
- GE_BREAK (NULL, 0); /* should never be used here! */
+ GNUNET_GE_BREAK (NULL, 0); /* should never be used here! */
return GNUNET_SYSERR;
}
default:
{
- GE_BREAK (NULL, 0); /* unknown block type */
+ GNUNET_GE_BREAK (NULL, 0); /* unknown block type */
return GNUNET_SYSERR;
}
} /* end switch */
@@ -291,12 +291,12 @@
if (type != getTypeOfBlock (size, data))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR; /* type mismatch */
}
if (0 != memcmp (hc, &keys[0], sizeof (GNUNET_HashCode)))
{
- GE_BREAK (NULL, 0); /* mismatch between primary queries,
+ GNUNET_GE_BREAK (NULL, 0); /* mismatch between primary queries,
we should not even see those here. */
return GNUNET_SYSERR;
}
@@ -304,7 +304,7 @@
return GNUNET_YES; /* request was to match only primary key */
switch (type)
{
- case S_BLOCK:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_SIGNED:
if (keyCount != 2)
return GNUNET_SYSERR; /* no match */
GNUNET_hash (&((const SBlock *) data)->subspace,
@@ -312,7 +312,7 @@
if (0 == memcmp (&keys[1], &h, sizeof (GNUNET_HashCode)))
return GNUNET_OK;
return GNUNET_SYSERR;
- case N_BLOCK:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_NAMESPACE:
if (keyCount != 2)
return GNUNET_SYSERR; /* no match */
GNUNET_hash (&((const NBlock *) data)->subspace,
@@ -320,17 +320,17 @@
if (0 != memcmp (&keys[1], &h, sizeof (GNUNET_HashCode)))
return GNUNET_SYSERR;
return GNUNET_OK;
- case D_BLOCK:
- case K_BLOCK:
- case KN_BLOCK:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE:
if (keyCount != 1)
- GE_BREAK (NULL, 0); /* keyCount should be 1 */
+ GNUNET_GE_BREAK (NULL, 0); /* keyCount should be 1 */
return GNUNET_OK; /* if query matches, everything matches! */
- case ANY_BLOCK:
- GE_BREAK (NULL, 0); /* block type should be known */
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY:
+ GNUNET_GE_BREAK (NULL, 0); /* block type should be known */
return GNUNET_SYSERR;
default:
- GE_BREAK (NULL, 0); /* unknown block type */
+ GNUNET_GE_BREAK (NULL, 0); /* unknown block type */
return GNUNET_SYSERR;
}
}
Modified: GNUnet/src/applications/fs/ecrs_core_test.c
===================================================================
--- GNUnet/src/applications/fs/ecrs_core_test.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/ecrs_core_test.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -34,7 +34,7 @@
testEC ()
{
DBlock *data;
- Datastore_Value *value;
+ GNUNET_DatastoreValue *value;
GNUNET_HashCode query;
GNUNET_HashCode key;
unsigned int len;
@@ -42,14 +42,14 @@
len = sizeof (DBlock) + 42;
data = GNUNET_malloc (len);
memset (&data[1], rand (), len - sizeof (DBlock));
- data->type = htonl (D_BLOCK);
- CHECK (D_BLOCK == getTypeOfBlock (len, data), data);
+ data->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
+ CHECK (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA == getTypeOfBlock (len, data),
data);
fileBlockGetKey (data, len, &key);
fileBlockGetQuery (data, len, &query);
CHECK (GNUNET_OK == fileBlockEncode (data, len, &query, &value), data);
memcpy (data, &value[1], len);
GNUNET_free (value);
- CHECK (GNUNET_YES == isDatumApplicable (D_BLOCK,
+ CHECK (GNUNET_YES == isDatumApplicable (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA,
len, data, &query, 1, &query),
data);
GNUNET_free (data);
Modified: GNUnet/src/applications/fs/fsui/deserialize.c
===================================================================
--- GNUnet/src/applications/fs/fsui/deserialize.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/fsui/deserialize.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -58,11 +58,11 @@
#define READLONG(a) if (GNUNET_OK != read_long(fd, (long long*) &a)) return
GNUNET_SYSERR;
-static struct ECRS_URI *
-read_uri (struct GE_Context *ectx, int fd)
+static struct GNUNET_ECRS_URI *
+read_uri (struct GNUNET_GE_Context *ectx, int fd)
{
char *buf;
- struct ECRS_URI *ret;
+ struct GNUNET_ECRS_URI *ret;
unsigned int size;
if (GNUNET_OK != read_int (fd, (int *) &size))
@@ -74,8 +74,8 @@
GNUNET_free (buf);
return NULL;
}
- ret = ECRS_stringToUri (ectx, buf);
- GE_BREAK (ectx, ret != NULL);
+ ret = GNUNET_ECRS_string_to_uri (ectx, buf);
+ GNUNET_GE_BREAK (ectx, ret != NULL);
GNUNET_free (buf);
return ret;
}
@@ -105,29 +105,29 @@
#define READSTRING(c, max) if (NULL == (c = read_string(fd, max))) return
GNUNET_SYSERR;
static void
-fixState (FSUI_State * state)
+fixState (GNUNET_FSUI_State * state)
{
switch (*state)
{ /* try to correct errors */
- case FSUI_ACTIVE:
- *state = FSUI_PENDING;
+ case GNUNET_FSUI_ACTIVE:
+ *state = GNUNET_FSUI_PENDING;
break;
- case FSUI_PENDING:
- case FSUI_COMPLETED_JOINED:
- case FSUI_ABORTED_JOINED:
- case FSUI_ERROR_JOINED:
+ case GNUNET_FSUI_PENDING:
+ case GNUNET_FSUI_COMPLETED_JOINED:
+ case GNUNET_FSUI_ABORTED_JOINED:
+ case GNUNET_FSUI_ERROR_JOINED:
break;
- case FSUI_ERROR:
- *state = FSUI_ERROR_JOINED;
+ case GNUNET_FSUI_ERROR:
+ *state = GNUNET_FSUI_ERROR_JOINED;
break;
- case FSUI_ABORTED:
- *state = FSUI_ABORTED_JOINED;
+ case GNUNET_FSUI_ABORTED:
+ *state = GNUNET_FSUI_ABORTED_JOINED;
break;
- case FSUI_COMPLETED:
- *state = FSUI_COMPLETED_JOINED;
+ case GNUNET_FSUI_COMPLETED:
+ *state = GNUNET_FSUI_COMPLETED_JOINED;
break;
default:
- *state = FSUI_ERROR_JOINED;
+ *state = GNUNET_FSUI_ERROR_JOINED;
break;
}
}
@@ -138,35 +138,35 @@
*
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-static struct ECRS_MetaData *
-read_meta (struct GE_Context *ectx, int fd)
+static struct GNUNET_ECRS_MetaData *
+read_meta (struct GNUNET_GE_Context *ectx, int fd)
{
unsigned int size;
char *buf;
- struct ECRS_MetaData *meta;
+ struct GNUNET_ECRS_MetaData *meta;
if (read_int (fd, (int *) &size) != GNUNET_OK)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return NULL;
}
if (size > 1024 * 1024)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return NULL;
}
buf = GNUNET_malloc (size);
if (size != READ (fd, buf, size))
{
GNUNET_free (buf);
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return NULL;
}
- meta = ECRS_deserializeMetaData (ectx, buf, size);
+ meta = GNUNET_ECRS_meta_data_deserialize (ectx, buf, size);
if (meta == NULL)
{
GNUNET_free (buf);
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return NULL;
}
GNUNET_free (buf);
@@ -179,12 +179,12 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
static int
-readFileInfo (struct GE_Context *ectx, int fd, ECRS_FileInfo * fi)
+readFileInfo (struct GNUNET_GE_Context *ectx, int fd, GNUNET_ECRS_FileInfo *
fi)
{
fi->meta = read_meta (ectx, fd);
if (fi->meta == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
fi->uri = NULL;
@@ -192,9 +192,9 @@
fi->uri = read_uri (ectx, fd);
if (fi->uri == NULL)
{
- ECRS_freeMetaData (fi->meta);
+ GNUNET_ECRS_meta_data_destroy (fi->meta);
fi->meta = NULL;
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
return GNUNET_OK;
@@ -209,22 +209,22 @@
* @return NULL on error AND on read of empty
* list (these two cannot be distinguished)
*/
-static FSUI_DownloadList *
-readDownloadList (struct GE_Context *ectx,
- int fd, FSUI_Context * ctx, FSUI_DownloadList * parent)
+static GNUNET_FSUI_DownloadList *
+readDownloadList (struct GNUNET_GE_Context *ectx,
+ int fd, GNUNET_FSUI_Context * ctx, GNUNET_FSUI_DownloadList
* parent)
{
- FSUI_DownloadList *ret;
- FSUI_SearchList *pos;
+ GNUNET_FSUI_DownloadList *ret;
+ GNUNET_FSUI_SearchList *pos;
unsigned int big;
int i;
int ok;
int soff;
- GE_ASSERT (ectx, ctx != NULL);
+ GNUNET_GE_ASSERT (ectx, ctx != NULL);
if ((GNUNET_OK != read_int (fd, (int *) &big)) || (big == 0))
return NULL;
- ret = GNUNET_malloc (sizeof (FSUI_DownloadList));
- memset (ret, 0, sizeof (FSUI_DownloadList));
+ ret = GNUNET_malloc (sizeof (GNUNET_FSUI_DownloadList));
+ memset (ret, 0, sizeof (GNUNET_FSUI_DownloadList));
ret->ctx = ctx;
if ((GNUNET_OK != read_int (fd, (int *) &soff)) ||
(GNUNET_OK != read_int (fd, (int *) &ret->state)) ||
@@ -237,7 +237,7 @@
(GNUNET_OK != read_long (fd, (long long *) &ret->runTime)) ||
(GNUNET_OK != read_int (fd, (int *) &big)) || (big > 1024 * 1024))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
GNUNET_free (ret);
return NULL;
}
@@ -246,14 +246,14 @@
ret->filename[big] = '\0';
if (big != READ (fd, ret->filename, big))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_free (ret->filename);
GNUNET_free (ret);
return NULL;
}
if (GNUNET_OK != readFileInfo (ectx, fd, &ret->fi))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
GNUNET_free (ret->filename);
GNUNET_free (ret);
return NULL;
@@ -261,7 +261,7 @@
if (ret->completedDownloadsCount > 0)
ret->completedDownloads
=
- GNUNET_malloc (sizeof (struct ECRS_URI *) *
+ GNUNET_malloc (sizeof (struct GNUNET_ECRS_URI *) *
ret->completedDownloadsCount);
ok = GNUNET_YES;
for (i = 0; i < ret->completedDownloadsCount; i++)
@@ -269,23 +269,23 @@
ret->completedDownloads[i] = read_uri (ectx, fd);
if (ret->completedDownloads[i] == NULL)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
ok = GNUNET_NO;
}
}
if (GNUNET_NO == ok)
{
GNUNET_free (ret->filename);
- ECRS_freeUri (ret->fi.uri);
- ECRS_freeMetaData (ret->fi.meta);
+ GNUNET_ECRS_uri_destroy (ret->fi.uri);
+ GNUNET_ECRS_meta_data_destroy (ret->fi.meta);
for (i = 0; i < ret->completedDownloadsCount; i++)
{
if (ret->completedDownloads[i] != NULL)
- ECRS_freeUri (ret->completedDownloads[i]);
+ GNUNET_ECRS_uri_destroy (ret->completedDownloads[i]);
}
GNUNET_free (ret->completedDownloads);
GNUNET_free (ret);
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return NULL;
}
ret->parent = parent;
@@ -300,7 +300,7 @@
{
if (pos == NULL)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
break;
}
pos = pos->next;
@@ -317,8 +317,8 @@
ret->next = readDownloadList (ectx, fd, ctx, parent);
ret->child = readDownloadList (ectx, fd, ctx, ret);
#if DEBUG_PERSISTENCE
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"FSUI persistence: restoring download `%s': (%llu, %llu)\n",
ret->filename, ret->completed, ret->total);
#endif
@@ -332,19 +332,19 @@
if (8 != READ (fd, magic, 8))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
if (0 != memcmp (magic, "FSUI01\n\0", 8))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
return GNUNET_OK;
}
static int
-readCollection (int fd, struct FSUI_Context *ctx)
+readCollection (int fd, struct GNUNET_FSUI_Context *ctx)
{
int big;
@@ -357,7 +357,7 @@
}
if ((big > 16 * 1024 * 1024) || (big < sizeof (unsigned int)))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
ctx->collectionData = GNUNET_malloc (big);
@@ -366,18 +366,18 @@
{
GNUNET_free (ctx->collectionData);
ctx->collectionData = NULL;
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
return GNUNET_OK;
}
static int
-readSearches (int fd, struct FSUI_Context *ctx)
+readSearches (int fd, struct GNUNET_FSUI_Context *ctx)
{
int big;
- FSUI_SearchList *list;
- FSUI_SearchList *last;
+ GNUNET_FSUI_SearchList *list;
+ GNUNET_FSUI_SearchList *last;
int i;
ResultPending *rp;
char *buf;
@@ -388,8 +388,8 @@
READINT (big);
if (big == 0)
return GNUNET_OK;
- list = GNUNET_malloc (sizeof (FSUI_SearchList));
- memset (list, 0, sizeof (FSUI_SearchList));
+ list = GNUNET_malloc (sizeof (GNUNET_FSUI_SearchList));
+ memset (list, 0, sizeof (GNUNET_FSUI_SearchList));
if ((GNUNET_OK != read_int (fd, (int *) &list->state)) ||
(GNUNET_OK != read_int (fd, (int *) &list->maxResults)) ||
(GNUNET_OK != read_long (fd, (long long *) &list->timeout)) ||
@@ -402,7 +402,7 @@
|| (list->sizeResultsReceived > 1024 * 1024)
|| (list->sizeUnmatchedResultsReceived > 1024 * 1024))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
break;
}
fixState (&list->state);
@@ -412,30 +412,30 @@
buf = read_string (fd, 1024 * 1024);
if (buf == NULL)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
break;
}
- list->uri = ECRS_stringToUri (NULL, buf);
+ list->uri = GNUNET_ECRS_string_to_uri (NULL, buf);
GNUNET_free (buf);
if (list->uri == NULL)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
break;
}
- if (!(ECRS_isKeywordUri (list->uri) || ECRS_isNamespaceUri (list->uri)))
+ if (!(GNUNET_ECRS_uri_test_ksk (list->uri) || GNUNET_ECRS_uri_test_sks
(list->uri)))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
break;
}
- list->numberOfURIKeys = ECRS_countKeywordsOfUri (list->uri);
+ list->numberOfURIKeys = GNUNET_ECRS_uri_get_keyword_count_from_ksk
(list->uri);
if (list->sizeResultsReceived > 0)
{
list->resultsReceived
=
GNUNET_malloc (list->sizeResultsReceived *
- sizeof (ECRS_FileInfo));
+ sizeof (GNUNET_ECRS_FileInfo));
memset (list->resultsReceived, 0,
- list->sizeResultsReceived * sizeof (ECRS_FileInfo));
+ list->sizeResultsReceived * sizeof (GNUNET_ECRS_FileInfo));
}
if (list->sizeUnmatchedResultsReceived > 0)
{
@@ -451,7 +451,7 @@
if (GNUNET_OK !=
readFileInfo (ctx->ectx, fd, &list->resultsReceived[i]))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
goto ERR;
}
for (i = 0; i < list->sizeUnmatchedResultsReceived; i++)
@@ -459,18 +459,18 @@
rp = &list->unmatchedResultsReceived[i];
if (GNUNET_OK != readFileInfo (ctx->ectx, fd, &rp->fi))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
goto ERR;
}
if (GNUNET_OK != read_int (fd, (int *) &rp->matchingKeyCount))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
goto ERR;
}
if ((rp->matchingKeyCount > 1024) ||
(rp->matchingKeyCount >= list->numberOfURIKeys))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
goto ERR;
}
if (rp->matchingKeyCount > 0)
@@ -483,7 +483,7 @@
READ (fd, rp->matchingKeys,
sizeof (GNUNET_HashCode) * rp->matchingKeyCount))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
goto ERR;
}
}
@@ -511,9 +511,9 @@
for (i = 0; i < list->sizeResultsReceived; i++)
{
if (list->resultsReceived[i].uri != NULL)
- ECRS_freeUri (list->resultsReceived[i].uri);
+ GNUNET_ECRS_uri_destroy (list->resultsReceived[i].uri);
if (list->resultsReceived[i].meta != NULL)
- ECRS_freeMetaData (list->resultsReceived[i].meta);
+ GNUNET_ECRS_meta_data_destroy (list->resultsReceived[i].meta);
}
GNUNET_array_grow (list->resultsReceived, list->sizeResultsReceived, 0);
}
@@ -524,42 +524,42 @@
rp = &list->unmatchedResultsReceived[i];
if (rp->fi.uri != NULL)
- ECRS_freeUri (rp->fi.uri);
+ GNUNET_ECRS_uri_destroy (rp->fi.uri);
if (rp->fi.meta != NULL)
- ECRS_freeMetaData (rp->fi.meta);
+ GNUNET_ECRS_meta_data_destroy (rp->fi.meta);
GNUNET_free_non_null (rp->matchingKeys);
}
GNUNET_array_grow (list->resultsReceived, list->sizeResultsReceived, 0);
}
if (list->uri != NULL)
- ECRS_freeUri (list->uri);
+ GNUNET_ECRS_uri_destroy (list->uri);
GNUNET_free (list);
return GNUNET_SYSERR;
}
static int
-readDownloads (int fd, struct FSUI_Context *ctx)
+readDownloads (int fd, struct GNUNET_FSUI_Context *ctx)
{
- memset (&ctx->activeDownloads, 0, sizeof (FSUI_DownloadList));
+ memset (&ctx->activeDownloads, 0, sizeof (GNUNET_FSUI_DownloadList));
ctx->activeDownloads.child
= readDownloadList (ctx->ectx, fd, ctx, &ctx->activeDownloads);
return GNUNET_OK;
}
static int
-readUploadList (struct FSUI_Context *ctx,
- struct FSUI_UploadList *parent,
- int fd, struct FSUI_UploadShared *shared, int top)
+readUploadList (struct GNUNET_FSUI_Context *ctx,
+ struct GNUNET_FSUI_UploadList *parent,
+ int fd, struct GNUNET_FSUI_UploadShared *shared, int top)
{
- struct FSUI_UploadList *list;
- struct FSUI_UploadList l;
+ struct GNUNET_FSUI_UploadList *list;
+ struct GNUNET_FSUI_UploadList l;
unsigned long long stime;
int big;
int bag;
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
ectx = ctx->ectx;
- GE_ASSERT (ectx, shared != NULL);
+ GNUNET_GE_ASSERT (ectx, shared != NULL);
while (1)
{
READINT (big);
@@ -567,20 +567,20 @@
return GNUNET_OK;
if ((big < 1) || (big > 15))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
READINT (bag);
if (bag != 0x34D1F023)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
- memset (&l, 0, sizeof (FSUI_UploadList));
+ memset (&l, 0, sizeof (GNUNET_FSUI_UploadList));
READINT (l.state);
fixState (&l.state);
- if (l.state == FSUI_PENDING)
- l.state = FSUI_ACTIVE;
+ if (l.state == GNUNET_FSUI_PENDING)
+ l.state = GNUNET_FSUI_ACTIVE;
READLONG (l.completed);
READLONG (l.total);
READLONG (stime);
@@ -598,8 +598,8 @@
if (l.keywords == NULL)
{
if (l.uri != NULL)
- ECRS_freeUri (l.uri);
- GE_BREAK (NULL, 0);
+ GNUNET_ECRS_uri_destroy (l.uri);
+ GNUNET_GE_BREAK (NULL, 0);
break;
}
}
@@ -609,10 +609,10 @@
if (l.meta == NULL)
{
if (l.uri != NULL)
- ECRS_freeUri (l.uri);
+ GNUNET_ECRS_uri_destroy (l.uri);
if (l.keywords != NULL)
- ECRS_freeUri (l.keywords);
- GE_BREAK (NULL, 0);
+ GNUNET_ECRS_uri_destroy (l.keywords);
+ GNUNET_GE_BREAK (NULL, 0);
break;
}
}
@@ -620,25 +620,25 @@
if (l.filename == NULL)
{
if (l.uri != NULL)
- ECRS_freeUri (l.uri);
+ GNUNET_ECRS_uri_destroy (l.uri);
if (l.meta != NULL)
- ECRS_freeMetaData (l.meta);
+ GNUNET_ECRS_meta_data_destroy (l.meta);
if (l.keywords != NULL)
- ECRS_freeUri (l.keywords);
- GE_BREAK (NULL, 0);
+ GNUNET_ECRS_uri_destroy (l.keywords);
+ GNUNET_GE_BREAK (NULL, 0);
break;
}
- list = GNUNET_malloc (sizeof (struct FSUI_UploadList));
- memcpy (list, &l, sizeof (struct FSUI_UploadList));
+ list = GNUNET_malloc (sizeof (struct GNUNET_FSUI_UploadList));
+ memcpy (list, &l, sizeof (struct GNUNET_FSUI_UploadList));
list->shared = shared;
list->parent = parent;
if (GNUNET_OK != readUploadList (ctx, list, fd, shared, GNUNET_NO))
{
if (l.uri != NULL)
- ECRS_freeUri (l.uri);
+ GNUNET_ECRS_uri_destroy (l.uri);
GNUNET_free (l.filename);
GNUNET_free (list);
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
break;
}
list->next = parent->child;
@@ -651,14 +651,14 @@
static int
-readUploads (int fd, struct FSUI_Context *ctx)
+readUploads (int fd, struct GNUNET_FSUI_Context *ctx)
{
int big;
int bag;
- struct FSUI_UploadShared *shared;
- struct FSUI_UploadShared sshared;
+ struct GNUNET_FSUI_UploadShared *shared;
+ struct GNUNET_FSUI_UploadShared sshared;
- memset (&ctx->activeUploads, 0, sizeof (FSUI_UploadList));
+ memset (&ctx->activeUploads, 0, sizeof (GNUNET_FSUI_UploadList));
while (1)
{
READINT (big);
@@ -666,16 +666,16 @@
return GNUNET_OK;
if ((big < 1) && (big > 7))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
break;
}
READINT (bag);
if (bag != 0x44D1F024)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
- memset (&sshared, 0, sizeof (FSUI_UploadShared));
+ memset (&sshared, 0, sizeof (GNUNET_FSUI_UploadShared));
READINT (sshared.doIndex);
READINT (sshared.anonymityLevel);
READINT (sshared.priority);
@@ -689,17 +689,17 @@
if (sshared.global_keywords == NULL)
{
GNUNET_free_non_null (sshared.extractor_config);
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
}
- shared = GNUNET_malloc (sizeof (FSUI_UploadShared));
- memcpy (shared, &sshared, sizeof (FSUI_UploadShared));
+ shared = GNUNET_malloc (sizeof (GNUNET_FSUI_UploadShared));
+ memcpy (shared, &sshared, sizeof (GNUNET_FSUI_UploadShared));
shared->ctx = ctx;
if (GNUNET_OK !=
readUploadList (ctx, &ctx->activeUploads, fd, shared, GNUNET_YES))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
#if 0
/* cannot do this, readUploadList
may have added *some* uploads that
@@ -717,11 +717,11 @@
}
static int
-readUnindex (int fd, struct FSUI_Context *ctx)
+readUnindex (int fd, struct GNUNET_FSUI_Context *ctx)
{
int big;
char *name;
- struct FSUI_UnindexList *ul;
+ struct GNUNET_FSUI_UnindexList *ul;
while (1)
{
@@ -730,7 +730,7 @@
return GNUNET_OK;
READINT (big); /* state */
READSTRING (name, 1024 * 1024);
- ul = GNUNET_malloc (sizeof (struct FSUI_UnindexList));
+ ul = GNUNET_malloc (sizeof (struct GNUNET_FSUI_UnindexList));
ul->state = big;
ul->filename = name;
ul->next = ctx->unindexOperations;
@@ -742,7 +742,7 @@
void
-FSUI_deserialize (struct FSUI_Context *ctx)
+GNUNET_FSUI_deserialize (struct GNUNET_FSUI_Context *ctx)
{
int fd;
@@ -760,9 +760,9 @@
(GNUNET_OK != readUnindex (fd, ctx))
|| (GNUNET_OK != readUploads (fd, ctx)))
{
- GE_BREAK (ctx->ectx, 0);
- GE_LOG (ctx->ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_BREAK (ctx->ectx, 0);
+ GNUNET_GE_LOG (ctx->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("FSUI state file `%s' had syntax error at offset %u.\n"),
ctx->name, LSEEK (fd, 0, SEEK_CUR));
}
Modified: GNUnet/src/applications/fs/fsui/download.c
===================================================================
--- GNUnet/src/applications/fs/fsui/download.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/fsui/download.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -39,15 +39,15 @@
* in URITRACK.
*/
static int
-listURIfoundDirectory (const ECRS_FileInfo * fi,
+listURIfoundDirectory (const GNUNET_ECRS_FileInfo * fi,
const GNUNET_HashCode * key, int isRoot, void *prnt)
{
- FSUI_DownloadList *dl = prnt;
+ GNUNET_FSUI_DownloadList *dl = prnt;
if (isRoot == GNUNET_YES)
return GNUNET_OK; /* namespace ad, ignore */
- URITRACK_addState (dl->ctx->ectx,
- dl->ctx->cfg, fi->uri, URITRACK_DIRECTORY_FOUND);
+ GNUNET_URITRACK_add_state (dl->ctx->ectx,
+ dl->ctx->cfg, fi->uri, GNUNET_URITRACK_DIRECTORY_FOUND);
return GNUNET_OK;
}
@@ -57,27 +57,27 @@
/**
* Start to download a file.
*/
-static FSUI_DownloadList *startDownload (struct FSUI_Context *ctx,
+static GNUNET_FSUI_DownloadList *startDownload (struct GNUNET_FSUI_Context
*ctx,
unsigned int anonymityLevel,
int is_recursive,
- const struct ECRS_URI *uri,
- const struct ECRS_MetaData *meta,
+ const struct GNUNET_ECRS_URI *uri,
+ const struct GNUNET_ECRS_MetaData
*meta,
const char *filename,
- struct FSUI_SearchList *psearch,
- FSUI_DownloadList * parent);
+ struct GNUNET_FSUI_SearchList
*psearch,
+ GNUNET_FSUI_DownloadList * parent);
/**
* Initiate a (recursive) download of the given
* directory entry.
*/
static int
-triggerRecursiveDownload (const ECRS_FileInfo * fi,
+triggerRecursiveDownload (const GNUNET_ECRS_FileInfo * fi,
const GNUNET_HashCode * key, int isRoot, void *prnt)
{
- FSUI_DownloadList *parent = prnt;
- struct GE_Context *ectx;
+ GNUNET_FSUI_DownloadList *parent = prnt;
+ struct GNUNET_GE_Context *ectx;
int i;
- FSUI_DownloadList *pos;
+ GNUNET_FSUI_DownloadList *pos;
char *filename;
char *fullName;
char *dotdot;
@@ -86,27 +86,27 @@
if (isRoot == GNUNET_YES)
return GNUNET_OK; /* namespace ad, ignore */
- URITRACK_trackURI (ectx, parent->ctx->cfg, fi);
+ GNUNET_URITRACK_track (ectx, parent->ctx->cfg, fi);
for (i = 0; i < parent->completedDownloadsCount; i++)
- if (ECRS_equalsUri (parent->completedDownloads[i], fi->uri))
+ if (GNUNET_ECRS_uri_test_equal (parent->completedDownloads[i], fi->uri))
return GNUNET_OK; /* already complete! */
pos = parent->child;
while (pos != NULL)
{
- if (ECRS_equalsUri (pos->fi.uri, fi->uri))
+ if (GNUNET_ECRS_uri_test_equal (pos->fi.uri, fi->uri))
return GNUNET_OK; /* already downloading */
pos = pos->next;
}
- filename = ECRS_getFromMetaData (fi->meta, EXTRACTOR_FILENAME);
+ filename = GNUNET_ECRS_meta_data_get_by_type (fi->meta, EXTRACTOR_FILENAME);
if (filename == NULL)
{
- char *tmp = ECRS_uriToString (fi->uri);
- GE_ASSERT (ectx,
+ char *tmp = GNUNET_ECRS_uri_to_string (fi->uri);
+ GNUNET_GE_ASSERT (ectx,
strlen (tmp) >=
- strlen (ECRS_URI_PREFIX) + strlen (ECRS_FILE_INFIX));
+ strlen (GNUNET_ECRS_URI_PREFIX) + strlen
(GNUNET_ECRS_FILE_INFIX));
filename =
GNUNET_strdup (&tmp
- [strlen (ECRS_URI_PREFIX) + strlen (ECRS_FILE_INFIX)]);
+ [strlen (GNUNET_ECRS_URI_PREFIX) + strlen
(GNUNET_ECRS_FILE_INFIX)]);
GNUNET_free (tmp);
}
fullName =
@@ -117,8 +117,8 @@
dotdot[0] = dotdot[1] = '_';
GNUNET_free (filename);
#if DEBUG_DTM
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Starting recursive download of `%s'\n", fullName);
#endif
startDownload (parent->ctx,
@@ -140,15 +140,15 @@
const char *lastBlock,
unsigned int lastBlockSize, void *cls)
{
- FSUI_DownloadList *dl = cls;
- FSUI_Event event;
- struct ECRS_MetaData *md;
+ GNUNET_FSUI_DownloadList *dl = cls;
+ GNUNET_FSUI_Event event;
+ struct GNUNET_ECRS_MetaData *md;
GNUNET_CronTime now;
GNUNET_CronTime run_time;
- GE_ASSERT (dl->ctx->ectx, dl->total == totalBytes);
+ GNUNET_GE_ASSERT (dl->ctx->ectx, dl->total == totalBytes);
dl->completed = completedBytes;
- event.type = FSUI_download_progress;
+ event.type = GNUNET_FSUI_download_progress;
event.data.DownloadProgress.dc.pos = dl;
event.data.DownloadProgress.dc.cctx = dl->cctx;
event.data.DownloadProgress.dc.ppos =
@@ -194,22 +194,22 @@
if (dl->is_directory == GNUNET_YES)
{
md = NULL;
- ECRS_listDirectory (dl->ctx->ectx,
+ GNUNET_ECRS_directory_list_contents (dl->ctx->ectx,
lastBlock,
lastBlockSize, &md, &listURIfoundDirectory, dl);
if (md != NULL)
- ECRS_freeMetaData (md);
+ GNUNET_ECRS_meta_data_destroy (md);
}
if ((dl->is_recursive == GNUNET_YES) && (dl->is_directory == GNUNET_YES))
{
md = NULL;
GNUNET_mutex_lock (dl->ctx->lock);
- ECRS_listDirectory (dl->ctx->ectx,
+ GNUNET_ECRS_directory_list_contents (dl->ctx->ectx,
lastBlock,
lastBlockSize, &md, &triggerRecursiveDownload, dl);
GNUNET_mutex_unlock (dl->ctx->lock);
if (md != NULL)
- ECRS_freeMetaData (md);
+ GNUNET_ECRS_meta_data_destroy (md);
}
}
@@ -219,11 +219,11 @@
static int
testTerminate (void *cls)
{
- FSUI_DownloadList *dl = cls;
+ GNUNET_FSUI_DownloadList *dl = cls;
- if ((dl->state == FSUI_ERROR) || (dl->state == FSUI_ABORTED))
+ if ((dl->state == GNUNET_FSUI_ERROR) || (dl->state == GNUNET_FSUI_ABORTED))
return GNUNET_SYSERR; /* aborted - delete! */
- if (dl->state != FSUI_ACTIVE)
+ if (dl->state != GNUNET_FSUI_ACTIVE)
return GNUNET_NO; /* suspended */
return GNUNET_OK;
}
@@ -234,34 +234,34 @@
void *
downloadThread (void *cls)
{
- FSUI_DownloadList *dl = cls;
+ GNUNET_FSUI_DownloadList *dl = cls;
int ret;
- FSUI_Event event;
- struct GE_Context *ectx;
- struct GE_Memory *mem;
- struct GE_Context *ee;
+ GNUNET_FSUI_Event event;
+ struct GNUNET_GE_Context *ectx;
+ struct GNUNET_GE_Memory *mem;
+ struct GNUNET_GE_Context *ee;
dl->startTime = GNUNET_get_time () - dl->runTime;
ectx = dl->ctx->ectx;
#if DEBUG_DTM
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Download thread for `%s' started...\n", dl->filename);
#endif
- GE_ASSERT (ectx, dl->ctx != NULL);
- GE_ASSERT (ectx, dl->filename != NULL);
- mem = GE_memory_create (2);
+ GNUNET_GE_ASSERT (ectx, dl->ctx != NULL);
+ GNUNET_GE_ASSERT (ectx, dl->filename != NULL);
+ mem = GNUNET_GE_memory_create (2);
ee =
- GE_create_context_memory (GE_USER | GE_ADMIN | GE_ERROR | GE_WARNING |
- GE_FATAL | GE_BULK | GE_IMMEDIATE, mem);
+ GNUNET_GE_create_context_memory (GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_ERROR | GNUNET_GE_WARNING |
+ GNUNET_GE_FATAL | GNUNET_GE_BULK |
GNUNET_GE_IMMEDIATE, mem);
ret =
- ECRS_downloadFile (ee, dl->ctx->cfg, dl->fi.uri, dl->filename,
+ GNUNET_ECRS_file_download (ee, dl->ctx->cfg, dl->fi.uri, dl->filename,
dl->anonymityLevel, &downloadProgressCallback, dl,
&testTerminate, dl);
if (ret == GNUNET_OK)
{
- dl->state = FSUI_COMPLETED;
- event.type = FSUI_download_completed;
+ dl->state = GNUNET_FSUI_COMPLETED;
+ event.type = GNUNET_FSUI_download_completed;
event.data.DownloadCompleted.dc.pos = dl;
event.data.DownloadCompleted.dc.cctx = dl->cctx;
event.data.DownloadCompleted.dc.ppos =
@@ -273,18 +273,18 @@
event.data.DownloadCompleted.total = dl->total;
event.data.DownloadCompleted.filename = dl->filename;
event.data.DownloadCompleted.uri = dl->fi.uri;
- URITRACK_addState (dl->ctx->ectx,
+ GNUNET_URITRACK_add_state (dl->ctx->ectx,
dl->ctx->cfg,
- dl->fi.uri, URITRACK_DOWNLOAD_COMPLETED);
+ dl->fi.uri, GNUNET_URITRACK_DOWNLOAD_COMPLETED);
dl->ctx->ecb (dl->ctx->ecbClosure, &event);
}
- else if (dl->state == FSUI_ACTIVE)
+ else if (dl->state == GNUNET_FSUI_ACTIVE)
{
const char *error;
/* ECRS error */
- dl->state = FSUI_ERROR;
- event.type = FSUI_download_error;
+ dl->state = GNUNET_FSUI_ERROR;
+ event.type = GNUNET_FSUI_download_error;
event.data.DownloadError.dc.pos = dl;
event.data.DownloadError.dc.cctx = dl->cctx;
event.data.DownloadError.dc.ppos =
@@ -293,17 +293,17 @@
event.data.DownloadError.dc.spos = dl->search;
event.data.DownloadError.dc.sctx =
dl->search == NULL ? NULL : dl->search->cctx;
- error = GE_memory_get (mem, 0);
+ error = GNUNET_GE_memory_get (mem, 0);
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);
+ GNUNET_URITRACK_add_state (dl->ctx->ectx,
+ dl->ctx->cfg, dl->fi.uri,
GNUNET_URITRACK_DOWNLOAD_ABORTED);
dl->ctx->ecb (dl->ctx->ecbClosure, &event);
}
- else if (dl->state == FSUI_ABORTED)
+ else if (dl->state == GNUNET_FSUI_ABORTED)
{ /* aborted */
- event.type = FSUI_download_aborted;
+ event.type = GNUNET_FSUI_download_aborted;
event.data.DownloadAborted.dc.pos = dl;
event.data.DownloadAborted.dc.cctx = dl->cctx;
event.data.DownloadAborted.dc.ppos =
@@ -312,27 +312,27 @@
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);
+ GNUNET_URITRACK_add_state (dl->ctx->ectx, dl->ctx->cfg, dl->fi.uri,
+ GNUNET_URITRACK_DOWNLOAD_ABORTED);
dl->ctx->ecb (dl->ctx->ecbClosure, &event);
}
else
{
/* else: suspended */
- GE_BREAK (NULL, dl->state == FSUI_SUSPENDING);
+ GNUNET_GE_BREAK (NULL, dl->state == GNUNET_FSUI_SUSPENDING);
}
if ((ret == GNUNET_OK) &&
- (dl->is_directory == GNUNET_YES) && (ECRS_fileSize (dl->fi.uri) > 0))
+ (dl->is_directory == GNUNET_YES) && (GNUNET_ECRS_uri_get_file_siz
(dl->fi.uri) > 0))
{
char *dirBlock;
int fd;
char *fn;
size_t totalBytes;
- struct ECRS_MetaData *md;
+ struct GNUNET_ECRS_MetaData *md;
- totalBytes = ECRS_fileSize (dl->fi.uri);
+ totalBytes = GNUNET_ECRS_uri_get_file_siz (dl->fi.uri);
fn =
GNUNET_malloc (strlen (dl->filename) + strlen (GNUNET_DIRECTORY_EXT) +
1);
@@ -349,31 +349,31 @@
dirBlock = MMAP (NULL, totalBytes, PROT_READ, MAP_SHARED, fd, 0);
if (MAP_FAILED == dirBlock)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_BULK | GE_ADMIN | GE_USER,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_ADMIN | GNUNET_GE_USER,
"mmap", fn);
}
else
{
md = NULL;
- ECRS_listDirectory (dl->ctx->ectx,
+ GNUNET_ECRS_directory_list_contents (dl->ctx->ectx,
dirBlock,
totalBytes,
&md, &listURIfoundDirectory, dl);
if (md != NULL)
- ECRS_freeMetaData (md);
+ GNUNET_ECRS_meta_data_destroy (md);
if (dl->is_recursive)
{
/* load directory, start downloads */
md = NULL;
GNUNET_mutex_lock (dl->ctx->lock);
- ECRS_listDirectory (dl->ctx->ectx,
+ GNUNET_ECRS_directory_list_contents (dl->ctx->ectx,
dirBlock,
totalBytes,
&md, &triggerRecursiveDownload, dl);
GNUNET_mutex_unlock (dl->ctx->lock);
- ECRS_freeMetaData (md);
+ GNUNET_ECRS_meta_data_destroy (md);
MUNMAP (dirBlock, totalBytes);
}
}
@@ -382,44 +382,44 @@
GNUNET_free (fn);
}
#if DEBUG_DTM
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Download thread for `%s' terminated (%s)...\n",
dl->filename, ret == GNUNET_OK ? "COMPLETED" : "ABORTED");
#endif
dl->runTime = GNUNET_get_time () - dl->startTime;
- GE_free_context (ee);
- GE_memory_free (mem);
+ GNUNET_GE_free_context (ee);
+ GNUNET_GE_memory_free (mem);
return NULL;
}
/**
* Start to download a file.
*/
-static FSUI_DownloadList *
-startDownload (struct FSUI_Context *ctx,
+static GNUNET_FSUI_DownloadList *
+startDownload (struct GNUNET_FSUI_Context *ctx,
unsigned int anonymityLevel,
int is_recursive,
- const struct ECRS_URI *uri,
- const struct ECRS_MetaData *meta,
+ const struct GNUNET_ECRS_URI *uri,
+ const struct GNUNET_ECRS_MetaData *meta,
const char *filename,
- struct FSUI_SearchList *psearch, FSUI_DownloadList * parent)
+ struct GNUNET_FSUI_SearchList *psearch,
GNUNET_FSUI_DownloadList * parent)
{
- FSUI_DownloadList *dl;
- FSUI_Event event;
+ GNUNET_FSUI_DownloadList *dl;
+ GNUNET_FSUI_Event event;
- GE_ASSERT (NULL, ctx != NULL);
- GE_ASSERT (NULL, parent != NULL);
- if (!(ECRS_isFileUri (uri) || ECRS_isLocationUri (uri)))
+ GNUNET_GE_ASSERT (NULL, ctx != NULL);
+ GNUNET_GE_ASSERT (NULL, parent != NULL);
+ if (!(GNUNET_ECRS_uri_test_chk (uri) || GNUNET_ECRS_uri_test_loc (uri)))
{
- GE_BREAK (NULL, 0); /* wrong type of URI! */
+ GNUNET_GE_BREAK (NULL, 0); /* wrong type of URI! */
return NULL;
}
- dl = GNUNET_malloc (sizeof (FSUI_DownloadList));
- memset (dl, 0, sizeof (FSUI_DownloadList));
+ dl = GNUNET_malloc (sizeof (GNUNET_FSUI_DownloadList));
+ memset (dl, 0, sizeof (GNUNET_FSUI_DownloadList));
dl->startTime = 0; /* not run at all so far! */
dl->runTime = 0; /* not run at all so far! */
- dl->state = FSUI_PENDING;
+ dl->state = GNUNET_FSUI_PENDING;
dl->is_recursive = is_recursive;
dl->parent = parent;
dl->search = psearch;
@@ -427,13 +427,13 @@
dl->anonymityLevel = anonymityLevel;
dl->ctx = ctx;
dl->filename = GNUNET_strdup (filename);
- dl->fi.uri = ECRS_dupUri (uri);
- dl->fi.meta = ECRS_dupMetaData (meta);
- dl->total = ECRS_fileSize (uri);
+ dl->fi.uri = GNUNET_ECRS_uri_duplicate (uri);
+ dl->fi.meta = GNUNET_ECRS_meta_data_duplicate (meta);
+ dl->total = GNUNET_ECRS_uri_get_file_siz (uri);
dl->child = NULL;
dl->cctx = NULL;
/* signal start! */
- event.type = FSUI_download_started;
+ event.type = GNUNET_FSUI_download_started;
event.data.DownloadStarted.dc.pos = dl;
event.data.DownloadStarted.dc.cctx = NULL;
event.data.DownloadStarted.dc.ppos =
@@ -442,12 +442,12 @@
event.data.DownloadStarted.dc.spos = dl->search;
event.data.DownloadStarted.dc.sctx =
dl->search == NULL ? NULL : dl->search->cctx;
- event.data.DownloadStarted.total = ECRS_fileSize (dl->fi.uri);
+ event.data.DownloadStarted.total = GNUNET_ECRS_uri_get_file_siz (dl->fi.uri);
event.data.DownloadStarted.filename = dl->filename;
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);
+ GNUNET_URITRACK_add_state (ctx->ectx, ctx->cfg, uri,
GNUNET_URITRACK_DOWNLOAD_STARTED);
dl->cctx = dl->ctx->ecb (dl->ctx->ecbClosure, &event);
dl->next = parent->child;
parent->child = dl;
@@ -468,17 +468,17 @@
* already used for another download at the moment (or
* if the disk does not have enough space).
*/
-struct FSUI_DownloadList *
-FSUI_startDownload (struct FSUI_Context *ctx,
+struct GNUNET_FSUI_DownloadList *
+GNUNET_FSUI_download_start (struct GNUNET_FSUI_Context *ctx,
unsigned int anonymityLevel,
int doRecursive,
- const struct ECRS_URI *uri,
- const struct ECRS_MetaData *meta,
+ const struct GNUNET_ECRS_URI *uri,
+ const struct GNUNET_ECRS_MetaData *meta,
const char *filename,
- struct FSUI_SearchList *psearch,
- struct FSUI_DownloadList *pdownload)
+ struct GNUNET_FSUI_SearchList *psearch,
+ struct GNUNET_FSUI_DownloadList *pdownload)
{
- struct FSUI_DownloadList *ret;
+ struct GNUNET_FSUI_DownloadList *ret;
GNUNET_mutex_lock (ctx->lock);
if (pdownload == NULL)
@@ -498,10 +498,10 @@
* @return GNUNET_YES if change done that may require re-trying
*/
int
-FSUI_updateDownloadThread (FSUI_DownloadList * list)
+GNUNET_FSUI_updateDownloadThread (GNUNET_FSUI_DownloadList * list)
{
- struct GE_Context *ectx;
- FSUI_DownloadList *dpos;
+ struct GNUNET_GE_Context *ectx;
+ GNUNET_FSUI_DownloadList *dpos;
void *unused;
int ret;
@@ -510,8 +510,8 @@
ectx = list->ctx->ectx;
#if DEBUG_DTM
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Download thread manager investigates pending download of file `%s'
(%u/%u downloads)\n",
list->filename,
list->ctx->activeDownloadThreads, list->ctx->threadPoolSize);
@@ -520,16 +520,16 @@
/* should this one be started? */
if ((list->ctx->threadPoolSize
> list->ctx->activeDownloadThreads) &&
- (list->state == FSUI_PENDING) &&
+ (list->state == GNUNET_FSUI_PENDING) &&
((list->total > list->completed) || (list->total == 0)))
{
#if DEBUG_DTM
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Download thread manager starts download of file `%s'\n",
list->filename);
#endif
- list->state = FSUI_ACTIVE;
+ list->state = GNUNET_FSUI_ACTIVE;
list->handle = GNUNET_thread_create (&downloadThread, list, 128 * 1024);
if (list->handle != NULL)
{
@@ -537,41 +537,41 @@
}
else
{
- GE_LOG_STRERROR (ectx,
- GE_ADMIN | GE_USER | GE_BULK | GE_ERROR,
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_ADMIN | GNUNET_GE_USER | GNUNET_GE_BULK |
GNUNET_GE_ERROR,
"pthread_create");
- list->state = FSUI_ERROR_JOINED;
+ list->state = GNUNET_FSUI_ERROR_JOINED;
}
}
/* should this one be stopped? */
if ((list->ctx->threadPoolSize
- < list->ctx->activeDownloadThreads) && (list->state == FSUI_ACTIVE))
+ < list->ctx->activeDownloadThreads) && (list->state ==
GNUNET_FSUI_ACTIVE))
{
#if DEBUG_DTM
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Download thread manager aborts active download of file `%s'
(%u/%u downloads)\n",
list->filename,
list->ctx->activeDownloadThreads, list->ctx->threadPoolSize);
#endif
- list->state = FSUI_SUSPENDING;
- GE_ASSERT (ectx, list->handle != NULL);
+ list->state = GNUNET_FSUI_SUSPENDING;
+ GNUNET_GE_ASSERT (ectx, list->handle != NULL);
GNUNET_thread_stop_sleep (list->handle);
GNUNET_thread_join (list->handle, &unused);
list->handle = NULL;
list->ctx->activeDownloadThreads--;
- list->state = FSUI_PENDING;
+ list->state = GNUNET_FSUI_PENDING;
ret = GNUNET_YES;
}
/* has this one "died naturally"? */
- if ((list->state == FSUI_COMPLETED) ||
- (list->state == FSUI_ABORTED) || (list->state == FSUI_ERROR))
+ if ((list->state == GNUNET_FSUI_COMPLETED) ||
+ (list->state == GNUNET_FSUI_ABORTED) || (list->state ==
GNUNET_FSUI_ERROR))
{
#if DEBUG_DTM
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Download thread manager collects inactive download of file
`%s'\n",
list->filename);
#endif
@@ -586,7 +586,7 @@
dpos = list->child;
while (dpos != NULL)
{
- if (GNUNET_YES == FSUI_updateDownloadThread (dpos))
+ if (GNUNET_YES == GNUNET_FSUI_updateDownloadThread (dpos))
ret = GNUNET_YES;
dpos = dpos->next;
}
@@ -601,27 +601,27 @@
* GNUNET_NO if the download has already finished
*/
int
-FSUI_abortDownload (struct FSUI_Context *ctx, struct FSUI_DownloadList *dl)
+GNUNET_FSUI_download_abort (struct GNUNET_FSUI_Context *ctx, struct
GNUNET_FSUI_DownloadList *dl)
{
- struct FSUI_DownloadList *c;
+ struct GNUNET_FSUI_DownloadList *c;
- GE_ASSERT (ctx->ectx, dl != NULL);
+ GNUNET_GE_ASSERT (ctx->ectx, dl != NULL);
c = dl->child;
while (c != NULL)
{
- FSUI_abortDownload (ctx, c);
+ GNUNET_FSUI_download_abort (ctx, c);
c = c->next;
}
- if ((dl->state != FSUI_ACTIVE) && (dl->state != FSUI_PENDING))
+ if ((dl->state != GNUNET_FSUI_ACTIVE) && (dl->state != GNUNET_FSUI_PENDING))
return GNUNET_NO;
- if (dl->state == FSUI_ACTIVE)
+ if (dl->state == GNUNET_FSUI_ACTIVE)
{
- dl->state = FSUI_ABORTED;
+ dl->state = GNUNET_FSUI_ABORTED;
GNUNET_thread_stop_sleep (dl->handle);
}
else
{
- dl->state = FSUI_ABORTED_JOINED;
+ dl->state = GNUNET_FSUI_ABORTED_JOINED;
}
return GNUNET_OK;
}
@@ -633,16 +633,16 @@
* @return GNUNET_SYSERR if no such download is pending
*/
int
-FSUI_stopDownload (struct FSUI_Context *ctx, struct FSUI_DownloadList *dl)
+GNUNET_FSUI_download_stop (struct GNUNET_FSUI_Context *ctx, struct
GNUNET_FSUI_DownloadList *dl)
{
void *unused;
- struct FSUI_DownloadList *prev;
- FSUI_Event event;
+ struct GNUNET_FSUI_DownloadList *prev;
+ GNUNET_FSUI_Event event;
int i;
- GE_ASSERT (ctx->ectx, dl != NULL);
+ GNUNET_GE_ASSERT (ctx->ectx, dl != NULL);
while (dl->child != NULL)
- FSUI_stopDownload (ctx, dl->child);
+ GNUNET_FSUI_download_stop (ctx, dl->child);
GNUNET_mutex_lock (ctx->lock);
prev =
(dl->parent != NULL) ? dl->parent->child : ctx->activeDownloads.child;
@@ -651,9 +651,9 @@
if (prev == NULL)
{
GNUNET_mutex_unlock (ctx->lock);
- GE_LOG (ctx->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
- "FSUI_stopDownload failed to locate download.\n");
+ GNUNET_GE_LOG (ctx->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
+ "GNUNET_FSUI_stopDownload failed to locate download.\n");
return GNUNET_SYSERR;
}
if (prev == dl)
@@ -661,27 +661,27 @@
else
prev->next = dl->next; /* not first child */
GNUNET_mutex_unlock (ctx->lock);
- if ((dl->state == FSUI_ACTIVE) ||
- (dl->state == FSUI_COMPLETED) ||
- (dl->state == FSUI_ABORTED) || (dl->state == FSUI_ERROR))
+ if ((dl->state == GNUNET_FSUI_ACTIVE) ||
+ (dl->state == GNUNET_FSUI_COMPLETED) ||
+ (dl->state == GNUNET_FSUI_ABORTED) || (dl->state == GNUNET_FSUI_ERROR))
{
- GE_ASSERT (ctx->ectx, dl->handle != NULL);
+ GNUNET_GE_ASSERT (ctx->ectx, dl->handle != NULL);
GNUNET_thread_stop_sleep (dl->handle);
GNUNET_thread_join (dl->handle, &unused);
GNUNET_mutex_lock (ctx->lock);
dl->ctx->activeDownloadThreads--;
GNUNET_mutex_unlock (ctx->lock);
dl->handle = NULL;
- if (dl->state == FSUI_ACTIVE)
- dl->state = FSUI_PENDING;
+ if (dl->state == GNUNET_FSUI_ACTIVE)
+ dl->state = GNUNET_FSUI_PENDING;
else
dl->state++; /* add _JOINED */
}
else
{
- GE_ASSERT (ctx->ectx, dl->handle == NULL);
+ GNUNET_GE_ASSERT (ctx->ectx, dl->handle == NULL);
}
- event.type = FSUI_download_stopped;
+ event.type = GNUNET_FSUI_download_stopped;
event.data.DownloadStopped.dc.pos = dl;
event.data.DownloadStopped.dc.cctx = dl->cctx;
event.data.DownloadStopped.dc.ppos =
@@ -706,10 +706,10 @@
}
}
for (i = dl->completedDownloadsCount - 1; i >= 0; i--)
- ECRS_freeUri (dl->completedDownloads[i]);
+ GNUNET_ECRS_uri_destroy (dl->completedDownloads[i]);
GNUNET_array_grow (dl->completedDownloads, dl->completedDownloadsCount, 0);
- ECRS_freeUri (dl->fi.uri);
- ECRS_freeMetaData (dl->fi.meta);
+ GNUNET_ECRS_uri_destroy (dl->fi.uri);
+ GNUNET_ECRS_meta_data_destroy (dl->fi.meta);
GNUNET_free (dl->filename);
GNUNET_free (dl);
return GNUNET_OK;
Modified: GNUnet/src/applications/fs/fsui/downloadtest.c
===================================================================
--- GNUnet/src/applications/fs/fsui/downloadtest.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/fsui/downloadtest.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -33,11 +33,11 @@
#define DEBUG_VERBOSE GNUNET_NO
-#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GE_BREAK(ectx, 0); goto FAILURE; }
+#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GNUNET_GE_BREAK(ectx, 0); goto
FAILURE; }
static volatile int suspendRestart = 0;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
static char *
makeName (unsigned int i)
@@ -52,39 +52,39 @@
return fn;
}
-static volatile enum FSUI_EventType lastEvent;
-static volatile enum FSUI_EventType waitForEvent;
-static struct FSUI_Context *ctx;
-static struct ECRS_URI *upURI;
-static struct FSUI_SearchList *search;
-static struct FSUI_DownloadList *download;
+static volatile enum GNUNET_FSUI_EventType lastEvent;
+static volatile enum GNUNET_FSUI_EventType waitForEvent;
+static struct GNUNET_FSUI_Context *ctx;
+static struct GNUNET_ECRS_URI *upURI;
+static struct GNUNET_FSUI_SearchList *search;
+static struct GNUNET_FSUI_DownloadList *download;
static void *
-eventCallback (void *cls, const FSUI_Event * event)
+eventCallback (void *cls, const GNUNET_FSUI_Event * event)
{
char *fn;
switch (event->type)
{
- case FSUI_search_suspended:
+ case GNUNET_FSUI_search_suspended:
search = NULL;
break;
- case FSUI_download_suspended:
+ case GNUNET_FSUI_download_suspended:
download = NULL;
break;
- case FSUI_search_resumed:
+ case GNUNET_FSUI_search_resumed:
#if DEBUG_VERBOSE
printf ("Search resuming\n");
#endif
search = event->data.SearchResumed.sc.pos;
break;
- case FSUI_download_resumed:
+ case GNUNET_FSUI_download_resumed:
#if DEBUG_VERBOSE
printf ("Download resuming\n");
#endif
download = event->data.DownloadResumed.dc.pos;
break;
- case FSUI_search_completed:
+ case GNUNET_FSUI_search_completed:
#if DEBUG_VERBOSE
printf ("Search completed\n");
#endif
@@ -94,7 +94,7 @@
"ERROR: Search completed but download not started!\n");
}
break;
- case FSUI_search_result:
+ case GNUNET_FSUI_search_result:
#if DEBUG_VERBOSE
printf ("Received search result\n");
#endif
@@ -102,7 +102,7 @@
{
char *u;
- if (!ECRS_equalsUri (upURI, event->data.SearchResult.fi.uri))
+ if (!GNUNET_ECRS_uri_test_equal (upURI,
event->data.SearchResult.fi.uri))
{
#if DEBUG_VERBOSE
printf
@@ -111,12 +111,12 @@
return NULL; /* ignore */
}
fn = makeName (43);
- u = ECRS_uriToString (event->data.SearchResult.fi.uri);
+ u = GNUNET_ECRS_uri_to_string (event->data.SearchResult.fi.uri);
#if DEBUG_VERBOSE
printf ("Download started: %s.\n", u);
#endif
GNUNET_free (u);
- download = FSUI_startDownload (ctx,
+ download = GNUNET_FSUI_download_start (ctx,
0,
GNUNET_NO,
event->data.SearchResult.fi.uri,
@@ -124,80 +124,80 @@
fn, NULL, NULL);
if (download == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return NULL;
}
GNUNET_free (fn);
suspendRestart = 4;
}
break;
- case FSUI_upload_progress:
+ case GNUNET_FSUI_upload_progress:
#if DEBUG_VERBOSE
printf ("Upload is progressing (%llu/%llu)...\n",
event->data.UploadProgress.completed,
event->data.UploadProgress.total);
#endif
break;
- case FSUI_upload_completed:
- upURI = ECRS_dupUri (event->data.UploadCompleted.uri);
+ case GNUNET_FSUI_upload_completed:
+ upURI = GNUNET_ECRS_uri_duplicate (event->data.UploadCompleted.uri);
#if DEBUG_VERBOSE
printf ("Upload complete.\n");
#endif
break;
- case FSUI_download_completed:
+ case GNUNET_FSUI_download_completed:
#if DEBUG_VERBOSE
printf ("Download complete.\n");
#endif
- FSUI_abortSearch (ctx, search);
- FSUI_stopSearch (ctx, search);
+ GNUNET_FSUI_search_abort (ctx, search);
+ GNUNET_FSUI_search_stop (ctx, search);
search = NULL;
break;
- case FSUI_download_progress:
+ case GNUNET_FSUI_download_progress:
#if DEBUG_VERBOSE
printf ("Download is progressing (%llu/%llu)...\n",
event->data.DownloadProgress.completed,
event->data.DownloadProgress.total);
#endif
break;
- case FSUI_unindex_progress:
+ case GNUNET_FSUI_unindex_progress:
#if DEBUG_VERBOSE
printf ("Unindex is progressing (%llu/%llu)...\n",
event->data.UnindexProgress.completed,
event->data.UnindexProgress.total);
#endif
break;
- case FSUI_unindex_completed:
+ case GNUNET_FSUI_unindex_completed:
#if DEBUG_VERBOSE
printf ("Unindex complete.\n");
#endif
break;
- case FSUI_unindex_error:
- case FSUI_upload_error:
- case FSUI_download_error:
- case FSUI_search_error:
+ case GNUNET_FSUI_unindex_error:
+ case GNUNET_FSUI_upload_error:
+ case GNUNET_FSUI_download_error:
+ case GNUNET_FSUI_search_error:
fprintf (stderr, "Received ERROR: %d\n", event->type);
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
break;
- case FSUI_download_aborted:
+ case GNUNET_FSUI_download_aborted:
#if DEBUG_VERBOSE
printf ("Received download aborted event.\n");
#endif
break;
- case FSUI_unindex_suspended:
- case FSUI_upload_suspended:
+ case GNUNET_FSUI_unindex_suspended:
+ case GNUNET_FSUI_upload_suspended:
#if DEBUG_VERBOSE
fprintf (stderr, "Received SUSPENDING: %d\n", event->type);
#endif
break;
- case FSUI_upload_started:
- case FSUI_upload_stopped:
- case FSUI_download_started:
- case FSUI_download_stopped:
- case FSUI_search_started:
- case FSUI_search_aborted:
- case FSUI_search_stopped:
- case FSUI_unindex_started:
- case FSUI_unindex_stopped:
+ case GNUNET_FSUI_upload_started:
+ case GNUNET_FSUI_upload_stopped:
+ case GNUNET_FSUI_download_started:
+ case GNUNET_FSUI_download_stopped:
+ case GNUNET_FSUI_search_started:
+ case GNUNET_FSUI_search_aborted:
+ case GNUNET_FSUI_search_stopped:
+ case GNUNET_FSUI_unindex_started:
+ case GNUNET_FSUI_unindex_stopped:
break;
default:
printf ("Unexpected event: %d\n", event->type);
@@ -221,7 +221,7 @@
#endif
int ok;
int i;
- struct ECRS_URI *uri = NULL;
+ struct GNUNET_ECRS_URI *uri = NULL;
char *fn = NULL;
char *keywords[] = {
"down_foo",
@@ -231,29 +231,29 @@
char keyword[40];
int prog;
char *buf;
- struct ECRS_MetaData *meta;
- struct ECRS_URI *kuri = NULL;
- struct GC_Configuration *cfg;
- struct FSUI_UnindexList *unindex = NULL;
- struct FSUI_UploadList *upload = NULL;
+ struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_ECRS_URI *kuri = NULL;
+ struct GNUNET_GC_Configuration *cfg;
+ struct GNUNET_FSUI_UnindexList *unindex = NULL;
+ struct GNUNET_FSUI_UploadList *upload = NULL;
ok = GNUNET_YES;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#if START_DAEMON
daemon = GNUNET_daemon_start (NULL, cfg, "peer.conf", GNUNET_NO);
- GE_ASSERT (NULL, daemon > 0);
+ GNUNET_GE_ASSERT (NULL, daemon > 0);
CHECK (GNUNET_OK ==
GNUNET_wait_for_daemon_running (NULL, cfg,
30 * GNUNET_CRON_SECONDS));
GNUNET_thread_sleep (5 * GNUNET_CRON_SECONDS); /* give apps time to
start */
/* ACTUAL TEST CODE */
#endif
- ctx = FSUI_start (NULL,
+ ctx = GNUNET_FSUI_start (NULL,
cfg, "fsuidownloadtest", 32, GNUNET_YES, &eventCallback,
NULL);
CHECK (ctx != NULL);
@@ -263,22 +263,22 @@
buf[i] = GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 256);
GNUNET_disk_file_write (ectx, fn, buf, FILESIZE, "600");
GNUNET_free (buf);
- meta = ECRS_createMetaData ();
- kuri = ECRS_parseListKeywordURI (ectx, 2, (const char **) keywords);
- waitForEvent = FSUI_upload_completed;
- upload = FSUI_startUpload (ctx,
+ meta = GNUNET_ECRS_meta_data_create ();
+ kuri = GNUNET_ECRS_keyword_list_to_uri (ectx, 2, (const char **) keywords);
+ waitForEvent = GNUNET_FSUI_upload_completed;
+ upload = GNUNET_FSUI_upload_star (ctx,
fn,
- (DirectoryScanCallback) &
+ (GNUNET_FSUI_DirectoryScanCallback) &
GNUNET_disk_directory_scan, NULL, 0, 0,
GNUNET_YES, GNUNET_NO, GNUNET_NO,
GNUNET_get_time () + 5 * GNUNET_CRON_HOURS, meta,
kuri, kuri);
CHECK (upload != NULL);
- ECRS_freeUri (kuri);
+ GNUNET_ECRS_uri_destroy (kuri);
kuri = NULL;
- ECRS_freeMetaData (meta);
+ GNUNET_ECRS_meta_data_destroy (meta);
prog = 0;
- while (lastEvent != FSUI_upload_completed)
+ while (lastEvent != GNUNET_FSUI_upload_completed)
{
prog++;
CHECK (prog < 5000);
@@ -286,12 +286,12 @@
if (GNUNET_shutdown_test () == GNUNET_YES)
break;
}
- FSUI_stopUpload (ctx, upload);
+ GNUNET_FSUI_upload_stop (ctx, upload);
GNUNET_snprintf (keyword, 40, "%s %s %s", keywords[0], _("AND"),
keywords[1]);
- uri = ECRS_parseCharKeywordURI (ectx, keyword);
- waitForEvent = FSUI_download_completed;
- search = FSUI_startSearch (ctx, 0, 10000, 240 * GNUNET_CRON_SECONDS, uri);
+ uri = GNUNET_ECRS_keyword_string_to_uri (ectx, keyword);
+ waitForEvent = GNUNET_FSUI_download_completed;
+ search = GNUNET_FSUI_search_start (ctx, 0, 10000, 240 * GNUNET_CRON_SECONDS,
uri);
CHECK (search != NULL);
prog = 0;
while (search != NULL)
@@ -306,11 +306,11 @@
#if DEBUG_VERBOSE
printf ("Testing FSUI suspend-resume\n");
#endif
- FSUI_stop (ctx); /* download possibly incomplete
+ GNUNET_FSUI_stop (ctx); /* download possibly incomplete
at this point, thus testing resume */
CHECK (search == NULL);
CHECK (download == NULL);
- ctx = FSUI_start (NULL,
+ ctx = GNUNET_FSUI_start (NULL,
cfg,
"fsuidownloadtest",
32, GNUNET_YES, &eventCallback, NULL);
@@ -325,29 +325,29 @@
}
CHECK (search == NULL);
CHECK (download != NULL);
- waitForEvent = FSUI_unindex_completed;
- unindex = FSUI_startUnindex (ctx, fn);
+ waitForEvent = GNUNET_FSUI_unindex_completed;
+ unindex = GNUNET_FSUI_unindex_start (ctx, fn);
CHECK (unindex != NULL);
prog = 0;
- while (lastEvent != FSUI_unindex_completed)
+ while (lastEvent != GNUNET_FSUI_unindex_completed)
{
prog++;
CHECK (prog < 5000);
GNUNET_thread_sleep (50 * GNUNET_CRON_MILLISECONDS);
- CHECK (lastEvent != FSUI_unindex_error);
+ CHECK (lastEvent != GNUNET_FSUI_unindex_error);
if (GNUNET_shutdown_test () == GNUNET_YES)
break;
}
- CHECK (lastEvent == FSUI_unindex_completed);
+ CHECK (lastEvent == GNUNET_FSUI_unindex_completed);
/* END OF TEST CODE */
FAILURE:
if (ctx != NULL)
{
if (unindex != NULL)
- FSUI_stopUnindex (ctx, unindex);
+ GNUNET_FSUI_unindex_stop (ctx, unindex);
if (download != NULL)
- FSUI_stopDownload (ctx, download);
- FSUI_stop (ctx);
+ GNUNET_FSUI_download_stop (ctx, download);
+ GNUNET_FSUI_stop (ctx);
}
if (fn != NULL)
{
@@ -355,20 +355,20 @@
GNUNET_free (fn);
}
if (uri != NULL)
- ECRS_freeUri (uri);
+ GNUNET_ECRS_uri_destroy (uri);
if (kuri != NULL)
- ECRS_freeUri (kuri);
+ GNUNET_ECRS_uri_destroy (kuri);
fn = makeName (43);
/* TODO: verify file 'fn(42)' == file 'fn(43)' */
UNLINK (fn);
GNUNET_free (fn);
if (upURI != NULL)
- ECRS_freeUri (upURI);
+ GNUNET_ECRS_uri_destroy (upURI);
#if START_DAEMON
- GE_BREAK (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
+ GNUNET_GE_BREAK (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
#endif
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return (ok == GNUNET_YES) ? 0 : 1;
}
Modified: GNUnet/src/applications/fs/fsui/fsui-loader.c
===================================================================
--- GNUnet/src/applications/fs/fsui/fsui-loader.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/fsui/fsui-loader.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -29,21 +29,21 @@
#include "gnunet_util.h"
static void *
-eventCallback (void *cls, const FSUI_Event * event)
+eventCallback (void *cls, const GNUNET_FSUI_Event * event)
{
#if 0
switch (event->type)
{
- case FSUI_search_result:
+ case GNUNET_FSUI_search_result:
printf ("Received search result\n");
break;
- case FSUI_upload_complete:
+ case GNUNET_FSUI_upload_complete:
printf ("Upload complete.\n");
break;
- case FSUI_download_complete:
+ case GNUNET_FSUI_download_complete:
printf ("Download complete.\n");
break;
- case FSUI_unindex_complete:
+ case GNUNET_FSUI_unindex_complete:
printf ("Unindex complete.\n");
break;
default:
@@ -57,21 +57,21 @@
int
main (int argc, char *argv[])
{
- struct FSUI_Context *ctx;
- struct GC_Configuration *cfg;
+ struct GNUNET_FSUI_Context *ctx;
+ struct GNUNET_GC_Configuration *cfg;
GNUNET_os_init (NULL);
- cfg = GC_create ();
+ cfg = GNUNET_GC_create ();
if (argc != 2)
{
fprintf (stderr, "Call with name of FSUI resource file!\n");
return -1;
}
- ctx = FSUI_start (NULL, cfg, argv[1], 16, GNUNET_YES, &eventCallback, NULL);
+ ctx = GNUNET_FSUI_start (NULL, cfg, argv[1], 16, GNUNET_YES, &eventCallback,
NULL);
if (ctx != NULL)
- FSUI_stop (ctx);
+ GNUNET_FSUI_stop (ctx);
else
- fprintf (stderr, "FSUI_start failed!\n");
- GC_free (cfg);
+ fprintf (stderr, "GNUNET_FSUI_start failed!\n");
+ GNUNET_GC_free (cfg);
return (ctx == NULL);
}
Modified: GNUnet/src/applications/fs/fsui/fsui.c
===================================================================
--- GNUnet/src/applications/fs/fsui/fsui.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/fsui/fsui.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -33,7 +33,7 @@
/* ***************** CRON code ***************** */
-#define FSUI_UDT_FREQUENCY (2 * GNUNET_CRON_SECONDS)
+#define GNUNET_FSUI_UDT_FREQUENCY (2 * GNUNET_CRON_SECONDS)
/**
* Cron job for download load management.
@@ -41,20 +41,20 @@
static void
updateDownloadThreads (void *c)
{
- FSUI_Context *ctx = c;
- FSUI_DownloadList *dpos;
+ GNUNET_FSUI_Context *ctx = c;
+ GNUNET_FSUI_DownloadList *dpos;
GNUNET_mutex_lock (ctx->lock);
dpos = ctx->activeDownloads.child;
#if DEBUG_PERSISTENCE
if (dpos != NULL)
- GE_LOG (ctx->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ctx->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Download thread manager schedules pending downloads...\n");
#endif
while (dpos != NULL)
{
- FSUI_updateDownloadThread (dpos);
+ GNUNET_FSUI_updateDownloadThread (dpos);
dpos = dpos->next;
}
GNUNET_mutex_unlock (ctx->lock);
@@ -63,15 +63,15 @@
/* ******************* START code *********************** */
static void
-signalDownloadResume (struct FSUI_DownloadList *ret, FSUI_Context * ctx)
+signalDownloadResume (struct GNUNET_FSUI_DownloadList *ret,
GNUNET_FSUI_Context * ctx)
{
- FSUI_Event event;
+ GNUNET_FSUI_Event event;
GNUNET_CronTime now;
GNUNET_CronTime eta;
while (ret != NULL)
{
- event.type = FSUI_download_resumed;
+ event.type = GNUNET_FSUI_download_resumed;
event.data.DownloadResumed.dc.pos = ret;
event.data.DownloadResumed.dc.cctx = ret->cctx;
event.data.DownloadResumed.dc.ppos =
@@ -110,15 +110,15 @@
}
static void
-signalUploadResume (struct FSUI_UploadList *ret, FSUI_Context * ctx)
+signalUploadResume (struct GNUNET_FSUI_UploadList *ret, GNUNET_FSUI_Context *
ctx)
{
- FSUI_Event event;
+ GNUNET_FSUI_Event event;
GNUNET_CronTime now;
GNUNET_CronTime eta;
while (ret != NULL)
{
- event.type = FSUI_upload_resumed;
+ event.type = GNUNET_FSUI_upload_resumed;
event.data.UploadResumed.uc.pos = ret;
event.data.UploadResumed.uc.cctx = NULL;
event.data.UploadResumed.uc.ppos = ret->parent;
@@ -157,17 +157,17 @@
* threads below are controlled by the parent.
*/
static void
-doResumeUploads (struct FSUI_UploadList *ret, FSUI_Context * ctx)
+doResumeUploads (struct GNUNET_FSUI_UploadList *ret, GNUNET_FSUI_Context * ctx)
{
while (ret != NULL)
{
- if (ret->state == FSUI_ACTIVE)
+ if (ret->state == GNUNET_FSUI_ACTIVE)
{
- ret->shared->handle = GNUNET_thread_create (&FSUI_uploadThread,
+ ret->shared->handle = GNUNET_thread_create
(&GNUNET_FSUI_uploadThread,
ret, 128 * 1024);
if (ret->shared->handle == NULL)
- GE_DIE_STRERROR (ctx->ectx,
- GE_FATAL | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_DIE_STRERROR (ctx->ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE,
"pthread_create");
}
ret = ret->next;
@@ -177,30 +177,30 @@
/**
* Start FSUI manager. Use the given progress callback to notify the
* UI about events. Start processing pending activities that were
- * running when FSUI_stop was called previously.
+ * running when GNUNET_FSUI_stop was called previously.
*
* @param name name of the context, must not be NULL
* @return NULL on error
*/
-struct FSUI_Context *
-FSUI_start (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+struct GNUNET_FSUI_Context *
+GNUNET_FSUI_start (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *name,
unsigned int threadPoolSize,
- int doResume, FSUI_EventCallback cb, void *closure)
+ int doResume, GNUNET_FSUI_EventProcessor cb, void *closure)
{
- FSUI_Event event;
- FSUI_Context *ret;
- FSUI_SearchList *list;
- FSUI_UnindexList *xlist;
+ GNUNET_FSUI_Event event;
+ GNUNET_FSUI_Context *ret;
+ GNUNET_FSUI_SearchList *list;
+ GNUNET_FSUI_UnindexList *xlist;
char *fn;
char *gh;
unsigned long long size;
- GE_ASSERT (ectx, cfg != NULL);
- ret = GNUNET_malloc (sizeof (FSUI_Context));
- memset (ret, 0, sizeof (FSUI_Context));
- ret->activeDownloads.state = FSUI_PENDING; /* !? */
+ GNUNET_GE_ASSERT (ectx, cfg != NULL);
+ ret = GNUNET_malloc (sizeof (GNUNET_FSUI_Context));
+ memset (ret, 0, sizeof (GNUNET_FSUI_Context));
+ ret->activeDownloads.state = GNUNET_FSUI_PENDING; /* !? */
ret->activeDownloads.ctx = ret;
ret->cfg = cfg;
ret->ecb = cb;
@@ -210,10 +210,10 @@
ret->threadPoolSize = 32;
ret->activeDownloadThreads = 0;
- GC_get_configuration_value_filename (cfg,
+ GNUNET_GC_get_configuration_value_filename (cfg,
"GNUNET",
"GNUNET_HOME",
- GNUNET_HOME_DIRECTORY, &gh);
+ GNUNET_DEFAULT_HOME_DIRECTORY, &gh);
GNUNET_disk_directory_create (ectx, gh);
fn = GNUNET_malloc (strlen (gh) + strlen (name) + 2 + 5);
strcpy (fn, gh);
@@ -227,16 +227,16 @@
{
ret->ipc = GNUNET_IPC_semaphore_create (ectx, fn, 1);
#if DEBUG_PERSISTENCE
- GE_LOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Getting IPC lock for FSUI (%s).\n", fn);
#endif
GNUNET_IPC_semaphore_down (ret->ipc, GNUNET_YES);
#if DEBUG_PERSISTENCE
- GE_LOG (ectx, GE_INFO | GE_REQUEST | GE_USER, "Aquired IPC lock.\n");
+ GNUNET_GE_LOG (ectx, GNUNET_GE_INFO | GNUNET_GE_REQUEST |
GNUNET_GE_USER, "Aquired IPC lock.\n");
#endif
strcat (fn, ".res");
- FSUI_deserialize (ret);
+ GNUNET_FSUI_deserialize (ret);
}
else
{
@@ -251,7 +251,7 @@
list = ret->activeSearches;
while (list != NULL)
{
- event.type = FSUI_search_resumed;
+ event.type = GNUNET_FSUI_search_resumed;
event.data.SearchResumed.sc.pos = list;
event.data.SearchResumed.sc.cctx = NULL;
event.data.SearchResumed.fis = list->resultsReceived;
@@ -271,11 +271,11 @@
if (GNUNET_OK !=
GNUNET_disk_file_size (ectx, xlist->filename, &size, GNUNET_YES))
size = 0;
- event.type = FSUI_unindex_resumed;
+ event.type = GNUNET_FSUI_unindex_resumed;
event.data.UnindexResumed.uc.pos = xlist;
event.data.UnindexResumed.uc.cctx = NULL;
event.data.UnindexResumed.completed =
- (xlist->state == FSUI_COMPLETED_JOINED) ? size : 0;
+ (xlist->state == GNUNET_FSUI_COMPLETED_JOINED) ? size : 0;
event.data.UnindexResumed.total = size;
event.data.UnindexResumed.eta = GNUNET_get_time ();
event.data.UnindexResumed.filename = xlist->filename;
@@ -288,7 +288,7 @@
ret->cron = cron_create (ectx);
/* 3a) resume downloads */
GNUNET_cron_add_job (ret->cron,
- &updateDownloadThreads, 0, FSUI_UDT_FREQUENCY, ret);
+ &updateDownloadThreads, 0, GNUNET_FSUI_UDT_FREQUENCY,
ret);
GNUNET_cron_start (ret->cron);
/* 3b) resume uploads */
doResumeUploads (ret->activeUploads.child, ret);
@@ -296,14 +296,14 @@
xlist = ret->unindexOperations;
while (xlist != NULL)
{
- if (xlist->state == FSUI_PENDING)
+ if (xlist->state == GNUNET_FSUI_PENDING)
{
- xlist->state = FSUI_ACTIVE;
- xlist->handle = GNUNET_thread_create (&FSUI_unindexThread,
+ xlist->state = GNUNET_FSUI_ACTIVE;
+ xlist->handle = GNUNET_thread_create (&GNUNET_FSUI_unindexThread,
xlist, 32 * 1024);
if (xlist->handle == NULL)
- GE_DIE_STRERROR (ectx,
- GE_FATAL | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_DIE_STRERROR (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE,
"pthread_create");
}
xlist = xlist->next;
@@ -312,14 +312,14 @@
list = ret->activeSearches;
while (list != NULL)
{
- if (list->state == FSUI_PENDING)
+ if (list->state == GNUNET_FSUI_PENDING)
{
- list->state = FSUI_ACTIVE;
+ list->state = GNUNET_FSUI_ACTIVE;
list->handle =
- GNUNET_thread_create (&FSUI_searchThread, list, 32 * 1024);
+ GNUNET_thread_create (&GNUNET_FSUI_searchThread, list, 32 * 1024);
if (list->handle == NULL)
- GE_DIE_STRERROR (ectx,
- GE_FATAL | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_DIE_STRERROR (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE,
"pthread_create");
}
list = list->next;
@@ -334,14 +334,14 @@
* (recursively) signal download suspension.
*/
static void
-signalDownloadSuspend (struct GE_Context *ectx,
- FSUI_Context * ctx, FSUI_DownloadList * list)
+signalDownloadSuspend (struct GNUNET_GE_Context *ectx,
+ GNUNET_FSUI_Context * ctx, GNUNET_FSUI_DownloadList *
list)
{
- FSUI_Event event;
+ GNUNET_FSUI_Event event;
while (list != NULL)
{
signalDownloadSuspend (ectx, ctx, list->child);
- event.type = FSUI_download_suspended;
+ event.type = GNUNET_FSUI_download_suspended;
event.data.DownloadSuspended.dc.pos = list;
event.data.DownloadSuspended.dc.cctx = list->cctx;
event.data.DownloadSuspended.dc.ppos =
@@ -359,14 +359,14 @@
* (recursively) signal upload suspension.
*/
static void
-signalUploadSuspend (struct GE_Context *ectx,
- FSUI_Context * ctx, FSUI_UploadList * upos)
+signalUploadSuspend (struct GNUNET_GE_Context *ectx,
+ GNUNET_FSUI_Context * ctx, GNUNET_FSUI_UploadList * upos)
{
- FSUI_Event event;
+ GNUNET_FSUI_Event event;
while (upos != NULL)
{
signalUploadSuspend (ectx, ctx, upos->child);
- event.type = FSUI_upload_suspended;
+ event.type = GNUNET_FSUI_upload_suspended;
event.data.UploadSuspended.uc.pos = upos;
event.data.UploadSuspended.uc.cctx = upos->cctx;
event.data.UploadSuspended.uc.ppos = upos->parent;
@@ -380,19 +380,19 @@
* (recursively) free download list
*/
static void
-freeDownloadList (FSUI_DownloadList * list)
+freeDownloadList (GNUNET_FSUI_DownloadList * list)
{
- FSUI_DownloadList *next;
+ GNUNET_FSUI_DownloadList *next;
int i;
while (list != NULL)
{
freeDownloadList (list->child);
- ECRS_freeUri (list->fi.uri);
- ECRS_freeMetaData (list->fi.meta);
+ GNUNET_ECRS_uri_destroy (list->fi.uri);
+ GNUNET_ECRS_meta_data_destroy (list->fi.meta);
GNUNET_free (list->filename);
for (i = 0; i < list->completedDownloadsCount; i++)
- ECRS_freeUri (list->completedDownloads[i]);
+ GNUNET_ECRS_uri_destroy (list->completedDownloads[i]);
GNUNET_array_grow (list->completedDownloads,
list->completedDownloadsCount, 0);
next = list->next;
@@ -405,10 +405,10 @@
* (recursively) free upload list
*/
static void
-freeUploadList (struct FSUI_Context *ctx, FSUI_UploadList * list)
+freeUploadList (struct GNUNET_FSUI_Context *ctx, GNUNET_FSUI_UploadList * list)
{
- FSUI_UploadList *next;
- FSUI_UploadShared *shared;
+ GNUNET_FSUI_UploadList *next;
+ GNUNET_FSUI_UploadShared *shared;
while (list != NULL)
{
@@ -416,17 +416,17 @@
next = list->next;
GNUNET_free (list->filename);
if (list->meta != NULL)
- ECRS_freeMetaData (list->meta);
+ GNUNET_ECRS_meta_data_destroy (list->meta);
if (list->keywords != NULL)
- ECRS_freeUri (list->keywords);
+ GNUNET_ECRS_uri_destroy (list->keywords);
if (list->uri != NULL)
- ECRS_freeUri (list->uri);
+ GNUNET_ECRS_uri_destroy (list->uri);
if (list->parent == &ctx->activeUploads)
{
shared = list->shared;
EXTRACTOR_removeAll (shared->extractors);
if (shared->global_keywords != NULL)
- ECRS_freeUri (shared->global_keywords);
+ GNUNET_ECRS_uri_destroy (shared->global_keywords);
GNUNET_free_non_null (shared->extractor_config);
GNUNET_free (shared);
}
@@ -440,26 +440,26 @@
* later if possible).
*/
void
-FSUI_stop (struct FSUI_Context *ctx)
+GNUNET_FSUI_stop (struct GNUNET_FSUI_Context *ctx)
{
- struct GE_Context *ectx;
- FSUI_SearchList *spos;
- FSUI_DownloadList *dpos;
- FSUI_UnindexList *xpos;
- FSUI_UploadList *upos;
- FSUI_Event event;
+ struct GNUNET_GE_Context *ectx;
+ GNUNET_FSUI_SearchList *spos;
+ GNUNET_FSUI_DownloadList *dpos;
+ GNUNET_FSUI_UnindexList *xpos;
+ GNUNET_FSUI_UploadList *upos;
+ GNUNET_FSUI_Event event;
void *unused;
int i;
ectx = ctx->ectx;
if (ctx->ipc != NULL)
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"FSUI shutdown. This may take a while.\n");
/* 1) stop everything */
GNUNET_cron_stop (ctx->cron);
- GNUNET_cron_del_job (ctx->cron, &updateDownloadThreads, FSUI_UDT_FREQUENCY,
+ GNUNET_cron_del_job (ctx->cron, &updateDownloadThreads,
GNUNET_FSUI_UDT_FREQUENCY,
ctx);
GNUNET_cron_destroy (ctx->cron);
@@ -468,22 +468,22 @@
dpos = ctx->activeDownloads.child;
while (dpos != NULL)
{
- FSUI_updateDownloadThread (dpos);
+ GNUNET_FSUI_updateDownloadThread (dpos);
dpos = dpos->next;
}
/* 1b) stop searching */
spos = ctx->activeSearches;
while (spos != NULL)
{
- if ((spos->state == FSUI_ACTIVE) ||
- (spos->state == FSUI_ABORTED) ||
- (spos->state == FSUI_ERROR) || (spos->state == FSUI_COMPLETED))
+ if ((spos->state == GNUNET_FSUI_ACTIVE) ||
+ (spos->state == GNUNET_FSUI_ABORTED) ||
+ (spos->state == GNUNET_FSUI_ERROR) || (spos->state ==
GNUNET_FSUI_COMPLETED))
{
- if (spos->state == FSUI_ACTIVE)
- spos->state = FSUI_PENDING;
+ if (spos->state == GNUNET_FSUI_ACTIVE)
+ spos->state = GNUNET_FSUI_PENDING;
GNUNET_thread_stop_sleep (spos->handle);
GNUNET_thread_join (spos->handle, &unused);
- if (spos->state != FSUI_PENDING)
+ if (spos->state != GNUNET_FSUI_PENDING)
spos->state++; /* _JOINED */
}
spos = spos->next;
@@ -492,15 +492,15 @@
xpos = ctx->unindexOperations;
while (xpos != NULL)
{
- if ((xpos->state == FSUI_ACTIVE) ||
- (xpos->state == FSUI_ABORTED) ||
- (xpos->state == FSUI_ERROR) || (xpos->state == FSUI_COMPLETED))
+ if ((xpos->state == GNUNET_FSUI_ACTIVE) ||
+ (xpos->state == GNUNET_FSUI_ABORTED) ||
+ (xpos->state == GNUNET_FSUI_ERROR) || (xpos->state ==
GNUNET_FSUI_COMPLETED))
{
- if (xpos->state == FSUI_ACTIVE)
- xpos->state = FSUI_PENDING;
+ if (xpos->state == GNUNET_FSUI_ACTIVE)
+ xpos->state = GNUNET_FSUI_PENDING;
GNUNET_thread_stop_sleep (xpos->handle);
GNUNET_thread_join (xpos->handle, &unused);
- if (xpos->state != FSUI_PENDING)
+ if (xpos->state != GNUNET_FSUI_PENDING)
xpos->state++; /* _JOINED */
}
xpos = xpos->next;
@@ -509,17 +509,17 @@
upos = ctx->activeUploads.child;
while (upos != NULL)
{
- if ((upos->state == FSUI_ACTIVE) ||
- (upos->state == FSUI_ABORTED) ||
- (upos->state == FSUI_ERROR) || (upos->state == FSUI_COMPLETED))
+ if ((upos->state == GNUNET_FSUI_ACTIVE) ||
+ (upos->state == GNUNET_FSUI_ABORTED) ||
+ (upos->state == GNUNET_FSUI_ERROR) || (upos->state ==
GNUNET_FSUI_COMPLETED))
{
/* NOTE: will force transitive termination
of rest of tree! */
- if (upos->state == FSUI_ACTIVE)
- upos->state = FSUI_PENDING;
+ if (upos->state == GNUNET_FSUI_ACTIVE)
+ upos->state = GNUNET_FSUI_PENDING;
GNUNET_thread_stop_sleep (upos->shared->handle);
GNUNET_thread_join (upos->shared->handle, &unused);
- if (upos->state != FSUI_PENDING)
+ if (upos->state != GNUNET_FSUI_PENDING)
upos->state++; /* _JOINED */
}
upos = upos->next;
@@ -530,7 +530,7 @@
spos = ctx->activeSearches;
while (spos != NULL)
{
- event.type = FSUI_search_suspended;
+ event.type = GNUNET_FSUI_search_suspended;
event.data.SearchSuspended.sc.pos = spos;
event.data.SearchSuspended.sc.cctx = spos->cctx;
ctx->ecb (ctx->ecbClosure, &event);
@@ -544,7 +544,7 @@
xpos = ctx->unindexOperations;
while (xpos != NULL)
{
- event.type = FSUI_unindex_suspended;
+ event.type = GNUNET_FSUI_unindex_suspended;
event.data.UnindexSuspended.uc.pos = xpos;
event.data.UnindexSuspended.uc.cctx = xpos->cctx;
ctx->ecb (ctx->ecbClosure, &event);
@@ -553,7 +553,7 @@
/* 3) serialize all of the FSUI state */
if (ctx->ipc != NULL)
- FSUI_serialize (ctx);
+ GNUNET_FSUI_serialize (ctx);
/* 4) finally, free memory */
/* 4a) free search memory */
@@ -561,13 +561,13 @@
{
spos = ctx->activeSearches;
ctx->activeSearches = spos->next;
- ECRS_freeUri (spos->uri);
+ GNUNET_ECRS_uri_destroy (spos->uri);
for (i = spos->sizeResultsReceived - 1; i >= 0; i--)
{
- ECRS_FileInfo *fi;
+ GNUNET_ECRS_FileInfo *fi;
fi = &spos->resultsReceived[i];
- ECRS_freeMetaData (fi->meta);
- ECRS_freeUri (fi->uri);
+ GNUNET_ECRS_meta_data_destroy (fi->meta);
+ GNUNET_ECRS_uri_destroy (fi->uri);
}
GNUNET_array_grow (spos->resultsReceived, spos->sizeResultsReceived, 0);
for (i = spos->sizeUnmatchedResultsReceived - 1; i >= 0; i--)
@@ -576,8 +576,8 @@
rp = &spos->unmatchedResultsReceived[i];
GNUNET_array_grow (rp->matchingKeys, rp->matchingKeyCount, 0);
- ECRS_freeMetaData (rp->fi.meta);
- ECRS_freeUri (rp->fi.uri);
+ GNUNET_ECRS_meta_data_destroy (rp->fi.meta);
+ GNUNET_ECRS_uri_destroy (rp->fi.uri);
}
GNUNET_array_grow (spos->unmatchedResultsReceived,
spos->sizeUnmatchedResultsReceived, 0);
@@ -605,8 +605,8 @@
GNUNET_mutex_destroy (ctx->lock);
GNUNET_free (ctx->name);
if (ctx->ipc != NULL)
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER, "FSUI shutdown complete.\n");
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, "FSUI
shutdown complete.\n");
GNUNET_free (ctx);
}
Modified: GNUnet/src/applications/fs/fsui/fsui.h
===================================================================
--- GNUnet/src/applications/fs/fsui/fsui.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/fsui/fsui.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -23,8 +23,8 @@
* @brief internal definitions for libfsui
* @author Christian Grothoff
*/
-#ifndef FSUI_H
-#define FSUI_H
+#ifndef GNUNET_FSUI_H
+#define GNUNET_FSUI_H
#include "gnunet_util.h"
#include "gnunet_util_cron.h"
@@ -45,7 +45,7 @@
/**
* What info do we have about this result?
*/
- ECRS_FileInfo fi;
+ GNUNET_ECRS_FileInfo fi;
/**
* For how many keys (GNUNET_hash of keyword) did we
@@ -58,7 +58,7 @@
/**
* @brief list of active searches
*/
-typedef struct FSUI_SearchList
+typedef struct GNUNET_FSUI_SearchList
{
/**
@@ -74,12 +74,12 @@
/**
* Searches are kept in a simple linked list.
*/
- struct FSUI_SearchList *next;
+ struct GNUNET_FSUI_SearchList *next;
/**
* Context for this search
*/
- struct FSUI_Context *ctx;
+ struct GNUNET_FSUI_Context *ctx;
/**
* Handle to the thread which performs the search.
@@ -89,17 +89,17 @@
/**
* Which URI are we searching?
*/
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
/**
* What downloads belong to this search?
*/
- struct FSUI_DownloadList **my_downloads;
+ struct GNUNET_FSUI_DownloadList **my_downloads;
/**
* List of all results found so far.
*/
- ECRS_FileInfo *resultsReceived;
+ GNUNET_ECRS_FileInfo *resultsReceived;
ResultPending *unmatchedResultsReceived;
@@ -138,14 +138,14 @@
*/
unsigned int sizeUnmatchedResultsReceived;
- FSUI_State state;
+ GNUNET_FSUI_State state;
-} FSUI_SearchList;
+} GNUNET_FSUI_SearchList;
/**
* @brief list of active downloads
*/
-typedef struct FSUI_DownloadList
+typedef struct GNUNET_FSUI_DownloadList
{
/**
@@ -162,7 +162,7 @@
/**
* URI for this download.
*/
- ECRS_FileInfo fi;
+ GNUNET_ECRS_FileInfo fi;
/**
* Filename for this download.
@@ -173,30 +173,30 @@
* Next in the linked list of all downloads
* kept in FSUI context.
*/
- struct FSUI_DownloadList *next;
+ struct GNUNET_FSUI_DownloadList *next;
/**
* For recursive downloads, download entry for
* the parent.
*/
- struct FSUI_DownloadList *parent;
+ struct GNUNET_FSUI_DownloadList *parent;
/**
* If this is a recursive download, this is the
* list of sub-downloads that are currently
* going on in parallel.
*/
- struct FSUI_DownloadList *child;
+ struct GNUNET_FSUI_DownloadList *child;
/**
* Search that this download belongs to (maybe NULL)
*/
- struct FSUI_SearchList *search;
+ struct GNUNET_FSUI_SearchList *search;
/**
* FSUI context for this download.
*/
- struct FSUI_Context *ctx;
+ struct GNUNET_FSUI_Context *ctx;
/**
* Client context for the downloadx
@@ -211,7 +211,7 @@
/**
* FIs of completed sub-downloads.
*/
- struct ECRS_URI **completedDownloads;
+ struct GNUNET_ECRS_URI **completedDownloads;
/**
* When did the download start? Note that if a download is resumed,
@@ -265,55 +265,55 @@
/**
* State of the download.
*/
- FSUI_State state;
+ GNUNET_FSUI_State state;
-} FSUI_DownloadList;
+} GNUNET_FSUI_DownloadList;
/**
* Context for the unindex thread.
*/
-typedef struct FSUI_UnindexList
+typedef struct GNUNET_FSUI_UnindexList
{
GNUNET_CronTime start_time;
- struct FSUI_UnindexList *next;
+ struct GNUNET_FSUI_UnindexList *next;
struct GNUNET_ThreadHandle *handle;
char *filename;
- struct FSUI_Context *ctx;
+ struct GNUNET_FSUI_Context *ctx;
void *cctx;
- FSUI_State state;
+ GNUNET_FSUI_State state;
-} FSUI_UnindexList;
+} GNUNET_FSUI_UnindexList;
/**
* Shared context for upload of entire structure.
*/
-typedef struct FSUI_UploadShared
+typedef struct GNUNET_FSUI_UploadShared
{
GNUNET_CronTime expiration;
- DirectoryScanCallback dsc;
+ GNUNET_FSUI_DirectoryScanCallback dsc;
void *dscClosure;
EXTRACTOR_ExtractorList *extractors;
- struct FSUI_Context *ctx;
+ struct GNUNET_FSUI_Context *ctx;
struct GNUNET_ThreadHandle *handle;
/**
* Keywords to be used for all uploads.
*/
- struct ECRS_URI *global_keywords;
+ struct GNUNET_ECRS_URI *global_keywords;
char *extractor_config;
@@ -325,12 +325,12 @@
int individualKeywords;
-} FSUI_UploadShared;
+} GNUNET_FSUI_UploadShared;
/**
* Context for each file upload.
*/
-typedef struct FSUI_UploadList
+typedef struct GNUNET_FSUI_UploadList
{
unsigned long long completed;
@@ -339,28 +339,28 @@
GNUNET_CronTime start_time;
- struct FSUI_UploadShared *shared;
+ struct GNUNET_FSUI_UploadShared *shared;
- struct FSUI_UploadList *next;
+ struct GNUNET_FSUI_UploadList *next;
- struct FSUI_UploadList *child;
+ struct GNUNET_FSUI_UploadList *child;
- struct FSUI_UploadList *parent;
+ struct GNUNET_FSUI_UploadList *parent;
/**
* Metadata for this file.
*/
- struct ECRS_MetaData *meta;
+ struct GNUNET_ECRS_MetaData *meta;
/**
* Keywords to be used for this upload.
*/
- struct ECRS_URI *keywords;
+ struct GNUNET_ECRS_URI *keywords;
/**
* URI for this file (set upon completion).
*/
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
char *filename;
@@ -372,19 +372,19 @@
/**
* State of this sub-process.
*/
- FSUI_State state;
+ GNUNET_FSUI_State state;
-} FSUI_UploadList;
+} GNUNET_FSUI_UploadList;
/**
* @brief global state of the FSUI library
*/
-typedef struct FSUI_Context
+typedef struct GNUNET_FSUI_Context
{
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
/**
* IPC semaphore used to ensure mutual exclusion
@@ -408,7 +408,7 @@
/**
* Callback for notifying the client about events.
*/
- FSUI_EventCallback ecb;
+ GNUNET_FSUI_EventProcessor ecb;
/**
* Extra argument to ecb.
@@ -418,25 +418,25 @@
/**
* Collection related data.
*/
- DataContainer *collectionData;
+ GNUNET_DataContainer *collectionData;
/**
* List of active searches.
*/
- FSUI_SearchList *activeSearches;
+ GNUNET_FSUI_SearchList *activeSearches;
/**
* List of active unindex operations.
*/
- FSUI_UnindexList *unindexOperations;
+ GNUNET_FSUI_UnindexList *unindexOperations;
- FSUI_UploadList activeUploads;
+ GNUNET_FSUI_UploadList activeUploads;
/**
* Root of the tree of downloads. On shutdown,
* FSUI must abort each of these downloads.
*/
- FSUI_DownloadList activeDownloads;
+ GNUNET_FSUI_DownloadList activeDownloads;
/**
* Target size of the thread pool for parallel
@@ -450,7 +450,7 @@
*/
unsigned int activeDownloadThreads;
-} FSUI_Context;
+} GNUNET_FSUI_Context;
/* ************ cross-file prototypes ************ */
@@ -461,16 +461,16 @@
*
* @return GNUNET_YES if change done that may require re-trying
*/
-int FSUI_updateDownloadThread (FSUI_DownloadList * list);
+int GNUNET_FSUI_updateDownloadThread (GNUNET_FSUI_DownloadList * list);
-void *FSUI_uploadThread (void *dl);
+void *GNUNET_FSUI_uploadThread (void *dl);
-void *FSUI_searchThread (void *pos);
+void *GNUNET_FSUI_searchThread (void *pos);
-void *FSUI_unindexThread (void *cls);
+void *GNUNET_FSUI_unindexThread (void *cls);
-void FSUI_serialize (struct FSUI_Context *ctx);
+void GNUNET_FSUI_serialize (struct GNUNET_FSUI_Context *ctx);
-void FSUI_deserialize (struct FSUI_Context *ctx);
+void GNUNET_FSUI_deserialize (struct GNUNET_FSUI_Context *ctx);
#endif
Modified: GNUnet/src/applications/fs/fsui/fsuitest.c
===================================================================
--- GNUnet/src/applications/fs/fsui/fsuitest.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/fsui/fsuitest.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -32,7 +32,7 @@
#define DEBUG_VERBOSE GNUNET_NO
-#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GE_BREAK(NULL, 0); goto FAILURE; }
+#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GNUNET_GE_BREAK(NULL, 0); goto
FAILURE; }
static char *
makeName (unsigned int i)
@@ -47,31 +47,31 @@
return fn;
}
-static volatile enum FSUI_EventType lastEvent;
+static volatile enum GNUNET_FSUI_EventType lastEvent;
-static struct FSUI_Context *ctx;
+static struct GNUNET_FSUI_Context *ctx;
-static struct FSUI_DownloadList *download;
+static struct GNUNET_FSUI_DownloadList *download;
static void *
-eventCallback (void *cls, const FSUI_Event * event)
+eventCallback (void *cls, const GNUNET_FSUI_Event * event)
{
static char unused;
char *fn;
switch (event->type)
{
- case FSUI_search_resumed:
- case FSUI_download_resumed:
- case FSUI_upload_resumed:
- case FSUI_unindex_resumed:
+ case GNUNET_FSUI_search_resumed:
+ case GNUNET_FSUI_download_resumed:
+ case GNUNET_FSUI_upload_resumed:
+ case GNUNET_FSUI_unindex_resumed:
return &unused;
- case FSUI_search_result:
+ case GNUNET_FSUI_search_result:
#if DEBUG_VERBOSE
printf ("Received search result\n");
#endif
fn = makeName (43);
- download = FSUI_startDownload (ctx,
+ download = GNUNET_FSUI_download_start (ctx,
0,
GNUNET_NO,
event->data.SearchResult.fi.uri,
@@ -79,17 +79,17 @@
fn, NULL, NULL);
GNUNET_free (fn);
break;
- case FSUI_upload_completed:
+ case GNUNET_FSUI_upload_completed:
#if DEBUG_VERBOSE
printf ("Upload complete.\n");
#endif
break;
- case FSUI_download_completed:
+ case GNUNET_FSUI_download_completed:
#if DEBUG_VERBOSE
printf ("Download complete.\n");
#endif
break;
- case FSUI_unindex_completed:
+ case GNUNET_FSUI_unindex_completed:
#if DEBUG_VERBOSE
printf ("Unindex complete.\n");
#endif
@@ -110,7 +110,7 @@
pid_t daemon;
#endif
int ok;
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
char *filename = NULL;
char *keywords[] = {
"fsui_foo",
@@ -119,22 +119,22 @@
};
char keyword[40];
int prog;
- struct ECRS_MetaData *meta;
- struct ECRS_URI *kuri;
- struct GC_Configuration *cfg;
- struct FSUI_UploadList *upload;
- struct FSUI_SearchList *search;
- struct FSUI_UnindexList *unindex;
+ struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_ECRS_URI *kuri;
+ struct GNUNET_GC_Configuration *cfg;
+ struct GNUNET_FSUI_UploadList *upload;
+ struct GNUNET_FSUI_SearchList *search;
+ struct GNUNET_FSUI_UnindexList *unindex;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#if START_DAEMON
daemon = GNUNET_daemon_start (NULL, cfg, "peer.conf", GNUNET_NO);
- GE_ASSERT (NULL, daemon > 0);
+ GNUNET_GE_ASSERT (NULL, daemon > 0);
CHECK (GNUNET_OK ==
GNUNET_wait_for_daemon_running (NULL, cfg,
60 * GNUNET_CRON_SECONDS));
@@ -143,7 +143,7 @@
ok = GNUNET_YES;
/* ACTUAL TEST CODE */
- ctx = FSUI_start (NULL, cfg, "fsuitest", 32, /* thread pool size */
+ ctx = GNUNET_FSUI_start (NULL, cfg, "fsuitest", 32, /* thread pool size */
GNUNET_NO, /* no resume */
&eventCallback, NULL);
CHECK (ctx != NULL);
@@ -151,9 +151,9 @@
GNUNET_disk_file_write (NULL,
filename,
"foo bar test!", strlen ("foo bar test!"), "600");
- meta = ECRS_createMetaData ();
- kuri = ECRS_parseListKeywordURI (NULL, 2, (const char **) keywords);
- upload = FSUI_startUpload (ctx, filename, (DirectoryScanCallback) &
GNUNET_disk_directory_scan, NULL, 0, /* anonymity */
+ meta = GNUNET_ECRS_meta_data_create ();
+ kuri = GNUNET_ECRS_keyword_list_to_uri (NULL, 2, (const char **) keywords);
+ upload = GNUNET_FSUI_upload_star (ctx, filename,
(GNUNET_FSUI_DirectoryScanCallback) & GNUNET_disk_directory_scan, NULL, 0,
/* anonymity */
0, /* priority */
GNUNET_YES,
GNUNET_NO,
@@ -161,10 +161,10 @@
GNUNET_get_time () + 5 * GNUNET_CRON_HOURS, meta,
kuri, kuri);
CHECK (upload != NULL);
- ECRS_freeUri (kuri);
- ECRS_freeMetaData (meta);
+ GNUNET_ECRS_uri_destroy (kuri);
+ GNUNET_ECRS_meta_data_destroy (meta);
prog = 0;
- while (lastEvent != FSUI_upload_completed)
+ while (lastEvent != GNUNET_FSUI_upload_completed)
{
prog++;
CHECK (prog <
@@ -174,12 +174,12 @@
}
GNUNET_snprintf (keyword, 40, "%s %s %s", keywords[0], _("AND"),
keywords[1]);
- uri = ECRS_parseCharKeywordURI (NULL, keyword);
- search = FSUI_startSearch (ctx, 0, 100, 240 * GNUNET_CRON_SECONDS, uri);
- ECRS_freeUri (uri);
+ uri = GNUNET_ECRS_keyword_string_to_uri (NULL, keyword);
+ search = GNUNET_FSUI_search_start (ctx, 0, 100, 240 * GNUNET_CRON_SECONDS,
uri);
+ GNUNET_ECRS_uri_destroy (uri);
CHECK (search != NULL);
prog = 0;
- while (lastEvent != FSUI_download_completed)
+ while (lastEvent != GNUNET_FSUI_download_completed)
{
prog++;
CHECK (prog < 10000);
@@ -187,11 +187,11 @@
if (GNUNET_shutdown_test () == GNUNET_YES)
break;
}
- FSUI_abortSearch (ctx, search);
- FSUI_stopSearch (ctx, search);
- unindex = FSUI_startUnindex (ctx, filename);
+ GNUNET_FSUI_search_abort (ctx, search);
+ GNUNET_FSUI_search_stop (ctx, search);
+ unindex = GNUNET_FSUI_unindex_start (ctx, filename);
prog = 0;
- while (lastEvent != FSUI_unindex_completed)
+ while (lastEvent != GNUNET_FSUI_unindex_completed)
{
prog++;
CHECK (prog < 10000);
@@ -199,15 +199,15 @@
if (GNUNET_shutdown_test () == GNUNET_YES)
break;
}
- if (lastEvent != FSUI_unindex_completed)
- FSUI_abortUnindex (ctx, unindex);
- FSUI_stopUnindex (ctx, unindex);
+ if (lastEvent != GNUNET_FSUI_unindex_completed)
+ GNUNET_FSUI_unindex_abort (ctx, unindex);
+ GNUNET_FSUI_unindex_stop (ctx, unindex);
/* END OF TEST CODE */
FAILURE:
if (ctx != NULL)
- FSUI_stop (ctx);
+ GNUNET_FSUI_stop (ctx);
if (filename != NULL)
{
UNLINK (filename);
@@ -219,9 +219,9 @@
GNUNET_free (filename);
#if START_DAEMON
- GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
+ GNUNET_GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
#endif
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return (ok == GNUNET_YES) ? 0 : 1;
}
Modified: GNUnet/src/applications/fs/fsui/fsuitest2.c
===================================================================
--- GNUnet/src/applications/fs/fsui/fsuitest2.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/fsui/fsuitest2.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -30,13 +30,13 @@
#include "gnunet_util_config_impl.h"
#include "gnunet_util_network_client.h"
-#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GE_BREAK(NULL, 0); goto FAILURE; }
+#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GNUNET_GE_BREAK(NULL, 0); goto
FAILURE; }
-static struct FSUI_Context *ctx;
+static struct GNUNET_FSUI_Context *ctx;
static void *
-eventCallback (void *cls, const FSUI_Event * event)
+eventCallback (void *cls, const GNUNET_FSUI_Event * event)
{
return NULL;
}
@@ -50,17 +50,17 @@
pid_t daemon;
#endif
int ok;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#if START_DAEMON
daemon = GNUNET_daemon_start (NULL, cfg, "peer.conf", GNUNET_NO);
- GE_ASSERT (NULL, daemon > 0);
+ GNUNET_GE_ASSERT (NULL, daemon > 0);
CHECK (GNUNET_OK ==
GNUNET_wait_for_daemon_running (NULL, cfg,
60 * GNUNET_CRON_SECONDS));
@@ -69,20 +69,20 @@
GNUNET_thread_sleep (5 * GNUNET_CRON_SECONDS); /* give apps time to
start */
/* ACTUAL TEST CODE */
- ctx = FSUI_start (NULL, cfg, "fsuitest2", 32, GNUNET_YES, /* do resume!
*/
+ ctx = GNUNET_FSUI_start (NULL, cfg, "fsuitest2", 32, GNUNET_YES, /* do
resume! */
&eventCallback, NULL);
CHECK (ctx != NULL);
- FSUI_stop (ctx);
+ GNUNET_FSUI_stop (ctx);
ctx =
- FSUI_start (NULL, cfg, "fsuitest2", 32, GNUNET_YES, &eventCallback, NULL);
+ GNUNET_FSUI_start (NULL, cfg, "fsuitest2", 32, GNUNET_YES, &eventCallback,
NULL);
CHECK (ctx != NULL);
FAILURE:
if (ctx != NULL)
- FSUI_stop (ctx);
+ GNUNET_FSUI_stop (ctx);
#if START_DAEMON
- GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
+ GNUNET_GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
#endif
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return (ok == GNUNET_YES) ? 0 : 1;
}
Modified: GNUnet/src/applications/fs/fsui/search.c
===================================================================
--- GNUnet/src/applications/fs/fsui/search.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/fsui/search.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -41,25 +41,25 @@
* Pass the result to the client and note it as shown.
*/
static void
-processResult (const ECRS_FileInfo * fi, FSUI_SearchList * pos)
+processResult (const GNUNET_ECRS_FileInfo * fi, GNUNET_FSUI_SearchList * pos)
{
- FSUI_Event event;
+ GNUNET_FSUI_Event event;
GNUNET_array_grow (pos->resultsReceived,
pos->sizeResultsReceived, pos->sizeResultsReceived + 1);
pos->resultsReceived[pos->sizeResultsReceived - 1].uri
- = ECRS_dupUri (fi->uri);
+ = GNUNET_ECRS_uri_duplicate (fi->uri);
pos->resultsReceived[pos->sizeResultsReceived - 1].meta
- = ECRS_dupMetaData (fi->meta);
+ = GNUNET_ECRS_meta_data_duplicate (fi->meta);
- event.type = FSUI_search_result;
+ event.type = GNUNET_FSUI_search_result;
event.data.SearchResult.sc.pos = pos;
event.data.SearchResult.sc.cctx = pos->cctx;
event.data.SearchResult.fi = *fi;
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);
+ GNUNET_URITRACK_add_state (pos->ctx->ectx,
+ pos->ctx->cfg, pos->uri, GNUNET_URITRACK_SEARCH_RESULT);
}
@@ -67,30 +67,30 @@
* Process results found by ECRS.
*/
static int
-spcb (const ECRS_FileInfo * fi,
+spcb (const GNUNET_ECRS_FileInfo * fi,
const GNUNET_HashCode * key, int isRoot, void *cls)
{
- FSUI_SearchList *pos = cls;
+ GNUNET_FSUI_SearchList *pos = cls;
unsigned int i;
unsigned int j;
ResultPending *rp;
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
ectx = pos->ctx->ectx;
- URITRACK_trackURI (ectx, pos->ctx->cfg, fi);
+ GNUNET_URITRACK_track (ectx, pos->ctx->cfg, fi);
if (isRoot)
{
- NS_setNamespaceRoot (ectx, pos->ctx->cfg, fi->uri);
- NS_addNamespaceInfo (ectx, pos->ctx->cfg, fi->uri, fi->meta);
+ GNUNET_NS_namespace_set_root (ectx, pos->ctx->cfg, fi->uri);
+ GNUNET_NS_namespace_add_information (ectx, pos->ctx->cfg, fi->uri,
fi->meta);
return GNUNET_OK;
}
for (i = 0; i < pos->sizeResultsReceived; i++)
- if (ECRS_equalsUri (fi->uri, pos->resultsReceived[i].uri))
+ if (GNUNET_ECRS_uri_test_equal (fi->uri, pos->resultsReceived[i].uri))
{
#if DEBUG_SEARCH
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Received search result that I have seen before.\n");
#endif
return GNUNET_OK; /* seen before */
@@ -99,10 +99,10 @@
{
if (key == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
#if DEBUG_SEARCH
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Received search result without key to decrypt.\n");
#endif
return GNUNET_SYSERR;
@@ -110,7 +110,7 @@
for (i = 0; i < pos->sizeUnmatchedResultsReceived; i++)
{
rp = &pos->unmatchedResultsReceived[i];
- if (ECRS_equalsUri (fi->uri, rp->fi.uri))
+ if (GNUNET_ECRS_uri_test_equal (fi->uri, rp->fi.uri))
{
for (j = 0; j < rp->matchingKeyCount; j++)
if (0 == memcmp (key,
@@ -118,8 +118,8 @@
sizeof (GNUNET_HashCode)))
{
#if DEBUG_SEARCH
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"Received search result that I have seen before
(missing keyword to show client).\n");
#endif
return GNUNET_OK;
@@ -127,15 +127,15 @@
if (rp->matchingKeyCount + 1 == pos->numberOfURIKeys)
{
#if DEBUG_SEARCH
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Received search result (showing client)!\n");
#endif
GNUNET_array_grow (rp->matchingKeys, rp->matchingKeyCount,
0);
processResult (&rp->fi, pos);
- ECRS_freeUri (rp->fi.uri);
- ECRS_freeMetaData (rp->fi.meta);
+ GNUNET_ECRS_uri_destroy (rp->fi.uri);
+ GNUNET_ECRS_meta_data_destroy (rp->fi.meta);
pos->unmatchedResultsReceived[i]
=
pos->unmatchedResultsReceived[pos->
@@ -153,8 +153,8 @@
rp->matchingKeyCount + 1);
rp->matchingKeys[rp->matchingKeyCount - 1] = *key;
#if DEBUG_SEARCH
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Received search result (waiting for more %u keys
before showing client).\n",
pos->numberOfURIKeys - rp->matchingKeyCount);
#endif
@@ -167,15 +167,15 @@
pos->sizeUnmatchedResultsReceived + 1);
rp =
&pos->unmatchedResultsReceived[pos->sizeUnmatchedResultsReceived - 1];
- rp->fi.meta = ECRS_dupMetaData (fi->meta);
- rp->fi.uri = ECRS_dupUri (fi->uri);
+ rp->fi.meta = GNUNET_ECRS_meta_data_duplicate (fi->meta);
+ rp->fi.uri = GNUNET_ECRS_uri_duplicate (fi->uri);
rp->matchingKeys = NULL;
rp->matchingKeyCount = 0;
GNUNET_array_grow (rp->matchingKeys, rp->matchingKeyCount, 1);
rp->matchingKeys[0] = *key;
#if DEBUG_SEARCH
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Received search result (waiting for %u more keys before showing
client).\n",
pos->numberOfURIKeys - rp->matchingKeyCount);
#endif
@@ -184,8 +184,8 @@
else
{
#if DEBUG_SEARCH
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Received search result (showing client)!\n");
#endif
processResult (fi, pos);
@@ -196,8 +196,8 @@
static int
testTerminate (void *cls)
{
- FSUI_SearchList *pos = cls;
- if ((pos->state == FSUI_ACTIVE) &&
+ GNUNET_FSUI_SearchList *pos = cls;
+ if ((pos->state == GNUNET_FSUI_ACTIVE) &&
(pos->maxResults > pos->sizeResultsReceived))
return GNUNET_OK;
return GNUNET_SYSERR;
@@ -207,19 +207,19 @@
* Thread that searches for data.
*/
void *
-FSUI_searchThread (void *cls)
+GNUNET_FSUI_searchThread (void *cls)
{
- FSUI_SearchList *pos = cls;
- FSUI_Event event;
+ GNUNET_FSUI_SearchList *pos = cls;
+ GNUNET_FSUI_Event event;
int ret;
- struct GE_Memory *mem;
- struct GE_Context *ee;
+ struct GNUNET_GE_Memory *mem;
+ struct GNUNET_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, mem);
- ret = ECRS_search (ee,
+ mem = GNUNET_GE_memory_create (2);
+ ee = GNUNET_GE_create_context_memory (GNUNET_GE_USER | GNUNET_GE_ADMIN |
+ GNUNET_GE_ERROR | GNUNET_GE_WARNING |
GNUNET_GE_FATAL |
+ GNUNET_GE_BULK | GNUNET_GE_IMMEDIATE, mem);
+ ret = GNUNET_ECRS_search (ee,
pos->ctx->cfg,
pos->uri,
pos->anonymityLevel,
@@ -228,38 +228,38 @@
{
const char *error;
- pos->state = FSUI_ERROR;
- event.type = FSUI_search_error;
+ pos->state = GNUNET_FSUI_ERROR;
+ event.type = GNUNET_FSUI_search_error;
event.data.SearchError.sc.pos = pos;
event.data.SearchError.sc.cctx = pos->cctx;
- error = GE_memory_get (mem, 0);
+ error = GNUNET_GE_memory_get (mem, 0);
if (error == NULL)
error = _("Error running search (no reason given).");
event.data.SearchError.message = error;
pos->ctx->ecb (pos->ctx->ecbClosure, &event);
}
- else if (pos->state == FSUI_ABORTED)
+ else if (pos->state == GNUNET_FSUI_ABORTED)
{
- event.type = FSUI_search_aborted;
+ event.type = GNUNET_FSUI_search_aborted;
event.data.SearchAborted.sc.pos = pos;
event.data.SearchAborted.sc.cctx = pos->cctx;
pos->ctx->ecb (pos->ctx->ecbClosure, &event);
}
- else if (pos->state == FSUI_ACTIVE)
+ else if (pos->state == GNUNET_FSUI_ACTIVE)
{
- pos->state = FSUI_COMPLETED;
- event.type = FSUI_search_completed;
+ pos->state = GNUNET_FSUI_COMPLETED;
+ event.type = GNUNET_FSUI_search_completed;
event.data.SearchCompleted.sc.pos = pos;
event.data.SearchCompleted.sc.cctx = pos->cctx;
pos->ctx->ecb (pos->ctx->ecbClosure, &event);
}
else
{
- GE_ASSERT (NULL, pos->state == FSUI_PENDING);
+ GNUNET_GE_ASSERT (NULL, pos->state == GNUNET_FSUI_PENDING);
/* must be suspending */
}
- GE_free_context (ee);
- GE_memory_free (mem);
+ GNUNET_GE_free_context (ee);
+ GNUNET_GE_memory_free (mem);
return NULL;
}
@@ -268,39 +268,39 @@
* Thread that searches for data (and signals startup).
*/
void *
-FSUI_searchThreadSignal (void *cls)
+GNUNET_FSUI_searchThreadSignal (void *cls)
{
- FSUI_SearchList *pos = cls;
- FSUI_Event event;
+ GNUNET_FSUI_SearchList *pos = cls;
+ GNUNET_FSUI_Event event;
- event.type = FSUI_search_started;
+ event.type = GNUNET_FSUI_search_started;
event.data.SearchStarted.sc.pos = pos;
event.data.SearchStarted.sc.cctx = NULL;
event.data.SearchStarted.searchURI = pos->uri;
event.data.SearchStarted.anonymityLevel = pos->anonymityLevel;
pos->cctx = pos->ctx->ecb (pos->ctx->ecbClosure, &event);
- return FSUI_searchThread (pos);
+ return GNUNET_FSUI_searchThread (pos);
}
/**
* Start a search.
*/
-struct FSUI_SearchList *
-FSUI_startSearch (struct FSUI_Context *ctx,
+struct GNUNET_FSUI_SearchList *
+GNUNET_FSUI_search_start (struct GNUNET_FSUI_Context *ctx,
unsigned int anonymityLevel,
unsigned int maxResults,
- GNUNET_CronTime timeout, const struct ECRS_URI *uri)
+ GNUNET_CronTime timeout, const struct GNUNET_ECRS_URI *uri)
{
- FSUI_SearchList *pos;
- struct GE_Context *ectx;
+ GNUNET_FSUI_SearchList *pos;
+ struct GNUNET_GE_Context *ectx;
ectx = ctx->ectx;
GNUNET_mutex_lock (ctx->lock);
- pos = GNUNET_malloc (sizeof (FSUI_SearchList));
+ pos = GNUNET_malloc (sizeof (GNUNET_FSUI_SearchList));
pos->maxResults = maxResults;
- pos->state = FSUI_ACTIVE;
- pos->uri = ECRS_dupUri (uri);
- pos->numberOfURIKeys = ECRS_countKeywordsOfUri (uri);
+ pos->state = GNUNET_FSUI_ACTIVE;
+ pos->uri = GNUNET_ECRS_uri_duplicate (uri);
+ pos->numberOfURIKeys = GNUNET_ECRS_uri_get_keyword_count_from_ksk (uri);
pos->sizeResultsReceived = 0;
pos->resultsReceived = NULL;
pos->sizeUnmatchedResultsReceived = 0;
@@ -310,13 +310,13 @@
pos->start_time = GNUNET_get_time ();
pos->timeout = timeout;
pos->handle =
- GNUNET_thread_create (&FSUI_searchThreadSignal, pos, 32 * 1024);
+ GNUNET_thread_create (&GNUNET_FSUI_searchThreadSignal, pos, 32 * 1024);
if (pos->handle == NULL)
{
- GE_LOG_STRERROR (ectx,
- GE_ERROR | GE_IMMEDIATE | GE_USER | GE_ADMIN,
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_IMMEDIATE | GNUNET_GE_USER
| GNUNET_GE_ADMIN,
"PTHREAD_CREATE");
- ECRS_freeUri (pos->uri);
+ GNUNET_ECRS_uri_destroy (pos->uri);
GNUNET_free (pos);
GNUNET_mutex_unlock (ctx->lock);
return NULL;
@@ -331,16 +331,16 @@
* Abort a search.
*/
int
-FSUI_abortSearch (struct FSUI_Context *ctx, struct FSUI_SearchList *sl)
+GNUNET_FSUI_search_abort (struct GNUNET_FSUI_Context *ctx, struct
GNUNET_FSUI_SearchList *sl)
{
- if (sl->state == FSUI_PENDING)
+ if (sl->state == GNUNET_FSUI_PENDING)
{
- sl->state = FSUI_ABORTED_JOINED;
+ sl->state = GNUNET_FSUI_ABORTED_JOINED;
return GNUNET_OK;
}
- if (sl->state != FSUI_ACTIVE)
+ if (sl->state != GNUNET_FSUI_ACTIVE)
return GNUNET_SYSERR;
- sl->state = FSUI_ABORTED;
+ sl->state = GNUNET_FSUI_ABORTED;
GNUNET_thread_stop_sleep (sl->handle);
return GNUNET_OK;
}
@@ -349,11 +349,11 @@
* Stop a search.
*/
int
-FSUI_stopSearch (struct FSUI_Context *ctx, struct FSUI_SearchList *sl)
+GNUNET_FSUI_search_stop (struct GNUNET_FSUI_Context *ctx, struct
GNUNET_FSUI_SearchList *sl)
{
- FSUI_Event event;
- FSUI_SearchList *pos;
- FSUI_SearchList *prev;
+ GNUNET_FSUI_Event event;
+ GNUNET_FSUI_SearchList *pos;
+ GNUNET_FSUI_SearchList *prev;
void *unused;
int i;
@@ -379,39 +379,39 @@
GNUNET_array_grow (sl->my_downloads, sl->my_downloads_size, 0);
GNUNET_mutex_unlock (ctx->lock);
pos->next = NULL;
- if ((pos->state == FSUI_ACTIVE) ||
- (pos->state == FSUI_COMPLETED) ||
- (pos->state == FSUI_ABORTED) || (pos->state == FSUI_ERROR))
+ if ((pos->state == GNUNET_FSUI_ACTIVE) ||
+ (pos->state == GNUNET_FSUI_COMPLETED) ||
+ (pos->state == GNUNET_FSUI_ABORTED) || (pos->state == GNUNET_FSUI_ERROR))
{
- GE_ASSERT (ctx->ectx, pos->handle != NULL);
+ GNUNET_GE_ASSERT (ctx->ectx, pos->handle != NULL);
GNUNET_thread_join (pos->handle, &unused);
pos->handle = NULL;
- if (pos->state == FSUI_ACTIVE)
- pos->state = FSUI_PENDING;
+ if (pos->state == GNUNET_FSUI_ACTIVE)
+ pos->state = GNUNET_FSUI_PENDING;
else
pos->state++; /* add _JOINED */
}
else
{
- GE_ASSERT (ctx->ectx, pos->handle == NULL);
+ GNUNET_GE_ASSERT (ctx->ectx, pos->handle == NULL);
}
- event.type = FSUI_search_stopped;
+ event.type = GNUNET_FSUI_search_stopped;
event.data.SearchStopped.sc.pos = pos;
event.data.SearchStopped.sc.cctx = pos->cctx;
pos->ctx->ecb (pos->ctx->ecbClosure, &event);
- ECRS_freeUri (pos->uri);
+ GNUNET_ECRS_uri_destroy (pos->uri);
for (i = 0; i < pos->sizeResultsReceived; i++)
{
- ECRS_freeUri (pos->resultsReceived[i].uri);
- ECRS_freeMetaData (pos->resultsReceived[i].meta);
+ GNUNET_ECRS_uri_destroy (pos->resultsReceived[i].uri);
+ GNUNET_ECRS_meta_data_destroy (pos->resultsReceived[i].meta);
}
GNUNET_array_grow (pos->resultsReceived, pos->sizeResultsReceived, 0);
for (i = 0; i < pos->sizeUnmatchedResultsReceived; i++)
{
- ECRS_freeUri (pos->unmatchedResultsReceived[i].fi.uri);
- ECRS_freeMetaData (pos->unmatchedResultsReceived[i].fi.meta);
+ GNUNET_ECRS_uri_destroy (pos->unmatchedResultsReceived[i].fi.uri);
+ GNUNET_ECRS_meta_data_destroy (pos->unmatchedResultsReceived[i].fi.meta);
GNUNET_array_grow (pos->unmatchedResultsReceived[i].matchingKeys,
pos->unmatchedResultsReceived[i].matchingKeyCount,
0);
Modified: GNUnet/src/applications/fs/fsui/searchtest.c
===================================================================
--- GNUnet/src/applications/fs/fsui/searchtest.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/fsui/searchtest.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -30,7 +30,7 @@
#include "gnunet_util_config_impl.h"
#include "gnunet_util_network_client.h"
-#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GE_BREAK(NULL, 0); goto FAILURE; }
+#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GNUNET_GE_BREAK(NULL, 0); goto
FAILURE; }
static char *
makeName (unsigned int i)
@@ -45,57 +45,57 @@
return fn;
}
-static volatile enum FSUI_EventType lastEvent;
+static volatile enum GNUNET_FSUI_EventType lastEvent;
-static struct FSUI_SearchList *search;
+static struct GNUNET_FSUI_SearchList *search;
-static struct ECRS_URI *uri;
+static struct GNUNET_ECRS_URI *uri;
-static struct FSUI_Context *ctx;
+static struct GNUNET_FSUI_Context *ctx;
static struct GNUNET_Mutex *lock;
-static volatile enum FSUI_EventType waitForEvent;
+static volatile enum GNUNET_FSUI_EventType waitForEvent;
static void *
-eventCallback (void *cls, const FSUI_Event * event)
+eventCallback (void *cls, const GNUNET_FSUI_Event * event)
{
static char unused;
GNUNET_mutex_lock (lock);
switch (event->type)
{
- case FSUI_search_resumed:
+ case GNUNET_FSUI_search_resumed:
search = event->data.SearchResumed.sc.pos;
break;
- case FSUI_search_suspended:
+ case GNUNET_FSUI_search_suspended:
search = NULL;
break;
- case FSUI_download_resumed:
- case FSUI_upload_resumed:
- case FSUI_unindex_resumed:
+ case GNUNET_FSUI_download_resumed:
+ case GNUNET_FSUI_upload_resumed:
+ case GNUNET_FSUI_unindex_resumed:
GNUNET_mutex_unlock (lock);
return &unused;
- case FSUI_search_result:
+ case GNUNET_FSUI_search_result:
printf ("Received search result\n");
- uri = ECRS_dupUri (event->data.SearchResult.fi.uri);
+ uri = GNUNET_ECRS_uri_duplicate (event->data.SearchResult.fi.uri);
break;
- case FSUI_upload_completed:
+ case GNUNET_FSUI_upload_completed:
printf ("Upload complete.\n");
break;
- case FSUI_download_completed:
+ case GNUNET_FSUI_download_completed:
printf ("Download complete.\n");
break;
- case FSUI_unindex_completed:
+ case GNUNET_FSUI_unindex_completed:
printf ("Unindex complete.\n");
break;
- case FSUI_upload_error:
+ case GNUNET_FSUI_upload_error:
printf ("Upload error.\n");
break;
- case FSUI_download_error:
+ case GNUNET_FSUI_download_error:
printf ("Download error.\n");
break;
- case FSUI_unindex_error:
+ case GNUNET_FSUI_unindex_error:
printf ("Unindex error.\n");
break;
default:
@@ -124,24 +124,24 @@
};
char keyword[40];
int prog;
- struct ECRS_MetaData *meta;
- struct ECRS_URI *kuri;
- struct GC_Configuration *cfg;
- struct FSUI_UploadList *upload;
- struct FSUI_UnindexList *unindex;
- struct FSUI_DownloadList *download;
- struct ECRS_URI *luri;
+ struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_ECRS_URI *kuri;
+ struct GNUNET_GC_Configuration *cfg;
+ struct GNUNET_FSUI_UploadList *upload;
+ struct GNUNET_FSUI_UnindexList *unindex;
+ struct GNUNET_FSUI_DownloadList *download;
+ struct GNUNET_ECRS_URI *luri;
ok = GNUNET_YES;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#if START_DAEMON
daemon = GNUNET_daemon_start (NULL, cfg, "peer.conf", GNUNET_NO);
- GE_ASSERT (NULL, daemon > 0);
+ GNUNET_GE_ASSERT (NULL, daemon > 0);
CHECK (GNUNET_OK ==
GNUNET_wait_for_daemon_running (NULL, cfg,
30 * GNUNET_CRON_SECONDS));
@@ -149,33 +149,33 @@
/* ACTUAL TEST CODE */
#endif
lock = GNUNET_mutex_create (GNUNET_NO);
- ctx = FSUI_start (NULL,
+ ctx = GNUNET_FSUI_start (NULL,
cfg, "fsuisearchtest", 32, GNUNET_YES, &eventCallback,
NULL);
CHECK (ctx != NULL);
GNUNET_snprintf (keyword, 40, "%s %s %s", keywords[0], _("AND"),
keywords[1]);
- luri = ECRS_parseCharKeywordURI (NULL, keyword);
- search = FSUI_startSearch (ctx, 0, 100, 240 * GNUNET_CRON_SECONDS, luri);
- ECRS_freeUri (luri);
+ luri = GNUNET_ECRS_keyword_string_to_uri (NULL, keyword);
+ search = GNUNET_FSUI_search_start (ctx, 0, 100, 240 * GNUNET_CRON_SECONDS,
luri);
+ GNUNET_ECRS_uri_destroy (luri);
uri = NULL;
CHECK (NULL != search);
- FSUI_stop (ctx);
+ GNUNET_FSUI_stop (ctx);
/* resume search! */
- ctx = FSUI_start (NULL,
+ ctx = GNUNET_FSUI_start (NULL,
cfg, "fsuisearchtest", 32, GNUNET_YES, &eventCallback,
NULL);
fn = makeName (42);
GNUNET_disk_file_write (NULL,
fn, "foo bar test!", strlen ("foo bar test!"),
"600");
- meta = ECRS_createMetaData ();
- kuri = ECRS_parseListKeywordURI (NULL, 2, (const char **) keywords);
- waitForEvent = FSUI_upload_completed;
+ meta = GNUNET_ECRS_meta_data_create ();
+ kuri = GNUNET_ECRS_keyword_list_to_uri (NULL, 2, (const char **) keywords);
+ waitForEvent = GNUNET_FSUI_upload_completed;
upload =
- FSUI_startUpload (ctx,
+ GNUNET_FSUI_upload_star (ctx,
fn,
- (DirectoryScanCallback) & GNUNET_disk_directory_scan,
+ (GNUNET_FSUI_DirectoryScanCallback) &
GNUNET_disk_directory_scan,
NULL,
0,
0,
@@ -186,10 +186,10 @@
CHECK (NULL != upload);
GNUNET_free (fn);
fn = NULL;
- ECRS_freeUri (kuri);
- ECRS_freeMetaData (meta);
+ GNUNET_ECRS_uri_destroy (kuri);
+ GNUNET_ECRS_meta_data_destroy (meta);
prog = 0;
- while (lastEvent != FSUI_upload_completed)
+ while (lastEvent != GNUNET_FSUI_upload_completed)
{
prog++;
if (prog == 10000)
@@ -203,7 +203,7 @@
if (GNUNET_shutdown_test () == GNUNET_YES)
break;
}
- FSUI_stopUpload (ctx, upload);
+ GNUNET_FSUI_upload_stop (ctx, upload);
while (uri == NULL)
{
@@ -211,21 +211,21 @@
CHECK (prog <
10000) GNUNET_thread_sleep (50 * GNUNET_CRON_MILLISECONDS);
}
- FSUI_abortSearch (ctx, search);
- FSUI_stopSearch (ctx, search);
+ GNUNET_FSUI_search_abort (ctx, search);
+ GNUNET_FSUI_search_stop (ctx, search);
CHECK (uri != NULL);
fn = makeName (43);
- meta = ECRS_createMetaData ();
- waitForEvent = FSUI_download_completed;
+ meta = GNUNET_ECRS_meta_data_create ();
+ waitForEvent = GNUNET_FSUI_download_completed;
download =
- FSUI_startDownload (ctx, 0, GNUNET_NO, uri, meta, fn, NULL, NULL);
- ECRS_freeMetaData (meta);
+ GNUNET_FSUI_download_start (ctx, 0, GNUNET_NO, uri, meta, fn, NULL, NULL);
+ GNUNET_ECRS_meta_data_destroy (meta);
GNUNET_free (fn);
fn = NULL;
- ECRS_freeUri (uri);
+ GNUNET_ECRS_uri_destroy (uri);
prog = 0;
- while (lastEvent != FSUI_download_completed)
+ while (lastEvent != GNUNET_FSUI_download_completed)
{
prog++;
CHECK (prog < 10000);
@@ -233,15 +233,15 @@
if (GNUNET_shutdown_test () == GNUNET_YES)
break;
}
- FSUI_stopDownload (ctx, download);
+ GNUNET_FSUI_download_stop (ctx, download);
fn = makeName (42);
- waitForEvent = FSUI_unindex_completed;
- unindex = FSUI_startUnindex (ctx, fn);
+ waitForEvent = GNUNET_FSUI_unindex_completed;
+ unindex = GNUNET_FSUI_unindex_start (ctx, fn);
GNUNET_free (fn);
fn = NULL;
CHECK (NULL != unindex);
prog = 0;
- while (lastEvent != FSUI_unindex_completed)
+ while (lastEvent != GNUNET_FSUI_unindex_completed)
{
prog++;
CHECK (prog < 10000);
@@ -249,12 +249,12 @@
if (GNUNET_shutdown_test () == GNUNET_YES)
break;
}
- FSUI_stopUnindex (ctx, unindex);
+ GNUNET_FSUI_unindex_stop (ctx, unindex);
/* END OF TEST CODE */
FAILURE:
if (ctx != NULL)
- FSUI_stop (ctx);
+ GNUNET_FSUI_stop (ctx);
if (lock != NULL)
GNUNET_mutex_destroy (lock);
GNUNET_free_non_null (fn);
@@ -267,9 +267,9 @@
GNUNET_free (fn);
#if START_DAEMON
- GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
+ GNUNET_GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
#endif
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return (ok == GNUNET_YES) ? 0 : 1;
}
Modified: GNUnet/src/applications/fs/fsui/serialize.c
===================================================================
--- GNUnet/src/applications/fs/fsui/serialize.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/fsui/serialize.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -48,12 +48,12 @@
}
static void
-writeURI (int fd, const struct ECRS_URI *uri)
+writeURI (int fd, const struct GNUNET_ECRS_URI *uri)
{
char *buf;
unsigned int size;
- buf = ECRS_uriToString (uri);
+ buf = GNUNET_ECRS_uri_to_string (uri);
size = strlen (buf);
WRITEINT (fd, size);
WRITE (fd, buf, size);
@@ -63,29 +63,29 @@
static void
WRITESTRING (int fd, const char *name)
{
- GE_BREAK (NULL, name != NULL);
+ GNUNET_GE_BREAK (NULL, name != NULL);
WRITEINT (fd, strlen (name));
WRITE (fd, name, strlen (name));
}
static void
-writeMetaData (struct GE_Context *ectx,
- int fd, const struct ECRS_MetaData *meta)
+writeMetaData (struct GNUNET_GE_Context *ectx,
+ int fd, const struct GNUNET_ECRS_MetaData *meta)
{
unsigned int size;
char *buf;
- size = ECRS_sizeofMetaData (meta,
- ECRS_SERIALIZE_FULL |
- ECRS_SERIALIZE_NO_COMPRESS);
+ size = GNUNET_ECRS_meta_data_get_serialized_size (meta,
+ GNUNET_ECRS_SERIALIZE_FULL |
+ GNUNET_ECRS_SERIALIZE_NO_COMPRESS);
if (size > 1024 * 1024)
size = 1024 * 1024;
buf = GNUNET_malloc (size);
- ECRS_serializeMetaData (ectx,
+ GNUNET_ECRS_meta_data_serialize (ectx,
meta,
buf,
size,
- ECRS_SERIALIZE_PART | ECRS_SERIALIZE_NO_COMPRESS);
+ GNUNET_ECRS_SERIALIZE_PART |
GNUNET_ECRS_SERIALIZE_NO_COMPRESS);
WRITEINT (fd, size);
WRITE (fd, buf, size);
GNUNET_free (buf);
@@ -93,7 +93,7 @@
static void
-writeFileInfo (struct GE_Context *ectx, int fd, const ECRS_FileInfo * fi)
+writeFileInfo (struct GNUNET_GE_Context *ectx, int fd, const
GNUNET_ECRS_FileInfo * fi)
{
writeMetaData (ectx, fd, fi->meta);
writeURI (fd, fi->uri);
@@ -104,11 +104,11 @@
* (recursively) write a download list.
*/
static void
-writeDownloadList (struct GE_Context *ectx,
- int fd, FSUI_Context * ctx, FSUI_DownloadList * list)
+writeDownloadList (struct GNUNET_GE_Context *ectx,
+ int fd, GNUNET_FSUI_Context * ctx, GNUNET_FSUI_DownloadList
* list)
{
int i;
- FSUI_SearchList *pos;
+ GNUNET_FSUI_SearchList *pos;
if (list == NULL)
{
@@ -116,8 +116,8 @@
return;
}
#if DEBUG_PERSISTENCE
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Serializing download state of download `%s': (%llu, %llu)\n",
list->filename, list->completed, list->total);
#endif
@@ -138,7 +138,7 @@
pos = pos->next;
if (pos == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
i = 0;
break;
}
@@ -167,7 +167,7 @@
}
static void
-writeCollection (int fd, struct FSUI_Context *ctx)
+writeCollection (int fd, struct GNUNET_FSUI_Context *ctx)
{
if ((ctx->collectionData == NULL) ||
(ctx->collectionData->size > 16 * 1024 * 1024))
@@ -180,9 +180,9 @@
}
static void
-writeSearches (int fd, struct FSUI_Context *ctx)
+writeSearches (int fd, struct GNUNET_FSUI_Context *ctx)
{
- FSUI_SearchList *spos;
+ GNUNET_FSUI_SearchList *spos;
int i;
spos = ctx->activeSearches;
@@ -195,9 +195,9 @@
spos = spos->next;
continue;
}
- GE_ASSERT (ctx->ectx,
- ECRS_isKeywordUri (spos->uri) ||
- ECRS_isNamespaceUri (spos->uri));
+ GNUNET_GE_ASSERT (ctx->ectx,
+ GNUNET_ECRS_uri_test_ksk (spos->uri) ||
+ GNUNET_ECRS_uri_test_sks (spos->uri));
WRITEINT (fd, 1);
WRITEINT (fd, spos->state);
WRITEINT (fd, spos->maxResults);
@@ -216,7 +216,7 @@
rp = &spos->unmatchedResultsReceived[i];
writeFileInfo (ctx->ectx, fd, &rp->fi);
- GE_ASSERT (ctx->ectx, rp->matchingKeyCount < spos->numberOfURIKeys);
+ GNUNET_GE_ASSERT (ctx->ectx, rp->matchingKeyCount <
spos->numberOfURIKeys);
if (rp->matchingKeyCount > 1024)
{
WRITEINT (fd, 0); /* too large to serialize */
@@ -233,9 +233,9 @@
}
static void
-writeUnindexing (int fd, struct FSUI_Context *ctx)
+writeUnindexing (int fd, struct GNUNET_FSUI_Context *ctx)
{
- FSUI_UnindexList *xpos;
+ GNUNET_FSUI_UnindexList *xpos;
xpos = ctx->unindexOperations;
@@ -252,8 +252,8 @@
static void
writeUploadList (int fd,
- struct FSUI_Context *ctx,
- struct FSUI_UploadList *upos, int top)
+ struct GNUNET_FSUI_Context *ctx,
+ struct GNUNET_FSUI_UploadList *upos, int top)
{
int bits;
@@ -289,9 +289,9 @@
}
static void
-writeUploads (int fd, struct FSUI_Context *ctx, struct FSUI_UploadList *upos)
+writeUploads (int fd, struct GNUNET_FSUI_Context *ctx, struct
GNUNET_FSUI_UploadList *upos)
{
- struct FSUI_UploadShared *shared;
+ struct GNUNET_FSUI_UploadShared *shared;
int bits;
while (upos != NULL)
@@ -320,7 +320,7 @@
}
void
-FSUI_serialize (struct FSUI_Context *ctx)
+GNUNET_FSUI_serialize (struct GNUNET_FSUI_Context *ctx)
{
int fd;
Modified: GNUnet/src/applications/fs/fsui/serializetest.c
===================================================================
--- GNUnet/src/applications/fs/fsui/serializetest.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/fsui/serializetest.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -33,11 +33,11 @@
#define DEBUG_VERBOSE GNUNET_NO
-#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GE_BREAK(ectx, 0); goto FAILURE; }
+#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GNUNET_GE_BREAK(ectx, 0); goto
FAILURE; }
static volatile int suspendRestart = 0;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
static char *
makeName (unsigned int i)
@@ -53,85 +53,85 @@
return fn;
}
-static volatile enum FSUI_EventType lastEvent;
-static volatile enum FSUI_EventType waitForEvent;
-static struct FSUI_Context *ctx;
-static struct ECRS_URI *upURI;
-static struct FSUI_UnindexList *unindex;
-static struct FSUI_UploadList *upload;
+static volatile enum GNUNET_FSUI_EventType lastEvent;
+static volatile enum GNUNET_FSUI_EventType waitForEvent;
+static struct GNUNET_FSUI_Context *ctx;
+static struct GNUNET_ECRS_URI *upURI;
+static struct GNUNET_FSUI_UnindexList *unindex;
+static struct GNUNET_FSUI_UploadList *upload;
static void *
-eventCallback (void *cls, const FSUI_Event * event)
+eventCallback (void *cls, const GNUNET_FSUI_Event * event)
{
switch (event->type)
{
- case FSUI_upload_progress:
+ case GNUNET_FSUI_upload_progress:
#if DEBUG_VERBOSE
printf ("Upload is progressing (%llu/%llu)...\n",
event->data.UploadProgress.completed,
event->data.UploadProgress.total);
#endif
break;
- case FSUI_upload_completed:
- upURI = ECRS_dupUri (event->data.UploadCompleted.uri);
+ case GNUNET_FSUI_upload_completed:
+ upURI = GNUNET_ECRS_uri_duplicate (event->data.UploadCompleted.uri);
#if DEBUG_VERBOSE
printf ("Upload complete.\n");
#endif
break;
- case FSUI_unindex_progress:
+ case GNUNET_FSUI_unindex_progress:
#if DEBUG_VERBOSE
printf ("Unindex is progressing (%llu/%llu)...\n",
event->data.UnindexProgress.completed,
event->data.UnindexProgress.total);
#endif
break;
- case FSUI_unindex_completed:
+ case GNUNET_FSUI_unindex_completed:
#if DEBUG_VERBOSE
printf ("Unindex complete.\n");
#endif
break;
- case FSUI_unindex_error:
- case FSUI_upload_error:
- case FSUI_download_error:
- case FSUI_search_error:
+ case GNUNET_FSUI_unindex_error:
+ case GNUNET_FSUI_upload_error:
+ case GNUNET_FSUI_download_error:
+ case GNUNET_FSUI_search_error:
fprintf (stderr, "Received ERROR: %d\n", event->type);
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
break;
- case FSUI_download_aborted:
+ case GNUNET_FSUI_download_aborted:
#if DEBUG_VERBOSE
printf ("Received download aborted event.\n");
#endif
break;
- case FSUI_unindex_resumed:
+ case GNUNET_FSUI_unindex_resumed:
#if DEBUG_VERBOSE
fprintf (stderr, "Received RESUMING: %d\n", event->type);
#endif
unindex = event->data.UnindexResumed.uc.pos;
break;
- case FSUI_upload_resumed:
+ case GNUNET_FSUI_upload_resumed:
#if DEBUG_VERBOSE
fprintf (stderr, "Received RESUMING: %d\n", event->type);
#endif
upload = event->data.UploadResumed.uc.pos;
break;
break;
- case FSUI_unindex_suspended:
+ case GNUNET_FSUI_unindex_suspended:
unindex = NULL;
#if DEBUG_VERBOSE
fprintf (stderr, "Received SUSPENDING: %d\n", event->type);
#endif
break;
- case FSUI_upload_suspended:
+ case GNUNET_FSUI_upload_suspended:
upload = NULL;
#if DEBUG_VERBOSE
fprintf (stderr, "Received SUSPENDING: %d\n", event->type);
#endif
break;
- case FSUI_upload_started:
- case FSUI_upload_stopped:
- case FSUI_unindex_started:
- case FSUI_unindex_stopped:
+ case GNUNET_FSUI_upload_started:
+ case GNUNET_FSUI_upload_stopped:
+ case GNUNET_FSUI_unindex_started:
+ case GNUNET_FSUI_unindex_stopped:
break;
default:
printf ("Unexpected event: %d\n", event->type);
@@ -163,27 +163,27 @@
};
int prog;
char *buf;
- struct ECRS_MetaData *meta;
- struct ECRS_URI *kuri = NULL;
- struct GC_Configuration *cfg;
+ struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_ECRS_URI *kuri = NULL;
+ struct GNUNET_GC_Configuration *cfg;
ok = GNUNET_YES;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#if START_DAEMON
daemon = GNUNET_daemon_start (NULL, cfg, "peer.conf", GNUNET_NO);
- GE_ASSERT (NULL, daemon > 0);
+ GNUNET_GE_ASSERT (NULL, daemon > 0);
CHECK (GNUNET_OK ==
GNUNET_wait_for_daemon_running (NULL, cfg,
30 * GNUNET_CRON_SECONDS));
GNUNET_thread_sleep (5 * GNUNET_CRON_SECONDS); /* give apps time to
start */
/* ACTUAL TEST CODE */
#endif
- ctx = FSUI_start (NULL,
+ ctx = GNUNET_FSUI_start (NULL,
cfg, "fsuiserializetest", 32, GNUNET_YES, &eventCallback,
NULL);
CHECK (ctx != NULL);
@@ -193,23 +193,23 @@
buf[i] = GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 256);
GNUNET_disk_file_write (ectx, fn, buf, FILESIZE, "600");
GNUNET_free (buf);
- meta = ECRS_createMetaData ();
- kuri = ECRS_parseListKeywordURI (ectx, 2, (const char **) keywords);
- waitForEvent = FSUI_upload_completed;
- upload = FSUI_startUpload (ctx,
+ meta = GNUNET_ECRS_meta_data_create ();
+ kuri = GNUNET_ECRS_keyword_list_to_uri (ectx, 2, (const char **) keywords);
+ waitForEvent = GNUNET_FSUI_upload_completed;
+ upload = GNUNET_FSUI_upload_star (ctx,
fn,
- (DirectoryScanCallback) &
+ (GNUNET_FSUI_DirectoryScanCallback) &
GNUNET_disk_directory_scan, NULL, 0, 0,
GNUNET_YES, GNUNET_NO, GNUNET_NO,
GNUNET_get_time () + 5 * GNUNET_CRON_HOURS, meta,
kuri, kuri);
CHECK (upload != NULL);
- ECRS_freeUri (kuri);
+ GNUNET_ECRS_uri_destroy (kuri);
kuri = NULL;
- ECRS_freeMetaData (meta);
+ GNUNET_ECRS_meta_data_destroy (meta);
prog = 0;
suspendRestart = 4;
- while (lastEvent != FSUI_upload_completed)
+ while (lastEvent != GNUNET_FSUI_upload_completed)
{
if ((suspendRestart > 0)
&& (GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 4) == 0))
@@ -218,9 +218,9 @@
#if DEBUG_VERBOSE
printf ("Testing FSUI suspend-resume\n");
#endif
- FSUI_stop (ctx); /* download possibly incomplete
+ GNUNET_FSUI_stop (ctx); /* download possibly incomplete
at this point, thus testing resume */
- ctx = FSUI_start (NULL,
+ ctx = GNUNET_FSUI_start (NULL,
cfg,
"fsuiserializetest",
32, GNUNET_YES, &eventCallback, NULL);
@@ -236,13 +236,13 @@
if (GNUNET_shutdown_test () == GNUNET_YES)
break;
}
- FSUI_stopUpload (ctx, upload);
- waitForEvent = FSUI_unindex_completed;
- unindex = FSUI_startUnindex (ctx, fn);
+ GNUNET_FSUI_upload_stop (ctx, upload);
+ waitForEvent = GNUNET_FSUI_unindex_completed;
+ unindex = GNUNET_FSUI_unindex_start (ctx, fn);
CHECK (unindex != NULL);
prog = 0;
suspendRestart = 4;
- while (lastEvent != FSUI_unindex_completed)
+ while (lastEvent != GNUNET_FSUI_unindex_completed)
{
if ((suspendRestart > 0)
&& (GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 4) == 0))
@@ -251,9 +251,9 @@
#if DEBUG_VERBOSE
printf ("Testing FSUI suspend-resume\n");
#endif
- FSUI_stop (ctx); /* download possibly incomplete
+ GNUNET_FSUI_stop (ctx); /* download possibly incomplete
at this point, thus testing resume */
- ctx = FSUI_start (NULL,
+ ctx = GNUNET_FSUI_start (NULL,
cfg,
"fsuiserializetest",
32, GNUNET_YES, &eventCallback, NULL);
@@ -266,18 +266,18 @@
prog++;
CHECK (prog < 5000);
GNUNET_thread_sleep (50 * GNUNET_CRON_MILLISECONDS);
- CHECK (lastEvent != FSUI_unindex_error);
+ CHECK (lastEvent != GNUNET_FSUI_unindex_error);
if (GNUNET_shutdown_test () == GNUNET_YES)
break;
}
- CHECK (lastEvent == FSUI_unindex_completed);
+ CHECK (lastEvent == GNUNET_FSUI_unindex_completed);
/* END OF TEST CODE */
FAILURE:
if (ctx != NULL)
{
if (unindex != NULL)
- FSUI_stopUnindex (ctx, unindex);
- FSUI_stop (ctx);
+ GNUNET_FSUI_unindex_stop (ctx, unindex);
+ GNUNET_FSUI_stop (ctx);
}
if (fn != NULL)
{
@@ -285,18 +285,18 @@
GNUNET_free (fn);
}
if (kuri != NULL)
- ECRS_freeUri (kuri);
+ GNUNET_ECRS_uri_destroy (kuri);
fn = makeName (43);
/* TODO: verify file 'fn(42)' == file 'fn(43)' */
UNLINK (fn);
GNUNET_free (fn);
if (upURI != NULL)
- ECRS_freeUri (upURI);
+ GNUNET_ECRS_uri_destroy (upURI);
#if START_DAEMON
- GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
+ GNUNET_GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
#endif
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return (ok == GNUNET_YES) ? 0 : 1;
}
Modified: GNUnet/src/applications/fs/fsui/serializetest2.c
===================================================================
--- GNUnet/src/applications/fs/fsui/serializetest2.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/fsui/serializetest2.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -36,9 +36,9 @@
#define UPLOAD_PREFIX "/tmp/gnunet-fsui-searializetest2"
-#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GE_BREAK(ectx, 0); goto FAILURE; }
+#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GNUNET_GE_BREAK(ectx, 0); goto
FAILURE; }
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
static char *
makeName (unsigned int i)
@@ -53,10 +53,10 @@
return fn;
}
-static struct FSUI_Context *ctx;
-static struct ECRS_URI *upURI;
-static struct FSUI_SearchList *search;
-static struct FSUI_DownloadList *download;
+static struct GNUNET_FSUI_Context *ctx;
+static struct GNUNET_ECRS_URI *upURI;
+static struct GNUNET_FSUI_SearchList *search;
+static struct GNUNET_FSUI_DownloadList *download;
static int have_error;
/**
@@ -67,16 +67,16 @@
static int no_check;
static void *
-eventCallback (void *cls, const FSUI_Event * event)
+eventCallback (void *cls, const GNUNET_FSUI_Event * event)
{
if (no_check)
return NULL;
switch (event->type)
{
- case FSUI_search_suspended:
+ case GNUNET_FSUI_search_suspended:
search = NULL;
break;
- case FSUI_download_suspended:
+ case GNUNET_FSUI_download_suspended:
if (event->data.DownloadSuspended.dc.spos != search)
{
fprintf (stderr,
@@ -101,13 +101,13 @@
if (event->data.DownloadSuspended.dc.pos == download)
download = NULL;
break;
- case FSUI_search_resumed:
+ case GNUNET_FSUI_search_resumed:
#if DEBUG_VERBOSE
printf ("Search resuming\n");
#endif
search = event->data.SearchResumed.sc.pos;
break;
- case FSUI_download_resumed:
+ case GNUNET_FSUI_download_resumed:
if (download == NULL)
download = event->data.DownloadResumed.dc.pos;
if (event->data.DownloadResumed.dc.spos != search)
@@ -134,27 +134,27 @@
printf ("Download resuming\n");
#endif
break;
- case FSUI_search_result:
+ case GNUNET_FSUI_search_result:
#if DEBUG_VERBOSE
printf ("Received search result\n");
#endif
break;
- case FSUI_upload_progress:
+ case GNUNET_FSUI_upload_progress:
#if DEBUG_VERBOSE
printf ("Upload is progressing (%llu/%llu)...\n",
event->data.UploadProgress.completed,
event->data.UploadProgress.total);
#endif
break;
- case FSUI_upload_completed:
+ case GNUNET_FSUI_upload_completed:
if (upURI != NULL)
- ECRS_freeUri (upURI);
- upURI = ECRS_dupUri (event->data.UploadCompleted.uri);
+ GNUNET_ECRS_uri_destroy (upURI);
+ upURI = GNUNET_ECRS_uri_duplicate (event->data.UploadCompleted.uri);
#if DEBUG_VERBOSE
printf ("Upload complete.\n");
#endif
break;
- case FSUI_download_completed:
+ case GNUNET_FSUI_download_completed:
if (event->data.DownloadCompleted.dc.spos != search)
{
fprintf (stderr,
@@ -179,7 +179,7 @@
printf ("Download complete.\n");
#endif
break;
- case FSUI_download_progress:
+ case GNUNET_FSUI_download_progress:
if (event->data.DownloadResumed.dc.spos != search)
{
fprintf (stderr,
@@ -206,54 +206,54 @@
event->data.DownloadProgress.total);
#endif
break;
- case FSUI_unindex_progress:
+ case GNUNET_FSUI_unindex_progress:
#if DEBUG_VERBOSE
printf ("Unindex is progressing (%llu/%llu)...\n",
event->data.UnindexProgress.completed,
event->data.UnindexProgress.total);
#endif
break;
- case FSUI_unindex_completed:
+ case GNUNET_FSUI_unindex_completed:
#if DEBUG_VERBOSE
printf ("Unindex complete.\n");
#endif
break;
- case FSUI_unindex_error:
+ case GNUNET_FSUI_unindex_error:
fprintf (stderr,
"Received ERROR: %d %s\n",
event->type, event->data.UnindexError.message);
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
break;
- case FSUI_upload_error:
+ case GNUNET_FSUI_upload_error:
fprintf (stderr,
"Received ERROR: %d %s\n",
event->type, event->data.UploadError.message);
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
break;
- case FSUI_download_error:
+ case GNUNET_FSUI_download_error:
fprintf (stderr,
"Received ERROR: %d %s\n",
event->type, event->data.DownloadError.message);
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
break;
- case FSUI_search_error:
+ case GNUNET_FSUI_search_error:
fprintf (stderr,
"Received ERROR: %d %s\n",
event->type, event->data.SearchError.message);
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
break;
- case FSUI_download_aborted:
+ case GNUNET_FSUI_download_aborted:
#if DEBUG_VERBOSE
printf ("Received download aborted event.\n");
#endif
break;
- case FSUI_unindex_suspended:
- case FSUI_upload_suspended:
+ case GNUNET_FSUI_unindex_suspended:
+ case GNUNET_FSUI_upload_suspended:
#if DEBUG_VERBOSE
fprintf (stderr, "Received SUSPENDING: %d\n", event->type);
#endif
break;
- case FSUI_download_started:
+ case GNUNET_FSUI_download_started:
if (download == NULL)
download = event->data.DownloadStarted.dc.pos;
if (event->data.DownloadStarted.dc.spos != search)
@@ -277,7 +277,7 @@
have_error = 1;
}
break;
- case FSUI_download_stopped:
+ case GNUNET_FSUI_download_stopped:
if (event->data.DownloadStopped.dc.spos != search)
{
fprintf (stderr,
@@ -299,13 +299,13 @@
have_error = 1;
}
break;
- case FSUI_upload_started:
- case FSUI_upload_stopped:
- case FSUI_search_started:
- case FSUI_search_aborted:
- case FSUI_search_stopped:
- case FSUI_unindex_started:
- case FSUI_unindex_stopped:
+ case GNUNET_FSUI_upload_started:
+ case GNUNET_FSUI_upload_stopped:
+ case GNUNET_FSUI_search_started:
+ case GNUNET_FSUI_search_aborted:
+ case GNUNET_FSUI_search_stopped:
+ case GNUNET_FSUI_unindex_started:
+ case GNUNET_FSUI_unindex_stopped:
break;
default:
printf ("Unexpected event: %d\n", event->type);
@@ -327,7 +327,7 @@
int ok;
int i;
int j;
- struct ECRS_URI *uri = NULL;
+ struct GNUNET_ECRS_URI *uri = NULL;
char *fn = NULL;
char *keywords[] = {
"down_foo",
@@ -337,31 +337,31 @@
char keyword[40];
int prog;
char *buf;
- struct ECRS_MetaData *meta;
- struct ECRS_URI *kuri = NULL;
- struct GC_Configuration *cfg;
- struct FSUI_UnindexList *unindex = NULL;
- struct FSUI_UploadList *upload = NULL;
+ struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_ECRS_URI *kuri = NULL;
+ struct GNUNET_GC_Configuration *cfg;
+ struct GNUNET_FSUI_UnindexList *unindex = NULL;
+ struct GNUNET_FSUI_UploadList *upload = NULL;
int suspendRestart = 0;
ok = GNUNET_YES;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#if START_DAEMON
daemon = GNUNET_daemon_start (NULL, cfg, "peer.conf", GNUNET_NO);
- GE_ASSERT (NULL, daemon > 0);
+ GNUNET_GE_ASSERT (NULL, daemon > 0);
CHECK (GNUNET_OK ==
GNUNET_wait_for_daemon_running (NULL, cfg,
30 * GNUNET_CRON_SECONDS));
GNUNET_thread_sleep (5 * GNUNET_CRON_SECONDS); /* give apps time to
start */
/* ACTUAL TEST CODE */
#endif
- ctx = FSUI_start (NULL,
+ ctx = GNUNET_FSUI_start (NULL,
cfg, "serializetest2", 32, GNUNET_YES, &eventCallback,
NULL);
CHECK (ctx != NULL);
@@ -375,33 +375,33 @@
GNUNET_free (buf);
GNUNET_free (fn);
}
- meta = ECRS_createMetaData ();
- kuri = ECRS_parseListKeywordURI (ectx, 2, (const char **) keywords);
- ECRS_addToMetaData (meta, EXTRACTOR_MIMETYPE, GNUNET_DIRECTORY_MIME);
- upload = FSUI_startUpload (ctx,
+ meta = GNUNET_ECRS_meta_data_create ();
+ kuri = GNUNET_ECRS_keyword_list_to_uri (ectx, 2, (const char **) keywords);
+ GNUNET_ECRS_meta_data_inser (meta, EXTRACTOR_MIMETYPE,
GNUNET_DIRECTORY_MIME);
+ upload = GNUNET_FSUI_upload_star (ctx,
UPLOAD_PREFIX,
- (DirectoryScanCallback) &
+ (GNUNET_FSUI_DirectoryScanCallback) &
GNUNET_disk_directory_scan, NULL, 0, 0,
GNUNET_YES, GNUNET_NO, GNUNET_NO,
GNUNET_get_time () + 5 * GNUNET_CRON_HOURS, meta,
kuri, kuri);
CHECK (upload != NULL);
- ECRS_freeUri (kuri);
+ GNUNET_ECRS_uri_destroy (kuri);
kuri = NULL;
- FSUI_stopUpload (ctx, upload);
+ GNUNET_FSUI_upload_stop (ctx, upload);
CHECK (upURI != NULL);
GNUNET_snprintf (keyword, 40, "%s %s %s", keywords[0], _("AND"),
keywords[1]);
- uri = ECRS_parseCharKeywordURI (ectx, keyword);
- search = FSUI_startSearch (ctx, 0, 100, 240 * GNUNET_CRON_SECONDS, uri);
+ uri = GNUNET_ECRS_keyword_string_to_uri (ectx, keyword);
+ search = GNUNET_FSUI_search_start (ctx, 0, 100, 240 * GNUNET_CRON_SECONDS,
uri);
CHECK (search != NULL);
- download = FSUI_startDownload (ctx,
+ download = GNUNET_FSUI_download_start (ctx,
0,
GNUNET_YES,
upURI,
meta,
UPLOAD_PREFIX "-download", search, NULL);
- ECRS_freeMetaData (meta);
+ GNUNET_ECRS_meta_data_destroy (meta);
prog = 0;
suspendRestart = 10;
while (prog < 1000)
@@ -415,11 +415,11 @@
#if DEBUG_VERBOSE
printf ("Testing FSUI suspend-resume\n");
#endif
- FSUI_stop (ctx); /* download possibly incomplete
+ GNUNET_FSUI_stop (ctx); /* download possibly incomplete
at this point, thus testing resume */
CHECK (search == NULL);
CHECK (download == NULL);
- ctx = FSUI_start (NULL,
+ ctx = GNUNET_FSUI_start (NULL,
cfg,
"serializetest2", 32, GNUNET_YES, &eventCallback,
NULL);
@@ -433,38 +433,38 @@
{
no_check = 1;
GNUNET_thread_sleep (50 * GNUNET_CRON_MILLISECONDS);
- FSUI_abortSearch (ctx, search);
- FSUI_stopSearch (ctx, search);
+ GNUNET_FSUI_search_abort (ctx, search);
+ GNUNET_FSUI_search_stop (ctx, search);
search = NULL;
no_check = 0;
}
if (GNUNET_shutdown_test () == GNUNET_YES)
break;
}
- FSUI_stopDownload (ctx, download);
+ GNUNET_FSUI_download_stop (ctx, download);
for (j = 4; j < 256; j += 4)
{
fn = makeName (j);
- unindex = FSUI_startUnindex (ctx, fn);
- FSUI_stopUnindex (ctx, unindex);
+ unindex = GNUNET_FSUI_unindex_start (ctx, fn);
+ GNUNET_FSUI_unindex_stop (ctx, unindex);
UNLINK (fn);
GNUNET_free (fn);
}
/* END OF TEST CODE */
FAILURE:
if (ctx != NULL)
- FSUI_stop (ctx);
+ GNUNET_FSUI_stop (ctx);
if (uri != NULL)
- ECRS_freeUri (uri);
+ GNUNET_ECRS_uri_destroy (uri);
if (kuri != NULL)
- ECRS_freeUri (kuri);
+ GNUNET_ECRS_uri_destroy (kuri);
if (upURI != NULL)
- ECRS_freeUri (upURI);
+ GNUNET_ECRS_uri_destroy (upURI);
#if START_DAEMON
- GE_BREAK (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
+ GNUNET_GE_BREAK (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
#endif
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
if (have_error)
ok = GNUNET_NO;
return (ok == GNUNET_YES) ? 0 : 1;
Modified: GNUnet/src/applications/fs/fsui/serializetest3.c
===================================================================
--- GNUnet/src/applications/fs/fsui/serializetest3.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/fsui/serializetest3.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -35,83 +35,83 @@
#define UPLOAD_PREFIX "/tmp/gnunet-fsui-searializetest3"
-#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GE_BREAK(ectx, 0); goto FAILURE; }
+#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GNUNET_GE_BREAK(ectx, 0); goto
FAILURE; }
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static struct FSUI_Context *ctx;
-static struct FSUI_SearchList *search;
+static struct GNUNET_FSUI_Context *ctx;
+static struct GNUNET_FSUI_SearchList *search;
static int have_error;
static void *
-eventCallback (void *cls, const FSUI_Event * event)
+eventCallback (void *cls, const GNUNET_FSUI_Event * event)
{
switch (event->type)
{
- case FSUI_search_suspended:
+ case GNUNET_FSUI_search_suspended:
search = NULL;
break;
- case FSUI_search_resumed:
+ case GNUNET_FSUI_search_resumed:
#if DEBUG_VERBOSE
printf ("Search resuming\n");
#endif
search = event->data.SearchResumed.sc.pos;
break;
- case FSUI_search_result:
+ case GNUNET_FSUI_search_result:
#if DEBUG_VERBOSE
printf ("Received search result\n");
#endif
break;
- case FSUI_upload_progress:
+ case GNUNET_FSUI_upload_progress:
#if DEBUG_VERBOSE
printf ("Upload is progressing (%llu/%llu)...\n",
event->data.UploadProgress.completed,
event->data.UploadProgress.total);
#endif
break;
- case FSUI_upload_completed:
+ case GNUNET_FSUI_upload_completed:
#if DEBUG_VERBOSE
printf ("Upload complete.\n");
#endif
break;
- case FSUI_unindex_progress:
+ case GNUNET_FSUI_unindex_progress:
#if DEBUG_VERBOSE
printf ("Unindex is progressing (%llu/%llu)...\n",
event->data.UnindexProgress.completed,
event->data.UnindexProgress.total);
#endif
break;
- case FSUI_unindex_completed:
+ case GNUNET_FSUI_unindex_completed:
#if DEBUG_VERBOSE
printf ("Unindex complete.\n");
#endif
break;
- case FSUI_unindex_error:
- case FSUI_upload_error:
- case FSUI_download_error:
- case FSUI_search_error:
+ case GNUNET_FSUI_unindex_error:
+ case GNUNET_FSUI_upload_error:
+ case GNUNET_FSUI_download_error:
+ case GNUNET_FSUI_search_error:
fprintf (stderr, "Received ERROR: %d\n", event->type);
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
break;
- case FSUI_download_aborted:
+ case GNUNET_FSUI_download_aborted:
#if DEBUG_VERBOSE
printf ("Received download aborted event.\n");
#endif
break;
- case FSUI_unindex_suspended:
- case FSUI_upload_suspended:
+ case GNUNET_FSUI_unindex_suspended:
+ case GNUNET_FSUI_upload_suspended:
#if DEBUG_VERBOSE
fprintf (stderr, "Received SUSPENDING: %d\n", event->type);
#endif
break;
- case FSUI_upload_started:
- case FSUI_upload_stopped:
- case FSUI_search_started:
- case FSUI_search_aborted:
- case FSUI_search_stopped:
- case FSUI_search_completed:
- case FSUI_unindex_started:
- case FSUI_unindex_stopped:
+ case GNUNET_FSUI_upload_started:
+ case GNUNET_FSUI_upload_stopped:
+ case GNUNET_FSUI_search_started:
+ case GNUNET_FSUI_search_aborted:
+ case GNUNET_FSUI_search_stopped:
+ case GNUNET_FSUI_search_completed:
+ case GNUNET_FSUI_unindex_started:
+ case GNUNET_FSUI_unindex_stopped:
break;
default:
printf ("Unexpected event: %d\n", event->type);
@@ -131,7 +131,7 @@
pid_t daemon;
#endif
int ok;
- struct ECRS_URI *uri = NULL;
+ struct GNUNET_ECRS_URI *uri = NULL;
char *keywords[] = {
"down_foo",
"down_bar",
@@ -139,34 +139,34 @@
};
char keyword[40];
int prog;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
int suspendRestart = 0;
ok = GNUNET_YES;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#if START_DAEMON
daemon = GNUNET_daemon_start (NULL, cfg, "peer.conf", GNUNET_NO);
- GE_ASSERT (NULL, daemon > 0);
+ GNUNET_GE_ASSERT (NULL, daemon > 0);
CHECK (GNUNET_OK ==
GNUNET_wait_for_daemon_running (NULL, cfg,
30 * GNUNET_CRON_SECONDS));
GNUNET_thread_sleep (5 * GNUNET_CRON_SECONDS); /* give apps time to
start */
/* ACTUAL TEST CODE */
#endif
- ctx = FSUI_start (NULL,
+ ctx = GNUNET_FSUI_start (NULL,
cfg, "serializetest3", 32, GNUNET_YES, &eventCallback,
NULL);
CHECK (ctx != NULL);
GNUNET_snprintf (keyword, 40, "%s %s %s", keywords[0], _("AND"),
keywords[1]);
- uri = ECRS_parseCharKeywordURI (ectx, keyword);
- search = FSUI_startSearch (ctx, 0, 100, 240 * GNUNET_CRON_SECONDS, uri);
+ uri = GNUNET_ECRS_keyword_string_to_uri (ectx, keyword);
+ search = GNUNET_FSUI_search_start (ctx, 0, 100, 240 * GNUNET_CRON_SECONDS,
uri);
CHECK (search != NULL);
prog = 0;
suspendRestart = 10;
@@ -181,10 +181,10 @@
#if DEBUG_VERBOSE
printf ("Testing FSUI suspend-resume\n");
#endif
- FSUI_stop (ctx); /* download possibly incomplete
+ GNUNET_FSUI_stop (ctx); /* download possibly incomplete
at this point, thus testing resume */
CHECK (search == NULL);
- ctx = FSUI_start (NULL,
+ ctx = GNUNET_FSUI_start (NULL,
cfg,
"serializetest3", 32, GNUNET_YES, &eventCallback,
NULL);
@@ -197,20 +197,20 @@
if (GNUNET_shutdown_test () == GNUNET_YES)
break;
}
- FSUI_abortSearch (ctx, search);
- FSUI_stopSearch (ctx, search);
+ GNUNET_FSUI_search_abort (ctx, search);
+ GNUNET_FSUI_search_stop (ctx, search);
search = NULL;
/* END OF TEST CODE */
FAILURE:
if (ctx != NULL)
- FSUI_stop (ctx);
+ GNUNET_FSUI_stop (ctx);
if (uri != NULL)
- ECRS_freeUri (uri);
+ GNUNET_ECRS_uri_destroy (uri);
#if START_DAEMON
- GE_BREAK (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
+ GNUNET_GE_BREAK (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
#endif
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
if (have_error)
ok = GNUNET_NO;
return (ok == GNUNET_YES) ? 0 : 1;
Modified: GNUnet/src/applications/fs/fsui/serializetest4.c
===================================================================
--- GNUnet/src/applications/fs/fsui/serializetest4.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/fsui/serializetest4.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -36,9 +36,9 @@
#define UPLOAD_PREFIX "/tmp/gnunet-fsui-searializetest4"
-#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GE_BREAK(ectx, 0); goto FAILURE; }
+#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GNUNET_GE_BREAK(ectx, 0); goto
FAILURE; }
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
static char *
makeName (unsigned int i)
@@ -53,9 +53,9 @@
return fn;
}
-static struct FSUI_Context *ctx;
-static struct ECRS_URI *upURI;
-static struct FSUI_DownloadList *download;
+static struct GNUNET_FSUI_Context *ctx;
+static struct GNUNET_ECRS_URI *upURI;
+static struct GNUNET_FSUI_DownloadList *download;
static int have_error;
/**
@@ -66,13 +66,13 @@
static int no_check;
static void *
-eventCallback (void *cls, const FSUI_Event * event)
+eventCallback (void *cls, const GNUNET_FSUI_Event * event)
{
if (no_check)
return NULL;
switch (event->type)
{
- case FSUI_download_suspended:
+ case GNUNET_FSUI_download_suspended:
if (event->data.DownloadSuspended.dc.spos != NULL)
{
fprintf (stderr,
@@ -97,7 +97,7 @@
if (event->data.DownloadSuspended.dc.pos == download)
download = NULL;
break;
- case FSUI_download_resumed:
+ case GNUNET_FSUI_download_resumed:
if (download == NULL)
download = event->data.DownloadResumed.dc.pos;
if (event->data.DownloadResumed.dc.spos != NULL)
@@ -124,22 +124,22 @@
printf ("Download resuming\n");
#endif
break;
- case FSUI_upload_progress:
+ case GNUNET_FSUI_upload_progress:
#if DEBUG_VERBOSE
printf ("Upload is progressing (%llu/%llu)...\n",
event->data.UploadProgress.completed,
event->data.UploadProgress.total);
#endif
break;
- case FSUI_upload_completed:
+ case GNUNET_FSUI_upload_completed:
if (upURI != NULL)
- ECRS_freeUri (upURI);
- upURI = ECRS_dupUri (event->data.UploadCompleted.uri);
+ GNUNET_ECRS_uri_destroy (upURI);
+ upURI = GNUNET_ECRS_uri_duplicate (event->data.UploadCompleted.uri);
#if DEBUG_VERBOSE
printf ("Upload complete.\n");
#endif
break;
- case FSUI_download_completed:
+ case GNUNET_FSUI_download_completed:
if (event->data.DownloadCompleted.dc.spos != NULL)
{
fprintf (stderr,
@@ -164,7 +164,7 @@
printf ("Download complete.\n");
#endif
break;
- case FSUI_download_progress:
+ case GNUNET_FSUI_download_progress:
if (event->data.DownloadResumed.dc.spos != NULL)
{
fprintf (stderr,
@@ -191,37 +191,37 @@
event->data.DownloadProgress.total);
#endif
break;
- case FSUI_unindex_progress:
+ case GNUNET_FSUI_unindex_progress:
#if DEBUG_VERBOSE
printf ("Unindex is progressing (%llu/%llu)...\n",
event->data.UnindexProgress.completed,
event->data.UnindexProgress.total);
#endif
break;
- case FSUI_unindex_completed:
+ case GNUNET_FSUI_unindex_completed:
#if DEBUG_VERBOSE
printf ("Unindex complete.\n");
#endif
break;
- case FSUI_unindex_error:
- case FSUI_upload_error:
- case FSUI_download_error:
- case FSUI_search_error:
+ case GNUNET_FSUI_unindex_error:
+ case GNUNET_FSUI_upload_error:
+ case GNUNET_FSUI_download_error:
+ case GNUNET_FSUI_search_error:
fprintf (stderr, "Received ERROR: %d\n", event->type);
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
break;
- case FSUI_download_aborted:
+ case GNUNET_FSUI_download_aborted:
#if DEBUG_VERBOSE
printf ("Received download aborted event.\n");
#endif
break;
- case FSUI_unindex_suspended:
- case FSUI_upload_suspended:
+ case GNUNET_FSUI_unindex_suspended:
+ case GNUNET_FSUI_upload_suspended:
#if DEBUG_VERBOSE
fprintf (stderr, "Received SUSPENDING: %d\n", event->type);
#endif
break;
- case FSUI_download_started:
+ case GNUNET_FSUI_download_started:
if (download == NULL)
download = event->data.DownloadStarted.dc.pos;
if (event->data.DownloadStarted.dc.spos != NULL)
@@ -245,7 +245,7 @@
have_error = 1;
}
break;
- case FSUI_download_stopped:
+ case GNUNET_FSUI_download_stopped:
if (event->data.DownloadStopped.dc.spos != NULL)
{
fprintf (stderr,
@@ -267,13 +267,13 @@
have_error = 1;
}
break;
- case FSUI_upload_started:
- case FSUI_upload_stopped:
- case FSUI_search_started:
- case FSUI_search_aborted:
- case FSUI_search_stopped:
- case FSUI_unindex_started:
- case FSUI_unindex_stopped:
+ case GNUNET_FSUI_upload_started:
+ case GNUNET_FSUI_upload_stopped:
+ case GNUNET_FSUI_search_started:
+ case GNUNET_FSUI_search_aborted:
+ case GNUNET_FSUI_search_stopped:
+ case GNUNET_FSUI_unindex_started:
+ case GNUNET_FSUI_unindex_stopped:
break;
default:
printf ("Unexpected event: %d\n", event->type);
@@ -295,7 +295,7 @@
int ok;
int i;
int j;
- struct ECRS_URI *uri = NULL;
+ struct GNUNET_ECRS_URI *uri = NULL;
char *fn = NULL;
char *keywords[] = {
"down_foo",
@@ -305,31 +305,31 @@
char keyword[40];
int prog;
char *buf;
- struct ECRS_MetaData *meta;
- struct ECRS_URI *kuri = NULL;
- struct GC_Configuration *cfg;
- struct FSUI_UnindexList *unindex = NULL;
- struct FSUI_UploadList *upload = NULL;
+ struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_ECRS_URI *kuri = NULL;
+ struct GNUNET_GC_Configuration *cfg;
+ struct GNUNET_FSUI_UnindexList *unindex = NULL;
+ struct GNUNET_FSUI_UploadList *upload = NULL;
int suspendRestart = 0;
ok = GNUNET_YES;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#if START_DAEMON
daemon = GNUNET_daemon_start (NULL, cfg, "peer.conf", GNUNET_NO);
- GE_ASSERT (NULL, daemon > 0);
+ GNUNET_GE_ASSERT (NULL, daemon > 0);
CHECK (GNUNET_OK ==
GNUNET_wait_for_daemon_running (NULL, cfg,
30 * GNUNET_CRON_SECONDS));
GNUNET_thread_sleep (5 * GNUNET_CRON_SECONDS); /* give apps time to
start */
/* ACTUAL TEST CODE */
#endif
- ctx = FSUI_start (NULL,
+ ctx = GNUNET_FSUI_start (NULL,
cfg, "serializetest4", 32, GNUNET_YES, &eventCallback,
NULL);
CHECK (ctx != NULL);
@@ -343,29 +343,29 @@
GNUNET_free (buf);
GNUNET_free (fn);
}
- meta = ECRS_createMetaData ();
- kuri = ECRS_parseListKeywordURI (ectx, 2, (const char **) keywords);
- ECRS_addToMetaData (meta, EXTRACTOR_MIMETYPE, GNUNET_DIRECTORY_MIME);
- upload = FSUI_startUpload (ctx,
+ meta = GNUNET_ECRS_meta_data_create ();
+ kuri = GNUNET_ECRS_keyword_list_to_uri (ectx, 2, (const char **) keywords);
+ GNUNET_ECRS_meta_data_inser (meta, EXTRACTOR_MIMETYPE,
GNUNET_DIRECTORY_MIME);
+ upload = GNUNET_FSUI_upload_star (ctx,
UPLOAD_PREFIX,
- (DirectoryScanCallback) &
+ (GNUNET_FSUI_DirectoryScanCallback) &
GNUNET_disk_directory_scan, NULL, 0, 0,
GNUNET_YES, GNUNET_NO, GNUNET_NO,
GNUNET_get_time () + 5 * GNUNET_CRON_HOURS, meta,
kuri, kuri);
CHECK (upload != NULL);
- ECRS_freeUri (kuri);
+ GNUNET_ECRS_uri_destroy (kuri);
kuri = NULL;
- FSUI_stopUpload (ctx, upload);
+ GNUNET_FSUI_upload_stop (ctx, upload);
GNUNET_snprintf (keyword, 40, "%s %s %s", keywords[0], _("AND"),
keywords[1]);
- uri = ECRS_parseCharKeywordURI (ectx, keyword);
- download = FSUI_startDownload (ctx,
+ uri = GNUNET_ECRS_keyword_string_to_uri (ectx, keyword);
+ download = GNUNET_FSUI_download_start (ctx,
0,
GNUNET_YES,
upURI,
meta, UPLOAD_PREFIX "-download", NULL, NULL);
- ECRS_freeMetaData (meta);
+ GNUNET_ECRS_meta_data_destroy (meta);
prog = 0;
suspendRestart = 10;
while (prog < 1000)
@@ -379,10 +379,10 @@
#if DEBUG_VERBOSE
printf ("Testing FSUI suspend-resume\n");
#endif
- FSUI_stop (ctx); /* download possibly incomplete
+ GNUNET_FSUI_stop (ctx); /* download possibly incomplete
at this point, thus testing resume */
CHECK (download == NULL);
- ctx = FSUI_start (NULL,
+ ctx = GNUNET_FSUI_start (NULL,
cfg,
"serializetest4", 32, GNUNET_YES, &eventCallback,
NULL);
@@ -395,30 +395,30 @@
if (GNUNET_shutdown_test () == GNUNET_YES)
break;
}
- FSUI_stopDownload (ctx, download);
+ GNUNET_FSUI_download_stop (ctx, download);
for (j = 4; j < 16; j += 4)
{
fn = makeName (j);
- unindex = FSUI_startUnindex (ctx, fn);
- FSUI_stopUnindex (ctx, unindex);
+ unindex = GNUNET_FSUI_unindex_start (ctx, fn);
+ GNUNET_FSUI_unindex_stop (ctx, unindex);
UNLINK (fn);
GNUNET_free (fn);
}
/* END OF TEST CODE */
FAILURE:
if (ctx != NULL)
- FSUI_stop (ctx);
+ GNUNET_FSUI_stop (ctx);
if (uri != NULL)
- ECRS_freeUri (uri);
+ GNUNET_ECRS_uri_destroy (uri);
if (kuri != NULL)
- ECRS_freeUri (kuri);
+ GNUNET_ECRS_uri_destroy (kuri);
if (upURI != NULL)
- ECRS_freeUri (upURI);
+ GNUNET_ECRS_uri_destroy (upURI);
#if START_DAEMON
- GE_BREAK (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
+ GNUNET_GE_BREAK (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
#endif
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
if (have_error)
ok = GNUNET_NO;
return (ok == GNUNET_YES) ? 0 : 1;
Modified: GNUnet/src/applications/fs/fsui/unindex.c
===================================================================
--- GNUnet/src/applications/fs/fsui/unindex.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/fsui/unindex.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -40,10 +40,10 @@
unsigned long long completedBytes, GNUNET_CronTime eta,
void *cls)
{
- FSUI_UnindexList *utc = cls;
- FSUI_Event event;
+ GNUNET_FSUI_UnindexList *utc = cls;
+ GNUNET_FSUI_Event event;
- event.type = FSUI_unindex_progress;
+ event.type = GNUNET_FSUI_unindex_progress;
event.data.UnindexProgress.uc.pos = utc;
event.data.UnindexProgress.uc.cctx = utc->cctx;
event.data.UnindexProgress.total = totalBytes;
@@ -56,8 +56,8 @@
static int
tt (void *cls)
{
- FSUI_UnindexList *utc = cls;
- if (utc->state != FSUI_ACTIVE)
+ GNUNET_FSUI_UnindexList *utc = cls;
+ if (utc->state != GNUNET_FSUI_ACTIVE)
return GNUNET_SYSERR;
return GNUNET_OK;
}
@@ -66,56 +66,56 @@
* Thread that does the unindex.
*/
void *
-FSUI_unindexThread (void *cls)
+GNUNET_FSUI_unindexThread (void *cls)
{
- FSUI_UnindexList *utc = cls;
- FSUI_Event event;
+ GNUNET_FSUI_UnindexList *utc = cls;
+ GNUNET_FSUI_Event event;
int ret;
unsigned long long size;
- struct GE_Memory *mem;
- struct GE_Context *ee;
+ struct GNUNET_GE_Memory *mem;
+ struct GNUNET_GE_Context *ee;
if (GNUNET_OK !=
GNUNET_disk_file_size (utc->ctx->ectx, utc->filename, &size,
GNUNET_YES))
{
- GE_BREAK (utc->ctx->ectx, 0);
+ GNUNET_GE_BREAK (utc->ctx->ectx, 0);
size = 0;
}
- mem = GE_memory_create (2);
+ mem = GNUNET_GE_memory_create (2);
ee =
- GE_create_context_memory (GE_USER | GE_ADMIN | GE_ERROR | GE_WARNING |
- GE_FATAL | GE_BULK | GE_IMMEDIATE, mem);
+ GNUNET_GE_create_context_memory (GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_ERROR | GNUNET_GE_WARNING |
+ GNUNET_GE_FATAL | GNUNET_GE_BULK |
GNUNET_GE_IMMEDIATE, mem);
ret =
- ECRS_unindexFile (ee, utc->ctx->cfg, utc->filename, &progressCallback,
+ GNUNET_ECRS_file_uninde (ee, utc->ctx->cfg, utc->filename,
&progressCallback,
utc, &tt, utc);
if (ret == GNUNET_OK)
{
- utc->state = FSUI_COMPLETED;
- event.type = FSUI_unindex_completed;
+ utc->state = GNUNET_FSUI_COMPLETED;
+ event.type = GNUNET_FSUI_unindex_completed;
event.data.UnindexCompleted.uc.pos = utc;
event.data.UnindexCompleted.uc.cctx = utc->cctx;
event.data.UnindexCompleted.total = size;
event.data.UnindexCompleted.filename = utc->filename;
utc->ctx->ecb (utc->ctx->ecbClosure, &event);
}
- else if (utc->state == FSUI_ACTIVE)
+ else if (utc->state == GNUNET_FSUI_ACTIVE)
{
const char *error;
- utc->state = FSUI_ERROR;
- event.type = FSUI_unindex_error;
+ utc->state = GNUNET_FSUI_ERROR;
+ event.type = GNUNET_FSUI_unindex_error;
event.data.UnindexError.uc.pos = utc;
event.data.UnindexError.uc.cctx = utc->cctx;
- error = GE_memory_get (mem, 0);
+ error = GNUNET_GE_memory_get (mem, 0);
if (error == NULL)
error = _("Unindexing failed (no reason given)");
event.data.UnindexError.message = error;
utc->ctx->ecb (utc->ctx->ecbClosure, &event);
}
- else if (utc->state == FSUI_ABORTED)
+ else if (utc->state == GNUNET_FSUI_ABORTED)
{
- event.type = FSUI_unindex_aborted;
+ event.type = GNUNET_FSUI_unindex_aborted;
event.data.UnindexAborted.uc.pos = utc;
event.data.UnindexAborted.uc.cctx = utc->cctx;
utc->ctx->ecb (utc->ctx->ecbClosure, &event);
@@ -123,15 +123,15 @@
else
{
/* must be suspending */
- GE_BREAK (NULL, utc->state == FSUI_PENDING);
+ GNUNET_GE_BREAK (NULL, utc->state == GNUNET_FSUI_PENDING);
}
#if 0
- GE_LOG (utc->ctx->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (utc->ctx->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"FSUI unindexThread exits in state %u.\n", utc->state);
#endif
- GE_free_context (ee);
- GE_memory_free (mem);
+ GNUNET_GE_free_context (ee);
+ GNUNET_GE_memory_free (mem);
return NULL;
}
@@ -139,26 +139,26 @@
* Thread that does the unindex.
*/
static void *
-FSUI_unindexThreadEvent (void *cls)
+GNUNET_FSUI_unindexThreadEvent (void *cls)
{
- FSUI_UnindexList *utc = cls;
- FSUI_Event event;
+ GNUNET_FSUI_UnindexList *utc = cls;
+ GNUNET_FSUI_Event event;
unsigned long long size;
if (GNUNET_OK !=
GNUNET_disk_file_size (utc->ctx->ectx, utc->filename, &size,
GNUNET_YES))
{
- GE_BREAK (utc->ctx->ectx, 0);
+ GNUNET_GE_BREAK (utc->ctx->ectx, 0);
size = 0;
}
- event.type = FSUI_unindex_started;
+ event.type = GNUNET_FSUI_unindex_started;
event.data.UnindexStarted.uc.pos = utc;
event.data.UnindexStarted.uc.cctx = NULL;
event.data.UnindexStarted.total = size;
event.data.UnindexStarted.filename = utc->filename;
utc->cctx = utc->ctx->ecb (utc->ctx->ecbClosure, &event);
- return FSUI_unindexThread (utc);
+ return GNUNET_FSUI_unindexThread (utc);
}
/**
@@ -171,32 +171,32 @@
* GNUNET_SYSERR if the file does not exist or gnunetd is not
* running
*/
-struct FSUI_UnindexList *
-FSUI_startUnindex (struct FSUI_Context *ctx, const char *filename)
+struct GNUNET_FSUI_UnindexList *
+GNUNET_FSUI_unindex_start (struct GNUNET_FSUI_Context *ctx, const char
*filename)
{
- FSUI_UnindexList *utc;
+ GNUNET_FSUI_UnindexList *utc;
if (GNUNET_YES == GNUNET_disk_directory_test (ctx->ectx, filename))
{
- GE_BREAK (ctx->ectx, 0);
+ GNUNET_GE_BREAK (ctx->ectx, 0);
return NULL;
}
if (GNUNET_YES != GNUNET_disk_file_test (ctx->ectx, filename))
{
- GE_BREAK (ctx->ectx, 0);
+ GNUNET_GE_BREAK (ctx->ectx, 0);
return NULL;
}
- utc = GNUNET_malloc (sizeof (FSUI_UnindexList));
+ utc = GNUNET_malloc (sizeof (GNUNET_FSUI_UnindexList));
utc->ctx = ctx;
utc->filename = GNUNET_strdup (filename);
utc->start_time = GNUNET_get_time ();
- utc->state = FSUI_ACTIVE;
+ utc->state = GNUNET_FSUI_ACTIVE;
utc->handle =
- GNUNET_thread_create (&FSUI_unindexThreadEvent, utc, 32 * 1024);
+ GNUNET_thread_create (&GNUNET_FSUI_unindexThreadEvent, utc, 32 * 1024);
if (utc->handle == NULL)
{
- GE_LOG_STRERROR (ctx->ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG_STRERROR (ctx->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE,
"PTHREAD_CREATE");
GNUNET_free (utc->filename);
GNUNET_free (utc);
@@ -216,18 +216,18 @@
* @return GNUNET_SYSERR if no such unindex is pending
*/
int
-FSUI_abortUnindex (struct FSUI_Context *ctx, struct FSUI_UnindexList *ul)
+GNUNET_FSUI_unindex_abort (struct GNUNET_FSUI_Context *ctx, struct
GNUNET_FSUI_UnindexList *ul)
{
- if ((ul->state != FSUI_ACTIVE) && (ul->state != FSUI_PENDING))
+ if ((ul->state != GNUNET_FSUI_ACTIVE) && (ul->state != GNUNET_FSUI_PENDING))
return GNUNET_NO;
- if (ul->state == FSUI_ACTIVE)
+ if (ul->state == GNUNET_FSUI_ACTIVE)
{
- ul->state = FSUI_ABORTED;
+ ul->state = GNUNET_FSUI_ABORTED;
GNUNET_thread_stop_sleep (ul->handle);
}
else
{
- ul->state = FSUI_ABORTED_JOINED;
+ ul->state = GNUNET_FSUI_ABORTED_JOINED;
}
return GNUNET_OK;
}
@@ -239,22 +239,22 @@
* @return GNUNET_SYSERR if no such unindex is pending
*/
int
-FSUI_stopUnindex (struct FSUI_Context *ctx, struct FSUI_UnindexList *dl)
+GNUNET_FSUI_unindex_stop (struct GNUNET_FSUI_Context *ctx, struct
GNUNET_FSUI_UnindexList *dl)
{
- FSUI_UnindexList *prev;
- struct GE_Context *ectx;
+ GNUNET_FSUI_UnindexList *prev;
+ struct GNUNET_GE_Context *ectx;
void *unused;
- FSUI_Event event;
+ GNUNET_FSUI_Event event;
ectx = ctx->ectx;
if (dl == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
#if 0
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER, "FSUI_stopUnindex called.\n");
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"GNUNET_FSUI_stopUnindex called.\n");
#endif
GNUNET_mutex_lock (ctx->lock);
prev = ctx->unindexOperations;
@@ -263,9 +263,9 @@
if (prev == NULL)
{
GNUNET_mutex_unlock (ctx->lock);
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
- "FSUI_stopUnindex failed to locate deletion operation.\n");
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
+ "GNUNET_FSUI_stopUnindex failed to locate deletion
operation.\n");
return GNUNET_SYSERR;
}
if (prev == dl)
@@ -277,23 +277,23 @@
prev->next = dl->next;
}
GNUNET_mutex_unlock (ctx->lock);
- if ((dl->state == FSUI_ACTIVE) ||
- (dl->state == FSUI_COMPLETED) ||
- (dl->state == FSUI_ABORTED) || (dl->state == FSUI_ERROR))
+ if ((dl->state == GNUNET_FSUI_ACTIVE) ||
+ (dl->state == GNUNET_FSUI_COMPLETED) ||
+ (dl->state == GNUNET_FSUI_ABORTED) || (dl->state == GNUNET_FSUI_ERROR))
{
- GE_ASSERT (ctx->ectx, dl->handle != NULL);
+ GNUNET_GE_ASSERT (ctx->ectx, dl->handle != NULL);
GNUNET_thread_join (dl->handle, &unused);
dl->handle = NULL;
- if (dl->state == FSUI_ACTIVE)
- dl->state = FSUI_PENDING;
+ if (dl->state == GNUNET_FSUI_ACTIVE)
+ dl->state = GNUNET_FSUI_PENDING;
else
dl->state++; /* add _JOINED */
}
else
{
- GE_ASSERT (ctx->ectx, dl->handle == NULL);
+ GNUNET_GE_ASSERT (ctx->ectx, dl->handle == NULL);
}
- event.type = FSUI_unindex_stopped;
+ event.type = GNUNET_FSUI_unindex_stopped;
event.data.UnindexStopped.uc.pos = dl;
event.data.UnindexStopped.uc.cctx = dl->cctx;
dl->ctx->ecb (dl->ctx->ecbClosure, &event);
Modified: GNUnet/src/applications/fs/fsui/upload.c
===================================================================
--- GNUnet/src/applications/fs/fsui/upload.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/fsui/upload.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -48,19 +48,19 @@
unsigned long long completedBytes, GNUNET_CronTime eta,
void *ptr, int direct, int add, int unaccounted)
{
- FSUI_UploadList *utc = ptr;
- FSUI_Event event;
+ GNUNET_FSUI_UploadList *utc = ptr;
+ GNUNET_FSUI_Event event;
unsigned long long subtotal;
- FSUI_UploadList *pos;
+ GNUNET_FSUI_UploadList *pos;
GNUNET_CronTime xeta;
GNUNET_CronTime now;
- event.type = FSUI_upload_progress;
+ event.type = GNUNET_FSUI_upload_progress;
event.data.UploadProgress.uc.pos = utc;
event.data.UploadProgress.uc.cctx = utc->cctx;
event.data.UploadProgress.uc.ppos = utc->parent;
event.data.UploadProgress.uc.pcctx = utc->parent->cctx;
- if (GNUNET_YES == ECRS_isDirectory (utc->meta))
+ if (GNUNET_YES == GNUNET_ECRS_meta_data_test_for_directory (utc->meta))
{
if (direct == GNUNET_YES)
unaccounted = GNUNET_YES;
@@ -77,7 +77,7 @@
}
else
{
- GE_ASSERT (NULL, totalBytes == completedBytes);
+ GNUNET_GE_ASSERT (NULL, totalBytes == completedBytes);
event.data.UploadProgress.completed =
completedBytes + utc->completed;
event.data.UploadProgress.total = totalBytes + utc->total;
@@ -133,8 +133,8 @@
static int
testTerminate (void *cls)
{
- FSUI_UploadList *utc = cls;
- if (utc->state != FSUI_ACTIVE)
+ GNUNET_FSUI_UploadList *utc = cls;
+ if (utc->state != GNUNET_FSUI_ACTIVE)
return GNUNET_SYSERR;
return GNUNET_OK;
}
@@ -144,22 +144,22 @@
* a directory, upload it and store the uri in *uri.
*/
static char *
-createDirectoryHelper (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- struct FSUI_UploadList *children,
- struct ECRS_MetaData *meta, char **error)
+createDirectoryHelper (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_FSUI_UploadList *children,
+ struct GNUNET_ECRS_MetaData *meta, char **error)
{
- ECRS_FileInfo *fis;
+ GNUNET_ECRS_FileInfo *fis;
unsigned int count;
unsigned int size;
char *data;
unsigned long long len;
int ret;
char *tempName;
- struct FSUI_UploadList *pos;
+ struct GNUNET_FSUI_UploadList *pos;
int handle;
- struct GE_Memory *mem;
- struct GE_Context *ee;
+ struct GNUNET_GE_Memory *mem;
+ struct GNUNET_GE_Context *ee;
fis = NULL;
size = 0;
@@ -184,54 +184,54 @@
}
pos = pos->next;
}
- GE_BREAK (ectx, count == size);
- mem = GE_memory_create (2);
+ GNUNET_GE_BREAK (ectx, count == size);
+ mem = GNUNET_GE_memory_create (2);
ee =
- GE_create_context_memory (GE_USER | GE_ADMIN | GE_ERROR | GE_WARNING |
- GE_FATAL | GE_BULK | GE_IMMEDIATE, mem);
- ret = ECRS_createDirectory (ee, &data, &len, size, fis, meta);
+ GNUNET_GE_create_context_memory (GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_ERROR | GNUNET_GE_WARNING |
+ GNUNET_GE_FATAL | GNUNET_GE_BULK |
GNUNET_GE_IMMEDIATE, mem);
+ ret = GNUNET_ECRS_directory_create (ee, &data, &len, size, fis, meta);
GNUNET_array_grow (fis, size, 0);
if (ret != GNUNET_OK)
{
- *error = GNUNET_strdup (GE_memory_get (mem, 0));
- GE_free_context (ee);
- GE_memory_free (mem);
+ *error = GNUNET_strdup (GNUNET_GE_memory_get (mem, 0));
+ GNUNET_GE_free_context (ee);
+ GNUNET_GE_memory_free (mem);
return NULL;
}
pos = children;
while (pos != NULL)
{
if (pos->uri != NULL)
- URITRACK_addState (ectx, cfg, pos->uri, URITRACK_DIRECTORY_ADDED);
+ GNUNET_URITRACK_add_state (ectx, cfg, pos->uri,
GNUNET_URITRACK_DIRECTORY_ADDED);
pos = pos->next;
}
- GE_memory_reset (mem);
+ GNUNET_GE_memory_reset (mem);
tempName = GNUNET_strdup ("/tmp/gnunet-upload-dir.XXXXXX");
handle = mkstemp (tempName);
if (handle == -1)
{
- GE_LOG_STRERROR_FILE (ee,
- GE_ERROR | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ee,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_BULK,
"mkstemp", tempName);
GNUNET_free (tempName);
GNUNET_free (data);
- *error = GNUNET_strdup (GE_memory_get (mem, 0));
- GE_free_context (ee);
- GE_memory_free (mem);
+ *error = GNUNET_strdup (GNUNET_GE_memory_get (mem, 0));
+ GNUNET_GE_free_context (ee);
+ GNUNET_GE_memory_free (mem);
return NULL;
}
if (len != WRITE (handle, data, len))
{
- GE_LOG_STRERROR_FILE (ee,
- GE_ERROR | GE_USER | GE_BULK, "write", tempName);
- *error = GNUNET_strdup (GE_memory_get (mem, 0));
- GE_free_context (ee);
- GE_memory_free (mem);
+ GNUNET_GE_LOG_STRERROR_FILE (ee,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_BULK,
"write", tempName);
+ *error = GNUNET_strdup (GNUNET_GE_memory_get (mem, 0));
+ GNUNET_GE_free_context (ee);
+ GNUNET_GE_memory_free (mem);
GNUNET_free (data);
return NULL;
}
- GE_free_context (ee);
- GE_memory_free (mem);
+ GNUNET_GE_free_context (ee);
+ GNUNET_GE_memory_free (mem);
CLOSE (handle);
GNUNET_free (data);
return tempName;
@@ -241,12 +241,12 @@
* Signal upload error to client.
*/
static void
-signalError (FSUI_UploadList * utc, const char *message)
+signalError (GNUNET_FSUI_UploadList * utc, const char *message)
{
- FSUI_Event event;
+ GNUNET_FSUI_Event event;
- utc->state = FSUI_ERROR;
- event.type = FSUI_upload_error;
+ utc->state = GNUNET_FSUI_ERROR;
+ event.type = GNUNET_FSUI_upload_error;
event.data.UploadError.uc.pos = utc;
event.data.UploadError.uc.cctx = utc->cctx;
event.data.UploadError.uc.ppos = utc->parent;
@@ -256,13 +256,13 @@
}
static void
-signalUploadStarted (struct FSUI_UploadList *utc, int first_only)
+signalUploadStarted (struct GNUNET_FSUI_UploadList *utc, int first_only)
{
- FSUI_Event event;
+ GNUNET_FSUI_Event event;
while (utc != NULL)
{
- event.type = FSUI_upload_started;
+ event.type = GNUNET_FSUI_upload_started;
event.data.UploadStarted.uc.pos = utc;
event.data.UploadStarted.uc.cctx = utc->cctx;
event.data.UploadStarted.uc.ppos = utc->parent;
@@ -283,34 +283,34 @@
* Thread that does the upload.
*/
void *
-FSUI_uploadThread (void *cls)
+GNUNET_FSUI_uploadThread (void *cls)
{
- FSUI_UploadList *utc = cls;
- FSUI_UploadList *cpos;
- FSUI_Event event;
- ECRS_FileInfo fi;
+ GNUNET_FSUI_UploadList *utc = cls;
+ GNUNET_FSUI_UploadList *cpos;
+ GNUNET_FSUI_Event event;
+ GNUNET_ECRS_FileInfo fi;
int ret;
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
char *filename;
char *pfn;
- struct ECRS_URI *uri;
- struct ECRS_URI *loc;
+ struct GNUNET_ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *loc;
size_t tpos;
char *error;
- struct GE_Memory *mem;
- struct GE_Context *ee;
+ struct GNUNET_GE_Memory *mem;
+ struct GNUNET_GE_Context *ee;
ectx = utc->shared->ctx->ectx;
- GE_ASSERT (ectx, utc->filename != NULL);
+ GNUNET_GE_ASSERT (ectx, utc->filename != NULL);
cpos = utc->child;
while (cpos != NULL)
{
- if (cpos->state == FSUI_ACTIVE)
- FSUI_uploadThread (cpos);
+ if (cpos->state == GNUNET_FSUI_ACTIVE)
+ GNUNET_FSUI_uploadThread (cpos);
cpos = cpos->next;
}
- if (utc->state != FSUI_ACTIVE)
+ if (utc->state != GNUNET_FSUI_ACTIVE)
return NULL; /* aborted or suspended */
if (GNUNET_YES == GNUNET_disk_directory_test (ectx, utc->filename))
{
@@ -333,12 +333,12 @@
filename = GNUNET_strdup (utc->filename);
}
utc->start_time = GNUNET_get_time ();
- mem = GE_memory_create (2);
+ mem = GNUNET_GE_memory_create (2);
ee =
- GE_create_context_memory (GE_USER | GE_ADMIN | GE_ERROR | GE_WARNING |
- GE_FATAL | GE_BULK | GE_IMMEDIATE, mem);
+ GNUNET_GE_create_context_memory (GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_ERROR | GNUNET_GE_WARNING |
+ GNUNET_GE_FATAL | GNUNET_GE_BULK |
GNUNET_GE_IMMEDIATE, mem);
ret =
- ECRS_uploadFile (ee, utc->shared->ctx->cfg, filename,
+ GNUNET_ECRS_file_upload (ee, utc->shared->ctx->cfg, filename,
utc->shared->doIndex == GNUNET_YES ? (utc->child ==
NULL ? GNUNET_YES :
GNUNET_NO) :
@@ -347,16 +347,16 @@
&progressCallback, utc, &testTerminate, utc, &utc->uri);
if (ret != GNUNET_OK)
{
- if (utc->state == FSUI_ACTIVE)
+ if (utc->state == GNUNET_FSUI_ACTIVE)
{
const char *err;
- err = GE_memory_get (mem, 0);
+ err = GNUNET_GE_memory_get (mem, 0);
signalError (utc, err ? err : "");
}
- else if (utc->state == FSUI_ABORTED)
+ else if (utc->state == GNUNET_FSUI_ABORTED)
{
- event.type = FSUI_upload_aborted;
+ event.type = GNUNET_FSUI_upload_aborted;
event.data.UploadAborted.uc.pos = utc;
event.data.UploadAborted.uc.cctx = utc->cctx;
event.data.UploadAborted.uc.ppos = utc->parent;
@@ -366,21 +366,21 @@
else
{
/* must be suspended */
- GE_BREAK (NULL, utc->state == FSUI_PENDING);
+ GNUNET_GE_BREAK (NULL, utc->state == GNUNET_FSUI_PENDING);
}
if (utc->child != NULL)
UNLINK (filename);
GNUNET_free (filename);
- GE_free_context (ee);
- GE_memory_free (mem);
+ GNUNET_GE_free_context (ee);
+ GNUNET_GE_memory_free (mem);
return NULL;
}
- utc->state = FSUI_COMPLETED;
+ utc->state = GNUNET_FSUI_COMPLETED;
if (utc->child == NULL)
- ECRS_extractMetaData (utc->shared->ctx->ectx,
+ GNUNET_ECRS_meta_data_extract_from_file (utc->shared->ctx->ectx,
utc->meta, utc->filename, utc->shared->extractors);
while (GNUNET_OK ==
- ECRS_delFromMetaData (utc->meta, EXTRACTOR_FILENAME, NULL));
+ GNUNET_ECRS_meta_data_delete (utc->meta, EXTRACTOR_FILENAME, NULL));
/* only publish the last part of the path
-- we do not want to publish $HOME or similar
trivially deanonymizing information */
@@ -394,7 +394,7 @@
if ((utc->child != NULL) &&
((strlen (pfn) == 0) || (pfn[strlen (pfn) - 1] != DIR_SEPARATOR)))
strcat (pfn, DIR_SEPARATOR_STR);
- ECRS_addToMetaData (utc->meta, EXTRACTOR_FILENAME, pfn);
+ GNUNET_ECRS_meta_data_inser (utc->meta, EXTRACTOR_FILENAME, pfn);
GNUNET_free (pfn);
if ((utc->shared->anonymityLevel == 0)
&& (utc->shared->doIndex == GNUNET_YES))
@@ -408,10 +408,10 @@
if (GNUNET_OK == GNUNET_IDENTITY_get_self (sock, &hello))
{
- loc = ECRS_uriFromLocation (utc->uri,
+ loc = GNUNET_ECRS_location_to_uri (utc->uri,
&hello->publicKey,
ntohl (hello->expirationTime),
- (ECRS_SignFunction) &
+ (GNUNET_ECRS_SignFunction) &
GNUNET_IDENTITY_sign_function, sock);
GNUNET_free (hello);
@@ -419,7 +419,7 @@
else
{
/* may happen if no transports are available... */
- loc = ECRS_dupUri (utc->uri);
+ loc = GNUNET_ECRS_uri_duplicate (utc->uri);
}
GNUNET_client_connection_destroy (sock);
}
@@ -427,17 +427,17 @@
{
/* no location URI, use standard URI
(copied here to allow free later) */
- loc = ECRS_dupUri (utc->uri);
+ loc = GNUNET_ECRS_uri_duplicate (utc->uri);
}
if (utc->shared->global_keywords != NULL)
- ECRS_addToKeyspace (ectx,
+ GNUNET_ECRS_publish_under_keyword (ectx,
utc->shared->ctx->cfg,
utc->shared->global_keywords,
utc->shared->anonymityLevel,
utc->shared->priority,
utc->shared->expiration, loc, utc->meta);
if (utc->keywords != NULL)
- ECRS_addToKeyspace (ectx,
+ GNUNET_ECRS_publish_under_keyword (ectx,
utc->shared->ctx->cfg,
utc->keywords,
utc->shared->anonymityLevel,
@@ -445,28 +445,28 @@
utc->shared->expiration, loc, utc->meta);
if (utc->shared->individualKeywords == GNUNET_YES)
{
- uri = ECRS_metaDataToUri (utc->meta);
- ECRS_addToKeyspace (ectx,
+ uri = GNUNET_ECRS_meta_data_to_uri (utc->meta);
+ GNUNET_ECRS_publish_under_keyword (ectx,
utc->shared->ctx->cfg,
uri,
utc->shared->anonymityLevel,
utc->shared->priority,
utc->shared->expiration, loc, utc->meta);
- ECRS_freeUri (uri);
+ GNUNET_ECRS_uri_destroy (uri);
}
- ECRS_freeUri (loc);
+ GNUNET_ECRS_uri_destroy (loc);
loc = NULL;
while (GNUNET_OK ==
- ECRS_delFromMetaData (utc->meta, EXTRACTOR_SPLIT, NULL));
+ GNUNET_ECRS_meta_data_delete (utc->meta, EXTRACTOR_SPLIT, NULL));
fi.meta = utc->meta;
fi.uri = utc->uri;
- URITRACK_trackURI (ectx, utc->shared->ctx->cfg, &fi);
- URITRACK_addState (ectx,
+ GNUNET_URITRACK_track (ectx, utc->shared->ctx->cfg, &fi);
+ GNUNET_URITRACK_add_state (ectx,
utc->shared->ctx->cfg,
utc->uri,
utc->shared->doIndex ==
- GNUNET_YES ? URITRACK_INDEXED : URITRACK_INSERTED);
- event.type = FSUI_upload_completed;
+ GNUNET_YES ? GNUNET_URITRACK_INDEXED :
GNUNET_URITRACK_INSERTED);
+ event.type = GNUNET_FSUI_upload_completed;
event.data.UploadCompleted.uc.pos = utc;
event.data.UploadCompleted.uc.cctx = utc->cctx;
event.data.UploadCompleted.uc.ppos = utc->parent;
@@ -478,8 +478,8 @@
if (utc->child != NULL)
UNLINK (filename);
GNUNET_free (filename);
- GE_free_context (ee);
- GE_memory_free (mem);
+ GNUNET_GE_free_context (ee);
+ GNUNET_GE_memory_free (mem);
return NULL;
}
@@ -487,24 +487,24 @@
* Thread that does the upload.
*/
static void *
-FSUI_uploadThreadEvent (void *cls)
+GNUNET_FSUI_uploadThreadEvent (void *cls)
{
- FSUI_UploadList *utc = cls;
+ GNUNET_FSUI_UploadList *utc = cls;
if (utc->parent == &utc->shared->ctx->activeUploads)
{
/* top-level call: signal client! */
signalUploadStarted (utc, 1);
}
- return FSUI_uploadThread (utc);
+ return GNUNET_FSUI_uploadThread (utc);
}
static void
-freeUploadList (struct FSUI_UploadList *ul)
+freeUploadList (struct GNUNET_FSUI_UploadList *ul)
{
- struct FSUI_UploadList *next;
- struct FSUI_Context *ctx;
+ struct GNUNET_FSUI_UploadList *next;
+ struct GNUNET_FSUI_Context *ctx;
ctx = ul->shared->ctx;
while (ul->child != NULL)
@@ -512,16 +512,16 @@
GNUNET_mutex_lock (ctx->lock);
GNUNET_free (ul->filename);
if (ul->keywords != NULL)
- ECRS_freeUri (ul->keywords);
+ GNUNET_ECRS_uri_destroy (ul->keywords);
if (ul->uri != NULL)
- ECRS_freeUri (ul->uri);
+ GNUNET_ECRS_uri_destroy (ul->uri);
if (ul->meta != NULL)
- ECRS_freeMetaData (ul->meta);
+ GNUNET_ECRS_meta_data_destroy (ul->meta);
/* unlink from parent */
next = ul->parent->child;
if (next == NULL)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
GNUNET_mutex_unlock (ctx->lock);
return;
}
@@ -536,7 +536,7 @@
next = next->next;
if (next == NULL)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
GNUNET_mutex_unlock (ctx->lock);
return;
}
@@ -547,43 +547,43 @@
GNUNET_mutex_unlock (ctx->lock);
}
-static struct FSUI_UploadList *addUploads (struct FSUI_UploadShared *shared,
+static struct GNUNET_FSUI_UploadList *addUploads (struct
GNUNET_FSUI_UploadShared *shared,
const char *filename,
- const struct ECRS_URI *keywords,
- const struct ECRS_MetaData *md,
- struct FSUI_UploadList *parent);
+ const struct GNUNET_ECRS_URI
*keywords,
+ const struct GNUNET_ECRS_MetaData
*md,
+ struct GNUNET_FSUI_UploadList
*parent);
static int
addChildUpload (const char *name, const char *dirName, void *data)
{
- struct FSUI_UploadList *parent = data;
+ struct GNUNET_FSUI_UploadList *parent = data;
char *filename;
- struct FSUI_UploadList *child;
- struct ECRS_MetaData *md;
+ struct GNUNET_FSUI_UploadList *child;
+ struct GNUNET_ECRS_MetaData *md;
filename = GNUNET_malloc (strlen (dirName) + strlen (name) + 2);
strcpy (filename, dirName);
strcat (filename, DIR_SEPARATOR_STR);
strcat (filename, name);
- md = ECRS_createMetaData ();
+ md = GNUNET_ECRS_meta_data_create ();
child = addUploads (parent->shared, filename, NULL, md, parent);
GNUNET_free (filename);
- ECRS_freeMetaData (md);
+ GNUNET_ECRS_meta_data_destroy (md);
if (child == NULL)
return GNUNET_SYSERR;
parent->total += child->total;
return GNUNET_OK;
}
-static struct FSUI_UploadList *
-addUploads (struct FSUI_UploadShared *shared,
+static struct GNUNET_FSUI_UploadList *
+addUploads (struct GNUNET_FSUI_UploadShared *shared,
const char *filename,
- const struct ECRS_URI *keywords,
- const struct ECRS_MetaData *md, struct FSUI_UploadList *parent)
+ const struct GNUNET_ECRS_URI *keywords,
+ const struct GNUNET_ECRS_MetaData *md, struct
GNUNET_FSUI_UploadList *parent)
{
- FSUI_UploadList *utc;
+ GNUNET_FSUI_UploadList *utc;
- utc = GNUNET_malloc (sizeof (FSUI_UploadList));
+ utc = GNUNET_malloc (sizeof (GNUNET_FSUI_UploadList));
utc->completed = 0;
utc->total = 0; /* to be set later */
utc->start_time = GNUNET_get_time ();
@@ -593,7 +593,7 @@
utc->parent = parent;
utc->uri = NULL;
utc->cctx = NULL; /* to be set later */
- utc->state = FSUI_ACTIVE;
+ utc->state = GNUNET_FSUI_ACTIVE;
if (GNUNET_YES == GNUNET_disk_file_test (shared->ctx->ectx, filename))
{
/* add this file */
@@ -604,7 +604,7 @@
GNUNET_free (utc);
return NULL;
}
- utc->meta = ECRS_dupMetaData (md);
+ utc->meta = GNUNET_ECRS_meta_data_duplicate (md);
}
else
{
@@ -617,12 +617,12 @@
GNUNET_free (utc);
return NULL;
}
- utc->meta = ECRS_dupMetaData (md);
- ECRS_addToMetaData (utc->meta,
+ utc->meta = GNUNET_ECRS_meta_data_duplicate (md);
+ GNUNET_ECRS_meta_data_inser (utc->meta,
EXTRACTOR_MIMETYPE, GNUNET_DIRECTORY_MIME);
}
if (keywords != NULL)
- utc->keywords = ECRS_dupUri (keywords);
+ utc->keywords = GNUNET_ECRS_uri_duplicate (keywords);
else
utc->keywords = NULL;
utc->filename = GNUNET_strdup (filename);
@@ -636,14 +636,14 @@
}
static void
-signalUploadStopped (struct FSUI_UploadList *ul, int first_only)
+signalUploadStopped (struct GNUNET_FSUI_UploadList *ul, int first_only)
{
- FSUI_Event event;
+ GNUNET_FSUI_Event event;
while (ul != NULL)
{
signalUploadStopped (ul->child, 0);
- event.type = FSUI_upload_stopped;
+ event.type = GNUNET_FSUI_upload_stopped;
event.data.UploadStopped.uc.pos = ul;
event.data.UploadStopped.uc.cctx = ul->cctx;
event.data.UploadStopped.uc.ppos = ul->parent;
@@ -656,10 +656,10 @@
}
static void
-freeShared (struct FSUI_UploadShared *shared)
+freeShared (struct GNUNET_FSUI_UploadShared *shared)
{
if (shared->global_keywords != NULL)
- ECRS_freeUri (shared->global_keywords);
+ GNUNET_ECRS_uri_destroy (shared->global_keywords);
EXTRACTOR_removeAll (shared->extractors);
GNUNET_free_non_null (shared->extractor_config);
GNUNET_free (shared);
@@ -675,10 +675,10 @@
* GNUNET_SYSERR if the file does not exist or gnunetd is not
* running
*/
-struct FSUI_UploadList *
-FSUI_startUpload (struct FSUI_Context *ctx,
+struct GNUNET_FSUI_UploadList *
+GNUNET_FSUI_upload_star (struct GNUNET_FSUI_Context *ctx,
const char *filename,
- DirectoryScanCallback dsc,
+ GNUNET_FSUI_DirectoryScanCallback dsc,
void *dscClosure,
unsigned int anonymityLevel,
unsigned int priority,
@@ -686,23 +686,23 @@
int doExtract,
int individualKeywords,
GNUNET_CronTime expiration,
- const struct ECRS_MetaData *md,
- const struct ECRS_URI *globalURI,
- const struct ECRS_URI *keyUri)
+ const struct GNUNET_ECRS_MetaData *md,
+ const struct GNUNET_ECRS_URI *globalURI,
+ const struct GNUNET_ECRS_URI *keyUri)
{
char *config;
EXTRACTOR_ExtractorList *extractors;
- struct FSUI_UploadShared *shared;
- struct FSUI_UploadList *ul;
+ struct GNUNET_FSUI_UploadShared *shared;
+ struct GNUNET_FSUI_UploadList *ul;
config = NULL;
extractors = NULL;
if (doExtract)
{
extractors = EXTRACTOR_loadDefaultLibraries ();
- if (GC_have_configuration_value (ctx->cfg, "FS", "EXTRACTORS"))
+ if (GNUNET_GC_have_configuration_value (ctx->cfg, "FS", "EXTRACTORS"))
{
- GC_get_configuration_value_string (ctx->cfg,
+ GNUNET_GC_get_configuration_value_string (ctx->cfg,
"FS",
"EXTRACTORS", NULL, &config);
if (config != NULL)
@@ -711,7 +711,7 @@
}
}
}
- shared = GNUNET_malloc (sizeof (FSUI_UploadShared));
+ shared = GNUNET_malloc (sizeof (GNUNET_FSUI_UploadShared));
shared->dsc = dsc;
shared->dscClosure = dscClosure;
shared->extractors = extractors;
@@ -719,7 +719,7 @@
shared->ctx = ctx;
shared->handle = NULL;
shared->global_keywords =
- globalURI != NULL ? ECRS_dupUri (globalURI) : NULL;
+ globalURI != NULL ? GNUNET_ECRS_uri_duplicate (globalURI) : NULL;
shared->extractor_config = config;
shared->doIndex = doIndex;
shared->anonymityLevel = anonymityLevel;
@@ -733,16 +733,16 @@
return NULL;
}
shared->handle =
- GNUNET_thread_create (&FSUI_uploadThreadEvent, ul, 128 * 1024);
+ GNUNET_thread_create (&GNUNET_FSUI_uploadThreadEvent, ul, 128 * 1024);
if (shared->handle == NULL)
{
- GE_LOG_STRERROR (ctx->ectx,
- GE_ERROR | GE_USER | GE_BULK, "PTHREAD_CREATE");
+ GNUNET_GE_LOG_STRERROR (ctx->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_BULK,
"PTHREAD_CREATE");
freeUploadList (ul);
freeShared (shared);
return NULL;
}
- GE_ASSERT (ctx->ectx, ul->shared == shared);
+ GNUNET_GE_ASSERT (ctx->ectx, ul->shared == shared);
return ul;
}
@@ -756,31 +756,31 @@
* @return GNUNET_SYSERR on error
*/
int
-FSUI_abortUpload (struct FSUI_Context *ctx, struct FSUI_UploadList *ul)
+GNUNET_FSUI_upload_abort (struct GNUNET_FSUI_Context *ctx, struct
GNUNET_FSUI_UploadList *ul)
{
- FSUI_UploadList *c;
+ GNUNET_FSUI_UploadList *c;
- GE_ASSERT (ctx->ectx, ul != NULL);
- if ((ul->state != FSUI_ACTIVE) && (ul->state != FSUI_PENDING))
+ GNUNET_GE_ASSERT (ctx->ectx, ul != NULL);
+ if ((ul->state != GNUNET_FSUI_ACTIVE) && (ul->state != GNUNET_FSUI_PENDING))
return GNUNET_NO;
- if (ul->state == FSUI_ACTIVE)
+ if (ul->state == GNUNET_FSUI_ACTIVE)
{
- ul->state = FSUI_ABORTED;
+ ul->state = GNUNET_FSUI_ABORTED;
c = ul->child;
while (c != NULL)
{
- FSUI_abortUpload (ctx, c);
+ GNUNET_FSUI_upload_abort (ctx, c);
c = c->next;
}
GNUNET_thread_stop_sleep (ul->shared->handle);
}
else
{
- ul->state = FSUI_ABORTED_JOINED;
+ ul->state = GNUNET_FSUI_ABORTED_JOINED;
c = ul->child;
while (c != NULL)
{
- FSUI_abortUpload (ctx, c);
+ GNUNET_FSUI_upload_abort (ctx, c);
c = c->next;
}
}
@@ -794,28 +794,28 @@
* @return GNUNET_SYSERR on error
*/
int
-FSUI_stopUpload (struct FSUI_Context *ctx, struct FSUI_UploadList *ul)
+GNUNET_FSUI_upload_stop (struct GNUNET_FSUI_Context *ctx, struct
GNUNET_FSUI_UploadList *ul)
{
void *unused;
- struct FSUI_UploadShared *shared;
+ struct GNUNET_FSUI_UploadShared *shared;
- GE_ASSERT (ctx->ectx, ul != NULL);
- GE_ASSERT (ctx->ectx, ul->parent == &ctx->activeUploads);
- if ((ul->state == FSUI_ACTIVE) ||
- (ul->state == FSUI_COMPLETED) ||
- (ul->state == FSUI_ABORTED) || (ul->state == FSUI_ERROR))
+ GNUNET_GE_ASSERT (ctx->ectx, ul != NULL);
+ GNUNET_GE_ASSERT (ctx->ectx, ul->parent == &ctx->activeUploads);
+ if ((ul->state == GNUNET_FSUI_ACTIVE) ||
+ (ul->state == GNUNET_FSUI_COMPLETED) ||
+ (ul->state == GNUNET_FSUI_ABORTED) || (ul->state == GNUNET_FSUI_ERROR))
{
- GE_ASSERT (ctx->ectx, ul->shared->handle != NULL);
+ GNUNET_GE_ASSERT (ctx->ectx, ul->shared->handle != NULL);
GNUNET_thread_join (ul->shared->handle, &unused);
ul->shared->handle = NULL;
- if (ul->state == FSUI_ACTIVE)
- ul->state = FSUI_PENDING;
+ if (ul->state == GNUNET_FSUI_ACTIVE)
+ ul->state = GNUNET_FSUI_PENDING;
else
ul->state++; /* add _JOINED */
}
else
{
- GE_ASSERT (ctx->ectx, ul->shared->handle == NULL);
+ GNUNET_GE_ASSERT (ctx->ectx, ul->shared->handle == NULL);
}
signalUploadStopped (ul, 1);
shared = ul->shared;
Modified: GNUnet/src/applications/fs/lib/fslib.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslib.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/lib/fslib.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -32,17 +32,17 @@
#define DEBUG_FSLIB GNUNET_NO
-typedef struct FS_SEARCH_HANDLE
+typedef struct GNUNET_FS_SearchHandle
{
CS_fs_request_search_MESSAGE *req;
- Datum_Iterator callback;
+ GNUNET_DatastoreValueIterator callback;
void *closure;
} SEARCH_HANDLE;
-typedef struct FS_SEARCH_CONTEXT
+typedef struct GNUNET_FS_SearchContext
{
- struct GC_Configuration *cfg;
- struct GE_Context *ectx;
+ struct GNUNET_GC_Configuration *cfg;
+ struct GNUNET_GE_Context *ectx;
struct GNUNET_ClientServerConnection *sock;
struct GNUNET_ThreadHandle *thread;
struct GNUNET_Mutex *lock;
@@ -81,8 +81,8 @@
if (GNUNET_OK == GNUNET_client_connection_read (ctx->sock, &hdr))
{
#if DEBUG_FSLIB
- GE_LOG (ctx->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ctx->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"FSLIB: received message from gnunetd\n");
#endif
delay = 100 * GNUNET_CRON_MILLISECONDS;
@@ -90,9 +90,9 @@
signal protocol problem; if ok, find
matching callback, call on value */
if ((ntohs (hdr->size) < sizeof (CS_fs_reply_content_MESSAGE)) ||
- (ntohs (hdr->type) != CS_PROTO_gap_RESULT))
+ (ntohs (hdr->type) != GNUNET_CS_PROTO_GAP_RESULT))
{
- GE_BREAK (ctx->ectx, 0);
+ GNUNET_GE_BREAK (ctx->ectx, 0);
GNUNET_free (hdr);
continue;
}
@@ -101,7 +101,7 @@
if (GNUNET_OK != getQueryFor (size, (DBlock *) & rep[1], GNUNET_NO,
/* gnunetd will have checked already */
&query))
{
- GE_BREAK (ctx->ectx, 0);
+ GNUNET_GE_BREAK (ctx->ectx, 0);
GNUNET_free (hdr);
continue;
}
@@ -113,13 +113,13 @@
memcmp (&query, &ctx->handles[i]->req->query[0],
sizeof (GNUNET_HashCode)))
{
- Datastore_Value *value;
+ GNUNET_DatastoreValue *value;
matched++;
if (ctx->handles[i]->callback != NULL)
{
- value = GNUNET_malloc (sizeof (Datastore_Value) + size);
- value->size = htonl (size + sizeof (Datastore_Value));
+ value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) +
size);
+ value->size = htonl (size + sizeof
(GNUNET_DatastoreValue));
value->type = htonl (getTypeOfBlock (size,
(DBlock *) &
rep[1]));
@@ -144,16 +144,16 @@
GNUNET_mutex_unlock (ctx->lock);
#if DEBUG_FSLIB
if (matched == 0)
- GE_LOG (ctx->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ctx->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"FSLIB: received content but have no pending request\n");
#endif
}
else
{
#if DEBUG_FSLIB
- GE_LOG (ctx->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ctx->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"FSLIB: error communicating with gnunetd; sleeping for
%ums\n",
delay);
#endif
@@ -169,13 +169,13 @@
}
SEARCH_CONTEXT *
-FS_SEARCH_makeContext (struct GE_Context * ectx,
- struct GC_Configuration * cfg,
+GNUNET_FS_create_search_context (struct GNUNET_GE_Context * ectx,
+ struct GNUNET_GC_Configuration * cfg,
struct GNUNET_Mutex * lock)
{
SEARCH_CONTEXT *ret;
- GE_ASSERT (ectx, lock != NULL);
+ GNUNET_GE_ASSERT (ectx, lock != NULL);
ret = GNUNET_malloc (sizeof (SEARCH_CONTEXT));
ret->ectx = ectx;
ret->cfg = cfg;
@@ -192,17 +192,17 @@
ret->abort = GNUNET_NO;
ret->thread = GNUNET_thread_create (&processReplies, ret, 128 * 1024);
if (ret->thread == NULL)
- GE_DIE_STRERROR (ectx, GE_FATAL | GE_ADMIN | GE_BULK, "PTHREAD_CREATE");
+ GNUNET_GE_DIE_STRERROR (ectx, GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "PTHREAD_CREATE");
return ret;
}
void
-FS_SEARCH_destroyContext (struct FS_SEARCH_CONTEXT *ctx)
+GNUNET_FS_destroy_search_context (struct GNUNET_FS_SearchContext *ctx)
{
void *unused;
GNUNET_mutex_lock (ctx->lock);
- GE_ASSERT (ctx->ectx, ctx->handleCount == 0);
+ GNUNET_GE_ASSERT (ctx->ectx, ctx->handleCount == 0);
ctx->abort = GNUNET_YES;
GNUNET_client_connection_close_forever (ctx->sock);
GNUNET_mutex_unlock (ctx->lock);
@@ -225,14 +225,14 @@
* @param prio priority to use for the search
*/
SEARCH_HANDLE *
-FS_start_search (SEARCH_CONTEXT * ctx,
+GNUNET_FS_start_search (SEARCH_CONTEXT * ctx,
const GNUNET_PeerIdentity * target,
unsigned int type,
unsigned int keyCount,
const GNUNET_HashCode * keys,
unsigned int anonymityLevel,
unsigned int prio,
- GNUNET_CronTime timeout, Datum_Iterator callback,
+ GNUNET_CronTime timeout, GNUNET_DatastoreValueIterator
callback,
void *closure)
{
SEARCH_HANDLE *ret;
@@ -243,8 +243,8 @@
ret = GNUNET_malloc (sizeof (SEARCH_HANDLE));
#if DEBUG_FSLIB
- GE_LOG (ctx->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER, "FSLIB: start search (%p)\n", ret);
+ GNUNET_GE_LOG (ctx->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, "FSLIB: start
search (%p)\n", ret);
#endif
req =
GNUNET_malloc (sizeof (CS_fs_request_search_MESSAGE) +
@@ -252,7 +252,7 @@
req->header.size =
htons (sizeof (CS_fs_request_search_MESSAGE) +
(keyCount - 1) * sizeof (GNUNET_HashCode));
- req->header.type = htons (CS_PROTO_gap_QUERY_START);
+ req->header.type = htons (GNUNET_CS_PROTO_GAP_QUERY_START);
req->prio = htonl (prio);
req->anonymityLevel = htonl (anonymityLevel);
req->expiration = GNUNET_htonll (timeout);
@@ -275,20 +275,20 @@
GNUNET_mutex_unlock (ctx->lock);
#if DEBUG_FSLIB
IF_GELOG (ctx->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&req->query[0], &enc));
- GE_LOG (ctx->ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ctx->ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"FSLIB: initiating search for `%s' of type %u\n", &enc, type);
#endif
- GE_ASSERT (NULL, ctx->sock != NULL);
+ GNUNET_GE_ASSERT (NULL, ctx->sock != NULL);
if (GNUNET_OK != GNUNET_client_connection_write (ctx->sock, &req->header))
{
- FS_stop_search (ctx, ret);
+ GNUNET_FS_stop_search (ctx, ret);
return NULL;
}
#if DEBUG_FSLIB
- GE_LOG (ctx->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ctx->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"FSLIB: search started (%p)\n", ret);
#endif
return ret;
@@ -298,22 +298,22 @@
* Stop searching.
*/
void
-FS_stop_search (SEARCH_CONTEXT * ctx, SEARCH_HANDLE * handle)
+GNUNET_FS_stop_search (SEARCH_CONTEXT * ctx, SEARCH_HANDLE * handle)
{
int i;
#if DEBUG_FSLIB
- GE_LOG (ctx->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ctx->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"FSLIB: stop search (%p)\n", handle);
#endif
- handle->req->header.type = htons (CS_PROTO_gap_QUERY_STOP);
- GE_ASSERT (NULL, ctx->sock != NULL);
+ handle->req->header.type = htons (GNUNET_CS_PROTO_GAP_QUERY_STOP);
+ GNUNET_GE_ASSERT (NULL, ctx->sock != NULL);
if (GNUNET_OK !=
GNUNET_client_connection_write (ctx->sock, &handle->req->header))
{
- GE_LOG (ctx->ectx,
- GE_WARNING | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (ctx->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"FSLIB: failed to request stop search with gnunetd\n");
}
GNUNET_mutex_lock (ctx->lock);
@@ -326,8 +326,8 @@
GNUNET_mutex_unlock (ctx->lock);
GNUNET_free (handle->req);
#if DEBUG_FSLIB
- GE_LOG (ctx->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ctx->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"FSLIB: search stopped (%p)\n", handle);
#endif
GNUNET_free (handle);
@@ -338,13 +338,13 @@
* in the routing table like? Returns -1 on error.
*/
int
-FS_getAveragePriority (struct GNUNET_ClientServerConnection *sock)
+GNUNET_FS_get_current_average_priority (struct GNUNET_ClientServerConnection
*sock)
{
GNUNET_MessageHeader req;
int ret;
req.size = htons (sizeof (GNUNET_MessageHeader));
- req.type = htons (CS_PROTO_gap_GET_AVG_PRIORITY);
+ req.type = htons (GNUNET_CS_PROTO_GAP_GET_AVG_PRIORITY);
if (GNUNET_OK != GNUNET_client_connection_write (sock, &req))
return -1;
if (GNUNET_OK != GNUNET_client_connection_read_result (sock, &ret))
@@ -359,23 +359,23 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error, GNUNET_NO on
transient error
*/
int
-FS_insert (struct GNUNET_ClientServerConnection *sock,
- const Datastore_Value * block)
+GNUNET_FS_insert (struct GNUNET_ClientServerConnection *sock,
+ const GNUNET_DatastoreValue * block)
{
int ret;
CS_fs_request_insert_MESSAGE *ri;
unsigned int size;
int retry;
- if (ntohl (block->size) <= sizeof (Datastore_Value))
+ if (ntohl (block->size) <= sizeof (GNUNET_DatastoreValue))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
- size = ntohl (block->size) - sizeof (Datastore_Value);
+ size = ntohl (block->size) - sizeof (GNUNET_DatastoreValue);
ri = GNUNET_malloc (sizeof (CS_fs_request_insert_MESSAGE) + size);
ri->header.size = htons (sizeof (CS_fs_request_insert_MESSAGE) + size);
- ri->header.type = htons (CS_PROTO_gap_INSERT);
+ ri->header.type = htons (GNUNET_CS_PROTO_GAP_INSERT);
ri->prio = block->prio;
ri->expiration = block->expirationTime;
ri->anonymityLevel = block->anonymityLevel;
@@ -390,7 +390,7 @@
}
if (GNUNET_OK != GNUNET_client_connection_read_result (sock, &ret))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
GNUNET_free (ri);
return GNUNET_SYSERR;
}
@@ -404,7 +404,7 @@
* Initialize to index a file
*/
int
-FS_initIndex (struct GNUNET_ClientServerConnection *sock,
+GNUNET_FS_prepare_to_inde (struct GNUNET_ClientServerConnection *sock,
const GNUNET_HashCode * fileHc, const char *fn)
{
int ret;
@@ -415,18 +415,18 @@
fnSize = strlen (fn);
fnSize = (fnSize + 7) & (~7); /* align */
size = sizeof (CS_fs_request_init_index_MESSAGE) + fnSize;
- GE_ASSERT (NULL, size < 65536);
+ GNUNET_GE_ASSERT (NULL, size < 65536);
ri = GNUNET_malloc (size);
memset (ri, 0, size);
ri->header.size = htons (size);
- ri->header.type = htons (CS_PROTO_gap_INIT_INDEX);
+ ri->header.type = htons (GNUNET_CS_PROTO_GAP_INIT_INDEX);
ri->reserved = htonl (0);
ri->fileId = *fileHc;
memcpy (&ri[1], fn, strlen (fn));
#if DEBUG_FSLIB
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Sending index initialization request to gnunetd\n");
#endif
if (GNUNET_OK != GNUNET_client_connection_write (sock, &ri->header))
@@ -436,8 +436,8 @@
}
GNUNET_free (ri);
#if DEBUG_FSLIB
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Waiting for confirmation of index initialization request by
gnunetd\n");
#endif
if (GNUNET_OK != GNUNET_client_connection_read_result (sock, &ret))
@@ -454,19 +454,19 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
int
-FS_index (struct GNUNET_ClientServerConnection *sock,
+GNUNET_FS_index (struct GNUNET_ClientServerConnection *sock,
const GNUNET_HashCode * fileHc,
- const Datastore_Value * block, unsigned long long offset)
+ const GNUNET_DatastoreValue * block, unsigned long long offset)
{
int ret;
CS_fs_request_index_MESSAGE *ri;
unsigned int size;
int retry;
- size = ntohl (block->size) - sizeof (Datastore_Value);
+ size = ntohl (block->size) - sizeof (GNUNET_DatastoreValue);
ri = GNUNET_malloc (sizeof (CS_fs_request_index_MESSAGE) + size);
ri->header.size = htons (sizeof (CS_fs_request_index_MESSAGE) + size);
- ri->header.type = htons (CS_PROTO_gap_INDEX);
+ ri->header.type = htons (GNUNET_CS_PROTO_GAP_INDEX);
ri->prio = block->prio;
ri->expiration = block->expirationTime;
ri->anonymityLevel = block->anonymityLevel;
@@ -474,8 +474,8 @@
ri->fileOffset = GNUNET_htonll (offset);
memcpy (&ri[1], &block[1], size);
#if DEBUG_FSLIB
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Sending index request to gnunetd\n");
#endif
retry = AUTO_RETRY;
@@ -487,8 +487,8 @@
return GNUNET_SYSERR;
}
#if DEBUG_FSLIB
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Waiting for confirmation of index request by gnunetd\n");
#endif
if (GNUNET_OK != GNUNET_client_connection_read_result (sock, &ret))
@@ -504,25 +504,25 @@
/**
* Delete a block. The arguments are the same as the ones for
- * FS_insert.
+ * GNUNET_FS_insert.
*
* @param block the block (properly encoded and all)
* @return number of items deleted on success,
* GNUNET_SYSERR on error
*/
int
-FS_delete (struct GNUNET_ClientServerConnection *sock,
- const Datastore_Value * block)
+GNUNET_FS_delete (struct GNUNET_ClientServerConnection *sock,
+ const GNUNET_DatastoreValue * block)
{
int ret;
CS_fs_request_delete_MESSAGE *rd;
unsigned int size;
int retry;
- size = ntohl (block->size) - sizeof (Datastore_Value);
+ size = ntohl (block->size) - sizeof (GNUNET_DatastoreValue);
rd = GNUNET_malloc (sizeof (CS_fs_request_delete_MESSAGE) + size);
rd->header.size = htons (sizeof (CS_fs_request_delete_MESSAGE) + size);
- rd->header.type = htons (CS_PROTO_gap_DELETE);
+ rd->header.type = htons (GNUNET_CS_PROTO_GAP_DELETE);
memcpy (&rd[1], &block[1], size);
retry = AUTO_RETRY;
do
@@ -530,12 +530,12 @@
if (GNUNET_OK != GNUNET_client_connection_write (sock, &rd->header))
{
GNUNET_free (rd);
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
if (GNUNET_OK != GNUNET_client_connection_read_result (sock, &ret))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
GNUNET_free (rd);
return GNUNET_SYSERR;
}
@@ -552,14 +552,14 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
int
-FS_unindex (struct GNUNET_ClientServerConnection *sock,
+GNUNET_FS_unindex (struct GNUNET_ClientServerConnection *sock,
unsigned int blocksize, const GNUNET_HashCode * hc)
{
int ret;
CS_fs_request_unindex_MESSAGE ru;
ru.header.size = htons (sizeof (CS_fs_request_unindex_MESSAGE));
- ru.header.type = htons (CS_PROTO_gap_UNINDEX);
+ ru.header.type = htons (GNUNET_CS_PROTO_GAP_UNINDEX);
ru.blocksize = htonl (blocksize);
ru.fileId = *hc;
if (GNUNET_OK != GNUNET_client_connection_write (sock, &ru.header))
@@ -576,14 +576,14 @@
* @return GNUNET_YES if so, GNUNET_NO if not, GNUNET_SYSERR on error
*/
int
-FS_testIndexed (struct GNUNET_ClientServerConnection *sock,
+GNUNET_FS_test_indexed (struct GNUNET_ClientServerConnection *sock,
const GNUNET_HashCode * hc)
{
RequestTestindex ri;
int ret;
ri.header.size = htons (sizeof (RequestTestindex));
- ri.header.type = htons (CS_PROTO_gap_TESTINDEX);
+ ri.header.type = htons (GNUNET_CS_PROTO_GAP_TESTINDEX);
ri.reserved = htonl (0);
ri.fileId = *hc;
if (GNUNET_OK != GNUNET_client_connection_write (sock, &ri.header))
Modified: GNUnet/src/applications/fs/lib/fslibtest.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslibtest.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/lib/fslibtest.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -32,7 +32,7 @@
#include "gnunet_protocols.h"
#include "ecrs_core.h"
-#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GE_BREAK(NULL, 0); goto FAILURE; }
+#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GNUNET_GE_BREAK(NULL, 0); goto
FAILURE; }
static struct GNUNET_CronManager *cron;
@@ -40,40 +40,40 @@
static struct GNUNET_ThreadHandle *mainThread;
-static Datastore_Value *
+static GNUNET_DatastoreValue *
makeBlock (int i)
{
- Datastore_Value *block;
+ GNUNET_DatastoreValue *block;
DBlock *db;
- block = GNUNET_malloc (sizeof (Datastore_Value) + sizeof (DBlock) + i);
- block->size = htonl (sizeof (Datastore_Value) + sizeof (DBlock) + i);
- block->type = htonl (D_BLOCK);
+ block = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + sizeof (DBlock) + i);
+ block->size = htonl (sizeof (GNUNET_DatastoreValue) + sizeof (DBlock) + i);
+ block->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
block->prio = htonl (0);
block->anonymityLevel = htonl (0);
block->expirationTime = GNUNET_htonll (now + 1 * GNUNET_CRON_HOURS);
db = (DBlock *) & block[1];
- db->type = htonl (D_BLOCK);
+ db->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
memset (&db[1], i + (i / 253), i);
return block;
}
-static Datastore_Value *
+static GNUNET_DatastoreValue *
makeKBlock (unsigned int i, const GNUNET_HashCode * key,
GNUNET_HashCode * query)
{
- Datastore_Value *block;
+ GNUNET_DatastoreValue *block;
KBlock *db;
struct GNUNET_RSA_PrivateKey *kkey;
- block = GNUNET_malloc (sizeof (Datastore_Value) + sizeof (KBlock) + i);
- block->size = htonl (sizeof (Datastore_Value) + sizeof (KBlock) + i);
- block->type = htonl (K_BLOCK);
+ block = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + sizeof (KBlock) + i);
+ block->size = htonl (sizeof (GNUNET_DatastoreValue) + sizeof (KBlock) + i);
+ block->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD);
block->prio = htonl (0);
block->anonymityLevel = htonl (0);
block->expirationTime = GNUNET_htonll (now + 1 * GNUNET_CRON_HOURS);
db = (KBlock *) & block[1];
- db->type = htonl (K_BLOCK);
+ db->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD);
memset (&db[1], i + (i / 253), i);
kkey = GNUNET_RSA_create_key_from_hash (key);
GNUNET_RSA_sign (kkey, i, &db[1], &db->signature);
@@ -104,7 +104,7 @@
*/
static int
countCallback (const GNUNET_HashCode * key,
- const Datastore_Value * value, void *cls)
+ const GNUNET_DatastoreValue * value, void *cls)
{
int *cnt = cls;
(*cnt)--;
@@ -117,26 +117,26 @@
static int
searchResultCB (const GNUNET_HashCode * key,
- const Datastore_Value * value, TSC * cls)
+ const GNUNET_DatastoreValue * value, TSC * cls)
{
GNUNET_HashCode ekey;
- Datastore_Value *blk;
- Datastore_Value *eblk;
+ GNUNET_DatastoreValue *blk;
+ GNUNET_DatastoreValue *eblk;
int ret;
blk = makeBlock (cls->i);
fileBlockGetQuery ((DBlock *) & blk[1],
- ntohl (blk->size) - sizeof (Datastore_Value), &ekey);
- GE_ASSERT (NULL, GNUNET_OK ==
+ ntohl (blk->size) - sizeof (GNUNET_DatastoreValue),
&ekey);
+ GNUNET_GE_ASSERT (NULL, GNUNET_OK ==
fileBlockEncode ((DBlock *) & blk[1],
- ntohl (blk->size) - sizeof (Datastore_Value),
+ ntohl (blk->size) - sizeof
(GNUNET_DatastoreValue),
&ekey, &eblk));
if ((0 == memcmp (&ekey,
key, sizeof (GNUNET_HashCode))) &&
(value->size == blk->size) &&
(0 == memcmp (&value[1],
&eblk[1],
- ntohl (value->size) - sizeof (Datastore_Value))))
+ ntohl (value->size) - sizeof (GNUNET_DatastoreValue))))
{
cls->found = GNUNET_YES;
GNUNET_semaphore_up (cls->sem);
@@ -144,7 +144,7 @@
}
else
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
printf ("Received unexpected result.\n");
ret = GNUNET_OK;
}
@@ -154,36 +154,36 @@
}
static int
-trySearch (struct FS_SEARCH_CONTEXT *ctx, int i)
+trySearch (struct GNUNET_FS_SearchContext *ctx, int i)
{
- struct FS_SEARCH_HANDLE *handle;
+ struct GNUNET_FS_SearchHandle *handle;
GNUNET_CronTime now;
GNUNET_HashCode query;
TSC closure;
- Datastore_Value *dv;
+ GNUNET_DatastoreValue *dv;
DBlock *db;
dv = makeBlock (i);
db = (DBlock *) & dv[1];
- fileBlockGetQuery (db, ntohl (dv->size) - sizeof (Datastore_Value), &query);
+ fileBlockGetQuery (db, ntohl (dv->size) - sizeof (GNUNET_DatastoreValue),
&query);
GNUNET_free (dv);
closure.found = GNUNET_NO;
closure.i = i;
closure.sem = GNUNET_semaphore_create (0);
now = GNUNET_get_time ();
- handle = FS_start_search (ctx,
+ handle = GNUNET_FS_start_search (ctx,
NULL,
- D_BLOCK,
+ GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA,
1,
&query,
0,
0,
now + 30 * GNUNET_CRON_SECONDS,
- (Datum_Iterator) & searchResultCB, &closure);
+ (GNUNET_DatastoreValueIterator) & searchResultCB,
&closure);
GNUNET_cron_add_job (cron, &abortSem, 30 * GNUNET_CRON_SECONDS, 0,
closure.sem);
GNUNET_semaphore_down (closure.sem, GNUNET_YES);
- FS_stop_search (ctx, handle);
+ GNUNET_FS_stop_search (ctx, handle);
GNUNET_cron_suspend_jobs (cron, GNUNET_NO);
GNUNET_cron_del_job (cron, &abortSem, 0, closure.sem);
GNUNET_cron_resume_jobs (cron, GNUNET_NO);
@@ -200,42 +200,42 @@
pid_t daemon;
#endif
int ok;
- struct FS_SEARCH_CONTEXT *ctx = NULL;
- struct FS_SEARCH_HANDLE *hnd;
+ struct GNUNET_FS_SearchContext *ctx = NULL;
+ struct GNUNET_FS_SearchHandle *hnd;
struct GNUNET_Mutex *lock;
struct GNUNET_ClientServerConnection *sock;
- Datastore_Value *block;
- Datastore_Value *eblock;
+ GNUNET_DatastoreValue *block;
+ GNUNET_DatastoreValue *eblock;
GNUNET_HashCode hc;
GNUNET_HashCode query;
int i;
char *tmpName;
int fd;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
now = GNUNET_get_time ();
cron = cron_create (NULL);
#if START_DAEMON
daemon = GNUNET_daemon_start (NULL, cfg, "peer.conf", GNUNET_NO);
- GE_ASSERT (NULL, daemon > 0);
+ GNUNET_GE_ASSERT (NULL, daemon > 0);
#endif
ok = GNUNET_YES;
GNUNET_cron_start (cron);
lock = GNUNET_mutex_create (GNUNET_NO);
- GE_ASSERT (NULL,
+ GNUNET_GE_ASSERT (NULL,
GNUNET_OK == GNUNET_wait_for_daemon_running (NULL, cfg,
60 *
GNUNET_CRON_SECONDS));
GNUNET_thread_sleep (5 * GNUNET_CRON_SECONDS); /* give apps time to
start */
sock = GNUNET_client_connection_create (NULL, cfg);
CHECK (sock != NULL);
- ctx = FS_SEARCH_makeContext (NULL, cfg, lock);
+ ctx = GNUNET_FS_create_search_context (NULL, cfg, lock);
CHECK (ctx != NULL);
/* ACTUAL TEST CODE */
@@ -244,37 +244,37 @@
fprintf (stderr, ".");
block = makeBlock (i);
fileBlockGetQuery ((DBlock *) & block[1],
- ntohl (block->size) - sizeof (Datastore_Value),
+ ntohl (block->size) - sizeof (GNUNET_DatastoreValue),
&query);
CHECK (GNUNET_OK == fileBlockEncode ((DBlock *) & block[1],
ntohl (block->size) -
- sizeof (Datastore_Value), &query,
+ sizeof (GNUNET_DatastoreValue),
&query,
&eblock));
eblock->expirationTime = block->expirationTime;
eblock->prio = block->prio;
- CHECK (GNUNET_OK == FS_insert (sock, eblock));
+ CHECK (GNUNET_OK == GNUNET_FS_insert (sock, eblock));
CHECK (GNUNET_OK == trySearch (ctx, i));
- CHECK (GNUNET_SYSERR != FS_delete (sock, eblock));
+ CHECK (GNUNET_SYSERR != GNUNET_FS_delete (sock, eblock));
GNUNET_free (eblock);
GNUNET_hash (&((DBlock *) & block[1])[1],
- ntohl (block->size) - sizeof (Datastore_Value) -
+ ntohl (block->size) - sizeof (GNUNET_DatastoreValue) -
sizeof (DBlock), &hc);
/* indexing without symlink */
- CHECK (GNUNET_OK == FS_index (sock, &hc, block, 0));
+ CHECK (GNUNET_OK == GNUNET_FS_index (sock, &hc, block, 0));
CHECK (GNUNET_OK == trySearch (ctx, i));
- CHECK (GNUNET_OK == FS_unindex (sock, GNUNET_MAX_BUFFER_SIZE, &hc));
+ CHECK (GNUNET_OK == GNUNET_FS_unindex (sock, GNUNET_MAX_BUFFER_SIZE,
&hc));
/* indexing with symlink */
tmpName = GNUNET_strdup ("/tmp/symlinkTestXXXXXX");
CHECK (-1 != (fd = mkstemp (tmpName)));
CHECK (-1 != WRITE (fd,
&((DBlock *) & block[1])[1],
- ntohl (block->size) - sizeof (Datastore_Value) -
+ ntohl (block->size) - sizeof (GNUNET_DatastoreValue)
-
sizeof (DBlock)));
CLOSE (fd);
- CHECK (FS_initIndex (sock, &hc, tmpName) == GNUNET_YES);
- CHECK (GNUNET_OK == FS_index (sock, &hc, block, 0));
+ CHECK (GNUNET_FS_prepare_to_inde (sock, &hc, tmpName) == GNUNET_YES);
+ CHECK (GNUNET_OK == GNUNET_FS_index (sock, &hc, block, 0));
CHECK (GNUNET_OK == trySearch (ctx, i));
- CHECK (GNUNET_OK == FS_unindex (sock, GNUNET_MAX_BUFFER_SIZE, &hc));
+ CHECK (GNUNET_OK == GNUNET_FS_unindex (sock, GNUNET_MAX_BUFFER_SIZE,
&hc));
UNLINK (tmpName);
GNUNET_free (tmpName);
GNUNET_free (block);
@@ -285,24 +285,24 @@
fprintf (stderr, ".");
block = makeBlock (i);
fileBlockGetQuery ((DBlock *) & block[1],
- ntohl (block->size) - sizeof (Datastore_Value),
+ ntohl (block->size) - sizeof (GNUNET_DatastoreValue),
&query);
CHECK (GNUNET_OK == fileBlockEncode ((DBlock *) & block[1],
ntohl (block->size) -
- sizeof (Datastore_Value), &query,
+ sizeof (GNUNET_DatastoreValue),
&query,
&eblock));
eblock->expirationTime = block->expirationTime;
eblock->prio = block->prio;
- CHECK (GNUNET_OK == FS_insert (sock, eblock));
+ CHECK (GNUNET_OK == GNUNET_FS_insert (sock, eblock));
CHECK (GNUNET_OK == trySearch (ctx, i));
- CHECK (1 == FS_delete (sock, eblock));
+ CHECK (1 == GNUNET_FS_delete (sock, eblock));
GNUNET_free (eblock);
GNUNET_hash (&((DBlock *) & block[1])[1],
- ntohl (block->size) - sizeof (Datastore_Value) -
+ ntohl (block->size) - sizeof (GNUNET_DatastoreValue) -
sizeof (DBlock), &hc);
- CHECK (GNUNET_OK == FS_index (sock, &hc, block, 0));
+ CHECK (GNUNET_OK == GNUNET_FS_index (sock, &hc, block, 0));
CHECK (GNUNET_OK == trySearch (ctx, i));
- CHECK (GNUNET_OK == FS_unindex (sock, GNUNET_MAX_BUFFER_SIZE, &hc));
+ CHECK (GNUNET_OK == GNUNET_FS_unindex (sock, GNUNET_MAX_BUFFER_SIZE,
&hc));
GNUNET_free (block);
}
fprintf (stderr, "\n");
@@ -310,43 +310,43 @@
/* multiple search results test */
GNUNET_create_random_hash (&hc);
block = makeKBlock (40, &hc, &query);
- CHECK (GNUNET_OK == FS_insert (sock, block));
+ CHECK (GNUNET_OK == GNUNET_FS_insert (sock, block));
GNUNET_free (block);
block = makeKBlock (60, &hc, &query);
- CHECK (GNUNET_OK == FS_insert (sock, block));
+ CHECK (GNUNET_OK == GNUNET_FS_insert (sock, block));
GNUNET_free (block);
i = 2;
mainThread = GNUNET_thread_get_self ();
- hnd = FS_start_search (ctx,
+ hnd = GNUNET_FS_start_search (ctx,
NULL,
- ANY_BLOCK,
+ GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
1,
&query, 0, 0, 10 * GNUNET_CRON_SECONDS,
&countCallback, &i);
CHECK (hnd != NULL);
GNUNET_thread_sleep (10 * GNUNET_CRON_SECONDS);
- FS_stop_search (ctx, hnd);
+ GNUNET_FS_stop_search (ctx, hnd);
GNUNET_thread_release_self (mainThread);
CHECK (i <= 0);
/* just to check if it crashes... */
- FS_getAveragePriority (sock);
+ GNUNET_FS_get_current_average_priority (sock);
/* END OF TEST CODE */
FAILURE:
fprintf (stderr, "\n");
if (ctx != NULL)
- FS_SEARCH_destroyContext (ctx);
+ GNUNET_FS_destroy_search_context (ctx);
if (sock != NULL)
GNUNET_client_connection_destroy (sock);
GNUNET_mutex_destroy (lock);
GNUNET_cron_stop (cron);
GNUNET_cron_destroy (cron);
#if START_DAEMON
- GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
+ GNUNET_GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
#endif
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return (ok == GNUNET_YES) ? 0 : 1;
}
Modified: GNUnet/src/applications/fs/module/anonymity.c
===================================================================
--- GNUnet/src/applications/fs/module/anonymity.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/module/anonymity.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -35,7 +35,7 @@
* with anonymity and GAP messages). So we should
* probably move it below the callback by passing
* the anonymity level along. But that would
- * require changing the DataProcessor somewhat,
+ * require changing the GNUNET_DataProcessor somewhat,
* which would also be ugly. So to keep things
* simple, we do the anonymity-level check for
* outgoing content right here.
@@ -43,8 +43,8 @@
* @return GNUNET_OK if cover traffic is sufficient
*/
int
-checkCoverTraffic (struct GE_Context *ectx,
- Traffic_ServiceAPI * traffic, unsigned int level)
+checkCoverTraffic (struct GNUNET_GE_Context *ectx,
+ GNUNET_Traffic_ServiceAPI * traffic, unsigned int level)
{
unsigned int count;
unsigned int peers;
@@ -56,13 +56,13 @@
level--;
if (traffic == NULL)
return GNUNET_SYSERR;
- if (GNUNET_OK != traffic->get (5 * GNUNET_CRON_SECONDS / TRAFFIC_TIME_UNIT,
/* TTL_DECREMENT/TTU */
- P2P_PROTO_gap_RESULT,
- TC_RECEIVED, &count, &peers, &sizes,
+ if (GNUNET_OK != traffic->get (5 * GNUNET_CRON_SECONDS /
GNUNET_TRAFFIC_TIME_UNIT, /* TTL_DECREMENT/TTU */
+ GNUNET_P2P_PROTO_GAP_RESULT,
+ GNUNET_TRAFFIC_TYPE_RECEIVED, &count, &peers,
&sizes,
&timevect))
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Failed to get traffic stats.\n"));
return GNUNET_SYSERR;
}
@@ -70,16 +70,16 @@
{
if (peers < level / 1000)
{
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Not enough cover traffic to satisfy anonymity requirements
(%u, %u peers). "
"Result dropped.\n", level, peers);
return GNUNET_SYSERR;
}
if (count < level % 1000)
{
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Not enough cover traffic to satisfy anonymity requirements
(%u, %u messages). "
"Result dropped.\n", level, count);
return GNUNET_SYSERR;
@@ -89,8 +89,8 @@
{
if (count < level)
{
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Not enough cover traffic to satisfy anonymity requirements
(%u, %u messages). "
"Result dropped.\n", level, count);
return GNUNET_SYSERR;
Modified: GNUnet/src/applications/fs/module/anonymity.h
===================================================================
--- GNUnet/src/applications/fs/module/anonymity.h 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/module/anonymity.h 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -36,14 +36,14 @@
* with anonymity and GAP messages). So we should
* probably move it below the callback by passing
* the anonymity level along. But that would
- * require changing the DataProcessor somewhat,
+ * require changing the GNUNET_DataProcessor somewhat,
* which would also be ugly. So to keep things
* simple, we do the anonymity-level check for
* outgoing content right here.
*
* @return GNUNET_OK if cover traffic is sufficient
*/
-int checkCoverTraffic (struct GE_Context *ectx,
- Traffic_ServiceAPI * traffic, unsigned int level);
+int checkCoverTraffic (struct GNUNET_GE_Context *ectx,
+ GNUNET_Traffic_ServiceAPI * traffic, unsigned int
level);
#endif
Modified: GNUnet/src/applications/fs/module/dht_push.c
===================================================================
--- GNUnet/src/applications/fs/module/dht_push.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/module/dht_push.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -43,17 +43,17 @@
/**
* DHT service. Set to NULL to terminate
*/
-static DHT_ServiceAPI *dht;
+static GNUNET_DHT_ServiceAPI *dht;
/**
* Global core API.
*/
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
/**
* SQStore service.
*/
-static SQstore_ServiceAPI *sqstore;
+static GNUNET_SQstore_ServiceAPI *sqstore;
/**
@@ -68,14 +68,14 @@
*/
static int total;
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
static int stat_push_count;
static int
push_callback (const GNUNET_HashCode * key,
- const Datastore_Value * value, void *closure,
+ const GNUNET_DatastoreValue * value, void *closure,
unsigned long long uid)
{
GNUNET_CronTime delay;
@@ -94,7 +94,7 @@
return GNUNET_SYSERR;
dht->put (key,
ntohl (value->type),
- ntohl (value->size) - sizeof (Datastore_Value),
+ ntohl (value->size) - sizeof (GNUNET_DatastoreValue),
GNUNET_ntohll (value->expirationTime), (const char *) &value[1]);
if (stats != NULL)
stats->change (stat_push_count, 1);
@@ -122,14 +122,14 @@
* Initialize the migration module.
*/
void
-init_dht_push (CoreAPIForApplication * capi, DHT_ServiceAPI * d)
+init_dht_push (GNUNET_CoreAPIForPlugins * capi, GNUNET_DHT_ServiceAPI * d)
{
coreAPI = capi;
dht = d;
sqstore = capi->requestService ("sqstore");
if (sqstore == NULL)
{
- GE_BREAK (capi->ectx, 0);
+ GNUNET_GE_BREAK (capi->ectx, 0);
return;
}
stats = capi->requestService ("stats");
Modified: GNUnet/src/applications/fs/module/dht_push.h
===================================================================
--- GNUnet/src/applications/fs/module/dht_push.h 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/module/dht_push.h 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -34,7 +34,7 @@
/**
* Initialize the migration module.
*/
-void init_dht_push (CoreAPIForApplication * capi, DHT_ServiceAPI * s);
+void init_dht_push (GNUNET_CoreAPIForPlugins * capi, GNUNET_DHT_ServiceAPI *
s);
void done_dht_push (void);
Modified: GNUnet/src/applications/fs/module/fs.c
===================================================================
--- GNUnet/src/applications/fs/module/fs.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/fs/module/fs.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -47,7 +47,7 @@
typedef struct
{
- struct DHT_GET_RECORD *rec;
+ struct GNUNET_DHT_GetHandle *rec;
unsigned int prio;
} DHT_GET_CLS;
@@ -62,32 +62,32 @@
/**
* Global core API.
*/
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
/**
* GAP service.
*/
-static GAP_ServiceAPI *gap;
+static GNUNET_GAP_ServiceAPI *gap;
/**
* DHT service. Maybe NULL!
*/
-static DHT_ServiceAPI *dht;
+static GNUNET_DHT_ServiceAPI *dht;
/**
* Datastore service.
*/
-static Datastore_ServiceAPI *datastore;
+static GNUNET_Datastore_ServiceAPI *datastore;
/**
* Traffic service.
*/
-static Traffic_ServiceAPI *traffic;
+static GNUNET_Traffic_ServiceAPI *traffic;
/**
* Stats service.
*/
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
static int stat_expired_replies_dropped;
@@ -103,12 +103,12 @@
static LG_Job *lg_jobs;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static Datastore_Value *
-gapWrapperToDatastoreValue (const DataContainer * value, int prio)
+static GNUNET_DatastoreValue *
+gapWrapperToDatastoreValue (const GNUNET_DataContainer * value, int prio)
{
- Datastore_Value *dv;
+ GNUNET_DatastoreValue *dv;
const GapWrapper *gw;
unsigned int size;
GNUNET_CronTime et;
@@ -116,14 +116,14 @@
if (ntohl (value->size) < sizeof (GapWrapper))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return NULL;
}
gw = (const GapWrapper *) value;
- size = ntohl (gw->dc.size) - sizeof (GapWrapper) + sizeof (Datastore_Value);
+ size = ntohl (gw->dc.size) - sizeof (GapWrapper) + sizeof
(GNUNET_DatastoreValue);
dv = GNUNET_malloc (size);
dv->size = htonl (size);
- dv->type = htonl (getTypeOfBlock (size - sizeof (Datastore_Value),
+ dv->type = htonl (getTypeOfBlock (size - sizeof (GNUNET_DatastoreValue),
(DBlock *) & gw[1]));
dv->prio = htonl (prio);
dv->anonymityLevel = htonl (0);
@@ -137,7 +137,7 @@
et += now;
}
dv->expirationTime = GNUNET_htonll (et);
- memcpy (&dv[1], &gw[1], size - sizeof (Datastore_Value));
+ memcpy (&dv[1], &gw[1], size - sizeof (GNUNET_DatastoreValue));
return dv;
}
@@ -155,9 +155,9 @@
static int
gapPut (void *closure,
const GNUNET_HashCode * query,
- const DataContainer * value, unsigned int prio)
+ const GNUNET_DataContainer * value, unsigned int prio)
{
- Datastore_Value *dv;
+ GNUNET_DatastoreValue *dv;
const GapWrapper *gw;
unsigned int size;
int ret;
@@ -173,22 +173,22 @@
GNUNET_YES, &hc))
|| (0 != memcmp (&hc, query, sizeof (GNUNET_HashCode))))
{
- GE_BREAK_OP (ectx, 0); /* value failed verification! */
+ GNUNET_GE_BREAK_OP (ectx, 0); /* value failed verification! */
return GNUNET_SYSERR;
}
dv = gapWrapperToDatastoreValue (value, prio);
if (dv == NULL)
{
- GE_BREAK_OP (ectx, 0);
+ GNUNET_GE_BREAK_OP (ectx, 0);
return GNUNET_SYSERR;
}
if (GNUNET_YES != isDatumApplicable (ntohl (dv->type),
ntohl (dv->size) -
- sizeof (Datastore_Value),
+ sizeof (GNUNET_DatastoreValue),
(const DBlock *) &dv[1], &hc, 0,
query))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_free (dv);
return GNUNET_SYSERR;
}
@@ -200,7 +200,7 @@
_except_ if it is pure content that one
of our clients has requested -- then we
should ignore expiration */
- if (ntohl (dv->type) == D_BLOCK)
+ if (ntohl (dv->type) == GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA)
processResponse (query, dv);
else if (stats != NULL)
stats->change (stat_expired_replies_dropped, 1);
@@ -212,9 +212,9 @@
#if DEBUG_FS
- IF_GELOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (query, &enc));
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"FS received GAP-PUT request (query: `%s')\n", &enc);
#endif
if (migration)
@@ -229,7 +229,7 @@
static int
get_result_callback (const GNUNET_HashCode * query,
- const DataContainer * value, void *ctx)
+ const GNUNET_DataContainer * value, void *ctx)
{
DHT_GET_CLS *cls = ctx;
const GapWrapper *gw;
@@ -238,9 +238,9 @@
#if DEBUG_FS
GNUNET_EncName enc;
- IF_GELOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (query, &enc));
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Found reply to query `%s'.\n", &enc);
#endif
gw = (const GapWrapper *) value;
@@ -250,7 +250,7 @@
GNUNET_YES, &hc))
|| (0 != memcmp (&hc, query, sizeof (GNUNET_HashCode))))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_OK;
}
@@ -272,7 +272,7 @@
* @return GNUNET_SYSERR if the TCP connection should be closed, otherwise
GNUNET_OK
*/
static int
-csHandleRequestQueryStop (struct ClientHandle *sock,
+csHandleRequestQueryStop (struct GNUNET_ClientHandle *sock,
const GNUNET_MessageHeader * req)
{
const CS_fs_request_search_MESSAGE *rs;
@@ -282,15 +282,15 @@
if (ntohs (req->size) < sizeof (CS_fs_request_search_MESSAGE))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
rs = (const CS_fs_request_search_MESSAGE *) req;
#if DEBUG_FS
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&rs->query[0], &enc));
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"FS received QUERY STOP (query: `%s')\n", &enc);
#endif
gap->get_stop (ntohl (rs->type),
@@ -307,12 +307,12 @@
* @return GNUNET_SYSERR if the TCP connection should be closed, otherwise
GNUNET_OK
*/
static int
-csHandleCS_fs_request_insert_MESSAGE (struct ClientHandle *sock,
+csHandleCS_fs_request_insert_MESSAGE (struct GNUNET_ClientHandle *sock,
const GNUNET_MessageHeader * req)
{
const CS_fs_request_insert_MESSAGE *ri;
- Datastore_Value *datum;
- struct GE_Context *cectx;
+ GNUNET_DatastoreValue *datum;
+ struct GNUNET_GE_Context *cectx;
GNUNET_HashCode query;
int ret;
unsigned int type;
@@ -321,21 +321,21 @@
#endif
cectx =
- coreAPI->createClientLogContext (GE_USER | GE_EVENTKIND | GE_ROUTEKIND,
+ coreAPI->createClientLogContext (GNUNET_GE_USER | GNUNET_GE_EVENTKIND |
GNUNET_GE_ROUTEKIND,
sock);
if (ntohs (req->size) < sizeof (CS_fs_request_insert_MESSAGE))
{
- GE_BREAK (ectx, 0);
- GE_BREAK (cectx, 0);
- GE_free_context (cectx);
+ GNUNET_GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (cectx, 0);
+ GNUNET_GE_free_context (cectx);
return GNUNET_SYSERR;
}
ri = (const CS_fs_request_insert_MESSAGE *) req;
- datum = GNUNET_malloc (sizeof (Datastore_Value) +
+ datum = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) +
ntohs (req->size) -
sizeof (CS_fs_request_insert_MESSAGE));
datum->size =
- htonl (sizeof (Datastore_Value) + ntohs (req->size) -
+ htonl (sizeof (GNUNET_DatastoreValue) + ntohs (req->size) -
sizeof (CS_fs_request_insert_MESSAGE));
datum->expirationTime = ri->expiration;
datum->prio = ri->prio;
@@ -345,10 +345,10 @@
sizeof (CS_fs_request_insert_MESSAGE),
(const DBlock *) &ri[1], GNUNET_YES, &query))
{
- GE_BREAK (ectx, 0);
- GE_BREAK (cectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (cectx, 0);
GNUNET_free (datum);
- GE_free_context (cectx);
+ GNUNET_GE_free_context (cectx);
return GNUNET_SYSERR;
}
type =
@@ -356,9 +356,9 @@
sizeof (CS_fs_request_insert_MESSAGE),
(const DBlock *) &ri[1]);
#if DEBUG_FS
- IF_GELOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&query, &enc));
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"FS received REQUEST INSERT (query: `%s', type: %u, priority %u)\n",
&enc, type, ntohl (ri->prio));
#endif
@@ -366,7 +366,7 @@
memcpy (&datum[1],
&ri[1], ntohs (req->size) - sizeof (CS_fs_request_insert_MESSAGE));
GNUNET_mutex_lock (lock);
- if ((type != D_BLOCK) || (0 == datastore->get (&query, type, NULL, NULL)))
+ if ((type != GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA) || (0 == datastore->get
(&query, type, NULL, NULL)))
ret = datastore->put (&query, datum);
else
ret = GNUNET_OK;
@@ -404,7 +404,7 @@
&hc))
|| (0 != memcmp (&hc, &query, sizeof (GNUNET_HashCode))))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
}
else
{
@@ -413,7 +413,7 @@
GNUNET_free (gw);
}
GNUNET_free (datum);
- GE_free_context (cectx);
+ GNUNET_GE_free_context (cectx);
return coreAPI->sendValueToClient (sock, ret);
}
@@ -421,23 +421,23 @@
* Process a request to symlink a file
*/
static int
-csHandleCS_fs_request_init_index_MESSAGE (struct ClientHandle *sock,
+csHandleCS_fs_request_init_index_MESSAGE (struct GNUNET_ClientHandle *sock,
const GNUNET_MessageHeader * req)
{
int ret;
char *fn;
CS_fs_request_init_index_MESSAGE *ri;
int fnLen;
- struct GE_Context *cectx;
+ struct GNUNET_GE_Context *cectx;
cectx =
- coreAPI->createClientLogContext (GE_USER | GE_EVENTKIND | GE_ROUTEKIND,
+ coreAPI->createClientLogContext (GNUNET_GE_USER | GNUNET_GE_EVENTKIND |
GNUNET_GE_ROUTEKIND,
sock);
if (ntohs (req->size) < sizeof (CS_fs_request_init_index_MESSAGE))
{
- GE_BREAK (ectx, 0);
- GE_BREAK (cectx, 0);
- GE_free_context (cectx);
+ GNUNET_GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (cectx, 0);
+ GNUNET_GE_free_context (cectx);
return GNUNET_SYSERR;
}
@@ -447,8 +447,8 @@
#if WINDOWS
if (fnLen > _MAX_PATH)
{
- GE_BREAK (cectx, 0);
- GE_free_context (cectx);
+ GNUNET_GE_BREAK (cectx, 0);
+ GNUNET_GE_free_context (cectx);
return GNUNET_SYSERR;
}
#endif
@@ -459,12 +459,12 @@
GNUNET_free (fn);
#if DEBUG_FS
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Sending confirmation (%s) of index initialization request to
client\n",
ret == GNUNET_OK ? "success" : "failure");
#endif
- GE_free_context (cectx);
+ GNUNET_GE_free_context (cectx);
return coreAPI->sendValueToClient (sock, ret);
}
@@ -474,21 +474,21 @@
* @return GNUNET_SYSERR if the TCP connection should be closed, otherwise
GNUNET_OK
*/
static int
-csHandleCS_fs_request_index_MESSAGE (struct ClientHandle *sock,
+csHandleCS_fs_request_index_MESSAGE (struct GNUNET_ClientHandle *sock,
const GNUNET_MessageHeader * req)
{
int ret;
const CS_fs_request_index_MESSAGE *ri;
- struct GE_Context *cectx;
+ struct GNUNET_GE_Context *cectx;
cectx =
- coreAPI->createClientLogContext (GE_USER | GE_EVENTKIND | GE_ROUTEKIND,
+ coreAPI->createClientLogContext (GNUNET_GE_USER | GNUNET_GE_EVENTKIND |
GNUNET_GE_ROUTEKIND,
sock);
if (ntohs (req->size) < sizeof (CS_fs_request_index_MESSAGE))
{
- GE_BREAK (ectx, 0);
- GE_BREAK (cectx, 0);
- GE_free_context (cectx);
+ GNUNET_GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (cectx, 0);
+ GNUNET_GE_free_context (cectx);
return GNUNET_SYSERR;
}
ri = (const CS_fs_request_index_MESSAGE *) req;
@@ -503,12 +503,12 @@
sizeof (CS_fs_request_index_MESSAGE),
(const DBlock *) &ri[1]);
#if DEBUG_FS
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Sending confirmation (%s) of index request to client\n",
ret == GNUNET_OK ? "success" : "failure");
#endif
- GE_free_context (cectx);
+ GNUNET_GE_free_context (cectx);
return coreAPI->sendValueToClient (sock, ret);
}
@@ -520,19 +520,19 @@
*/
static int
completeValue (const GNUNET_HashCode * key,
- const Datastore_Value * value, void *closure,
+ const GNUNET_DatastoreValue * value, void *closure,
unsigned long long uid)
{
- Datastore_Value *comp = closure;
+ GNUNET_DatastoreValue *comp = closure;
if ((comp->size != value->size) ||
(0 != memcmp (&value[1],
&comp[1],
- ntohl (value->size) - sizeof (Datastore_Value))))
+ ntohl (value->size) - sizeof (GNUNET_DatastoreValue))))
{
#if DEBUG_FS
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"`%s' found value that does not match (%u, %u).\n",
__FUNCTION__, ntohl (comp->size), ntohl (value->size));
#endif
@@ -540,8 +540,8 @@
}
*comp = *value; /* make copy! */
#if DEBUG_FS
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"`%s' found value that matches.\n", __FUNCTION__);
#endif
return GNUNET_SYSERR;
@@ -553,35 +553,35 @@
* @return GNUNET_SYSERR if the TCP connection should be closed, otherwise
GNUNET_OK
*/
static int
-csHandleCS_fs_request_delete_MESSAGE (struct ClientHandle *sock,
+csHandleCS_fs_request_delete_MESSAGE (struct GNUNET_ClientHandle *sock,
const GNUNET_MessageHeader * req)
{
int ret;
const CS_fs_request_delete_MESSAGE *rd;
- Datastore_Value *value;
+ GNUNET_DatastoreValue *value;
GNUNET_HashCode query;
unsigned int type;
#if DEBUG_FS
GNUNET_EncName enc;
#endif
- struct GE_Context *cectx;
+ struct GNUNET_GE_Context *cectx;
cectx =
- coreAPI->createClientLogContext (GE_USER | GE_EVENTKIND | GE_ROUTEKIND,
+ coreAPI->createClientLogContext (GNUNET_GE_USER | GNUNET_GE_EVENTKIND |
GNUNET_GE_ROUTEKIND,
sock);
if (ntohs (req->size) < sizeof (CS_fs_request_delete_MESSAGE))
{
- GE_BREAK (ectx, 0);
- GE_BREAK (cectx, 0);
- GE_free_context (cectx);
+ GNUNET_GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (cectx, 0);
+ GNUNET_GE_free_context (cectx);
return GNUNET_SYSERR;
}
rd = (const CS_fs_request_delete_MESSAGE *) req;
- value = GNUNET_malloc (sizeof (Datastore_Value) +
+ value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) +
ntohs (req->size) -
sizeof (CS_fs_request_delete_MESSAGE));
value->size =
- ntohl (sizeof (Datastore_Value) + ntohs (req->size) -
+ ntohl (sizeof (GNUNET_DatastoreValue) + ntohs (req->size) -
sizeof (CS_fs_request_delete_MESSAGE));
type =
getTypeOfBlock (ntohs (rd->header.size) -
@@ -596,15 +596,15 @@
(const DBlock *) &rd[1], GNUNET_NO, &query))
{
GNUNET_free (value);
- GE_BREAK (ectx, 0);
- GE_BREAK (cectx, 0);
- GE_free_context (cectx);
+ GNUNET_GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (cectx, 0);
+ GNUNET_GE_free_context (cectx);
return GNUNET_SYSERR;
}
#if DEBUG_FS
- IF_GELOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&query, &enc));
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"FS received REQUEST DELETE (query: `%s', type: %u)\n", &enc, type);
#endif
GNUNET_mutex_lock (lock);
@@ -615,12 +615,12 @@
GNUNET_mutex_unlock (lock);
GNUNET_free (value);
#if DEBUG_FS
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Sending confirmation (%s) of delete request to client\n",
ret != GNUNET_SYSERR ? "success" : "failure");
#endif
- GE_free_context (cectx);
+ GNUNET_GE_free_context (cectx);
return coreAPI->sendValueToClient (sock, ret);
}
@@ -628,31 +628,31 @@
* Process a client request unindex content.
*/
static int
-csHandleCS_fs_request_unindex_MESSAGE (struct ClientHandle *sock,
+csHandleCS_fs_request_unindex_MESSAGE (struct GNUNET_ClientHandle *sock,
const GNUNET_MessageHeader * req)
{
int ret;
const CS_fs_request_unindex_MESSAGE *ru;
- struct GE_Context *cectx;
+ struct GNUNET_GE_Context *cectx;
cectx =
- coreAPI->createClientLogContext (GE_USER | GE_EVENTKIND | GE_ROUTEKIND,
+ coreAPI->createClientLogContext (GNUNET_GE_USER | GNUNET_GE_EVENTKIND |
GNUNET_GE_ROUTEKIND,
sock);
if (ntohs (req->size) != sizeof (CS_fs_request_unindex_MESSAGE))
{
- GE_BREAK (ectx, 0);
- GE_BREAK (cectx, 0);
- GE_free_context (cectx);
+ GNUNET_GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (cectx, 0);
+ GNUNET_GE_free_context (cectx);
return GNUNET_SYSERR;
}
ru = (const CS_fs_request_unindex_MESSAGE *) req;
#if DEBUG_FS
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER, "FS received REQUEST UNINDEX\n");
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, "FS received
REQUEST UNINDEX\n");
#endif
ret = ONDEMAND_unindex (cectx,
datastore, ntohl (ru->blocksize), &ru->fileId);
- GE_free_context (cectx);
+ GNUNET_GE_free_context (cectx);
return coreAPI->sendValueToClient (sock, ret);
}
@@ -661,7 +661,7 @@
* data is indexed.
*/
static int
-csHandleCS_fs_request_test_index_MESSAGEed (struct ClientHandle *sock,
+csHandleCS_fs_request_test_index_MESSAGEed (struct GNUNET_ClientHandle *sock,
const GNUNET_MessageHeader * req)
{
int ret;
@@ -669,13 +669,13 @@
if (ntohs (req->size) != sizeof (RequestTestindex))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
ru = (const RequestTestindex *) req;
#if DEBUG_FS
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"FS received REQUEST TESTINDEXED\n");
#endif
ret = ONDEMAND_testindexed (datastore, &ru->fileId);
@@ -687,12 +687,12 @@
* averge priority.
*/
static int
-csHandleRequestGetAvgPriority (struct ClientHandle *sock,
+csHandleRequestGetAvgPriority (struct GNUNET_ClientHandle *sock,
const GNUNET_MessageHeader * req)
{
#if DEBUG_FS
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"FS received REQUEST GETAVGPRIORITY\n");
#endif
return coreAPI->sendValueToClient (sock, gap->getAvgPriority ());
@@ -703,7 +703,7 @@
*/
typedef struct
{
- DataProcessor resultCallback;
+ GNUNET_DataProcessor resultCallback;
void *resCallbackClosure;
unsigned int keyCount;
const GNUNET_HashCode *keys;
@@ -711,13 +711,13 @@
} GGC;
/**
- * Callback that converts the Datastore_Value values
- * from the datastore to Blockstore values for the
+ * Callback that converts the GNUNET_DatastoreValue values
+ * from the datastore to GNUNET_Blockstore values for the
* gap routing protocol.
*/
static int
gapGetConverter (const GNUNET_HashCode * key,
- const Datastore_Value * invalue, void *cls,
+ const GNUNET_DatastoreValue * invalue, void *cls,
unsigned long long uid)
{
GGC *ggc = (GGC *) cls;
@@ -726,8 +726,8 @@
unsigned int size;
GNUNET_CronTime et;
GNUNET_CronTime now;
- const Datastore_Value *value;
- Datastore_Value *xvalue;
+ const GNUNET_DatastoreValue *value;
+ GNUNET_DatastoreValue *xvalue;
unsigned int level;
GNUNET_EncName enc;
#if EXTRA_CHECKS
@@ -735,20 +735,20 @@
#endif
#if DEBUG_FS
- IF_GELOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (key, &enc));
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Converting reply for query `%s' for gap.\n", &enc);
#endif
et = GNUNET_ntohll (invalue->expirationTime);
now = GNUNET_get_time ();
- if ((et <= now) && (ntohl (invalue->type) != D_BLOCK))
+ if ((et <= now) && (ntohl (invalue->type) !=
GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA))
{
/* content expired and not just data -- drop! */
return GNUNET_OK;
}
- if (ntohl (invalue->type) == ONDEMAND_BLOCK)
+ if (ntohl (invalue->type) == GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND)
{
if (GNUNET_OK != ONDEMAND_getIndexed (datastore, invalue, key, &xvalue))
return GNUNET_SYSERR;
@@ -761,23 +761,23 @@
}
#if EXTRA_CHECKS
if ((GNUNET_OK !=
- getQueryFor (ntohl (value->size) - sizeof (Datastore_Value),
+ getQueryFor (ntohl (value->size) - sizeof (GNUNET_DatastoreValue),
(const DBlock *) &value[1], GNUNET_YES, &hc))
|| (!equalsGNUNET_HashCode (&hc, key)))
{
- GE_BREAK (ectx, 0); /* value failed verification! */
+ GNUNET_GE_BREAK (ectx, 0); /* value failed verification! */
return GNUNET_SYSERR;
}
#endif
ret = isDatumApplicable (ntohl (value->type),
- ntohl (value->size) - sizeof (Datastore_Value),
+ ntohl (value->size) - sizeof
(GNUNET_DatastoreValue),
(const DBlock *) &value[1],
key, ggc->keyCount, ggc->keys);
if (ret == GNUNET_SYSERR)
{
- IF_GELOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ IF_GELOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
GNUNET_hash_to_enc (key, &enc));
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
"Converting reply for query `%s' for gap failed (datum not
applicable).\n",
&enc);
GNUNET_free_non_null (xvalue);
@@ -785,9 +785,9 @@
}
if (ret == GNUNET_NO)
{
- IF_GELOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ IF_GELOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
GNUNET_hash_to_enc (key, &enc));
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
"Converting reply for query `%s' for gap failed (type not
applicable).\n",
&enc);
GNUNET_free_non_null (xvalue);
@@ -795,7 +795,7 @@
i.e., namespace request and namespace
in reply does not match namespace in query
*/
}
- size = sizeof (GapWrapper) + ntohl (value->size) - sizeof (Datastore_Value);
+ size = sizeof (GapWrapper) + ntohl (value->size) - sizeof
(GNUNET_DatastoreValue);
level = ntohl (value->anonymityLevel);
if (GNUNET_OK != checkCoverTraffic (ectx, traffic, level))
@@ -804,9 +804,9 @@
refuse to hand out data that requires
anonymity! */
GNUNET_free_non_null (xvalue);
- IF_GELOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ IF_GELOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
GNUNET_hash_to_enc (key, &enc));
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
"Converting reply for query `%s' for gap failed (insufficient
cover traffic).\n",
&enc);
return GNUNET_OK;
@@ -849,16 +849,16 @@
unsigned int prio,
unsigned int keyCount,
const GNUNET_HashCode * keys,
- DataProcessor resultCallback, void *resCallbackClosure)
+ GNUNET_DataProcessor resultCallback, void *resCallbackClosure)
{
int ret;
GGC myClosure;
#if DEBUG_FS
GNUNET_EncName enc;
- IF_GELOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&keys[0], &enc));
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"GAP requests content for `%s' of type %u\n", &enc, type);
#endif
myClosure.count = 0;
@@ -867,10 +867,10 @@
myClosure.resultCallback = resultCallback;
myClosure.resCallbackClosure = resCallbackClosure;
ret = GNUNET_OK;
- if (type == D_BLOCK)
+ if (type == GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA)
{
ret = datastore->get (&keys[0],
- ONDEMAND_BLOCK, &gapGetConverter, &myClosure);
+ GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND,
&gapGetConverter, &myClosure);
}
if (ret != GNUNET_SYSERR)
ret = datastore->get (&keys[0], type, &gapGetConverter, &myClosure);
@@ -890,9 +890,9 @@
*/
static int
gapDel (void *closure, const GNUNET_HashCode * key,
- const DataContainer * value)
+ const GNUNET_DataContainer * value)
{
- GE_BREAK (ectx, 0); /* gap does not use 'del'! */
+ GNUNET_GE_BREAK (ectx, 0); /* gap does not use 'del'! */
return GNUNET_SYSERR;
}
@@ -904,14 +904,14 @@
* @return number of results, GNUNET_SYSERR on error
*/
static int
-gapIterate (void *closure, DataProcessor processor, void *cls)
+gapIterate (void *closure, GNUNET_DataProcessor processor, void *cls)
{
- GE_BREAK (ectx, 0); /* gap does not use 'iterate' */
+ GNUNET_GE_BREAK (ectx, 0); /* gap does not use 'iterate' */
return GNUNET_SYSERR;
}
static int
-replyHashFunction (const DataContainer * content, GNUNET_HashCode * id)
+replyHashFunction (const GNUNET_DataContainer * content, GNUNET_HashCode * id)
{
const GapWrapper *gw;
unsigned int size;
@@ -919,7 +919,7 @@
size = ntohl (content->size);
if (size < sizeof (GapWrapper))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
memset (id, 0, sizeof (GNUNET_HashCode));
return GNUNET_SYSERR;
}
@@ -929,7 +929,7 @@
}
static int
-uniqueReplyIdentifier (const DataContainer * content,
+uniqueReplyIdentifier (const GNUNET_DataContainer * content,
unsigned int type,
int verify, const GNUNET_HashCode * primaryKey)
{
@@ -941,7 +941,7 @@
size = ntohl (content->size);
if (size < sizeof (GapWrapper))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_NO;
}
gw = (const GapWrapper *) content;
@@ -951,13 +951,13 @@
&q)) &&
(0 == memcmp (&q,
primaryKey, sizeof (GNUNET_HashCode))) &&
- ((type == ANY_BLOCK) ||
+ ((type == GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY) ||
(type == (t = getTypeOfBlock (size - sizeof (GapWrapper),
(const DBlock *) &gw[1])))))
{
switch (type)
{
- case D_BLOCK:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA:
return GNUNET_YES;
default:
return GNUNET_NO;
@@ -969,9 +969,9 @@
static int
fastPathProcessor (const GNUNET_HashCode * query,
- const DataContainer * value, void *cls)
+ const GNUNET_DataContainer * value, void *cls)
{
- Datastore_Value *dv;
+ GNUNET_DatastoreValue *dv;
dv = gapWrapperToDatastoreValue (value, 0);
if (dv == NULL)
@@ -988,10 +988,10 @@
*/
static int
fastPathProcessorFirst (const GNUNET_HashCode * query,
- const DataContainer * value, void *cls)
+ const GNUNET_DataContainer * value, void *cls)
{
int *done = cls;
- Datastore_Value *dv;
+ GNUNET_DatastoreValue *dv;
dv = gapWrapperToDatastoreValue (value, 0);
if (dv == NULL)
@@ -1026,7 +1026,7 @@
GNUNET_mutex_unlock (lock);
gapGet (NULL,
job->type,
- EXTREME_PRIORITY,
+ GNUNET_EXTREME_PRIORITY,
job->keyCount, job->queries, &fastPathProcessor, NULL);
GNUNET_free (job->queries);
GNUNET_free (job);
@@ -1057,7 +1057,7 @@
* @return GNUNET_SYSERR if the TCP connection should be closed, otherwise
GNUNET_OK
*/
static int
-csHandleRequestQueryStart (struct ClientHandle *sock,
+csHandleRequestQueryStart (struct GNUNET_ClientHandle *sock,
const GNUNET_MessageHeader * req)
{
static GNUNET_PeerIdentity all_zeros;
@@ -1072,7 +1072,7 @@
if (ntohs (req->size) < sizeof (CS_fs_request_search_MESSAGE))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
rs = (const CS_fs_request_search_MESSAGE *) req;
@@ -1082,9 +1082,9 @@
have_target = GNUNET_YES;
#if DEBUG_FS
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&rs->query[0], &enc));
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"FS received QUERY START (query: `%s', ttl %llu, priority %u,
anonymity %u)\n",
&enc, GNUNET_ntohll (rs->expiration) - GNUNET_get_time (),
ntohl (rs->prio), ntohl (rs->anonymityLevel));
@@ -1099,13 +1099,13 @@
done = GNUNET_NO;
gapGet (NULL,
type,
- EXTREME_PRIORITY,
+ GNUNET_EXTREME_PRIORITY,
keyCount, &rs->query[0], &fastPathProcessorFirst, &done);
if (done == GNUNET_YES)
{
#if DEBUG_FS
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"FS successfully took GAP shortcut for `%s'.\n", &enc);
#endif
return GNUNET_OK;
@@ -1150,33 +1150,33 @@
* @return GNUNET_SYSERR on errors
*/
int
-initialize_module_fs (CoreAPIForApplication * capi)
+initialize_module_fs (GNUNET_CoreAPIForPlugins * capi)
{
- static Blockstore dsGap;
+ static GNUNET_Blockstore dsGap;
unsigned long long quota;
ectx = capi->ectx;
- GE_ASSERT (ectx, sizeof (CHK) == 128);
- GE_ASSERT (ectx, sizeof (DBlock) == 4);
- GE_ASSERT (ectx, sizeof (IBlock) == 132);
- GE_ASSERT (ectx, sizeof (KBlock) == 524);
- GE_ASSERT (ectx, sizeof (SBlock) == 724);
- GE_ASSERT (ectx, sizeof (NBlock) == 716);
- GE_ASSERT (ectx, sizeof (KNBlock) == 1244);
- migration = GC_get_configuration_value_yesno (capi->cfg,
+ GNUNET_GE_ASSERT (ectx, sizeof (CHK) == 128);
+ GNUNET_GE_ASSERT (ectx, sizeof (DBlock) == 4);
+ GNUNET_GE_ASSERT (ectx, sizeof (IBlock) == 132);
+ GNUNET_GE_ASSERT (ectx, sizeof (KBlock) == 524);
+ GNUNET_GE_ASSERT (ectx, sizeof (SBlock) == 724);
+ GNUNET_GE_ASSERT (ectx, sizeof (NBlock) == 716);
+ GNUNET_GE_ASSERT (ectx, sizeof (KNBlock) == 1244);
+ migration = GNUNET_GC_get_configuration_value_yesno (capi->cfg,
"FS", "ACTIVEMIGRATION",
GNUNET_YES);
if (migration == GNUNET_SYSERR)
return GNUNET_SYSERR;
- if (GC_get_configuration_value_number (capi->cfg,
+ if (GNUNET_GC_get_configuration_value_number (capi->cfg,
"FS",
"QUOTA",
1,
((unsigned long long) -1) / 1024,
1024, "a) == -1)
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_
("You must specify a postive number for `%s' in the
configuration in section `%s'.\n"),
"QUOTA", "FS");
@@ -1185,7 +1185,7 @@
datastore = capi->requestService ("datastore");
if (datastore == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
traffic = capi->requestService ("traffic");
@@ -1200,7 +1200,7 @@
gap = capi->requestService ("gap");
if (gap == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
capi->releaseService (datastore);
if (stats != NULL)
capi->releaseService (stats);
@@ -1213,7 +1213,7 @@
ltgSignal = GNUNET_semaphore_create (0);
localGetProcessor = GNUNET_thread_create (&localGetter, NULL, 128 * 1024);
if (localGetProcessor == NULL)
- GE_DIE_STRERROR (ectx, GE_ADMIN | GE_FATAL | GE_BULK, "pthread_create");
+ GNUNET_GE_DIE_STRERROR (ectx, GNUNET_GE_ADMIN | GNUNET_GE_FATAL |
GNUNET_GE_BULK, "pthread_create");
coreAPI = capi;
ONDEMAND_init (capi);
lock = GNUNET_mutex_create (GNUNET_NO);
@@ -1225,58 +1225,58 @@
dsGap.fast_get = &fastGet;
initQueryManager (capi);
gap->init (&dsGap,
- &uniqueReplyIdentifier, (ReplyHashFunction) & replyHashFunction);
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ &uniqueReplyIdentifier, (GNUNET_ReplyHashingCallback) &
replyHashFunction);
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("`%s' registering client handlers %d %d %d %d %d %d %d %d %d\n"),
"fs",
- CS_PROTO_gap_QUERY_START,
- CS_PROTO_gap_QUERY_STOP,
- CS_PROTO_gap_INSERT,
- CS_PROTO_gap_INDEX,
- CS_PROTO_gap_DELETE,
- CS_PROTO_gap_UNINDEX,
- CS_PROTO_gap_TESTINDEX,
- CS_PROTO_gap_GET_AVG_PRIORITY, CS_PROTO_gap_INIT_INDEX);
+ GNUNET_CS_PROTO_GAP_QUERY_START,
+ GNUNET_CS_PROTO_GAP_QUERY_STOP,
+ GNUNET_CS_PROTO_GAP_INSERT,
+ GNUNET_CS_PROTO_GAP_INDEX,
+ GNUNET_CS_PROTO_GAP_DELETE,
+ GNUNET_CS_PROTO_GAP_UNINDEX,
+ GNUNET_CS_PROTO_GAP_TESTINDEX,
+ GNUNET_CS_PROTO_GAP_GET_AVG_PRIORITY,
GNUNET_CS_PROTO_GAP_INIT_INDEX);
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- capi->registerClientHandler (CS_PROTO_gap_QUERY_START,
+ capi->registerClientHandler (GNUNET_CS_PROTO_GAP_QUERY_START,
&csHandleRequestQueryStart));
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- capi->registerClientHandler (CS_PROTO_gap_QUERY_STOP,
+ capi->registerClientHandler (GNUNET_CS_PROTO_GAP_QUERY_STOP,
&csHandleRequestQueryStop));
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- capi->registerClientHandler (CS_PROTO_gap_INSERT,
+ capi->registerClientHandler (GNUNET_CS_PROTO_GAP_INSERT,
&csHandleCS_fs_request_insert_MESSAGE));
- GE_ASSERT (ectx,
- GNUNET_SYSERR != capi->registerClientHandler (CS_PROTO_gap_INDEX,
+ GNUNET_GE_ASSERT (ectx,
+ GNUNET_SYSERR != capi->registerClientHandler
(GNUNET_CS_PROTO_GAP_INDEX,
&csHandleCS_fs_request_index_MESSAGE));
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- capi->registerClientHandler (CS_PROTO_gap_INIT_INDEX,
+ capi->registerClientHandler (GNUNET_CS_PROTO_GAP_INIT_INDEX,
&csHandleCS_fs_request_init_index_MESSAGE));
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- capi->registerClientHandler (CS_PROTO_gap_DELETE,
+ capi->registerClientHandler (GNUNET_CS_PROTO_GAP_DELETE,
&csHandleCS_fs_request_delete_MESSAGE));
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- capi->registerClientHandler (CS_PROTO_gap_UNINDEX,
+ capi->registerClientHandler (GNUNET_CS_PROTO_GAP_UNINDEX,
&csHandleCS_fs_request_unindex_MESSAGE));
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- capi->registerClientHandler (CS_PROTO_gap_TESTINDEX,
+ capi->registerClientHandler (GNUNET_CS_PROTO_GAP_TESTINDEX,
&csHandleCS_fs_request_test_index_MESSAGEed));
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- capi->registerClientHandler (CS_PROTO_gap_GET_AVG_PRIORITY,
+ capi->registerClientHandler (GNUNET_CS_PROTO_GAP_GET_AVG_PRIORITY,
&csHandleRequestGetAvgPriority));
initMigration (capi, datastore, gap, dht, traffic);
- GE_ASSERT (capi->ectx,
- 0 == GC_set_configuration_value_string (capi->cfg,
+ GNUNET_GE_ASSERT (capi->ectx,
+ 0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
capi->ectx,
"ABOUT",
"fs",
@@ -1291,43 +1291,43 @@
LG_Job *job;
void *unused;
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER, "fs shutdown\n");
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"fs shutdown\n");
doneMigration ();
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- coreAPI->unregisterClientHandler (CS_PROTO_gap_QUERY_START,
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_GAP_QUERY_START,
&csHandleRequestQueryStart));
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- coreAPI->unregisterClientHandler (CS_PROTO_gap_QUERY_STOP,
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_GAP_QUERY_STOP,
&csHandleRequestQueryStop));
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- coreAPI->unregisterClientHandler (CS_PROTO_gap_INSERT,
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_GAP_INSERT,
&csHandleCS_fs_request_insert_MESSAGE));
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- coreAPI->unregisterClientHandler (CS_PROTO_gap_INDEX,
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_GAP_INDEX,
&csHandleCS_fs_request_index_MESSAGE));
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- coreAPI->unregisterClientHandler (CS_PROTO_gap_INIT_INDEX,
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_GAP_INIT_INDEX,
&csHandleCS_fs_request_init_index_MESSAGE));
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- coreAPI->unregisterClientHandler (CS_PROTO_gap_DELETE,
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_GAP_DELETE,
&csHandleCS_fs_request_delete_MESSAGE));
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- coreAPI->unregisterClientHandler (CS_PROTO_gap_UNINDEX,
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_GAP_UNINDEX,
&csHandleCS_fs_request_unindex_MESSAGE));
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- coreAPI->unregisterClientHandler (CS_PROTO_gap_TESTINDEX,
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_GAP_TESTINDEX,
&csHandleCS_fs_request_test_index_MESSAGEed));
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- coreAPI->unregisterClientHandler (CS_PROTO_gap_GET_AVG_PRIORITY,
+ coreAPI->unregisterClientHandler
(GNUNET_CS_PROTO_GAP_GET_AVG_PRIORITY,
&csHandleRequestGetAvgPriority));
doneQueryManager ();
while (lg_jobs != NULL)
@@ -1371,7 +1371,7 @@
* Update FS module.
*/
void
-update_module_fs (UpdateAPI * uapi)
+update_module_fs (GNUNET_UpdateAPI * uapi)
{
/* general sub-module updates */
uapi->updateModule ("datastore");
Modified: GNUnet/src/applications/fs/module/migration.c
===================================================================
--- GNUnet/src/applications/fs/module/migration.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/module/migration.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -61,29 +61,29 @@
/**
* Datastore service.
*/
-static Datastore_ServiceAPI *datastore;
+static GNUNET_Datastore_ServiceAPI *datastore;
/**
* Global core API.
*/
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
/**
* GAP service.
*/
-static GAP_ServiceAPI *gap;
+static GNUNET_GAP_ServiceAPI *gap;
/**
* DHT service. Maybe NULL!
*/
-static DHT_ServiceAPI *dht;
+static GNUNET_DHT_ServiceAPI *dht;
/**
* Traffic service.
*/
-static Traffic_ServiceAPI *traffic;
+static GNUNET_Traffic_ServiceAPI *traffic;
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
static int stat_migration_count;
@@ -98,7 +98,7 @@
struct MigrationRecord
{
- Datastore_Value *value;
+ GNUNET_DatastoreValue *value;
GNUNET_HashCode key;
unsigned int receiverIndices[MAX_RECEIVERS];
unsigned int sentCount;
@@ -106,7 +106,7 @@
static struct MigrationRecord content[MAX_RECORDS];
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
/**
* Callback method for pushing content into the network.
@@ -134,8 +134,8 @@
GNUNET_CronTime et;
GNUNET_CronTime now;
unsigned int anonymity;
- Datastore_Value *enc;
- Datastore_Value *value;
+ GNUNET_DatastoreValue *enc;
+ GNUNET_DatastoreValue *value;
unsigned int index;
int entry;
int discard_entry;
@@ -174,7 +174,7 @@
}
match = 1;
if (ntohl (content[i].value->size) + sizeof (GapWrapper) -
- sizeof (Datastore_Value) <= padding)
+ sizeof (GNUNET_DatastoreValue) <= padding)
{
match = 0;
for (j = 0; j < content[i].sentCount; j++)
@@ -232,8 +232,8 @@
if (entry == -1)
{
#if DEBUG_MIGRATION
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Migration: no content available for migration.\n");
#endif
GNUNET_mutex_unlock (lock);
@@ -242,16 +242,16 @@
value = content[entry].value;
if (value == NULL)
{
- GE_ASSERT (NULL, 0);
+ GNUNET_GE_ASSERT (NULL, 0);
GNUNET_mutex_unlock (lock);
return 0;
}
- size = sizeof (GapWrapper) + ntohl (value->size) - sizeof (Datastore_Value);
+ size = sizeof (GapWrapper) + ntohl (value->size) - sizeof
(GNUNET_DatastoreValue);
if (size > padding)
{
#if DEBUG_MIGRATION
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Migration: available content too big (%u > %u) for
migration.\n",
size, padding);
#endif
@@ -259,12 +259,12 @@
return 0;
}
#if DEBUG_MIGRATION
- GE_LOG (ectx,
- GE_DEBUG | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_USER,
"Migration: random lookup in datastore returned type %d.\n",
ntohl (value->type));
#endif
- if (ntohl (value->type) == ONDEMAND_BLOCK)
+ if (ntohl (value->type) == GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND)
{
if (ONDEMAND_getIndexed (datastore,
value, &content[entry].key, &enc) != GNUNET_OK)
@@ -273,8 +273,8 @@
content[entry].value = NULL;
GNUNET_mutex_unlock (lock);
#if DEBUG_MIGRATION
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Migration: failed to locate indexed content for
migration.\n");
#endif
return 0;
@@ -286,13 +286,13 @@
value = enc;
}
- size = sizeof (GapWrapper) + ntohl (value->size) - sizeof (Datastore_Value);
+ size = sizeof (GapWrapper) + ntohl (value->size) - sizeof
(GNUNET_DatastoreValue);
if (size > padding)
{
GNUNET_mutex_unlock (lock);
#if DEBUG_MIGRATION
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Migration: available content too big (%u > %u) for
migration.\n",
size, padding);
#endif
@@ -321,8 +321,8 @@
ret = gap->tryMigrate (&gw->dc, &content[entry].key, position, padding);
GNUNET_free (gw);
#if DEBUG_MIGRATION
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"gap's tryMigrate returned %u\n", ret);
#endif
if (ret != 0)
@@ -342,8 +342,8 @@
else
{
#if DEBUG_MIGRATION
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Migration: not enough cover traffic\n");
#endif
}
@@ -351,14 +351,14 @@
GNUNET_mutex_unlock (lock);
if ((ret > 0) && (stats != NULL))
stats->change (stat_migration_count, 1);
- GE_BREAK (NULL, ret <= padding);
+ GNUNET_GE_BREAK (NULL, ret <= padding);
return ret;
}
void
-initMigration (CoreAPIForApplication * capi,
- Datastore_ServiceAPI * ds,
- GAP_ServiceAPI * g, DHT_ServiceAPI * d, Traffic_ServiceAPI * t)
+initMigration (GNUNET_CoreAPIForPlugins * capi,
+ GNUNET_Datastore_ServiceAPI * ds,
+ GNUNET_GAP_ServiceAPI * g, GNUNET_DHT_ServiceAPI * d,
GNUNET_Traffic_ServiceAPI * t)
{
ectx = capi->ectx;
lock = GNUNET_mutex_create (GNUNET_NO);
@@ -367,7 +367,7 @@
gap = g;
dht = d;
traffic = t;
- coreAPI->registerSendCallback (GAP_ESTIMATED_DATA_SIZE,
+ coreAPI->registerSendCallback (GNUNET_GAP_ESTIMATED_DATA_SIZE,
&activeMigrationCallback);
stats = capi->requestService ("stats");
if (stats != NULL)
@@ -387,7 +387,7 @@
doneMigration ()
{
int i;
- coreAPI->unregisterSendCallback (GAP_ESTIMATED_DATA_SIZE,
+ coreAPI->unregisterSendCallback (GNUNET_GAP_ESTIMATED_DATA_SIZE,
&activeMigrationCallback);
if (stats != NULL)
{
Modified: GNUnet/src/applications/fs/module/migration.h
===================================================================
--- GNUnet/src/applications/fs/module/migration.h 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/module/migration.h 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -81,10 +81,10 @@
/**
* Initialize the migration module.
*/
-void initMigration (CoreAPIForApplication * capi,
- Datastore_ServiceAPI * s,
- GAP_ServiceAPI * g,
- DHT_ServiceAPI * d, Traffic_ServiceAPI * t);
+void initMigration (GNUNET_CoreAPIForPlugins * capi,
+ GNUNET_Datastore_ServiceAPI * s,
+ GNUNET_GAP_ServiceAPI * g,
+ GNUNET_DHT_ServiceAPI * d, GNUNET_Traffic_ServiceAPI * t);
void doneMigration (void);
Modified: GNUnet/src/applications/fs/module/ondemand.c
===================================================================
--- GNUnet/src/applications/fs/module/ondemand.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/module/ondemand.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -42,7 +42,7 @@
*/
typedef struct
{
- Datastore_Value header;
+ GNUNET_DatastoreValue header;
unsigned int type;
@@ -69,11 +69,11 @@
static char *index_directory;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
-static State_ServiceAPI *state;
+static GNUNET_State_ServiceAPI *state;
static char *
getOnDemandFile (const GNUNET_HashCode * fileId)
@@ -97,15 +97,15 @@
*/
static int
checkPresent (const GNUNET_HashCode * key,
- const Datastore_Value * value, void *closure,
+ const GNUNET_DatastoreValue * value, void *closure,
unsigned long long uid)
{
- Datastore_Value *comp = closure;
+ GNUNET_DatastoreValue *comp = closure;
if ((comp->size != value->size) ||
(0 != memcmp (&value[1],
&comp[1],
- ntohl (value->size) - sizeof (Datastore_Value))))
+ ntohl (value->size) - sizeof (GNUNET_DatastoreValue))))
return GNUNET_OK;
return GNUNET_SYSERR;
}
@@ -119,7 +119,7 @@
* GNUNET_YES on success
*/
int
-ONDEMAND_initIndex (struct GE_Context *cectx,
+ONDEMAND_initIndex (struct GNUNET_GE_Context *cectx,
const GNUNET_HashCode * fileId, const char *fn)
{
GNUNET_EncName enc;
@@ -145,11 +145,11 @@
GNUNET_disk_directory_create_for_file (cectx, serverFN);
if (0 != SYMLINK (fn, serverFN))
{
- GE_LOG_STRERROR_FILE (cectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (cectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER
| GNUNET_GE_BULK,
"symlink", fn);
- GE_LOG_STRERROR_FILE (cectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (cectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER
| GNUNET_GE_BULK,
"symlink", serverFN);
GNUNET_free (serverFN);
return GNUNET_NO;
@@ -168,8 +168,8 @@
* GNUNET_SYSERR on other error (i.e. datastore full)
*/
int
-ONDEMAND_index (struct GE_Context *cectx,
- Datastore_ServiceAPI * datastore,
+ONDEMAND_index (struct GNUNET_GE_Context *cectx,
+ GNUNET_Datastore_ServiceAPI * datastore,
unsigned int prio,
GNUNET_CronTime expiration,
unsigned long long fileOffset,
@@ -189,8 +189,8 @@
if (size <= sizeof (DBlock))
{
- GE_BREAK (cectx, 0);
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (cectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
@@ -205,8 +205,8 @@
/* not sym-linked, write content to offset! */
#if DEBUG_ONDEMAND
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Storing on-demand encoded data in `%s'.\n", fn);
#endif
fd = GNUNET_disk_file_open (cectx, fn, O_LARGEFILE | O_CREAT | O_WRONLY,
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); /* 644 */
@@ -223,8 +223,8 @@
}
else
{
- GE_LOG_STRERROR_FILE (cectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (cectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_USER | GNUNET_GE_BULK,
"write", fn);
ret = GNUNET_SYSERR;
}
@@ -238,11 +238,11 @@
GNUNET_free (fn);
odb.header.size = htonl (sizeof (OnDemandBlock));
- odb.header.type = htonl (ONDEMAND_BLOCK);
+ odb.header.type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND);
odb.header.prio = htonl (prio);
odb.header.anonymityLevel = htonl (anonymityLevel);
odb.header.expirationTime = GNUNET_htonll (expiration);
- odb.type = htonl (ONDEMAND_BLOCK);
+ odb.type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND);
odb.fileOffset = GNUNET_htonll (fileOffset);
odb.blockSize = htonl (size - sizeof (DBlock));
odb.fileId = *fileId;
@@ -250,11 +250,11 @@
fileBlockGetQuery (content, size, &key);
#if EXTRA_CHECKS
{
- Datastore_Value *dsvalue;
+ GNUNET_DatastoreValue *dsvalue;
if (GNUNET_OK != fileBlockEncode (content, size, &key, &dsvalue))
{
- GE_BREAK (cectx, 0);
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (cectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
}
else
{
@@ -264,13 +264,13 @@
#endif
#if DEBUG_ONDEMAND
- IF_GELOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&key, &enc));
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Storing on-demand content for query `%s'\n", &enc);
#endif
- ret = datastore->get (&key, ONDEMAND_BLOCK, &checkPresent, &odb.header);
+ ret = datastore->get (&key, GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND,
&checkPresent, &odb.header);
if (ret >= 0)
{
ret = datastore->put (&key, &odb.header);
@@ -284,8 +284,8 @@
struct adJ
{
- Datastore_ServiceAPI *datastore;
- Datastore_Value *dbv;
+ GNUNET_Datastore_ServiceAPI *datastore;
+ GNUNET_DatastoreValue *dbv;
GNUNET_HashCode query;
};
@@ -304,8 +304,8 @@
* a del operation during "get" would deadlock!
*/
static void
-asyncDelete (Datastore_ServiceAPI * datastore,
- const Datastore_Value * dbv, const GNUNET_HashCode * query)
+asyncDelete (GNUNET_Datastore_ServiceAPI * datastore,
+ const GNUNET_DatastoreValue * dbv, const GNUNET_HashCode * query)
{
struct adJ *job;
#if DEBUG_ONDEMAND
@@ -319,8 +319,8 @@
memcpy (job->dbv, dbv, ntohl (dbv->size));
#if DEBUG_ONDEMAND
GNUNET_hash_to_enc (query, &enc);
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("Indexed file disappeared, deleting block for query `%s'\n"),
&enc);
#endif
@@ -338,9 +338,9 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if there was an error
*/
int
-ONDEMAND_getIndexed (Datastore_ServiceAPI * datastore,
- const Datastore_Value * dbv,
- const GNUNET_HashCode * query, Datastore_Value ** enc)
+ONDEMAND_getIndexed (GNUNET_Datastore_ServiceAPI * datastore,
+ const GNUNET_DatastoreValue * dbv,
+ const GNUNET_HashCode * query, GNUNET_DatastoreValue **
enc)
{
char *fn;
char *iobuf;
@@ -352,7 +352,7 @@
if (ntohl (dbv->size) != sizeof (OnDemandBlock))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
odb = (OnDemandBlock *) dbv;
@@ -368,8 +368,8 @@
unsigned long long *first_unavail;
struct stat linkStat;
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
GNUNET_GE_USER | GNUNET_GE_BULK,
"open", fn);
/* Is the symlink there? */
@@ -407,7 +407,7 @@
(errno == ENAMETOOLONG) && (len < 4 * 1024 * 1024))
if (len * 2 < len)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_array_grow (ofn, len, 0);
GNUNET_free (fn);
return GNUNET_SYSERR;
@@ -416,8 +416,8 @@
if (ret != -1)
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_USER,
_
("Because the file `%s' has been unavailable for
3 days"
" it got removed from your share. Please
unindex files before"
@@ -466,8 +466,8 @@
fileOffset),
SEEK_SET))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
GNUNET_GE_USER | GNUNET_GE_BULK,
"lseek", fn);
GNUNET_free (fn);
CLOSE (fileHandle);
@@ -475,13 +475,13 @@
return GNUNET_SYSERR;
}
db = GNUNET_malloc (sizeof (DBlock) + ntohl (odb->blockSize));
- db->type = htonl (D_BLOCK);
+ db->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
iobuf = (char *) &db[1];
blen = READ (fileHandle, iobuf, ntohl (odb->blockSize));
if (blen != ntohl (odb->blockSize))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
GNUNET_GE_USER | GNUNET_GE_BULK,
"read", fn);
GNUNET_free (fn);
GNUNET_free (db);
@@ -497,8 +497,8 @@
GNUNET_free (fn);
if (ret == GNUNET_SYSERR)
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Indexed content changed (does not match its hash).\n"));
asyncDelete (datastore, dbv, query);
return GNUNET_SYSERR;
@@ -516,7 +516,7 @@
* @return GNUNET_YES if so, GNUNET_NO if not.
*/
int
-ONDEMAND_testindexed (Datastore_ServiceAPI * datastore,
+ONDEMAND_testindexed (GNUNET_Datastore_ServiceAPI * datastore,
const GNUNET_HashCode * fileId)
{
char *fn;
@@ -540,19 +540,19 @@
*/
static int
completeValue (const GNUNET_HashCode * key,
- const Datastore_Value * value, void *closure,
+ const GNUNET_DatastoreValue * value, void *closure,
unsigned long long uid)
{
- Datastore_Value *comp = closure;
+ GNUNET_DatastoreValue *comp = closure;
if ((comp->size != value->size) ||
(0 != memcmp (&value[1],
&comp[1],
- ntohl (value->size) - sizeof (Datastore_Value))))
+ ntohl (value->size) - sizeof (GNUNET_DatastoreValue))))
{
#if DEBUG_ONDEMAND
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"`%s' found value that does not match (%u, %u).\n",
__FUNCTION__, ntohl (comp->size), ntohl (value->size));
#endif
@@ -560,8 +560,8 @@
}
*comp = *value; /* make copy! */
#if DEBUG_ONDEMAND
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"`%s' found value that matches.\n", __FUNCTION__);
#endif
return GNUNET_SYSERR;
@@ -578,8 +578,8 @@
* the keys of the odb blocks).
*/
int
-ONDEMAND_unindex (struct GE_Context *cectx,
- Datastore_ServiceAPI * datastore,
+ONDEMAND_unindex (struct GNUNET_GE_Context *cectx,
+ GNUNET_Datastore_ServiceAPI * datastore,
unsigned int blocksize, const GNUNET_HashCode * fileId)
{
char *fn;
@@ -596,8 +596,8 @@
fn = getOnDemandFile (fileId);
#if DEBUG_ONDEMAND
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Removing on-demand encoded data stored in `%s'.\n", fn);
#endif
fd = GNUNET_disk_file_open (cectx, fn, O_RDONLY | O_LARGEFILE, S_IRUSR |
S_IWUSR | S_IRGRP | S_IROTH); /* 644 */
@@ -613,7 +613,7 @@
return GNUNET_SYSERR;
}
block = GNUNET_malloc (sizeof (DBlock) + blocksize);
- block->type = htonl (D_BLOCK);
+ block->type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA);
while (pos < size)
{
delta = size - pos;
@@ -621,8 +621,8 @@
delta = blocksize;
if (delta != READ (fd, &block[1], delta))
{
- GE_LOG_STRERROR_FILE (cectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (cectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_USER | GNUNET_GE_BULK,
"read", fn);
CLOSE (fd);
GNUNET_free (fn);
@@ -630,26 +630,26 @@
return GNUNET_SYSERR;
}
odb.header.size = htonl (sizeof (OnDemandBlock));
- odb.header.type = htonl (ONDEMAND_BLOCK);
+ odb.header.type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND);
odb.header.prio = 0;
odb.header.anonymityLevel = 0;
odb.header.expirationTime = 0;
- odb.type = htonl (ONDEMAND_BLOCK);
+ odb.type = htonl (GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND);
odb.fileOffset = GNUNET_htonll (pos);
odb.blockSize = htonl (delta);
odb.fileId = *fileId;
/* compute the primary key */
fileBlockGetQuery (block, delta + sizeof (DBlock), &key);
- if (GNUNET_SYSERR == datastore->get (&key, ONDEMAND_BLOCK,
&completeValue, &odb.header)) /* aborted == found! */
+ if (GNUNET_SYSERR == datastore->get (&key,
GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND, &completeValue, &odb.header)) /*
aborted == found! */
ret = datastore->del (&key, &odb.header);
else /* not found */
ret = GNUNET_SYSERR;
if (ret == GNUNET_SYSERR)
{
IF_GELOG (cectx,
- GE_WARNING | GE_BULK | GE_USER, GNUNET_hash_to_enc (&key,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
GNUNET_hash_to_enc (&key,
&enc));
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK |
GNUNET_GE_USER,
_
("Unindexed ODB block `%s' from offset %llu already missing
from datastore.\n"),
&enc, pos);
@@ -668,7 +668,7 @@
}
int
-ONDEMAND_init (CoreAPIForApplication * capi)
+ONDEMAND_init (GNUNET_CoreAPIForPlugins * capi)
{
char *tmp;
@@ -676,18 +676,18 @@
state = capi->requestService ("state");
if (state == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
ectx = capi->ectx;
- GC_get_configuration_value_filename (capi->cfg,
+ GNUNET_GC_get_configuration_value_filename (capi->cfg,
"GNUNETD",
"GNUNETD_HOME",
- VAR_DAEMON_DIRECTORY, &tmp);
- GE_ASSERT (ectx, NULL != tmp);
+ GNUNET_DEFAULT_DAEMON_VAR_DIRECTORY,
&tmp);
+ GNUNET_GE_ASSERT (ectx, NULL != tmp);
tmp = GNUNET_realloc (tmp, strlen (tmp) + strlen ("/data/shared/") + 1);
strcat (tmp, "/data/shared/");
- GC_get_configuration_value_filename (capi->cfg,
+ GNUNET_GC_get_configuration_value_filename (capi->cfg,
"FS",
"INDEX-DIRECTORY",
tmp, &index_directory);
Modified: GNUnet/src/applications/fs/module/ondemand.h
===================================================================
--- GNUnet/src/applications/fs/module/ondemand.h 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/module/ondemand.h 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -38,15 +38,15 @@
* @return GNUNET_SYSERR on error, GNUNET_NO if symlinking failed,
* GNUNET_YES on success
*/
-int ONDEMAND_initIndex (struct GE_Context *cectx,
+int ONDEMAND_initIndex (struct GNUNET_GE_Context *cectx,
const GNUNET_HashCode * fileId, const char *fn);
/**
* @return GNUNET_NO if already present, GNUNET_YES on success,
* GNUNET_SYSERR on other error (i.e. datastore full)
*/
-int ONDEMAND_index (struct GE_Context *cectx,
- Datastore_ServiceAPI * datastore,
+int ONDEMAND_index (struct GNUNET_GE_Context *cectx,
+ GNUNET_Datastore_ServiceAPI * datastore,
unsigned int prio,
GNUNET_CronTime expiration,
unsigned long long fileOffset,
@@ -62,10 +62,10 @@
* this function also removes the OD-Entry
* @return GNUNET_OK on success, GNUNET_SYSERR if there was an error
*/
-int ONDEMAND_getIndexed (Datastore_ServiceAPI * datastore,
- const Datastore_Value * odb,
+int ONDEMAND_getIndexed (GNUNET_Datastore_ServiceAPI * datastore,
+ const GNUNET_DatastoreValue * odb,
const GNUNET_HashCode * query,
- Datastore_Value ** enc);
+ GNUNET_DatastoreValue ** enc);
/**
* Unindex the file with the given ID. Removes the file from the
@@ -77,8 +77,8 @@
* up the file properly when computing
* the keys of the odb blocks).
*/
-int ONDEMAND_unindex (struct GE_Context *cectx,
- Datastore_ServiceAPI * datastore,
+int ONDEMAND_unindex (struct GNUNET_GE_Context *cectx,
+ GNUNET_Datastore_ServiceAPI * datastore,
unsigned int blocksize, const GNUNET_HashCode * fileId);
/**
@@ -86,10 +86,10 @@
* indexed.
* @return GNUNET_YES if so, GNUNET_NO if not.
*/
-int ONDEMAND_testindexed (Datastore_ServiceAPI * datastore,
+int ONDEMAND_testindexed (GNUNET_Datastore_ServiceAPI * datastore,
const GNUNET_HashCode * fileId);
-int ONDEMAND_init (CoreAPIForApplication * capi);
+int ONDEMAND_init (GNUNET_CoreAPIForPlugins * capi);
int ONDEMAND_done (void);
Modified: GNUnet/src/applications/fs/module/querymanager.c
===================================================================
--- GNUnet/src/applications/fs/module/querymanager.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/module/querymanager.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -38,14 +38,14 @@
{
GNUNET_HashCode query;
unsigned int type;
- struct ClientHandle *client;
+ struct GNUNET_ClientHandle *client;
} TrackRecord;
/**
* Stats service.
*/
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
static int stat_queries_tracked;
@@ -65,14 +65,14 @@
*/
static struct GNUNET_Mutex *queryManagerLock;
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
static void
removeEntry (unsigned int off)
{
- GE_ASSERT (ectx, off < trackerCount);
+ GNUNET_GE_ASSERT (ectx, off < trackerCount);
GNUNET_free (trackers[off]);
if (stats != NULL)
stats->change (stat_queries_tracked, -1);
@@ -83,7 +83,7 @@
}
static void
-ceh (struct ClientHandle *client)
+ceh (struct GNUNET_ClientHandle *client)
{
int i;
GNUNET_mutex_lock (queryManagerLock);
@@ -102,9 +102,9 @@
*/
void
trackQuery (const GNUNET_HashCode * query,
- unsigned int type, struct ClientHandle *client)
+ unsigned int type, struct GNUNET_ClientHandle *client)
{
- GE_ASSERT (ectx, client != NULL);
+ GNUNET_GE_ASSERT (ectx, client != NULL);
GNUNET_mutex_lock (queryManagerLock);
if (trackerSize == trackerCount)
GNUNET_array_grow (trackers, trackerSize, trackerSize * 2);
@@ -125,7 +125,7 @@
* @param client where did the query come from?
*/
void
-untrackQuery (const GNUNET_HashCode * query, struct ClientHandle *client)
+untrackQuery (const GNUNET_HashCode * query, struct GNUNET_ClientHandle
*client)
{
int i;
@@ -148,7 +148,7 @@
* @param value the response
*/
void
-processResponse (const GNUNET_HashCode * key, const Datastore_Value * value)
+processResponse (const GNUNET_HashCode * key, const GNUNET_DatastoreValue *
value)
{
int i;
CS_fs_reply_content_MESSAGE *rc;
@@ -157,14 +157,14 @@
GNUNET_EncName enc;
#endif
- GE_ASSERT (ectx, ntohl (value->size) > sizeof (Datastore_Value));
+ GNUNET_GE_ASSERT (ectx, ntohl (value->size) > sizeof
(GNUNET_DatastoreValue));
if ((GNUNET_ntohll (value->expirationTime) < GNUNET_get_time ()) &&
- (ntohl (value->type) != D_BLOCK))
+ (ntohl (value->type) != GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA))
return; /* ignore expired, non-data responses! */
matchCount = 0;
#if DEBUG_QUERYMANAGER
- IF_GELOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (key, &enc));
#endif
GNUNET_mutex_lock (queryManagerLock);
@@ -172,23 +172,23 @@
{
if ((0 == memcmp (&trackers[i]->query,
key, sizeof (GNUNET_HashCode))) &&
- ((trackers[i]->type == ANY_BLOCK) ||
+ ((trackers[i]->type == GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY) ||
(trackers[i]->type == ntohl (value->type))))
{
matchCount++;
rc = GNUNET_malloc (sizeof (CS_fs_reply_content_MESSAGE) +
- ntohl (value->size) - sizeof (Datastore_Value));
+ ntohl (value->size) - sizeof
(GNUNET_DatastoreValue));
rc->header.size = htons (sizeof (CS_fs_reply_content_MESSAGE) +
ntohl (value->size) -
- sizeof (Datastore_Value));
- rc->header.type = htons (CS_PROTO_gap_RESULT);
+ sizeof (GNUNET_DatastoreValue));
+ rc->header.type = htons (GNUNET_CS_PROTO_GAP_RESULT);
rc->anonymityLevel = value->anonymityLevel;
rc->expirationTime = value->expirationTime;
memcpy (&rc[1],
- &value[1], ntohl (value->size) - sizeof (Datastore_Value));
+ &value[1], ntohl (value->size) - sizeof
(GNUNET_DatastoreValue));
#if DEBUG_QUERYMANAGER
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Sending reply for `%s' to client waiting in slot %u.\n",
&enc, i);
#endif
@@ -201,8 +201,8 @@
#if DEBUG_QUERYMANAGER && 0
if (matchCount == 0)
{
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Reply `%s' did not match any request.\n", &enc);
}
#endif
@@ -213,7 +213,7 @@
* Initialize the query management.
*/
int
-initQueryManager (CoreAPIForApplication * capi)
+initQueryManager (GNUNET_CoreAPIForPlugins * capi)
{
coreAPI = capi;
ectx = capi->ectx;
Modified: GNUnet/src/applications/fs/module/querymanager.h
===================================================================
--- GNUnet/src/applications/fs/module/querymanager.h 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/module/querymanager.h 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -31,7 +31,7 @@
/**
* Initialize the query management.
*/
-int initQueryManager (CoreAPIForApplication * capi);
+int initQueryManager (GNUNET_CoreAPIForPlugins * capi);
/**
* Shutdown query management.
@@ -46,7 +46,7 @@
* @param client where did the query come from?
*/
void trackQuery (const GNUNET_HashCode * query,
- unsigned int type, struct ClientHandle *client);
+ unsigned int type, struct GNUNET_ClientHandle *client);
/**
* Stop keeping track of a query.
@@ -55,7 +55,7 @@
* @param client where did the query come from?
*/
void untrackQuery (const GNUNET_HashCode * query,
- struct ClientHandle *client);
+ struct GNUNET_ClientHandle *client);
/**
* We received a reply from 'responder'.
@@ -64,6 +64,6 @@
* @param value the response
*/
void processResponse (const GNUNET_HashCode * key,
- const Datastore_Value * value);
+ const GNUNET_DatastoreValue * value);
#endif
Modified: GNUnet/src/applications/fs/namespace/namespace_info.c
===================================================================
--- GNUnet/src/applications/fs/namespace/namespace_info.c 2007-11-25
03:50:33 UTC (rev 5754)
+++ GNUnet/src/applications/fs/namespace/namespace_info.c 2007-11-25
12:04:45 UTC (rev 5755)
@@ -39,7 +39,7 @@
struct DiscoveryCallback
{
struct DiscoveryCallback *next;
- NS_NamespaceIterator callback;
+ GNUNET_NS_NamespaceIterator callback;
void *closure;
};
@@ -53,7 +53,7 @@
static void
internal_notify (const char *name,
const GNUNET_HashCode * id,
- const struct ECRS_MetaData *md, int rating)
+ const struct GNUNET_ECRS_MetaData *md, int rating)
{
struct DiscoveryCallback *pos;
@@ -68,10 +68,10 @@
}
static void
-writeNamespaceInfo (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+writeNamespaceInfo (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *namespaceName,
- const struct ECRS_MetaData *meta, int ranking)
+ const struct GNUNET_ECRS_MetaData *meta, int ranking)
{
unsigned int size;
unsigned int tag;
@@ -80,10 +80,10 @@
char *fnBase;
- GC_get_configuration_value_filename (cfg,
+ GNUNET_GC_get_configuration_value_filename (cfg,
"GNUNET",
"GNUNET_HOME",
- GNUNET_HOME_DIRECTORY, &fnBase);
+ GNUNET_DEFAULT_HOME_DIRECTORY, &fnBase);
fn = GNUNET_malloc (strlen (fnBase) +
strlen (NS_DIR) + strlen (namespaceName) + 6);
strcpy (fn, fnBase);
@@ -94,25 +94,25 @@
strcat (fn, namespaceName);
GNUNET_free (fnBase);
- size = ECRS_sizeofMetaData (meta, ECRS_SERIALIZE_FULL);
+ size = GNUNET_ECRS_meta_data_get_serialized_size (meta,
GNUNET_ECRS_SERIALIZE_FULL);
tag = size + sizeof (int);
buf = GNUNET_malloc (tag);
((int *) buf)[0] = htonl (ranking); /* ranking */
- GE_ASSERT (ectx,
- size == ECRS_serializeMetaData (ectx,
+ GNUNET_GE_ASSERT (ectx,
+ size == GNUNET_ECRS_meta_data_serialize (ectx,
meta,
&buf[sizeof (int)],
- size, ECRS_SERIALIZE_FULL));
+ size,
GNUNET_ECRS_SERIALIZE_FULL));
GNUNET_disk_file_write (ectx, fn, buf, tag, "660");
GNUNET_free (fn);
GNUNET_free (buf);
}
static int
-readNamespaceInfo (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+readNamespaceInfo (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *namespaceName,
- struct ECRS_MetaData **meta, int *ranking)
+ struct GNUNET_ECRS_MetaData **meta, int *ranking)
{
unsigned long long len;
unsigned int size;
@@ -121,10 +121,10 @@
char *fnBase;
*meta = NULL;
- GC_get_configuration_value_filename (cfg,
+ GNUNET_GC_get_configuration_value_filename (cfg,
"GNUNET",
"GNUNET_HOME",
- GNUNET_HOME_DIRECTORY, &fnBase);
+ GNUNET_DEFAULT_HOME_DIRECTORY, &fnBase);
fn = GNUNET_malloc (strlen (fnBase) +
strlen (NS_DIR) + strlen (namespaceName) + 6);
strcpy (fn, fnBase);
@@ -150,7 +150,7 @@
if (len > 16 * 1024 * 1024)
{
/* too big, must be invalid! remove! */
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
UNLINK (fn);
GNUNET_free (fn);
return GNUNET_SYSERR;
@@ -165,11 +165,11 @@
size = len - sizeof (int);
*ranking = ntohl (((int *) buf)[0]);
- *meta = ECRS_deserializeMetaData (ectx, &buf[sizeof (int)], size);
+ *meta = GNUNET_ECRS_meta_data_deserialize (ectx, &buf[sizeof (int)], size);
if ((*meta) == NULL)
{
/* invalid data! remove! */
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
UNLINK (fn);
GNUNET_free (buf);
GNUNET_free (fn);
@@ -189,20 +189,20 @@
* @param meta meta-data about the namespace (maybe NULL)
* @return namespace root URI on success, NULL on error (namespace already
exists)
*/
-struct ECRS_URI *
-NS_createNamespace (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+struct GNUNET_ECRS_URI *
+GNUNET_NS_namespace_create (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
unsigned int anonymityLevel,
unsigned int insertPriority,
GNUNET_CronTime insertExpiration,
const char *namespaceName,
- const struct ECRS_MetaData *meta,
- const struct ECRS_URI *advertisementURI,
+ const struct GNUNET_ECRS_MetaData *meta,
+ const struct GNUNET_ECRS_URI *advertisementURI,
const GNUNET_HashCode * rootEntry)
{
- struct ECRS_URI *ret;
+ struct GNUNET_ECRS_URI *ret;
- ret = ECRS_createNamespace (ectx,
+ ret = GNUNET_ECRS_namespace_create (ectx,
cfg,
namespaceName,
meta,
@@ -215,9 +215,9 @@
GNUNET_HashCode id;
char *name;
- NS_setNamespaceRoot (ectx, cfg, ret);
- ECRS_getNamespaceId (ret, &id);
- name = ECRS_getNamespaceName (&id);
+ GNUNET_NS_namespace_set_root (ectx, cfg, ret);
+ GNUNET_ECRS_uri_get_namespace_from_sks (ret, &id);
+ name = GNUNET_ECRS_get_namespace_name (&id);
writeNamespaceInfo (ectx, cfg, name, meta, 0);
internal_notify (namespaceName, &id, meta, 0);
GNUNET_free (name);
@@ -232,18 +232,18 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
int
-NS_deleteNamespace (struct GE_Context *ectx,
- struct GC_Configuration *cfg, const char *namespaceName)
+GNUNET_NS_namespace_delete (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg, const char
*namespaceName)
{
int ret;
char *tmp;
char *fn;
- ret = ECRS_deleteNamespace (ectx, cfg, namespaceName);
- GC_get_configuration_value_filename (cfg,
+ ret = GNUNET_ECRS_namespace_delete (ectx, cfg, namespaceName);
+ GNUNET_GC_get_configuration_value_filename (cfg,
"GNUNET",
"GNUNET_HOME",
- GNUNET_HOME_DIRECTORY, &tmp);
+ GNUNET_DEFAULT_HOME_DIRECTORY, &tmp);
fn = GNUNET_malloc (strlen (tmp) + strlen (NS_UPDATE_DIR) +
strlen (namespaceName) + 20);
strcpy (fn, tmp);
@@ -263,16 +263,16 @@
* Change the ranking of a (non-local) namespace.
*
* @param ns the name of the namespace, as obtained
- * from ECRS_getNamespaceName
+ * from GNUNET_ECRS_get_namespace_name
* @param delta by how much should the rating be
* changed?
* @return new rating of the namespace
*/
int
-NS_rankNamespace (struct GE_Context *ectx,
- struct GC_Configuration *cfg, const char *ns, int delta)
+GNUNET_NS_namespace_rank (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg, const char *ns, int
delta)
{
- struct ECRS_MetaData *meta;
+ struct GNUNET_ECRS_MetaData *meta;
int ret;
int ranking;
@@ -280,20 +280,20 @@
if (ret == GNUNET_SYSERR)
{
ranking = 0;
- meta = ECRS_createMetaData ();
+ meta = GNUNET_ECRS_meta_data_create ();
}
ranking += delta;
writeNamespaceInfo (ectx, cfg, ns, meta, ranking);
- ECRS_freeMetaData (meta);
+ GNUNET_ECRS_meta_data_destroy (meta);
return ranking;
}
typedef struct
{
- NS_NamespaceIterator iterator;
+ GNUNET_NS_NamespaceIterator iterator;
void *closure;
- struct GE_Context *ectx;
- struct GC_Configuration *cfg;
+ struct GNUNET_GE_Context *ectx;
+ struct GNUNET_GC_Configuration *cfg;
} LNClosure;
static int
@@ -302,21 +302,21 @@
{
LNClosure *c = cls;
int ret;
- struct ECRS_MetaData *meta;
+ struct GNUNET_ECRS_MetaData *meta;
int rating;
meta = NULL;
rating = 0;
readNamespaceInfo (c->ectx, c->cfg, name, &meta, &rating);
if (meta == NULL)
- meta = ECRS_createMetaData ();
+ meta = GNUNET_ECRS_meta_data_create ();
if (c->iterator != NULL)
{
ret = c->iterator (c->closure, name, nsid, meta, rating);
}
else
ret = GNUNET_OK;
- ECRS_freeMetaData (meta);
+ GNUNET_ECRS_meta_data_destroy (meta);
return ret;
}
@@ -325,7 +325,7 @@
{
LNClosure *c = cls;
int ret;
- struct ECRS_MetaData *meta;
+ struct GNUNET_ECRS_MetaData *meta;
int rating;
GNUNET_HashCode id;
@@ -339,7 +339,7 @@
}
else
ret = GNUNET_OK;
- ECRS_freeMetaData (meta);
+ GNUNET_ECRS_meta_data_destroy (meta);
return GNUNET_OK;
}
@@ -348,9 +348,9 @@
*
*/
int
-NS_listNamespaces (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- NS_NamespaceIterator iterator, void *closure)
+GNUNET_NS_namespace_list_all (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ GNUNET_NS_NamespaceIterator iterator, void *closure)
{
LNClosure cls;
char *fn;
@@ -362,13 +362,13 @@
cls.closure = closure;
cls.ectx = ectx;
cls.cfg = cfg;
- ret1 = ECRS_listNamespaces (ectx, cfg, &localListNamespaceHelper, &cls);
+ ret1 = GNUNET_ECRS_get_namespaces (ectx, cfg, &localListNamespaceHelper,
&cls);
if (ret1 == -1)
return ret1;
- GC_get_configuration_value_filename (cfg,
+ GNUNET_GC_get_configuration_value_filename (cfg,
"GNUNET",
"GNUNET_HOME",
- GNUNET_HOME_DIRECTORY, &fnBase);
+ GNUNET_DEFAULT_HOME_DIRECTORY, &fnBase);
fn = GNUNET_malloc (strlen (fnBase) + strlen (NS_DIR) + 4);
strcpy (fn, fnBase);
GNUNET_free (fnBase);
@@ -388,17 +388,17 @@
* @param lastId maybe NULL
*/
static char *
-getUpdateDataFilename (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+getUpdateDataFilename (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *nsname, const GNUNET_HashCode * lastId)
{
char *tmp;
char *ret;
- GC_get_configuration_value_filename (cfg,
+ GNUNET_GC_get_configuration_value_filename (cfg,
"GNUNET",
"GNUNET_HOME",
- GNUNET_HOME_DIRECTORY, &tmp);
+ GNUNET_DEFAULT_HOME_DIRECTORY, &tmp);
ret = GNUNET_malloc (strlen (tmp) + strlen (NS_UPDATE_DIR) +
strlen (nsname) + sizeof (GNUNET_EncName) + 20);
strcpy (ret, tmp);
@@ -434,12 +434,12 @@
* @return GNUNET_OK if update data was found, GNUNET_SYSERR if not.
*/
static int
-readUpdateData (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+readUpdateData (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *nsname,
const GNUNET_HashCode * lastId,
GNUNET_HashCode * nextId,
- ECRS_FileInfo * fi,
+ GNUNET_ECRS_FileInfo * fi,
GNUNET_Int32Time * updateInterval,
GNUNET_Int32Time * lastPubTime)
{
@@ -485,25 +485,25 @@
if (size == 0)
{
GNUNET_free (buf);
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
if (fi != NULL)
{
- fi->meta = ECRS_deserializeMetaData (ectx, &uri[pos], size);
+ fi->meta = GNUNET_ECRS_meta_data_deserialize (ectx, &uri[pos], size);
if (fi->meta == NULL)
{
GNUNET_free (buf);
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
- fi->uri = ECRS_stringToUri (ectx, uri);
+ fi->uri = GNUNET_ECRS_string_to_uri (ectx, uri);
if (fi->uri == NULL)
{
- ECRS_freeMetaData (fi->meta);
+ GNUNET_ECRS_meta_data_destroy (fi->meta);
fi->meta = NULL;
GNUNET_free (buf);
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
}
@@ -521,12 +521,12 @@
* Write content update information.
*/
static int
-writeUpdateData (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+writeUpdateData (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *nsname,
const GNUNET_HashCode * thisId,
const GNUNET_HashCode * nextId,
- const ECRS_FileInfo * fi,
+ const GNUNET_ECRS_FileInfo * fi,
const GNUNET_Int32Time updateInterval,
const GNUNET_Int32Time lastPubTime)
{
@@ -536,8 +536,8 @@
size_t size;
struct UpdateData *buf;
- uri = ECRS_uriToString (fi->uri);
- metaSize = ECRS_sizeofMetaData (fi->meta, ECRS_SERIALIZE_FULL);
+ uri = GNUNET_ECRS_uri_to_string (fi->uri);
+ metaSize = GNUNET_ECRS_meta_data_get_serialized_size (fi->meta,
GNUNET_ECRS_SERIALIZE_FULL);
size = sizeof (struct UpdateData) + metaSize + strlen (uri) + 1;
buf = GNUNET_malloc (size);
buf->nextId = *nextId;
@@ -545,12 +545,12 @@
buf->updateInterval = htonl (updateInterval);
buf->lastPubTime = htonl (lastPubTime);
memcpy (&buf[1], uri, strlen (uri) + 1);
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
metaSize ==
- ECRS_serializeMetaData (ectx,
+ GNUNET_ECRS_meta_data_serialize (ectx,
fi->meta,
&((char *) &buf[1])[strlen (uri) + 1],
- metaSize, ECRS_SERIALIZE_FULL));
+ metaSize, GNUNET_ECRS_SERIALIZE_FULL));
GNUNET_free (uri);
fn = getUpdateDataFilename (ectx, cfg, nsname, thisId);
GNUNET_disk_file_write (ectx, fn, buf, size, "400"); /* no editing, just
deletion */
@@ -567,8 +567,8 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
int
-NS_computeNextId (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+GNUNET_NS_compute_next_identifier (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *name,
const GNUNET_HashCode * lastId,
const GNUNET_HashCode * thisId,
@@ -580,8 +580,8 @@
GNUNET_Int32Time lastTime;
GNUNET_Int32Time ui;
- if ((updateInterval == ECRS_SBLOCK_UPDATE_SPORADIC) ||
- (updateInterval == ECRS_SBLOCK_UPDATE_NONE))
+ if ((updateInterval == GNUNET_ECRS_SBLOCK_UPDATE_SPORADIC) ||
+ (updateInterval == GNUNET_ECRS_SBLOCK_UPDATE_NONE))
return GNUNET_SYSERR;
if (GNUNET_OK != readUpdateData (ectx,
@@ -615,9 +615,9 @@
* entry?
* @param uri set to the resulting URI
*/
-struct ECRS_URI *
-NS_addToNamespace (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+struct GNUNET_ECRS_URI *
+GNUNET_NS_add_to_namespace (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
unsigned int anonymityLevel,
unsigned int insertPriority,
GNUNET_CronTime insertExpiration,
@@ -626,7 +626,7 @@
const GNUNET_HashCode * lastId,
const GNUNET_HashCode * thisId,
const GNUNET_HashCode * nextId,
- const struct ECRS_URI *dst, const struct ECRS_MetaData *md)
+ const struct GNUNET_ECRS_URI *dst, const struct
GNUNET_ECRS_MetaData *md)
{
GNUNET_Int32Time creationTime;
GNUNET_HashCode nid;
@@ -634,15 +634,15 @@
GNUNET_Int32Time now;
GNUNET_Int32Time lastTime;
GNUNET_Int32Time lastInterval;
- ECRS_FileInfo fi;
+ GNUNET_ECRS_FileInfo fi;
char *old;
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
/* computation of IDs of update(s). Not as terrible as
it looks, just enumerating all of the possible cases
of periodic/sporadic updates and how IDs are computed. */
creationTime = GNUNET_get_time_int32 (&now);
- if (updateInterval != ECRS_SBLOCK_UPDATE_NONE)
+ if (updateInterval != GNUNET_ECRS_SBLOCK_UPDATE_NONE)
{
if ((lastId != NULL) &&
(GNUNET_OK == readUpdateData (ectx,
@@ -654,14 +654,14 @@
{
if (lastInterval != updateInterval)
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK |
GNUNET_GE_USER,
_
("Publication interval for periodic publication
changed."));
}
/* try to compute tid and/or
nid based on information read from lastId */
- if (updateInterval != ECRS_SBLOCK_UPDATE_SPORADIC)
+ if (updateInterval != GNUNET_ECRS_SBLOCK_UPDATE_SPORADIC)
{
GNUNET_HashCode delta;
@@ -675,7 +675,7 @@
}
if (creationTime > GNUNET_get_time () + 7 * GNUNET_CRON_DAYS)
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("Publishing update for periodically updated "
"content more than a week ahead of schedule.\n"));
}
@@ -736,7 +736,7 @@
nid = tid;
}
}
- uri = ECRS_addToNamespace (ectx,
+ uri = GNUNET_ECRS_namespace_add_content (ectx,
cfg,
name,
anonymityLevel,
@@ -746,12 +746,12 @@
updateInterval, &tid, &nid, dst, md);
if ((uri != NULL) && (dst != NULL))
{
- fi.uri = ECRS_dupUri (dst);
- fi.meta = (struct ECRS_MetaData *) md;
+ fi.uri = GNUNET_ECRS_uri_duplicate (dst);
+ fi.meta = (struct GNUNET_ECRS_MetaData *) md;
writeUpdateData (ectx,
cfg,
name, &tid, &nid, &fi, updateInterval, creationTime);
- ECRS_freeUri (fi.uri);
+ GNUNET_ECRS_uri_destroy (fi.uri);
if (lastId != NULL)
{
old = getUpdateDataFilename (ectx, cfg, name, lastId);
@@ -765,18 +765,18 @@
struct lNCC
{
const char *name;
- NS_UpdateIterator it;
+ GNUNET_NS_UpdateIterator it;
void *closure;
int cnt;
- struct GE_Context *ectx;
- struct GC_Configuration *cfg;
+ struct GNUNET_GE_Context *ectx;
+ struct GNUNET_GC_Configuration *cfg;
};
static int
lNCHelper (const char *fil, const char *dir, void *ptr)
{
struct lNCC *cls = ptr;
- ECRS_FileInfo fi;
+ GNUNET_ECRS_FileInfo fi;
GNUNET_HashCode lastId;
GNUNET_HashCode nextId;
GNUNET_Int32Time pubFreq;
@@ -786,7 +786,7 @@
if (GNUNET_OK != GNUNET_enc_to_hash (fil, &lastId))
{
- GE_BREAK (cls->ectx, 0);
+ GNUNET_GE_BREAK (cls->ectx, 0);
return GNUNET_OK;
}
fi.uri = NULL;
@@ -797,11 +797,11 @@
&lastId, &nextId, &fi, &pubFreq,
&lastTime))
{
- GE_BREAK (cls->ectx, 0);
+ GNUNET_GE_BREAK (cls->ectx, 0);
return GNUNET_OK;
}
cls->cnt++;
- if (pubFreq == ECRS_SBLOCK_UPDATE_SPORADIC)
+ if (pubFreq == GNUNET_ECRS_SBLOCK_UPDATE_SPORADIC)
{
nextTime = 0;
}
@@ -817,13 +817,13 @@
if (GNUNET_OK != cls->it (cls->closure,
&fi, &lastId, &nextId, pubFreq, nextTime))
{
- ECRS_freeUri (fi.uri);
- ECRS_freeMetaData (fi.meta);
+ GNUNET_ECRS_uri_destroy (fi.uri);
+ GNUNET_ECRS_meta_data_destroy (fi.meta);
return GNUNET_SYSERR;
}
}
- ECRS_freeUri (fi.uri);
- ECRS_freeMetaData (fi.meta);
+ GNUNET_ECRS_uri_destroy (fi.uri);
+ GNUNET_ECRS_meta_data_destroy (fi.meta);
return GNUNET_OK;
}
@@ -831,10 +831,10 @@
* List all updateable content in a given namespace.
*/
int
-NS_listNamespaceContent (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+GNUNET_NS_namespace_list_contents (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *name,
- NS_UpdateIterator iterator, void *closure)
+ GNUNET_NS_UpdateIterator iterator, void *closure)
{
struct lNCC cls;
char *dirName;
@@ -860,8 +860,8 @@
static int
mergeMeta (EXTRACTOR_KeywordType type, const char *data, void *cls)
{
- struct ECRS_MetaData *meta = cls;
- ECRS_addToMetaData (meta, type, data);
+ struct GNUNET_ECRS_MetaData *meta = cls;
+ GNUNET_ECRS_meta_data_inser (meta, type, data);
return GNUNET_OK;
}
@@ -873,34 +873,34 @@
* @param ns the namespace identifier
*/
void
-NS_addNamespaceInfo (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- const struct ECRS_URI *uri,
- const struct ECRS_MetaData *meta)
+GNUNET_NS_namespace_add_information (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const struct GNUNET_ECRS_URI *uri,
+ const struct GNUNET_ECRS_MetaData *meta)
{
char *name;
int ranking;
- struct ECRS_MetaData *old;
+ struct GNUNET_ECRS_MetaData *old;
GNUNET_HashCode id;
- if (!ECRS_isNamespaceUri (uri))
+ if (!GNUNET_ECRS_uri_test_sks (uri))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return;
}
- ECRS_getNamespaceId (uri, &id);
- name = ECRS_getNamespaceName (&id);
+ GNUNET_ECRS_uri_get_namespace_from_sks (uri, &id);
+ name = GNUNET_ECRS_get_namespace_name (&id);
if (name == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return;
}
ranking = 0;
if (GNUNET_OK == readNamespaceInfo (ectx, cfg, name, &old, &ranking))
{
- ECRS_getMetaData (meta, &mergeMeta, old);
+ GNUNET_ECRS_meta_data_get_contents (meta, &mergeMeta, old);
writeNamespaceInfo (ectx, cfg, name, old, ranking);
- ECRS_freeMetaData (old);
+ GNUNET_ECRS_meta_data_destroy (old);
}
else
{
@@ -916,18 +916,18 @@
* @return GNUNET_SYSERR on error, GNUNET_OK on success
*/
int
-NS_getNamespaceRoot (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+GNUNET_NS_namespace_get_root (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *ns, GNUNET_HashCode * root)
{
char *fn;
char *fnBase;
int ret;
- GC_get_configuration_value_filename (cfg,
+ GNUNET_GC_get_configuration_value_filename (cfg,
"GNUNET",
"GNUNET_HOME",
- GNUNET_HOME_DIRECTORY, &fnBase);
+ GNUNET_DEFAULT_HOME_DIRECTORY, &fnBase);
fn = GNUNET_malloc (strlen (fnBase) + strlen (NS_ROOTS) + strlen (ns) + 6);
strcpy (fn, fnBase);
strcat (fn, DIR_SEPARATOR_STR);
@@ -946,24 +946,24 @@
}
void
-NS_setNamespaceRoot (struct GE_Context *ectx,
- struct GC_Configuration *cfg, const struct ECRS_URI *uri)
+GNUNET_NS_namespace_set_root (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg, const struct
GNUNET_ECRS_URI *uri)
{
char *fn;
char *fnBase;
GNUNET_HashCode ns;
char *name;
- if (GNUNET_OK != ECRS_getNamespaceId (uri, &ns))
+ if (GNUNET_OK != GNUNET_ECRS_uri_get_namespace_from_sks (uri, &ns))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return;
}
- name = ECRS_getNamespaceName (&ns);
- GC_get_configuration_value_filename (cfg,
+ name = GNUNET_ECRS_get_namespace_name (&ns);
+ GNUNET_GC_get_configuration_value_filename (cfg,
"GNUNET",
"GNUNET_HOME",
- GNUNET_HOME_DIRECTORY, &fnBase);
+ GNUNET_DEFAULT_HOME_DIRECTORY, &fnBase);
fn =
GNUNET_malloc (strlen (fnBase) + strlen (NS_ROOTS) + strlen (name) + 6);
strcpy (fn, fnBase);
@@ -974,7 +974,7 @@
strcat (fn, name);
GNUNET_free (name);
GNUNET_free (fnBase);
- if (GNUNET_OK == ECRS_getSKSContentHash (uri, &ns))
+ if (GNUNET_OK == GNUNET_ECRS_uri_get_content_hash_from_sks (uri, &ns))
{
GNUNET_disk_file_write (ectx, fn, &ns, sizeof (GNUNET_HashCode), "644");
}
@@ -986,9 +986,9 @@
* a new namespace.
*/
int
-NS_registerDiscoveryCallback (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- NS_NamespaceIterator iterator, void *closure)
+GNUNET_NS_register_discovery_callback (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ GNUNET_NS_NamespaceIterator iterator, void
*closure)
{
struct DiscoveryCallback *list;
@@ -998,7 +998,7 @@
GNUNET_mutex_lock (lock);
list->next = head;
head = list;
- NS_listNamespaces (ectx, cfg, iterator, closure);
+ GNUNET_NS_namespace_list_all (ectx, cfg, iterator, closure);
GNUNET_mutex_unlock (lock);
return GNUNET_OK;
}
@@ -1007,7 +1007,7 @@
* Unregister namespace discovery callback.
*/
int
-NS_unregisterDiscoveryCallback (NS_NamespaceIterator iterator, void *closure)
+GNUNET_NS_unregister_discovery_callback (GNUNET_NS_NamespaceIterator iterator,
void *closure)
{
struct DiscoveryCallback *prev;
struct DiscoveryCallback *pos;
Modified: GNUnet/src/applications/fs/namespace/namespace_infotest.c
===================================================================
--- GNUnet/src/applications/fs/namespace/namespace_infotest.c 2007-11-25
03:50:33 UTC (rev 5754)
+++ GNUnet/src/applications/fs/namespace/namespace_infotest.c 2007-11-25
12:04:45 UTC (rev 5755)
@@ -33,76 +33,76 @@
#include "gnunet_util_crypto.h"
#include "gnunet_util_network_client.h"
-#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GE_BREAK(ectx, 0); goto FAILURE; }
+#define CHECK(a) if (!(a)) { ok = GNUNET_NO; GNUNET_GE_BREAK(ectx, 0); goto
FAILURE; }
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
int
main (int argc, char *argv[])
{
pid_t daemon;
int ok;
- struct ECRS_URI *uri = NULL;
- struct ECRS_URI *euri = NULL;
- struct ECRS_MetaData *meta = NULL;
+ struct GNUNET_ECRS_URI *uri = NULL;
+ struct GNUNET_ECRS_URI *euri = NULL;
+ struct GNUNET_ECRS_MetaData *meta = NULL;
GNUNET_HashCode root;
int old;
int newVal;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
daemon = GNUNET_daemon_start (NULL, cfg, "peer.conf", GNUNET_NO);
- GE_ASSERT (NULL, daemon > 0);
+ GNUNET_GE_ASSERT (NULL, daemon > 0);
CHECK (GNUNET_OK ==
GNUNET_wait_for_daemon_running (NULL, cfg,
30 * GNUNET_CRON_SECONDS));
ok = GNUNET_YES;
- NS_deleteNamespace (ectx, cfg, "test");
+ GNUNET_NS_namespace_delete (ectx, cfg, "test");
GNUNET_thread_sleep (5 * GNUNET_CRON_SECONDS); /* give apps time to
start */
/* ACTUAL TEST CODE */
- old = NS_listNamespaces (ectx, cfg, NULL, NULL);
+ old = GNUNET_NS_namespace_list_all (ectx, cfg, NULL, NULL);
- meta = ECRS_createMetaData ();
- ECRS_addToMetaData (meta, 0, "test");
+ meta = GNUNET_ECRS_meta_data_create ();
+ GNUNET_ECRS_meta_data_inser (meta, 0, "test");
GNUNET_create_random_hash (&root);
- uri = NS_createNamespace (ectx,
+ uri = GNUNET_NS_namespace_create (ectx,
cfg,
1,
1,
GNUNET_get_time () + 10 * GNUNET_CRON_MINUTES,
"test", meta, NULL, &root);
CHECK (uri != NULL);
- newVal = NS_listNamespaces (ectx, cfg, NULL, NULL);
+ newVal = GNUNET_NS_namespace_list_all (ectx, cfg, NULL, NULL);
CHECK (old < newVal);
- old = NS_listNamespaceContent (ectx, cfg, "test", NULL, NULL);
- euri = NS_addToNamespace (ectx,
+ old = GNUNET_NS_namespace_list_contents (ectx, cfg, "test", NULL, NULL);
+ euri = GNUNET_NS_add_to_namespace (ectx,
cfg,
1,
1,
GNUNET_get_time () + 10 * GNUNET_CRON_MINUTES,
"test", 42, NULL, &root, NULL, uri, meta);
CHECK (euri != NULL);
- newVal = NS_listNamespaceContent (ectx, cfg, "test", NULL, NULL);
+ newVal = GNUNET_NS_namespace_list_contents (ectx, cfg, "test", NULL, NULL);
CHECK (old < newVal);
- CHECK (GNUNET_OK == NS_deleteNamespace (ectx, cfg, "test"));
+ CHECK (GNUNET_OK == GNUNET_NS_namespace_delete (ectx, cfg, "test"));
/* END OF TEST CODE */
FAILURE:
if (uri != NULL)
- ECRS_freeUri (uri);
+ GNUNET_ECRS_uri_destroy (uri);
if (euri != NULL)
- ECRS_freeUri (euri);
+ GNUNET_ECRS_uri_destroy (euri);
if (meta != NULL)
- ECRS_freeMetaData (meta);
- ECRS_deleteNamespace (ectx, cfg, "test");
+ GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_ECRS_namespace_delete (ectx, cfg, "test");
- GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
- GC_free (cfg);
+ GNUNET_GE_ASSERT (NULL, GNUNET_OK == GNUNET_daemon_stop (NULL, daemon));
+ GNUNET_GC_free (cfg);
return (ok == GNUNET_YES) ? 0 : 1;
}
Modified: GNUnet/src/applications/fs/tools/gnunet-directory.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-directory.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/tools/gnunet-directory.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -32,7 +32,7 @@
#include "gnunet_uritrack_lib.h"
#include "gnunet_util.h"
-static char *cfgFilename = DEFAULT_CLIENT_CONFIG_FILE;
+static char *cfgFilename = GNUNET_DEFAULT_CLIENT_CONFIG_FILE;
static int do_list;
@@ -40,7 +40,7 @@
static int do_track;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
static int
itemPrinter (EXTRACTOR_KeywordType type, const char *data, void *closure)
@@ -52,18 +52,18 @@
}
static void
-printMeta (const struct ECRS_MetaData *meta)
+printMeta (const struct GNUNET_ECRS_MetaData *meta)
{
- ECRS_getMetaData (meta, &itemPrinter, NULL);
+ GNUNET_ECRS_meta_data_get_contents (meta, &itemPrinter, NULL);
}
static int
-printNode (const ECRS_FileInfo * fi,
+printNode (const GNUNET_ECRS_FileInfo * fi,
const GNUNET_HashCode * key, int isRoot, void *unused)
{
char *string;
- string = ECRS_uriToString (fi->uri);
+ string = GNUNET_ECRS_uri_to_string (fi->uri);
printf ("%s:\n", string);
GNUNET_free (string);
printMeta (fi->meta);
@@ -74,7 +74,7 @@
printDirectory (const char *filename)
{
unsigned long long len;
- struct ECRS_MetaData *md;
+ struct GNUNET_ECRS_MetaData *md;
char *data;
int ret;
char *name;
@@ -100,13 +100,13 @@
data = MMAP (NULL, len, PROT_READ, MAP_SHARED, fd, 0);
if (data == MAP_FAILED)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_ADMIN | GE_BULK, "mmap", name);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "mmap", name);
ret = -1;
}
else
{
- ret = ECRS_listDirectory (ectx, data, len, &md, &printNode, NULL);
+ ret = GNUNET_ECRS_directory_list_contents (ectx, data, len, &md,
&printNode, NULL);
MUNMAP (data, len);
}
CLOSE (fd);
@@ -118,7 +118,7 @@
if (md != NULL)
{
printMeta (md);
- ECRS_freeMetaData (md);
+ GNUNET_ECRS_meta_data_destroy (md);
}
printf ("\n");
GNUNET_free (name);
@@ -141,7 +141,7 @@
{'t', "track", NULL,
gettext_noop ("start tracking entries for the directory database"),
0, &GNUNET_getopt_configure_set_one, &do_track},
- GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
+ GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGNUNET_GE_VERSION), /* -v */
GNUNET_COMMAND_LINE_OPTION_VERBOSE,
GNUNET_COMMAND_LINE_OPTION_END,
};
@@ -150,7 +150,7 @@
main (int argc, char *const *argv)
{
int i;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
i = GNUNET_init (argc,
argv,
@@ -163,14 +163,14 @@
}
if (do_list)
printf (_("Listed %d matching entries.\n"),
- URITRACK_listURIs (ectx, cfg, GNUNET_YES, &printNode, NULL));
+ GNUNET_URITRACK_list (ectx, cfg, GNUNET_YES, &printNode, NULL));
if (do_kill)
{
- URITRACK_trackURIS (ectx, cfg, GNUNET_NO);
- URITRACK_clearTrackedURIS (ectx, cfg);
+ GNUNET_URITRACK_toggle_tracking (ectx, cfg, GNUNET_NO);
+ GNUNET_URITRACK_clear (ectx, cfg);
}
if (do_track)
- URITRACK_trackURIS (ectx, cfg, GNUNET_YES);
+ GNUNET_URITRACK_toggle_tracking (ectx, cfg, GNUNET_YES);
while (i < argc)
printDirectory (argv[i++]);
Modified: GNUnet/src/applications/fs/tools/gnunet-download.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-download.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/tools/gnunet-download.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -29,9 +29,9 @@
#include "gnunet_fsui_lib.h"
#include "gnunet_util.h"
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static unsigned long long verbose;
@@ -39,7 +39,7 @@
static int do_directory;
-static char *cfgFilename = DEFAULT_CLIENT_CONFIG_FILE;
+static char *cfgFilename = GNUNET_DEFAULT_CLIENT_CONFIG_FILE;
static char *filename;
@@ -49,13 +49,13 @@
static GNUNET_CronTime start_time;
-static struct FSUI_DownloadList *dl;
+static struct GNUNET_FSUI_DownloadList *dl;
static int errorCode;
static unsigned int downloads_running;
-static struct FSUI_DownloadList **downloads;
+static struct GNUNET_FSUI_DownloadList **downloads;
static unsigned int downloads_size;
@@ -86,7 +86,7 @@
{'R', "recursive", NULL,
gettext_noop ("download a GNUnet directory recursively"),
0, &GNUNET_getopt_configure_set_one, &do_recursive},
- GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
+ GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGNUNET_GE_VERSION), /* -v */
GNUNET_COMMAND_LINE_OPTION_VERBOSE,
GNUNET_COMMAND_LINE_OPTION_END,
};
@@ -97,12 +97,12 @@
* method exits once the download is complete.
*/
static void *
-progressModel (void *unused, const FSUI_Event * event)
+progressModel (void *unused, const GNUNET_FSUI_Event * event)
{
GNUNET_mutex_lock (lock);
switch (event->type)
{
- case FSUI_download_progress:
+ case GNUNET_FSUI_download_progress:
if (verbose)
{
PRINTF (_("Download of file `%s' at "
@@ -115,7 +115,7 @@
/ (double) GNUNET_CRON_SECONDS));
}
break;
- case FSUI_download_aborted:
+ case GNUNET_FSUI_download_aborted:
if (dl == event->data.DownloadError.dc.pos)
{
/* top-download aborted */
@@ -124,13 +124,13 @@
GNUNET_shutdown_initiate ();
}
break;
- case FSUI_download_error:
+ case GNUNET_FSUI_download_error:
printf (_("Error downloading: %s\n"),
event->data.DownloadError.message);
errorCode = 3;
GNUNET_shutdown_initiate ();
break;
- case FSUI_download_completed:
+ case GNUNET_FSUI_download_completed:
PRINTF (_("Download of file `%s' complete. "
"Speed was %8.3f KiB per second.\n"),
event->data.DownloadCompleted.filename,
@@ -144,14 +144,14 @@
GNUNET_shutdown_initiate ();
}
break;
- case FSUI_download_started:
+ case GNUNET_FSUI_download_started:
downloads_running++;
GNUNET_array_append (downloads, downloads_size,
event->data.DownloadStarted.dc.pos);
- case FSUI_download_stopped:
+ case GNUNET_FSUI_download_stopped:
break;
default:
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
break;
}
GNUNET_mutex_unlock (lock);
@@ -159,15 +159,15 @@
}
static int
-directoryIterator (const ECRS_FileInfo * fi,
+directoryIterator (const GNUNET_ECRS_FileInfo * fi,
const GNUNET_HashCode * key, int isRoot, void *cls)
{
- struct FSUI_Context *ctx = cls;
- struct ECRS_MetaData *meta;
+ struct GNUNET_FSUI_Context *ctx = cls;
+ struct GNUNET_ECRS_MetaData *meta;
char *fn;
char *f;
- f = ECRS_getFirstFromMetaData (fi->meta,
+ f = GNUNET_ECRS_meta_data_get_first_by_types (fi->meta,
EXTRACTOR_FILENAME,
EXTRACTOR_TITLE,
EXTRACTOR_ARTIST,
@@ -184,10 +184,10 @@
if (verbose > 1)
printf (_("Starting download `%s'\n"), f);
GNUNET_free (f);
- meta = ECRS_createMetaData ();
- FSUI_startDownload (ctx,
+ meta = GNUNET_ECRS_meta_data_create ();
+ GNUNET_FSUI_download_start (ctx,
anonymity, do_recursive, fi->uri, meta, fn, NULL, NULL);
- ECRS_freeMetaData (meta);
+ GNUNET_ECRS_meta_data_destroy (meta);
GNUNET_free (fn);
return GNUNET_OK;
}
@@ -205,9 +205,9 @@
{
int ok;
int try_rename;
- struct FSUI_Context *ctx;
- struct ECRS_URI *uri;
- struct ECRS_MetaData *meta;
+ struct GNUNET_FSUI_Context *ctx;
+ struct GNUNET_ECRS_URI *uri;
+ struct GNUNET_ECRS_MetaData *meta;
int i;
i = GNUNET_init (argc,
@@ -221,25 +221,25 @@
}
if (i == argc)
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Not enough arguments. "
"You must specify a GNUnet file URI\n"));
errorCode = -1;
goto quit;
}
- GC_get_configuration_value_number (cfg,
+ GNUNET_GC_get_configuration_value_number (cfg,
"GNUNET",
"VERBOSE", 0, 9999, 0, &verbose);
uri = NULL;
if (!do_directory)
{
- uri = ECRS_stringToUri (ectx, argv[i]);
+ uri = GNUNET_ECRS_string_to_uri (ectx, argv[i]);
if ((NULL == uri) ||
- (!(ECRS_isLocationUri (uri) || ECRS_isFileUri (uri))))
+ (!(GNUNET_ECRS_uri_test_loc (uri) || GNUNET_ECRS_uri_test_chk
(uri))))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("URI `%s' invalid for gnunet-download.\n"), argv[i]);
errorCode = -1;
goto quit;
@@ -269,15 +269,15 @@
}
else
{
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
strlen (argv[i]) >
- strlen (ECRS_URI_PREFIX) + strlen (ECRS_FILE_INFIX));
+ strlen (GNUNET_ECRS_URI_PREFIX) + strlen
(GNUNET_ECRS_FILE_INFIX));
filename = GNUNET_expand_file_name (ectx,
&argv[i][strlen
- (ECRS_URI_PREFIX) +
+
(GNUNET_ECRS_URI_PREFIX) +
strlen
- (ECRS_FILE_INFIX)]);
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+
(GNUNET_ECRS_FILE_INFIX)]);
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
_("No filename specified, using `%s' instead (for now).\n"),
filename);
try_rename = GNUNET_YES;
@@ -285,7 +285,7 @@
}
ok = GNUNET_NO;
lock = GNUNET_mutex_create (GNUNET_NO);
- ctx = FSUI_start (ectx,
+ ctx = GNUNET_FSUI_start (ectx,
cfg,
"gnunet-download",
parallelism == 0 ? 1 : parallelism,
@@ -317,20 +317,20 @@
{
if (fd != -1)
CLOSE (fd);
- GE_LOG (ectx,
- GE_ERROR | GE_IMMEDIATE | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_IMMEDIATE | GNUNET_GE_USER,
_("Could not access gnunet-directory file `%s'\n"), efn);
- FSUI_stop (ctx);
+ GNUNET_FSUI_stop (ctx);
GNUNET_mutex_destroy (lock);
GNUNET_free (efn);
goto quit;
}
- meta = ECRS_createMetaData ();
- count = ECRS_listDirectory (ectx,
+ meta = GNUNET_ECRS_meta_data_create ();
+ count = GNUNET_ECRS_directory_list_contents (ectx,
data,
sbuf.st_size,
&meta, &directoryIterator, ctx);
- ECRS_freeMetaData (meta);
+ GNUNET_ECRS_meta_data_destroy (meta);
MUNMAP (data, sbuf.st_size);
CLOSE (fd);
GNUNET_free (efn);
@@ -345,14 +345,14 @@
}
else
{
- meta = ECRS_createMetaData ();
- dl = FSUI_startDownload (ctx,
+ meta = GNUNET_ECRS_meta_data_create ();
+ dl = GNUNET_FSUI_download_start (ctx,
anonymity,
do_recursive, uri, meta, filename, NULL, NULL);
- ECRS_freeMetaData (meta);
+ GNUNET_ECRS_meta_data_destroy (meta);
if (dl == NULL)
{
- FSUI_stop (ctx);
+ GNUNET_FSUI_stop (ctx);
GNUNET_mutex_destroy (lock);
goto quit;
}
@@ -361,17 +361,17 @@
if (errorCode == 1)
{
for (i = 0; i < downloads_size; i++)
- FSUI_abortDownload (ctx, downloads[i]);
+ GNUNET_FSUI_download_abort (ctx, downloads[i]);
}
for (i = 0; i < downloads_size; i++)
- FSUI_stopDownload (ctx, downloads[i]);
+ GNUNET_FSUI_download_stop (ctx, downloads[i]);
GNUNET_array_grow (downloads, downloads_size, 0);
- FSUI_stop (ctx);
+ GNUNET_FSUI_stop (ctx);
GNUNET_mutex_destroy (lock);
if ((errorCode == 0) && (dl != NULL) && (try_rename == GNUNET_YES))
{
- char *newname = ECRS_suggestFilename (ectx,
+ char *newname = GNUNET_ECRS_suggest_better_filename (ectx,
filename);
if (newname != NULL)
@@ -382,7 +382,7 @@
}
GNUNET_free (filename);
if (uri != NULL)
- ECRS_freeUri (uri);
+ GNUNET_ECRS_uri_destroy (uri);
quit:
GNUNET_fini (ectx, cfg);
return errorCode;
Modified: GNUnet/src/applications/fs/tools/gnunet-insert.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-insert.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/tools/gnunet-insert.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -39,27 +39,27 @@
static int errorCode;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static struct FSUI_Context *ctx;
+static struct GNUNET_FSUI_Context *ctx;
-static struct FSUI_UploadList *ul;
+static struct GNUNET_FSUI_UploadList *ul;
static GNUNET_CronTime start_time;
/* ************ config options ******** */
-static char *cfgFilename = DEFAULT_CLIENT_CONFIG_FILE;
+static char *cfgFilename = GNUNET_DEFAULT_CLIENT_CONFIG_FILE;
-static struct ECRS_MetaData *meta;
+static struct GNUNET_ECRS_MetaData *meta;
-static struct ECRS_URI *topKeywords;
+static struct GNUNET_ECRS_URI *topKeywords;
-static struct ECRS_URI *gloKeywords;
+static struct GNUNET_ECRS_URI *gloKeywords;
-static struct ECRS_MetaData *meta;
+static struct GNUNET_ECRS_MetaData *meta;
static unsigned int anonymity = 1;
@@ -101,12 +101,12 @@
* post-processing.
*/
static void
-postProcess (const struct ECRS_URI *uri)
+postProcess (const struct GNUNET_ECRS_URI *uri)
{
GNUNET_HashCode prevId;
GNUNET_HashCode thisId;
GNUNET_HashCode nextId;
- struct ECRS_URI *nsuri;
+ struct GNUNET_ECRS_URI *nsuri;
char *us;
if (pseudonym == NULL)
@@ -114,7 +114,7 @@
convertId (next_id, &nextId);
convertId (this_id, &thisId);
convertId (prev_id, &prevId);
- nsuri = NS_addToNamespace (ectx,
+ nsuri = GNUNET_NS_add_to_namespace (ectx,
cfg,
anonymity,
priority,
@@ -126,8 +126,8 @@
next_id == NULL ? NULL : &nextId, uri, meta);
if (nsuri != NULL)
{
- us = ECRS_uriToString (nsuri);
- ECRS_freeUri (nsuri);
+ us = GNUNET_ECRS_uri_to_string (nsuri);
+ GNUNET_ECRS_uri_destroy (nsuri);
printf (_("Created entry `%s' in namespace `%s'\n"), us, pseudonym);
GNUNET_free (us);
}
@@ -185,7 +185,7 @@
* Print progess message.
*/
static void *
-printstatus (void *ctx, const FSUI_Event * event)
+printstatus (void *ctx, const GNUNET_FSUI_Event * event)
{
unsigned long long *verboselevel = ctx;
unsigned long long delta;
@@ -193,7 +193,7 @@
switch (event->type)
{
- case FSUI_upload_progress:
+ case GNUNET_FSUI_upload_progress:
if (*verboselevel)
{
char *ret;
@@ -212,7 +212,7 @@
GNUNET_free (ret);
}
break;
- case FSUI_upload_completed:
+ case GNUNET_FSUI_upload_completed:
if (*verboselevel)
{
delta = GNUNET_get_time () - start_time;
@@ -226,7 +226,7 @@
: (double) (event->data.UploadCompleted.total
/ 1024.0 * GNUNET_CRON_SECONDS / delta));
}
- fstring = ECRS_uriToString (event->data.UploadCompleted.uri);
+ fstring = GNUNET_ECRS_uri_to_string (event->data.UploadCompleted.uri);
printf (_("File `%s' has URI: %s\n"),
event->data.UploadCompleted.filename, fstring);
GNUNET_free (fstring);
@@ -237,23 +237,23 @@
GNUNET_shutdown_initiate ();
}
break;
- case FSUI_upload_aborted:
+ case GNUNET_FSUI_upload_aborted:
printf (_("\nUpload aborted.\n"));
errorCode = 2;
GNUNET_shutdown_initiate ();
break;
- case FSUI_upload_error:
+ case GNUNET_FSUI_upload_error:
printf (_("\nError uploading file: %s"),
event->data.UploadError.message);
errorCode = 3;
GNUNET_shutdown_initiate ();
break;
- case FSUI_upload_started:
- case FSUI_upload_stopped:
+ case GNUNET_FSUI_upload_started:
+ case GNUNET_FSUI_upload_stopped:
break;
default:
printf (_("\nUnexpected event: %d\n"), event->type);
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
break;
}
return NULL;
@@ -293,15 +293,15 @@
gettext_noop
("add an additional keyword for the top-level file or directory"
" (this option can be specified multiple times)"),
- 1, &gnunet_getopt_configure_set_keywords, &topKeywords},
+ 1, &GNUNET_ECRS_getopt_configure_set_keywords, &topKeywords},
{'K', "global-key", "KEYWORD",
gettext_noop ("add an additional keyword for all files and directories"
" (this option can be specified multiple times)"),
- 1, &gnunet_getopt_configure_set_keywords, &gloKeywords},
+ 1, &GNUNET_ECRS_getopt_configure_set_keywords, &gloKeywords},
GNUNET_COMMAND_LINE_OPTION_LOGGING, /* -L */
{'m', "meta", "TYPE:VALUE",
gettext_noop ("set the meta-data for the given TYPE to the given VALUE"),
- 1, &gnunet_getopt_configure_set_metadata, &meta},
+ 1, &GNUNET_ECRS_getopt_configure_set_metadata, &meta},
{'n', "noindex", NULL,
gettext_noop ("do not index, perform full insertion (stores entire "
"file in encrypted form in GNUnet database)"),
@@ -334,7 +334,7 @@
gettext_noop ("ID of the previous version of the content"
" (for namespace update only)"),
1, &GNUNET_getopt_configure_set_string, &prev_id},
- GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
+ GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGNUNET_GE_VERSION), /* -v */
GNUNET_COMMAND_LINE_OPTION_VERBOSE,
GNUNET_COMMAND_LINE_OPTION_END,
};
@@ -354,7 +354,7 @@
char *tmp;
unsigned long long verbose;
- meta = ECRS_createMetaData ();
+ meta = GNUNET_ECRS_meta_data_create ();
i = GNUNET_init (argc,
argv,
"gnunet-insert [OPTIONS] FILENAME",
@@ -382,37 +382,37 @@
l = EXTRACTOR_loadDefaultLibraries ();
ex = NULL;
- GC_get_configuration_value_string (cfg, "FS", "EXTRACTORS", "", &ex);
+ GNUNET_GC_get_configuration_value_string (cfg, "FS", "EXTRACTORS", "",
&ex);
if (strlen (ex) > 0)
l = EXTRACTOR_loadConfigLibraries (l, ex);
GNUNET_free (ex);
dirname = GNUNET_expand_file_name (ectx, filename);
- GE_ASSERT (ectx, dirname != NULL);
+ GNUNET_GE_ASSERT (ectx, dirname != NULL);
while ((strlen (dirname) > 0) &&
(dirname[strlen (dirname) - 1] == DIR_SEPARATOR))
dirname[strlen (dirname) - 1] = '\0';
fname = dirname;
while (strstr (fname, DIR_SEPARATOR_STR) != NULL)
fname = strstr (fname, DIR_SEPARATOR_STR) + 1;
- GE_ASSERT (ectx, fname != dirname);
+ GNUNET_GE_ASSERT (ectx, fname != dirname);
fname[-1] = '\0';
listKeywords (fname, dirname, l);
GNUNET_free (dirname);
EXTRACTOR_removeAll (l);
- ECRS_freeMetaData (meta);
+ GNUNET_ECRS_meta_data_destroy (meta);
errorCode = 0;
goto quit;
}
- GC_get_configuration_value_number (cfg,
+ GNUNET_GC_get_configuration_value_number (cfg,
"GNUNET",
"VERBOSE", 0, 9999, 0, &verbose);
/* check arguments */
if (pseudonym != NULL)
{
- if (GNUNET_OK != ECRS_testNamespaceExists (ectx, cfg, pseudonym, NULL))
+ if (GNUNET_OK != GNUNET_ECRS_namespace_test_exists (ectx, cfg,
pseudonym, NULL))
{
printf (_("Could not access namespace `%s' (does not exist?).\n"),
pseudonym);
@@ -431,8 +431,8 @@
#endif
if ((NULL == strptime (creation_time, fmt, &t)))
{
- GE_LOG_STRERROR (ectx,
- GE_FATAL | GE_USER | GE_IMMEDIATE, "strptime");
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE, "strptime");
printf (_("Parsing time failed. Use `%s' format.\n"), fmt);
errorCode = -1;
goto quit;
@@ -484,18 +484,18 @@
}
/* fundamental init */
- ctx = FSUI_start (ectx, cfg, "gnunet-insert", GNUNET_NO, 32, /* make
configurable */
+ ctx = GNUNET_FSUI_start (ectx, cfg, "gnunet-insert", GNUNET_NO, 32, /* make
configurable */
&printstatus, &verbose);
/* first insert all of the top-level files or directories */
tmp = GNUNET_expand_file_name (ectx, filename);
if (!do_disable_creation_time)
- ECRS_addPublicationDateToMetaData (meta);
+ GNUNET_ECRS_meta_data_add_publication_date (meta);
start_time = GNUNET_get_time ();
errorCode = 1;
- ul = FSUI_startUpload (ctx,
+ ul = GNUNET_FSUI_upload_star (ctx,
tmp,
- (DirectoryScanCallback) & GNUNET_disk_directory_scan,
+ (GNUNET_FSUI_DirectoryScanCallback) &
GNUNET_disk_directory_scan,
ectx,
anonymity,
priority,
@@ -505,19 +505,19 @@
start_time + 2 * GNUNET_CRON_YEARS,
meta, gloKeywords, topKeywords);
if (gloKeywords != NULL)
- ECRS_freeUri (gloKeywords);
+ GNUNET_ECRS_uri_destroy (gloKeywords);
if (topKeywords != NULL)
- ECRS_freeUri (topKeywords);
+ GNUNET_ECRS_uri_destroy (topKeywords);
GNUNET_free (tmp);
if (ul != NULL)
{
GNUNET_shutdown_wait_for ();
if (errorCode == 1)
- FSUI_abortUpload (ctx, ul);
- FSUI_stopUpload (ctx, ul);
+ GNUNET_FSUI_upload_abort (ctx, ul);
+ GNUNET_FSUI_upload_stop (ctx, ul);
}
- ECRS_freeMetaData (meta);
- FSUI_stop (ctx);
+ GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_FSUI_stop (ctx);
quit:
GNUNET_fini (ectx, cfg);
Modified: GNUnet/src/applications/fs/tools/gnunet-pseudonym.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-pseudonym.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/tools/gnunet-pseudonym.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -30,9 +30,9 @@
#include "gnunet_namespace_lib.h"
#include "gnunet_util.h"
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static int start_collection;
@@ -56,11 +56,11 @@
static GNUNET_CronTime expiration = 2 * GNUNET_CRON_YEARS;
-static char *cfgFilename = DEFAULT_CLIENT_CONFIG_FILE;
+static char *cfgFilename = GNUNET_DEFAULT_CLIENT_CONFIG_FILE;
-static struct ECRS_MetaData *meta;
+static struct GNUNET_ECRS_MetaData *meta;
-static struct ECRS_URI *advertisement;
+static struct GNUNET_ECRS_URI *advertisement;
/**
* All gnunet-pseudonym command line options
@@ -87,10 +87,10 @@
{'k', "keyword", "KEYWORD",
gettext_noop
("use the given keyword to advertise the namespace (use when creating a new
pseudonym)"),
- 1, &gnunet_getopt_configure_set_keywords, &advertisement},
+ 1, &GNUNET_ECRS_getopt_configure_set_keywords, &advertisement},
{'m', "meta", "TYPE=VALUE",
gettext_noop ("specify metadata describing the namespace or collection"),
- 1, &gnunet_getopt_configure_set_metadata, &meta},
+ 1, &GNUNET_ECRS_getopt_configure_set_metadata, &meta},
{'n', "no-advertisement", NULL,
gettext_noop
("do not generate an advertisement for this namespace (use when creating a
new pseudonym)"),
@@ -105,7 +105,7 @@
{'s', "set-rating", "ID:VALUE",
gettext_noop ("set the rating of a namespace"),
0, &GNUNET_getopt_configure_set_string, &set_rating},
- GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
+ GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGNUNET_GE_VERSION), /* -v */
GNUNET_COMMAND_LINE_OPTION_VERBOSE,
GNUNET_COMMAND_LINE_OPTION_END,
};
@@ -120,16 +120,16 @@
}
static void
-printMeta (const struct ECRS_MetaData *m)
+printMeta (const struct GNUNET_ECRS_MetaData *m)
{
- ECRS_getMetaData (m, &itemPrinter, NULL);
+ GNUNET_ECRS_meta_data_get_contents (m, &itemPrinter, NULL);
}
static int
namespacePrinter (void *unused,
const char *namespaceName,
const GNUNET_HashCode * id,
- const struct ECRS_MetaData *md, int rating)
+ const struct GNUNET_ECRS_MetaData *md, int rating)
{
GNUNET_EncName enc;
int cpos;
@@ -166,7 +166,7 @@
if (delta != 0)
{
- rating = NS_rankNamespace (ectx, cfg, namespaceName, delta);
+ rating = GNUNET_NS_namespace_rank (ectx, cfg, namespaceName, delta);
printf (_("\tRating (after update): %d\n"), rating);
}
}
@@ -182,24 +182,24 @@
int i;
GNUNET_HashCode hc;
- meta = ECRS_createMetaData ();
+ meta = GNUNET_ECRS_meta_data_create ();
i = GNUNET_init (argc,
argv,
"gnunet-pseudonym [OPTIONS]",
&cfgFilename, gnunetpseudonymOptions, &ectx, &cfg);
if (i == -1)
{
- ECRS_freeMetaData (meta);
+ GNUNET_ECRS_meta_data_destroy (meta);
GNUNET_fini (ectx, cfg);
return -1;
}
success = 0; /* no errors */
- CO_init (ectx, cfg);
+ GNUNET_CO_init (ectx, cfg);
/* stop collections */
if (stop_collection && (!start_collection))
{
- if (GNUNET_OK == CO_stopCollection ())
+ if (GNUNET_OK == GNUNET_CO_collection_stop ())
printf (_("Collection stopped.\n"));
else
printf (_("Failed to stop collection (not active?).\n"));
@@ -208,7 +208,7 @@
/* delete pseudonyms */
if (delete_name != NULL)
{
- if (GNUNET_OK == NS_deleteNamespace (ectx, cfg, delete_name))
+ if (GNUNET_OK == GNUNET_NS_namespace_delete (ectx, cfg, delete_name))
{
printf (_("Pseudonym `%s' deleted.\n"), delete_name);
}
@@ -226,8 +226,8 @@
{
if (start_collection)
{
- ECRS_addToMetaData (meta, EXTRACTOR_OWNER, create_name);
- if (GNUNET_OK == CO_startCollection (anonymity, priority,
ECRS_SBLOCK_UPDATE_SPORADIC, /* FIXME: allow other update policies */
+ GNUNET_ECRS_meta_data_inser (meta, EXTRACTOR_OWNER, create_name);
+ if (GNUNET_OK == GNUNET_CO_collection_start (anonymity, priority,
GNUNET_ECRS_SBLOCK_UPDATE_SPORADIC, /* FIXME: allow other update
policies */
create_name, meta))
{
printf (_("Started collection `%s'.\n"), create_name);
@@ -238,12 +238,12 @@
success++;
}
- ECRS_delFromMetaData (meta, EXTRACTOR_OWNER, create_name);
+ GNUNET_ECRS_meta_data_delete (meta, EXTRACTOR_OWNER, create_name);
}
else
{ /* no collection */
GNUNET_HashCode rootEntry;
- struct ECRS_URI *rootURI;
+ struct GNUNET_ECRS_URI *rootURI;
char *root;
if (root_name == NULL)
@@ -258,15 +258,15 @@
if (no_advertisement)
{
if (advertisement != NULL)
- ECRS_freeUri (advertisement);
+ GNUNET_ECRS_uri_destroy (advertisement);
advertisement = NULL;
}
else
{
if (advertisement == NULL)
- advertisement = ECRS_parseCharKeywordURI (ectx, "namespace");
+ advertisement = GNUNET_ECRS_keyword_string_to_uri (ectx,
"namespace");
}
- rootURI = NS_createNamespace (ectx,
+ rootURI = GNUNET_NS_namespace_create (ectx,
cfg,
anonymity,
priority,
@@ -281,14 +281,14 @@
}
else
{
- root = ECRS_uriToString (rootURI);
+ root = GNUNET_ECRS_uri_to_string (rootURI);
printf (_("Namespace `%s' created (root: %s).\n"),
create_name, root);
GNUNET_free (root);
- ECRS_freeUri (rootURI);
+ GNUNET_ECRS_uri_destroy (rootURI);
}
if (NULL != advertisement)
- ECRS_freeUri (advertisement);
+ GNUNET_ECRS_uri_destroy (advertisement);
}
GNUNET_free (create_name);
create_name = NULL;
@@ -303,12 +303,12 @@
if (0 == be_quiet)
{
/* print information about pseudonyms */
- cnt = NS_listNamespaces (ectx, cfg, &namespacePrinter, NULL);
+ cnt = GNUNET_NS_namespace_list_all (ectx, cfg, &namespacePrinter, NULL);
if (cnt == -1)
printf (_("Could not access namespace information.\n"));
}
- ECRS_freeMetaData (meta);
- CO_done ();
+ GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_CO_done ();
GNUNET_fini (ectx, cfg);
return success;
}
Modified: GNUnet/src/applications/fs/tools/gnunet-search.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-search.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/tools/gnunet-search.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -30,9 +30,9 @@
#include "gnunet_util.h"
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static unsigned int anonymity = 1;
@@ -40,13 +40,13 @@
static unsigned int max_results;
-static char *cfgFilename = DEFAULT_CLIENT_CONFIG_FILE;
+static char *cfgFilename = GNUNET_DEFAULT_CLIENT_CONFIG_FILE;
static char *output_filename;
static int errorCode;
-static ECRS_FileInfo *fis;
+static GNUNET_ECRS_FileInfo *fis;
static unsigned int fiCount;
@@ -61,44 +61,44 @@
}
static void
-printMeta (const struct ECRS_MetaData *meta)
+printMeta (const struct GNUNET_ECRS_MetaData *meta)
{
- ECRS_getMetaData (meta, &itemPrinter, NULL);
+ GNUNET_ECRS_meta_data_get_contents (meta, &itemPrinter, NULL);
}
/**
* Handle the search result.
*/
static void *
-eventCallback (void *cls, const FSUI_Event * event)
+eventCallback (void *cls, const GNUNET_FSUI_Event * event)
{
char *uri;
char *filename;
switch (event->type)
{
- case FSUI_search_error:
+ case GNUNET_FSUI_search_error:
errorCode = 3;
GNUNET_shutdown_initiate ();
break;
- case FSUI_search_aborted:
+ case GNUNET_FSUI_search_aborted:
errorCode = 4;
GNUNET_shutdown_initiate ();
break;
- case FSUI_search_completed:
+ case GNUNET_FSUI_search_completed:
errorCode = 0;
GNUNET_shutdown_initiate ();
break;
- case FSUI_search_result:
+ case GNUNET_FSUI_search_result:
/* retain URIs for possible directory dump later */
GNUNET_array_grow (fis, fiCount, fiCount + 1);
- fis[fiCount - 1].uri = ECRS_dupUri (event->data.SearchResult.fi.uri);
+ fis[fiCount - 1].uri = GNUNET_ECRS_uri_duplicate
(event->data.SearchResult.fi.uri);
fis[fiCount - 1].meta
- = ECRS_dupMetaData (event->data.SearchResult.fi.meta);
+ = GNUNET_ECRS_meta_data_duplicate (event->data.SearchResult.fi.meta);
- uri = ECRS_uriToString (event->data.SearchResult.fi.uri);
+ uri = GNUNET_ECRS_uri_to_string (event->data.SearchResult.fi.uri);
printf ("%s:\n", uri);
- filename = ECRS_getFromMetaData (event->data.SearchResult.fi.meta,
+ filename = GNUNET_ECRS_meta_data_get_by_type
(event->data.SearchResult.fi.meta,
EXTRACTOR_FILENAME);
if (filename != NULL)
{
@@ -116,11 +116,11 @@
GNUNET_free_non_null (filename);
GNUNET_free (uri);
break;
- case FSUI_search_started:
- case FSUI_search_stopped:
+ case GNUNET_FSUI_search_started:
+ case GNUNET_FSUI_search_stopped:
break;
default:
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
break;
}
return NULL;
@@ -146,7 +146,7 @@
{'t', "timeout", "DELAY",
gettext_noop ("wait DELAY seconds for search results before aborting"),
1, &GNUNET_getopt_configure_set_uint, &delay},
- GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
+ GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGNUNET_GE_VERSION), /* -v */
GNUNET_COMMAND_LINE_OPTION_VERBOSE,
GNUNET_COMMAND_LINE_OPTION_END,
};
@@ -161,10 +161,10 @@
int
main (int argc, char *const *argv)
{
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
int i;
- struct FSUI_Context *ctx;
- struct FSUI_SearchList *s;
+ struct GNUNET_FSUI_Context *ctx;
+ struct GNUNET_FSUI_SearchList *s;
i = GNUNET_init (argc,
argv,
@@ -176,7 +176,7 @@
return -1;
}
/* convert args to URI */
- uri = ECRS_parseArgvKeywordURI (ectx, argc - i, (const char **) &argv[i]);
+ uri = GNUNET_ECRS_keyword_command_line_to_uri (ectx, argc - i, (const char
**) &argv[i]);
if (uri == NULL)
{
printf (_("Error converting arguments to URI!\n"));
@@ -186,42 +186,42 @@
if (max_results == 0)
max_results = (unsigned int) -1; /* infty */
ctx =
- FSUI_start (ectx, cfg, "gnunet-search", 4, GNUNET_NO, &eventCallback,
+ GNUNET_FSUI_start (ectx, cfg, "gnunet-search", 4, GNUNET_NO,
&eventCallback,
NULL);
if (ctx == NULL)
{
- ECRS_freeUri (uri);
+ GNUNET_ECRS_uri_destroy (uri);
GNUNET_fini (ectx, cfg);
return GNUNET_SYSERR;
}
errorCode = 1;
- s = FSUI_startSearch (ctx,
+ s = GNUNET_FSUI_search_start (ctx,
anonymity, max_results, delay * GNUNET_CRON_SECONDS,
uri);
- ECRS_freeUri (uri);
+ GNUNET_ECRS_uri_destroy (uri);
if (s == NULL)
{
errorCode = 2;
- FSUI_stop (ctx);
+ GNUNET_FSUI_stop (ctx);
goto quit;
}
GNUNET_shutdown_wait_for ();
if (errorCode == 1)
- FSUI_abortSearch (ctx, s);
- FSUI_stopSearch (ctx, s);
- FSUI_stop (ctx);
+ GNUNET_FSUI_search_abort (ctx, s);
+ GNUNET_FSUI_search_stop (ctx, s);
+ GNUNET_FSUI_stop (ctx);
if (output_filename != NULL)
{
char *outfile;
unsigned long long n;
char *data;
- struct ECRS_MetaData *meta;
+ struct GNUNET_ECRS_MetaData *meta;
- meta = ECRS_createMetaData ();
+ meta = GNUNET_ECRS_meta_data_create ();
/* ?: anything here to put into meta? */
if (GNUNET_OK ==
- ECRS_createDirectory (ectx, &data, &n, fiCount, fis, meta))
+ GNUNET_ECRS_directory_create (ectx, &data, &n, fiCount, fis, meta))
{
outfile = GNUNET_expand_file_name (ectx, output_filename);
GNUNET_disk_file_write (ectx, outfile, data, n, "600");
@@ -232,8 +232,8 @@
}
for (i = 0; i < fiCount; i++)
{
- ECRS_freeUri (fis[i].uri);
- ECRS_freeMetaData (fis[i].meta);
+ GNUNET_ECRS_uri_destroy (fis[i].uri);
+ GNUNET_ECRS_meta_data_destroy (fis[i].meta);
}
GNUNET_array_grow (fis, fiCount, 0);
quit:
Modified: GNUnet/src/applications/fs/tools/gnunet-unindex.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-unindex.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/tools/gnunet-unindex.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -32,28 +32,28 @@
#include "gnunet_fsui_lib.h"
#include "gnunet_util.h"
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static GNUNET_CronTime start_time;
static int errorCode;
-static char *cfgFilename = DEFAULT_CLIENT_CONFIG_FILE;
+static char *cfgFilename = GNUNET_DEFAULT_CLIENT_CONFIG_FILE;
/**
* Print progess message.
*/
static void *
-printstatus (void *cls, const FSUI_Event * event)
+printstatus (void *cls, const GNUNET_FSUI_Event * event)
{
unsigned long long *verboselevel = cls;
unsigned long long delta;
switch (event->type)
{
- case FSUI_unindex_progress:
+ case GNUNET_FSUI_unindex_progress:
if (*verboselevel)
{
delta = event->data.UnindexProgress.eta - GNUNET_get_time ();
@@ -65,7 +65,7 @@
printf ("\r");
}
break;
- case FSUI_unindex_completed:
+ case GNUNET_FSUI_unindex_completed:
if (*verboselevel)
{
delta = GNUNET_get_time () - start_time;
@@ -84,17 +84,17 @@
errorCode = 0;
GNUNET_shutdown_initiate ();
break;
- case FSUI_unindex_error:
+ case GNUNET_FSUI_unindex_error:
printf (_("\nError unindexing file: %s\n"),
event->data.UnindexError.message);
errorCode = 3;
GNUNET_shutdown_initiate ();
break;
- case FSUI_unindex_started:
- case FSUI_unindex_stopped:
+ case GNUNET_FSUI_unindex_started:
+ case GNUNET_FSUI_unindex_stopped:
break;
default:
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
break;
}
return NULL;
@@ -108,7 +108,7 @@
GNUNET_COMMAND_LINE_OPTION_HELP (gettext_noop ("Unindex files.")), /* -h */
GNUNET_COMMAND_LINE_OPTION_HOSTNAME, /* -H */
GNUNET_COMMAND_LINE_OPTION_LOGGING, /* -L */
- GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
+ GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGNUNET_GE_VERSION), /* -v */
GNUNET_COMMAND_LINE_OPTION_VERBOSE,
GNUNET_COMMAND_LINE_OPTION_END,
};
@@ -123,11 +123,11 @@
int
main (int argc, char *const *argv)
{
- static struct FSUI_Context *ctx;
+ static struct GNUNET_FSUI_Context *ctx;
char *filename;
int i;
unsigned long long verbose;
- struct FSUI_UnindexList *ul;
+ struct GNUNET_FSUI_UnindexList *ul;
i = GNUNET_init (argc,
argv,
@@ -140,37 +140,37 @@
}
if (i == argc)
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Not enough arguments. " "You must specify a filename.\n"));
GNUNET_fini (ectx, cfg);
return -1;
}
- GC_get_configuration_value_number (cfg,
+ GNUNET_GC_get_configuration_value_number (cfg,
"GNUNET",
"VERBOSE", 0, 9999, 0, &verbose);
/* fundamental init */
- ctx = FSUI_start (ectx,
+ ctx = GNUNET_FSUI_start (ectx,
cfg, "gnunet-unindex", 2, GNUNET_NO, &printstatus,
&verbose);
errorCode = 1;
start_time = GNUNET_get_time ();
filename = GNUNET_expand_file_name (ectx, argv[i]);
- ul = FSUI_startUnindex (ctx, filename);
+ ul = GNUNET_FSUI_unindex_start (ctx, filename);
if (ul == NULL)
{
- printf (_("`%s' failed. Is `%s' a file?\n"), "FSUI_unindex", filename);
+ printf (_("`%s' failed. Is `%s' a file?\n"), "GNUNET_FSUI_unindex",
filename);
errorCode = 2;
}
else
{
GNUNET_shutdown_wait_for ();
if (errorCode == 1)
- FSUI_abortUnindex (ctx, ul);
- FSUI_stopUnindex (ctx, ul);
+ GNUNET_FSUI_unindex_abort (ctx, ul);
+ GNUNET_FSUI_unindex_stop (ctx, ul);
}
GNUNET_free (filename);
- FSUI_stop (ctx);
+ GNUNET_FSUI_stop (ctx);
GNUNET_fini (ectx, cfg);
return errorCode;
}
Modified: GNUnet/src/applications/fs/uritrack/callbacks.c
===================================================================
--- GNUnet/src/applications/fs/uritrack/callbacks.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/uritrack/callbacks.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -34,11 +34,11 @@
*/
typedef struct
{
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
- ECRS_SearchProgressCallback iterator;
+ GNUNET_ECRS_SearchResultProcessor iterator;
void *closure;
@@ -54,7 +54,7 @@
static unsigned int callbacks_size;
static int
-init_iterator (const ECRS_FileInfo * fi,
+init_iterator (const GNUNET_ECRS_FileInfo * fi,
const GNUNET_HashCode * key, int isRoot, void *closure)
{
Callback *c = closure;
@@ -69,7 +69,7 @@
init_thread (void *arg)
{
Callback *c = arg;
- URITRACK_listURIs (c->ectx, c->cfg, GNUNET_YES, &init_iterator, arg);
+ GNUNET_URITRACK_list (c->ectx, c->cfg, GNUNET_YES, &init_iterator, arg);
return NULL;
}
@@ -80,9 +80,9 @@
* for all existing URIs as well.
*/
int
-URITRACK_registerTrackCallback (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- ECRS_SearchProgressCallback iterator,
+GNUNET_URITRACK_register_track_callback (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ GNUNET_ECRS_SearchResultProcessor iterator,
void *closure)
{
Callback *c;
@@ -105,7 +105,7 @@
* Unregister a URI callback.
*/
int
-URITRACK_unregisterTrackCallback (ECRS_SearchProgressCallback iterator,
+GNUNET_URITRACK_unregister_track_callback (GNUNET_ECRS_SearchResultProcessor
iterator,
void *closure)
{
int i;
@@ -135,7 +135,7 @@
* Internal notification about new tracked URI.
*/
void
-URITRACK_internal_notify (const ECRS_FileInfo * fi)
+URITRACK_internal_notify (const GNUNET_ECRS_FileInfo * fi)
{
int i;
Modified: GNUnet/src/applications/fs/uritrack/callbacks.h
===================================================================
--- GNUnet/src/applications/fs/uritrack/callbacks.h 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/uritrack/callbacks.h 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -30,6 +30,6 @@
/**
* Internal notification about new tracked URI.
*/
-void URITRACK_internal_notify (const ECRS_FileInfo * fi);
+void URITRACK_internal_notify (const GNUNET_ECRS_FileInfo * fi);
#endif
Modified: GNUnet/src/applications/fs/uritrack/file_info.c
===================================================================
--- GNUnet/src/applications/fs/uritrack/file_info.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/uritrack/file_info.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -39,17 +39,17 @@
#define TRACK_OPTION "fs_uridb_status"
static struct GNUNET_IPC_Semaphore *
-createIPC (struct GE_Context *ectx, struct GC_Configuration *cfg)
+createIPC (struct GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration *cfg)
{
char *basename;
char *ipcName;
struct GNUNET_IPC_Semaphore *sem;
size_t n;
- GC_get_configuration_value_filename (cfg,
+ GNUNET_GC_get_configuration_value_filename (cfg,
"GNUNET",
"GNUNET_HOME",
- GNUNET_HOME_DIRECTORY, &basename);
+ GNUNET_DEFAULT_HOME_DIRECTORY,
&basename);
n = strlen (basename) + 512;
ipcName = GNUNET_malloc (n);
GNUNET_snprintf (ipcName, n, "%s/directory_ipc_lock", basename);
@@ -60,15 +60,15 @@
}
static char *
-getUriDbName (struct GE_Context *ectx, struct GC_Configuration *cfg)
+getUriDbName (struct GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration
*cfg)
{
char *nw;
char *pfx;
- GC_get_configuration_value_filename (cfg,
+ GNUNET_GC_get_configuration_value_filename (cfg,
"GNUNET",
"GNUNET_HOME",
- GNUNET_HOME_DIRECTORY, &pfx);
+ GNUNET_DEFAULT_HOME_DIRECTORY, &pfx);
nw = GNUNET_malloc (strlen (pfx) + strlen (STATE_NAME) + 2);
strcpy (nw, pfx);
strcat (nw, DIR_SEPARATOR_STR);
@@ -79,15 +79,15 @@
}
static char *
-getToggleName (struct GE_Context *ectx, struct GC_Configuration *cfg)
+getToggleName (struct GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration
*cfg)
{
char *nw;
char *pfx;
- GC_get_configuration_value_filename (cfg,
+ GNUNET_GC_get_configuration_value_filename (cfg,
"GNUNET",
"GNUNET_HOME",
- GNUNET_HOME_DIRECTORY, &pfx);
+ GNUNET_DEFAULT_HOME_DIRECTORY, &pfx);
nw = GNUNET_malloc (strlen (pfx) + strlen (TRACK_OPTION) + 2);
strcpy (nw, pfx);
strcat (nw, DIR_SEPARATOR_STR);
@@ -103,7 +103,7 @@
* @return GNUNET_YES of tracking is enabled, GNUNET_NO if not
*/
int
-URITRACK_trackStatus (struct GE_Context *ectx, struct GC_Configuration *cfg)
+GNUNET_URITRACK_get_tracking_status (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg)
{
int status;
char *tn;
@@ -122,8 +122,8 @@
{
GNUNET_free (tn);
#if DEBUG_FILE_INFO
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("Collecting file identifiers disabled.\n"));
#endif
return GNUNET_NO;
@@ -137,16 +137,16 @@
struct CheckPresentClosure
{
- const ECRS_FileInfo *fi;
+ const GNUNET_ECRS_FileInfo *fi;
int present;
};
static int
-checkPresent (const ECRS_FileInfo * fi,
+checkPresent (const GNUNET_ECRS_FileInfo * fi,
const GNUNET_HashCode * key, int isRoot, void *closure)
{
struct CheckPresentClosure *cpc = closure;
- if (ECRS_equalsUri (fi->uri, cpc->fi->uri))
+ if (GNUNET_ECRS_uri_test_equal (fi->uri, cpc->fi->uri))
{
cpc->present = 1;
return GNUNET_SYSERR;
@@ -158,8 +158,8 @@
* Makes a URI available for directory building.
*/
void
-URITRACK_trackURI (struct GE_Context *ectx,
- struct GC_Configuration *cfg, const ECRS_FileInfo * fi)
+GNUNET_URITRACK_track (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg, const
GNUNET_ECRS_FileInfo * fi)
{
struct GNUNET_IPC_Semaphore *sem;
char *data;
@@ -169,26 +169,26 @@
char *fn;
struct CheckPresentClosure cpc;
- if (GNUNET_NO == URITRACK_trackStatus (ectx, cfg))
+ if (GNUNET_NO == GNUNET_URITRACK_get_tracking_status (ectx, cfg))
return;
cpc.present = 0;
cpc.fi = fi;
- URITRACK_listURIs (ectx, cfg, GNUNET_NO, &checkPresent, &cpc);
+ GNUNET_URITRACK_list (ectx, cfg, GNUNET_NO, &checkPresent, &cpc);
if (cpc.present == 1)
return;
- size = ECRS_sizeofMetaData (fi->meta,
- ECRS_SERIALIZE_FULL |
- ECRS_SERIALIZE_NO_COMPRESS);
+ size = GNUNET_ECRS_meta_data_get_serialized_size (fi->meta,
+ GNUNET_ECRS_SERIALIZE_FULL |
+ GNUNET_ECRS_SERIALIZE_NO_COMPRESS);
data = GNUNET_malloc (size);
- GE_ASSERT (ectx,
- size == ECRS_serializeMetaData (ectx,
+ GNUNET_GE_ASSERT (ectx,
+ size == GNUNET_ECRS_meta_data_serialize (ectx,
fi->meta,
data,
size,
- ECRS_SERIALIZE_FULL |
- ECRS_SERIALIZE_NO_COMPRESS));
+ GNUNET_ECRS_SERIALIZE_FULL |
+
GNUNET_ECRS_SERIALIZE_NO_COMPRESS));
size = htonl (size);
- suri = ECRS_uriToString (fi->uri);
+ suri = GNUNET_ECRS_uri_to_string (fi->uri);
sem = createIPC (ectx, cfg);
GNUNET_IPC_semaphore_down (sem, GNUNET_YES);
fn = getUriDbName (ectx, cfg);
@@ -216,8 +216,8 @@
* from the tracking database.
*/
void
-URITRACK_clearTrackedURIS (struct GE_Context *ectx,
- struct GC_Configuration *cfg)
+GNUNET_URITRACK_clear (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg)
{
struct GNUNET_IPC_Semaphore *sem;
char *fn;
@@ -228,8 +228,8 @@
if (GNUNET_YES == GNUNET_disk_file_test (ectx, fn))
{
if (0 != UNLINK (fn))
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"unlink", fn);
}
GNUNET_free (fn);
@@ -244,8 +244,8 @@
* disabling tracking
*/
void
-URITRACK_trackURIS (struct GE_Context *ectx,
- struct GC_Configuration *cfg, int onOff)
+GNUNET_URITRACK_toggle_tracking (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg, int onOff)
{
int o = htonl (onOff);
char *tn;
@@ -266,10 +266,10 @@
* @return number of entries found
*/
int
-URITRACK_listURIs (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+GNUNET_URITRACK_list (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
int need_metadata,
- ECRS_SearchProgressCallback iterator, void *closure)
+ GNUNET_ECRS_SearchResultProcessor iterator, void *closure)
{
struct GNUNET_IPC_Semaphore *sem;
int rval;
@@ -278,7 +278,7 @@
off_t pos;
off_t spos;
unsigned int msize;
- ECRS_FileInfo fi;
+ GNUNET_ECRS_FileInfo fi;
int fd;
char *fn;
struct stat buf;
@@ -298,8 +298,8 @@
{
GNUNET_IPC_semaphore_up (sem);
GNUNET_IPC_semaphore_destroy (sem);
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN
| GNUNET_GE_BULK,
"open", fn);
GNUNET_free (fn);
return GNUNET_SYSERR; /* error opening URI db */
@@ -308,8 +308,8 @@
if (result == MAP_FAILED)
{
CLOSE (fd);
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN
| GNUNET_GE_BULK,
"mmap", fn);
GNUNET_free (fn);
GNUNET_IPC_semaphore_up (sem);
@@ -327,13 +327,13 @@
spos++; /* skip '\0' */
if ((spos + sizeof (int) >= ret) || (spos + sizeof (int) < spos))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
goto FORMATERROR;
}
- fi.uri = ECRS_stringToUri (ectx, &result[pos]);
+ fi.uri = GNUNET_ECRS_string_to_uri (ectx, &result[pos]);
if (fi.uri == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
goto FORMATERROR;
}
memcpy (&msize, &result[spos], sizeof (int));
@@ -341,17 +341,17 @@
spos += sizeof (int);
if ((spos + msize > ret) || (spos + msize < spos))
{
- GE_BREAK (ectx, 0);
- ECRS_freeUri (fi.uri);
+ GNUNET_GE_BREAK (ectx, 0);
+ GNUNET_ECRS_uri_destroy (fi.uri);
goto FORMATERROR;
}
if (need_metadata == GNUNET_YES)
{
- fi.meta = ECRS_deserializeMetaData (ectx, &result[spos], msize);
+ fi.meta = GNUNET_ECRS_meta_data_deserialize (ectx, &result[spos],
msize);
if (fi.meta == NULL)
{
- GE_BREAK (ectx, 0);
- ECRS_freeUri (fi.uri);
+ GNUNET_GE_BREAK (ectx, 0);
+ GNUNET_ECRS_uri_destroy (fi.uri);
goto FORMATERROR;
}
}
@@ -365,11 +365,11 @@
if (GNUNET_OK != iterator (&fi, NULL, GNUNET_NO, closure))
{
if (fi.meta != NULL)
- ECRS_freeMetaData (fi.meta);
- ECRS_freeUri (fi.uri);
+ GNUNET_ECRS_meta_data_destroy (fi.meta);
+ GNUNET_ECRS_uri_destroy (fi.uri);
if (0 != MUNMAP (result, buf.st_size))
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_BULK,
"munmap", fn);
CLOSE (fd);
GNUNET_free (fn);
@@ -380,27 +380,27 @@
}
rval++;
if (fi.meta != NULL)
- ECRS_freeMetaData (fi.meta);
- ECRS_freeUri (fi.uri);
+ GNUNET_ECRS_meta_data_destroy (fi.meta);
+ GNUNET_ECRS_uri_destroy (fi.uri);
}
if (0 != MUNMAP (result, buf.st_size))
- GE_LOG_STRERROR_FILE (ectx, GE_ERROR | GE_ADMIN | GE_BULK, "munmap", fn);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx, GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "munmap", fn);
CLOSE (fd);
GNUNET_free (fn);
GNUNET_IPC_semaphore_up (sem);
GNUNET_IPC_semaphore_destroy (sem);
return rval;
FORMATERROR:
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Deleted corrupt URI database in `%s'."), STATE_NAME);
if (0 != MUNMAP (result, buf.st_size))
- GE_LOG_STRERROR_FILE (ectx, GE_ERROR | GE_ADMIN | GE_BULK, "munmap", fn);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx, GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "munmap", fn);
CLOSE (fd);
GNUNET_free (fn);
GNUNET_IPC_semaphore_up (sem);
GNUNET_IPC_semaphore_destroy (sem);
- URITRACK_clearTrackedURIS (ectx, cfg);
+ GNUNET_URITRACK_clear (ectx, cfg);
return GNUNET_SYSERR;
}
Modified: GNUnet/src/applications/fs/uritrack/tracktest.c
===================================================================
--- GNUnet/src/applications/fs/uritrack/tracktest.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/uritrack/tracktest.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -32,30 +32,30 @@
#define CHECK(a) { if (! (a)) { fprintf(stderr, "Error at %s:%d\n", __FILE__,
__LINE__); return 1; } }
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
-static ECRS_FileInfo fi1;
+static GNUNET_ECRS_FileInfo fi1;
-static ECRS_FileInfo fi2;
+static GNUNET_ECRS_FileInfo fi2;
static unsigned int notifications;
static int
-notified (const ECRS_FileInfo * fi,
+notified (const GNUNET_ECRS_FileInfo * fi,
const GNUNET_HashCode * key, int isRoot, void *cls)
{
if ((fi1.meta != NULL) &&
(fi1.uri != NULL) &&
- (ECRS_equalsMetaData (fi->meta,
- fi1.meta)) && (ECRS_equalsUri (fi->uri, fi1.uri)))
+ (GNUNET_ECRS_meta_data_test_equal (fi->meta,
+ fi1.meta)) && (GNUNET_ECRS_uri_test_equal
(fi->uri, fi1.uri)))
{
notifications++;
return GNUNET_OK;
}
if ((fi2.meta != NULL) &&
(fi2.uri != NULL) &&
- (ECRS_equalsMetaData (fi->meta,
- fi2.meta)) && (ECRS_equalsUri (fi->uri, fi2.uri)))
+ (GNUNET_ECRS_meta_data_test_equal (fi->meta,
+ fi2.meta)) && (GNUNET_ECRS_uri_test_equal
(fi->uri, fi2.uri)))
{
notifications++;
return GNUNET_OK;
@@ -64,28 +64,28 @@
}
static int
-processor (const ECRS_FileInfo * fi,
+processor (const GNUNET_ECRS_FileInfo * fi,
const GNUNET_HashCode * key, int isRoot, void *cls)
{
if ((fi1.meta != NULL) &&
(fi1.uri != NULL) &&
- (ECRS_equalsMetaData (fi->meta,
- fi1.meta)) && (ECRS_equalsUri (fi->uri, fi1.uri)))
+ (GNUNET_ECRS_meta_data_test_equal (fi->meta,
+ fi1.meta)) && (GNUNET_ECRS_uri_test_equal
(fi->uri, fi1.uri)))
{
- ECRS_freeUri (fi1.uri);
+ GNUNET_ECRS_uri_destroy (fi1.uri);
fi1.uri = NULL;
- ECRS_freeMetaData (fi1.meta);
+ GNUNET_ECRS_meta_data_destroy (fi1.meta);
fi1.meta = NULL;
return GNUNET_OK;
}
if ((fi2.meta != NULL) &&
(fi2.uri != NULL) &&
- (ECRS_equalsMetaData (fi->meta,
- fi2.meta)) && (ECRS_equalsUri (fi->uri, fi2.uri)))
+ (GNUNET_ECRS_meta_data_test_equal (fi->meta,
+ fi2.meta)) && (GNUNET_ECRS_uri_test_equal
(fi->uri, fi2.uri)))
{
- ECRS_freeUri (fi2.uri);
+ GNUNET_ECRS_uri_destroy (fi2.uri);
fi2.uri = NULL;
- ECRS_freeMetaData (fi2.meta);
+ GNUNET_ECRS_meta_data_destroy (fi2.meta);
fi2.meta = NULL;
return GNUNET_OK;
}
@@ -103,35 +103,35 @@
"foot",
NULL,
};
- fi1.uri = ECRS_keywordsToUri (k1);
- fi1.meta = ECRS_createMetaData ();
- ECRS_addToMetaData (fi1.meta, EXTRACTOR_MIMETYPE, "foo/bar");
- fi2.uri = ECRS_keywordsToUri (k2);
- fi2.meta = ECRS_createMetaData ();
- ECRS_addToMetaData (fi2.meta, EXTRACTOR_MIMETYPE, "foo/bar");
+ fi1.uri = GNUNET_ECRS_keyword_string_to_uri (k1);
+ fi1.meta = GNUNET_ECRS_meta_data_create ();
+ GNUNET_ECRS_meta_data_inser (fi1.meta, EXTRACTOR_MIMETYPE, "foo/bar");
+ fi2.uri = GNUNET_ECRS_keyword_string_to_uri (k2);
+ fi2.meta = GNUNET_ECRS_meta_data_create ();
+ GNUNET_ECRS_meta_data_inser (fi2.meta, EXTRACTOR_MIMETYPE, "foo/bar");
- URITRACK_clearTrackedURIS (NULL, cfg);
- URITRACK_registerTrackCallback (NULL, cfg, ¬ified, NULL);
- URITRACK_trackURIS (NULL, cfg, GNUNET_NO);
- URITRACK_clearTrackedURIS (NULL, cfg);
+ GNUNET_URITRACK_clear (NULL, cfg);
+ GNUNET_URITRACK_register_track_callback (NULL, cfg, ¬ified, NULL);
+ GNUNET_URITRACK_toggle_tracking (NULL, cfg, GNUNET_NO);
+ GNUNET_URITRACK_clear (NULL, cfg);
/* test non-tracking */
- URITRACK_trackURI (NULL, cfg, &fi1);
- CHECK (0 == URITRACK_listURIs (NULL, cfg, GNUNET_NO, NULL, NULL));
- CHECK (GNUNET_NO == URITRACK_trackStatus (NULL, cfg));
- URITRACK_clearTrackedURIS (NULL, cfg);
- URITRACK_trackURIS (NULL, cfg, GNUNET_YES);
- URITRACK_clearTrackedURIS (NULL, cfg);
- CHECK (0 == URITRACK_listURIs (NULL, cfg, GNUNET_NO, NULL, NULL));
- CHECK (GNUNET_YES == URITRACK_trackStatus (NULL, cfg));
- URITRACK_trackURI (NULL, cfg, &fi1);
- CHECK (1 == URITRACK_listURIs (NULL, cfg, GNUNET_NO, NULL, NULL));
- URITRACK_trackURI (NULL, cfg, &fi2);
- CHECK (2 == URITRACK_listURIs (NULL, cfg, GNUNET_YES, &processor, NULL));
- URITRACK_trackURIS (NULL, cfg, GNUNET_NO);
- CHECK (GNUNET_NO == URITRACK_trackStatus (NULL, cfg));
- URITRACK_clearTrackedURIS (NULL, cfg);
+ GNUNET_URITRACK_track (NULL, cfg, &fi1);
+ CHECK (0 == GNUNET_URITRACK_list (NULL, cfg, GNUNET_NO, NULL, NULL));
+ CHECK (GNUNET_NO == GNUNET_URITRACK_get_tracking_status (NULL, cfg));
+ GNUNET_URITRACK_clear (NULL, cfg);
+ GNUNET_URITRACK_toggle_tracking (NULL, cfg, GNUNET_YES);
+ GNUNET_URITRACK_clear (NULL, cfg);
+ CHECK (0 == GNUNET_URITRACK_list (NULL, cfg, GNUNET_NO, NULL, NULL));
+ CHECK (GNUNET_YES == GNUNET_URITRACK_get_tracking_status (NULL, cfg));
+ GNUNET_URITRACK_track (NULL, cfg, &fi1);
+ CHECK (1 == GNUNET_URITRACK_list (NULL, cfg, GNUNET_NO, NULL, NULL));
+ GNUNET_URITRACK_track (NULL, cfg, &fi2);
+ CHECK (2 == GNUNET_URITRACK_list (NULL, cfg, GNUNET_YES, &processor, NULL));
+ GNUNET_URITRACK_toggle_tracking (NULL, cfg, GNUNET_NO);
+ CHECK (GNUNET_NO == GNUNET_URITRACK_get_tracking_status (NULL, cfg));
+ GNUNET_URITRACK_clear (NULL, cfg);
CHECK (notifications == 2);
- URITRACK_unregisterTrackCallback (¬ified, NULL);
+ GNUNET_URITRACK_unregister_track_callback (¬ified, NULL);
return 0;
}
@@ -140,14 +140,14 @@
{
int failureCount = 0;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
failureCount += testTracking ();
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
if (failureCount != 0)
return 1;
return 0;
Modified: GNUnet/src/applications/fs/uritrack/uri_info.c
===================================================================
--- GNUnet/src/applications/fs/uritrack/uri_info.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/fs/uritrack/uri_info.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -34,16 +34,16 @@
#include "platform.h"
static char *
-getDBName (struct GC_Configuration *cfg)
+getDBName (struct GNUNET_GC_Configuration *cfg)
{
char *basename;
char *ipcName;
size_t n;
- GC_get_configuration_value_filename (cfg,
+ GNUNET_GC_get_configuration_value_filename (cfg,
"GNUNET",
"GNUNET_HOME",
- GNUNET_HOME_DIRECTORY, &basename);
+ GNUNET_DEFAULT_HOME_DIRECTORY,
&basename);
n = strlen (basename) + 512;
ipcName = GNUNET_malloc (n);
GNUNET_snprintf (ipcName, n, "%s/uri_info.db", basename);
@@ -52,12 +52,12 @@
}
static unsigned long long
-getDBSize (struct GC_Configuration *cfg)
+getDBSize (struct GNUNET_GC_Configuration *cfg)
{
unsigned long long value;
value = 1024 * 1024;
- GC_get_configuration_value_number (cfg,
+ GNUNET_GC_get_configuration_value_number (cfg,
"FS",
"URI_DB_SIZE",
1,
@@ -69,14 +69,14 @@
* Find out what we know about a given URI's past. Note that we only
* track the states for a (finite) number of URIs and that the
* information that we give back maybe inaccurate (returning
- * URITRACK_FRESH if the URI did not fit into our bounded-size map,
+ * GNUNET_URITRACK_FRESH if the URI did not fit into our bounded-size map,
* even if the URI is not fresh anymore; also, if the URI has a
* GNUNET_hash-collision in the map, there is a 1:256 chance that we will
* return information from the wrong URI without detecting it).
*/
-enum URITRACK_STATE
-URITRACK_getState (struct GE_Context *ectx,
- struct GC_Configuration *cfg, const struct ECRS_URI *uri)
+enum GNUNET_URITRACK_STATE
+GNUNET_URITRACK_get_state (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg, const struct
GNUNET_ECRS_URI *uri)
{
char *s;
int crc;
@@ -85,44 +85,44 @@
unsigned char io[2];
off_t o;
- s = ECRS_uriToString (uri);
+ s = GNUNET_ECRS_uri_to_string (uri);
crc = GNUNET_crc32_n (s, strlen (s));
GNUNET_free (s);
s = getDBName (cfg);
if (GNUNET_NO == GNUNET_disk_file_test (ectx, s))
- return URITRACK_FRESH;
+ return GNUNET_URITRACK_FRESH;
size = getDBSize (cfg);
fd = GNUNET_disk_file_open (ectx, s, O_RDONLY);
GNUNET_free (s);
if (fd == -1)
- return URITRACK_FRESH;
+ return GNUNET_URITRACK_FRESH;
o = 2 * (crc % size);
if (o != LSEEK (fd, o, SEEK_SET))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"lseek", s);
CLOSE (fd);
- return URITRACK_FRESH;
+ return GNUNET_URITRACK_FRESH;
}
if (2 != read (fd, io, 2))
{
CLOSE (fd);
- return URITRACK_FRESH;
+ return GNUNET_URITRACK_FRESH;
}
CLOSE (fd);
if (io[0] == (unsigned char) crc)
- return (enum URITRACK_STATE) io[1];
- return URITRACK_FRESH;
+ return (enum GNUNET_URITRACK_STATE) io[1];
+ return GNUNET_URITRACK_FRESH;
}
/**
* Add additional information about a given URI's past.
*/
void
-URITRACK_addState (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- const struct ECRS_URI *uri, enum URITRACK_STATE state)
+GNUNET_URITRACK_add_state (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const struct GNUNET_ECRS_URI *uri, enum
GNUNET_URITRACK_STATE state)
{
char *s;
int crc;
@@ -131,7 +131,7 @@
unsigned char io[2];
off_t o;
- s = ECRS_uriToString (uri);
+ s = GNUNET_ECRS_uri_to_string (uri);
crc = GNUNET_crc32_n (s, strlen (s));
GNUNET_free (s);
s = getDBName (cfg);
@@ -145,8 +145,8 @@
o = 2 * (crc % size);
if (o != LSEEK (fd, o, SEEK_SET))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"lseek", s);
CLOSE (fd);
GNUNET_free (s);
@@ -155,26 +155,26 @@
if (2 != read (fd, io, 2))
{
io[0] = crc;
- io[1] = URITRACK_FRESH;
+ io[1] = GNUNET_URITRACK_FRESH;
}
else if (io[0] != (unsigned char) crc)
{
io[0] = (unsigned char) crc;
- io[1] = URITRACK_FRESH;
+ io[1] = GNUNET_URITRACK_FRESH;
}
io[1] |= state;
if (o != LSEEK (fd, o, SEEK_SET))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"lseek", s);
CLOSE (fd);
GNUNET_free (s);
return;
}
if (2 != write (fd, io, 2))
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_ADMIN
| GNUNET_GE_BULK,
"write", s);
GNUNET_disk_file_close (ectx, s, fd);
GNUNET_free (s);
Modified: GNUnet/src/applications/gap/gap.c
===================================================================
--- GNUnet/src/applications/gap/gap.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/applications/gap/gap.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -53,17 +53,17 @@
/**
* GNUnet core.
*/
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
/**
* Identity service.
*/
-static Identity_ServiceAPI *identity;
+static GNUNET_Identity_ServiceAPI *identity;
/**
* Statistics service.
*/
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
static int stat_routing_collisions;
@@ -106,26 +106,26 @@
/**
* Topology service.
*/
-static Topology_ServiceAPI *topology;
+static GNUNET_Topology_ServiceAPI *topology;
/**
* Traffic service.
*/
-static Traffic_ServiceAPI *traffic;
+static GNUNET_Traffic_ServiceAPI *traffic;
/**
* For migration / local stores, local lookup and
* content verification.
*/
-static Blockstore *bs;
+static GNUNET_Blockstore *bs;
/**
* Function that can be used to identify unique
* replies.
*/
-static UniqueReplyIdentifier uri;
+static GNUNET_UniqueReplyIdentifierCallback uri;
-static ReplyHashFunction rhf;
+static GNUNET_ReplyHashingCallback rhf;
/**
* The routing table. This table has entries for all
@@ -184,9 +184,9 @@
static int hist_total;
#endif
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
/* ****************** helper functions ***************** */
@@ -528,8 +528,8 @@
((char *) &enc)[6] = '\0';
GNUNET_hash_to_enc (&peer->hashPubKey, &enc2);
((char *) &enc2)[6] = '\0';
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Q %s peer %2u (%s) ranks (responses: %2u, distance %4d): %u%s\n",
&enc,
idx,
@@ -557,7 +557,7 @@
}
/**
- * A "PerNodeCallback" method that forwards the query to the selected
+ * A "GNUNET_NodeIteratorCallback" method that forwards the query to the
selected
* nodes.
*/
static void
@@ -590,11 +590,11 @@
{
#if DEBUG_GAP
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&peer->hashPubKey, &encp);
GNUNET_hash_to_enc (&qr->msg->queries[0], &encq));
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Sending query `%s' to `%s'\n", &encq, &encp);
#endif
if (stats != NULL)
@@ -735,7 +735,7 @@
if (pos > sel)
{
setBit (qr, j);
- GE_ASSERT (ectx, rankingSum >= qr->rankings[j]);
+ GNUNET_GE_ASSERT (ectx, rankingSum >= qr->rankings[j]);
rankingSum -= qr->rankings[j];
qr->rankings[j] = 0;
break;
@@ -804,7 +804,7 @@
= (((unsigned int *) query)[0] ^
((unsigned int *) query)[1] / (1 + random_qsel))
% indirectionTableSize;
- GE_ASSERT (ectx, res < indirectionTableSize);
+ GNUNET_GE_ASSERT (ectx, res < indirectionTableSize);
#if DO_HISTOGRAM
histogram[res % 65536]++;
if (++hist_total % 10000 == 0)
@@ -846,7 +846,7 @@
*
* @param sender the next hop
* @param result the content that was found
- * @param data is a DataContainer which
+ * @param data is a GNUNET_DataContainer which
* wraps the content in the format that
* can be passed to the FS module (GapWrapper),
* which in turn wraps the DBlock (including
@@ -854,7 +854,7 @@
*/
static int
queueReply (const GNUNET_PeerIdentity * sender,
- const GNUNET_HashCode * primaryKey, const DataContainer * data)
+ const GNUNET_HashCode * primaryKey, const GNUNET_DataContainer *
data)
{
P2P_gap_reply_MESSAGE *pmsg;
IndirectionTableEntry *ite;
@@ -863,23 +863,23 @@
GNUNET_EncName enc;
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER, GNUNET_hash_to_enc (primaryKey,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (primaryKey,
&enc));
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Gap queues reply to query `%s' for later use.\n", &enc);
#endif
#if EXTRA_CHECKS
/* verify data is valid */
- uri (data, ANY_BLOCK, GNUNET_YES, primaryKey);
+ uri (data, GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY, GNUNET_YES, primaryKey);
#endif
ite = &ROUTING_indTable_[computeRoutingIndex (primaryKey)];
if (0 != memcmp (&ite->primaryKey, primaryKey, sizeof (GNUNET_HashCode)))
{
#if DEBUG_GAP
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"GAP: Dropping reply, routing table has no query associated with
it (anymore)\n");
#endif
return GNUNET_NO; /* we don't care for the reply (anymore) */
@@ -887,8 +887,8 @@
if (GNUNET_YES == ite->successful_local_lookup_in_delay_loop)
{
#if DEBUG_GAP
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"GAP: Dropping reply, found reply locally during delay\n");
#endif
return GNUNET_NO; /* wow, really bad concurrent DB lookup and
processing for
@@ -897,16 +897,16 @@
}
size =
sizeof (P2P_gap_reply_MESSAGE) + ntohl (data->size) -
- sizeof (DataContainer);
+ sizeof (GNUNET_DataContainer);
if (size >= GNUNET_MAX_BUFFER_SIZE)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
ite->successful_local_lookup_in_delay_loop = GNUNET_YES;
pmsg = GNUNET_malloc (size);
pmsg->header.size = htons (size);
- pmsg->header.type = htons (P2P_PROTO_gap_RESULT);
+ pmsg->header.type = htons (GNUNET_P2P_PROTO_GAP_RESULT);
pmsg->primaryKey = *primaryKey;
memcpy (&pmsg[1], &data[1], size - sizeof (P2P_gap_reply_MESSAGE));
/* delay reply, delay longer if we are busy (makes it harder
@@ -997,12 +997,12 @@
#if DEBUG__GAP
GNUNET_EncName enc;
- IF_GELOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (query, &enc));
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"GAP: Queueing query '%s' in slot %p\n", &enc, ite);
#endif
- GE_ASSERT (ectx, sender != 0); /* do NOT add to RT for local clients!
*/
+ GNUNET_GE_ASSERT (ectx, sender != 0); /* do NOT add to RT for local
clients! */
now = GNUNET_get_time ();
if ((stats != NULL) && (ite->ttl == 0))
stats->change (stat_routing_slots_used, 1);
@@ -1034,7 +1034,7 @@
}
else
{ /* GNUNET_array_grow mode */
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
0 == memcmp (query, &ite->primaryKey,
sizeof (GNUNET_HashCode)));
/* extend lifetime */
@@ -1425,10 +1425,10 @@
resolve_pid (ite->destination[j], &recv);
#if DEBUG_GAP
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&recv.hashPubKey, &enc));
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"GAP sending reply to `%s'\n", &enc);
#endif
coreAPI->unicast (&recv, msg, BASE_REPLY_PRIORITY * (ite->priority + 5),
@@ -1439,7 +1439,7 @@
struct qLRC
{
- DataContainer **values;
+ GNUNET_DataContainer **values;
unsigned int valueCount;
GNUNET_HashCode query;
};
@@ -1450,7 +1450,7 @@
*
* @param primaryKey is the key needed to decrypt
* the block
- * @param value is a DataContainer which
+ * @param value is a GNUNET_DataContainer which
* wraps the content in the format that
* can be passed to the FS module (GapWrapper),
* which in turn wraps the DBlock (including
@@ -1458,14 +1458,14 @@
*/
static int
queryLocalResultCallback (const GNUNET_HashCode * primaryKey,
- const DataContainer * value, void *closure)
+ const GNUNET_DataContainer * value, void *closure)
{
struct qLRC *cls = closure;
int i;
#if EXTRA_CHECKS
/* verify data is valid */
- uri (value, ANY_BLOCK, GNUNET_YES, primaryKey);
+ uri (value, GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY, GNUNET_YES, primaryKey);
#endif
/* check seen */
if ((cls->valueCount > MAX_SEEN_VALUES) &&
@@ -1522,7 +1522,7 @@
return GNUNET_SYSERR; /* not fully initialized */
senderID = intern_pid (sender);
- GE_ASSERT (ectx, (senderID != 0) || (sender == NULL));
+ GNUNET_GE_ASSERT (ectx, (senderID != 0) || (sender == NULL));
ite = &ROUTING_indTable_[computeRoutingIndex (&query->queries[0])];
GNUNET_mutex_lock (lookup_exclusion);
i = -1;
@@ -1559,11 +1559,11 @@
#if DEBUG_GAP
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&query->queries[0], &enc));
((char *) &enc)[6] = '\0';
- GE_LOG (ectx,
- GE_INFO | GE_IMMEDIATE | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_IMMEDIATE | GNUNET_GE_USER,
"GAP is executing request for `%s':%s%s (%d)\n",
&enc,
doForward ? " forwarding" : "", isRouted ? " routing" : "", i);
@@ -1609,7 +1609,7 @@
&query->queries[0],
cls.values[perm[i]], ite->priority)))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
GNUNET_free (cls.values[perm[i]]);
continue;
}
@@ -1665,7 +1665,7 @@
unsigned int size;
int ret;
unsigned int prio;
- DataContainer *value;
+ GNUNET_DataContainer *value;
double preference;
PID_INDEX hostId;
#if DEBUG_GAP
@@ -1675,18 +1675,18 @@
if (ntohs (pmsg->size) < sizeof (P2P_gap_reply_MESSAGE))
{
- GE_BREAK_OP (ectx, 0);
+ GNUNET_GE_BREAK_OP (ectx, 0);
return GNUNET_SYSERR; /* invalid! */
}
msg = (const P2P_gap_reply_MESSAGE *) pmsg;
#if DEBUG_GAP
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
if (host != NULL) GNUNET_hash_to_enc (&host->hashPubKey, &enc));
GNUNET_hash_to_enc (&msg->primaryKey, &enc2);
((char *) &enc2)[6] = '\0';
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"GAP received content `%s' from `%s'\n",
&enc2, (host != NULL) ? (const char *) &enc : "myself");
#endif
@@ -1702,8 +1702,8 @@
stats->change (stat_routing_reply_drops, 1);
return GNUNET_OK; /* not fully initialized! */
}
- value = GNUNET_malloc (size + sizeof (DataContainer));
- value->size = htonl (size + sizeof (DataContainer));
+ value = GNUNET_malloc (size + sizeof (GNUNET_DataContainer));
+ value->size = htonl (size + sizeof (GNUNET_DataContainer));
memcpy (&value[1], &msg[1], size);
rhf (value, &contentHC);
@@ -1714,13 +1714,13 @@
GNUNET_EncName enc;
IF_GELOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
if (host != NULL) GNUNET_hash_to_enc (&host->hashPubKey,
&enc));
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("GAP received invalid content from `%s'\n"),
(host != NULL) ? (const char *) &enc : _("myself"));
- GE_BREAK_OP (ectx, 0);
+ GNUNET_GE_BREAK_OP (ectx, 0);
GNUNET_free (value);
return GNUNET_SYSERR; /* invalid */
}
@@ -1844,11 +1844,11 @@
* @return GNUNET_SYSERR on error, GNUNET_OK on success
*/
static int
-init (Blockstore * datastore, UniqueReplyIdentifier uid, ReplyHashFunction rh)
+init (GNUNET_Blockstore * datastore, GNUNET_UniqueReplyIdentifierCallback uid,
GNUNET_ReplyHashingCallback rh)
{
if (bs != NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
bs = datastore;
@@ -1891,7 +1891,7 @@
1) * sizeof (GNUNET_HashCode);
if (size >= GNUNET_MAX_BUFFER_SIZE)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR; /* too many keys! */
}
@@ -1907,19 +1907,19 @@
anonymityLevel--;
if (traffic == NULL)
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_
("Cover traffic requested but traffic service not loaded.
Rejecting request.\n"));
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
- traffic->get ((TTL_DECREMENT + timeout) / TRAFFIC_TIME_UNIT,
- P2P_PROTO_gap_QUERY, TC_RECEIVED, &count, &peers,
+ traffic->get ((TTL_DECREMENT + timeout) / GNUNET_TRAFFIC_TIME_UNIT,
+ GNUNET_P2P_PROTO_GAP_QUERY,
GNUNET_TRAFFIC_TYPE_RECEIVED, &count, &peers,
&sizes, &timevect))
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Failed to get traffic stats.\n"));
return GNUNET_SYSERR;
}
@@ -1927,16 +1927,16 @@
{
if (peers < anonymityLevel / 1000)
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_
("Cannot satisfy desired level of anonymity, ignoring
request.\n"));
return GNUNET_SYSERR;
}
if (count < anonymityLevel % 1000)
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_
("Cannot satisfy desired level of anonymity, ignoring
request.\n"));
return GNUNET_SYSERR;
@@ -1946,8 +1946,8 @@
{
if (count < anonymityLevel)
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_
("Cannot satisfy desired level of anonymity, ignoring
request.\n"));
return GNUNET_SYSERR;
@@ -1958,7 +1958,7 @@
msg = GNUNET_malloc (size);
msg->header.size = htons (size);
- msg->header.type = htons (P2P_PROTO_gap_QUERY);
+ msg->header.type = htons (GNUNET_P2P_PROTO_GAP_QUERY);
msg->type = htonl (type);
msg->priority = htonl (prio);
msg->ttl = htonl (adjustTTL ((int) timeout - GNUNET_get_time (), prio));
@@ -1997,7 +1997,7 @@
* that buffer (must be a positive number).
*/
static unsigned int
-tryMigrate (const DataContainer * data,
+tryMigrate (const GNUNET_DataContainer * data,
const GNUNET_HashCode * primaryKey,
char *position, unsigned int padding)
{
@@ -2006,11 +2006,11 @@
size =
sizeof (P2P_gap_reply_MESSAGE) + ntohl (data->size) -
- sizeof (DataContainer);
+ sizeof (GNUNET_DataContainer);
if ((size > padding) || (size >= GNUNET_MAX_BUFFER_SIZE))
return 0;
reply = (P2P_gap_reply_MESSAGE *) position;
- reply->header.type = htons (P2P_PROTO_gap_RESULT);
+ reply->header.type = htons (GNUNET_P2P_PROTO_GAP_RESULT);
reply->header.size = htons (size);
reply->primaryKey = *primaryKey;
memcpy (&reply[1], &data[1], size - sizeof (P2P_gap_reply_MESSAGE));
@@ -2037,7 +2037,7 @@
if (bs == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return 0;
}
/* Load above hard limit? */
@@ -2047,11 +2047,11 @@
if (sender != NULL)
{
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&sender->hashPubKey, &enc));
}
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Dropping query from %s, this peer is too busy.\n",
sender == NULL ? "localhost" : (char *) &enc);
#endif
@@ -2064,7 +2064,7 @@
(ntohs (msg->size) != sizeof (P2P_gap_query_MESSAGE) +
(queries - 1) * sizeof (GNUNET_HashCode)))
{
- GE_BREAK_OP (ectx, 0);
+ GNUNET_GE_BREAK_OP (ectx, 0);
return GNUNET_SYSERR; /* malformed query */
}
@@ -2079,7 +2079,7 @@
(or B directly back to A; also should not happen)
in this case, A must just drop; however, this
should not happen (peers should check). */
- GE_BREAK_OP (ectx, 0);
+ GNUNET_GE_BREAK_OP (ectx, 0);
GNUNET_free (qmsg);
return GNUNET_OK;
}
@@ -2111,10 +2111,10 @@
policy = evaluateQuery (sender, &prio);
#if DEBUG_GAP
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&qmsg->queries[0], &enc));
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Received GAP query `%s'.\n", &enc);
#endif
if ((policy & QUERY_DROPMASK) == 0)
@@ -2125,11 +2125,11 @@
#if DEBUG_GAP
if (sender != NULL)
{
- IF_GELOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&sender->hashPubKey, &enc));
}
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Dropping query from %s, policy decided that this peer is too
busy.\n",
sender == NULL ? "localhost" : (const char *) &enc);
#endif
@@ -2190,29 +2190,29 @@
}
-GAP_ServiceAPI *
-provide_module_gap (CoreAPIForApplication * capi)
+GNUNET_GAP_ServiceAPI *
+provide_module_gap (GNUNET_CoreAPIForPlugins * capi)
{
- static GAP_ServiceAPI api;
+ static GNUNET_GAP_ServiceAPI api;
unsigned int i;
ectx = capi->ectx;
cfg = capi->cfg;
coreAPI = capi;
- if ((-1 == GC_get_configuration_value_number (cfg, "LOAD", "HARDCPULIMIT",
0, 100000, /* 1000 CPUs!? */
+ if ((-1 == GNUNET_GC_get_configuration_value_number (cfg, "LOAD",
"HARDCPULIMIT", 0, 100000, /* 1000 CPUs!? */
0, /* 0 == no limit */
- &hardCPULimit)) || (-1 ==
GC_get_configuration_value_number (cfg, "LOAD", "HARDUPLIMIT", 0, 999999999, 0,
/* 0 == no limit */
+ &hardCPULimit)) || (-1 ==
GNUNET_GC_get_configuration_value_number (cfg, "LOAD", "HARDUPLIMIT", 0,
999999999, 0, /* 0 == no limit */
&hardUpLimit))
|| (-1 ==
- GC_get_configuration_value_number (cfg, "GAP", "TABLESIZE",
+ GNUNET_GC_get_configuration_value_number (cfg, "GAP", "TABLESIZE",
MIN_INDIRECTION_TABLE_SIZE,
GNUNET_MAX_GNUNET_malloc_CHECKED
/ sizeof (IndirectionTableEntry),
MIN_INDIRECTION_TABLE_SIZE,
&indirectionTableSize)))
return NULL;
- GE_ASSERT (ectx, sizeof (P2P_gap_reply_MESSAGE) == 68);
- GE_ASSERT (ectx, sizeof (P2P_gap_query_MESSAGE) == 144);
+ GNUNET_GE_ASSERT (ectx, sizeof (P2P_gap_reply_MESSAGE) == 68);
+ GNUNET_GE_ASSERT (ectx, sizeof (P2P_gap_query_MESSAGE) == 144);
stats = capi->requestService ("stats");
if (stats != NULL)
@@ -2273,13 +2273,13 @@
identity = coreAPI->requestService ("identity");
- GE_ASSERT (ectx, identity != NULL);
+ GNUNET_GE_ASSERT (ectx, identity != NULL);
topology = coreAPI->requestService ("topology");
- GE_ASSERT (ectx, topology != NULL);
+ GNUNET_GE_ASSERT (ectx, topology != NULL);
traffic = coreAPI->requestService ("traffic");
if (traffic == NULL)
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_
("Traffic service failed to load; gap cannot ensure
cover-traffic availability.\n"));
}
@@ -2303,12 +2303,12 @@
GNUNET_cron_add_job (capi->cron, &ageRTD, 2 * GNUNET_CRON_MINUTES,
2 * GNUNET_CRON_MINUTES, NULL);
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("`%s' registering handlers %d %d\n"),
- "gap", P2P_PROTO_gap_QUERY, P2P_PROTO_gap_RESULT);
- capi->registerHandler (P2P_PROTO_gap_QUERY, &handleQuery);
- capi->registerHandler (P2P_PROTO_gap_RESULT, &useContent);
+ "gap", GNUNET_P2P_PROTO_GAP_QUERY, GNUNET_P2P_PROTO_GAP_RESULT);
+ capi->registerHandler (GNUNET_P2P_PROTO_GAP_QUERY, &handleQuery);
+ capi->registerHandler (GNUNET_P2P_PROTO_GAP_RESULT, &useContent);
coreAPI->registerSendCallback (sizeof (P2P_gap_query_MESSAGE),
&fillInQuery);
@@ -2328,8 +2328,8 @@
ReplyTrackData *pos;
IndirectionTableEntry *ite;
- coreAPI->unregisterHandler (P2P_PROTO_gap_QUERY, &handleQuery);
- coreAPI->unregisterHandler (P2P_PROTO_gap_RESULT, &useContent);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_GAP_QUERY, &handleQuery);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_GAP_RESULT, &useContent);
coreAPI->unregisterSendCallback (sizeof (P2P_gap_query_MESSAGE),
&fillInQuery);
Modified: GNUnet/src/applications/gap/gaptest.c
===================================================================
--- GNUnet/src/applications/gap/gaptest.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/gap/gaptest.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -34,9 +34,9 @@
#include "gnunet_util_network_client.h"
#include "gnunet_stats_lib.h"
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static int
testTerminate (void *unused)
@@ -77,14 +77,14 @@
return fn;
}
-static struct ECRS_URI *
+static struct GNUNET_ECRS_URI *
uploadFile (unsigned int size)
{
int ret;
char *name;
int fd;
char *buf;
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
int i;
name = makeName (size);
@@ -99,26 +99,26 @@
WRITE (fd, buf, size);
GNUNET_free (buf);
GNUNET_disk_file_close (ectx, name, fd);
- ret = ECRS_uploadFile (ectx, cfg, name, GNUNET_YES, /* index */
+ ret = GNUNET_ECRS_file_upload (ectx, cfg, name, GNUNET_YES, /* index */
0, /* anon */
0, /* prio */
GNUNET_get_time () + 10 * GNUNET_CRON_MINUTES, /*
expire */
&uprogress, NULL, &testTerminate, NULL, &uri);
if (ret != GNUNET_SYSERR)
{
- struct ECRS_MetaData *meta;
- struct ECRS_URI *key;
+ struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_ECRS_URI *key;
const char *keywords[2];
keywords[0] = name;
keywords[1] = NULL;
- meta = ECRS_createMetaData ();
- key = ECRS_keywordsToUri (keywords);
- ret = ECRS_addToKeyspace (ectx, cfg, key, 0, 0, GNUNET_get_time () + 10
* GNUNET_CRON_MINUTES, /* expire */
+ meta = GNUNET_ECRS_meta_data_create ();
+ key = GNUNET_ECRS_keyword_strings_to_uri (keywords);
+ ret = GNUNET_ECRS_publish_under_keyword (ectx, cfg, key, 0, 0,
GNUNET_get_time () + 10 * GNUNET_CRON_MINUTES, /* expire */
uri, meta);
- ECRS_freeMetaData (meta);
- ECRS_freeUri (uri);
+ GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_ECRS_uri_destroy (uri);
GNUNET_free (name);
if (ret == GNUNET_OK)
{
@@ -126,7 +126,7 @@
}
else
{
- ECRS_freeUri (key);
+ GNUNET_ECRS_uri_destroy (key);
return NULL;
}
}
@@ -138,18 +138,18 @@
}
static int
-searchCB (const ECRS_FileInfo * fi,
+searchCB (const GNUNET_ECRS_FileInfo * fi,
const GNUNET_HashCode * key, int isRoot, void *closure)
{
- struct ECRS_URI **my = closure;
+ struct GNUNET_ECRS_URI **my = closure;
char *tmp;
- tmp = ECRS_uriToString (fi->uri);
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER, "Search found URI `%s'\n", tmp);
+ tmp = GNUNET_ECRS_uri_to_string (fi->uri);
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, "Search found
URI `%s'\n", tmp);
GNUNET_free (tmp);
- GE_ASSERT (ectx, NULL == *my);
- *my = ECRS_dupUri (fi->uri);
+ GNUNET_GE_ASSERT (ectx, NULL == *my);
+ *my = GNUNET_ECRS_uri_duplicate (fi->uri);
return GNUNET_SYSERR; /* abort search */
}
@@ -158,19 +158,19 @@
* @return GNUNET_OK on success
*/
static int
-searchFile (struct ECRS_URI **uri)
+searchFile (struct GNUNET_ECRS_URI **uri)
{
int ret;
- struct ECRS_URI *myURI;
+ struct GNUNET_ECRS_URI *myURI;
myURI = NULL;
- ret = ECRS_search (ectx,
+ ret = GNUNET_ECRS_search (ectx,
cfg,
*uri,
0,
15 * GNUNET_CRON_SECONDS,
&searchCB, &myURI, &testTerminate, NULL);
- ECRS_freeUri (*uri);
+ GNUNET_ECRS_uri_destroy (*uri);
*uri = myURI;
if ((ret != GNUNET_SYSERR) && (myURI != NULL))
return GNUNET_OK;
@@ -179,7 +179,7 @@
}
static int
-downloadFile (unsigned int size, const struct ECRS_URI *uri)
+downloadFile (unsigned int size, const struct GNUNET_ECRS_URI *uri)
{
int ret;
char *tmpName;
@@ -189,14 +189,14 @@
int i;
char *tmp;
- tmp = ECRS_uriToString (uri);
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ tmp = GNUNET_ECRS_uri_to_string (uri);
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Starting download of `%s'\n", tmp);
GNUNET_free (tmp);
tmpName = makeName (0);
ret = GNUNET_SYSERR;
- if (GNUNET_OK == ECRS_downloadFile (ectx,
+ if (GNUNET_OK == GNUNET_ECRS_file_download (ectx,
cfg,
uri,
tmpName,
@@ -232,14 +232,14 @@
char *name;
name = makeName (size);
- ret = ECRS_unindexFile (ectx, cfg, name, NULL, NULL, &testTerminate, NULL);
+ ret = GNUNET_ECRS_file_uninde (ectx, cfg, name, NULL, NULL, &testTerminate,
NULL);
if (0 != UNLINK (name))
ret = GNUNET_SYSERR;
GNUNET_free (name);
return ret;
}
-#define CHECK(a) if (!(a)) { ret = 1; GE_BREAK(ectx, 0); goto FAILURE; }
+#define CHECK(a) if (!(a)) { ret = 1; GNUNET_GE_BREAK(ectx, 0); goto FAILURE; }
#define START_PEERS 1
@@ -252,13 +252,13 @@
{
struct GNUNET_TESTING_DaemonContext *peers;
int ret;
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
ret = 0;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#if START_PEERS
@@ -269,7 +269,7 @@
if (peers == NULL)
{
fprintf (stderr, "Failed to start the gnunetd daemons!\n");
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#endif
@@ -277,19 +277,19 @@
{
GNUNET_TESTING_stop_daemons (peers);
fprintf (stderr, "Failed to connect the peers!\n");
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
uri = uploadFile (12345);
CHECK (NULL != uri);
- GC_set_configuration_value_string (cfg,
+ GNUNET_GC_set_configuration_value_string (cfg,
ectx,
"NETWORK", "HOST", "localhost:12087");
CHECK (GNUNET_OK == searchFile (&uri));
CHECK (GNUNET_OK == downloadFile (12345, uri));
- ECRS_freeUri (uri);
- GC_set_configuration_value_string (cfg,
+ GNUNET_ECRS_uri_destroy (uri);
+ GNUNET_GC_set_configuration_value_string (cfg,
ectx,
"NETWORK", "HOST", "localhost:2087");
CHECK (GNUNET_OK == unindexFile (12345));
@@ -299,7 +299,7 @@
GNUNET_TESTING_stop_daemons (peers);
#endif
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return ret;
}
Modified: GNUnet/src/applications/gap/gaptest2.c
===================================================================
--- GNUnet/src/applications/gap/gaptest2.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/gap/gaptest2.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -41,9 +41,9 @@
#define SIZE 1024 * 1024 * 2
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static int
testTerminate (void *unused)
@@ -82,14 +82,14 @@
return fn;
}
-static struct ECRS_URI *
+static struct GNUNET_ECRS_URI *
uploadFile (unsigned int size)
{
int ret;
char *name;
int fd;
char *buf;
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
int i;
name = makeName (size);
@@ -104,7 +104,7 @@
WRITE (fd, buf, size);
GNUNET_free (buf);
GNUNET_disk_file_close (ectx, name, fd);
- ret = ECRS_uploadFile (ectx, cfg, name, GNUNET_YES, /* index */
+ ret = GNUNET_ECRS_file_upload (ectx, cfg, name, GNUNET_YES, /* index */
1, /* anon */
0, /* prio */
GNUNET_get_time () + 100 * GNUNET_CRON_MINUTES,
/* expire */
@@ -112,19 +112,19 @@
NULL, &testTerminate, NULL, &uri);
if (ret != GNUNET_SYSERR)
{
- struct ECRS_MetaData *meta;
- struct ECRS_URI *key;
+ struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_ECRS_URI *key;
const char *keywords[2];
keywords[0] = name;
keywords[1] = NULL;
- meta = ECRS_createMetaData ();
- key = ECRS_keywordsToUri (keywords);
- ret = ECRS_addToKeyspace (ectx, cfg, key, 0, 0, GNUNET_get_time () + 100
* GNUNET_CRON_MINUTES, /* expire */
+ meta = GNUNET_ECRS_meta_data_create ();
+ key = GNUNET_ECRS_keyword_strings_to_uri (keywords);
+ ret = GNUNET_ECRS_publish_under_keyword (ectx, cfg, key, 0, 0,
GNUNET_get_time () + 100 * GNUNET_CRON_MINUTES, /* expire */
uri, meta);
- ECRS_freeMetaData (meta);
- ECRS_freeUri (uri);
+ GNUNET_ECRS_meta_data_destroy (meta);
+ GNUNET_ECRS_uri_destroy (uri);
GNUNET_free (name);
if (ret == GNUNET_OK)
{
@@ -132,7 +132,7 @@
}
else
{
- ECRS_freeUri (key);
+ GNUNET_ECRS_uri_destroy (key);
return NULL;
}
}
@@ -144,18 +144,18 @@
}
static int
-searchCB (const ECRS_FileInfo * fi,
+searchCB (const GNUNET_ECRS_FileInfo * fi,
const GNUNET_HashCode * key, int isRoot, void *closure)
{
- struct ECRS_URI **my = closure;
+ struct GNUNET_ECRS_URI **my = closure;
char *tmp;
- tmp = ECRS_uriToString (fi->uri);
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ tmp = GNUNET_ECRS_uri_to_string (fi->uri);
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Search found URI `%s'\n", tmp);
GNUNET_free (tmp);
- GE_ASSERT (ectx, NULL == *my);
- *my = ECRS_dupUri (fi->uri);
+ GNUNET_GE_ASSERT (ectx, NULL == *my);
+ *my = GNUNET_ECRS_uri_duplicate (fi->uri);
return GNUNET_SYSERR; /* abort search */
}
@@ -164,19 +164,19 @@
* @return GNUNET_OK on success
*/
static int
-searchFile (struct ECRS_URI **uri)
+searchFile (struct GNUNET_ECRS_URI **uri)
{
int ret;
- struct ECRS_URI *myURI;
+ struct GNUNET_ECRS_URI *myURI;
myURI = NULL;
- ret = ECRS_search (ectx,
+ ret = GNUNET_ECRS_search (ectx,
cfg,
*uri,
1,
1450 * GNUNET_CRON_SECONDS,
&searchCB, &myURI, &testTerminate, NULL);
- ECRS_freeUri (*uri);
+ GNUNET_ECRS_uri_destroy (*uri);
*uri = myURI;
if ((ret != GNUNET_SYSERR) && (myURI != NULL))
return GNUNET_OK;
@@ -185,7 +185,7 @@
}
static int
-downloadFile (unsigned int size, const struct ECRS_URI *uri)
+downloadFile (unsigned int size, const struct GNUNET_ECRS_URI *uri)
{
int ret;
char *tmpName;
@@ -195,14 +195,14 @@
int i;
char *tmp;
- tmp = ECRS_uriToString (uri);
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ tmp = GNUNET_ECRS_uri_to_string (uri);
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Starting download of `%s'\n", tmp);
GNUNET_free (tmp);
tmpName = makeName (0);
ret = GNUNET_SYSERR;
- if (GNUNET_OK == ECRS_downloadFile (ectx,
+ if (GNUNET_OK == GNUNET_ECRS_file_download (ectx,
cfg,
uri,
tmpName,
@@ -238,14 +238,14 @@
char *name;
name = makeName (size);
- ret = ECRS_unindexFile (ectx, cfg, name, NULL, NULL, &testTerminate, NULL);
+ ret = GNUNET_ECRS_file_uninde (ectx, cfg, name, NULL, NULL, &testTerminate,
NULL);
if (0 != UNLINK (name))
ret = GNUNET_SYSERR;
GNUNET_free (name);
return ret;
}
-#define CHECK(a) if (!(a)) { ret = 1; GE_BREAK(ectx, 0); goto FAILURE; }
+#define CHECK(a) if (!(a)) { ret = 1; GNUNET_GE_BREAK(ectx, 0); goto FAILURE; }
/**
* Testcase to test gap routing (2 peers only).
@@ -256,16 +256,16 @@
{
struct GNUNET_TESTING_DaemonContext *peers;
int ret;
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
int i;
char buf[128];
GNUNET_CronTime start;
ret = 0;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#if START_PEERS
@@ -276,7 +276,7 @@
if (peers == NULL)
{
fprintf (stderr, "Failed to start the gnunetd daemons!\n");
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#endif
@@ -287,7 +287,7 @@
{
GNUNET_TESTING_stop_daemons (peers);
fprintf (stderr, "Failed to connect the peers!\n");
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
}
@@ -296,7 +296,7 @@
uri = uploadFile (SIZE);
CHECK (NULL != uri);
GNUNET_snprintf (buf, 128, "localhost:%u", 2077 + PEER_COUNT * 10);
- GC_set_configuration_value_string (cfg, ectx, "NETWORK", "HOST", buf);
+ GNUNET_GC_set_configuration_value_string (cfg, ectx, "NETWORK", "HOST", buf);
CHECK (GNUNET_OK == searchFile (&uri));
printf ("Search successful!\n");
start = GNUNET_get_time ();
@@ -305,8 +305,8 @@
printf ("Download successful at %llu kbps!\n",
(SIZE / 1024) / ((GNUNET_get_time () - start) /
GNUNET_CRON_SECONDS));
- ECRS_freeUri (uri);
- GC_set_configuration_value_string (cfg,
+ GNUNET_ECRS_uri_destroy (uri);
+ GNUNET_GC_set_configuration_value_string (cfg,
ectx,
"NETWORK", "HOST", "localhost:2087");
CHECK (GNUNET_OK == unindexFile (SIZE));
@@ -316,7 +316,7 @@
GNUNET_TESTING_stop_daemons (peers);
#endif
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return ret;
}
Modified: GNUnet/src/applications/gap/gaptest3.c
===================================================================
--- GNUnet/src/applications/gap/gaptest3.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/gap/gaptest3.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -41,9 +41,9 @@
#define SIZE 1024*1024*2
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static int
testTerminate (void *unused)
@@ -82,14 +82,14 @@
return fn;
}
-static struct ECRS_URI *
+static struct GNUNET_ECRS_URI *
uploadFile (unsigned int size)
{
int ret;
char *name;
int fd;
char *buf;
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
int i;
name = makeName (size);
@@ -104,7 +104,7 @@
WRITE (fd, buf, size);
GNUNET_free (buf);
GNUNET_disk_file_close (ectx, name, fd);
- ret = ECRS_uploadFile (ectx, cfg, name, GNUNET_YES, /* index */
+ ret = GNUNET_ECRS_file_upload (ectx, cfg, name, GNUNET_YES, /* index */
1, /* anon */
0, /* prio */
GNUNET_get_time () + 100 * GNUNET_CRON_MINUTES,
/* expire */
@@ -116,7 +116,7 @@
}
static int
-downloadFile (unsigned int size, const struct ECRS_URI *uri)
+downloadFile (unsigned int size, const struct GNUNET_ECRS_URI *uri)
{
int ret;
char *tmpName;
@@ -126,14 +126,14 @@
int i;
char *tmp;
- tmp = ECRS_uriToString (uri);
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ tmp = GNUNET_ECRS_uri_to_string (uri);
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Starting download of `%s'\n", tmp);
GNUNET_free (tmp);
tmpName = makeName (0);
ret = GNUNET_SYSERR;
- if (GNUNET_OK == ECRS_downloadFile (ectx,
+ if (GNUNET_OK == GNUNET_ECRS_file_download (ectx,
cfg,
uri,
tmpName,
@@ -162,7 +162,7 @@
return ret;
}
-#define CHECK(a) if (!(a)) { ret = 1; GE_BREAK(ectx, 0); goto FAILURE; }
+#define CHECK(a) if (!(a)) { ret = 1; GNUNET_GE_BREAK(ectx, 0); goto FAILURE; }
static GNUNET_PeerIdentity goodPeers[PEER_COUNT];
static unsigned int goodPeerPos;
@@ -202,7 +202,7 @@
{
struct GNUNET_TESTING_DaemonContext *peers;
int ret;
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
int i;
char buf[128];
GNUNET_MessageHello *hello;
@@ -211,10 +211,10 @@
GNUNET_EncName enc;
ret = 0;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#if START_PEERS
@@ -225,7 +225,7 @@
if (peers == NULL)
{
fprintf (stderr, "Failed to start the gnunetd daemons!\n");
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#endif
@@ -236,7 +236,7 @@
{
GNUNET_TESTING_stop_daemons (peers);
fprintf (stderr, "Failed to connect the peers!\n");
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
}
@@ -246,17 +246,17 @@
for (i = 1; i < PEER_COUNT; i += 2)
{
GNUNET_snprintf (buf, 128, "localhost:%u", 2087 + i * 10);
- GC_set_configuration_value_string (cfg, ectx, "NETWORK", "HOST", buf);
+ GNUNET_GC_set_configuration_value_string (cfg, ectx, "NETWORK", "HOST",
buf);
sock = GNUNET_client_connection_create (NULL, cfg);
if (GNUNET_OK != GNUNET_IDENTITY_get_self (sock, &hello))
{
GNUNET_client_connection_destroy (sock);
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
break;
}
GNUNET_client_connection_destroy (sock);
if (uri != NULL)
- ECRS_freeUri (uri);
+ GNUNET_ECRS_uri_destroy (uri);
GNUNET_hash_to_enc (&hello->senderIdentity.hashPubKey, &enc);
printf ("Uploading to peer `%8s'\n", (const char *) &enc);
uri = uploadFile (SIZE);
@@ -266,7 +266,7 @@
GNUNET_free (hello);
}
- GC_set_configuration_value_string (cfg,
+ GNUNET_GC_set_configuration_value_string (cfg,
ectx,
"NETWORK", "HOST", "localhost:2087");
printf ("Downloading...\n");
@@ -285,7 +285,7 @@
#if START_PEERS
GNUNET_TESTING_stop_daemons (peers);
#endif
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return ret;
}
Modified: GNUnet/src/applications/gap/pid_table.c
===================================================================
--- GNUnet/src/applications/gap/pid_table.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/gap/pid_table.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -30,13 +30,13 @@
/**
* Statistics service.
*/
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
static int stat_pid_entries;
static int stat_pid_rc;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
typedef struct
{
@@ -95,7 +95,7 @@
}
if (ret == 0)
ret = 1;
- GE_ASSERT (ectx, ret < size);
+ GNUNET_GE_ASSERT (ectx, ret < size);
table[ret].id = pid->hashPubKey;
table[ret].rc = 1;
GNUNET_mutex_unlock (lock);
@@ -118,8 +118,8 @@
for (i = count - 1; i >= 0; i--)
{
id = ids[i];
- GE_ASSERT (ectx, id < size);
- GE_ASSERT (ectx, table[id].rc > 0);
+ GNUNET_GE_ASSERT (ectx, id < size);
+ GNUNET_GE_ASSERT (ectx, table[id].rc > 0);
table[id].rc--;
if ((table[id].rc == 0) && (stats != NULL))
stats->change (stat_pid_entries, -1);
@@ -135,8 +135,8 @@
if (id == 0)
return;
GNUNET_mutex_lock (lock);
- GE_ASSERT (ectx, id < size);
- GE_ASSERT (ectx, table[id].rc > 0);
+ GNUNET_GE_ASSERT (ectx, id < size);
+ GNUNET_GE_ASSERT (ectx, table[id].rc > 0);
table[id].rc += delta;
if (stats != NULL)
{
@@ -153,19 +153,19 @@
if (id == 0)
{
memset (pid, 0, sizeof (GNUNET_PeerIdentity));
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return;
}
GNUNET_mutex_lock (lock);
- GE_ASSERT (ectx, id < size);
- GE_ASSERT (ectx, table[id].rc > 0);
+ GNUNET_GE_ASSERT (ectx, id < size);
+ GNUNET_GE_ASSERT (ectx, table[id].rc > 0);
pid->hashPubKey = table[id].id;
GNUNET_mutex_unlock (lock);
}
void
-init_pid_table (struct GE_Context *e, Stats_ServiceAPI * s)
+init_pid_table (struct GNUNET_GE_Context *e, GNUNET_Stats_ServiceAPI * s)
{
ectx = e;
stats = s;
Modified: GNUnet/src/applications/gap/pid_table.h
===================================================================
--- GNUnet/src/applications/gap/pid_table.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/gap/pid_table.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -27,7 +27,7 @@
#include "gnunet_util.h"
#include "gnunet_stats_service.h"
-void init_pid_table (struct GE_Context *ectx, Stats_ServiceAPI * s);
+void init_pid_table (struct GNUNET_GE_Context *ectx, GNUNET_Stats_ServiceAPI *
s);
void done_pid_table (void);
Modified: GNUnet/src/applications/getoption/clientapi.c
===================================================================
--- GNUnet/src/applications/getoption/clientapi.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/getoption/clientapi.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -47,10 +47,10 @@
char *ret;
memset (&req, 0, sizeof (CS_getoption_request_MESSAGE));
- req.header.type = htons (CS_PROTO_GET_OPTION_REQUEST);
+ req.header.type = htons (GNUNET_CS_PROTO_GET_OPTION_REQUEST);
req.header.size = htons (sizeof (CS_getoption_request_MESSAGE));
- if ((strlen (section) >= CS_getoption_request_MESSAGE_OPT_LEN) ||
- (strlen (option) >= CS_getoption_request_MESSAGE_OPT_LEN))
+ if ((strlen (section) >= CS_getoption_request_MESSAGNUNET_GE_OPT_LEN) ||
+ (strlen (option) >= CS_getoption_request_MESSAGNUNET_GE_OPT_LEN))
return NULL;
strcpy (&req.section[0], section);
strcpy (&req.option[0], option);
Modified: GNUnet/src/applications/getoption/getoption.c
===================================================================
--- GNUnet/src/applications/getoption/getoption.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/getoption/getoption.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -31,10 +31,10 @@
* @author Christian Grothoff
*/
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
static int
-handleGetOption (struct ClientHandle *sock,
+handleGetOption (struct GNUNET_ClientHandle *sock,
const GNUNET_MessageHeader * message)
{
CS_getoption_request_MESSAGE *req;
@@ -45,13 +45,13 @@
if (ntohs (message->size) != sizeof (CS_getoption_request_MESSAGE))
return GNUNET_SYSERR;
req = (CS_getoption_request_MESSAGE *) message;
- req->section[CS_getoption_request_MESSAGE_OPT_LEN - 1] = '\0';
- req->option[CS_getoption_request_MESSAGE_OPT_LEN - 1] = '\0';
+ req->section[CS_getoption_request_MESSAGNUNET_GE_OPT_LEN - 1] = '\0';
+ req->option[CS_getoption_request_MESSAGNUNET_GE_OPT_LEN - 1] = '\0';
val = NULL;
- if (GNUNET_NO == GC_have_configuration_value (coreAPI->cfg,
+ if (GNUNET_NO == GNUNET_GC_have_configuration_value (coreAPI->cfg,
req->section, req->option))
return GNUNET_SYSERR; /* signal error: option not set */
- if ((0 != GC_get_configuration_value_string (coreAPI->cfg,
+ if ((0 != GNUNET_GC_get_configuration_value_string (coreAPI->cfg,
req->section,
req->option,
NULL, &val)) || (val == NULL))
@@ -60,7 +60,7 @@
rep = GNUNET_malloc (sizeof (GNUNET_MessageHeader) + strlen (val) + 1);
rep->header.size = htons (sizeof (GNUNET_MessageHeader) + strlen (val) + 1);
memcpy (rep->value, val, strlen (val) + 1);
- rep->header.type = htons (CS_PROTO_GET_OPTION_REPLY);
+ rep->header.type = htons (GNUNET_CS_PROTO_GET_OPTION_REPLY);
ret = coreAPI->sendToClient (sock, &rep->header, GNUNET_YES);
GNUNET_free (rep);
GNUNET_free (val);
@@ -68,16 +68,16 @@
}
int
-initialize_module_getoption (CoreAPIForApplication * capi)
+initialize_module_getoption (GNUNET_CoreAPIForPlugins * capi)
{
coreAPI = capi;
- GE_LOG (capi->ectx,
- GE_INFO | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (capi->ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_REQUEST,
_("`%s' registering client handler %d\n"),
- "getoption", CS_PROTO_GET_OPTION_REQUEST);
- capi->registerClientHandler (CS_PROTO_GET_OPTION_REQUEST, &handleGetOption);
- GE_ASSERT (capi->ectx,
- 0 == GC_set_configuration_value_string (capi->cfg,
+ "getoption", GNUNET_CS_PROTO_GET_OPTION_REQUEST);
+ capi->registerClientHandler (GNUNET_CS_PROTO_GET_OPTION_REQUEST,
&handleGetOption);
+ GNUNET_GE_ASSERT (capi->ectx,
+ 0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
capi->ectx,
"ABOUT",
"getoption",
@@ -90,7 +90,7 @@
void
done_module_getoption ()
{
- coreAPI->unregisterClientHandler (CS_PROTO_GET_OPTION_REQUEST,
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_GET_OPTION_REQUEST,
&handleGetOption);
coreAPI = NULL;
}
Modified: GNUnet/src/applications/getoption/getoption.h
===================================================================
--- GNUnet/src/applications/getoption/getoption.h 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/getoption/getoption.h 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -21,7 +21,7 @@
#ifndef GETOPTION_H
#define GETOPTION_H
-#define CS_getoption_request_MESSAGE_OPT_LEN 32
+#define CS_getoption_request_MESSAGNUNET_GE_OPT_LEN 32
/**
* Request for option value.
@@ -29,8 +29,8 @@
typedef struct
{
GNUNET_MessageHeader header;
- char section[CS_getoption_request_MESSAGE_OPT_LEN];
- char option[CS_getoption_request_MESSAGE_OPT_LEN];
+ char section[CS_getoption_request_MESSAGNUNET_GE_OPT_LEN];
+ char option[CS_getoption_request_MESSAGNUNET_GE_OPT_LEN];
} CS_getoption_request_MESSAGE;
/**
Modified: GNUnet/src/applications/identity/clientapi.c
===================================================================
--- GNUnet/src/applications/identity/clientapi.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/identity/clientapi.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -43,7 +43,7 @@
msg = GNUNET_malloc (GNUNET_sizeof_hello (hello));
memcpy (msg, hello, GNUNET_sizeof_hello (hello));
- msg->header.type = htons (CS_PROTO_identity_HELLO);
+ msg->header.type = htons (GNUNET_CS_PROTO_IDENTITY_HELLO);
/* check that signature is valid -- internal
sanity check... */
if (GNUNET_SYSERR == GNUNET_RSA_verify (&msg->senderIdentity,
@@ -53,7 +53,7 @@
- sizeof (GNUNET_MessageHeader),
&msg->signature, &msg->publicKey))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
GNUNET_free (msg);
return GNUNET_SYSERR;
}
@@ -82,7 +82,7 @@
req = GNUNET_malloc (sizeof (GNUNET_MessageHeader) + size);
req->size = htons (sizeof (GNUNET_MessageHeader) + size);
- req->type = htons (CS_PROTO_identity_request_SIGN);
+ req->type = htons (GNUNET_CS_PROTO_IDENTITY_REQUEST_SIGNATURE);
memcpy (&req[1], data, size);
if (GNUNET_SYSERR == GNUNET_client_connection_write (sock, req))
{
@@ -97,7 +97,7 @@
return GNUNET_SYSERR;
}
if ((ntohs (reply->header.size) != sizeof (CS_identity_signature_MESSAGE))
- || (ntohs (reply->header.type) != CS_PROTO_identity_SIGNATURE))
+ || (ntohs (reply->header.type) != GNUNET_CS_PROTO_IDENTITY_SIGNATURE))
{
GNUNET_free (reply);
return GNUNET_SYSERR;
@@ -122,7 +122,7 @@
GNUNET_MessageHello *reply;
req.size = htons (sizeof (GNUNET_MessageHeader));
- req.type = htons (CS_PROTO_identity_request_HELLO);
+ req.type = htons (GNUNET_CS_PROTO_IDENTITY_REQUEST_HELLO);
if (GNUNET_SYSERR == GNUNET_client_connection_write (sock, &req))
return GNUNET_SYSERR;
if (GNUNET_OK !=
@@ -132,13 +132,13 @@
return GNUNET_SYSERR;
}
if ((ntohs (reply->header.size) < sizeof (GNUNET_MessageHello)) ||
- (ntohs (reply->header.type) != CS_PROTO_identity_HELLO) ||
+ (ntohs (reply->header.type) != GNUNET_CS_PROTO_IDENTITY_HELLO) ||
(ntohs (reply->header.size) != GNUNET_sizeof_hello (reply)))
{
GNUNET_free (reply);
return GNUNET_SYSERR;
}
- reply->header.type = htons (p2p_PROTO_hello);
+ reply->header.type = htons (GNUNET_P2P_PROTO_HELLO);
*msg = reply;
return GNUNET_OK;
}
@@ -157,7 +157,7 @@
CS_identity_connect_MESSAGE msg;
int result;
- msg.header.type = htons (CS_PROTO_identity_CONNECT);
+ msg.header.type = htons (GNUNET_CS_PROTO_IDENTITY_CONNECT);
msg.header.size = htons (sizeof (CS_identity_connect_MESSAGE));
msg.other = *peer;
if (GNUNET_SYSERR == GNUNET_client_connection_write (sock, &msg.header))
@@ -185,7 +185,7 @@
unsigned int count;
req.size = htons (sizeof (GNUNET_MessageHeader));
- req.type = htons (CS_PROTO_identity_request_INFO);
+ req.type = htons (GNUNET_CS_PROTO_IDENTITY_REQUEST_INFO);
if (GNUNET_SYSERR == GNUNET_client_connection_write (sock, &req))
return GNUNET_SYSERR;
count = 0;
@@ -193,20 +193,20 @@
{
if (ntohs (reply->size) < sizeof (GNUNET_MessageHeader))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
GNUNET_free (reply);
return GNUNET_SYSERR;
}
- if (ntohs (reply->type) == CS_PROTO_RETURN_VALUE)
+ if (ntohs (reply->type) == GNUNET_CS_PROTO_RETURN_VALUE)
{
GNUNET_free (reply);
return count;
}
count++;
- if ((ntohs (reply->type) != CS_PROTO_identity_INFO) ||
+ if ((ntohs (reply->type) != GNUNET_CS_PROTO_IDENTITY_INFO) ||
(ntohs (reply->size) < sizeof (CS_identity_peer_info_MESSAGE)))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
GNUNET_free (reply);
return GNUNET_SYSERR;
}
Modified: GNUnet/src/applications/identity/hostkey.c
===================================================================
--- GNUnet/src/applications/identity/hostkey.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/identity/hostkey.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -73,7 +73,7 @@
#if EXTRA_CHECKS
if (ret == GNUNET_OK)
{
- GE_ASSERT (NULL,
+ GNUNET_GE_ASSERT (NULL,
GNUNET_OK == GNUNET_RSA_verify (data, size, result,
&publicKey));
}
@@ -98,7 +98,7 @@
}
void
-initPrivateKey (struct GE_Context *ectx, struct GC_Configuration *cfg)
+initPrivateKey (struct GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration
*cfg)
{
char *gnHome;
char *hostkeyfile;
@@ -106,17 +106,17 @@
unsigned short len;
int res;
- GE_ASSERT (ectx,
- -1 != GC_get_configuration_value_filename (cfg,
+ GNUNET_GE_ASSERT (ectx,
+ -1 != GNUNET_GC_get_configuration_value_filename (cfg,
"GNUNETD",
"GNUNETD_HOME",
- VAR_DAEMON_DIRECTORY,
+
GNUNET_DEFAULT_DAEMON_VAR_DIRECTORY,
&gnHome));
GNUNET_disk_directory_create (ectx, gnHome);
if (GNUNET_YES != GNUNET_disk_directory_test (ectx, gnHome))
{
- GE_LOG (ectx,
- GE_FATAL | GE_ADMIN | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE,
_("Failed to access GNUnet home directory `%s'\n"), gnHome);
abort ();
}
@@ -145,8 +145,8 @@
encPrivateKey))
{
GNUNET_free (encPrivateKey);
- GE_LOG (ectx,
- GE_WARNING | GE_USER | GE_IMMEDIATE | GE_ADMIN,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE |
GNUNET_GE_ADMIN,
_
("Existing hostkey in file `%s' failed format check,
creating new hostkey.\n"),
hostkeyfile);
@@ -155,20 +155,20 @@
}
if (encPrivateKey == NULL)
{ /* make new hostkey */
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Creating new hostkey (this may take a while).\n"));
hostkey = GNUNET_RSA_create_key ();
- GE_ASSERT (ectx, hostkey != NULL);
+ GNUNET_GE_ASSERT (ectx, hostkey != NULL);
encPrivateKey = GNUNET_RSA_encode_key (hostkey);
- GE_ASSERT (ectx, encPrivateKey != NULL);
+ GNUNET_GE_ASSERT (ectx, encPrivateKey != NULL);
GNUNET_disk_file_write (ectx,
hostkeyfile,
encPrivateKey, ntohs (encPrivateKey->len),
"600");
GNUNET_free (encPrivateKey);
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_BULK, _("Done creating hostkey.\n"));
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_BULK, _("Done
creating hostkey.\n"));
}
else
{
@@ -176,7 +176,7 @@
GNUNET_free (encPrivateKey);
}
GNUNET_free (hostkeyfile);
- GE_ASSERT (ectx, hostkey != NULL);
+ GNUNET_GE_ASSERT (ectx, hostkey != NULL);
GNUNET_RSA_get_public_key (hostkey, &publicKey);
}
@@ -184,7 +184,7 @@
void
donePrivateKey ()
{
- GE_ASSERT (NULL, hostkey != NULL);
+ GNUNET_GE_ASSERT (NULL, hostkey != NULL);
GNUNET_RSA_free_key (hostkey);
hostkey = NULL;
}
Modified: GNUnet/src/applications/identity/hostkey.h
===================================================================
--- GNUnet/src/applications/identity/hostkey.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/identity/hostkey.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -59,7 +59,7 @@
-void initPrivateKey (struct GE_Context *ectx, struct GC_Configuration *cfg);
+void initPrivateKey (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg);
void donePrivateKey (void);
Modified: GNUnet/src/applications/identity/identity.c
===================================================================
--- GNUnet/src/applications/identity/identity.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/identity/identity.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -143,9 +143,9 @@
static GNUNET_PeerIdentity myIdentity;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
/**
* Get the filename under which we would store the GNUNET_MessageHello
@@ -177,7 +177,7 @@
{
int i;
- GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
+ GNUNET_GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
for (i = 0; i < numberOfHosts_; i++)
if ((0 ==
memcmp (id, &hosts_[i]->identity, sizeof (GNUNET_PeerIdentity))))
@@ -200,7 +200,7 @@
char *fn;
unsigned int trust;
- GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
+ GNUNET_GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
GNUNET_mutex_lock (lock_);
entry = findHost (identity);
if (entry == NULL)
@@ -271,11 +271,11 @@
host = findHost (hostId);
if (host == NULL)
{
- addHostToKnown (hostId, NAT_PROTOCOL_NUMBER);
+ addHostToKnown (hostId, GNUNET_TRANSPORT_PROTOCOL_NUMBER_NAT);
host = findHost (hostId);
if (host == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_mutex_unlock (lock_);
return 0;
}
@@ -325,8 +325,8 @@
unsigned int protoNumber;
char *fullname;
- GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
- GE_ASSERT (ectx, sizeof (GNUNET_EncName) == 104);
+ GNUNET_GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
+ GNUNET_GE_ASSERT (ectx, sizeof (GNUNET_EncName) == 104);
if (2 == sscanf (filename, "%103c.%u", (char *) &id, &protoNumber))
{
id.encoding[sizeof (GNUNET_EncName) - 1] = '\0';
@@ -345,27 +345,27 @@
if (GNUNET_disk_file_test (ectx, fullname) == GNUNET_YES)
{
if (0 == UNLINK (fullname))
- GE_LOG (ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_BULK,
_
("File `%s' in directory `%s' does not match naming
convention. "
"Removed.\n"), filename, networkIdDirectory);
else
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_BULK,
"unlink", fullname);
}
else if (GNUNET_disk_directory_test (ectx, fullname) == GNUNET_YES)
{
if (0 == RMDIR (fullname))
- GE_LOG (ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_BULK,
_
("Directory `%s' in directory `%s' does not match naming
convention. "
"Removed.\n"), filename, networkIdDirectory);
else
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_BULK,
"rmdir", fullname);
}
GNUNET_free (fullname);
@@ -395,12 +395,12 @@
retries++;
if ((retries & 32) > 0)
{
- GE_LOG (ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Still no peers found in `%s'!\n"), networkIdDirectory);
}
}
- GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
+ GNUNET_GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
}
@@ -440,7 +440,7 @@
getPeerIdentity (&tmp->publicKey, &have);
if (0 != memcmp (&have, &tmp->senderIdentity, sizeof (GNUNET_PeerIdentity)))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return;
}
GNUNET_mutex_lock (lock_);
@@ -490,8 +490,8 @@
int i;
int j;
- GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
- GE_ASSERT (ectx, protocol != ANY_PROTOCOL_NUMBER);
+ GNUNET_GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
+ GNUNET_GE_ASSERT (ectx, protocol != GNUNET_TRANSPORT_PROTOCOL_NUMBER_ANY);
GNUNET_mutex_lock (lock_);
for (i = 0; i < numberOfHosts_; i++)
{
@@ -524,8 +524,8 @@
/* also remove hello file itself */
fn = getHostFileName (identity, protocol);
if (0 != UNLINK (fn))
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK,
"unlink", fn);
GNUNET_free (fn);
@@ -541,7 +541,7 @@
GNUNET_free (entry);
}
GNUNET_mutex_unlock (lock_);
- GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
+ GNUNET_GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
return; /* deleted */
}
}
@@ -566,11 +566,11 @@
getPeerIdentity (&msg->publicKey, &have);
if (0 != memcmp (&have, &msg->senderIdentity, sizeof (GNUNET_PeerIdentity)))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return;
}
- GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
- GE_ASSERT (ectx, msg != NULL);
+ GNUNET_GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
+ GNUNET_GE_ASSERT (ectx, msg != NULL);
fn = getHostFileName (&msg->senderIdentity, ntohs (msg->protocol));
buffer = GNUNET_malloc (GNUNET_MAX_BUFFER_SIZE);
if (GNUNET_disk_file_test (ectx, fn) == GNUNET_YES)
@@ -598,7 +598,7 @@
GNUNET_mutex_lock (lock_);
addHostToKnown (&msg->senderIdentity, ntohs (msg->protocol));
host = findHost (&msg->senderIdentity);
- GE_ASSERT (ectx, host != NULL);
+ GNUNET_GE_ASSERT (ectx, host != NULL);
for (i = 0; i < host->helloCount; i++)
{
@@ -614,17 +614,17 @@
host->hellos[i] = GNUNET_malloc (GNUNET_sizeof_hello (msg));
memcpy (host->hellos[i], msg, GNUNET_sizeof_hello (msg));
GNUNET_mutex_unlock (lock_);
- GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
+ GNUNET_GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
}
/**
* Obtain the public key and address of a known host. If no specific
- * protocol is specified (ANY_PROTOCOL_NUMBER), hellos for cheaper
+ * protocol is specified (GNUNET_TRANSPORT_PROTOCOL_NUMBER_ANY), hellos for
cheaper
* protocols are returned with preference (randomness!).
*
* @param hostId the host id
* @param protocol the protocol that we need,
- * ANY_PROTOCOL_NUMBER if we do not care which protocol
+ * GNUNET_TRANSPORT_PROTOCOL_NUMBER_ANY if we do not care which protocol
* @param tryTemporaryList is it ok to check the unverified hellos?
* @param result where to store the result
* @returns GNUNET_SYSERR on failure, GNUNET_OK on success
@@ -642,7 +642,7 @@
int i;
int j;
- GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
+ GNUNET_GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
GNUNET_mutex_lock (lock_);
if (GNUNET_YES == tryTemporaryList)
{
@@ -656,7 +656,7 @@
memcmp (hostId, &host->identity,
sizeof (GNUNET_PeerIdentity))))
{
- if (protocol == ANY_PROTOCOL_NUMBER)
+ if (protocol == GNUNET_TRANSPORT_PROTOCOL_NUMBER_ANY)
{
j =
GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK,
@@ -691,7 +691,7 @@
return NULL;
}
- if (protocol == ANY_PROTOCOL_NUMBER)
+ if (protocol == GNUNET_TRANSPORT_PROTOCOL_NUMBER_ANY)
protocol =
host->
protocols[GNUNET_random_u32
@@ -722,12 +722,12 @@
if (size != sizeof (GNUNET_MessageHello))
{
if (0 == UNLINK (fn))
- GE_LOG (ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Removed file `%s' containing invalid HELLO data.\n"), fn);
else
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_USER | GNUNET_GE_BULK,
"unlink", fn);
GNUNET_free (fn);
GNUNET_mutex_unlock (lock_);
@@ -745,12 +745,12 @@
memcmp (&have, &result->senderIdentity, sizeof (GNUNET_PeerIdentity))))
{
if (0 == UNLINK (fn))
- GE_LOG (ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Removed file `%s' containing invalid HELLO data.\n"), fn);
else
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_USER | GNUNET_GE_BULK,
"unlink", fn);
GNUNET_free (fn);
GNUNET_free (result);
@@ -784,17 +784,17 @@
GNUNET_MessageHello *hello;
int res;
- hello = identity2Hello (signer, ANY_PROTOCOL_NUMBER, GNUNET_YES);
+ hello = identity2Hello (signer, GNUNET_TRANSPORT_PROTOCOL_NUMBER_ANY,
GNUNET_YES);
if (hello == NULL)
{
#if DEBUG_IDENTITY
GNUNET_EncName enc;
IF_GELOG (ectx,
- GE_INFO | GE_USER | GE_BULK,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_BULK,
GNUNET_hash_to_enc (&signer->hashPubKey, &enc));
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Signature failed verification: peer `%s' not known.\n"),
&enc);
#endif
@@ -802,8 +802,8 @@
}
res = GNUNET_RSA_verify (message, size, sig, &hello->publicKey);
if (res == GNUNET_SYSERR)
- GE_LOG (ectx,
- GE_ERROR | GE_REQUEST | GE_DEVELOPER | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER |
GNUNET_GE_USER,
_("Signature failed verification: signature invalid.\n"));
GNUNET_free (hello);
return res;
@@ -827,7 +827,7 @@
int i;
GNUNET_CronTime now;
- GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
+ GNUNET_GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
GNUNET_mutex_lock (lock_);
entry = findHost (identity);
if (entry == NULL)
@@ -876,8 +876,8 @@
entry->strict = strict;
GNUNET_hash_to_enc (&identity->hashPubKey, &hn);
#if DEBUG_IDENTITY
- GE_LOG (ectx,
- GE_INFO | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"Blacklisting host `%s' for %llu seconds"
" until %llu (strict=%d).\n",
&hn, entry->delta / GNUNET_CRON_SECONDS, entry->until, strict);
@@ -898,7 +898,7 @@
GNUNET_CronTime now;
HostEntry *entry;
- GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
+ GNUNET_GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
GNUNET_mutex_lock (lock_);
entry = findHost (identity);
if (entry == NULL)
@@ -914,10 +914,10 @@
GNUNET_EncName enc;
IF_GELOG (ectx,
- GE_INFO | GE_USER | GE_BULK,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_BULK,
GNUNET_hash_to_enc (&identity->hashPubKey, &enc));
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_BULK,
_
("Peer `%s' is currently strictly blacklisted (for another
%llums).\n"),
&enc, entry->until - now);
@@ -944,7 +944,7 @@
HostEntry *entry;
int i;
- GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
+ GNUNET_GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
GNUNET_mutex_lock (lock_);
entry = findHost (identity);
if (entry == NULL)
@@ -983,7 +983,7 @@
* @return the number of hosts matching
*/
static int
-forEachHost (GNUNET_CronTime now, HostIterator callback, void *data)
+forEachHost (GNUNET_CronTime now, GNUNET_HostProcessor callback, void *data)
{
int i;
int j;
@@ -994,7 +994,7 @@
int ret;
ret = GNUNET_OK;
- GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
+ GNUNET_GE_ASSERT (ectx, numberOfHosts_ <= sizeOfHosts_);
count = 0;
GNUNET_mutex_lock (lock_);
for (i = 0; i < numberOfHosts_; i++)
@@ -1036,10 +1036,10 @@
GNUNET_EncName enc;
IF_GELOG (ectx,
- GE_INFO | GE_USER | GE_BULK,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_BULK,
GNUNET_hash_to_enc (&entry->identity.hashPubKey, &enc));
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_BULK,
entry->strict ?
_
("Peer `%s' is currently strictly blacklisted (for another
%llums).\n")
@@ -1099,8 +1099,8 @@
if (host->trust == 0)
{
if ((0 != UNLINK (fn)) && (errno != ENOENT))
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_BULK, "unlink", fn);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK, "unlink", fn);
}
else
{
@@ -1169,7 +1169,7 @@
static int
-identityRequestConnectHandler (struct ClientHandle *sock,
+identityRequestConnectHandler (struct GNUNET_ClientHandle *sock,
const GNUNET_MessageHeader * message)
{
const CS_identity_connect_MESSAGE *msg;
@@ -1186,7 +1186,7 @@
}
static int
-identityHelloHandler (struct ClientHandle *sock,
+identityHelloHandler (struct GNUNET_ClientHandle *sock,
const GNUNET_MessageHeader * message)
{
const GNUNET_MessageHello *msg;
@@ -1194,18 +1194,18 @@
if (sizeof (GNUNET_MessageHello) > ntohs (message->size))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
msg = (const GNUNET_MessageHello *) message;
if (GNUNET_sizeof_hello (msg) != ntohs (message->size))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
hello = GNUNET_malloc (ntohs (msg->header.size));
memcpy (hello, msg, ntohs (msg->header.size));
- hello->header.type = htons (p2p_PROTO_hello);
+ hello->header.type = htons (GNUNET_P2P_PROTO_HELLO);
coreAPI->injectMessage (NULL,
(const char *) hello,
ntohs (msg->header.size), GNUNET_NO, NULL);
@@ -1214,23 +1214,23 @@
}
static int
-identityRequestHelloHandler (struct ClientHandle *sock,
+identityRequestHelloHandler (struct GNUNET_ClientHandle *sock,
const GNUNET_MessageHeader * message)
{
/* transport types in order of preference
for location URIs (by best guess at what
people are most likely to actually run) */
static unsigned short types[] = {
- TCP_PROTOCOL_NUMBER,
- UDP_PROTOCOL_NUMBER,
- HTTP_PROTOCOL_NUMBER,
- TCP6_PROTOCOL_NUMBER,
- UDP6_PROTOCOL_NUMBER,
- SMTP_PROTOCOL_NUMBER,
- NAT_PROTOCOL_NUMBER,
+ GNUNET_TRANSPORT_PROTOCOL_NUMBER_TCP,
+ GNUNET_TRANSPORT_PROTOCOL_NUMBER_UDP,
+ GNUNET_TRANSPORT_PROTOCOL_NUMBER_HTTP,
+ GNUNET_TRANSPORT_PROTOCOL_NUMBER_TCP6,
+ GNUNET_TRANSPORT_PROTOCOL_NUMBER_UDP6,
+ GNUNET_TRANSPORT_PROTOCOL_NUMBER_SMTP,
+ GNUNET_TRANSPORT_PROTOCOL_NUMBER_NAT,
0,
};
- Transport_ServiceAPI *tapi;
+ GNUNET_Transport_ServiceAPI *tapi;
GNUNET_MessageHello *hello;
int pos;
int ret;
@@ -1248,14 +1248,14 @@
coreAPI->releaseService (tapi);
if (hello == NULL)
return GNUNET_SYSERR;
- hello->header.type = htons (CS_PROTO_identity_HELLO);
+ hello->header.type = htons (GNUNET_CS_PROTO_IDENTITY_HELLO);
ret = coreAPI->sendToClient (sock, &hello->header, GNUNET_YES);
GNUNET_free (hello);
return ret;
}
static int
-identityRequestSignatureHandler (struct ClientHandle *sock,
+identityRequestSignatureHandler (struct GNUNET_ClientHandle *sock,
const GNUNET_MessageHeader * message)
{
CS_identity_signature_MESSAGE reply;
@@ -1263,7 +1263,7 @@
if (ntohs (message->size) <= sizeof (GNUNET_MessageHeader))
return GNUNET_SYSERR;
reply.header.size = htons (sizeof (CS_identity_signature_MESSAGE));
- reply.header.type = htons (CS_PROTO_identity_SIGNATURE);
+ reply.header.type = htons (GNUNET_CS_PROTO_IDENTITY_SIGNATURE);
if (GNUNET_OK != signData (&message[1],
ntohs (message->size) -
sizeof (GNUNET_MessageHeader), &reply.sig))
@@ -1275,8 +1275,8 @@
hostInfoIterator (const GNUNET_PeerIdentity * identity,
unsigned short protocol, int confirmed, void *data)
{
- struct ClientHandle *sock = data;
- Transport_ServiceAPI *transport;
+ struct GNUNET_ClientHandle *sock = data;
+ GNUNET_Transport_ServiceAPI *transport;
CS_identity_peer_info_MESSAGE *reply;
GNUNET_MessageHello *hello;
void *address;
@@ -1315,7 +1315,7 @@
}
reply = GNUNET_malloc (sizeof (CS_identity_peer_info_MESSAGE) + len);
reply->header.size = htons (sizeof (CS_identity_peer_info_MESSAGE) + len);
- reply->header.type = htons (CS_PROTO_identity_INFO);
+ reply->header.type = htons (GNUNET_CS_PROTO_IDENTITY_INFO);
reply->peer = *identity;
reply->last_message = GNUNET_htonll (last);
reply->trust = htonl (getHostTrust (identity));
@@ -1328,7 +1328,7 @@
}
static int
-identityRequestInfoHandler (struct ClientHandle *sock,
+identityRequestInfoHandler (struct GNUNET_ClientHandle *sock,
const GNUNET_MessageHeader * message)
{
forEachHost (0, &hostInfoIterator, sock);
@@ -1342,10 +1342,10 @@
* @param capi the core API
* @return NULL on errors, ID_API otherwise
*/
-Identity_ServiceAPI *
-provide_module_identity (CoreAPIForApplication * capi)
+GNUNET_Identity_ServiceAPI *
+provide_module_identity (GNUNET_CoreAPIForPlugins * capi)
{
- static Identity_ServiceAPI id;
+ static GNUNET_Identity_ServiceAPI id;
char *gnHome;
char *tmp;
int i;
@@ -1373,11 +1373,11 @@
numberOfHosts_ = 0;
gnHome = NULL;
- GE_ASSERT (ectx,
- -1 != GC_get_configuration_value_filename (coreAPI->cfg,
+ GNUNET_GE_ASSERT (ectx,
+ -1 != GNUNET_GC_get_configuration_value_filename (coreAPI->cfg,
"GNUNETD",
"GNUNETD_HOME",
- VAR_DAEMON_DIRECTORY,
+
GNUNET_DEFAULT_DAEMON_VAR_DIRECTORY,
&gnHome));
if (gnHome == NULL)
return NULL;
@@ -1387,8 +1387,8 @@
strcat (tmp, DIR_SEPARATOR_STR);
strcat (tmp, HOST_DIR);
networkIdDirectory = NULL;
- GE_ASSERT (ectx,
- -1 != GC_get_configuration_value_filename (coreAPI->cfg,
+ GNUNET_GE_ASSERT (ectx,
+ -1 != GNUNET_GC_get_configuration_value_filename (coreAPI->cfg,
"GNUNETD",
"HOSTS",
tmp,
@@ -1415,15 +1415,15 @@
GNUNET_cron_add_job (coreAPI->cron,
&cronDiscardHosts, 0, CRON_DISCARD_HOSTS_INTERVAL,
NULL);
- coreAPI->registerClientHandler (CS_PROTO_identity_CONNECT,
+ coreAPI->registerClientHandler (GNUNET_CS_PROTO_IDENTITY_CONNECT,
&identityRequestConnectHandler);
- coreAPI->registerClientHandler (CS_PROTO_identity_HELLO,
+ coreAPI->registerClientHandler (GNUNET_CS_PROTO_IDENTITY_HELLO,
&identityHelloHandler);
- coreAPI->registerClientHandler (CS_PROTO_identity_request_HELLO,
+ coreAPI->registerClientHandler (GNUNET_CS_PROTO_IDENTITY_REQUEST_HELLO,
&identityRequestHelloHandler);
- coreAPI->registerClientHandler (CS_PROTO_identity_request_SIGN,
+ coreAPI->registerClientHandler (GNUNET_CS_PROTO_IDENTITY_REQUEST_SIGNATURE,
&identityRequestSignatureHandler);
- coreAPI->registerClientHandler (CS_PROTO_identity_request_INFO,
+ coreAPI->registerClientHandler (GNUNET_CS_PROTO_IDENTITY_REQUEST_INFO,
&identityRequestInfoHandler);
return &id;
}
@@ -1438,15 +1438,15 @@
int j;
HostEntry *entry;
- coreAPI->unregisterClientHandler (CS_PROTO_identity_CONNECT,
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_IDENTITY_CONNECT,
&identityRequestConnectHandler);
- coreAPI->unregisterClientHandler (CS_PROTO_identity_HELLO,
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_IDENTITY_HELLO,
&identityHelloHandler);
- coreAPI->unregisterClientHandler (CS_PROTO_identity_request_HELLO,
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_IDENTITY_REQUEST_HELLO,
&identityRequestHelloHandler);
- coreAPI->unregisterClientHandler (CS_PROTO_identity_request_SIGN,
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_IDENTITY_REQUEST_SIGNATURE,
&identityRequestSignatureHandler);
- coreAPI->unregisterClientHandler (CS_PROTO_identity_request_INFO,
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_IDENTITY_REQUEST_INFO,
&identityRequestInfoHandler);
for (i = 0; i < MAX_TEMP_HOSTS; i++)
{
Modified: GNUnet/src/applications/identity/identitytest.c
===================================================================
--- GNUnet/src/applications/identity/identitytest.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/identity/identitytest.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -37,7 +37,7 @@
static struct GNUNET_CronManager *cron;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
#define ASSERT(cond) do { \
@@ -54,8 +54,8 @@
static int
runTest ()
{
- Identity_ServiceAPI *identity;
- Transport_ServiceAPI *transport;
+ GNUNET_Identity_ServiceAPI *identity;
+ GNUNET_Transport_ServiceAPI *transport;
GNUNET_PeerIdentity pid;
const GNUNET_RSA_PublicKey *pkey;
GNUNET_RSA_Signature sig;
@@ -66,7 +66,7 @@
GNUNET_cron_start (cron);
/* give cron job chance to run */
GNUNET_thread_sleep (5 * GNUNET_CRON_SECONDS);
- hello = transport->createhello (ANY_PROTOCOL_NUMBER);
+ hello = transport->createhello (GNUNET_TRANSPORT_PROTOCOL_NUMBER_ANY);
if (NULL == hello)
{
printf ("Cannot run test, failed to create any hello.\n");
@@ -136,10 +136,10 @@
{
int err;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
cron = cron_create (NULL);
@@ -151,7 +151,7 @@
err = 1;
doneCore ();
GNUNET_cron_destroy (cron);
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return err;
}
Modified: GNUnet/src/applications/kvstore_sqlite/kv_sqlite.c
===================================================================
--- GNUnet/src/applications/kvstore_sqlite/kv_sqlite.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/kvstore_sqlite/kv_sqlite.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -41,14 +41,14 @@
* a failure of the command 'cmd' with the message given
* by strerror(errno).
*/
-#define DIE_SQLITE(dbh, cmd) do { GE_LOG(ectx, GE_FATAL | GE_ADMIN | GE_BULK,
_("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__,
sqlite3_errmsg(dbh)); abort(); } while(0);
+#define DIE_SQLITE(dbh, cmd) do { GNUNET_GE_LOG(ectx, GNUNET_GE_FATAL |
GNUNET_GE_ADMIN | GNUNET_GE_BULK, _("`%s' failed at %s:%d with error: %s\n"),
cmd, __FILE__, __LINE__, sqlite3_errmsg(dbh)); abort(); } while(0);
/**
* Log an error message at log-level 'level' that indicates
* a failure of the command 'cmd' on file 'filename'
* with the message given by strerror(errno).
*/
-#define LOG_SQLITE(dbh, level, cmd) do { GE_LOG(ectx, GE_ERROR | GE_ADMIN |
GE_BULK, _("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__,
sqlite3_errmsg(dbh)); } while(0);
+#define LOG_SQLITE(dbh, level, cmd) do { GNUNET_GE_LOG(ectx, GNUNET_GE_ERROR |
GNUNET_GE_ADMIN | GNUNET_GE_BULK, _("`%s' failed at %s:%d with error: %s\n"),
cmd, __FILE__, __LINE__, sqlite3_errmsg(dbh)); } while(0);
/**
* @brief Wrapper for SQLite
@@ -103,9 +103,9 @@
} sqliteDatabase;
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
static unsigned int databases;
@@ -200,10 +200,10 @@
char *fn;
size_t mem;
- GC_get_configuration_value_filename (coreAPI->cfg,
+ GNUNET_GC_get_configuration_value_filename (coreAPI->cfg,
"KEYVALUE_DATABASE",
"DIR",
- VAR_DAEMON_DIRECTORY "/kvstore/",
+ GNUNET_DEFAULT_DAEMON_VAR_DIRECTORY
"/kvstore/",
&dir);
GNUNET_disk_directory_create (ectx, dir);
mem = strlen (dir) + strlen (name) + 6;
@@ -263,7 +263,7 @@
if (sqlite3_open (db->fn, &dbh->dbh) != SQLITE_OK)
{
printf ("FN: %s\n", db->fn);
- LOG_SQLITE (dbh->dbh, GE_ERROR | GE_BULK | GE_USER, "sqlite3_open");
+ LOG_SQLITE (dbh->dbh, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
"sqlite3_open");
sqlite3_close (dbh->dbh);
GNUNET_mutex_unlock (lock);
GNUNET_thread_release_self (dbh->tid);
@@ -331,12 +331,12 @@
* @param table the name of the Key/Value-Table
* @return a handle
*/
-static KVHandle *
+static GNUNET_KeyValueRecord *
getTable (const char *database, const char *table)
{
sqlite3_stmt *stmt;
unsigned int len;
- KVHandle *ret;
+ GNUNET_KeyValueRecord *ret;
sqliteHandle *dbh;
char *idx;
@@ -371,7 +371,7 @@
sprintf (idx, "CREATE INDEX idx_key ON %s (gn_key)", table);
sqlite3_exec (dbh->dbh, idx, NULL, NULL, NULL);
GNUNET_free (idx);
- ret = GNUNET_malloc (sizeof (KVHandle));
+ ret = GNUNET_malloc (sizeof (GNUNET_KeyValueRecord));
ret->table = GNUNET_strdup (table);
ret->db = GNUNET_strdup (database);
@@ -389,10 +389,10 @@
* @param closure optional parameter for handler
*/
static void *
-get (KVHandle * kv,
+get (GNUNET_KeyValueRecord * kv,
void *key,
int keylen,
- unsigned int sort, unsigned int limit, KVCallback handler, void *closure)
+ unsigned int sort, unsigned int limit, GNUNET_KeyValueProcessor handler,
void *closure)
{
unsigned int len, enclen, retlen;
char *sel, *order, *where, limit_spec[30];
@@ -489,7 +489,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR otherwise
*/
static int
-put (KVHandle * kv, void *key, int keylen, void *val, int vallen,
+put (GNUNET_KeyValueRecord * kv, void *key, int keylen, void *val, int vallen,
unsigned long long age)
{
unsigned int len;
@@ -544,7 +544,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR otherwise
*/
static int
-del (KVHandle * kv, void *key, int keylen, unsigned long long age)
+del (GNUNET_KeyValueRecord * kv, void *key, int keylen, unsigned long long age)
{
unsigned int len;
char *del, *key_where, *age_where;
@@ -613,7 +613,7 @@
* @param kv the handle to close
*/
static void
-closeTable (KVHandle * kv)
+closeTable (GNUNET_KeyValueRecord * kv)
{
GNUNET_free (kv->table);
GNUNET_free (kv->db);
@@ -625,7 +625,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR otherwise
*/
static int
-dropTable (KVHandle * kv)
+dropTable (GNUNET_KeyValueRecord * kv)
{
sqlite3_stmt *stmt;
sqliteHandle *dbh;
@@ -650,15 +650,15 @@
return GNUNET_OK;
}
-KVstore_ServiceAPI *
-provide_module_kvstore_sqlite (CoreAPIForApplication * capi)
+GNUNET_KVstore_ServiceAPI *
+provide_module_kvstore_sqlite (GNUNET_CoreAPIForPlugins * capi)
{
- static KVstore_ServiceAPI api;
+ static GNUNET_KVstore_ServiceAPI api;
ectx = capi->ectx;
#if DEBUG_SQLITE
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"KV-SQLite: initializing database\n");
#endif
@@ -687,8 +687,8 @@
GNUNET_array_grow (dbs, databases, 0);
#if DEBUG_SQLITE
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"SQLite KVStore: database shutdown\n");
#endif
Modified: GNUnet/src/applications/kvstore_sqlite/kv_sqlitetest.c
===================================================================
--- GNUnet/src/applications/kvstore_sqlite/kv_sqlitetest.c 2007-11-25
03:50:33 UTC (rev 5754)
+++ GNUnet/src/applications/kvstore_sqlite/kv_sqlitetest.c 2007-11-25
12:04:45 UTC (rev 5755)
@@ -38,9 +38,9 @@
* Add testcode here!
*/
static int
-test (KVstore_ServiceAPI * api)
+test (GNUNET_KVstore_ServiceAPI * api)
{
- KVHandle *kv;
+ GNUNET_KeyValueRecord *kv;
GNUNET_HashCode k, v;
GNUNET_HashCode *r;
@@ -78,15 +78,15 @@
int
main (int argc, char *argv[])
{
- KVstore_ServiceAPI *api;
+ GNUNET_KVstore_ServiceAPI *api;
int ok;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
struct GNUNET_CronManager *cron;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
cron = cron_create (NULL);
Modified: GNUnet/src/applications/pingpong/pingpong.c
===================================================================
--- GNUnet/src/applications/pingpong/pingpong.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/pingpong/pingpong.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -88,15 +88,15 @@
static struct GNUNET_Mutex *pingPongLock;
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
-static Transport_ServiceAPI *transport;
+static GNUNET_Transport_ServiceAPI *transport;
-static Identity_ServiceAPI *identity;
+static GNUNET_Identity_ServiceAPI *identity;
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
static int stat_encryptedPongReceived;
@@ -128,8 +128,8 @@
if (ntohs (msg->size) != sizeof (P2P_pingpong_MESSAGE))
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER |
GNUNET_GE_DEVELOPER,
_("Received malformed `%s' message. Dropping.\n"), "ping");
return GNUNET_SYSERR;
}
@@ -139,8 +139,8 @@
if (0 != memcmp (coreAPI->myIdentity,
&pmsg->receiver, sizeof (GNUNET_PeerIdentity)))
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_ADMIN,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_ADMIN,
_("Received ping for another peer. Dropping.\n"));
return GNUNET_SYSERR; /* not for us */
}
@@ -149,15 +149,15 @@
GNUNET_EncName enc;
GNUNET_hash_to_enc (&sender->hashPubKey, &enc);
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Received ping from peer %s.\n", &enc);
#endif
pong = *pmsg;
- pong.header.type = htons (p2p_PROTO_PONG);
+ pong.header.type = htons (GNUNET_P2P_PROTO_PONG);
if (stats != NULL)
stats->change (stat_pingReceived, 1);
- coreAPI->unicast (sender, &pong.header, EXTREME_PRIORITY, 0); /* send now! */
+ coreAPI->unicast (sender, &pong.header, GNUNET_EXTREME_PRIORITY, 0); /* send
now! */
if (stats != NULL)
stats->change (stat_pongSent, 1);
return GNUNET_OK;
@@ -167,7 +167,7 @@
sendPlaintext (const GNUNET_PeerIdentity * peer,
const P2P_pingpong_MESSAGE * msg)
{
- TSession *mytsession;
+ GNUNET_TSession *mytsession;
int ret;
mytsession = transport->connectFreely (peer, GNUNET_YES, __FILE__);
@@ -185,7 +185,7 @@
*/
static int
plaintextPingReceived (const GNUNET_PeerIdentity * sender,
- const GNUNET_MessageHeader * hmsg, TSession * tsession)
+ const GNUNET_MessageHeader * hmsg, GNUNET_TSession *
tsession)
{
#if DEBUG_PINGPONG
GNUNET_EncName enc;
@@ -196,31 +196,31 @@
if (ntohs (hmsg->size) != sizeof (P2P_pingpong_MESSAGE))
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER |
GNUNET_GE_DEVELOPER,
_("Received malformed `%s' message. Dropping.\n"), "ping");
- GE_BREAK_OP (NULL, 0);
+ GNUNET_GE_BREAK_OP (NULL, 0);
return GNUNET_SYSERR;
}
pmsg = (const P2P_pingpong_MESSAGE *) hmsg;
if (0 != memcmp (coreAPI->myIdentity,
&pmsg->receiver, sizeof (GNUNET_PeerIdentity)))
{
- GE_LOG (ectx,
- GE_INFO | GE_REQUEST | GE_ADMIN,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_ADMIN,
_("Received PING not destined for us!\n"));
- GE_BREAK_OP (NULL, 0);
+ GNUNET_GE_BREAK_OP (NULL, 0);
return GNUNET_SYSERR; /* not for us */
}
#if DEBUG_PINGPONG
GNUNET_hash_to_enc (&sender->hashPubKey, &enc);
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Received plaintext ping from peer %s.\n", &enc);
#endif
pong = *pmsg;
- pong.header.type = htons (p2p_PROTO_PONG);
+ pong.header.type = htons (GNUNET_P2P_PROTO_PONG);
/* allow using a different transport for sending the reply, the
transport may have been uni-directional! */
ret = GNUNET_SYSERR;
@@ -262,15 +262,15 @@
if ((ntohs (msg->size) != sizeof (P2P_pingpong_MESSAGE)) ||
(0 != memcmp (sender, &pmsg->receiver, sizeof (GNUNET_PeerIdentity))))
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER |
GNUNET_GE_DEVELOPER,
_("Received malformed `%s' message. Dropping.\n"), "pong");
return GNUNET_SYSERR; /* bad pong */
}
#if DEBUG_PINGPONG
GNUNET_hash_to_enc (&sender->hashPubKey, &enc);
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Received PONG from `%s'.\n", &enc);
#endif
matched = 0;
@@ -295,15 +295,15 @@
GNUNET_mutex_unlock (pingPongLock);
#if DEBUG_PINGPONG
GNUNET_hash_to_enc (&sender->hashPubKey, &enc);
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Received PONG from `%s' matched %u peers.\n", &enc, matched);
#endif
if (matched == 0)
{
#if DEBUG_PINGPONG
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_ADMIN,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_ADMIN,
_("Could not match PONG against any PING. "
"Try increasing MAX_PING_PONG constant.\n"));
#endif
@@ -316,7 +316,7 @@
*/
static int
plaintextPongReceived (const GNUNET_PeerIdentity * sender,
- const GNUNET_MessageHeader * msg, TSession * session)
+ const GNUNET_MessageHeader * msg, GNUNET_TSession *
session)
{
int i;
const P2P_pingpong_MESSAGE *pmsg;
@@ -330,8 +330,8 @@
if ((ntohs (msg->size) != sizeof (P2P_pingpong_MESSAGE)) ||
(0 != memcmp (sender, &pmsg->receiver, sizeof (GNUNET_PeerIdentity))))
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER |
GNUNET_GE_DEVELOPER,
_("Received malformed `%s' message. Dropping.\n"), "pong");
return GNUNET_SYSERR; /* bad pong */
}
@@ -357,16 +357,16 @@
GNUNET_mutex_unlock (pingPongLock);
#if DEBUG_PINGPONG
GNUNET_hash_to_enc (&sender->hashPubKey, &enc);
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Received plaintext PONG from `%s' matched %u peers.\n",
&enc, matched);
#endif
if (matched == 0)
{
#if DEBUG_PINGPONG
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_ADMIN,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_ADMIN,
_("Could not match PONG against any PING. "
"Try increasing MAX_PING_PONG constant.\n"));
#endif
@@ -409,8 +409,8 @@
}
if (j == -1)
{ /* all send this second!? */
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_ADMIN,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_ADMIN,
_("Cannot create PING, table full. "
"Try increasing MAX_PING_PONG.\n"));
GNUNET_mutex_unlock (pingPongLock);
@@ -425,7 +425,7 @@
entry->receiverIdentity = *receiver;
pmsg = GNUNET_malloc (sizeof (P2P_pingpong_MESSAGE));
pmsg->header.size = htons (sizeof (P2P_pingpong_MESSAGE));
- pmsg->header.type = htons (p2p_PROTO_PING);
+ pmsg->header.type = htons (GNUNET_P2P_PROTO_PING);
pmsg->receiver = *receiver;
entry->challenge = challenge;
pmsg->challenge = htonl (challenge);
@@ -467,7 +467,7 @@
}
else
{
- coreAPI->unicast (receiver, pmsg, EXTREME_PRIORITY, 0);
+ coreAPI->unicast (receiver, pmsg, GNUNET_EXTREME_PRIORITY, 0);
if (stats != NULL)
stats->change (stat_ciphertextPingSent, 1);
}
@@ -478,24 +478,24 @@
/**
* Initialize the pingpong module.
*/
-Pingpong_ServiceAPI *
-provide_module_pingpong (CoreAPIForApplication * capi)
+GNUNET_Pingpong_ServiceAPI *
+provide_module_pingpong (GNUNET_CoreAPIForPlugins * capi)
{
- static Pingpong_ServiceAPI ret;
+ static GNUNET_Pingpong_ServiceAPI ret;
ectx = capi->ectx;
- GE_ASSERT (ectx, sizeof (P2P_pingpong_MESSAGE) == 72);
+ GNUNET_GE_ASSERT (ectx, sizeof (P2P_pingpong_MESSAGE) == 72);
coreAPI = capi;
identity = capi->requestService ("identity");
if (identity == NULL)
{
- GE_BREAK (capi->ectx, 0);
+ GNUNET_GE_BREAK (capi->ectx, 0);
return NULL;
}
transport = capi->requestService ("transport");
if (transport == NULL)
{
- GE_BREAK (capi->ectx, 0);
+ GNUNET_GE_BREAK (capi->ectx, 0);
capi->releaseService (identity);
return NULL;
}
@@ -528,14 +528,14 @@
pingPongs =
(PingPongEntry *) GNUNET_malloc (sizeof (PingPongEntry) * MAX_PING_PONG);
memset (pingPongs, 0, sizeof (PingPongEntry) * MAX_PING_PONG);
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
_("`%s' registering handlers %d %d (plaintext and ciphertext)\n"),
- "pingpong", p2p_PROTO_PING, p2p_PROTO_PONG);
- capi->registerHandler (p2p_PROTO_PING, &pingReceived);
- capi->registerHandler (p2p_PROTO_PONG, &pongReceived);
- capi->registerPlaintextHandler (p2p_PROTO_PING, &plaintextPingReceived);
- capi->registerPlaintextHandler (p2p_PROTO_PONG, &plaintextPongReceived);
+ "pingpong", GNUNET_P2P_PROTO_PING, GNUNET_P2P_PROTO_PONG);
+ capi->registerHandler (GNUNET_P2P_PROTO_PING, &pingReceived);
+ capi->registerHandler (GNUNET_P2P_PROTO_PONG, &pongReceived);
+ capi->registerPlaintextHandler (GNUNET_P2P_PROTO_PING,
&plaintextPingReceived);
+ capi->registerPlaintextHandler (GNUNET_P2P_PROTO_PONG,
&plaintextPongReceived);
ret.ping = &initiatePing;
ret.pingUser = &createPing;
ret.ping_size = sizeof (P2P_pingpong_MESSAGE);
@@ -559,11 +559,11 @@
for (i = 0; i < MAX_PING_PONG; i++)
GNUNET_free_non_null (pingPongs[i].data);
GNUNET_free (pingPongs);
- coreAPI->unregisterHandler (p2p_PROTO_PING, &pingReceived);
- coreAPI->unregisterHandler (p2p_PROTO_PONG, &pongReceived);
- coreAPI->unregisterPlaintextHandler (p2p_PROTO_PING,
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_PING, &pingReceived);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_PONG, &pongReceived);
+ coreAPI->unregisterPlaintextHandler (GNUNET_P2P_PROTO_PING,
&plaintextPingReceived);
- coreAPI->unregisterPlaintextHandler (p2p_PROTO_PONG,
+ coreAPI->unregisterPlaintextHandler (GNUNET_P2P_PROTO_PONG,
&plaintextPongReceived);
coreAPI = NULL;
return GNUNET_OK;
Modified: GNUnet/src/applications/rpc/parameters.c
===================================================================
--- GNUnet/src/applications/rpc/parameters.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/rpc/parameters.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -27,12 +27,12 @@
#include "gnunet_util.h"
#include "gnunet_util_containers.h"
-#include "gnunet_rpc_service.h"
+#include "gnunet_rpc_lib.h"
#include "platform.h"
/**
* A parameter to/from an RPC call. These (and nothing else) are stored in
- * the GNUNET_Vector of the RPC_Param structure.
+ * the GNUNET_Vector of the GNUNET_RPC_CallParameters structure.
*/
typedef struct
{
@@ -44,10 +44,10 @@
/**
* Allocate a new, empty RPC parameter structure.
*
- * @return An empty RPC_Param structure
+ * @return An empty GNUNET_RPC_CallParameters structure
*/
-RPC_Param *
-RPC_paramNew ()
+GNUNET_RPC_CallParameters *
+GNUNET_RPC_parameters_create ()
{
return GNUNET_vector_create (4);
}
@@ -60,7 +60,7 @@
* @param param The RPC parameter structure to be freed
*/
void
-RPC_paramFree (RPC_Param * param)
+GNUNET_RPC_parameters_destroy(GNUNET_RPC_CallParameters * param)
{
if (param == NULL)
return;
@@ -76,10 +76,10 @@
/**
* Serialize the param array. target must point to at least
- * RPC_paramSize(param) bytes of memory.
+ * GNUNET_RPC_parameters_get_serialized_size(param) bytes of memory.
*/
void
-RPC_paramSerialize (RPC_Param * param, char *target)
+GNUNET_RPC_parameters_serialize (GNUNET_RPC_CallParameters * param, char
*target)
{
int i;
const char *paramName;
@@ -93,11 +93,11 @@
return;
pos = 0;
dataLength = 0;
- for (i = 0; i < RPC_paramCount (param); i++)
+ for (i = 0; i < GNUNET_RPC_parameters_count (param); i++)
{
- paramName = RPC_paramName (param, i);
+ paramName = GNUNET_RPC_parameters_get_name (param, i);
paramValue = NULL;
- RPC_paramValueByPosition (param, i, &dataLength, ¶mValue);
+ GNUNET_RPC_parameters_get_value_by_index (param, i, &dataLength,
¶mValue);
memcpy (&target[pos], paramName, strlen (paramName) + 1);
pos += strlen (paramName) + 1;
*(unsigned int *) &target[pos] = htonl (dataLength);
@@ -110,17 +110,17 @@
/**
* Deserialize parameters from buffer.
*/
-RPC_Param *
-RPC_paramDeserialize (char *buffer, size_t size)
+GNUNET_RPC_CallParameters *
+GNUNET_RPC_parameters_deserialize (char *buffer, size_t size)
{
- RPC_Param *ret;
+ GNUNET_RPC_CallParameters *ret;
size_t pos;
size_t xpos;
unsigned int dataLength;
if (buffer == NULL)
return NULL;
- ret = RPC_paramNew ();
+ ret = GNUNET_RPC_parameters_create ();
pos = 0;
while (pos < size)
{
@@ -130,18 +130,18 @@
pos++;
if (pos + sizeof (unsigned int) > size)
{
- RPC_paramFree (ret);
+ GNUNET_RPC_parameters_destroy (ret);
return NULL;
}
dataLength = ntohl (*(unsigned int *) &buffer[pos]);
pos += sizeof (unsigned int);
if ((pos + dataLength < pos) || (pos + dataLength > size))
{
- RPC_paramFree (ret);
+ GNUNET_RPC_parameters_destroy (ret);
return NULL;
}
- RPC_paramAdd (ret, &buffer[xpos], dataLength, &buffer[pos]);
+ GNUNET_RPC_parameters_add (ret, &buffer[xpos], dataLength, &buffer[pos]);
pos += dataLength;
}
return ret;
@@ -151,7 +151,7 @@
* How many bytes are required to serialize the param array?
*/
size_t
-RPC_paramSize (RPC_Param * param)
+GNUNET_RPC_parameters_get_serialized_size (GNUNET_RPC_CallParameters * param)
{
int i;
const char *paramName;
@@ -163,11 +163,11 @@
return 0;
pos = 0;
dataLength = 0;
- for (i = 0; i < RPC_paramCount (param); i++)
+ for (i = 0; i < GNUNET_RPC_parameters_count (param); i++)
{
- paramName = RPC_paramName (param, i);
+ paramName = GNUNET_RPC_parameters_get_name (param, i);
paramValue = NULL;
- RPC_paramValueByPosition (param, i, &dataLength, ¶mValue);
+ GNUNET_RPC_parameters_get_value_by_index (param, i, &dataLength,
¶mValue);
if (pos + strlen (paramName) + 1 + sizeof (unsigned int) < pos)
return 0;
pos += strlen (paramName) + 1;
@@ -187,7 +187,7 @@
* @return The number of parameters
*/
unsigned int
-RPC_paramCount (RPC_Param * param)
+GNUNET_RPC_paramters_count (GNUNET_RPC_CallParameters * param)
{
if (param == NULL)
return 0;
@@ -208,7 +208,7 @@
*/
void
-RPC_paramAdd (RPC_Param * param,
+GNUNET_RPC_parameters_add (GNUNET_RPC_CallParameters * param,
const char *name, unsigned int dataLength, const void *data)
{
Parameter *new;
@@ -243,8 +243,8 @@
* @param data Value of the parameter
*/
void
-RPC_paramAddDataContainer (RPC_Param * param,
- const char *name, const DataContainer * data)
+GNUNET_RPC_parameters_add_data_container (GNUNET_RPC_CallParameters * param,
+ const char *name, const GNUNET_DataContainer * data)
{
Parameter *new;
@@ -252,7 +252,7 @@
return;
new = GNUNET_malloc (sizeof (Parameter));
new->name = GNUNET_strdup (name);
- new->dataLength = ntohl (data->size) - sizeof (DataContainer);
+ new->dataLength = ntohl (data->size) - sizeof (GNUNET_DataContainer);
if (new->dataLength == 0)
{
new->data = NULL;
@@ -273,7 +273,7 @@
* @return Name of the parameter
*/
const char *
-RPC_paramName (RPC_Param * param, unsigned int i)
+GNUNET_RPC_parameters_get_name (GNUNET_RPC_CallParameters * param, unsigned
int i)
{
Parameter *p;
@@ -295,7 +295,7 @@
* @return GNUNET_SYSERR on error
*/
int
-RPC_paramValueByName (RPC_Param * param,
+GNUNET_RPC_parameters_get_value_by_name (GNUNET_RPC_CallParameters * param,
const char *name,
unsigned int *dataLength, void **value)
{
@@ -325,11 +325,11 @@
* @param value set to the value of the named parameter
* @return GNUNET_SYSERR on error
*/
-DataContainer *
-RPC_paramDataContainerByName (RPC_Param * param, const char *name)
+GNUNET_DataContainer *
+GNUNET_RPC_parameters_get_data_container_by_name (GNUNET_RPC_CallParameters *
param, const char *name)
{
Parameter *p;
- DataContainer *ret;
+ GNUNET_DataContainer *ret;
if (param == NULL)
return NULL;
@@ -338,8 +338,8 @@
{
if (!strcmp (p->name, name))
{
- ret = GNUNET_malloc (sizeof (DataContainer) + p->dataLength);
- ret->size = htonl (sizeof (DataContainer) + p->dataLength);
+ ret = GNUNET_malloc (sizeof (GNUNET_DataContainer) + p->dataLength);
+ ret->size = htonl (sizeof (GNUNET_DataContainer) + p->dataLength);
memcpy (&ret[1], p->data, p->dataLength);
return ret;
}
@@ -356,7 +356,7 @@
* @param value set to the value of the parameter
*/
int
-RPC_paramValueByPosition (RPC_Param * param,
+GNUNET_RPC_parameters_get_value_by_index (GNUNET_RPC_CallParameters * param,
unsigned int i,
unsigned int *dataLength, void **value)
{
@@ -380,19 +380,19 @@
* @param param Target RPC parameter structure
* @param value set to the value of the parameter
*/
-DataContainer *
-RPC_paramDataContainerByPosition (RPC_Param * param, unsigned int i)
+GNUNET_DataContainer *
+GNUNET_RPC_parameters_get_data_container_by_index (GNUNET_RPC_CallParameters *
param, unsigned int i)
{
Parameter *p;
- DataContainer *ret;
+ GNUNET_DataContainer *ret;
if (param == NULL)
return NULL;
p = GNUNET_vector_get (param, i);
if (p != NULL)
{
- ret = GNUNET_malloc (sizeof (DataContainer) + p->dataLength);
- ret->size = htonl (sizeof (DataContainer) + p->dataLength);
+ ret = GNUNET_malloc (sizeof (GNUNET_DataContainer) + p->dataLength);
+ ret->size = htonl (sizeof (GNUNET_DataContainer) + p->dataLength);
memcpy (&ret[1], p->data, p->dataLength);
return ret;
}
Modified: GNUnet/src/applications/rpc/parameterstest.c
===================================================================
--- GNUnet/src/applications/rpc/parameterstest.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/rpc/parameterstest.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -29,58 +29,58 @@
int
main (int argc, char *argv[])
{
- RPC_Param *p;
+ GNUNET_RPC_CallParameters *p;
void *buf;
size_t size;
unsigned int len;
- p = RPC_paramNew ();
+ p = GNUNET_RPC_parameters_create ();
- if (GNUNET_SYSERR != RPC_paramValueByPosition (p, 0, &len, &buf))
+ if (GNUNET_SYSERR != GNUNET_RPC_parameters_get_value_by_index (p, 0, &len,
&buf))
return 1;
- if (GNUNET_SYSERR != RPC_paramValueByName (p, "not there", &len, &buf))
+ if (GNUNET_SYSERR != GNUNET_RPC_parameters_get_value_by_name (p, "not
there", &len, &buf))
return 1;
- if (RPC_paramCount (p) != 0)
+ if (GNUNET_RPC_parameters_count (p) != 0)
return 1;
- RPC_paramAdd (p, "foo", 4, "bar");
- RPC_paramAdd (p, "bar", 4, "foo");
- if (RPC_paramCount (p) != 2)
+ GNUNET_RPC_parameters_add (p, "foo", 4, "bar");
+ GNUNET_RPC_parameters_add (p, "bar", 4, "foo");
+ if (GNUNET_RPC_parameters_count (p) != 2)
return 1;
- if (0 != strcmp (RPC_paramName (p, 0), "foo"))
+ if (0 != strcmp (GNUNET_RPC_parameters_get_name (p, 0), "foo"))
return 1;
- if (0 != strcmp (RPC_paramName (p, 1), "bar"))
+ if (0 != strcmp (GNUNET_RPC_parameters_get_name (p, 1), "bar"))
return 1;
- size = RPC_paramSize (p);
+ size = GNUNET_RPC_parameters_get_serialized_size (p);
buf = GNUNET_malloc (size);
- RPC_paramSerialize (p, buf);
- RPC_paramFree (p);
- p = RPC_paramDeserialize (buf, size);
+ GNUNET_RPC_parameters_serialize (p, buf);
+ GNUNET_RPC_parameters_destroy (p);
+ p = GNUNET_RPC_parameters_deserialize (buf, size);
GNUNET_free (buf);
if (p == NULL)
return 1;
buf = NULL;
- if (GNUNET_OK != RPC_paramValueByName (p, "foo", &len, &buf))
+ if (GNUNET_OK != GNUNET_RPC_parameters_get_value_by_name (p, "foo", &len,
&buf))
return 1;
if (strcmp ("bar", buf) != 0)
return 1;
buf = NULL;
if (4 != len)
return 1;
- if (GNUNET_OK != RPC_paramValueByPosition (p, 1, &len, &buf))
+ if (GNUNET_OK != GNUNET_RPC_parameters_get_value_by_index (p, 1, &len, &buf))
return 1;
if (strcmp ("foo", buf) != 0)
return 1;
if (4 != len)
return 1;
- if (GNUNET_SYSERR != RPC_paramValueByPosition (p, 2, &len, &buf))
+ if (GNUNET_SYSERR != GNUNET_RPC_parameters_get_value_by_index (p, 2, &len,
&buf))
return 1;
- if (GNUNET_SYSERR != RPC_paramValueByName (p, "not there", &len, &buf))
+ if (GNUNET_SYSERR != GNUNET_RPC_parameters_get_value_by_name (p, "not
there", &len, &buf))
return 1;
- RPC_paramFree (p);
+ GNUNET_RPC_parameters_destroy (p);
return 0;
}
Modified: GNUnet/src/applications/rpc/rpc.c
===================================================================
--- GNUnet/src/applications/rpc/rpc.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/applications/rpc/rpc.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -27,6 +27,7 @@
#include "gnunet_util.h"
#include "gnunet_protocols.h"
#include "gnunet_rpc_service.h"
+#include "gnunet_rpc_lib.h"
/**
* Flag that determines if the RPC test will be build as
@@ -63,7 +64,7 @@
#if DEBUG_RPC_CLIENT
-#define RPC_STATUS(a,b,c) GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER, "RPC:
`%s' (%p) %s at %s\n", a, c, b, __FUNCTION__);
+#define RPC_STATUS(a,b,c) GNUNET_GE_LOG(ectx, GNUNET_GE_DEBUG |
GNUNET_GE_REQUEST | GNUNET_GE_USER, "RPC: `%s' (%p) %s at %s\n", a, c, b,
__FUNCTION__);
#else
#define RPC_STATUS(a,b,c)
#endif
@@ -72,7 +73,7 @@
/**
* Access to GNUnet core API.
*/
-static CoreAPIForApplication *coreAPI = NULL;
+static GNUNET_CoreAPIForPlugins *coreAPI = NULL;
/**
* A mutex for synchronous access to all module-wide data structures. This
@@ -81,7 +82,7 @@
*/
static struct GNUNET_Mutex *rpcLock;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
/* *************** RPC registration ****************** */
@@ -94,12 +95,12 @@
/**
* Callback for a synchronous RPC. NULL for async RPCs.
*/
- RPC_Function callback;
+ GNUNET_RPC_SynchronousFunction callback;
/**
* Callback for an asynchronous RPC. NULL for sync RPCs.
*/
- ASYNC_RPC_Function async_callback;
+ GNUNET_RPC_AsynchronousFunction async_callback;
} RegisteredRPC;
/**
@@ -117,12 +118,12 @@
* (typically if a callback of that name is already in use).
*/
static int
-RPC_register (const char *name, RPC_Function callback)
+RPC_register (const char *name, GNUNET_RPC_SynchronousFunction callback)
{
RegisteredRPC *rrpc;
- GE_ASSERT (ectx, name != NULL);
- GE_ASSERT (ectx, callback != NULL);
+ GNUNET_GE_ASSERT (ectx, name != NULL);
+ GNUNET_GE_ASSERT (ectx, callback != NULL);
GNUNET_mutex_lock (rpcLock);
rrpc = GNUNET_vector_get_first (list_of_callbacks);
while (rrpc != NULL)
@@ -130,7 +131,7 @@
if (0 == strcmp (rrpc->name, name))
{
GNUNET_mutex_unlock (rpcLock);
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("%s::%s - RPC %s:%p could not be registered:"
" another callback is already using this name (%p)\n"),
__FILE__, __FUNCTION__, name, callback, rrpc->callback);
@@ -143,7 +144,7 @@
rrpc->callback = callback;
rrpc->async_callback = NULL;
GNUNET_vector_insert_last (list_of_callbacks, rrpc);
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"%s::%s - Registered RPC %d: %s\n",
__FILE__, __FUNCTION__, GNUNET_vector_get_size (list_of_callbacks),
name);
@@ -159,12 +160,12 @@
* (typically if a callback of that name is already in use).
*/
static int
-RPC_register_async (const char *name, ASYNC_RPC_Function callback)
+RPC_register_async (const char *name, GNUNET_RPC_AsynchronousFunction callback)
{
RegisteredRPC *rrpc;
- GE_ASSERT (ectx, name != NULL);
- GE_ASSERT (ectx, callback != NULL);
+ GNUNET_GE_ASSERT (ectx, name != NULL);
+ GNUNET_GE_ASSERT (ectx, callback != NULL);
GNUNET_mutex_lock (rpcLock);
rrpc = GNUNET_vector_get_first (list_of_callbacks);
while (rrpc != NULL)
@@ -172,7 +173,7 @@
if (0 == strcmp (rrpc->name, name))
{
GNUNET_mutex_unlock (rpcLock);
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("%s::%s - RPC %s:%p could not be registered:"
" another callback is already using this name (%p)\n"),
__FILE__, __FUNCTION__, name, callback, rrpc->callback);
@@ -185,7 +186,7 @@
rrpc->callback = NULL;
rrpc->async_callback = callback;
GNUNET_vector_insert_last (list_of_callbacks, rrpc);
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"%s::%s - Registered asynchronous RPC %d: %s\n",
__FILE__, __FUNCTION__, GNUNET_vector_get_size (list_of_callbacks),
name);
@@ -203,11 +204,11 @@
* bound to a different function).
*/
static int
-RPC_unregister (const char *name, RPC_Function callback)
+RPC_unregister (const char *name, GNUNET_RPC_SynchronousFunction callback)
{
RegisteredRPC *rrpc;
- GE_ASSERT (ectx, name != NULL);
+ GNUNET_GE_ASSERT (ectx, name != NULL);
GNUNET_mutex_lock (rpcLock);
rrpc = GNUNET_vector_get_first (list_of_callbacks);
while (rrpc != NULL)
@@ -216,7 +217,7 @@
{
if ((rrpc->callback != callback) && (callback != NULL))
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("%s::%s - RPC %s:%p could not be unregistered:"
" another callback registered under that name: %p\n"),
__FILE__, __FUNCTION__, name, callback, rrpc->callback);
@@ -227,7 +228,7 @@
GNUNET_free (rrpc->name);
GNUNET_free (rrpc);
GNUNET_mutex_unlock (rpcLock);
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"%s::%s - Unregistered RPC %s\n",
__FILE__, __FUNCTION__, name);
return GNUNET_OK;
@@ -235,7 +236,7 @@
rrpc = GNUNET_vector_get_next (list_of_callbacks);
}
GNUNET_mutex_unlock (rpcLock);
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("%s::%s - RPC %s:%p could not be unregistered: not found\n"),
__FILE__, __FUNCTION__, name, callback);
return GNUNET_SYSERR;
@@ -250,11 +251,11 @@
* bound to a different function).
*/
static int
-RPC_unregister_async (const char *name, ASYNC_RPC_Function callback)
+RPC_unregister_async (const char *name, GNUNET_RPC_AsynchronousFunction
callback)
{
RegisteredRPC *rrpc;
- GE_ASSERT (ectx, name != NULL);
+ GNUNET_GE_ASSERT (ectx, name != NULL);
GNUNET_mutex_lock (rpcLock);
rrpc = GNUNET_vector_get_first (list_of_callbacks);
while (rrpc != NULL)
@@ -263,7 +264,7 @@
{
if ((rrpc->async_callback != callback) && (callback != NULL))
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("%s::%s - RPC %s:%p could not be unregistered:"
" another callback registered under that name: %p\n"),
__FILE__, __FUNCTION__, name, callback, rrpc->callback);
@@ -274,7 +275,7 @@
GNUNET_free (rrpc->name);
GNUNET_free (rrpc);
GNUNET_mutex_unlock (rpcLock);
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"%s::%s - Unregistered asynchronous RPC %s\n",
__FILE__, __FUNCTION__, name);
return GNUNET_OK;
@@ -282,7 +283,7 @@
rrpc = GNUNET_vector_get_next (list_of_callbacks);
}
GNUNET_mutex_unlock (rpcLock);
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_
("%s::%s - async RPC %s:%p could not be unregistered: not found\n"),
__FILE__, __FUNCTION__, name, callback);
@@ -417,7 +418,7 @@
* Ensure replies and requests have different IDs when dealing
* with the same peer.
*/
-#define MINGLE(a,b) (((b) == P2P_PROTO_rpc_RES) ? (a) : (a) ^ 0x12345678)
+#define MINGLE(a,b) (((b) == GNUNET_P2P_PROTO_RPC_RES) ? (a) : (a) ^
0x12345678)
/**
* Notification: we sent a message to the peer.
@@ -532,7 +533,7 @@
* followed by a serialization of argumentCount arguments.
*/
char data[1];
-} P2P_rpc_MESSAGE_GENERIC;
+} P2P_rpc_MESSAGNUNET_GE_GENERIC;
/**
@@ -562,12 +563,12 @@
typedef void (*RPCFinishedCallback) (void *context,
unsigned int sequenceNumber,
unsigned short errorCode,
- RPC_Param * result);
+ GNUNET_RPC_CallParameters * result);
/**
* A per-RPC structure.
*/
-typedef struct CallInstance
+typedef struct GNUNET_RPC_CallHandle
{
/**
* The sequence number of this RPC.
@@ -629,13 +630,13 @@
} CallInstance;
/**
- * A set of CallInstance structures for active incoming rpc calls.
+ * A set of GNUNET_RPC_CallHandle structures for active incoming rpc calls.
* (requests without a reply).
*/
static struct GNUNET_Vector *incomingCalls;
/**
- * A set of CallInstance structures for active outgoing rpc calls.
+ * A set of GNUNET_RPC_CallHandle structures for active outgoing rpc calls.
* (reply messages without an ACK).
*/
static struct GNUNET_Vector *outgoingCalls;
@@ -650,7 +651,7 @@
/**
* Cron-job that processes the RPC queues. Created for
- * each CallInstance. Not renewed if the call times out,
+ * each GNUNET_RPC_CallHandle. Not renewed if the call times out,
* deleted if the appropriate response is received.
*/
static void
@@ -660,7 +661,7 @@
GNUNET_CronTime now;
now = GNUNET_get_time ();
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
(GNUNET_get_time () + 1 * GNUNET_CRON_MINUTES >
call->expirationTime)
|| (call->expirationTime - GNUNET_get_time () <
@@ -669,14 +670,14 @@
if (now > call->expirationTime)
{
#if DEBUG_RPC
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"Completed RPC %p (timeout).\n", call);
#endif
if (call->finishedCallback != NULL)
{
call->finishedCallback (call->rpcCallbackArgs,
call->sequenceNumber,
- RPC_ERROR_TIMEOUT, NULL);
+ GNUNET_RPC_ERROR_TIMEOUT, NULL);
GNUNET_vector_delete (outgoingCalls, call);
}
else
@@ -711,19 +712,19 @@
MINGLE (call->sequenceNumber,
ntohs (call->msg->header.type)));
#if DEBUG_RPC
- if (ntohs (call->msg->header.type) == P2P_PROTO_rpc_REQ)
+ if (ntohs (call->msg->header.type) == GNUNET_P2P_PROTO_RPC_REQ)
{
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"Sending RPC request %p: '%.*s' (expires in %llums, last
attempt %llums ago; attempt %u).\n",
call,
ntohs (call->msg->functionNameLength),
- &((P2P_rpc_MESSAGE_GENERIC *) call->msg)->data[0],
+ &((P2P_rpc_MESSAGNUNET_GE_GENERIC *) call->msg)->data[0],
call->expirationTime - now,
now - call->lastAttempt, call->attempts);
}
else
{
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"Sending RPC reply %p (expires in %llums, last attempt
%llums ago, attempt %u).\n",
call,
call->expirationTime - now,
@@ -736,7 +737,7 @@
&call->msg->header,
ntohl (call->msg->importance), maxdelay);
}
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
(GNUNET_get_time () + 1 * GNUNET_CRON_MINUTES >
call->expirationTime)
|| (call->expirationTime - GNUNET_get_time () <
@@ -758,7 +759,7 @@
RPC_ACK_Message msg;
msg.header.size = htons (sizeof (RPC_ACK_Message));
- msg.header.type = htons (P2P_PROTO_rpc_ACK);
+ msg.header.type = htons (GNUNET_P2P_PROTO_RPC_ACK);
msg.sequenceNumber = htonl (sequenceNumber);
coreAPI->unicast (receiver, &msg.header, importance, maxDelay);
}
@@ -773,29 +774,29 @@
if (ntohs (req->header.size) < sizeof (P2P_rpc_MESSAGE) + slen)
return NULL; /* invalid! */
ret = GNUNET_malloc (slen + 1);
- memcpy (ret, &((P2P_rpc_MESSAGE_GENERIC *) req)->data[0], slen);
+ memcpy (ret, &((P2P_rpc_MESSAGNUNET_GE_GENERIC *) req)->data[0], slen);
ret[slen] = '\0';
return ret;
}
-static RPC_Param *
+static GNUNET_RPC_CallParameters *
deserializeArguments (P2P_rpc_MESSAGE * req)
{
unsigned short slen;
- RPC_Param *ret;
+ GNUNET_RPC_CallParameters *ret;
- if (ntohs (req->header.type) == P2P_PROTO_rpc_REQ)
+ if (ntohs (req->header.type) == GNUNET_P2P_PROTO_RPC_REQ)
slen = ntohs (req->functionNameLength);
else
slen = 0;
if (ntohs (req->header.size) < sizeof (P2P_rpc_MESSAGE) + slen)
return NULL; /* invalid! */
- ret = RPC_paramDeserialize (&((P2P_rpc_MESSAGE_GENERIC *) req)->data[slen],
+ ret = GNUNET_RPC_parameters_deserialize (&((P2P_rpc_MESSAGNUNET_GE_GENERIC
*) req)->data[slen],
ntohs (req->header.size) -
sizeof (P2P_rpc_MESSAGE) - slen);
- if (RPC_paramCount (ret) != ntohs (req->argumentCount))
+ if (GNUNET_RPC_parameters_count (ret) != ntohs (req->argumentCount))
{
- RPC_paramFree (ret);
+ GNUNET_RPC_parameters_destroy (ret);
return NULL; /* invalid! */
}
return ret;
@@ -815,7 +816,7 @@
buildMessage (unsigned short errorCode,
const char *name,
unsigned int sequenceNumber,
- unsigned int importance, RPC_Param * values)
+ unsigned int importance, GNUNET_RPC_CallParameters * values)
{
P2P_rpc_MESSAGE *ret;
size_t size = sizeof (P2P_rpc_MESSAGE);
@@ -829,7 +830,7 @@
else
slen = 0;
if (values != NULL)
- size += RPC_paramSize (values);
+ size += GNUNET_RPC_parameters_get_serialized_size (values);
if (size >= GNUNET_MAX_BUFFER_SIZE)
return NULL; /* message to big! */
ret = GNUNET_malloc (size);
@@ -841,17 +842,17 @@
ret->functionNameLength = htons (errorCode);
else
ret->functionNameLength = htons (slen);
- ret->argumentCount = htons (RPC_paramCount (values));
+ ret->argumentCount = htons (GNUNET_RPC_parameters_count (values));
if (name != NULL)
{
- memcpy (&((P2P_rpc_MESSAGE_GENERIC *) ret)->data[0], name, slen);
+ memcpy (&((P2P_rpc_MESSAGNUNET_GE_GENERIC *) ret)->data[0], name, slen);
}
- RPC_paramSerialize (values, &((P2P_rpc_MESSAGE_GENERIC *) ret)->data[slen]);
+ GNUNET_RPC_parameters_serialize (values, &((P2P_rpc_MESSAGNUNET_GE_GENERIC
*) ret)->data[slen]);
if (name == NULL)
- ret->header.type = htons (P2P_PROTO_rpc_RES);
+ ret->header.type = htons (GNUNET_P2P_PROTO_RPC_RES);
else
- ret->header.type = htons (P2P_PROTO_rpc_REQ);
+ ret->header.type = htons (GNUNET_P2P_PROTO_RPC_REQ);
return ret;
}
@@ -867,7 +868,7 @@
* case o complete the reply (since it's the same code).
*/
static void
-async_rpc_complete_callback (RPC_Param * results,
+async_rpc_complete_callback (GNUNET_RPC_CallParameters * results,
int errorCode, CallInstance * calls)
{
GNUNET_mutex_lock (rpcLock);
@@ -877,13 +878,13 @@
calls->sequenceNumber,
calls->importance, results);
if (calls->msg == NULL)
- calls->msg = buildMessage (RPC_ERROR_RETURN_VALUE_TOO_LARGE,
+ calls->msg = buildMessage (GNUNET_RPC_ERROR_RETURN_VALUE_TOO_LARGE,
NULL,
calls->sequenceNumber,
calls->importance, results);
GNUNET_vector_insert_last (incomingCalls, calls);
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
(GNUNET_get_time () + 1 * GNUNET_CRON_MINUTES >
calls->expirationTime)
|| (calls->expirationTime - GNUNET_get_time () <
@@ -908,16 +909,16 @@
unsigned int sq;
unsigned short errorCode;
char *functionName;
- RPC_Param *argumentValues;
- RPC_Param *returnValues;
+ GNUNET_RPC_CallParameters *argumentValues;
+ GNUNET_RPC_CallParameters *returnValues;
RegisteredRPC *rpc;
unsigned int minSQ;
- if ((ntohs (message->type) != P2P_PROTO_rpc_REQ) ||
+ if ((ntohs (message->type) != GNUNET_P2P_PROTO_RPC_REQ) ||
(ntohs (message->size) < sizeof (P2P_rpc_MESSAGE)))
{
- GE_LOG (ectx,
- GE_WARNING | GE_REQUEST | GE_ADMIN,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_REQUEST | GNUNET_GE_ADMIN,
_("Invalid message of type %u received. Dropping.\n"),
ntohs (message->type));
return GNUNET_SYSERR;
@@ -925,8 +926,8 @@
req = (P2P_rpc_MESSAGE *) message;
sq = ntohl (req->sequenceNumber);
#if DEBUG_RPC
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Received RPC request with id %u.\n", sq);
#endif
GNUNET_mutex_lock (rpcLock);
@@ -961,14 +962,14 @@
}
RPC_STATUS ("", "received duplicate request", calls);
calls->expirationTime = GNUNET_get_time () + MAX_RPC_TIMEOUT;
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"Dropping RPC request %u, duplicate.\n", sq);
GNUNET_mutex_unlock (rpcLock);
return GNUNET_OK; /* seen before */
}
if (minSQ > sq)
{
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"Dropping RPC request %u, sequence number too old (current
minimum is %u).\n",
sq, minSQ);
GNUNET_mutex_unlock (rpcLock);
@@ -982,9 +983,9 @@
{
GNUNET_free_non_null (functionName);
if (argumentValues != NULL)
- RPC_paramFree (argumentValues);
+ GNUNET_RPC_parameters_destroy (argumentValues);
GNUNET_mutex_unlock (rpcLock);
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Dropping RPC request %u: message malformed.\n"));
return GNUNET_SYSERR; /* message malformed */
}
@@ -1012,9 +1013,9 @@
/* if possible, perform RPC call */
if (rpc == NULL)
{
- RPC_paramFree (argumentValues);
+ GNUNET_RPC_parameters_destroy (argumentValues);
returnValues = NULL;
- errorCode = RPC_ERROR_UNKNOWN_FUNCTION;
+ errorCode = GNUNET_RPC_ERROR_UNKNOWN_FUNCTION;
}
else
{
@@ -1027,10 +1028,10 @@
GNUNET_mutex_unlock (rpcLock);
return GNUNET_OK;
}
- returnValues = RPC_paramNew ();
+ returnValues = GNUNET_RPC_parameters_create ();
rpc->callback (sender, argumentValues, returnValues);
- RPC_paramFree (argumentValues);
- errorCode = RPC_ERROR_OK;
+ GNUNET_RPC_parameters_destroy(argumentValues);
+ errorCode = GNUNET_RPC_ERROR_OK;
}
GNUNET_mutex_unlock (rpcLock);
async_rpc_complete_callback (returnValues, errorCode, calls);
@@ -1049,25 +1050,25 @@
P2P_rpc_MESSAGE *res;
CallInstance *call;
- if ((ntohs (message->type) != P2P_PROTO_rpc_RES) ||
+ if ((ntohs (message->type) != GNUNET_P2P_PROTO_RPC_RES) ||
(ntohs (message->size) < sizeof (P2P_rpc_MESSAGE)))
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Invalid message of type %u received. Dropping.\n"),
ntohs (message->type));
return GNUNET_SYSERR;
}
res = (P2P_rpc_MESSAGE *) message;
#if DEBUG_RPC
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Received RPC reply with id %u.\n", ntohl (res->sequenceNumber));
#endif
GNUNET_cron_suspend_jobs (coreAPI->cron, GNUNET_NO);
GNUNET_mutex_lock (rpcLock);
- /* Locate the CallInstance structure. */
+ /* Locate the GNUNET_RPC_CallHandle structure. */
call = GNUNET_vector_get_first (outgoingCalls);
while (call != NULL)
{
@@ -1080,25 +1081,25 @@
}
if (NULL != call)
{
- RPC_Param *reply;
- P2P_rpc_MESSAGE_GENERIC *gen;
+ GNUNET_RPC_CallParameters *reply;
+ P2P_rpc_MESSAGNUNET_GE_GENERIC *gen;
unsigned short error;
RPC_STATUS ("", "received reply", call);
- gen = (P2P_rpc_MESSAGE_GENERIC *) res;
+ gen = (P2P_rpc_MESSAGNUNET_GE_GENERIC *) res;
reply = NULL;
error = ntohs (res->functionNameLength);
- if (error == RPC_ERROR_OK)
+ if (error == GNUNET_RPC_ERROR_OK)
{
- reply = RPC_paramDeserialize (&gen->data[0],
+ reply = GNUNET_RPC_parameters_deserialize (&gen->data[0],
ntohs (message->size) -
sizeof (P2P_rpc_MESSAGE));
- if (ntohs (res->argumentCount) != RPC_paramCount (reply))
+ if (ntohs (res->argumentCount) != GNUNET_RPC_parameters_count
(reply))
{
- RPC_paramFree (reply);
+ GNUNET_RPC_parameters_destroy(reply);
reply = NULL;
- error = RPC_ERROR_REPLY_MALFORMED;
+ error = GNUNET_RPC_ERROR_REPLY_MALFORMED;
}
}
if (call->finishedCallback != NULL)
@@ -1109,12 +1110,12 @@
}
GNUNET_vector_delete (outgoingCalls, call);
notifyPeerReply (sender,
- MINGLE (call->sequenceNumber, P2P_PROTO_rpc_REQ));
+ MINGLE (call->sequenceNumber,
GNUNET_P2P_PROTO_RPC_REQ));
GNUNET_cron_del_job (coreAPI->cron, &retryRPCJob, 0, call);
GNUNET_free (call->msg);
GNUNET_free (call);
if (reply != NULL)
- RPC_paramFree (reply);
+ GNUNET_RPC_parameters_destroy (reply);
}
sendAck (sender, ntohl (res->sequenceNumber), 0, /* not important, ACK
should be tiny enough to go through anyway */
0 /* right away */ );
@@ -1125,7 +1126,7 @@
/**
- * Handle a peer-to-peer message of type P2P_PROTO_rpc_ACK.
+ * Handle a peer-to-peer message of type GNUNET_P2P_PROTO_RPC_ACK.
*/
static int
handleRPCMessageAck (const GNUNET_PeerIdentity * sender,
@@ -1134,11 +1135,11 @@
RPC_ACK_Message *ack;
CallInstance *call;
- if ((ntohs (message->type) != P2P_PROTO_rpc_ACK) ||
+ if ((ntohs (message->type) != GNUNET_P2P_PROTO_RPC_ACK) ||
(ntohs (message->size) != sizeof (RPC_ACK_Message)))
{
- GE_LOG (ectx,
- GE_WARNING | GE_REQUEST | GE_ADMIN,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_REQUEST | GNUNET_GE_ADMIN,
_("Invalid message of type %u received. Dropping.\n"),
ntohs (message->type));
return GNUNET_SYSERR;
@@ -1146,13 +1147,13 @@
ack = (RPC_ACK_Message *) message;
#if DEBUG_RPC
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Received RPC ACK with id %u.\n", ntohl (ack->sequenceNumber));
#endif
GNUNET_cron_suspend_jobs (coreAPI->cron, GNUNET_NO);
GNUNET_mutex_lock (rpcLock);
- /* Locate the CallInstance structure. */
+ /* Locate the GNUNET_RPC_CallHandle structure. */
call = (CallInstance *) GNUNET_vector_get_first (incomingCalls);
while (call != NULL)
{
@@ -1170,7 +1171,7 @@
RPC_STATUS ("", "acknowledged reply", call);
notifyPeerReply (sender,
MINGLE (ntohl (ack->sequenceNumber),
- P2P_PROTO_rpc_RES));
+ GNUNET_P2P_PROTO_RPC_RES));
GNUNET_cron_del_job (coreAPI->cron, &retryRPCJob, 0, call);
GNUNET_vector_delete (incomingCalls, call);
GNUNET_free (call->msg);
@@ -1185,7 +1186,7 @@
pi->averageResponseTime *= 2;
}
#if DEBUG_RPC
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"ACK is a duplicate (or invalid).\n");
#endif
}
@@ -1200,7 +1201,7 @@
typedef struct
{
struct GNUNET_Semaphore *sem;
- RPC_Param *result;
+ GNUNET_RPC_CallParameters *result;
unsigned short ec;
} RPC_EXEC_CLS;
@@ -1210,17 +1211,17 @@
*/
static void
RPC_execute_callback (RPC_EXEC_CLS * context,
- unsigned int sq, unsigned short ec, RPC_Param * res)
+ unsigned int sq, unsigned short ec,
GNUNET_RPC_CallParameters * res)
{
int i;
unsigned int dl;
void *data;
- for (i = RPC_paramCount (res) - 1; i >= 0; i--)
+ for (i = GNUNET_RPC_parameters_count (res) - 1; i >= 0; i--)
{
data = NULL;
- RPC_paramValueByPosition (res, i, &dl, &data);
- RPC_paramAdd (context->result, RPC_paramName (res, i), dl, data);
+ GNUNET_RPC_parameters_get_value_by_index (res, i, &dl, &data);
+ GNUNET_RPC_parameters_add (context->result,
GNUNET_RPC_parameters_get_name (res, i), dl, data);
}
context->ec = ec;
GNUNET_semaphore_up (context->sem);
@@ -1239,8 +1240,8 @@
static int
RPC_execute (const GNUNET_PeerIdentity * receiver,
const char *name,
- RPC_Param * requestParam,
- RPC_Param * returnParam, unsigned int importance,
+ GNUNET_RPC_CallParameters * requestParam,
+ GNUNET_RPC_CallParameters * returnParam, unsigned int importance,
GNUNET_CronTime timeout)
{
RPC_EXEC_CLS cls;
@@ -1257,13 +1258,13 @@
call->expirationTime = GNUNET_get_time () + timeout;
call->receiver = *receiver;
call->sequenceNumber = rpcIdentifier++;
- call->msg = buildMessage (RPC_ERROR_OK,
+ call->msg = buildMessage (GNUNET_RPC_ERROR_OK,
name,
call->sequenceNumber, importance, requestParam);
call->finishedCallback = (RPCFinishedCallback) & RPC_execute_callback;
call->rpcCallbackArgs = &cls;
GNUNET_vector_insert_last (outgoingCalls, call);
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
(GNUNET_get_time () + 1 * GNUNET_CRON_MINUTES >
call->expirationTime)
|| (call->expirationTime - GNUNET_get_time () <
@@ -1276,11 +1277,11 @@
return cls.ec;
}
-typedef struct RPC_Record
+typedef struct GNUNET_RPC_RequestHandle
{
GNUNET_PeerIdentity peer;
CallInstance *call;
- RPC_Complete callback;
+ GNUNET_RPC_AsynchronousCompletionCallback callback;
void *closure;
unsigned short errorCode;
} RPC_Record;
@@ -1288,9 +1289,9 @@
static void
RPC_async_callback (RPC_Record * rec,
unsigned int sequenceNumber,
- unsigned short errorCode, RPC_Param * result)
+ unsigned short errorCode, GNUNET_RPC_CallParameters *
result)
{
- if ((errorCode == RPC_ERROR_OK) && (rec->callback != NULL))
+ if ((errorCode == GNUNET_RPC_ERROR_OK) && (rec->callback != NULL))
{
rec->callback (&rec->peer, result, rec->closure);
rec->callback = NULL; /* never call callback twice */
@@ -1311,15 +1312,15 @@
static RPC_Record *
RPC_start (const GNUNET_PeerIdentity * receiver,
const char *name,
- RPC_Param * request_param,
+ GNUNET_RPC_CallParameters * request_param,
unsigned int importance,
- GNUNET_CronTime timeout, RPC_Complete callback, void *closure)
+ GNUNET_CronTime timeout, GNUNET_RPC_AsynchronousCompletionCallback
callback, void *closure)
{
RPC_Record *ret;
if (timeout > 1 * GNUNET_CRON_HOURS)
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' called with timeout above 1 hour (bug?)\n"),
__FUNCTION__);
timeout = 1 * GNUNET_CRON_HOURS;
@@ -1329,7 +1330,7 @@
ret->peer = *receiver;
ret->callback = callback;
ret->closure = closure;
- ret->errorCode = RPC_ERROR_TIMEOUT;
+ ret->errorCode = GNUNET_RPC_ERROR_TIMEOUT;
GNUNET_mutex_lock (rpcLock);
ret->call = GNUNET_malloc (sizeof (CallInstance));
ret->call->lastAttempt = 0;
@@ -1338,14 +1339,14 @@
ret->call->expirationTime = GNUNET_get_time () + timeout;
ret->call->receiver = *receiver;
ret->call->sequenceNumber = rpcIdentifier++;
- ret->call->msg = buildMessage (RPC_ERROR_OK,
+ ret->call->msg = buildMessage (GNUNET_RPC_ERROR_OK,
name,
ret->call->sequenceNumber,
importance, request_param);
ret->call->finishedCallback = (RPCFinishedCallback) & RPC_async_callback;
ret->call->rpcCallbackArgs = ret;
GNUNET_vector_insert_last (outgoingCalls, ret->call);
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
(GNUNET_get_time () + 1 * GNUNET_CRON_MINUTES >
ret->call->expirationTime)
|| (ret->call->expirationTime - GNUNET_get_time () <
@@ -1359,7 +1360,7 @@
* Stop an asynchronous RPC (and free associated resources)
*
* @param record the return value from RPC_start
- * @return RPC_ERROR_OK if the RPC was successful,
+ * @return GNUNET_RPC_ERROR_OK if the RPC was successful,
* another RPC_ERROR code if it was aborted
*/
static int
@@ -1396,9 +1397,9 @@
GNUNET_cron_del_job (coreAPI->cron,
&agePeerStats, PEER_TRACKING_TIME_INTERVAL, NULL);
- coreAPI->unregisterHandler (P2P_PROTO_rpc_REQ, &handleRPCMessageReq);
- coreAPI->unregisterHandler (P2P_PROTO_rpc_RES, &handleRPCMessageRes);
- coreAPI->unregisterHandler (P2P_PROTO_rpc_ACK, &handleRPCMessageAck);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_RPC_REQ, &handleRPCMessageReq);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_RPC_RES, &handleRPCMessageRes);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_RPC_ACK, &handleRPCMessageAck);
if (NULL != peerInformation)
{
while (GNUNET_vector_get_size (peerInformation) > 0)
@@ -1437,7 +1438,7 @@
RegisteredRPC *rpc;
rpc =
(RegisteredRPC *) GNUNET_vector_delete_last (list_of_callbacks);
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("RPC not unregistered: %s:%p\n"), rpc->name,
rpc->callback);
GNUNET_free (rpc->name);
@@ -1453,10 +1454,10 @@
/**
* Initialize the RPC service.
*/
-RPC_ServiceAPI *
-provide_module_rpc (CoreAPIForApplication * capi)
+GNUNET_RPC_ServiceAPI *
+provide_module_rpc (GNUNET_CoreAPIForPlugins * capi)
{
- static RPC_ServiceAPI rpcAPI;
+ static GNUNET_RPC_ServiceAPI rpcAPI;
int rvalue;
ectx = capi->ectx;
@@ -1466,23 +1467,23 @@
incomingCalls = GNUNET_vector_create (16);
outgoingCalls = GNUNET_vector_create (16);
list_of_callbacks = GNUNET_vector_create (16);
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("`%s' registering handlers %d %d %d\n"),
- "rpc", P2P_PROTO_rpc_REQ, P2P_PROTO_rpc_RES, P2P_PROTO_rpc_ACK);
+ "rpc", GNUNET_P2P_PROTO_RPC_REQ, GNUNET_P2P_PROTO_RPC_RES,
GNUNET_P2P_PROTO_RPC_ACK);
rvalue = GNUNET_OK;
- if (capi->registerHandler (P2P_PROTO_rpc_REQ,
+ if (capi->registerHandler (GNUNET_P2P_PROTO_RPC_REQ,
&handleRPCMessageReq) == GNUNET_SYSERR)
rvalue = GNUNET_SYSERR;
- if (capi->registerHandler (P2P_PROTO_rpc_RES,
+ if (capi->registerHandler (GNUNET_P2P_PROTO_RPC_RES,
&handleRPCMessageRes) == GNUNET_SYSERR)
rvalue = GNUNET_SYSERR;
- if (capi->registerHandler (P2P_PROTO_rpc_ACK,
+ if (capi->registerHandler (GNUNET_P2P_PROTO_RPC_ACK,
&handleRPCMessageAck) == GNUNET_SYSERR)
rvalue = GNUNET_SYSERR;
if (rvalue == GNUNET_SYSERR)
{
release_module_rpc ();
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Failed to initialize `%s' service.\n"), "rpc");
return NULL;
}
@@ -1507,123 +1508,123 @@
static void
testCallback (const GNUNET_PeerIdentity * sender,
- RPC_Param * arguments, RPC_Param * results)
+ GNUNET_RPC_CallParameters * arguments, GNUNET_RPC_CallParameters
* results)
{
unsigned int dl;
char *data;
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER, "RPC callback invoked!\n");
- if ((GNUNET_OK == RPC_paramValueByName (arguments,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"RPC callback invoked!\n");
+ if ((GNUNET_OK == GNUNET_RPC_parameters_get_value_by_name (arguments,
"command",
&dl,
(void **) &data)) &&
(strncmp ("Hello", data, dl) == 0))
{
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"RPC callback received Hello command!\n");
- RPC_paramAdd (results,
+ GNUNET_RPC_parameters_add (results,
"response",
strlen ("Hello RPC World") + 1, "Hello RPC World");
}
}
static void
-async_RPC_Complete_callback (RPC_Param * results,
+async_RPC_Complete_callback (GNUNET_RPC_CallParameters * results,
struct GNUNET_Semaphore *GNUNET_RSA_sign)
{
unsigned int dl;
char *reply;
GNUNET_semaphore_down (GNUNET_RSA_sign, GNUNET_YES);
- if ((GNUNET_OK != RPC_paramValueByName (results,
+ if ((GNUNET_OK != GNUNET_RPC_parameters_get_value_by_name (results,
"response",
&dl,
(void **) &reply)) ||
(strncmp ("Hello RPC World", reply, dl) != 0))
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("RPC async reply invalid.\n"));
}
else
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"RPC async reply received.\n");
}
int
-initialize_module_rpc (CoreAPIForApplication * capi)
+initialize_module_rpc (GNUNET_CoreAPIForPlugins * capi)
{
- RPC_ServiceAPI *rpcAPI;
+ GNUNET_RPC_ServiceAPI *rpcAPI;
int ret;
- RPC_Param *args;
- RPC_Param *rets;
+ GNUNET_RPC_CallParameters *args;
+ GNUNET_RPC_CallParameters *rets;
unsigned int dl;
char *reply;
int code;
- RPC_Record *record;
+ struct GNUNET_RPC_RequestHandle *record;
struct GNUNET_Semaphore *GNUNET_RSA_sign;
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER, "RPC testcase starting\n");
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"RPC testcase starting\n");
rpcAPI = capi->requestService ("rpc");
if (rpcAPI == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
ret = GNUNET_OK;
if (GNUNET_OK != rpcAPI->RPC_register ("testFunction", &testCallback))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
ret = GNUNET_SYSERR;
}
- args = RPC_paramNew ();
- RPC_paramAdd (args, "command", strlen ("Hello") + 1, "Hello");
+ args = GNUNET_RPC_parameters_create ();
+ GNUNET_RPC_parameters_add (args, "command", strlen ("Hello") + 1, "Hello");
GNUNET_RSA_sign = GNUNET_semaphore_create (0);
record = rpcAPI->RPC_start (coreAPI->myIdentity,
"testFunction",
args,
0,
5 * GNUNET_CRON_SECONDS,
- (RPC_Complete) & async_RPC_Complete_callback,
+ (GNUNET_RPC_AsynchronousCompletionCallback) &
async_RPC_Complete_callback,
GNUNET_RSA_sign);
GNUNET_semaphore_up (GNUNET_RSA_sign); /* allow callback now - forces
async! */
- rets = RPC_paramNew ();
+ rets = GNUNET_RPC_parameters_create ();
code = rpcAPI->RPC_execute (coreAPI->myIdentity,
"testFunction", args, rets, 0,
5 * GNUNET_CRON_SECONDS);
- if (code != RPC_ERROR_OK)
+ if (code != GNUNET_RPC_ERROR_OK)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
ret = GNUNET_SYSERR;
}
- RPC_paramFree (args);
- if ((GNUNET_OK != RPC_paramValueByName (rets,
+ GNUNET_RPC_parameters_destroy (args);
+ if ((GNUNET_OK != GNUNET_RPC_parameters_get_value_by_name (rets,
"response",
&dl,
(void **) &reply)) ||
(strncmp ("Hello RPC World", reply, dl) != 0))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
ret = GNUNET_SYSERR;
}
- RPC_paramFree (rets);
+ GNUNET_RPC_parameters_destroy (rets);
GNUNET_thread_sleep (1 * GNUNET_CRON_SECONDS);
- if (RPC_ERROR_OK != rpcAPI->RPC_stop (record))
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ if (GNUNET_RPC_ERROR_OK != rpcAPI->RPC_stop (record))
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("async RPC reply not received.\n"));
if (GNUNET_OK != rpcAPI->RPC_unregister ("testFunction", &testCallback))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
ret = GNUNET_SYSERR;
}
if (GNUNET_OK != capi->releaseService (rpcAPI))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
ret = GNUNET_SYSERR;
}
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"RPC testcase completed with status %s\n",
ret == GNUNET_OK ? "SUCCESS" : "FAILURE");
return ret;
Modified: GNUnet/src/applications/session/connect.c
===================================================================
--- GNUnet/src/applications/session/connect.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/session/connect.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -41,19 +41,19 @@
#define EXTRA_CHECKS ALLOW_EXTRA_CHECKS
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
-static Identity_ServiceAPI *identity;
+static GNUNET_Identity_ServiceAPI *identity;
-static Transport_ServiceAPI *transport;
+static GNUNET_Transport_ServiceAPI *transport;
-static Pingpong_ServiceAPI *pingpong;
+static GNUNET_Pingpong_ServiceAPI *pingpong;
-static Topology_ServiceAPI *topology;
+static GNUNET_Topology_ServiceAPI *topology;
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
static int stat_skeySent;
@@ -159,16 +159,16 @@
GNUNET_EncName enc;
#endif
- GE_ASSERT (ectx, hostId != NULL);
+ GNUNET_GE_ASSERT (ectx, hostId != NULL);
#if DEBUG_SESSION
IF_GELOG (ectx,
- GE_DEBUG | GE_USER | GE_REQUEST,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
GNUNET_hash_to_enc (&hostId->hashPubKey, &enc));
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Received `%s' from `%s', marking session as up.\n", "PONG", &enc);
#endif
- GE_ASSERT (ectx, hostId != NULL);
+ GNUNET_GE_ASSERT (ectx, hostId != NULL);
if (stats != NULL)
stats->change (stat_sessionEstablished, 1);
coreAPI->confirmSessionUp (hostId);
@@ -197,13 +197,13 @@
if ((sks == NULL) || (hostId == NULL))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
/* check if we are allowed to accept connections
from that peer */
limited = NULL;
- GC_get_configuration_value_string (coreAPI->cfg,
+ GNUNET_GC_get_configuration_value_string (coreAPI->cfg,
"GNUNETD", "LIMIT-ALLOW", "", &limited);
if (strlen (limited) > 0)
{
@@ -211,8 +211,8 @@
if (NULL == strstr (limited, (char *) &enc))
{
#if DEBUG_SESSION
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Connection from peer `%s' was rejected (not allowed).\n",
&enc);
#endif
@@ -222,7 +222,7 @@
}
GNUNET_free (limited);
limited = NULL;
- GC_get_configuration_value_string (coreAPI->cfg,
+ GNUNET_GC_get_configuration_value_string (coreAPI->cfg,
"GNUNETD", "LIMIT-DENY", "", &limited);
if (strlen (limited) > 0)
{
@@ -230,8 +230,8 @@
if (NULL != strstr (limited, (char *) &enc))
{
#if DEBUG_SESSION
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Connection from peer `%s' was rejected (explicitly
denied).\n",
&enc);
#endif
@@ -248,12 +248,12 @@
{
GNUNET_EncName enc;
- GE_BREAK_OP (ectx, 0);
+ GNUNET_GE_BREAK_OP (ectx, 0);
IF_GELOG (ectx,
- GE_INFO | GE_USER | GE_REQUEST,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_REQUEST,
GNUNET_hash_to_enc (&hostId->hashPubKey, &enc));
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_REQUEST,
_("Session key from peer `%s' could not be verified.\n"), &enc);
return GNUNET_SYSERR;
}
@@ -268,10 +268,10 @@
GNUNET_EncName enc;
IF_GELOG (ectx,
- GE_INFO | GE_USER | GE_REQUEST,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_REQUEST,
GNUNET_hash_to_enc (&hostId->hashPubKey, &enc));
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_REQUEST,
_("Session key from peer `%s' could not be verified.\n"), &enc);
#endif
return GNUNET_SYSERR; /*reject! */
@@ -305,15 +305,15 @@
GNUNET_EncName enc;
GNUNET_PeerIdentity hc;
- GE_ASSERT (ectx, sk != NULL);
+ GNUNET_GE_ASSERT (ectx, sk != NULL);
foreignHello =
- identity->identity2Hello (hostId, ANY_PROTOCOL_NUMBER, GNUNET_YES);
+ identity->identity2Hello (hostId, GNUNET_TRANSPORT_PROTOCOL_NUMBER_ANY,
GNUNET_YES);
/* create and encrypt sessionkey */
if (NULL == foreignHello)
{
GNUNET_hash_to_enc (&hostId->hashPubKey, &enc);
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_REQUEST,
_("Cannot encrypt sessionkey, peer `%s' not known!\n"), &enc);
return NULL; /* other host not known */
}
@@ -325,13 +325,13 @@
&foreignHello->senderIdentity,
sizeof (GNUNET_PeerIdentity))))
{
- GE_BREAK_OP (NULL,
+ GNUNET_GE_BREAK_OP (NULL,
0 == memcmp (&hc,
&foreignHello->senderIdentity,
sizeof (GNUNET_PeerIdentity)));
- GE_BREAK_OP (NULL,
+ GNUNET_GE_BREAK_OP (NULL,
0 == memcmp (&hc, hostId, sizeof (GNUNET_PeerIdentity)));
- GE_BREAK_OP (NULL, 0);
+ GNUNET_GE_BREAK_OP (NULL, 0);
GNUNET_free (foreignHello);
return NULL;
}
@@ -349,7 +349,7 @@
&foreignHello->publicKey,
&msg->key))
{
- GE_BREAK_OP (ectx, 0);
+ GNUNET_GE_BREAK_OP (ectx, 0);
GNUNET_free (foreignHello);
GNUNET_free (msg);
return NULL; /* encrypt failed */
@@ -358,9 +358,9 @@
/* complete header */
msg->header.size = htons (size);
- msg->header.type = htons (P2P_PROTO_setkey);
+ msg->header.type = htons (GNUNET_P2P_PROTO_SET_KEY);
msg->creationTime = htonl (created);
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
identity->signData (msg,
sizeof (P2P_new_setkey_MESSAGE)
@@ -368,7 +368,7 @@
&msg->signature));
#if EXTRA_CHECKS
/* verify signature/SKS */
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR != verifySKS (coreAPI->myIdentity,
(const P2P_setkey_MESSAGE *) msg,
&msg->signature));
@@ -394,12 +394,12 @@
size += ntohs (pong->size);
}
#if DEBUG_SESSION
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Encrypting %d bytes of PINGPONG with key %s and IV %u\n",
size, printSKEY (sk), *(int *) &msg->signature);
#endif
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
-1 != GNUNET_AES_encrypt (pt,
size,
sk,
@@ -423,7 +423,7 @@
*/
static int
exchangeKey (const GNUNET_PeerIdentity * receiver,
- TSession * tsession, GNUNET_MessageHeader * pong)
+ GNUNET_TSession * tsession, GNUNET_MessageHeader * pong)
{
GNUNET_MessageHello *hello;
P2P_new_setkey_MESSAGE *skey;
@@ -433,11 +433,11 @@
GNUNET_PeerIdentity *sndr;
GNUNET_EncName enc;
- GE_ASSERT (ectx, receiver != NULL);
+ GNUNET_GE_ASSERT (ectx, receiver != NULL);
if ((tsession != NULL) &&
(0 != memcmp (&tsession->peer, receiver, sizeof (GNUNET_PeerIdentity))))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
tsession = NULL;
}
if ((topology != NULL) &&
@@ -451,8 +451,8 @@
if (tsession == NULL)
{
#if DEBUG_SESSION
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Key exchange with `%s' failed: could not connect.\n", &enc);
#endif
return GNUNET_SYSERR; /* failed to connect */
@@ -476,8 +476,8 @@
age = GNUNET_get_time_int32 (NULL);
GNUNET_AES_create_session_key (&sk);
#if DEBUG_SESSION
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Created fresh sessionkey `%s' for peer `%s'.\n",
printSKEY (&sk), &enc);
#endif
@@ -495,16 +495,16 @@
/* create hello */
hello = transport->createhello (tsession->ttype);
if (NULL == hello)
- hello = transport->createhello (ANY_PROTOCOL_NUMBER);
+ hello = transport->createhello (GNUNET_TRANSPORT_PROTOCOL_NUMBER_ANY);
if (NULL == hello)
{
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
_("Could not create any HELLO for myself!\n"));
}
#if DEBUG_SESSION
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Sending session key to peer `%s'.\n", &enc);
#endif
if (stats != NULL)
@@ -527,7 +527,7 @@
GNUNET_free (skey);
if (0 != memcmp (receiver, &tsession->peer, sizeof (GNUNET_PeerIdentity)))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
}
else
{
@@ -552,7 +552,7 @@
*/
static int
acceptSessionKey (const GNUNET_PeerIdentity * sender,
- const GNUNET_MessageHeader * msg, TSession * tsession)
+ const GNUNET_MessageHeader * msg, GNUNET_TSession * tsession)
{
GNUNET_AES_SessionKey key;
GNUNET_MessageHeader *ping;
@@ -569,7 +569,7 @@
if (sender == NULL)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
GNUNET_hash_to_enc (&sender->hashPubKey, &enc);
@@ -577,8 +577,8 @@
(topology->allowConnectionFrom (sender) == GNUNET_SYSERR))
{
#if DEBUG_SESSION
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Topology rejected session key from peer `%s'.\n", &enc);
#endif
return GNUNET_SYSERR;
@@ -587,19 +587,19 @@
&coreAPI->myIdentity->hashPubKey,
sizeof (GNUNET_HashCode)))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
#if DEBUG_SESSION
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Received session key from peer `%s'.\n", &enc);
#endif
if (ntohs (msg->size) < sizeof (P2P_setkey_MESSAGE))
{
- GE_LOG (ectx,
- GE_WARNING | GE_DEVELOPER | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_DEVELOPER | GNUNET_GE_USER |
GNUNET_GE_BULK,
_
("Session key received from peer `%s' has invalid format
(discarded).\n"),
&enc);
@@ -631,8 +631,8 @@
{
GNUNET_EncName ta;
GNUNET_hash_to_enc (&newMsg->target.hashPubKey, &ta);
- GE_LOG (ectx,
- GE_WARNING | GE_DEVELOPER | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_DEVELOPER | GNUNET_GE_USER |
GNUNET_GE_BULK,
_
("Session key received from peer `%s' is for `%s' and not
for me!\n"),
&enc, &ta);
@@ -650,8 +650,8 @@
{
#if DEBUG_SESSION
if (ret == GNUNET_SYSERR)
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_REQUEST |
GNUNET_GE_DEVELOPER,
"Signature of session key from `%s' failed"
" verification (discarded).\n", &enc);
#endif
@@ -664,8 +664,8 @@
&key, sizeof (GNUNET_AES_SessionKey));
if (size != sizeof (GNUNET_AES_SessionKey))
{
- GE_LOG (ectx,
- GE_WARNING | GE_DEVELOPER | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_DEVELOPER | GNUNET_GE_USER |
GNUNET_GE_BULK,
_("Invalid `%s' message received from peer `%s'.\n"),
"setkey", &enc);
return GNUNET_SYSERR;
@@ -673,21 +673,21 @@
if (key.crc32 != htonl (GNUNET_crc32_n (&key, GNUNET_SESSIONKEY_LEN)))
{
#if DEBUG_SESSION
- GE_LOG (ectx,
- GE_WARNING | GE_DEVELOPER | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_DEVELOPER | GNUNET_GE_USER |
GNUNET_GE_BULK,
_
("setkey `%s' from `%s' fails CRC check (have: %u, want %u).\n"),
printSKEY (&key), &enc, ntohl (key.crc32), GNUNET_crc32_n (&key,
GNUNET_SESSIONKEY_LEN));
#endif
- GE_BREAK_OP (ectx, 0);
+ GNUNET_GE_BREAK_OP (ectx, 0);
stats->change (stat_skeyRejected, 1);
return GNUNET_SYSERR;
}
#if DEBUG_SESSION
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Received setkey message from `%s' with %u bytes of data and key
`%s'.\n",
&enc, ntohs (sessionkeySigned->header.size), printSKEY (&key));
#endif
@@ -719,12 +719,12 @@
}
plaintext = GNUNET_malloc (size);
#if DEBUG_SESSION
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Decrypting %d bytes of PINGPONG from `%s' with key `%s' and IV
%u\n",
size, &enc, printSKEY (&key), *(int *) sig);
#endif
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
-1 != GNUNET_AES_decrypt (&key,
end,
size,
@@ -740,19 +740,19 @@
hdr = (GNUNET_MessageHeader *) & plaintext[pos];
if (htons (hdr->size) + pos > size)
{
- GE_LOG (ectx,
- GE_WARNING | GE_DEVELOPER | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_DEVELOPER | GNUNET_GE_USER
| GNUNET_GE_BULK,
_("Error parsing encrypted session key from `%s', "
"given message part size is invalid.\n"), &enc);
break;
}
- if (htons (hdr->type) == p2p_PROTO_PING)
+ if (htons (hdr->type) == GNUNET_P2P_PROTO_PING)
ping = hdr;
- else if (htons (hdr->type) == p2p_PROTO_PONG)
+ else if (htons (hdr->type) == GNUNET_P2P_PROTO_PONG)
pong = hdr;
else
- GE_LOG (ectx,
- GE_WARNING | GE_DEVELOPER | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_DEVELOPER | GNUNET_GE_USER |
GNUNET_GE_BULK,
_
("Unknown type in embedded message from `%s': %u (size:
%u)\n"),
&enc, htons (hdr->type), htons (hdr->size));
@@ -764,8 +764,8 @@
/* we initiated, this is the response */
/* notify ourselves about encapsulated pong */
#if DEBUG_SESSION
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Received PONG in session key from `%s', injecting!\n", &enc);
#endif
coreAPI->injectMessage (sender,
@@ -775,15 +775,15 @@
{ /* should always be true for well-behaved
peers */
/* pong can go out over ordinary channels */
#if DEBUG_SESSION
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Received PING in session key from `%s', "
"sending PONG over normal encrypted session!\n", &enc);
#endif
- ping->type = htons (p2p_PROTO_PONG);
+ ping->type = htons (GNUNET_P2P_PROTO_PONG);
if (stats != NULL)
stats->change (stat_pongSent, 1);
- coreAPI->unicast (sender, ping, EXTREME_PRIORITY, 0);
+ coreAPI->unicast (sender, ping, GNUNET_EXTREME_PRIORITY, 0);
}
}
else
@@ -791,19 +791,19 @@
if (ping != NULL)
{
#if DEBUG_SESSION
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Received ping in session key from `%s', "
"sending pong together with my session key!\n", &enc);
#endif
- ping->type = htons (p2p_PROTO_PONG);
+ ping->type = htons (GNUNET_P2P_PROTO_PONG);
if (stats != NULL)
stats->change (stat_pongSent, 1);
exchangeKey (sender, tsession, ping); /* ping is now pong */
}
else
{
- GE_BREAK_OP (ectx, 0);
+ GNUNET_GE_BREAK_OP (ectx, 0);
/* PING not included in SKEY - bug (in other peer!?) */
}
}
@@ -825,15 +825,15 @@
GNUNET_EncName enc;
IF_GELOG (ectx,
- GE_DEBUG | GE_USER | GE_REQUEST,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
GNUNET_hash_to_enc (&peer->hashPubKey, &enc));
#endif
if ((topology != NULL)
&& (topology->allowConnectionFrom (peer) == GNUNET_SYSERR))
{
#if DEBUG_SESSION
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Topology rejected connecting to `%s'.\n", &enc);
#endif
return GNUNET_SYSERR;
@@ -841,15 +841,15 @@
if (coreAPI->queryPeerStatus (peer, NULL, NULL) == GNUNET_OK)
{
#if DEBUG_SESSION
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Connection to `%s' already up\n", &enc);
#endif
return GNUNET_YES; /* trivial case */
}
#if DEBUG_SESSION
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Trying to exchange key with `%s'.\n", &enc);
#endif
if (GNUNET_YES == identity->isBlacklisted (peer, GNUNET_NO))
@@ -876,24 +876,24 @@
/**
* Initialize the module.
*/
-Session_ServiceAPI *
-provide_module_session (CoreAPIForApplication * capi)
+GNUNET_Session_ServiceAPI *
+provide_module_session (GNUNET_CoreAPIForPlugins * capi)
{
- static Session_ServiceAPI ret;
+ static GNUNET_Session_ServiceAPI ret;
ectx = capi->ectx;
- GE_ASSERT (ectx, sizeof (P2P_setkey_MESSAGE) == 520);
+ GNUNET_GE_ASSERT (ectx, sizeof (P2P_setkey_MESSAGE) == 520);
coreAPI = capi;
identity = capi->requestService ("identity");
if (identity == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return NULL;
}
transport = capi->requestService ("transport");
if (transport == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
coreAPI->releaseService (identity);
identity = NULL;
return NULL;
@@ -901,7 +901,7 @@
pingpong = capi->requestService ("pingpong");
if (pingpong == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
coreAPI->releaseService (transport);
transport = NULL;
coreAPI->releaseService (identity);
@@ -925,12 +925,12 @@
= stats->create (gettext_noop ("# encrypted PONG messages sent"));
}
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_REQUEST,
_("`%s' registering handler %d (plaintext and ciphertext)\n"),
- "session", P2P_PROTO_setkey);
- coreAPI->registerPlaintextHandler (P2P_PROTO_setkey, &acceptSessionKey);
- coreAPI->registerHandler (P2P_PROTO_setkey, &acceptSessionKeyUpdate);
+ "session", GNUNET_P2P_PROTO_SET_KEY);
+ coreAPI->registerPlaintextHandler (GNUNET_P2P_PROTO_SET_KEY,
&acceptSessionKey);
+ coreAPI->registerHandler (GNUNET_P2P_PROTO_SET_KEY, &acceptSessionKeyUpdate);
ret.tryConnect = &tryConnect;
return &ret;
}
@@ -941,8 +941,8 @@
int
release_module_session ()
{
- coreAPI->unregisterPlaintextHandler (P2P_PROTO_setkey, &acceptSessionKey);
- coreAPI->unregisterHandler (P2P_PROTO_setkey, &acceptSessionKeyUpdate);
+ coreAPI->unregisterPlaintextHandler (GNUNET_P2P_PROTO_SET_KEY,
&acceptSessionKey);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_SET_KEY,
&acceptSessionKeyUpdate);
if (topology != NULL)
{
coreAPI->releaseService (topology);
Modified: GNUnet/src/applications/session/sessiontest.c
===================================================================
--- GNUnet/src/applications/session/sessiontest.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/session/sessiontest.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -64,12 +64,12 @@
struct GNUNET_ClientServerConnection *sock1;
struct GNUNET_ClientServerConnection *sock2;
int left;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#if START_PEERS
@@ -79,7 +79,7 @@
10000, 2);
if (peers == NULL)
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#endif
@@ -88,14 +88,14 @@
GNUNET_wait_for_daemon_running (NULL, cfg, 30 * GNUNET_CRON_SECONDS))
{
sock1 = GNUNET_client_connection_create (NULL, cfg);
- GC_set_configuration_value_string (cfg,
+ GNUNET_GC_set_configuration_value_string (cfg,
NULL,
"NETWORK",
"HOST", "localhost:12087");
sock2 = GNUNET_client_connection_create (NULL, cfg);
left = 30; /* how many iterations should we wait? */
while (GNUNET_OK ==
- STATS_getStatistics (NULL, sock1, &waitForConnect, NULL))
+ GNUNET_STATS_get_statistics (NULL, sock1, &waitForConnect, NULL))
{
printf ("Waiting for peers to connect (%u iterations left)...\n",
left);
@@ -116,7 +116,7 @@
while (GNUNET_shutdown_test () == GNUNET_NO)
{
printf ("Checking that peers are staying connected 1...\n");
- STATS_getStatistics (NULL, sock1, &waitForConnect, NULL);
+ GNUNET_STATS_get_statistics (NULL, sock1, &waitForConnect,
NULL);
sleep (1);
if (ok == 0)
{
@@ -124,7 +124,7 @@
break;
}
printf ("Checking that peers are staying connected 2...\n");
- STATS_getStatistics (NULL, sock2, &waitForConnect, NULL);
+ GNUNET_STATS_get_statistics (NULL, sock2, &waitForConnect,
NULL);
sleep (1);
if (ok == 0)
{
@@ -151,7 +151,7 @@
#if START_PEERS
GNUNET_TESTING_stop_daemons (peers);
#endif
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return (ok == 0) ? 1 : 0;
}
Modified: GNUnet/src/applications/session/sessiontest2.c
===================================================================
--- GNUnet/src/applications/session/sessiontest2.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/session/sessiontest2.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -59,8 +59,8 @@
connect_daemons (unsigned short port1, unsigned short port2)
{
char host[128];
- GC_Configuration *cfg1 = GC_create ();
- GC_Configuration *cfg2 = GC_create ();
+ GNUNET_GC_Configuration *cfg1 = GNUNET_GC_create ();
+ GNUNET_GC_Configuration *cfg2 = GNUNET_GC_create ();
struct GNUNET_ClientServerConnection *sock1;
struct GNUNET_ClientServerConnection *sock2;
int ret;
@@ -68,9 +68,9 @@
ret = GNUNET_SYSERR;
GNUNET_snprintf (host, 128, "localhost:%u", port1);
- GC_set_configuration_value_string (cfg1, NULL, "NETWORK", "HOST", host);
+ GNUNET_GC_set_configuration_value_string (cfg1, NULL, "NETWORK", "HOST",
host);
GNUNET_snprintf (host, 128, "localhost:%u", port2);
- GC_set_configuration_value_string (cfg2, NULL, "NETWORK", "HOST", host);
+ GNUNET_GC_set_configuration_value_string (cfg2, NULL, "NETWORK", "HOST",
host);
if ((GNUNET_OK == GNUNET_wait_for_daemon_running (NULL,
cfg1,
300 *
@@ -100,8 +100,8 @@
{
fprintf (stderr, "Failed to establish connection with peers.\n");
}
- GC_free (cfg1);
- GC_free (cfg2);
+ GNUNET_GC_free (cfg1);
+ GNUNET_GC_free (cfg2);
return ret;
}
@@ -123,26 +123,26 @@
int ret;
struct GNUNET_ClientServerConnection *sock;
int left;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#if START_PEERS
peer1 = GNUNET_daemon_start (NULL, cfg, "tcp-peer.conf", GNUNET_NO);
if (peer1 == -1)
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
peer2 = GNUNET_daemon_start (NULL, cfg, "nat-peer.conf", GNUNET_NO);
if (peer2 == -1)
{
GNUNET_daemon_stop (NULL, peer1);
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#endif
@@ -153,7 +153,7 @@
sock = GNUNET_client_connection_create (NULL, cfg);
left = 30; /* how many iterations should we wait? */
while (GNUNET_OK ==
- STATS_getStatistics (NULL, sock, &waitForConnect, NULL))
+ GNUNET_STATS_get_statistics (NULL, sock, &waitForConnect, NULL))
{
printf ("Waiting for peers to connect (%u iterations left)...\n",
left);
@@ -176,7 +176,7 @@
GNUNET_daemon_stop (NULL, peer1);
GNUNET_daemon_stop (NULL, peer2);
#endif
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return (ok == 0) ? 1 : 0;
}
Modified: GNUnet/src/applications/session/sessiontest_http.c
===================================================================
--- GNUnet/src/applications/session/sessiontest_http.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/session/sessiontest_http.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -59,8 +59,8 @@
connect_daemons (unsigned short port1, unsigned short port2)
{
char host[128];
- GC_Configuration *cfg1 = GC_create ();
- GC_Configuration *cfg2 = GC_create ();
+ GNUNET_GC_Configuration *cfg1 = GNUNET_GC_create ();
+ GNUNET_GC_Configuration *cfg2 = GNUNET_GC_create ();
struct GNUNET_ClientServerConnection *sock1;
struct GNUNET_ClientServerConnection *sock2;
int ret;
@@ -68,9 +68,9 @@
ret = GNUNET_SYSERR;
GNUNET_snprintf (host, 128, "localhost:%u", port1);
- GC_set_configuration_value_string (cfg1, NULL, "NETWORK", "HOST", host);
+ GNUNET_GC_set_configuration_value_string (cfg1, NULL, "NETWORK", "HOST",
host);
GNUNET_snprintf (host, 128, "localhost:%u", port2);
- GC_set_configuration_value_string (cfg2, NULL, "NETWORK", "HOST", host);
+ GNUNET_GC_set_configuration_value_string (cfg2, NULL, "NETWORK", "HOST",
host);
if ((GNUNET_OK == GNUNET_wait_for_daemon_running (NULL,
cfg1,
300 *
@@ -100,8 +100,8 @@
{
fprintf (stderr, "Failed to establish connection with peers.\n");
}
- GC_free (cfg1);
- GC_free (cfg2);
+ GNUNET_GC_free (cfg1);
+ GNUNET_GC_free (cfg2);
return ret;
}
@@ -123,26 +123,26 @@
int ret;
struct GNUNET_ClientServerConnection *sock;
int left;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#if START_PEERS
peer1 = GNUNET_daemon_start (NULL, cfg, "http-peer.conf", GNUNET_NO);
if (peer1 == -1)
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
peer2 = GNUNET_daemon_start (NULL, cfg, "nat-http-peer.conf", GNUNET_NO);
if (peer2 == -1)
{
GNUNET_daemon_stop (NULL, peer1);
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#endif
@@ -153,7 +153,7 @@
sock = GNUNET_client_connection_create (NULL, cfg);
left = 30; /* how many iterations should we wait? */
while (GNUNET_OK ==
- STATS_getStatistics (NULL, sock, &waitForConnect, NULL))
+ GNUNET_STATS_get_statistics (NULL, sock, &waitForConnect, NULL))
{
printf ("Waiting for peers to connect (%u iterations left)...\n",
left);
@@ -176,7 +176,7 @@
GNUNET_daemon_stop (NULL, peer1);
GNUNET_daemon_stop (NULL, peer2);
#endif
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return (ok == 0) ? 1 : 0;
}
Modified: GNUnet/src/applications/sqstore_mysql/mysql.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysql.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/sqstore_mysql/mysql.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -142,18 +142,18 @@
* a failure of the command 'cmd' with the message given
* by strerror(errno).
*/
-#define DIE_MYSQL(cmd, dbh) do { GE_LOG(ectx, GE_FATAL | GE_ADMIN |
GE_IMMEDIATE, _("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__,
__LINE__, mysql_error((dbh)->dbf)); abort(); } while(0);
+#define DIE_MYSQL(cmd, dbh) do { GNUNET_GE_LOG(ectx, GNUNET_GE_FATAL |
GNUNET_GE_ADMIN | GNUNET_GE_IMMEDIATE, _("`%s' failed at %s:%d with error:
%s\n"), cmd, __FILE__, __LINE__, mysql_error((dbh)->dbf)); abort(); } while(0);
/**
* Log an error message at log-level 'level' that indicates
* a failure of the command 'cmd' on file 'filename'
* with the message given by strerror(errno).
*/
-#define LOG_MYSQL(level, cmd, dbh) do { GE_LOG(ectx, level, _("`%s' failed at
%s:%d with error: %s\n"), cmd, __FILE__, __LINE__, mysql_error((dbh)->dbf)); }
while(0);
+#define LOG_MYSQL(level, cmd, dbh) do { GNUNET_GE_LOG(ectx, level, _("`%s'
failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__,
mysql_error((dbh)->dbf)); } while(0);
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
static unsigned int stat_size;
@@ -167,7 +167,7 @@
*/
static struct GNUNET_Mutex *lock;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
/**
* @brief mysql wrapper
@@ -332,14 +332,14 @@
mysql_options (dbh->dbf, MYSQL_OPT_WRITE_TIMEOUT, (const void *) &timeout);
dbname = NULL;
- GC_get_configuration_value_string (coreAPI->cfg,
+ GNUNET_GC_get_configuration_value_string (coreAPI->cfg,
"MYSQL", "DATABASE", "gnunet", &dbname);
- GE_ASSERT (ectx, dbname != NULL);
+ GNUNET_GE_ASSERT (ectx, dbname != NULL);
mysql_real_connect (dbh->dbf, NULL, NULL, NULL, dbname, 0, NULL, 0);
GNUNET_free (dbname);
if (mysql_error (dbh->dbf)[0])
{
- LOG_MYSQL (GE_ERROR | GE_ADMIN | GE_BULK, "mysql_real_connect", dbh);
+ LOG_MYSQL (GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"mysql_real_connect", dbh);
iclose ();
return GNUNET_SYSERR;
}
@@ -347,7 +347,7 @@
"SET SESSION net_read_timeout=60, SESSION
net_write_timeout=60");
if (mysql_error (dbh->dbf)[0])
{
- LOG_MYSQL (GE_ERROR | GE_ADMIN | GE_BULK, "mysql_query", dbh);
+ LOG_MYSQL (GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"mysql_query", dbh);
iclose ();
return GNUNET_SYSERR;
}
@@ -394,7 +394,7 @@
}
if (mysql_error (dbh->dbf)[0])
{
- LOG_MYSQL (GE_ERROR | GE_ADMIN | GE_BULK, "mysql_query", dbh);
+ LOG_MYSQL (GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"mysql_query", dbh);
iclose ();
return GNUNET_SYSERR;
}
@@ -404,20 +404,20 @@
" value BLOB NOT NULL DEFAULT '') ENGINE=MyISAM");
if (mysql_error (dbh->dbf)[0])
{
- LOG_MYSQL (GE_ERROR | GE_ADMIN | GE_BULK, "mysql_query", dbh);
+ LOG_MYSQL (GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"mysql_query", dbh);
iclose ();
return GNUNET_SYSERR;
}
mysql_query (dbh->dbf, "SET AUTOCOMMIT = 1");
if (mysql_error (dbh->dbf)[0])
{
- LOG_MYSQL (GE_ERROR | GE_ADMIN | GE_BULK, "mysql_query", dbh);
+ LOG_MYSQL (GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"mysql_query", dbh);
iclose ();
return GNUNET_SYSERR;
}
#define PINIT(a,b) a = mysql_stmt_init(dbh->dbf); if (a == NULL) { iclose();
return GNUNET_SYSERR; } else { \
if (mysql_stmt_prepare (a, b, strlen(b))) { \
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER, \
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER, \
_("`%s' failed at %s:%d with error: %s"), "mysql_stmt_prepare",
__FILE__, __LINE__, \
mysql_stmt_error (a)); iclose(); return GNUNET_SYSERR; } }
PINIT (dbh->select_value, SELECT_VALUE);
@@ -462,11 +462,11 @@
qbind[0].is_unsigned = GNUNET_YES;
qbind[0].buffer_type = MYSQL_TYPE_LONGLONG;
qbind[0].buffer = &vkey;
- GE_ASSERT (ectx, mysql_stmt_param_count (dbh->delete_value) == 1);
+ GNUNET_GE_ASSERT (ectx, mysql_stmt_param_count (dbh->delete_value) == 1);
if (mysql_stmt_bind_param (dbh->delete_value, qbind))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' failed at %s:%d with error: %s\n"),
"mysql_stmt_bind_param",
__FILE__, __LINE__, mysql_stmt_error (dbh->delete_value));
@@ -475,8 +475,8 @@
}
if (mysql_stmt_execute (dbh->delete_value))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' failed at %s:%d with error: %s\n"),
"mysql_stmt_execute",
__FILE__, __LINE__, mysql_stmt_error (dbh->delete_value));
@@ -510,11 +510,11 @@
qbind[0].buffer = (void *) value;
qbind[0].buffer_length = size;
qbind[0].length = &length;
- GE_ASSERT (ectx, mysql_stmt_param_count (dbh->insert_value) == 1);
+ GNUNET_GE_ASSERT (ectx, mysql_stmt_param_count (dbh->insert_value) == 1);
if (mysql_stmt_bind_param (dbh->insert_value, qbind))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' failed at %s:%d with error: %s\n"),
"mysql_stmt_bind_param",
__FILE__, __LINE__, mysql_stmt_error (dbh->insert_value));
@@ -523,8 +523,8 @@
}
if (mysql_stmt_execute (dbh->insert_value))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' failed at %s:%d with error: %s\n"),
"mysql_stmt_execute",
__FILE__, __LINE__, mysql_stmt_error (dbh->insert_value));
@@ -552,11 +552,11 @@
qbind[0].is_unsigned = GNUNET_YES;
qbind[0].buffer_type = MYSQL_TYPE_LONGLONG;
qbind[0].buffer = &vkey;
- GE_ASSERT (ectx, mysql_stmt_param_count (dbh->delete_entry_by_vkey) == 1);
+ GNUNET_GE_ASSERT (ectx, mysql_stmt_param_count (dbh->delete_entry_by_vkey)
== 1);
if (mysql_stmt_bind_param (dbh->delete_entry_by_vkey, qbind))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' failed at %s:%d with error: %s\n"),
"mysql_stmt_bind_param",
__FILE__, __LINE__,
@@ -566,8 +566,8 @@
}
if (mysql_stmt_execute (dbh->delete_entry_by_vkey))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' failed at %s:%d with error: %s\n"),
"mysql_stmt_execute",
__FILE__, __LINE__,
@@ -585,7 +585,7 @@
/**
* Given a full (SELECT *) result set from gn071 table,
- * assemble it into a Datastore_Value representation.
+ * assemble it into a GNUNET_DatastoreValue representation.
*
* Call *without* holding the lock, but while within
* mysql_thread_start/end.
@@ -593,10 +593,10 @@
* @param result location where mysql_stmt_fetch stored the results
* @return NULL on error
*/
-static Datastore_Value *
+static GNUNET_DatastoreValue *
assembleDatum (MYSQL_BIND * result)
{
- Datastore_Value *datum;
+ GNUNET_DatastoreValue *datum;
unsigned int contentSize;
unsigned int type;
unsigned int prio;
@@ -623,21 +623,21 @@
(result[6].buffer_type != MYSQL_TYPE_LONGLONG) ||
(!result[6].is_unsigned))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return NULL; /* error */
}
contentSize = *(unsigned int *) result[0].buffer;
- if (contentSize < sizeof (Datastore_Value))
+ if (contentSize < sizeof (GNUNET_DatastoreValue))
return NULL; /* error */
- contentSize -= sizeof (Datastore_Value);
+ contentSize -= sizeof (GNUNET_DatastoreValue);
type = *(unsigned int *) result[1].buffer;
prio = *(unsigned int *) result[2].buffer;
level = *(unsigned int *) result[3].buffer;
exp = *(unsigned long long *) result[4].buffer;
vkey = *(unsigned long long *) result[6].buffer;
- datum = GNUNET_malloc (sizeof (Datastore_Value) + contentSize);
- datum->size = htonl (contentSize + sizeof (Datastore_Value));
+ datum = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + contentSize);
+ datum->size = htonl (contentSize + sizeof (GNUNET_DatastoreValue));
datum->type = htonl (type);
datum->prio = htonl (prio);
datum->anonymityLevel = htonl (level);
@@ -661,11 +661,11 @@
GNUNET_free (datum);
return NULL;
}
- GE_ASSERT (ectx, mysql_stmt_param_count (dbh->select_value) == 1);
+ GNUNET_GE_ASSERT (ectx, mysql_stmt_param_count (dbh->select_value) == 1);
if (mysql_stmt_bind_param (dbh->select_value, qbind))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' failed at %s:%d with error: %s\n"),
"mysql_stmt_bind_param",
__FILE__, __LINE__, mysql_stmt_error (dbh->select_value));
@@ -676,8 +676,8 @@
}
if (mysql_stmt_execute (dbh->select_value))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' failed at %s:%d with error: %s\n"),
"mysql_stmt_execute",
__FILE__, __LINE__, mysql_stmt_error (dbh->select_value));
@@ -685,11 +685,11 @@
GNUNET_free (datum);
return NULL;
}
- GE_ASSERT (ectx, mysql_stmt_field_count (dbh->select_value) == 1);
+ GNUNET_GE_ASSERT (ectx, mysql_stmt_field_count (dbh->select_value) == 1);
if (mysql_stmt_bind_result (dbh->select_value, rbind))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' failed at %s:%d with error: %s\n"),
"mysql_stmt_bind_result",
__FILE__, __LINE__, mysql_stmt_error (dbh->select_value));
@@ -702,8 +702,8 @@
(rbind[0].buffer_length != contentSize) || (length != contentSize))
{
mysql_stmt_reset (dbh->select_value);
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' failed at %s:%d with error: %s\n"),
"mysql_stmt_bind_result",
__FILE__, __LINE__, mysql_stmt_error (dbh->select_value));
@@ -724,7 +724,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
static int
-put (const GNUNET_HashCode * key, const Datastore_Value * value)
+put (const GNUNET_HashCode * key, const GNUNET_DatastoreValue * value)
{
unsigned long contentSize;
unsigned long hashSize;
@@ -739,10 +739,10 @@
GNUNET_EncName enc;
#endif
- if (((ntohl (value->size) < sizeof (Datastore_Value))) ||
- ((ntohl (value->size) - sizeof (Datastore_Value)) > MAX_DATUM_SIZE))
+ if (((ntohl (value->size) < sizeof (GNUNET_DatastoreValue))) ||
+ ((ntohl (value->size) - sizeof (GNUNET_DatastoreValue)) >
MAX_DATUM_SIZE))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
GNUNET_mutex_lock (lock);
@@ -753,7 +753,7 @@
GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
- contentSize = ntohl (value->size) - sizeof (Datastore_Value);
+ contentSize = ntohl (value->size) - sizeof (GNUNET_DatastoreValue);
if (GNUNET_OK != insert_value (&value[1], contentSize, &vkey))
{
mysql_thread_end ();
@@ -767,12 +767,12 @@
level = ntohl (value->anonymityLevel);
expiration = GNUNET_ntohll (value->expirationTime);
#if DEBUG_MYSQL
- IF_GELOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (key, &enc));
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Storing in database block with type %u and key %s.\n", type, &enc);
#endif
- GE_ASSERT (ectx, mysql_stmt_param_count (dbh->insert_entry) == 7);
+ GNUNET_GE_ASSERT (ectx, mysql_stmt_param_count (dbh->insert_entry) == 7);
memset (qbind, 0, sizeof (qbind));
qbind[0].buffer_type = MYSQL_TYPE_LONG; /* size */
qbind[0].buffer = &size;
@@ -799,8 +799,8 @@
if (mysql_stmt_bind_param (dbh->insert_entry, qbind))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' failed at %s:%d with error: %s\n"),
"mysql_stmt_bind_param",
__FILE__, __LINE__, mysql_stmt_error (dbh->insert_entry));
@@ -813,8 +813,8 @@
if (mysql_stmt_execute (dbh->insert_entry))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' failed at %s:%d with error: %s\n"),
"mysql_stmt_execute",
__FILE__, __LINE__, mysql_stmt_error (dbh->insert_entry));
@@ -852,9 +852,9 @@
int is_asc,
int is_prio,
int is_migr,
- unsigned int iter_select, Datum_Iterator iter, void *closure)
+ unsigned int iter_select, GNUNET_DatastoreValueIterator iter,
void *closure)
{
- Datastore_Value *datum;
+ GNUNET_DatastoreValue *datum;
int count;
int ret;
unsigned int last_prio;
@@ -873,7 +873,7 @@
MYSQL_BIND rbind[7];
MYSQL_STMT *stmt;
- GE_ASSERT (NULL, ((is_migr == 1) || (is_migr == 0)));
+ GNUNET_GE_ASSERT (NULL, ((is_migr == 1) || (is_migr == 0)));
if (is_asc)
{
last_prio = 0;
@@ -958,13 +958,13 @@
return GNUNET_SYSERR;
}
stmt = dbh->iter[iter_select];
- GE_ASSERT (ectx, mysql_stmt_param_count (stmt) <= 6);
- GE_ASSERT (ectx, mysql_stmt_field_count (stmt) == 7);
+ GNUNET_GE_ASSERT (ectx, mysql_stmt_param_count (stmt) <= 6);
+ GNUNET_GE_ASSERT (ectx, mysql_stmt_field_count (stmt) == 7);
now = GNUNET_get_time ();
if (mysql_stmt_bind_param (stmt, qbind))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' failed at %s:%d with error: %s\n"),
"mysql_stmt_bind_param",
__FILE__, __LINE__, mysql_stmt_error (stmt));
@@ -975,8 +975,8 @@
}
if (mysql_stmt_execute (stmt))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' failed at %s:%d with error: %s\n"),
"mysql_stmt_execute",
__FILE__, __LINE__, mysql_stmt_error (stmt));
@@ -987,8 +987,8 @@
}
if (mysql_stmt_bind_result (stmt, rbind))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' failed at %s:%d with error: %s\n"),
"mysql_stmt_bind_result",
__FILE__, __LINE__, mysql_stmt_error (stmt));
@@ -1047,7 +1047,7 @@
* iter is non-NULL and aborted the iteration
*/
static int
-iterateLowPriority (unsigned int type, Datum_Iterator iter, void *closure)
+iterateLowPriority (unsigned int type, GNUNET_DatastoreValueIterator iter,
void *closure)
{
return iterateHelper (type, GNUNET_YES, GNUNET_YES, GNUNET_NO, 0, iter,
closure);
@@ -1064,7 +1064,7 @@
* iter is non-NULL and aborted the iteration
*/
static int
-iterateNonAnonymous (unsigned int type, Datum_Iterator iter, void *closure)
+iterateNonAnonymous (unsigned int type, GNUNET_DatastoreValueIterator iter,
void *closure)
{
return iterateHelper (type, GNUNET_NO, GNUNET_YES, GNUNET_NO, 1, iter,
closure);
@@ -1081,7 +1081,7 @@
* iter is non-NULL and aborted the iteration
*/
static int
-iterateExpirationTime (unsigned int type, Datum_Iterator iter, void *closure)
+iterateExpirationTime (unsigned int type, GNUNET_DatastoreValueIterator iter,
void *closure)
{
return iterateHelper (type, GNUNET_YES, GNUNET_NO, GNUNET_NO, 2, iter,
closure);
@@ -1096,7 +1096,7 @@
* iter is non-NULL and aborted the iteration
*/
static int
-iterateMigrationOrder (Datum_Iterator iter, void *closure)
+iterateMigrationOrder (GNUNET_DatastoreValueIterator iter, void *closure)
{
return iterateHelper (0, GNUNET_NO, GNUNET_NO, GNUNET_YES, 3, iter,
closure);
@@ -1111,7 +1111,7 @@
* iter is non-NULL and aborted the iteration
*/
static int
-iterateAllNow (Datum_Iterator iter, void *closure)
+iterateAllNow (GNUNET_DatastoreValueIterator iter, void *closure)
{
return iterateHelper (0, GNUNET_YES, GNUNET_YES, GNUNET_NO, 0, iter,
closure);
@@ -1130,7 +1130,7 @@
*/
static int
get (const GNUNET_HashCode * query,
- unsigned int type, Datum_Iterator iter, void *closure)
+ unsigned int type, GNUNET_DatastoreValueIterator iter, void *closure)
{
int count;
int ret;
@@ -1142,7 +1142,7 @@
unsigned long long expiration;
unsigned long long vkey;
unsigned long long last_vkey;
- Datastore_Value *datum;
+ GNUNET_DatastoreValue *datum;
GNUNET_HashCode key;
unsigned long hashSize;
MYSQL_BIND qbind[3];
@@ -1155,9 +1155,9 @@
return iterateLowPriority (type, iter, closure);
#if DEBUG_MYSQL
- IF_GELOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (query, &enc));
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"MySQL looks for `%s' of type %u\n", &enc, type);
#endif
@@ -1225,15 +1225,15 @@
stmt = dbh->select_entry_by_hash;
}
- GE_ASSERT (ectx, mysql_stmt_param_count (stmt) <= 3);
+ GNUNET_GE_ASSERT (ectx, mysql_stmt_param_count (stmt) <= 3);
if (iter == NULL)
- GE_ASSERT (ectx, mysql_stmt_field_count (stmt) == 1);
+ GNUNET_GE_ASSERT (ectx, mysql_stmt_field_count (stmt) == 1);
else
- GE_ASSERT (ectx, mysql_stmt_field_count (stmt) == 7);
+ GNUNET_GE_ASSERT (ectx, mysql_stmt_field_count (stmt) == 7);
if (mysql_stmt_bind_param (stmt, qbind))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' failed at %s:%d with error: %s\n"),
"mysql_stmt_bind_param",
__FILE__, __LINE__, mysql_stmt_error (stmt));
@@ -1244,8 +1244,8 @@
}
if (mysql_stmt_execute (stmt))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' failed at %s:%d with error: %s\n"),
"mysql_stmt_execute",
__FILE__, __LINE__, mysql_stmt_error (stmt));
@@ -1256,8 +1256,8 @@
}
if (mysql_stmt_bind_result (stmt, rbind))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' failed at %s:%d with error: %s\n"),
"mysql_stmt_bind_result",
__FILE__, __LINE__, mysql_stmt_error (stmt));
@@ -1338,11 +1338,11 @@
qbind[3].buffer_type = MYSQL_TYPE_LONGLONG;
qbind[3].is_unsigned = GNUNET_YES;
qbind[3].buffer = &vkey;
- GE_ASSERT (ectx, mysql_stmt_param_count (dbh->update_entry) == 4);
+ GNUNET_GE_ASSERT (ectx, mysql_stmt_param_count (dbh->update_entry) == 4);
if (mysql_stmt_bind_param (dbh->update_entry, qbind))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' failed at %s:%d with error: %s\n"),
"mysql_stmt_bind_param",
__FILE__, __LINE__, mysql_stmt_error (dbh->update_entry));
@@ -1359,8 +1359,8 @@
start = GNUNET_get_time ();
if (mysql_stmt_execute (dbh->update_entry))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("`%s' failed at %s:%d with error `%s' after %llums\n"),
"mysql_stmt_execute",
__FILE__, __LINE__,
@@ -1418,13 +1418,13 @@
mysql_query (dbh->dbf, "DROP TABLE gn071");
if (mysql_error (dbh->dbf)[0])
{
- LOG_MYSQL (GE_ERROR | GE_ADMIN | GE_BULK, "mysql_query", dbh);
+ LOG_MYSQL (GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"mysql_query", dbh);
ok = GNUNET_NO;
}
mysql_query (dbh->dbf, "DROP TABLE gn072");
if (mysql_error (dbh->dbf)[0])
{
- LOG_MYSQL (GE_ERROR | GE_ADMIN | GE_BULK, "mysql_query", dbh);
+ LOG_MYSQL (GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"mysql_query", dbh);
ok = GNUNET_NO;
}
if (ok == GNUNET_YES)
@@ -1434,11 +1434,11 @@
GNUNET_mutex_unlock (lock);
}
-SQstore_ServiceAPI *
-provide_module_sqstore_mysql (CoreAPIForApplication * capi)
+GNUNET_SQstore_ServiceAPI *
+provide_module_sqstore_mysql (GNUNET_CoreAPIForPlugins * capi)
{
- static SQstore_ServiceAPI api;
- State_ServiceAPI *state;
+ static GNUNET_SQstore_ServiceAPI api;
+ GNUNET_State_ServiceAPI *state;
char *cnffile;
FILE *fp;
struct passwd *pw;
@@ -1458,7 +1458,7 @@
#ifndef WINDOWS
pw = getpwuid (getuid ());
if (!pw)
- GE_DIE_STRERROR (ectx, GE_FATAL | GE_ADMIN | GE_IMMEDIATE, "getpwuid");
+ GNUNET_GE_DIE_STRERROR (ectx, GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE, "getpwuid");
home_dir = GNUNET_strdup (pw->pw_dir);
#else
home_dir = (char *) GNUNET_malloc (_MAX_PATH + 1);
@@ -1468,18 +1468,18 @@
cnffile = GNUNET_malloc (nX);
GNUNET_snprintf (cnffile, nX, "%s/.my.cnf", home_dir);
GNUNET_free (home_dir);
- GC_get_configuration_value_filename (capi->cfg,
+ GNUNET_GC_get_configuration_value_filename (capi->cfg,
"MYSQL", "CONFIG", cnffile, &home_dir);
GNUNET_free (cnffile);
cnffile = home_dir;
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("Trying to use file `%s' for MySQL configuration.\n"), cnffile);
fp = FOPEN (cnffile, "r");
if (!fp)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_ADMIN | GE_BULK, "fopen", cnffile);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "fopen", cnffile);
if (stats != NULL)
coreAPI->releaseService (stats);
GNUNET_free (cnffile);
@@ -1496,8 +1496,8 @@
{
GNUNET_free (cnffile);
GNUNET_free (dbh);
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_
("Failed to load MySQL database module. Check that MySQL is
running and configured properly!\n"));
dbh = NULL;
@@ -1519,7 +1519,7 @@
(!(sql_res = mysql_use_result (dbh->dbf))) ||
(!(sql_row = mysql_fetch_row (sql_res))))
{
- LOG_MYSQL (GE_ERROR | GE_ADMIN | GE_BULK, "mysql_query", dbh);
+ LOG_MYSQL (GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"mysql_query", dbh);
content_size = 0;
iclose (dbh);
}
@@ -1527,14 +1527,14 @@
{
if ((mysql_num_fields (sql_res) != 1) || (sql_row[0] == NULL))
{
- GE_BREAK (ectx, mysql_num_fields (sql_res) == 1);
+ GNUNET_GE_BREAK (ectx, mysql_num_fields (sql_res) == 1);
content_size = 0;
}
else
{
if (1 != SSCANF (sql_row[0], "%llu", &content_size))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
content_size = 0;
}
}
@@ -1570,7 +1570,7 @@
void
release_module_sqstore_mysql ()
{
- State_ServiceAPI *state;
+ GNUNET_State_ServiceAPI *state;
iclose (dbh);
GNUNET_free (dbh->cnffile);
@@ -1593,7 +1593,7 @@
* Update mysql database module.
*/
void
-update_module_sqstore_mysql (UpdateAPI * uapi)
+update_module_sqstore_mysql (GNUNET_UpdateAPI * uapi)
{
char *cnffile;
FILE *fp;
@@ -1605,7 +1605,7 @@
#ifndef WINDOWS
pw = getpwuid (getuid ());
if (!pw)
- GE_DIE_STRERROR (ectx, GE_FATAL | GE_ADMIN | GE_IMMEDIATE, "getpwuid");
+ GNUNET_GE_DIE_STRERROR (ectx, GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE, "getpwuid");
home_dir = GNUNET_strdup (pw->pw_dir);
#else
home_dir = (char *) GNUNET_malloc (_MAX_PATH + 1);
@@ -1615,18 +1615,18 @@
cnffile = GNUNET_malloc (nX);
GNUNET_snprintf (cnffile, nX, "%s/.my.cnf", home_dir);
GNUNET_free (home_dir);
- GC_get_configuration_value_filename (uapi->cfg,
+ GNUNET_GC_get_configuration_value_filename (uapi->cfg,
"MYSQL", "CONFIG", cnffile, &home_dir);
GNUNET_free (cnffile);
cnffile = home_dir;
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("Trying to use file `%s' for MySQL configuration.\n"), cnffile);
fp = FOPEN (cnffile, "r");
if (!fp)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_ADMIN | GE_BULK, "fopen", cnffile);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "fopen", cnffile);
GNUNET_free (cnffile);
return;
}
@@ -1641,8 +1641,8 @@
{
GNUNET_free (cnffile);
GNUNET_free (dbh);
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_
("Failed to load MySQL database module. Check that MySQL is
running and configured properly!\n"));
dbh = NULL;
Modified: GNUnet/src/applications/sqstore_mysql/mysqltest.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysqltest.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/sqstore_mysql/mysqltest.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -35,13 +35,13 @@
static GNUNET_CronTime now;
-static Datastore_Value *
+static GNUNET_DatastoreValue *
initValue (int i)
{
- Datastore_Value *value;
+ GNUNET_DatastoreValue *value;
- value = GNUNET_malloc (sizeof (Datastore_Value) + 8 * i);
- value->size = htonl (sizeof (Datastore_Value) + 8 * i);
+ value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + 8 * i);
+ value->size = htonl (sizeof (GNUNET_DatastoreValue) + 8 * i);
value->type = htonl (i);
value->prio = htonl (i + 1);
value->anonymityLevel = htonl (i);
@@ -52,12 +52,12 @@
static int
checkValue (const GNUNET_HashCode * key,
- const Datastore_Value * val, void *closure,
+ const GNUNET_DatastoreValue * val, void *closure,
unsigned long long uid)
{
int i;
int ret;
- Datastore_Value *value;
+ GNUNET_DatastoreValue *value;
i = *(int *) closure;
value = initValue (i);
@@ -78,7 +78,7 @@
}
static int
-iterateUp (const GNUNET_HashCode * key, const Datastore_Value * val,
+iterateUp (const GNUNET_HashCode * key, const GNUNET_DatastoreValue * val,
int *closure, unsigned long long uid)
{
int ret;
@@ -90,7 +90,7 @@
static int
iterateDown (const GNUNET_HashCode * key,
- const Datastore_Value * val, int *closure,
+ const GNUNET_DatastoreValue * val, int *closure,
unsigned long long uid)
{
int ret;
@@ -102,7 +102,7 @@
static int
iterateDelete (const GNUNET_HashCode * key,
- const Datastore_Value * val, void *closure,
+ const GNUNET_DatastoreValue * val, void *closure,
unsigned long long uid)
{
return GNUNET_NO;
@@ -110,7 +110,7 @@
static int
iteratePriority (const GNUNET_HashCode * key,
- const Datastore_Value * val, SQstore_ServiceAPI * api,
+ const GNUNET_DatastoreValue * val, GNUNET_SQstore_ServiceAPI
* api,
unsigned long long uid)
{
api->update (uid, 4, 0);
@@ -119,7 +119,7 @@
static int
priorityCheck (const GNUNET_HashCode * key,
- const Datastore_Value * val, int *closure,
+ const GNUNET_DatastoreValue * val, int *closure,
unsigned long long uid)
{
int id;
@@ -133,7 +133,7 @@
static int
multipleCheck (const GNUNET_HashCode * key,
- const Datastore_Value * val, Datastore_Value ** last,
+ const GNUNET_DatastoreValue * val, GNUNET_DatastoreValue **
last,
unsigned long long uid)
{
if (*last != NULL)
@@ -153,9 +153,9 @@
* Add testcode here!
*/
static int
-test (SQstore_ServiceAPI * api)
+test (GNUNET_SQstore_ServiceAPI * api)
{
- Datastore_Value *value;
+ GNUNET_DatastoreValue *value;
GNUNET_HashCode key;
unsigned long long oldSize;
int i;
@@ -170,8 +170,8 @@
GNUNET_free (value);
}
ASSERT (oldSize < api->getSize ());
- ASSERT (256 == api->iterateLowPriority (ANY_BLOCK, NULL, NULL));
- ASSERT (256 == api->iterateExpirationTime (ANY_BLOCK, NULL, NULL));
+ ASSERT (256 == api->iterateLowPriority (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
NULL, NULL));
+ ASSERT (256 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
NULL, NULL));
for (i = 255; i >= 0; i--)
{
memset (&key, 256 - i, sizeof (GNUNET_HashCode));
@@ -188,31 +188,31 @@
}
ASSERT (oldSize > api->getSize ());
i = 0;
- ASSERT (128 == api->iterateLowPriority (ANY_BLOCK,
- (Datum_Iterator) & iterateUp, &i));
+ ASSERT (128 == api->iterateLowPriority (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ (GNUNET_DatastoreValueIterator) &
iterateUp, &i));
ASSERT (256 == i);
- ASSERT (128 == api->iterateExpirationTime (ANY_BLOCK,
- (Datum_Iterator) & iterateDown,
+ ASSERT (128 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ (GNUNET_DatastoreValueIterator) &
iterateDown,
&i));
ASSERT (0 == i);
- ASSERT (128 == api->iterateExpirationTime (ANY_BLOCK,
- (Datum_Iterator) & iterateDelete,
+ ASSERT (128 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ (GNUNET_DatastoreValueIterator) &
iterateDelete,
api));
- ASSERT (0 == api->iterateExpirationTime (ANY_BLOCK,
- (Datum_Iterator) & iterateDown,
+ ASSERT (0 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ (GNUNET_DatastoreValueIterator) &
iterateDown,
&i));
i = 42;
value = initValue (i);
memset (&key, 256 - i, sizeof (GNUNET_HashCode));
api->put (&key, value);
- ASSERT (1 == api->iterateExpirationTime (ANY_BLOCK,
- (Datum_Iterator) & priorityCheck,
+ ASSERT (1 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ (GNUNET_DatastoreValueIterator) &
priorityCheck,
&i));
- ASSERT (1 == api->iterateAllNow ((Datum_Iterator) & iteratePriority, api));
+ ASSERT (1 == api->iterateAllNow ((GNUNET_DatastoreValueIterator) &
iteratePriority, api));
i += 4;
- ASSERT (1 == api->iterateExpirationTime (ANY_BLOCK,
- (Datum_Iterator) & priorityCheck,
+ ASSERT (1 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ (GNUNET_DatastoreValueIterator) &
priorityCheck,
&i));
GNUNET_free (value);
@@ -222,12 +222,12 @@
GNUNET_free (value);
value = NULL;
- ASSERT (2 == api->iterateExpirationTime (ANY_BLOCK,
- (Datum_Iterator) & multipleCheck,
+ ASSERT (2 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ (GNUNET_DatastoreValueIterator) &
multipleCheck,
&value));
GNUNET_free (value);
- ASSERT (2 == api->iterateAllNow ((Datum_Iterator) & iterateDelete, api));
- ASSERT (0 == api->iterateExpirationTime (ANY_BLOCK, NULL, NULL));
+ ASSERT (2 == api->iterateAllNow ((GNUNET_DatastoreValueIterator) &
iterateDelete, api));
+ ASSERT (0 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
NULL, NULL));
api->drop ();
return GNUNET_OK;
@@ -240,15 +240,15 @@
int
main (int argc, char *argv[])
{
- SQstore_ServiceAPI *api;
+ GNUNET_SQstore_ServiceAPI *api;
int ok;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
struct GNUNET_CronManager *cron;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
cron = cron_create (NULL);
@@ -263,7 +263,7 @@
ok = GNUNET_SYSERR;
doneCore ();
GNUNET_cron_destroy (cron);
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
if (ok == GNUNET_SYSERR)
return 1;
return 0;
Modified: GNUnet/src/applications/sqstore_mysql/mysqltest2.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysqltest2.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/sqstore_mysql/mysqltest2.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -124,18 +124,18 @@
static GNUNET_CronTime start_time;
static int
-putValue (SQstore_ServiceAPI * api, int i)
+putValue (GNUNET_SQstore_ServiceAPI * api, int i)
{
- Datastore_Value *value;
+ GNUNET_DatastoreValue *value;
size_t size;
static GNUNET_HashCode key;
static int ic;
/* most content is 32k */
- size = sizeof (Datastore_Value) + 32 * 1024;
+ size = sizeof (GNUNET_DatastoreValue) + 32 * 1024;
if (GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 16) == 0) /* but some of
it is less! */
size =
- sizeof (Datastore_Value) +
+ sizeof (GNUNET_DatastoreValue) +
GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 32 * 1024);
size = size - (size & 7); /* always multiple of 8 */
@@ -149,7 +149,7 @@
value->expirationTime =
GNUNET_htonll (GNUNET_get_time () +
GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 1000));
- memset (&value[1], i, size - sizeof (Datastore_Value));
+ memset (&value[1], i, size - sizeof (GNUNET_DatastoreValue));
if (GNUNET_OK != api->put (&key, value))
{
GNUNET_free (value);
@@ -170,9 +170,9 @@
static int
iterateDelete (const GNUNET_HashCode * key,
- const Datastore_Value * val, void *cls, unsigned long long uid)
+ const GNUNET_DatastoreValue * val, void *cls, unsigned long
long uid)
{
- SQstore_ServiceAPI *api = cls;
+ GNUNET_SQstore_ServiceAPI *api = cls;
static int dc;
if (api->getSize () < MAX_SIZE)
@@ -193,7 +193,7 @@
* Add testcode here!
*/
static int
-test (SQstore_ServiceAPI * api)
+test (GNUNET_SQstore_ServiceAPI * api)
{
int i;
int j;
@@ -249,15 +249,15 @@
int
main (int argc, char *argv[])
{
- SQstore_ServiceAPI *api;
+ GNUNET_SQstore_ServiceAPI *api;
int ok;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
struct GNUNET_CronManager *cron;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
cron = cron_create (NULL);
@@ -273,7 +273,7 @@
ok = GNUNET_SYSERR;
doneCore ();
GNUNET_cron_destroy (cron);
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
if (ok == GNUNET_SYSERR)
return 1;
return 0;
Modified: GNUnet/src/applications/sqstore_mysql/mysqltest3.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysqltest3.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/sqstore_mysql/mysqltest3.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -56,19 +56,19 @@
static GNUNET_CronTime start_time;
static int
-putValue (SQstore_ServiceAPI * api, int i)
+putValue (GNUNET_SQstore_ServiceAPI * api, int i)
{
- Datastore_Value *value;
+ GNUNET_DatastoreValue *value;
size_t size;
static GNUNET_HashCode key;
static int ic;
/* most content is 32k */
- size = sizeof (Datastore_Value) + 32 * 1024;
+ size = sizeof (GNUNET_DatastoreValue) + 32 * 1024;
if (GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 16) == 0) /* but some of
it is less! */
size =
- sizeof (Datastore_Value) +
+ sizeof (GNUNET_DatastoreValue) +
GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 32 * 1024);
size = size - (size & 7); /* always multiple of 8 */
@@ -83,7 +83,7 @@
value->expirationTime =
GNUNET_htonll (GNUNET_get_time () + 60 * GNUNET_CRON_HOURS +
GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 1000));
- memset (&value[1], i, size - sizeof (Datastore_Value));
+ memset (&value[1], i, size - sizeof (GNUNET_DatastoreValue));
if (GNUNET_OK != api->put (&key, value))
{
GNUNET_free (value);
@@ -99,7 +99,7 @@
}
static int
-iterateDummy (const GNUNET_HashCode * key, const Datastore_Value * val,
+iterateDummy (const GNUNET_HashCode * key, const GNUNET_DatastoreValue * val,
void *cls, unsigned long long uid)
{
if (GNUNET_shutdown_test () == GNUNET_YES)
@@ -108,7 +108,7 @@
}
static int
-test (SQstore_ServiceAPI * api)
+test (GNUNET_SQstore_ServiceAPI * api)
{
int i;
int j;
@@ -174,15 +174,15 @@
int
main (int argc, char *argv[])
{
- SQstore_ServiceAPI *api;
+ GNUNET_SQstore_ServiceAPI *api;
int ok;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
struct GNUNET_CronManager *cron;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
cron = cron_create (NULL);
@@ -198,7 +198,7 @@
ok = GNUNET_SYSERR;
doneCore ();
GNUNET_cron_destroy (cron);
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
if (ok == GNUNET_SYSERR)
return 1;
return 0;
Modified: GNUnet/src/applications/sqstore_sqlite/sqlite.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlite.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/sqstore_sqlite/sqlite.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -44,14 +44,14 @@
* a failure of the command 'cmd' with the message given
* by strerror(errno).
*/
-#define DIE_SQLITE(db, cmd) do { GE_LOG(ectx, GE_FATAL | GE_IMMEDIATE |
GE_ADMIN, _("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__,
sqlite3_errmsg(db->dbh)); abort(); } while(0)
+#define DIE_SQLITE(db, cmd) do { GNUNET_GE_LOG(ectx, GNUNET_GE_FATAL |
GNUNET_GE_IMMEDIATE | GNUNET_GE_ADMIN, _("`%s' failed at %s:%d with error:
%s\n"), cmd, __FILE__, __LINE__, sqlite3_errmsg(db->dbh)); abort(); } while(0)
/**
* Log an error message at log-level 'level' that indicates
* a failure of the command 'cmd' on file 'filename'
* with the message given by strerror(errno).
*/
-#define LOG_SQLITE(db, level, cmd) do { GE_LOG(ectx, level, _("`%s' failed at
%s:%d with error: %s\n"), cmd, __FILE__, __LINE__, sqlite3_errmsg(db->dbh)); }
while(0)
+#define LOG_SQLITE(db, level, cmd) do { GNUNET_GE_LOG(ectx, level, _("`%s'
failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__,
sqlite3_errmsg(db->dbh)); } while(0)
/* These selects basically work in the same way as the old MySQL selects do.
But because the
reverse ordering kills performance, we are using subselects with MAX() for
SQLite instead.
@@ -128,13 +128,13 @@
sqlite3_stmt *insertContent;
} sqliteHandle;
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
static unsigned int stat_size;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
static struct GNUNET_Mutex *lock;
@@ -162,7 +162,7 @@
}
#if 1
-#define CHECK(a) GE_BREAK(ectx, a)
+#define CHECK(a) GNUNET_GE_BREAK(ectx, a)
#define ENULL NULL
#else
#define ENULL &e
@@ -233,8 +233,8 @@
/* Open database and precompile statements */
if (sqlite3_open (fn, &ret->dbh) != SQLITE_OK)
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Unable to initialize SQLite: %s.\n"),
sqlite3_errmsg (ret->dbh));
sqlite3_close (ret->dbh);
@@ -276,7 +276,7 @@
NULL) != SQLITE_OK)
{
LOG_SQLITE (ret,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
"sqlite_create");
sqlite3_finalize (stmt);
GNUNET_free (ret);
@@ -304,7 +304,7 @@
&ret->insertContent) != SQLITE_OK))
{
LOG_SQLITE (ret,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "precompiling");
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "precompiling");
if (ret->countContent != NULL)
sqlite3_finalize (ret->countContent);
if (ret->exists != NULL)
@@ -353,10 +353,10 @@
* </pre>
*/
static unsigned int
-getContentDatastoreSize (const Datastore_Value * value)
+getContentDatastoreSize (const GNUNET_DatastoreValue * value)
{
return sizeof (GNUNET_HashCode) + ntohl (value->size) -
- sizeof (Datastore_Value) + getIntSize (ntohl (value->size)) +
+ sizeof (GNUNET_DatastoreValue) + getIntSize (ntohl (value->size)) +
getIntSize (ntohl (value->type)) + getIntSize (ntohl (value->prio)) +
getIntSize (ntohl (value->anonymityLevel)) +
getIntSize (GNUNET_ntohll (value->expirationTime)) + 7 + 245 + 1;
@@ -393,14 +393,14 @@
"DELETE FROM gn070 WHERE _ROWID_ = ?", &stmt) != SQLITE_OK)
{
LOG_SQLITE (handle,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sq_prepare");
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "sq_prepare");
return GNUNET_SYSERR;
}
sqlite3_bind_int64 (stmt, 1, rid);
if (SQLITE_DONE != sqlite3_step (stmt))
{
LOG_SQLITE (handle,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sqlite3_step");
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "sqlite3_step");
sqlite3_finalize (stmt);
return GNUNET_SYSERR;
}
@@ -410,58 +410,58 @@
/**
* Given a full row from gn070 table
(size,type,prio,anonLevel,expire,GNUNET_hash,value),
- * assemble it into a Datastore_Value representation.
+ * assemble it into a GNUNET_DatastoreValue representation.
*/
-static Datastore_Value *
+static GNUNET_DatastoreValue *
assembleDatum (sqliteHandle * handle, sqlite3_stmt * stmt,
GNUNET_HashCode * key, unsigned long long *rowid)
{
- Datastore_Value *value;
+ GNUNET_DatastoreValue *value;
int contentSize;
sqlite3 *dbh;
unsigned int type;
*rowid = sqlite3_column_int64 (stmt, 7);
type = sqlite3_column_int (stmt, 1);
- if (type == RESERVED_BLOCK)
+ if (type == GNUNET_GNUNET_ECRS_BLOCKTYPE_RESERVED)
return NULL;
- contentSize = sqlite3_column_int (stmt, 0) - sizeof (Datastore_Value);
+ contentSize = sqlite3_column_int (stmt, 0) - sizeof (GNUNET_DatastoreValue);
dbh = handle->dbh;
if (contentSize < 0)
{
sqlite3_stmt *stmtd;
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Invalid data in %s (NCS). Trying to fix (by deletion).\n"),
_("sqlite datastore"));
if (1)
abort ();
if (SQLITE_OK != sqlite3_reset (stmt))
LOG_SQLITE (handle,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sqlite3_reset");
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "sqlite3_reset");
if (sq_prepare (dbh,
"DELETE FROM gn070 WHERE size < ?",
&stmtd) == SQLITE_OK)
{
if (SQLITE_OK !=
- sqlite3_bind_int (stmtd, 1, sizeof (Datastore_Value)))
- LOG_SQLITE (handle, GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ sqlite3_bind_int (stmtd, 1, sizeof (GNUNET_DatastoreValue)))
+ LOG_SQLITE (handle, GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_USER | GNUNET_GE_BULK,
"sqlite3_bind_int");
if (SQLITE_DONE != sqlite3_step (stmtd))
LOG_SQLITE (handle,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
"sqlite3_step");
if (SQLITE_OK != sqlite3_finalize (stmtd))
LOG_SQLITE (handle,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
"sqlite3_finalize");
}
else
LOG_SQLITE (handle,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sq_prepare");
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "sq_prepare");
return NULL; /* error */
}
@@ -470,43 +470,43 @@
{
sqlite3_stmt *stmtd;
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Invalid data in %s. Trying to fix (by deletion).\n"),
_("sqlite datastore"));
if (SQLITE_OK != sqlite3_reset (stmt))
LOG_SQLITE (handle,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sqlite3_reset");
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "sqlite3_reset");
if (sq_prepare (dbh,
"DELETE FROM gn070 WHERE NOT ((LENGTH(hash) = ?) AND
(size = LENGTH(value) + ?))",
&stmtd) == SQLITE_OK)
{
if (SQLITE_OK !=
sqlite3_bind_int (stmtd, 1, sizeof (GNUNET_HashCode)))
- LOG_SQLITE (handle, GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ LOG_SQLITE (handle, GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_USER | GNUNET_GE_BULK,
"sqlite3_bind_int");
if (SQLITE_OK !=
- sqlite3_bind_int (stmtd, 2, sizeof (Datastore_Value)))
- LOG_SQLITE (handle, GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ sqlite3_bind_int (stmtd, 2, sizeof (GNUNET_DatastoreValue)))
+ LOG_SQLITE (handle, GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_USER | GNUNET_GE_BULK,
"sqlite3_bind_int");
if (SQLITE_DONE != sqlite3_step (stmtd))
LOG_SQLITE (handle,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
"sqlite3_step");
if (SQLITE_OK != sqlite3_finalize (stmtd))
LOG_SQLITE (handle,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
"sqlite3_finalize");
}
else
LOG_SQLITE (handle,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sq_prepare");
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "sq_prepare");
return NULL;
}
- value = GNUNET_malloc (sizeof (Datastore_Value) + contentSize);
- value->size = htonl (contentSize + sizeof (Datastore_Value));
+ value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + contentSize);
+ value->size = htonl (contentSize + sizeof (GNUNET_DatastoreValue));
value->type = htonl (type);
value->prio = htonl (sqlite3_column_int (stmt, 2));
value->anonymityLevel = htonl (sqlite3_column_int (stmt, 3));
@@ -553,7 +553,7 @@
if (i != SQLITE_OK)
{
LOG_SQLITE (handle,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sqlite_getStat");
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "sqlite_getStat");
return GNUNET_SYSERR;
}
return ret;
@@ -578,7 +578,7 @@
sqlite3_bind_text (stmt, 1, key, strlen (key), SQLITE_STATIC);
if (SQLITE_DONE != sqlite3_step (stmt))
LOG_SQLITE (handle,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sqlite3_step");
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "sqlite3_step");
sqlite3_finalize (stmt);
}
@@ -590,10 +590,10 @@
if ((SQLITE_OK !=
sqlite3_bind_text (stmt, 1, key, strlen (key), SQLITE_STATIC))
|| (SQLITE_OK != sqlite3_bind_int64 (stmt, 2, val))
- || (SQLITE_OK != sqlite3_bind_int (stmt, 3, RESERVED_BLOCK)))
+ || (SQLITE_OK != sqlite3_bind_int (stmt, 3,
GNUNET_GNUNET_ECRS_BLOCKTYPE_RESERVED)))
{
LOG_SQLITE (handle,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
"sqlite3_bind_xxx");
sqlite3_finalize (stmt);
return GNUNET_SYSERR;
@@ -601,7 +601,7 @@
if (sqlite3_step (stmt) != SQLITE_DONE)
{
LOG_SQLITE (handle,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sqlite3_step");
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "sqlite3_step");
sqlite3_finalize (stmt);
return GNUNET_SYSERR;
}
@@ -637,12 +637,12 @@
int is_prio,
int is_migr,
int limit_nonanonymous,
- unsigned int iter_select, Datum_Iterator iter, void *closure)
+ unsigned int iter_select, GNUNET_DatastoreValueIterator iter,
void *closure)
{
sqlite3_stmt *stmt;
int count;
char *stmt_str;
- Datastore_Value *datum;
+ GNUNET_DatastoreValue *datum;
unsigned int lastPrio;
unsigned long long lastExp;
GNUNET_HashCode key;
@@ -671,14 +671,14 @@
stmt_str = SELECT_IT_MIGRATION_ORDER;
break;
default:
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
if (sq_prepare (dbh, stmt_str, &stmt) != SQLITE_OK)
{
LOG_SQLITE (handle,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sqlite3_prepare");
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "sqlite3_prepare");
GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
@@ -743,13 +743,13 @@
datum = assembleDatum (handle, stmt, &key, &rowid);
if (SQLITE_OK != sqlite3_reset (stmt))
LOG_SQLITE (handle,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
"sqlite3_reset");
if (datum == NULL)
break;
#if 0
printf ("FOUND %4u prio %4u exp %20llu old: %4u, %20llu\n",
- (ntohl (datum->size) - sizeof (Datastore_Value)),
+ (ntohl (datum->size) - sizeof (GNUNET_DatastoreValue)),
ntohl (datum->prio),
GNUNET_ntohll (datum->expirationTime), lastPrio, lastExp);
#endif
@@ -784,7 +784,7 @@
if (ret != SQLITE_DONE)
{
LOG_SQLITE (handle,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
"sqlite3_step");
sqlite3_finalize (stmt);
GNUNET_mutex_unlock (lock);
@@ -811,7 +811,7 @@
* iter is non-NULL and aborted the iteration
*/
static int
-iterateLowPriority (unsigned int type, Datum_Iterator iter, void *closure)
+iterateLowPriority (unsigned int type, GNUNET_DatastoreValueIterator iter,
void *closure)
{
return sqlite_iterate (type, GNUNET_YES, GNUNET_YES, GNUNET_NO, GNUNET_NO,
0, iter, closure);
@@ -828,7 +828,7 @@
* iter is non-NULL and aborted the iteration
*/
static int
-iterateNonAnonymous (unsigned int type, Datum_Iterator iter, void *closure)
+iterateNonAnonymous (unsigned int type, GNUNET_DatastoreValueIterator iter,
void *closure)
{
return sqlite_iterate (type, GNUNET_NO, GNUNET_YES, GNUNET_NO, GNUNET_YES,
1, iter, closure);
@@ -844,7 +844,7 @@
* @return the number of items stored in the content database
*/
static int
-iterateExpirationTime (unsigned int type, Datum_Iterator iter, void *closure)
+iterateExpirationTime (unsigned int type, GNUNET_DatastoreValueIterator iter,
void *closure)
{
return sqlite_iterate (type, GNUNET_YES, GNUNET_NO, GNUNET_NO, GNUNET_NO, 2,
iter, closure);
@@ -859,7 +859,7 @@
* iter is non-NULL and aborted the iteration
*/
static int
-iterateMigrationOrder (Datum_Iterator iter, void *closure)
+iterateMigrationOrder (GNUNET_DatastoreValueIterator iter, void *closure)
{
return sqlite_iterate (0, GNUNET_NO, GNUNET_NO, GNUNET_YES, GNUNET_NO, 3,
iter, closure);
@@ -875,11 +875,11 @@
* @return the number of items stored in the content database
*/
static int
-iterateAllNow (Datum_Iterator iter, void *closure)
+iterateAllNow (GNUNET_DatastoreValueIterator iter, void *closure)
{
sqlite3_stmt *stmt;
int count;
- Datastore_Value *datum;
+ GNUNET_DatastoreValue *datum;
sqlite3 *dbh;
sqliteHandle *handle;
int ret;
@@ -900,7 +900,7 @@
&stmt) != SQLITE_OK)
{
LOG_SQLITE (handle,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sqlite3_prepare");
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "sqlite3_prepare");
GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
@@ -946,8 +946,8 @@
if (count != GNUNET_SYSERR)
{
/* re-computed payload! */
- GE_LOG (ectx,
- GE_INFO | GE_IMMEDIATE | GE_USER | GE_ADMIN,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_IMMEDIATE | GNUNET_GE_USER |
GNUNET_GE_ADMIN,
"SQLite database size recomputed. New estimate is %llu, old
estimate was %llu\n",
newpayload, payload);
payload = newpayload;
@@ -968,8 +968,8 @@
if (fn == NULL)
return; /* already down */
#if DEBUG_SQLITE
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER, "SQLite: closing database\n");
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, "SQLite:
closing database\n");
#endif
syncStats (getDBHandle ());
@@ -984,7 +984,7 @@
sqlite3_finalize (h->insertContent);
if (sqlite3_close (h->dbh) != SQLITE_OK)
LOG_SQLITE (h,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sqlite_close");
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "sqlite_close");
GNUNET_free (h);
}
GNUNET_free (handles);
@@ -1021,13 +1021,13 @@
*/
static int
get (const GNUNET_HashCode * key,
- unsigned int type, Datum_Iterator iter, void *closure)
+ unsigned int type, GNUNET_DatastoreValueIterator iter, void *closure)
{
int ret;
int count = 0;
sqlite3_stmt *stmt;
char scratch[256];
- Datastore_Value *datum;
+ GNUNET_DatastoreValue *datum;
sqlite3 *dbh;
sqliteHandle *handle;
GNUNET_HashCode rkey;
@@ -1052,7 +1052,7 @@
if (sq_prepare (dbh, scratch, &stmt) != SQLITE_OK)
{
LOG_SQLITE (handle,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sqlite_prepare");
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "sqlite_prepare");
GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
@@ -1089,7 +1089,7 @@
if ((key != NULL) &&
(0 != memcmp (&rkey, key, sizeof (GNUNET_HashCode))))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
GNUNET_free (datum);
continue;
}
@@ -1125,7 +1125,7 @@
* @return GNUNET_SYSERR on error, GNUNET_NO on temporary error, GNUNET_OK if
ok.
*/
static int
-put (const GNUNET_HashCode * key, const Datastore_Value * value)
+put (const GNUNET_HashCode * key, const GNUNET_DatastoreValue * value)
{
int n;
sqlite3_stmt *stmt;
@@ -1136,24 +1136,24 @@
#if DEBUG_SQLITE
GNUNET_EncName enc;
- IF_GELOG (ectx, GE_DEBUG | GE_BULK | GE_USER,
+ IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_USER,
GNUNET_hash_to_enc (key, &enc));
- GE_LOG (ectx, GE_DEBUG | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_USER,
"Storing in database block with type %u/key `%s'/priority
%u/expiration %llu.\n",
ntohl (*(int *) &value[1]), &enc, ntohl (value->prio),
GNUNET_ntohll (value->expirationTime));
#endif
- if ((ntohl (value->size) < sizeof (Datastore_Value)))
+ if ((ntohl (value->size) < sizeof (GNUNET_DatastoreValue)))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
GNUNET_mutex_lock (lock);
dbh = getDBHandle ();
if (lastSync > 1000)
syncStats (dbh);
- contentSize = ntohl (value->size) - sizeof (Datastore_Value);
+ contentSize = ntohl (value->size) - sizeof (GNUNET_DatastoreValue);
stmt = dbh->insertContent;
size = ntohl (value->size);
type = ntohl (value->type);
@@ -1173,11 +1173,11 @@
SQLITE_TRANSIENT)))
{
LOG_SQLITE (dbh,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
"sqlite3_bind_XXXX");
if (SQLITE_OK != sqlite3_reset (stmt))
LOG_SQLITE (dbh,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sqlite3_reset");
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "sqlite3_reset");
GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
@@ -1192,19 +1192,19 @@
return GNUNET_NO;
}
LOG_SQLITE (dbh,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sqlite3_step");
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "sqlite3_step");
sqlite3_reset (stmt);
GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
if (SQLITE_OK != sqlite3_reset (stmt))
LOG_SQLITE (dbh,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sqlite3_reset");
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "sqlite3_reset");
lastSync++;
payload += getContentDatastoreSize (value);
#if DEBUG_SQLITE
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER, "SQLite: done writing content\n");
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, "SQLite: done
writing content\n");
#endif
GNUNET_mutex_unlock (lock);
return GNUNET_OK;
@@ -1227,12 +1227,12 @@
sqlite3_bind_int64 (dbh->updPrio, 3, uid);
n = sqlite3_step (dbh->updPrio);
if (n != SQLITE_DONE)
- LOG_SQLITE (dbh, GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sqlite3_step");
+ LOG_SQLITE (dbh, GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "sqlite3_step");
sqlite3_reset (dbh->updPrio);
#if DEBUG_SQLITE
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER, "SQLite: block updated\n");
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"SQLite: block updated\n");
#endif
GNUNET_mutex_unlock (lock);
if (n == SQLITE_BUSY)
@@ -1240,10 +1240,10 @@
return n == SQLITE_OK ? GNUNET_OK : GNUNET_SYSERR;
}
-SQstore_ServiceAPI *
-provide_module_sqstore_sqlite (CoreAPIForApplication * capi)
+GNUNET_SQstore_ServiceAPI *
+provide_module_sqstore_sqlite (GNUNET_CoreAPIForPlugins * capi)
{
- static SQstore_ServiceAPI api;
+ static GNUNET_SQstore_ServiceAPI api;
char *dir;
char *afsdir;
@@ -1251,18 +1251,18 @@
ectx = capi->ectx;
#if DEBUG_SQLITE
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER, "SQLite: initializing database\n");
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, "SQLite:
initializing database\n");
#endif
payload = 0;
lastSync = 0;
afsdir = NULL;
- GC_get_configuration_value_filename (capi->cfg,
+ GNUNET_GC_get_configuration_value_filename (capi->cfg,
"FS",
"DIR",
- VAR_DAEMON_DIRECTORY "/data/fs/",
+ GNUNET_DEFAULT_DAEMON_VAR_DIRECTORY
"/data/fs/",
&afsdir);
dir = GNUNET_malloc (strlen (afsdir) + strlen ("/content/gnunet.dat") + 2);
strcpy (dir, afsdir);
@@ -1270,7 +1270,7 @@
GNUNET_free (afsdir);
if (GNUNET_OK != GNUNET_disk_directory_create_for_file (ectx, dir))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_free (dir);
return NULL;
}
@@ -1278,7 +1278,7 @@
dbh = getDBHandle ();
if (dbh == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_free (fn);
fn = NULL;
return NULL;
@@ -1287,9 +1287,9 @@
payload = getStat (dbh, "PAYLOAD");
if (payload == GNUNET_SYSERR)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
LOG_SQLITE (dbh,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sqlite_payload");
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "sqlite_payload");
GNUNET_mutex_destroy (lock);
GNUNET_free (fn);
fn = NULL;
@@ -1324,8 +1324,8 @@
coreAPI->releaseService (stats);
sqlite_shutdown ();
#if DEBUG_SQLITE
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER, "SQLite: database shutdown\n");
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, "SQLite:
database shutdown\n");
#endif
GNUNET_mutex_destroy (lock);
lock = NULL;
@@ -1340,7 +1340,7 @@
* Currently only makes sure that the sqlite indices are created.
*/
void
-update_module_sqstore_sqlite (UpdateAPI * uapi)
+update_module_sqstore_sqlite (GNUNET_UpdateAPI * uapi)
{
sqliteHandle *dbh;
char *dir;
@@ -1349,10 +1349,10 @@
payload = 0;
lastSync = 0;
afsdir = NULL;
- GC_get_configuration_value_filename (uapi->cfg,
+ GNUNET_GC_get_configuration_value_filename (uapi->cfg,
"FS",
"DIR",
- VAR_DAEMON_DIRECTORY "/data/fs/",
+ GNUNET_DEFAULT_DAEMON_VAR_DIRECTORY
"/data/fs/",
&afsdir);
dir = GNUNET_malloc (strlen (afsdir) + 8 + 2); /* 8 = "content/" */
strcpy (dir, afsdir);
Modified: GNUnet/src/applications/sqstore_sqlite/sqlitetest.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlitetest.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/sqstore_sqlite/sqlitetest.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -35,13 +35,13 @@
static GNUNET_CronTime now;
-static Datastore_Value *
+static GNUNET_DatastoreValue *
initValue (int i)
{
- Datastore_Value *value;
+ GNUNET_DatastoreValue *value;
- value = GNUNET_malloc (sizeof (Datastore_Value) + 8 * i);
- value->size = htonl (sizeof (Datastore_Value) + 8 * i);
+ value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + 8 * i);
+ value->size = htonl (sizeof (GNUNET_DatastoreValue) + 8 * i);
value->type = htonl (i);
value->prio = htonl (i + 1);
value->anonymityLevel = htonl (i);
@@ -52,12 +52,12 @@
static int
checkValue (const GNUNET_HashCode * key,
- const Datastore_Value * val, void *closure,
+ const GNUNET_DatastoreValue * val, void *closure,
unsigned long long uid)
{
int i;
int ret;
- Datastore_Value *value;
+ GNUNET_DatastoreValue *value;
i = *(int *) closure;
value = initValue (i);
@@ -78,7 +78,7 @@
}
static int
-iterateUp (const GNUNET_HashCode * key, const Datastore_Value * val,
+iterateUp (const GNUNET_HashCode * key, const GNUNET_DatastoreValue * val,
int *closure, unsigned long long uid)
{
int ret;
@@ -90,7 +90,7 @@
static int
iterateDown (const GNUNET_HashCode * key,
- const Datastore_Value * val, int *closure,
+ const GNUNET_DatastoreValue * val, int *closure,
unsigned long long uid)
{
int ret;
@@ -102,7 +102,7 @@
static int
iterateDelete (const GNUNET_HashCode * key,
- const Datastore_Value * val, void *closure,
+ const GNUNET_DatastoreValue * val, void *closure,
unsigned long long uid)
{
return GNUNET_NO;
@@ -110,7 +110,7 @@
static int
iteratePriority (const GNUNET_HashCode * key,
- const Datastore_Value * val, SQstore_ServiceAPI * api,
+ const GNUNET_DatastoreValue * val, GNUNET_SQstore_ServiceAPI
* api,
unsigned long long uid)
{
api->update (uid, 4, 0);
@@ -119,7 +119,7 @@
static int
priorityCheck (const GNUNET_HashCode * key,
- const Datastore_Value * val, int *closure,
+ const GNUNET_DatastoreValue * val, int *closure,
unsigned long long uid)
{
int id;
@@ -133,7 +133,7 @@
static int
multipleCheck (const GNUNET_HashCode * key,
- const Datastore_Value * val, Datastore_Value ** last,
+ const GNUNET_DatastoreValue * val, GNUNET_DatastoreValue **
last,
unsigned long long uid)
{
if (*last != NULL)
@@ -153,9 +153,9 @@
* Add testcode here!
*/
static int
-test (SQstore_ServiceAPI * api)
+test (GNUNET_SQstore_ServiceAPI * api)
{
- Datastore_Value *value;
+ GNUNET_DatastoreValue *value;
GNUNET_HashCode key;
unsigned long long oldSize;
int i;
@@ -170,8 +170,8 @@
GNUNET_free (value);
}
ASSERT (oldSize < api->getSize ());
- ASSERT (256 == api->iterateLowPriority (ANY_BLOCK, NULL, NULL));
- ASSERT (256 == api->iterateExpirationTime (ANY_BLOCK, NULL, NULL));
+ ASSERT (256 == api->iterateLowPriority (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
NULL, NULL));
+ ASSERT (256 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
NULL, NULL));
for (i = 255; i >= 0; i--)
{
memset (&key, 256 - i, sizeof (GNUNET_HashCode));
@@ -188,31 +188,31 @@
}
ASSERT (oldSize > api->getSize ());
i = 0;
- ASSERT (128 == api->iterateLowPriority (ANY_BLOCK,
- (Datum_Iterator) & iterateUp, &i));
+ ASSERT (128 == api->iterateLowPriority (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ (GNUNET_DatastoreValueIterator) &
iterateUp, &i));
ASSERT (256 == i);
- ASSERT (128 == api->iterateExpirationTime (ANY_BLOCK,
- (Datum_Iterator) & iterateDown,
+ ASSERT (128 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ (GNUNET_DatastoreValueIterator) &
iterateDown,
&i));
ASSERT (0 == i);
- ASSERT (128 == api->iterateExpirationTime (ANY_BLOCK,
- (Datum_Iterator) & iterateDelete,
+ ASSERT (128 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ (GNUNET_DatastoreValueIterator) &
iterateDelete,
api));
- ASSERT (0 == api->iterateExpirationTime (ANY_BLOCK,
- (Datum_Iterator) & iterateDown,
+ ASSERT (0 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ (GNUNET_DatastoreValueIterator) &
iterateDown,
&i));
i = 42;
value = initValue (i);
memset (&key, 256 - i, sizeof (GNUNET_HashCode));
api->put (&key, value);
- ASSERT (1 == api->iterateExpirationTime (ANY_BLOCK,
- (Datum_Iterator) & priorityCheck,
+ ASSERT (1 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ (GNUNET_DatastoreValueIterator) &
priorityCheck,
&i));
- ASSERT (1 == api->iterateAllNow ((Datum_Iterator) & iteratePriority, api));
+ ASSERT (1 == api->iterateAllNow ((GNUNET_DatastoreValueIterator) &
iteratePriority, api));
i += 4;
- ASSERT (1 == api->iterateExpirationTime (ANY_BLOCK,
- (Datum_Iterator) & priorityCheck,
+ ASSERT (1 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ (GNUNET_DatastoreValueIterator) &
priorityCheck,
&i));
GNUNET_free (value);
@@ -222,12 +222,12 @@
GNUNET_free (value);
value = NULL;
- ASSERT (2 == api->iterateExpirationTime (ANY_BLOCK,
- (Datum_Iterator) & multipleCheck,
+ ASSERT (2 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
+ (GNUNET_DatastoreValueIterator) &
multipleCheck,
&value));
GNUNET_free (value);
- ASSERT (2 == api->iterateAllNow ((Datum_Iterator) & iterateDelete, api));
- ASSERT (0 == api->iterateExpirationTime (ANY_BLOCK, NULL, NULL));
+ ASSERT (2 == api->iterateAllNow ((GNUNET_DatastoreValueIterator) &
iterateDelete, api));
+ ASSERT (0 == api->iterateExpirationTime (GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY,
NULL, NULL));
api->drop ();
return GNUNET_OK;
@@ -240,15 +240,15 @@
int
main (int argc, char *argv[])
{
- SQstore_ServiceAPI *api;
+ GNUNET_SQstore_ServiceAPI *api;
int ok;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
struct GNUNET_CronManager *cron;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
cron = cron_create (NULL);
@@ -263,7 +263,7 @@
ok = GNUNET_SYSERR;
doneCore ();
GNUNET_cron_destroy (cron);
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
if (ok == GNUNET_SYSERR)
return 1;
return 0;
Modified: GNUnet/src/applications/sqstore_sqlite/sqlitetest2.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlitetest2.c 2007-11-25
03:50:33 UTC (rev 5754)
+++ GNUnet/src/applications/sqstore_sqlite/sqlitetest2.c 2007-11-25
12:04:45 UTC (rev 5755)
@@ -124,18 +124,18 @@
static GNUNET_CronTime start_time;
static int
-putValue (SQstore_ServiceAPI * api, int i)
+putValue (GNUNET_SQstore_ServiceAPI * api, int i)
{
- Datastore_Value *value;
+ GNUNET_DatastoreValue *value;
size_t size;
static GNUNET_HashCode key;
static int ic;
/* most content is 32k */
- size = sizeof (Datastore_Value) + 32 * 1024;
+ size = sizeof (GNUNET_DatastoreValue) + 32 * 1024;
if (GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 16) == 0) /* but some of
it is less! */
size =
- sizeof (Datastore_Value) +
+ sizeof (GNUNET_DatastoreValue) +
GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 32 * 1024);
size = size - (size & 7); /* always multiple of 8 */
@@ -149,7 +149,7 @@
value->expirationTime =
GNUNET_htonll (GNUNET_get_time () +
GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 1000));
- memset (&value[1], i, size - sizeof (Datastore_Value));
+ memset (&value[1], i, size - sizeof (GNUNET_DatastoreValue));
if (GNUNET_OK != api->put (&key, value))
{
GNUNET_free (value);
@@ -170,9 +170,9 @@
static int
iterateDelete (const GNUNET_HashCode * key,
- const Datastore_Value * val, void *cls, unsigned long long uid)
+ const GNUNET_DatastoreValue * val, void *cls, unsigned long
long uid)
{
- SQstore_ServiceAPI *api = cls;
+ GNUNET_SQstore_ServiceAPI *api = cls;
static int dc;
if (api->getSize () < MAX_SIZE)
@@ -193,7 +193,7 @@
* Add testcode here!
*/
static int
-test (SQstore_ServiceAPI * api)
+test (GNUNET_SQstore_ServiceAPI * api)
{
int i;
int j;
@@ -249,15 +249,15 @@
int
main (int argc, char *argv[])
{
- SQstore_ServiceAPI *api;
+ GNUNET_SQstore_ServiceAPI *api;
int ok;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
struct GNUNET_CronManager *cron;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
cron = cron_create (NULL);
@@ -273,7 +273,7 @@
ok = GNUNET_SYSERR;
doneCore ();
GNUNET_cron_destroy (cron);
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
if (ok == GNUNET_SYSERR)
return 1;
return 0;
Modified: GNUnet/src/applications/sqstore_sqlite/sqlitetest3.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlitetest3.c 2007-11-25
03:50:33 UTC (rev 5754)
+++ GNUnet/src/applications/sqstore_sqlite/sqlitetest3.c 2007-11-25
12:04:45 UTC (rev 5755)
@@ -56,19 +56,19 @@
static GNUNET_CronTime start_time;
static int
-putValue (SQstore_ServiceAPI * api, int i)
+putValue (GNUNET_SQstore_ServiceAPI * api, int i)
{
- Datastore_Value *value;
+ GNUNET_DatastoreValue *value;
size_t size;
static GNUNET_HashCode key;
static int ic;
/* most content is 32k */
- size = sizeof (Datastore_Value) + 32 * 1024;
+ size = sizeof (GNUNET_DatastoreValue) + 32 * 1024;
if (GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 16) == 0) /* but some of
it is less! */
size =
- sizeof (Datastore_Value) +
+ sizeof (GNUNET_DatastoreValue) +
GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 32 * 1024);
size = size - (size & 7); /* always multiple of 8 */
@@ -83,7 +83,7 @@
value->expirationTime =
GNUNET_htonll (GNUNET_get_time () + 60 * GNUNET_CRON_HOURS +
GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 1000));
- memset (&value[1], i, size - sizeof (Datastore_Value));
+ memset (&value[1], i, size - sizeof (GNUNET_DatastoreValue));
if (GNUNET_OK != api->put (&key, value))
{
GNUNET_free (value);
@@ -99,7 +99,7 @@
}
static int
-iterateDummy (const GNUNET_HashCode * key, const Datastore_Value * val,
+iterateDummy (const GNUNET_HashCode * key, const GNUNET_DatastoreValue * val,
void *cls, unsigned long long uid)
{
if (GNUNET_shutdown_test () == GNUNET_YES)
@@ -108,7 +108,7 @@
}
static int
-test (SQstore_ServiceAPI * api)
+test (GNUNET_SQstore_ServiceAPI * api)
{
int i;
int j;
@@ -174,15 +174,15 @@
int
main (int argc, char *argv[])
{
- SQstore_ServiceAPI *api;
+ GNUNET_SQstore_ServiceAPI *api;
int ok;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
struct GNUNET_CronManager *cron;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
cron = cron_create (NULL);
@@ -198,7 +198,7 @@
ok = GNUNET_SYSERR;
doneCore ();
GNUNET_cron_destroy (cron);
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
if (ok == GNUNET_SYSERR)
return 1;
return 0;
Modified: GNUnet/src/applications/state/state.c
===================================================================
--- GNUnet/src/applications/state/state.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/state/state.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -51,7 +51,7 @@
* @return the number of bytes read on success, -1 on failure
*/
static int
-stateReadContent (struct GE_Context *ectx, const char *name, void **result)
+stateReadContent (struct GNUNET_GE_Context *ectx, const char *name, void
**result)
{
/* open file, must exist, open read only */
char *dbh = handle;
@@ -61,7 +61,7 @@
unsigned long long fsize;
size_t n;
- GE_ASSERT (ectx, handle != NULL);
+ GNUNET_GE_ASSERT (ectx, handle != NULL);
if (result == NULL)
return -1;
n = strlen (dbh) + strlen (name) + 2;
@@ -101,7 +101,7 @@
* @return GNUNET_SYSERR on error, GNUNET_OK if ok.
*/
static int
-stateAppendContent (struct GE_Context *ectx,
+stateAppendContent (struct GNUNET_GE_Context *ectx,
const char *name, int len, const void *block)
{
char *dbh = handle;
@@ -109,15 +109,15 @@
int fd;
size_t n;
- GE_ASSERT (ectx, handle != NULL);
+ GNUNET_GE_ASSERT (ectx, handle != NULL);
n = strlen (dbh) + strlen (name) + 2;
fil = GNUNET_malloc (n);
GNUNET_snprintf (fil, n, "%s/%s", dbh, name);
fd = GNUNET_disk_file_open (ectx, fil, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
if (fd == -1)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_BULK | GE_USER, "open", fil);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK |
GNUNET_GE_USER, "open", fil);
GNUNET_free (fil);
return GNUNET_SYSERR; /* failed! */
}
@@ -137,7 +137,7 @@
* @return GNUNET_SYSERR on error, GNUNET_OK if ok.
*/
static int
-stateWriteContent (struct GE_Context *ectx,
+stateWriteContent (struct GNUNET_GE_Context *ectx,
const char *name, int len, const void *block)
{
char *dbh = handle;
@@ -145,22 +145,22 @@
int fd;
size_t n;
- GE_ASSERT (ectx, handle != NULL);
+ GNUNET_GE_ASSERT (ectx, handle != NULL);
n = strlen (dbh) + strlen (name) + 2;
fil = GNUNET_malloc (n);
GNUNET_snprintf (fil, n, "%s/%s", dbh, name);
fd = GNUNET_disk_file_open (ectx, fil, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
if (fd == -1)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_BULK | GE_USER, "open", fil);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK |
GNUNET_GE_USER, "open", fil);
GNUNET_free (fil);
return GNUNET_SYSERR; /* failed! */
}
WRITE (fd, block, len);
if (0 != FTRUNCATE (fd, len))
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_BULK | GE_ADMIN, "ftruncate", fil);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK |
GNUNET_GE_ADMIN, "ftruncate", fil);
GNUNET_disk_file_close (ectx, fil, fd);
GNUNET_free (fil);
return GNUNET_OK;
@@ -172,13 +172,13 @@
* (without directory)
*/
static int
-stateUnlinkFromDB (struct GE_Context *ectx, const char *name)
+stateUnlinkFromDB (struct GNUNET_GE_Context *ectx, const char *name)
{
char *dbh = handle;
char *fil;
size_t n;
- GE_ASSERT (ectx, handle != NULL);
+ GNUNET_GE_ASSERT (ectx, handle != NULL);
n = strlen (dbh) + strlen (name) + 2;
fil = GNUNET_malloc (n);
GNUNET_snprintf (fil, n, "%s/%s", dbh, name);
@@ -187,21 +187,21 @@
return GNUNET_OK;
}
-State_ServiceAPI *
-provide_module_state (CoreAPIForApplication * capi)
+GNUNET_State_ServiceAPI *
+provide_module_state (GNUNET_CoreAPIForPlugins * capi)
{
- static State_ServiceAPI api;
+ static GNUNET_State_ServiceAPI api;
char *dbh;
size_t n;
dbh = NULL;
- if (-1 == GC_get_configuration_value_filename (capi->cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_filename (capi->cfg,
"GNUNETD",
"GNUNETD_HOME",
- VAR_DAEMON_DIRECTORY, &dbh))
+
GNUNET_DEFAULT_DAEMON_VAR_DIRECTORY, &dbh))
return NULL;
- GE_ASSERT (capi->ectx, dbh != NULL);
+ GNUNET_GE_ASSERT (capi->ectx, dbh != NULL);
n = strlen (dbh) + strlen (DIR_EXT) + 5;
handle = GNUNET_malloc (n);
GNUNET_snprintf (handle, n, "%s/%s/", dbh, DIR_EXT);
@@ -225,7 +225,7 @@
void
release_module_state ()
{
- GE_ASSERT (NULL, handle != NULL);
+ GNUNET_GE_ASSERT (NULL, handle != NULL);
GNUNET_free (handle);
handle = NULL;
}
Modified: GNUnet/src/applications/stats/clientapi.c
===================================================================
--- GNUnet/src/applications/stats/clientapi.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/stats/clientapi.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -35,96 +35,96 @@
* Return a descriptive name for a p2p message type
*/
const char *
-STATS_p2pMessageName (unsigned short type)
+GNUNET_STATS_p2p_message_type_to_string (unsigned short type)
{
const char *name = NULL;
switch (type)
{
- case p2p_PROTO_hello:
+ case GNUNET_P2P_PROTO_HELLO:
name = "p2p_PROTO_hello";
break;
- case P2P_PROTO_setkey:
+ case GNUNET_P2P_PROTO_SET_KEY:
name = "P2P_PROTO_setkey";
break;
- case p2p_PROTO_PING:
+ case GNUNET_P2P_PROTO_PING:
name = "p2p_PROTO_PING";
break;
- case p2p_PROTO_PONG:
+ case GNUNET_P2P_PROTO_PONG:
name = "p2p_PROTO_PONG";
break;
- case P2P_PROTO_hangup:
+ case GNUNET_P2P_PROTO_HANG_UP:
name = "P2P_PROTO_hangup";
break;
- case P2P_PROTO_fragment:
+ case GNUNET_P2P_PROTO_MESSAGNUNET_GE_FRAGMENT:
name = "P2P_PROTO_fragment";
break;
- case P2P_PROTO_noise:
+ case GNUNET_P2P_PROTO_NOISE:
name = "P2P_PROTO_noise";
break;
- case P2P_PROTO_gap_QUERY:
+ case GNUNET_P2P_PROTO_GAP_QUERY:
name = "P2P_PROTO_gap_QUERY";
break;
- case P2P_PROTO_gap_RESULT:
+ case GNUNET_P2P_PROTO_GAP_RESULT:
name = "P2P_PROTO_gap_RESULT";
break;
- case P2P_PROTO_chat_MSG:
+ case GNUNET_P2P_PROTO_CHAT_MSG:
name = "P2P_PROTO_chat_MSG";
break;
- case P2P_PROTO_tracekit_PROBE:
+ case GNUNET_P2P_PROTO_TRACEKIT_PROBE:
name = "P2P_PROTO_tracekit_PROBE";
break;
- case P2P_PROTO_tracekit_REPLY:
+ case GNUNET_P2P_PROTO_TRACEKIT_REPLY:
name = "P2P_PROTO_tracekit_REPLY";
break;
- case P2P_PROTO_tbench_REQUEST:
+ case GNUNET_P2P_PROTO_TBENCH_REQUEST:
name = "P2P_PROTO_tbench_REQUEST";
break;
- case P2P_PROTO_tbench_REPLY:
+ case GNUNET_P2P_PROTO_TBENCH_REPLY:
name = "P2P_PROTO_tbench_REPLY";
break;
- case P2P_PROTO_rpc_REQ:
- name = "P2P_PROTO_rpc_REQ";
+ case GNUNET_P2P_PROTO_RPC_REQ:
+ name = "GNUNET_P2P_PROTO_RPC_REQ";
break;
- case P2P_PROTO_rpc_RES:
- name = "P2P_PROTO_rpc_RES";
+ case GNUNET_P2P_PROTO_RPC_RES:
+ name = "GNUNET_P2P_PROTO_RPC_RES";
break;
- case P2P_PROTO_rpc_ACK:
- name = "P2P_PROTO_rpc_ACK";
+ case GNUNET_P2P_PROTO_RPC_ACK:
+ name = "GNUNET_P2P_PROTO_RPC_ACK";
break;
- case P2P_PROTO_DHT_DISCOVERY:
- name = "P2P_PROTO_DHT_DISCOVERY";
+ case GNUNET_P2P_PROTO_DHT_DISCOVERY:
+ name = "GNUNET_P2P_PROTO_DHT_DISCOVERY";
break;
- case P2P_PROTO_DHT_ASK_HELLO:
- name = "P2P_PROTO_DHT_ASK_HELLO";
+ case GNUNET_P2P_PROTO_DHT_ASK_HELLO:
+ name = "GNUNET_P2P_PROTO_DHT_ASK_HELLO";
break;
- case P2P_PROTO_DHT_GET:
- name = "P2P_PROTO_DHT_GET";
+ case GNUNET_P2P_PROTO_DHT_GET:
+ name = "GNUNET_P2P_PROTO_DHT_GET";
break;
- case P2P_PROTO_DHT_PUT:
- name = "P2P_PROTO_DHT_PUT";
+ case GNUNET_P2P_PROTO_DHT_PUT:
+ name = "GNUNET_P2P_PROTO_DHT_PUT";
break;
- case P2P_PROTO_DHT_RESULT:
- name = "P2P_PROTO_DHT_RESULT";
+ case GNUNET_P2P_PROTO_DHT_RESULT:
+ name = "GNUNET_P2P_PROTO_DHT_RESULT";
break;
- case P2P_PROTO_aip_IP:
- name = "P2P_PROTO_aip_IP";
+ case GNUNET_P2P_PROTO_AIP_IP:
+ name = "GNUNET_P2P_PROTO_AIP_IP";
break;
- case P2P_PROTO_aip_ROUTE:
- name = "P2P_PROTO_aip_ROUTE";
+ case GNUNET_P2P_PROTO_AIP_ROUTE:
+ name = "GNUNET_P2P_PROTO_AIP_ROUTE";
break;
- case P2P_PROTO_aip_ROUTES:
- name = "P2P_PROTO_aip_ROUTES";
+ case GNUNET_P2P_PROTO_AIP_ROUTES:
+ name = "GNUNET_P2P_PROTO_AIP_ROUTES";
break;
- case P2P_PROTO_aip_GETROUTE:
- name = "P2P_PROTO_aip_GETROUTE";
+ case GNUNET_P2P_PROTO_AIP_GETROUTE:
+ name = "GNUNET_P2P_PROTO_AIP_GETROUTE";
break;
default:
@@ -139,141 +139,141 @@
* Return a descriptive name for a client server message type
*/
const char *
-STATS_csMessageName (unsigned short type)
+GNUNET_STATS_cs_message_type_to_string (unsigned short type)
{
const char *name = NULL;
switch (type)
{
- case CS_PROTO_RETURN_VALUE:
+ case GNUNET_CS_PROTO_RETURN_VALUE:
name = "CS_PROTO_RETURN_VALUE";
break;
- case CS_PROTO_SHUTDOWN_REQUEST:
+ case GNUNET_CS_PROTO_SHUTDOWN_REQUEST:
name = "CS_PROTO_SHUTDOWN_REQUEST";
break;
- case CS_PROTO_GET_OPTION_REQUEST:
+ case GNUNET_CS_PROTO_GET_OPTION_REQUEST:
name = "CS_PROTO_GET_OPTION_REQUEST";
break;
- case CS_PROTO_GET_OPTION_REPLY:
+ case GNUNET_CS_PROTO_GET_OPTION_REPLY:
name = "CS_PROTO_GET_OPTION_REPLY";
break;
- case CS_PROTO_RETURN_ERROR:
+ case GNUNET_CS_PROTO_RETURN_ERROR:
name = "CS_PROTO_RETURN_ERROR";
break;
- case CS_PROTO_gap_QUERY_START:
+ case GNUNET_CS_PROTO_GAP_QUERY_START:
name = "CS_PROTO_gap_QUERY_START";
break;
- case CS_PROTO_gap_QUERY_STOP:
- /* case CS_PROTO_gap_RESULT : */
+ case GNUNET_CS_PROTO_GAP_QUERY_STOP:
+ /* case GNUNET_CS_PROTO_GAP_RESULT : */
name = "CS_PROTO_gap_QUERY_STOP or CS_PROTO_gap_RESULT";
break;
- case CS_PROTO_gap_INSERT:
+ case GNUNET_CS_PROTO_GAP_INSERT:
name = "CS_PROTO_gap_INSERT";
break;
- case CS_PROTO_gap_INDEX:
+ case GNUNET_CS_PROTO_GAP_INDEX:
name = "CS_PROTO_gap_INDEX";
break;
- case CS_PROTO_gap_DELETE:
+ case GNUNET_CS_PROTO_GAP_DELETE:
name = "CS_PROTO_gap_DELETE";
break;
- case CS_PROTO_gap_UNINDEX:
+ case GNUNET_CS_PROTO_GAP_UNINDEX:
name = "CS_PROTO_gap_UNINDEX";
break;
- case CS_PROTO_gap_TESTINDEX:
+ case GNUNET_CS_PROTO_GAP_TESTINDEX:
name = "CS_PROTO_gap_TESTINDEX";
break;
- case CS_PROTO_gap_GET_AVG_PRIORITY:
+ case GNUNET_CS_PROTO_GAP_GET_AVG_PRIORITY:
name = "CS_PROTO_gap_GET_AVG_PRIORITY";
break;
- case CS_PROTO_gap_INIT_INDEX:
+ case GNUNET_CS_PROTO_GAP_INIT_INDEX:
name = "CS_PROTO_gap_INIT_INDEX";
break;
- case CS_PROTO_traffic_COUNT:
- name = "CS_PROTO_traffic_COUNT";
+ case GNUNET_CS_PROTO_TRAFFIC_COUNT:
+ name = "GNUNET_CS_PROTO_TRAFFIC_COUNT";
break;
- case CS_PROTO_traffic_QUERY:
- name = "CS_PROTO_traffic_QUERY";
+ case GNUNET_CS_PROTO_TRAFFIC_QUERY:
+ name = "GNUNET_CS_PROTO_TRAFFIC_QUERY";
break;
- case CS_PROTO_traffic_INFO:
- name = "CS_PROTO_traffic_INFO";
+ case GNUNET_CS_PROTO_TRAFFIC_INFO:
+ name = "GNUNET_CS_PROTO_TRAFFIC_INFO";
break;
- case CS_PROTO_stats_GET_STATISTICS:
- name = "CS_PROTO_stats_GET_STATISTICS";
+ case GNUNET_CS_PROTO_STATS_GET_STATISTICS:
+ name = "GNUNET_CS_PROTO_STATS_GET_STATISTICS";
break;
- case CS_PROTO_stats_STATISTICS:
- name = "CS_PROTO_stats_STATISTICS";
+ case GNUNET_CS_PROTO_STATS_STATISTICS:
+ name = "GNUNET_CS_PROTO_STATS_STATISTICS";
break;
- case CS_PROTO_stats_GET_CS_MESSAGE_SUPPORTED:
- name = "CS_PROTO_stats_GET_CS_MESSAGE_SUPPORTED";
+ case GNUNET_CS_PROTO_STATS_GET_CS_MESSAGNUNET_GE_SUPPORTED:
+ name = "GNUNET_CS_PROTO_STATS_GET_CS_MESSAGNUNET_GE_SUPPORTED";
break;
- case CS_PROTO_stats_GET_P2P_MESSAGE_SUPPORTED:
- name = "CS_PROTO_stats_GET_P2P_MESSAGE_SUPPORTED";
+ case GNUNET_CS_PROTO_STATS_GET_P2P_MESSAGNUNET_GE_SUPPORTED:
+ name = "GNUNET_CS_PROTO_STATS_GET_P2P_MESSAGNUNET_GE_SUPPORTED";
break;
- case CS_PROTO_tbench_REQUEST:
- name = "CS_PROTO_tbench_REQUEST";
+ case GNUNET_CS_PROTO_TBENCH_REQUEST:
+ name = "GNUNET_CS_PROTO_TBENCH_REQUEST";
break;
- case CS_PROTO_tbench_REPLY:
- name = "CS_PROTO_tbench_REPLY";
+ case GNUNET_CS_PROTO_TBENCH_REPLY:
+ name = "GNUNET_CS_PROTO_TBENCH_REPLY";
break;
- case CS_PROTO_tracekit_PROBE:
- name = "CS_PROTO_tracekit_PROBE";
+ case GNUNET_CS_PROTO_TRACEKIT_PROBE:
+ name = "GNUNET_CS_PROTO_TRACEKIT_PROBE";
break;
- case CS_PROTO_tracekit_REPLY:
- name = "CS_PROTO_tracekit_REPLY";
+ case GNUNET_CS_PROTO_TRACEKIT_REPLY:
+ name = "GNUNET_CS_PROTO_TRACEKIT_REPLY";
break;
- case CS_PROTO_chat_MSG:
- name = "CS_PROTO_chat_MSG";
+ case GNUNET_CS_PROTO_CHAT_MSG:
+ name = "GNUNET_CS_PROTO_CHAT_MSG";
break;
- case CS_PROTO_dht_REQUEST_GET:
- name = "CS_PROTO_dht_REQUEST_GET";
+ case GNUNET_CS_PROTO_DHT_REQUEST_GET:
+ name = "GNUNET_CS_PROTO_DHT_REQUEST_GET";
break;
- case CS_PROTO_dht_REQUEST_PUT:
- name = "CS_PROTO_dht_REQUEST_PUT";
+ case GNUNET_CS_PROTO_DHT_REQUEST_PUT:
+ name = "GNUNET_CS_PROTO_DHT_REQUEST_PUT";
break;
- case CS_PROTO_testbed_REQUEST:
- name = "CS_PROTO_testbed_REQUEST";
+ case GNUNET_CS_PROTO_TESTBED_REQUEST:
+ name = "GNUNET_CS_PROTO_TESTBED_REQUEST";
break;
- case CS_PROTO_testbed_REPLY:
- name = "CS_PROTO_testbed_REPLY";
+ case GNUNET_CS_PROTO_TESTBED_REPLY:
+ name = "GNUNET_CS_PROTO_TESTBED_REPLY";
break;
- case CS_PROTO_VPN_MSG:
- name = "CS_PROTO_VPN_MSG";
+ case GNUNET_CS_PROTO_VPN_MSG:
+ name = "GNUNET_CS_PROTO_VPN_MSG";
break;
- case CS_PROTO_VPN_REPLY:
- name = "CS_PROTO_VPN_REPLY";
+ case GNUNET_CS_PROTO_VPN_REPLY:
+ name = "GNUNET_CS_PROTO_VPN_REPLY";
break;
- case CS_PROTO_VPN_DEBUGOFF:
- name = "CS_PROTO_VPN_DEBUGOFF";
+ case GNUNET_CS_PROTO_VPN_DEBUGOFF:
+ name = "GNUNET_CS_PROTO_VPN_DEBUGOFF";
break;
- case CS_PROTO_VPN_TUNNELS:
- name = "CS_PROTO_VPN_TUNNELS";
+ case GNUNET_CS_PROTO_VPN_TUNNELS:
+ name = "GNUNET_CS_PROTO_VPN_TUNNELS";
break;
- case CS_PROTO_VPN_ROUTES:
- name = "CS_PROTO_VPN_ROUTES";
+ case GNUNET_CS_PROTO_VPN_ROUTES:
+ name = "GNUNET_CS_PROTO_VPN_ROUTES";
break;
- case CS_PROTO_VPN_REALISED:
- name = "CS_PROTO_VPN_REALISED";
+ case GNUNET_CS_PROTO_VPN_REALISED:
+ name = "GNUNET_CS_PROTO_VPN_REALISED";
break;
- case CS_PROTO_VPN_RESET:
- name = "CS_PROTO_VPN_RESET";
+ case GNUNET_CS_PROTO_VPN_RESET:
+ name = "GNUNET_CS_PROTO_VPN_RESET";
break;
- case CS_PROTO_VPN_REALISE:
- name = "CS_PROTO_VPN_REALISE";
+ case GNUNET_CS_PROTO_VPN_REALISE:
+ name = "GNUNET_CS_PROTO_VPN_REALISE";
break;
- case CS_PROTO_VPN_ADD:
- name = "CS_PROTO_VPN_ADD";
+ case GNUNET_CS_PROTO_VPN_ADD:
+ name = "GNUNET_CS_PROTO_VPN_ADD";
break;
- case CS_PROTO_VPN_TRUST:
- name = "CS_PROTO_VPN_TRUST";
+ case GNUNET_CS_PROTO_VPN_TRUST:
+ name = "GNUNET_CS_PROTO_VPN_TRUST";
break;
default:
@@ -290,9 +290,9 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
int
-STATS_getStatistics (struct GE_Context *ectx,
+GNUNET_STATS_get_statistics (struct GNUNET_GE_Context *ectx,
struct GNUNET_ClientServerConnection *sock,
- STATS_StatProcessor processor, void *cls)
+ GNUNET_STATS_StatisticsProcessor processor, void *cls)
{
CS_stats_reply_MESSAGE *statMsg;
GNUNET_MessageHeader csHdr;
@@ -303,7 +303,7 @@
ret = GNUNET_OK;
csHdr.size = htons (sizeof (GNUNET_MessageHeader));
- csHdr.type = htons (CS_PROTO_stats_GET_STATISTICS);
+ csHdr.type = htons (GNUNET_CS_PROTO_STATS_GET_STATISTICS);
if (GNUNET_SYSERR == GNUNET_client_connection_write (sock, &csHdr))
return GNUNET_SYSERR;
statMsg = GNUNET_malloc (sizeof (CS_stats_reply_MESSAGE));
@@ -322,7 +322,7 @@
if ((ntohs (statMsg->header.size) < sizeof (CS_stats_reply_MESSAGE)) ||
(((char *) statMsg)[ntohs (statMsg->header.size) - 1] != '\0'))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
ret = GNUNET_SYSERR;
break;
}
@@ -340,11 +340,11 @@
if (mpos +
strlen (&
((char
- *) (((CS_stats_reply_MESSAGE_GENERIC *) statMsg)->
+ *) (((CS_stats_reply_MESSAGNUNET_GE_GENERIC *)
statMsg)->
values))[mpos]) + 1 >
ntohs (statMsg->header.size) - sizeof (CS_stats_reply_MESSAGE))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
ret = GNUNET_SYSERR;
break; /* out of bounds! */
}
@@ -353,14 +353,14 @@
ret =
processor (&
((char
- *) (((CS_stats_reply_MESSAGE_GENERIC *)
+ *) (((CS_stats_reply_MESSAGNUNET_GE_GENERIC *)
statMsg)->values))[mpos],
- GNUNET_ntohll (((CS_stats_reply_MESSAGE_GENERIC *)
+ GNUNET_ntohll
(((CS_stats_reply_MESSAGNUNET_GE_GENERIC *)
statMsg)->values[i]), cls);
}
mpos +=
strlen (&
- ((char *) (((CS_stats_reply_MESSAGE_GENERIC *) statMsg)->
+ ((char *) (((CS_stats_reply_MESSAGNUNET_GE_GENERIC *)
statMsg)->
values))[mpos]) + 1;
}
count += ntohl (statMsg->statCounters);
@@ -377,9 +377,9 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
int
-STATS_getAvailableProtocols (struct GE_Context *ectx,
+GNUNET_STATS_get_available_protocols (struct GNUNET_GE_Context *ectx,
struct GNUNET_ClientServerConnection *sock,
- STATS_ProtocolProcessor processor, void *cls)
+ GNUNET_STATS_ProtocolProcessor processor, void
*cls)
{
CS_stats_get_supported_MESSAGE csStatMsg;
unsigned short i;
@@ -389,7 +389,7 @@
ret = GNUNET_OK;
csStatMsg.header.size = htons (sizeof (CS_stats_get_supported_MESSAGE));
- csStatMsg.header.type = htons (CS_PROTO_stats_GET_P2P_MESSAGE_SUPPORTED);
+ csStatMsg.header.type = htons
(GNUNET_CS_PROTO_STATS_GET_P2P_MESSAGNUNET_GE_SUPPORTED);
for (j = 2; j < 4; j++)
{
csStatMsg.handlerType = htons (j);
Modified: GNUnet/src/applications/stats/gnunet-stats.c
===================================================================
--- GNUnet/src/applications/stats/gnunet-stats.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/stats/gnunet-stats.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -33,7 +33,7 @@
static int lastIp2p = 42; /* not GNUNET_YES or GNUNET_NO */
-static char *cfgFilename = DEFAULT_CLIENT_CONFIG_FILE;
+static char *cfgFilename = GNUNET_DEFAULT_CLIENT_CONFIG_FILE;
/**
* Print statistics received.
@@ -65,9 +65,9 @@
lastIp2p = isP2P;
}
if (isP2P)
- name = STATS_p2pMessageName (type);
+ name = GNUNET_STATS_p2p_message_type_to_string (type);
else
- name = STATS_csMessageName (type);
+ name = GNUNET_STATS_cs_message_type_to_string (type);
if (name == NULL)
fprintf (stream, "\t%d\n", type);
else
@@ -86,7 +86,7 @@
{'p', "protocols", NULL,
gettext_noop ("prints supported protocol messages"),
0, &GNUNET_getopt_configure_set_option, "STATS:PRINT-PROTOCOLS=YES"},
- GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
+ GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGNUNET_GE_VERSION), /* -v */
GNUNET_COMMAND_LINE_OPTION_END,
};
@@ -103,8 +103,8 @@
{
int res;
struct GNUNET_ClientServerConnection *sock;
- struct GC_Configuration *cfg;
- struct GE_Context *ectx;
+ struct GNUNET_GC_Configuration *cfg;
+ struct GNUNET_GE_Context *ectx;
res = GNUNET_init (argc,
argv,
@@ -121,14 +121,14 @@
fprintf (stderr, _("Error establishing connection with gnunetd.\n"));
return 1;
}
- res = STATS_getStatistics (ectx, sock, &printStatistics, stdout);
- if ((GNUNET_YES == GC_get_configuration_value_yesno (cfg,
+ res = GNUNET_STATS_get_statistics (ectx, sock, &printStatistics, stdout);
+ if ((GNUNET_YES == GNUNET_GC_get_configuration_value_yesno (cfg,
"STATS",
"PRINT-PROTOCOLS",
GNUNET_NO))
&& (res == GNUNET_OK))
{
- res = STATS_getAvailableProtocols (ectx, sock, &printProtocols, stdout);
+ res = GNUNET_STATS_get_available_protocols (ectx, sock, &printProtocols,
stdout);
}
if (res != GNUNET_OK)
fprintf (stderr, _("Error reading information from gnunetd.\n"));
Modified: GNUnet/src/applications/stats/sqstats.c
===================================================================
--- GNUnet/src/applications/stats/sqstats.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/stats/sqstats.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -27,7 +27,7 @@
#include "gnunet_sqstore_service.h"
#include "gnunet_protocols.h"
-static SQstore_ServiceAPI *sq;
+static GNUNET_SQstore_ServiceAPI *sq;
/* block types */
static int stat_block[8];
@@ -51,7 +51,7 @@
};
static int
-iter (const GNUNET_HashCode * key, const Datastore_Value * value, void *cls)
+iter (const GNUNET_HashCode * key, const GNUNET_DatastoreValue * value, void
*cls)
{
struct CD *data = cls;
GNUNET_CronTime expire;
@@ -59,25 +59,25 @@
switch (ntohl (value->type))
{
- case ANY_BLOCK:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY:
data->stat_block[0]++;
break;
- case D_BLOCK:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA:
data->stat_block[1]++;
break;
- case S_BLOCK:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_SIGNED:
data->stat_block[2]++;
break;
- case K_BLOCK:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD:
data->stat_block[3]++;
break;
- case N_BLOCK:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_NAMESPACE:
data->stat_block[4]++;
break;
- case KN_BLOCK:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE:
data->stat_block[5]++;
break;
- case ONDEMAND_BLOCK:
+ case GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND:
data->stat_block[6]++;
break;
default:
Modified: GNUnet/src/applications/stats/statistics.c
===================================================================
--- GNUnet/src/applications/stats/statistics.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/stats/statistics.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -77,7 +77,7 @@
/**
* The core API.
*/
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
/**
* Get a handle to a statistical entity.
@@ -89,7 +89,7 @@
statHandle (const char *name)
{
int i;
- GE_ASSERT (NULL, name != NULL);
+ GNUNET_GE_ASSERT (NULL, name != NULL);
GNUNET_mutex_lock (statLock);
for (i = 0; i < statCounters; i++)
if (0 == strcmp (entries[i].description, name))
@@ -118,7 +118,7 @@
GNUNET_mutex_lock (statLock);
if ((handle < 0) || (handle >= statCounters))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
GNUNET_mutex_unlock (statLock);
return;
}
@@ -133,7 +133,7 @@
GNUNET_mutex_lock (statLock);
if ((handle < 0) || (handle >= statCounters))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
GNUNET_mutex_unlock (statLock);
return -1;
}
@@ -155,7 +155,7 @@
GNUNET_mutex_lock (statLock);
if ((handle < 0) || (handle >= statCounters))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
GNUNET_mutex_unlock (statLock);
return;
}
@@ -182,10 +182,10 @@
/**
* Initialize the statistics module.
*/
-Stats_ServiceAPI *
-provide_module_stats (CoreAPIForApplication * capi)
+GNUNET_Stats_ServiceAPI *
+provide_module_stats (GNUNET_CoreAPIForPlugins * capi)
{
- static Stats_ServiceAPI api;
+ static GNUNET_Stats_ServiceAPI api;
coreAPI = capi;
api.create = &statHandle;
@@ -210,8 +210,8 @@
static int stat_bytes_noise_received;
static int stat_connected;
static int stat_handles;
-static Stats_ServiceAPI *stats;
-static CoreAPIForApplication *myCoreAPI;
+static GNUNET_Stats_ServiceAPI *stats;
+static GNUNET_CoreAPIForPlugins *myCoreAPI;
#if HAVE_SQSTATS
#include "sqstats.c"
@@ -273,7 +273,7 @@
* @param originalRequestMessage ignored at this point.
*/
static int
-sendStatistics (struct ClientHandle *sock,
+sendStatistics (struct GNUNET_ClientHandle *sock,
const GNUNET_MessageHeader * originalRequestMessage)
{
CS_stats_reply_MESSAGE *statMsg;
@@ -284,7 +284,7 @@
immediateUpdates ();
statMsg = GNUNET_malloc (GNUNET_MAX_BUFFER_SIZE);
- statMsg->header.type = htons (CS_PROTO_stats_STATISTICS);
+ statMsg->header.type = htons (GNUNET_CS_PROTO_STATS_STATISTICS);
statMsg->totalCounters = htonl (statCounters);
statMsg->statCounters = htons (0);
statMsg->startTime = GNUNET_htonll (startTime);
@@ -308,19 +308,19 @@
end = pos;
/* second pass: copy values and messages to message */
for (pos = start; pos < end; pos++)
- ((CS_stats_reply_MESSAGE_GENERIC *) statMsg)->values[pos - start] =
+ ((CS_stats_reply_MESSAGNUNET_GE_GENERIC *) statMsg)->values[pos -
start] =
GNUNET_htonll (entries[pos].value);
mpos = sizeof (unsigned long long) * (end - start);
for (pos = start; pos < end; pos++)
{
memcpy (&
- ((char *) (((CS_stats_reply_MESSAGE_GENERIC *) statMsg))->
+ ((char *) (((CS_stats_reply_MESSAGNUNET_GE_GENERIC *)
statMsg))->
values)[mpos], entries[pos].description,
entries[pos].descStrLen + 1);
mpos += entries[pos].descStrLen + 1;
}
statMsg->statCounters = htonl (end - start);
- GE_ASSERT (NULL,
+ GNUNET_GE_ASSERT (NULL,
mpos + sizeof (CS_stats_reply_MESSAGE) <
GNUNET_MAX_BUFFER_SIZE);
@@ -341,7 +341,7 @@
* Handle a request to see if a particular p2p message is supported.
*/
static int
-handleMessageSupported (struct ClientHandle *sock,
+handleMessageSupported (struct GNUNET_ClientHandle *sock,
const GNUNET_MessageHeader * message)
{
unsigned short type;
@@ -351,7 +351,7 @@
if (ntohs (message->size) != sizeof (CS_stats_get_supported_MESSAGE))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
cmsg = (CS_stats_get_supported_MESSAGE *) message;
@@ -370,12 +370,12 @@
* @returns GNUNET_OK if ok, GNUNET_SYSERR if not.
*/
static int
-processGetConnectionCountRequest (struct ClientHandle *client,
+processGetConnectionCountRequest (struct GNUNET_ClientHandle *client,
const GNUNET_MessageHeader * msg)
{
if (ntohs (msg->size) != sizeof (GNUNET_MessageHeader))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
return coreAPI->sendValueToClient
@@ -395,36 +395,36 @@
int
-initialize_module_stats (CoreAPIForApplication * capi)
+initialize_module_stats (GNUNET_CoreAPIForPlugins * capi)
{
- GE_ASSERT (capi->ectx, myCoreAPI == NULL);
+ GNUNET_GE_ASSERT (capi->ectx, myCoreAPI == NULL);
myCoreAPI = capi;
stats = capi->requestService ("stats");
if (stats == NULL)
{
- GE_BREAK (capi->ectx, 0);
+ GNUNET_GE_BREAK (capi->ectx, 0);
myCoreAPI = NULL;
return GNUNET_SYSERR;
}
initializeStats ();
- GE_LOG (capi->ectx,
- GE_INFO | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (capi->ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_REQUEST,
_("`%s' registering client handlers %d %d %d and p2p handler %d\n"),
"stats",
- CS_PROTO_traffic_COUNT,
- CS_PROTO_stats_GET_STATISTICS,
- CS_PROTO_stats_GET_P2P_MESSAGE_SUPPORTED, P2P_PROTO_noise);
- capi->registerClientHandler (CS_PROTO_stats_GET_STATISTICS,
+ GNUNET_CS_PROTO_TRAFFIC_COUNT,
+ GNUNET_CS_PROTO_STATS_GET_STATISTICS,
+ GNUNET_CS_PROTO_STATS_GET_P2P_MESSAGNUNET_GE_SUPPORTED,
GNUNET_P2P_PROTO_NOISE);
+ capi->registerClientHandler (GNUNET_CS_PROTO_STATS_GET_STATISTICS,
&sendStatistics);
- capi->registerClientHandler (CS_PROTO_stats_GET_P2P_MESSAGE_SUPPORTED,
+ capi->registerClientHandler
(GNUNET_CS_PROTO_STATS_GET_P2P_MESSAGNUNET_GE_SUPPORTED,
&handleMessageSupported);
- capi->registerClientHandler (CS_PROTO_stats_GET_CS_MESSAGE_SUPPORTED,
+ capi->registerClientHandler
(GNUNET_CS_PROTO_STATS_GET_CS_MESSAGNUNET_GE_SUPPORTED,
&handleMessageSupported);
- capi->registerClientHandler (CS_PROTO_traffic_COUNT,
+ capi->registerClientHandler (GNUNET_CS_PROTO_TRAFFIC_COUNT,
&processGetConnectionCountRequest);
- capi->registerHandler (P2P_PROTO_noise, &processNoise);
- GE_ASSERT (capi->ectx,
- 0 == GC_set_configuration_value_string (capi->cfg,
+ capi->registerHandler (GNUNET_P2P_PROTO_NOISE, &processNoise);
+ GNUNET_GE_ASSERT (capi->ectx,
+ 0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
capi->ectx,
"ABOUT",
"stats",
@@ -443,16 +443,16 @@
#if HAVE_SQSTATS
done_sqstore_stats ();
#endif
- GE_ASSERT (NULL, myCoreAPI != NULL);
- coreAPI->unregisterClientHandler (CS_PROTO_stats_GET_STATISTICS,
+ GNUNET_GE_ASSERT (NULL, myCoreAPI != NULL);
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_STATS_GET_STATISTICS,
&sendStatistics);
- coreAPI->unregisterClientHandler (CS_PROTO_stats_GET_P2P_MESSAGE_SUPPORTED,
+ coreAPI->unregisterClientHandler
(GNUNET_CS_PROTO_STATS_GET_P2P_MESSAGNUNET_GE_SUPPORTED,
&handleMessageSupported);
- coreAPI->unregisterClientHandler (CS_PROTO_stats_GET_CS_MESSAGE_SUPPORTED,
+ coreAPI->unregisterClientHandler
(GNUNET_CS_PROTO_STATS_GET_CS_MESSAGNUNET_GE_SUPPORTED,
&handleMessageSupported);
- coreAPI->unregisterClientHandler (CS_PROTO_traffic_COUNT,
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_TRAFFIC_COUNT,
&processGetConnectionCountRequest);
- coreAPI->unregisterHandler (P2P_PROTO_noise, &processNoise);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_NOISE, &processNoise);
myCoreAPI->releaseService (stats);
stats = NULL;
myCoreAPI = NULL;
Modified: GNUnet/src/applications/stats/statistics.h
===================================================================
--- GNUnet/src/applications/stats/statistics.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/stats/statistics.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -64,7 +64,7 @@
last description is also terminated
by a '\0'; again statCounters entries */
/* char descriptions[0]; */
-} CS_stats_reply_MESSAGE_GENERIC;
+} CS_stats_reply_MESSAGNUNET_GE_GENERIC;
/**
* Query protocol supported message. Contains the type of
Modified: GNUnet/src/applications/tbench/gnunet-tbench.c
===================================================================
--- GNUnet/src/applications/tbench/gnunet-tbench.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/tbench/gnunet-tbench.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -30,14 +30,14 @@
#include "gnunet_util.h"
#include "tbench.h"
-#define DEFAULT_MESSAGE_SIZE 10
+#define DEFAULT_MESSAGNUNET_GE_SIZE 10
#define DEFAULT_TIMEOUT (2 * GNUNET_CRON_SECONDS)
#define DEFAULT_SPACING 0
#define OF_HUMAN_READABLE 0
#define OF_GNUPLOT_INPUT 1
-static unsigned long long messageSize = DEFAULT_MESSAGE_SIZE;
+static unsigned long long messageSize = DEFAULT_MESSAGNUNET_GE_SIZE;
static unsigned long long messageCnt = 1;
@@ -53,7 +53,7 @@
static int outputFormat = OF_HUMAN_READABLE;
-static char *cfgFilename = DEFAULT_CLIENT_CONFIG_FILE;
+static char *cfgFilename = GNUNET_DEFAULT_CLIENT_CONFIG_FILE;
/**
* All gnunet-tbench command line options
@@ -85,7 +85,7 @@
gettext_noop ("time to wait for the completion of an iteration (in ms)"),
1,
&GNUNET_getopt_configure_set_ulong, &messageTimeOut},
- GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
+ GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGNUNET_GE_VERSION), /* -v */
{'X', "xspace", "COUNT",
gettext_noop ("number of messages in a message block"), 1,
&GNUNET_getopt_configure_set_ulong, &messageTrainSize},
@@ -107,8 +107,8 @@
CS_tbench_request_MESSAGE msg;
CS_tbench_reply_MESSAGE *buffer;
float messagesPercentLoss;
- struct GE_Context *ectx;
- struct GC_Configuration *cfg;
+ struct GNUNET_GE_Context *ectx;
+ struct GNUNET_GC_Configuration *cfg;
int res;
res = GNUNET_init (argc,
@@ -129,7 +129,7 @@
}
msg.header.size = htons (sizeof (CS_tbench_request_MESSAGE));
- msg.header.type = htons (CS_PROTO_tbench_REQUEST);
+ msg.header.type = htons (GNUNET_CS_PROTO_TBENCH_REQUEST);
msg.msgSize = htonl (messageSize);
msg.msgCnt = htonl (messageCnt);
msg.iterations = htonl (messageIterations);
@@ -170,12 +170,12 @@
GNUNET_client_connection_read (sock,
(GNUNET_MessageHeader **) & buffer))
{
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
ntohs (buffer->header.size) ==
sizeof (CS_tbench_reply_MESSAGE));
if ((float) buffer->mean_loss < 0)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
messagesPercentLoss = 0.0;
}
else
Modified: GNUnet/src/applications/tbench/tbench.c
===================================================================
--- GNUnet/src/applications/tbench/tbench.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/tbench/tbench.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -73,9 +73,9 @@
*/
static int timeoutOccured;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
static IterationData *results;
@@ -98,11 +98,11 @@
const P2P_tbench_MESSAGE *msg;
#if DEBUG_TBENCH
- GE_LOG (ectx, GE_DEBUG | GE_BULK | GE_USER, "Received tbench request\n");
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_USER,
"Received tbench request\n");
#endif
if (ntohs (message->size) < sizeof (P2P_tbench_MESSAGE))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
msg = (const P2P_tbench_MESSAGE *) message;
@@ -110,20 +110,20 @@
ntohs (message->size) - sizeof (P2P_tbench_MESSAGE))
!= ntohl (msg->crc))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
#if DEBUG_TBENCH
- GE_LOG (ectx,
- GE_DEBUG | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_USER,
"Received request %u from iteration %u/%u\n",
htonl (msg->packetNum),
htonl (msg->iterationNum), htonl (msg->nounce));
#endif
reply = GNUNET_malloc (ntohs (message->size));
memcpy (reply, message, ntohs (message->size));
- reply->type = htons (P2P_PROTO_tbench_REPLY);
+ reply->type = htons (GNUNET_P2P_PROTO_TBENCH_REPLY);
coreAPI->unicast (sender, reply, ntohl (msg->priority), 0); /* no delay */
GNUNET_free (reply);
return GNUNET_OK;
@@ -142,7 +142,7 @@
if (ntohs (message->size) < sizeof (P2P_tbench_MESSAGE))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
pmsg = (const P2P_tbench_MESSAGE *) message;
@@ -150,7 +150,7 @@
ntohs (message->size) - sizeof (P2P_tbench_MESSAGE))
!= ntohl (pmsg->crc))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
GNUNET_mutex_lock (lock);
@@ -175,8 +175,8 @@
}
}
#if DEBUG_TBENCH
- GE_LOG (ectx,
- GE_DEBUG | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_USER,
"Received response %u from iteration %u/%u on time!\n",
htonl (pmsg->packetNum),
htonl (pmsg->iterationNum), htonl (pmsg->nounce));
@@ -185,8 +185,8 @@
else
{
#if DEBUG_TBENCH
- GE_LOG (ectx,
- GE_DEBUG | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_USER,
"Received message %u from iteration %u too late (now at
iteration %u)\n",
ntohl (pmsg->packetNum),
ntohl (pmsg->iterationNum), currIteration);
@@ -211,7 +211,7 @@
* Handle client request (main function)
*/
static int
-csHandleTBenchRequest (struct ClientHandle *client,
+csHandleTBenchRequest (struct GNUNET_ClientHandle *client,
const GNUNET_MessageHeader * message)
{
CS_tbench_request_MESSAGE *msg;
@@ -236,8 +236,8 @@
unsigned int iterations;
#if DEBUG_TBENCH
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
"Tbench received request from client.\n", msgCnt, size, iterations);
#endif
if (ntohs (message->size) != sizeof (CS_tbench_request_MESSAGE))
@@ -251,16 +251,16 @@
iterations = ntohl (msg->iterations);
msgCnt = ntohl (msg->msgCnt);
#if DEBUG_TBENCH
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_BULK,
"Tbench runs %u test messages of size %u in %u iterations.\n",
msgCnt, size, iterations);
#endif
GNUNET_mutex_lock (lock);
if (results != NULL)
{
- GE_LOG (ectx,
- GE_WARNING | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
"Cannot run multiple tbench sessions at the same time!\n");
GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
@@ -270,7 +270,7 @@
p2p = GNUNET_malloc (size);
memset (p2p, 0, size);
p2p->header.size = htons (size);
- p2p->header.type = htons (P2P_PROTO_tbench_REQUEST);
+ p2p->header.type = htons (GNUNET_P2P_PROTO_TBENCH_REQUEST);
p2p->priority = msg->priority;
for (iteration = 0; iteration < iterations; iteration++)
@@ -307,8 +307,8 @@
now = GNUNET_get_time ();
p2p->packetNum = htonl (packetNum);
#if DEBUG_TBENCH
- GE_LOG (ectx,
- GE_DEBUG | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_USER,
"Sending message %u of size %u in iteration %u\n",
packetNum, size, iteration);
#endif
@@ -330,8 +330,8 @@
GNUNET_mutex_unlock (lock);
GNUNET_free (p2p);
#if DEBUG_TBENCH
- GE_LOG (ectx,
- GE_DEBUG | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_USER,
"Done waiting for response.\n", packetNum, size, iteration);
#endif
@@ -371,7 +371,7 @@
/* send collected stats back to client */
reply.header.size = htons (sizeof (CS_tbench_reply_MESSAGE));
- reply.header.type = htons (CS_PROTO_tbench_REPLY);
+ reply.header.type = htons (GNUNET_CS_PROTO_TBENCH_REPLY);
reply.max_loss = htonl (max_loss);
reply.min_loss = htonl (min_loss);
reply.mean_loss = ((float) sum_loss / (float) iterations);
@@ -391,25 +391,25 @@
* @return GNUNET_SYSERR on errors
*/
int
-initialize_module_tbench (CoreAPIForApplication * capi)
+initialize_module_tbench (GNUNET_CoreAPIForPlugins * capi)
{
int ok = GNUNET_OK;
ectx = capi->ectx;
lock = GNUNET_mutex_create (GNUNET_NO);
coreAPI = capi;
- if (GNUNET_SYSERR == capi->registerHandler (P2P_PROTO_tbench_REPLY,
+ if (GNUNET_SYSERR == capi->registerHandler (GNUNET_P2P_PROTO_TBENCH_REPLY,
&handleTBenchReply))
ok = GNUNET_SYSERR;
- if (GNUNET_SYSERR == capi->registerHandler (P2P_PROTO_tbench_REQUEST,
+ if (GNUNET_SYSERR == capi->registerHandler (GNUNET_P2P_PROTO_TBENCH_REQUEST,
&handleTBenchReq))
ok = GNUNET_SYSERR;
- if (GNUNET_SYSERR == capi->registerClientHandler (CS_PROTO_tbench_REQUEST,
+ if (GNUNET_SYSERR == capi->registerClientHandler
(GNUNET_CS_PROTO_TBENCH_REQUEST,
&csHandleTBenchRequest))
ok = GNUNET_SYSERR;
- GE_ASSERT (capi->ectx,
- 0 == GC_set_configuration_value_string (capi->cfg,
+ GNUNET_GE_ASSERT (capi->ectx,
+ 0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
capi->ectx,
"ABOUT",
"tbench",
@@ -422,9 +422,9 @@
void
done_module_tbench ()
{
- coreAPI->unregisterHandler (P2P_PROTO_tbench_REQUEST, &handleTBenchReq);
- coreAPI->unregisterHandler (P2P_PROTO_tbench_REPLY, &handleTBenchReply);
- coreAPI->unregisterClientHandler (CS_PROTO_tbench_REQUEST,
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_TBENCH_REQUEST,
&handleTBenchReq);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_TBENCH_REPLY,
&handleTBenchReply);
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_TBENCH_REQUEST,
&csHandleTBenchRequest);
GNUNET_mutex_destroy (lock);
lock = NULL;
Modified: GNUnet/src/applications/tbench/tbenchtest.c
===================================================================
--- GNUnet/src/applications/tbench/tbenchtest.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/tbench/tbenchtest.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -55,7 +55,7 @@
printf (_("Using %u messages of size %u for %u times.\n"),
messageCnt, messageSize, messageIterations);
msg.header.size = htons (sizeof (CS_tbench_request_MESSAGE));
- msg.header.type = htons (CS_PROTO_tbench_REQUEST);
+ msg.header.type = htons (GNUNET_CS_PROTO_TBENCH_REQUEST);
msg.msgSize = htonl (messageSize);
msg.msgCnt = htonl (messageCnt);
msg.iterations = htonl (messageIterations);
@@ -119,14 +119,14 @@
int ok;
int ret;
struct GNUNET_ClientServerConnection *sock;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
ret = 0;
ok = 1;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#if START_PEERS
@@ -136,7 +136,7 @@
"/tmp/gnunet-tbench-test", 2087, 10000, 2);
if (peers == NULL)
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
#endif
@@ -146,7 +146,7 @@
{
GNUNET_TESTING_stop_daemons (peers);
fprintf (stderr, "Failed to connect the peers!\n");
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
sock = GNUNET_client_connection_create (NULL, cfg);
@@ -174,7 +174,7 @@
if (ok == 0)
ret = 1;
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return ret;
}
Modified: GNUnet/src/applications/template/gnunet-template.c
===================================================================
--- GNUnet/src/applications/template/gnunet-template.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/template/gnunet-template.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -42,7 +42,7 @@
GNUNET_COMMAND_LINE_OPTION_HELP (gettext_noop ("Template description.")),
/* -h */
GNUNET_COMMAND_LINE_OPTION_HOSTNAME, /* -H */
GNUNET_COMMAND_LINE_OPTION_LOGGING, /* -L */
- GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
+ GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGNUNET_GE_VERSION), /* -v */
GNUNET_COMMAND_LINE_OPTION_END,
};
@@ -75,8 +75,8 @@
struct GNUNET_ClientServerConnection *sock;
struct GNUNET_ThreadHandle *messageReceiveThread;
void *unused;
- struct GE_Context *ectx;
- struct GC_Configuration *cfg;
+ struct GNUNET_GE_Context *ectx;
+ struct GNUNET_GC_Configuration *cfg;
int i;
i = GNUNET_init (argc,
@@ -100,8 +100,8 @@
GNUNET_thread_create (&receiveThread, sock, 128 * 1024);
if (messageReceiveThread == NULL)
{
- GE_DIE_STRERROR (ectx,
- GE_IMMEDIATE | GE_FATAL | GE_USER | GE_ADMIN,
+ GNUNET_GE_DIE_STRERROR (ectx,
+ GNUNET_GE_IMMEDIATE | GNUNET_GE_FATAL | GNUNET_GE_USER
| GNUNET_GE_ADMIN,
"pthread_create");
}
Modified: GNUnet/src/applications/template/template.c
===================================================================
--- GNUnet/src/applications/template/template.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/template/template.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -29,8 +29,8 @@
#include "gnunet_core.h"
#include "gnunet_protocols.h"
-static CoreAPIForApplication *coreAPI = NULL;
-static struct ClientHandle *client;
+static GNUNET_CoreAPIForPlugins *coreAPI = NULL;
+static struct GNUNET_ClientHandle *client;
static struct GNUNET_Mutex *lock;
static int
@@ -41,13 +41,13 @@
}
static int
-csHandle (struct ClientHandle *client, const GNUNET_MessageHeader * message)
+csHandle (struct GNUNET_ClientHandle *client, const GNUNET_MessageHeader *
message)
{
return GNUNET_OK;
}
static void
-clientExitHandler (struct ClientHandle *c)
+clientExitHandler (struct GNUNET_ClientHandle *c)
{
GNUNET_mutex_lock (lock);
if (c == client)
@@ -56,7 +56,7 @@
}
int
-initialize_module_template (CoreAPIForApplication * capi)
+initialize_module_template (GNUNET_CoreAPIForPlugins * capi)
{
int ok = GNUNET_OK;
@@ -64,17 +64,17 @@
client = NULL;
coreAPI = capi;
- GE_LOG (capi->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (capi->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("`%s' registering client handler %d and %d\n"),
- "template", CS_PROTO_MAX_USED, P2P_PROTO_MAX_USED);
+ "template", GNUNET_CS_PROTO_MAX_USED, GNUNET_P2P_PROTO_MAX_USED);
if (GNUNET_SYSERR ==
- capi->registerHandler (P2P_PROTO_MAX_USED, &handlep2pMSG))
+ capi->registerHandler (GNUNET_P2P_PROTO_MAX_USED, &handlep2pMSG))
ok = GNUNET_SYSERR;
if (GNUNET_SYSERR == capi->registerClientExitHandler (&clientExitHandler))
ok = GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (CS_PROTO_MAX_USED, &csHandle))
+ capi->registerClientHandler (GNUNET_CS_PROTO_MAX_USED, &csHandle))
ok = GNUNET_SYSERR;
return ok;
}
@@ -82,9 +82,9 @@
void
done_module_template ()
{
- coreAPI->unregisterHandler (P2P_PROTO_MAX_USED, &handlep2pMSG);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_MAX_USED, &handlep2pMSG);
coreAPI->unregisterClientExitHandler (&clientExitHandler);
- coreAPI->unregisterClientHandler (CS_PROTO_MAX_USED, &csHandle);
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_MAX_USED, &csHandle);
GNUNET_mutex_destroy (lock);
coreAPI = NULL;
}
Modified: GNUnet/src/applications/testbed/commands.c
===================================================================
--- GNUnet/src/applications/testbed/commands.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/testbed/commands.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -116,9 +116,9 @@
msgsz = sizeof (TESTBED_CS_MESSAGE) + argSize;
msg = GNUNET_malloc (msgsz);
msg->header.size = htons (msgsz);
- msg->header.type = htons (CS_PROTO_testbed_REQUEST);
+ msg->header.type = htons (GNUNET_CS_PROTO_TESTBED_REQUEST);
msg->msgType = htonl (msgType);
- memcpy (&((TESTBED_CS_MESSAGE_GENERIC *) msg)->data[0], arg, argSize);
+ memcpy (&((TESTBED_CS_MESSAGNUNET_GE_GENERIC *) msg)->data[0], arg, argSize);
msgsz = GNUNET_client_connection_write (&nodes[peer].sock, &msg->header);
GNUNET_free (msg);
if (msgsz == GNUNET_SYSERR)
@@ -217,7 +217,7 @@
hdr = NULL;
if (GNUNET_SYSERR == GNUNET_client_connection_read (&nodes[currindex].sock,
- (CS_MESSAGE_HEADER **) &
+
(CS_MESSAGNUNET_GE_HEADER **) &
hdr))
{
XPRINTF (" peer %s is not responding.\n", nodes[currindex].ips);
@@ -226,7 +226,7 @@
GNUNET_array_grow (nodes, nnodes, nnodes - 1);
return -1;
}
- if ((ntohs (hdr->header.header.type) == CS_PROTO_testbed_REPLY) &&
+ if ((ntohs (hdr->header.header.type) == GNUNET_CS_PROTO_TESTBED_REPLY) &&
(ntohs (hdr->header.header.size) >= sizeof (TESTBED_hello_MESSAGE)) &&
(ntohl (hdr->header.msgType) == TESTBED_hello_RESPONSE) &&
(ntohs (hdr->header.header.size) - sizeof (TESTBED_CS_MESSAGE) >=
@@ -343,7 +343,7 @@
sargv[5] = argv[1]; /* remote hostname */
sargv[6] = NULL; /* last argument */
execvp ("ssh", sargv);
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
" execvp failed: %s\n", STRERROR (errno));
exit (-1);
}
@@ -408,7 +408,7 @@
hdr = NULL;
if (GNUNET_SYSERR == GNUNET_client_connection_read (&nodes[currindex].sock,
- (CS_MESSAGE_HEADER **) &
+
(CS_MESSAGNUNET_GE_HEADER **) &
hdr))
{
XPRINTF (" peer %s is not responding.\n", nodes[currindex].ips);
@@ -420,7 +420,7 @@
GNUNET_array_grow (nodes, nnodes, nnodes - 1);
return -1;
}
- if ((ntohs (hdr->header.header.type) == CS_PROTO_testbed_REPLY) &&
+ if ((ntohs (hdr->header.header.type) == GNUNET_CS_PROTO_TESTBED_REPLY) &&
(ntohs (hdr->header.header.size) >= sizeof (TESTBED_hello_MESSAGE)) &&
(ntohl (hdr->header.msgType) == TESTBED_hello_RESPONSE) &&
(ntohs (hdr->header.header.size) - sizeof (TESTBED_CS_MESSAGE) >=
@@ -1005,7 +1005,7 @@
reply = NULL;
if (GNUNET_SYSERR ==
GNUNET_client_connection_read (&nodes[dst].sock,
- (CS_MESSAGE_HEADER **) & reply))
+ (CS_MESSAGNUNET_GE_HEADER **) &
reply))
{
XPRINTF (" peer %s is not responding after %d of %d bytes.\n",
nodes[dst].ips, pos, ack);
@@ -1017,7 +1017,7 @@
sizeof (TESTBED_OUTPUT_REPLY_MESSAGE);
tmp = GNUNET_malloc (size + 1);
memcpy (tmp,
- &((TESTBED_OUTPUT_REPLY_MESSAGE_GENERIC *) reply)->data[0],
+ &((TESTBED_OUTPUT_REPLY_MESSAGNUNET_GE_GENERIC *)
reply)->data[0],
size);
tmp[size] = '\0';
XPRINTF ("%s", tmp);
@@ -1303,10 +1303,10 @@
TESTBED_FILE_BLK_SIZE);
msg->header.header.size =
htons (sizeof (TESTBED_UPLOAD_FILE_MESSAGE) + flen);
- msg->header.header.type = htons (CS_PROTO_testbed_REQUEST);
+ msg->header.header.type = htons (GNUNET_CS_PROTO_TESTBED_REQUEST);
msg->header.msgType = htonl (TESTBED_UPLOAD_FILE);
msg->type = htonl (TESTBED_FILE_DELETE);
- memcpy (((TESTBED_UPLOAD_FILE_MESSAGE_GENERIC *) msg)->buf, argv[2], flen);
+ memcpy (((TESTBED_UPLOAD_FILE_MESSAGNUNET_GE_GENERIC *) msg)->buf, argv[2],
flen);
if (GNUNET_SYSERR ==
GNUNET_client_connection_write (&nodes[peer].sock, &msg->header.header))
@@ -1333,7 +1333,7 @@
return -1;
}
msg->type = htonl (TESTBED_FILE_GNUNET_array_append);
- buf = ((TESTBED_UPLOAD_FILE_MESSAGE_GENERIC *) msg)->buf + flen;
+ buf = ((TESTBED_UPLOAD_FILE_MESSAGNUNET_GE_GENERIC *) msg)->buf + flen;
while ((nbytes = GN_FREAD (buf, 1,
(TESTBED_FILE_BLK_SIZE -
sizeof (TESTBED_UPLOAD_FILE_MESSAGE) - flen),
@@ -1602,7 +1602,7 @@
hostname[k] = '\0';
#if DEBUG_TESTBED
- GE_LOG (ectx, GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
" Trying to download a hostlist from %s\n", reg);
#endif
Modified: GNUnet/src/applications/testbed/gnunet-testbed.c
===================================================================
--- GNUnet/src/applications/testbed/gnunet-testbed.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/testbed/gnunet-testbed.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -119,7 +119,7 @@
return GNUNET_SYSERR;
}
default:
- GE_LOG (ectx, GE_ERROR | GE_IMMEDIATE | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_IMMEDIATE |
GNUNET_GE_USER,
_("Use --help to get a list of options.\n"));
return -1;
} /* end of parsing commandline */
@@ -169,7 +169,7 @@
res = CONNECT (sock, (struct sockaddr *) &soaddr, sizeof (soaddr));
if ((res < 0) && (errno != EINPROGRESS) && (errno != EWOULDBLOCK))
{
- GE_LOG (ectx, GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("Cannot connect to LOOPBACK port %d: %s\n"),
PORT, STRERROR (errno));
closefile (sock);
@@ -235,7 +235,7 @@
};
configFile = getConfigurationString ("FILES", "gnunet.conf");
- GE_ASSERT (ectx, configFile != NULL);
+ GNUNET_GE_ASSERT (ectx, configFile != NULL);
argv[0] = SHELL;
aliases = FOPEN (TB_ALIASES, "w+");
fprintf (aliases, "export PS1=\"[GTB]%% \"\n");
@@ -306,7 +306,7 @@
while ((ssock = SOCKET (PF_INET, SOCK_STREAM, 0)) < 0)
{
LOG_STRERROR (LOG_ERROR, "socket");
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("No client service started. Trying again in 30 seconds.\n"));
sleep (30);
}
@@ -321,7 +321,7 @@
/* bind the socket */
if (BIND (ssock, (struct sockaddr *) &serverAddr, sizeof (serverAddr)) < 0)
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Error (%s) binding the TCP listener to "
"port %d. No proxy service started.\nTrying "
"again in %d seconds...\n"), STRERROR (errno), PORT, secs);
@@ -375,12 +375,12 @@
continue;
}
/* access control! */
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
sizeof (struct in_addr) == sizeof (GNUNET_IPv4Address));
memcpy (&ipaddr, &clientAddr.sin_addr, sizeof (struct in_addr));
if (GNUNET_NO == isWhitelisted (ipaddr))
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("Rejected unauthorized connection from %u.%u.%u.%u.\n"),
PRIP (ntohl (*(int *) &clientAddr.sin_addr)));
closefile (sock);
@@ -503,7 +503,7 @@
return GNUNET_SYSERR;
}
default:
- GE_LOG (ectx, GE_ERROR | GE_IMMEDIATE | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_IMMEDIATE |
GNUNET_GE_USER,
_("Use --help to get a list of options.\n"));
return -1;
} /* end of parsing commandline */
Modified: GNUnet/src/applications/testbed/testbed.c
===================================================================
--- GNUnet/src/applications/testbed/testbed.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/testbed/testbed.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -39,16 +39,16 @@
#define HTTP_URL "http://"
/* */
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
-static Identity_ServiceAPI *identity;
+static GNUNET_Identity_ServiceAPI *identity;
static void
-sendAcknowledgement (ClientHandle client, int ack)
+sendAcknowledgement (GNUNET_ClientHandle client, int ack)
{
if (GNUNET_OK != coreAPI->sendValueToClient (client, ack))
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Could not send acknowledgement back to client.\n"));
}
}
@@ -57,9 +57,9 @@
* Handler that is called for "message not understood" cases.
*/
static void
-tb_undefined (ClientHandle client, TESTBED_CS_MESSAGE * msg)
+tb_undefined (GNUNET_ClientHandle client, TESTBED_CS_MESSAGE * msg)
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Received unknown testbed message of type %u.\n"),
ntohl (msg->msgType));
}
@@ -68,15 +68,15 @@
* Connect to another peer.
*/
static void
-tb_ADD_PEER (ClientHandle client, TESTBED_CS_MESSAGE * msg)
+tb_ADD_PEER (GNUNET_ClientHandle client, TESTBED_CS_MESSAGE * msg)
{
GNUNET_MessageHeader noise;
TESTBED_ADD_PEER_MESSAGE *hm = (TESTBED_ADD_PEER_MESSAGE *) msg;
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER, " tb_ADD_PEER\n");
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, "
tb_ADD_PEER\n");
if (sizeof (TESTBED_ADD_PEER_MESSAGE) > ntohs (msg->header.size))
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("size of `%s' message is too short. Ignoring.\n"),
"ADD_PEER");
return;
@@ -84,15 +84,15 @@
if (GNUNET_sizeof_hello (&hm->helo) !=
ntohs (msg->header.size) - sizeof (TESTBED_CS_MESSAGE))
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("size of `%s' message is wrong. Ignoring.\n"), "_ADD_PEER");
return;
}
identity->addHost (&hm->helo);
noise.size = htons (sizeof (GNUNET_MessageHeader));
- noise.type = htons (P2P_PROTO_noise);
- coreAPI->unicast (&hm->helo.senderIdentity, &noise, EXTREME_PRIORITY, 0);
+ noise.type = htons (GNUNET_P2P_PROTO_NOISE);
+ coreAPI->unicast (&hm->helo.senderIdentity, &noise, GNUNET_EXTREME_PRIORITY,
0);
sendAcknowledgement (client, GNUNET_OK);
}
@@ -100,7 +100,7 @@
* Disconnect from another peer.
*/
static void
-tb_DEL_PEER (ClientHandle client, TESTBED_DEL_PEER_MESSAGE * msg)
+tb_DEL_PEER (GNUNET_ClientHandle client, TESTBED_DEL_PEER_MESSAGE * msg)
{
coreAPI->disconnectFromPeer (&msg->host);
sendAcknowledgement (client, GNUNET_OK);
@@ -116,7 +116,7 @@
* Disconnect from all other peers.
*/
static void
-tb_DEL_ALL_PEERS (ClientHandle client, TESTBED_DEL_ALL_PEERS_MESSAGE * msg)
+tb_DEL_ALL_PEERS (GNUNET_ClientHandle client, TESTBED_DEL_ALL_PEERS_MESSAGE *
msg)
{
coreAPI->forAllConnectedNodes (&doDisconnect, NULL);
sendAcknowledgement (client, GNUNET_OK);
@@ -126,7 +126,7 @@
* Get a hello message for this peer.
*/
static void
-tb_GET_hello (ClientHandle client, TESTBED_GET_hello_MESSAGE * msg)
+tb_GET_hello (GNUNET_ClientHandle client, TESTBED_GET_hello_MESSAGE * msg)
{
GNUNET_MessageHello *helo;
unsigned int proto = ntohs (msg->proto);
@@ -134,7 +134,7 @@
helo = identity->identity2Helo (coreAPI->myIdentity, proto, GNUNET_NO);
if (NULL == helo)
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("TESTBED could not generate hello message for protocol %u\n"),
proto);
sendAcknowledgement (client, GNUNET_SYSERR);
@@ -147,11 +147,11 @@
sizeof (TESTBED_CS_MESSAGE));
reply->header.header.size =
htons (ntohs (helo->header.size) + sizeof (TESTBED_CS_MESSAGE));
- reply->header.header.type = htons (CS_PROTO_testbed_REPLY);
+ reply->header.header.type = htons (GNUNET_CS_PROTO_TESTBED_REPLY);
reply->header.msgType = htonl (TESTBED_hello_RESPONSE);
memcpy (&reply->helo, helo, ntohs (helo->header.size));
coreAPI->sendToClient (client, &reply->header.header);
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"%s: returning from sendToClient\n", __FUNCTION__);
GNUNET_free (helo);
GNUNET_free (reply);
@@ -162,7 +162,7 @@
* Set a trust value.
*/
static void
-tb_SET_TVALUE (ClientHandle client, TESTBED_SET_TVALUE_MESSAGE * msg)
+tb_SET_TVALUE (GNUNET_ClientHandle client, TESTBED_SET_TVALUE_MESSAGE * msg)
{
int trust;
@@ -175,7 +175,7 @@
* Get a trust value.
*/
static void
-tb_GET_TVALUE (ClientHandle client, TESTBED_GET_TVALUE_MESSAGE * msg)
+tb_GET_TVALUE (GNUNET_ClientHandle client, TESTBED_GET_TVALUE_MESSAGE * msg)
{
unsigned int trust;
@@ -187,9 +187,9 @@
* Change the bandwidth limitations.
*/
static void
-tb_SET_BW (ClientHandle client, TESTBED_SET_BW_MESSAGE * msg)
+tb_SET_BW (GNUNET_ClientHandle client, TESTBED_SET_BW_MESSAGE * msg)
{
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"gnunet-testbed: tb_SET_BW\n");
setConfigurationInt ("LOAD", "MAXNETDOWNBPSTOTAL", ntohl (msg->in_bw));
setConfigurationInt ("LOAD", "MAXNETUPBPSTOTAL", ntohl (msg->out_bw));
@@ -201,7 +201,7 @@
* Load an application module.
*/
static void
-tb_LOAD_MODULE (ClientHandle client, TESTBED_CS_MESSAGE * msg)
+tb_LOAD_MODULE (GNUNET_ClientHandle client, TESTBED_CS_MESSAGE * msg)
{
unsigned short size;
char *name;
@@ -210,7 +210,7 @@
size = ntohs (msg->header.size);
if (size <= sizeof (TESTBED_CS_MESSAGE))
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("received invalid `%s' message\n"), "LOAD_MODULE");
return;
}
@@ -222,18 +222,18 @@
}
name =
- STRNDUP (&((TESTBED_LOAD_MODULE_MESSAGE_GENERIC *) msg)->modulename[0],
+ STRNDUP (&((TESTBED_LOAD_MODULE_MESSAGNUNET_GE_GENERIC *)
msg)->modulename[0],
size - sizeof (TESTBED_CS_MESSAGE));
if (strlen (name) == 0)
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("received invalid `%s' message (empty module name)\n"),
"LOAD_MODULE");
return;
}
ok = coreAPI->loadApplicationModule (name);
if (ok != GNUNET_OK)
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("loading module `%s' failed. Notifying client.\n"), name);
GNUNET_free (name);
sendAcknowledgement (client, ok);
@@ -243,7 +243,7 @@
* Unload an application module.
*/
static void
-tb_UNLOAD_MODULE (ClientHandle client, TESTBED_CS_MESSAGE * msg)
+tb_UNLOAD_MODULE (GNUNET_ClientHandle client, TESTBED_CS_MESSAGE * msg)
{
unsigned short size;
char *name;
@@ -252,7 +252,7 @@
size = ntohs (msg->header.size);
if (size <= sizeof (TESTBED_CS_MESSAGE))
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("received invalid `%s' message\n"), "UNLOAD_MODULE");
return;
}
@@ -263,18 +263,18 @@
}
name =
- STRNDUP (&((TESTBED_UNLOAD_MODULE_MESSAGE_GENERIC *) msg)->modulename[0],
+ STRNDUP (&((TESTBED_UNLOAD_MODULE_MESSAGNUNET_GE_GENERIC *)
msg)->modulename[0],
size - sizeof (TESTBED_CS_MESSAGE));
if (strlen (name) == 0)
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("received invalid `%s' message (empty module name)\n"),
"UNLOAD_MODULE");
return;
}
ok = coreAPI->unloadApplicationModule (name);
if (ok != GNUNET_OK)
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("unloading module failed. Notifying client.\n"));
GNUNET_free (name);
sendAcknowledgement (client, ok);
@@ -286,7 +286,7 @@
* random).
*/
static void
-tb_DISABLE_AUTOCONNECT (ClientHandle client,
+tb_DISABLE_AUTOCONNECT (GNUNET_ClientHandle client,
TESTBED_DISABLE_AUTOCONNECT_MESSAGE * msg)
{
GNUNET_free_non_null (setConfigurationString ("GNUNETD",
@@ -302,7 +302,7 @@
* random).
*/
static void
-tb_ENABLE_AUTOCONNECT (ClientHandle client,
+tb_ENABLE_AUTOCONNECT (GNUNET_ClientHandle client,
TESTBED_ENABLE_AUTOCONNECT_MESSAGE * msg)
{
GNUNET_free_non_null (setConfigurationString ("GNUNETD",
@@ -317,7 +317,7 @@
* random).
*/
static void
-tb_DISABLE_hello (ClientHandle client, TESTBED_DISABLE_hello_MESSAGE * msg)
+tb_DISABLE_hello (GNUNET_ClientHandle client, TESTBED_DISABLE_hello_MESSAGE *
msg)
{
GNUNET_free_non_null (setConfigurationString ("NETWORK",
"DISABLE-ADVERTISEMENTS",
@@ -334,7 +334,7 @@
* random).
*/
static void
-tb_ENABLE_hello (ClientHandle client, TESTBED_ENABLE_hello_MESSAGE * msg)
+tb_ENABLE_hello (GNUNET_ClientHandle client, TESTBED_ENABLE_hello_MESSAGE *
msg)
{
GNUNET_free_non_null (setConfigurationString ("NETWORK",
"DISABLE-ADVERTISEMENTS",
@@ -349,7 +349,7 @@
* Allow only certain peers to connect.
*/
static void
-tb_ALLOW_CONNECT (ClientHandle client, TESTBED_ALLOW_CONNECT_MESSAGE * msg)
+tb_ALLOW_CONNECT (GNUNET_ClientHandle client, TESTBED_ALLOW_CONNECT_MESSAGE *
msg)
{
char *value;
unsigned short size;
@@ -360,7 +360,7 @@
size = ntohs (msg->header.header.size);
if (size <= sizeof (TESTBED_CS_MESSAGE))
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("received invalid `%s' message\n"), "ALLOW_CONNECT");
return;
}
@@ -368,7 +368,7 @@
if (count * sizeof (GNUNET_PeerIdentity) + sizeof (TESTBED_CS_MESSAGE) !=
size)
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("received invalid `%s' message\n"), "ALLOW_CONNECT");
return;
}
@@ -383,7 +383,7 @@
for (i = 0; i < count; i++)
{
GNUNET_hash_to_enc (&
- ((TESTBED_ALLOW_CONNECT_MESSAGE_GENERIC *)
+ ((TESTBED_ALLOW_CONNECT_MESSAGNUNET_GE_GENERIC *)
msg)->peers[i].hashPubKey, &enc);
strcat (value, (char *) &enc);
}
@@ -399,7 +399,7 @@
* Deny certain peers the right to connect.
*/
static void
-tb_DENY_CONNECT (ClientHandle client, TESTBED_DENY_CONNECT_MESSAGE * msg)
+tb_DENY_CONNECT (GNUNET_ClientHandle client, TESTBED_DENY_CONNECT_MESSAGE *
msg)
{
char *value;
unsigned short size;
@@ -410,7 +410,7 @@
size = ntohs (msg->header.header.size);
if (size <= sizeof (TESTBED_CS_MESSAGE))
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("received invalid `%s' message\n"), "DENY_CONNECT");
return;
}
@@ -418,7 +418,7 @@
if (count * sizeof (GNUNET_PeerIdentity) + sizeof (TESTBED_CS_MESSAGE) !=
size)
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("received invalid `%s' message\n"), "DENY_CONNECT");
return;
}
@@ -433,7 +433,7 @@
for (i = 0; i < count; i++)
{
GNUNET_hash_to_enc (&
- ((TESTBED_DENY_CONNECT_MESSAGE_GENERIC *) msg)->
+ ((TESTBED_DENY_CONNECT_MESSAGNUNET_GE_GENERIC *)
msg)->
peers[i].hashPubKey, &enc);
strcat (value, (char *) &enc);
}
@@ -473,7 +473,7 @@
/** Client responsible for this process
(if that client disconnects, the process
will be killed!) */
- ClientHandle client;
+ GNUNET_ClientHandle client;
/** arguments for exec */
char **argv;
int argc;
@@ -519,10 +519,10 @@
GNUNET_mutex_unlock (&lock);
return -1;
}
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"exec'ing: %s with %d arguments\n", pi->argv[0], pi->argc - 1);
for (i = 1; i < pi->argc; i++)
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"exec argument %d is %s\n", i, pi->argv[i]);
tmp = getConfigurationString ("TESTBED", "UPLOAD-DIR");
if (tmp == NULL)
@@ -549,7 +549,7 @@
CHDIR (dir);
GNUNET_free (dir);
execvp (pi->argv[0], &pi->argv[0]);
- GE_LOG_STRERROR_FILE (ectx, LOG_ERROR, "execvp", pi->argv[0]);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx, LOG_ERROR, "execvp", pi->argv[0]);
fprintf (stderr,
_("`%s' %s failed: %s\n"),
"execvp", pi->argv[0], STRERROR (errno));
@@ -614,7 +614,7 @@
* Execute a command.
*/
static void
-tb_EXEC (ClientHandle client, TESTBED_CS_MESSAGE * msg)
+tb_EXEC (GNUNET_ClientHandle client, TESTBED_CS_MESSAGE * msg)
{
int argc2;
unsigned short size;
@@ -628,10 +628,10 @@
emsg = (TESTBED_EXEC_MESSAGE *) msg;
size = htons (msg->header.size);
if ((size <= sizeof (TESTBED_CS_MESSAGE)) ||
- (((TESTBED_EXEC_MESSAGE_GENERIC *) emsg)->
+ (((TESTBED_EXEC_MESSAGNUNET_GE_GENERIC *) emsg)->
commandLine[size - sizeof (TESTBED_CS_MESSAGE) - 1] != '\0'))
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("received invalid `%s' message: %s.\n"),
"EXEC",
(size <= sizeof (TESTBED_CS_MESSAGE))
@@ -644,10 +644,10 @@
pi = GNUNET_malloc (sizeof (ProcessInfo));
pi->argc = 0;
for (pos = 0; pos < size; pos++)
- if (((TESTBED_EXEC_MESSAGE_GENERIC *) emsg)->commandLine[pos] == '\0')
+ if (((TESTBED_EXEC_MESSAGNUNET_GE_GENERIC *) emsg)->commandLine[pos] ==
'\0')
pi->argc++;
mainName =
- GNUNET_strdup (&((TESTBED_EXEC_MESSAGE_GENERIC *) emsg)->commandLine[0]);
+ GNUNET_strdup (&((TESTBED_EXEC_MESSAGNUNET_GE_GENERIC *)
emsg)->commandLine[0]);
clientConfig = NULL;
if (0 == strncmp ("gnunet", mainName, strlen ("gnunet")))
clientConfig = getConfigurationString ("TESTBED", "CLIENTCONFIG");
@@ -658,9 +658,9 @@
pi->argv[0] = mainName;
pi->argv[pi->argc] = NULL; /* termination! */
for (pos = size - 2; pos >= 0; pos--)
- if (((TESTBED_EXEC_MESSAGE_GENERIC *) emsg)->commandLine[pos] == '\0')
+ if (((TESTBED_EXEC_MESSAGNUNET_GE_GENERIC *) emsg)->commandLine[pos] ==
'\0')
pi->argv[--argc2] =
- GNUNET_strdup (&((TESTBED_EXEC_MESSAGE_GENERIC *) emsg)->
+ GNUNET_strdup (&((TESTBED_EXEC_MESSAGNUNET_GE_GENERIC *) emsg)->
commandLine[pos + 1]);
if (clientConfig != NULL)
{
@@ -700,7 +700,7 @@
* process on exit.
*/
static void
-tb_SIGNAL (ClientHandle client, TESTBED_SIGNAL_MESSAGE * msg)
+tb_SIGNAL (GNUNET_ClientHandle client, TESTBED_SIGNAL_MESSAGE * msg)
{
int ret;
int i;
@@ -755,7 +755,7 @@
* Get the output of a process.
*/
static void
-tb_GET_OUTPUT (ClientHandle client, TESTBED_GET_OUTPUT_MESSAGE * msg)
+tb_GET_OUTPUT (GNUNET_ClientHandle client, TESTBED_GET_OUTPUT_MESSAGE * msg)
{
int i;
unsigned int uid;
@@ -773,7 +773,7 @@
TESTBED_OUTPUT_REPLY_MESSAGE *msg;
msg = GNUNET_malloc (65532);
- msg->header.header.type = htons (CS_PROTO_testbed_REPLY);
+ msg->header.header.type = htons (GNUNET_CS_PROTO_TESTBED_REPLY);
msg->header.msgType = htonl (TESTBED_OUTPUT_RESPONSE);
sendAcknowledgement (client, pi->outputSize);
@@ -785,7 +785,7 @@
run = 65532 - sizeof (TESTBED_OUTPUT_REPLY_MESSAGE);
msg->header.header.size
= htons (run + sizeof (TESTBED_OUTPUT_REPLY_MESSAGE));
- memcpy (&((TESTBED_OUTPUT_REPLY_MESSAGE_GENERIC *) msg)->
+ memcpy (&((TESTBED_OUTPUT_REPLY_MESSAGNUNET_GE_GENERIC *) msg)->
data[0], &pi->output[pos], run);
coreAPI->sendToClient (client, &msg->header.header);
pos += run;
@@ -805,7 +805,7 @@
* The client is uploading a file to this peer.
*/
static void
-tb_UPLOAD_FILE (ClientHandle client, TESTBED_UPLOAD_FILE_MESSAGE * msg)
+tb_UPLOAD_FILE (GNUNET_ClientHandle client, TESTBED_UPLOAD_FILE_MESSAGE * msg)
{
int ack;
unsigned int size;
@@ -814,22 +814,22 @@
char *tmp;
FILE *outfile;
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER, "tb_UPLOAD_FILE\n");
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"tb_UPLOAD_FILE\n");
if (sizeof (TESTBED_UPLOAD_FILE_MESSAGE) > ntohs (msg->header.header.size))
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("size of `%s' message is too short. Ignoring.\n"),
"UPLOAD_FILE");
sendAcknowledgement (client, GNUNET_SYSERR);
return;
}
end = &((char *) msg)[ntohs (msg->header.header.size)];
- s = filename = ((TESTBED_UPLOAD_FILE_MESSAGE_GENERIC *) msg)->buf;
+ s = filename = ((TESTBED_UPLOAD_FILE_MESSAGNUNET_GE_GENERIC *) msg)->buf;
while ((*s) && (s != end))
{
if (*s == '.' && *(s + 1) == '.')
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("\'..\' is not allowed in file name (%s).\n"), filename);
return;
}
@@ -838,7 +838,7 @@
if (s == filename)
{
/* filename empty, not allowed! */
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Empty filename for UPLOAD_FILE message is invalid!\n"));
sendAcknowledgement (client, GNUNET_SYSERR);
return;
@@ -846,7 +846,7 @@
if (s == end)
{
/* filename empty, not allowed! */
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_
("Filename for UPLOAD_FILE message is not null-terminated
(invalid!)\n"));
sendAcknowledgement (client, GNUNET_SYSERR);
@@ -855,7 +855,7 @@
tmp = getConfigurationString ("TESTBED", "UPLOAD-DIR");
if (tmp == NULL)
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER, _("Upload refused!"));
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Upload refused!"));
sendAcknowledgement (client, GNUNET_SYSERR);
return;
}
@@ -867,13 +867,13 @@
strcpy (filename, gnHome);
strcat (filename, DIR_SEPARATOR_STR);
strncat (filename,
- ((TESTBED_UPLOAD_FILE_MESSAGE_GENERIC *) msg)->buf,
- end - ((TESTBED_UPLOAD_FILE_MESSAGE_GENERIC *) msg)->buf);
+ ((TESTBED_UPLOAD_FILE_MESSAGNUNET_GE_GENERIC *) msg)->buf,
+ end - ((TESTBED_UPLOAD_FILE_MESSAGNUNET_GE_GENERIC *) msg)->buf);
if (htonl (msg->type) == TESTBED_FILE_DELETE)
{
if (REMOVE (filename) && errno != ENOENT)
{
- GE_LOG_STRERROR_FILE (ectx, LOG_WARNING, "remove", filename);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx, LOG_WARNING, "remove", filename);
ack = GNUNET_SYSERR;
}
else
@@ -884,7 +884,7 @@
}
if (htonl (msg->type) != TESTBED_FILE_GNUNET_array_append)
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Invalid message received at %s:%d."), __FILE__, __LINE__);
GNUNET_free (filename);
return;
@@ -893,16 +893,16 @@
if (outfile == NULL)
{
/* Send nack back to control point. */
- GE_LOG_STRERROR_FILE (ectx, LOG_ERROR, "fopen", filename);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx, LOG_ERROR, "fopen", filename);
sendAcknowledgement (client, GNUNET_SYSERR);
GNUNET_free (filename);
return;
}
GNUNET_free (filename);
- s = ((TESTBED_UPLOAD_FILE_MESSAGE_GENERIC *) msg)->buf + strlen
(((TESTBED_UPLOAD_FILE_MESSAGE_GENERIC *) msg)->buf) + 1; /* \0 added */
+ s = ((TESTBED_UPLOAD_FILE_MESSAGNUNET_GE_GENERIC *) msg)->buf + strlen
(((TESTBED_UPLOAD_FILE_MESSAGNUNET_GE_GENERIC *) msg)->buf) + 1; /* \0
added */
size = ntohs (msg->header.header.size) -
sizeof (TESTBED_UPLOAD_FILE_MESSAGE) -
- (strlen (((TESTBED_UPLOAD_FILE_MESSAGE_GENERIC *) msg)->buf) + 1);
+ (strlen (((TESTBED_UPLOAD_FILE_MESSAGNUNET_GE_GENERIC *) msg)->buf) + 1);
if (GN_FWRITE (s, 1, size, outfile) != size)
ack = GNUNET_SYSERR;
else
@@ -914,7 +914,7 @@
/**
* General type of a message handler.
*/
-typedef void (*THandler) (ClientHandle client, TESTBED_CS_MESSAGE * msg);
+typedef void (*THandler) (GNUNET_ClientHandle client, TESTBED_CS_MESSAGE *
msg);
/**
* @brief Entry in the handlers array that describes a testbed message handler.
@@ -989,20 +989,20 @@
* on the testbed-message type.
*/
static void
-csHandleTestbedRequest (ClientHandle client, CS_MESSAGE_HEADER * message)
+csHandleTestbedRequest (GNUNET_ClientHandle client, CS_MESSAGNUNET_GE_HEADER *
message)
{
TESTBED_CS_MESSAGE *msg;
unsigned short size;
unsigned int id;
#if DEBUG_TESTBED
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"TESTBED handleTestbedRequest\n");
#endif
size = ntohs (message->size);
if (size < sizeof (TESTBED_CS_MESSAGE))
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("received invalid testbed message of size %u\n"), size);
return;
}
@@ -1013,7 +1013,7 @@
if ((handlers[id].expectedSize == 0) ||
(handlers[id].expectedSize == size))
{
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"TESTBED received message of type %u.\n", id);
handlers[id].handler (client, msg);
@@ -1021,7 +1021,7 @@
}
else
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_USER,
_
("Received testbed message of type %u but unexpected size
%u, expected %u\n"),
id, size, handlers[id].expectedSize);
@@ -1067,7 +1067,7 @@
reg = getConfigurationString ("TESTBED", "REGISTERURL");
if (reg == NULL)
{
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
_("No testbed URL given, not registered.\n"));
return;
}
@@ -1077,7 +1077,7 @@
{
if (GNUNET_OK != GNUNET_get_host_by_name (ectx, proxy, &ip_info))
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("Could not resolve name of HTTP proxy `%s'.\n"), proxy);
theProxy.sin_addr.s_addr = 0;
}
@@ -1105,7 +1105,7 @@
if (0 != strncmp (HTTP_URL, reg, strlen (HTTP_URL)))
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Invalid URL `%s' (must begin with `%s')\n"), reg, HTTP_URL);
return;
}
@@ -1145,7 +1145,7 @@
port = strtol (pstring, &buffer, 10);
if ((port < 0) || (port > 65536))
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_USER,
_
("Malformed http URL: `%s' at `%s'. Testbed-client not
registered.\n"),
reg, buffer);
@@ -1159,7 +1159,7 @@
hostname[k] = '\0';
#if DEBUG_TESTBED
- GE_LOG (ectx, GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Trying to (un)register testbed client at %s\n", reg);
#endif
@@ -1180,7 +1180,7 @@
/* no proxy */
if (GNUNET_OK != GNUNET_get_host_by_name (ectx, hostname, &ip_info))
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("Could not register testbed, host `%s' unknown\n"),
hostname);
GNUNET_free (reg);
@@ -1201,7 +1201,7 @@
(struct sockaddr *) &soaddr,
sizeof (soaddr)) < 0 && errno != EWOULDBLOCK)
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Failed to send HTTP request to host `%s': %s\n"),
hostname, STRERROR (errno));
GNUNET_free (reg);
@@ -1238,7 +1238,7 @@
curpos = SEND_BLOCKING_ALL (sock, command, curpos);
if (GNUNET_SYSERR == (int) curpos)
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Failed so send HTTP request `%s' to host `%s': %s\n"),
command, hostname, STRERROR (errno));
GNUNET_free (command);
@@ -1275,11 +1275,11 @@
closefile (sock);
if (curpos < 4)
{ /* invalid response */
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Exit register (error: no http response read).\n"));
}
#if DEBUG_TESTBED
- GE_LOG (ectx, GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Exit register (%d seconds before timeout)\n",
(int) (start + 300 * GNUNET_CRON_SECONDS -
GNUNET_get_time ()) / GNUNET_CRON_SECONDS);
@@ -1290,7 +1290,7 @@
* When a client exits, kill all associated processes.
*/
static void
-testbedClientExitHandler (ClientHandle client)
+testbedClientExitHandler (GNUNET_ClientHandle client)
{
int i;
int pding;
@@ -1347,35 +1347,35 @@
* @return GNUNET_SYSERR on errors
*/
int
-initialize_module_testbed (CoreAPIForApplication * capi)
+initialize_module_testbed (GNUNET_CoreAPIForPlugins * capi)
{
unsigned int i;
/* some checks */
for (i = 0; i < TESTBED_MAX_MSG; i++)
if ((handlers[i].msgId != i) && (handlers[i].handler != &tb_undefined))
- GE_ASSERT (ectx, 0);
- GE_ASSERT (ectx, handlers[TESTBED_MAX_MSG].handler == NULL);
+ GNUNET_GE_ASSERT (ectx, 0);
+ GNUNET_GE_ASSERT (ectx, handlers[TESTBED_MAX_MSG].handler == NULL);
identity = capi->requestService ("identity");
if (identity == NULL)
return GNUNET_SYSERR;
GNUNET_mutex_create (&lock);
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
- "TESTBED registering handler %d!\n", CS_PROTO_testbed_REQUEST);
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
+ "TESTBED registering handler %d!\n",
GNUNET_CS_PROTO_TESTBED_REQUEST);
coreAPI = capi;
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
capi->registerClientExitHandler (&testbedClientExitHandler));
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- capi->registerClientHandler (CS_PROTO_testbed_REQUEST,
- (CSHandler) &
+ capi->registerClientHandler (GNUNET_CS_PROTO_TESTBED_REQUEST,
+ (GNUNET_ClientRequestHandler) &
csHandleTestbedRequest));
httpRegister ("startup");
- GE_ASSERT (capi->ectx,
- 0 == GC_set_configuration_value_string (capi->cfg,
+ GNUNET_GE_ASSERT (capi->ectx,
+ 0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
capi->ectx,
"ABOUT",
"testbed",
@@ -1410,10 +1410,10 @@
httpRegister ("shutdown");
GNUNET_mutex_destroy (&lock);
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
- "TESTBED unregistering handler %d\n", CS_PROTO_testbed_REQUEST);
- coreAPI->unregisterClientHandler (CS_PROTO_testbed_REQUEST,
- (CSHandler) & csHandleTestbedRequest);
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
+ "TESTBED unregistering handler %d\n",
GNUNET_CS_PROTO_TESTBED_REQUEST);
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_TESTBED_REQUEST,
+ (GNUNET_ClientRequestHandler) &
csHandleTestbedRequest);
coreAPI->unregisterClientExitHandler (&testbedClientExitHandler);
coreAPI->releaseService (identity);
identity = NULL;
Modified: GNUnet/src/applications/testbed/testbed.h
===================================================================
--- GNUnet/src/applications/testbed/testbed.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/testbed/testbed.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -73,7 +73,7 @@
typedef struct
{
- CS_MESSAGE_HEADER header;
+ CS_MESSAGNUNET_GE_HEADER header;
unsigned int msgType; /* The message types listed above */
} TESTBED_CS_MESSAGE;
@@ -81,7 +81,7 @@
{
TESTBED_CS_MESSAGE testbed_cs_message;
char data[1]; /* Value is dependent on the type field */
-} TESTBED_CS_MESSAGE_GENERIC;
+} TESTBED_CS_MESSAGNUNET_GE_GENERIC;
typedef struct
{
@@ -160,7 +160,7 @@
{
TESTBED_LOAD_MODULE_MESSAGE load_module_message;
char modulename[1];
-} TESTBED_LOAD_MODULE_MESSAGE_GENERIC;
+} TESTBED_LOAD_MODULE_MESSAGNUNET_GE_GENERIC;
typedef struct
{
@@ -171,7 +171,7 @@
{
TESTBED_UNLOAD_MODULE_MESSAGE unload_module_message;
char modulename[1];
-} TESTBED_UNLOAD_MODULE_MESSAGE_GENERIC;
+} TESTBED_UNLOAD_MODULE_MESSAGNUNET_GE_GENERIC;
#define TESTBED_FILE_GNUNET_array_append 1
#define TESTBED_FILE_DELETE 2
@@ -188,7 +188,7 @@
{
TESTBED_UPLOAD_FILE_MESSAGE upload_file_message;
char buf[1];
-} TESTBED_UPLOAD_FILE_MESSAGE_GENERIC;
+} TESTBED_UPLOAD_FILE_MESSAGNUNET_GE_GENERIC;
typedef struct
{
@@ -219,7 +219,7 @@
{
TESTBED_ALLOW_CONNECT_MESSAGE allow_connect_message;
GNUNET_PeerIdentity peers[1];
-} TESTBED_ALLOW_CONNECT_MESSAGE_GENERIC;
+} TESTBED_ALLOW_CONNECT_MESSAGNUNET_GE_GENERIC;
typedef struct
{
@@ -230,7 +230,7 @@
{
TESTBED_DENY_CONNECT_MESSAGE deny_connect_message;
GNUNET_PeerIdentity peers[1];
-} TESTBED_DENY_CONNECT_MESSAGE_GENERIC;
+} TESTBED_DENY_CONNECT_MESSAGNUNET_GE_GENERIC;
typedef struct
{
@@ -241,7 +241,7 @@
{
TESTBED_EXEC_MESSAGE exec_message;
char commandLine[1];
-} TESTBED_EXEC_MESSAGE_GENERIC;
+} TESTBED_EXEC_MESSAGNUNET_GE_GENERIC;
typedef struct
{
@@ -265,6 +265,6 @@
{
TESTBED_OUTPUT_REPLY_MESSAGE output_reply_message;
char data[1];
-} TESTBED_OUTPUT_REPLY_MESSAGE_GENERIC;
+} TESTBED_OUTPUT_REPLY_MESSAGNUNET_GE_GENERIC;
#endif
Modified: GNUnet/src/applications/testing/testing.c
===================================================================
--- GNUnet/src/applications/testing/testing.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/testing/testing.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -31,22 +31,22 @@
#include "gnunet_testing_lib.h"
static void
-updatePort (struct GC_Configuration *cfg,
+updatePort (struct GNUNET_GC_Configuration *cfg,
const char *section, unsigned short offset)
{
unsigned long long old;
- if ((GNUNET_YES == GC_have_configuration_value (cfg,
+ if ((GNUNET_YES == GNUNET_GC_have_configuration_value (cfg,
section,
"PORT")) &&
- (0 == GC_get_configuration_value_number (cfg,
+ (0 == GNUNET_GC_get_configuration_value_number (cfg,
section,
"PORT",
0, 65535, 65535, &old)))
{
old += offset;
- GE_ASSERT (NULL,
- 0 == GC_set_configuration_value_number (cfg,
+ GNUNET_GE_ASSERT (NULL,
+ 0 == GNUNET_GC_set_configuration_value_number (cfg,
NULL,
section,
"PORT", old));
@@ -77,7 +77,7 @@
int ret;
char *ipath;
char *dpath;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
char host[128];
struct GNUNET_ClientServerConnection *sock;
GNUNET_MessageHello *hello;
@@ -96,12 +96,12 @@
strcpy (dpath, ipath);
GNUNET_free (ipath);
strcat (dpath, DIR_SEPARATOR_STR "gnunet-testing.conf");
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, dpath))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, dpath))
{
fprintf (stderr,
"Failed to read default configuration file `%s'\n", dpath);
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
GNUNET_free (dpath);
return GNUNET_SYSERR;
}
@@ -112,50 +112,50 @@
updatePort (cfg, "UDP6", tra_offset);
updatePort (cfg, "HTTP", tra_offset);
updatePort (cfg, "SMTP", tra_offset);
- GC_set_configuration_value_string (cfg,
+ GNUNET_GC_set_configuration_value_string (cfg,
NULL,
"PATHS", "GNUNETD_HOME", gnunetd_home);
if (transports != NULL)
- GC_set_configuration_value_string (cfg,
+ GNUNET_GC_set_configuration_value_string (cfg,
NULL,
"GNUNETD", "TRANSPORTS", transports);
if (applications != NULL)
- GC_set_configuration_value_string (cfg,
+ GNUNET_GC_set_configuration_value_string (cfg,
NULL,
"GNUNETD",
"APPLICATIONS", applications);
- GC_set_configuration_value_number (cfg, NULL, "NETWORK", "PORT", app_port);
+ GNUNET_GC_set_configuration_value_number (cfg, NULL, "NETWORK", "PORT",
app_port);
dpath = GNUNET_strdup ("/tmp/gnunet-config.XXXXXX");
ret = mkstemp (dpath);
if (ret == -1)
{
- GE_LOG_STRERROR_FILE (NULL,
- GE_ERROR | GE_USER | GE_BULK, "mkstemp", dpath);
+ GNUNET_GE_LOG_STRERROR_FILE (NULL,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_BULK,
"mkstemp", dpath);
GNUNET_free (dpath);
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return GNUNET_SYSERR;
}
CLOSE (ret);
- if (0 != GC_write_configuration (cfg, dpath))
+ if (0 != GNUNET_GC_write_configuration (cfg, dpath))
{
fprintf (stderr,
"Failed to write peer configuration file `%s'\n", dpath);
GNUNET_free (dpath);
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return GNUNET_SYSERR;
}
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
- cfg = GC_create ();
+ cfg = GNUNET_GC_create ();
/* cfg is now client CFG for GNUNET_daemon_start */
GNUNET_snprintf (host, 128, "localhost:%u", app_port);
- GC_set_configuration_value_string (cfg, NULL, "NETWORK", "HOST", host);
+ GNUNET_GC_set_configuration_value_string (cfg, NULL, "NETWORK", "HOST",
host);
ret = GNUNET_daemon_start (NULL, cfg, dpath, GNUNET_NO);
if (ret == -1)
{
fprintf (stderr, "Failed to start daemon!\n");
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return GNUNET_SYSERR;
}
*pid = ret;
@@ -168,7 +168,7 @@
GNUNET_wait_for_daemon_running (NULL, cfg, 15 * GNUNET_CRON_MINUTES))
{
fprintf (stderr, "Failed to confirm daemon running!\n");
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
UNLINK (dpath);
GNUNET_free (dpath);
return GNUNET_SYSERR;
@@ -193,7 +193,7 @@
}
GNUNET_client_connection_destroy (sock);
}
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
if (ret == GNUNET_SYSERR)
fprintf (stderr,
"Failed to obtain daemon's identity (is a transport loaded?)!\n");
@@ -214,8 +214,8 @@
GNUNET_TESTING_connect_daemons (unsigned short port1, unsigned short port2)
{
char host[128];
- struct GC_Configuration *cfg1 = GC_create ();
- struct GC_Configuration *cfg2 = GC_create ();
+ struct GNUNET_GC_Configuration *cfg1 = GNUNET_GC_create ();
+ struct GNUNET_GC_Configuration *cfg2 = GNUNET_GC_create ();
struct GNUNET_ClientServerConnection *sock1;
struct GNUNET_ClientServerConnection *sock2;
int ret;
@@ -224,9 +224,9 @@
ret = GNUNET_SYSERR;
GNUNET_snprintf (host, 128, "localhost:%u", port1);
- GC_set_configuration_value_string (cfg1, NULL, "NETWORK", "HOST", host);
+ GNUNET_GC_set_configuration_value_string (cfg1, NULL, "NETWORK", "HOST",
host);
GNUNET_snprintf (host, 128, "localhost:%u", port2);
- GC_set_configuration_value_string (cfg2, NULL, "NETWORK", "HOST", host);
+ GNUNET_GC_set_configuration_value_string (cfg2, NULL, "NETWORK", "HOST",
host);
if ((GNUNET_OK == GNUNET_wait_for_daemon_running (NULL,
cfg1,
300 *
@@ -279,8 +279,8 @@
{
fprintf (stderr, "Failed to establish connection with peers.\n");
}
- GC_free (cfg1);
- GC_free (cfg2);
+ GNUNET_GC_free (cfg1);
+ GNUNET_GC_free (cfg2);
return ret;
}
Modified: GNUnet/src/applications/topology_default/topology.c
===================================================================
--- GNUnet/src/applications/topology_default/topology.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/topology_default/topology.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -68,13 +68,13 @@
*/
#define LIVE_PING_EFFECTIVENESS 20
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
-static Identity_ServiceAPI *identity;
+static GNUNET_Identity_ServiceAPI *identity;
-static Transport_ServiceAPI *transport;
+static GNUNET_Transport_ServiceAPI *transport;
-static Pingpong_ServiceAPI *pingpong;
+static GNUNET_Pingpong_ServiceAPI *pingpong;
/**
* How many peers are we connected to in relation
@@ -186,8 +186,8 @@
if (indexMatch.matchCount == 0)
{
#if DEBUG_TOPOLOGY
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"No peers found for slot %u\n", index);
#endif
return; /* no matching peers found! */
@@ -202,21 +202,21 @@
return; /* should happen really rarely */
if (coreAPI->computeIndex (&indexMatch.match) != index)
{
- GE_BREAK (NULL, 0); /* should REALLY not happen */
+ GNUNET_GE_BREAK (NULL, 0); /* should REALLY not happen */
return;
}
if (GNUNET_OK == coreAPI->queryPeerStatus (&indexMatch.match, NULL, NULL))
{
- GE_BREAK (NULL, 0); /* should REALLY not happen */
+ GNUNET_GE_BREAK (NULL, 0); /* should REALLY not happen */
return;
}
#if DEBUG_TOPOLOGY
IF_GELOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER | GE_DEVELOPER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER |
GNUNET_GE_DEVELOPER,
GNUNET_hash_to_enc (&indexMatch.match.hashPubKey, &enc));
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER | GE_DEVELOPER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER |
GNUNET_GE_DEVELOPER,
"Trying to connect to peer `%s'\n", &enc);
#endif
if (GNUNET_NO == identity->isBlacklisted (&indexMatch.match, GNUNET_YES))
@@ -240,10 +240,10 @@
GNUNET_EncName enc;
IF_GELOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
GNUNET_hash_to_enc (&hostId->hashPubKey, &enc));
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"Received liveness confirmation from `%s'.\n", &enc);
#endif
@@ -269,7 +269,7 @@
now = GNUNET_get_time ();
if (GNUNET_SYSERR == coreAPI->getLastActivityOf (peer, &act))
{
- GE_BREAK (coreAPI->ectx, 0);
+ GNUNET_GE_BREAK (coreAPI->ectx, 0);
return; /* this should not happen... */
}
@@ -282,10 +282,10 @@
GNUNET_EncName enc;
IF_GELOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
GNUNET_hash_to_enc (&peer->hashPubKey, &enc));
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"Peer `%s' was inactive for %llus. Sending PING.\n",
&enc, (now - act) / GNUNET_CRON_SECONDS);
#endif
@@ -315,7 +315,7 @@
unsigned int minint;
int autoconnect;
- autoconnect = GC_get_configuration_value_yesno (coreAPI->cfg,
+ autoconnect = GNUNET_GC_get_configuration_value_yesno (coreAPI->cfg,
"GNUNETD",
"DISABLE-AUTOCONNECT",
GNUNET_NO);
@@ -389,22 +389,22 @@
return GNUNET_OK; /* allow everything else */
}
-Topology_ServiceAPI *
-provide_module_topology_default (CoreAPIForApplication * capi)
+GNUNET_Topology_ServiceAPI *
+provide_module_topology_default (GNUNET_CoreAPIForPlugins * capi)
{
- static Topology_ServiceAPI api;
+ static GNUNET_Topology_ServiceAPI api;
coreAPI = capi;
identity = capi->requestService ("identity");
if (identity == NULL)
{
- GE_BREAK (capi->ectx, 0);
+ GNUNET_GE_BREAK (capi->ectx, 0);
return NULL;
}
transport = capi->requestService ("transport");
if (transport == NULL)
{
- GE_BREAK (capi->ectx, 0);
+ GNUNET_GE_BREAK (capi->ectx, 0);
capi->releaseService (identity);
identity = NULL;
return NULL;
@@ -412,7 +412,7 @@
pingpong = capi->requestService ("pingpong");
if (pingpong == NULL)
{
- GE_BREAK (capi->ectx, 0);
+ GNUNET_GE_BREAK (capi->ectx, 0);
capi->releaseService (identity);
identity = NULL;
capi->releaseService (transport);
@@ -447,7 +447,7 @@
* Update topology module.
*/
void
-update_module_topology_default (UpdateAPI * uapi)
+update_module_topology_default (GNUNET_UpdateAPI * uapi)
{
uapi->updateModule ("state");
uapi->updateModule ("identity");
@@ -455,18 +455,18 @@
uapi->updateModule ("pingpong");
}
-static CoreAPIForApplication *myCapi;
+static GNUNET_CoreAPIForPlugins *myCapi;
-static Topology_ServiceAPI *myTopology;
+static GNUNET_Topology_ServiceAPI *myTopology;
int
-initialize_module_topology_default (CoreAPIForApplication * capi)
+initialize_module_topology_default (GNUNET_CoreAPIForPlugins * capi)
{
myCapi = capi;
myTopology = capi->requestService ("topology");
- GE_ASSERT (capi->ectx, myTopology != NULL);
- GE_ASSERT (capi->ectx,
- 0 == GC_set_configuration_value_string (capi->cfg,
+ GNUNET_GE_ASSERT (capi->ectx, myTopology != NULL);
+ GNUNET_GE_ASSERT (capi->ectx,
+ 0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
capi->ectx,
"ABOUT",
"topology",
Modified: GNUnet/src/applications/topology_f2f/topology.c
===================================================================
--- GNUnet/src/applications/topology_f2f/topology.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/topology_f2f/topology.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -67,15 +67,15 @@
*/
#define LIVE_PING_EFFECTIVENESS 20
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
-static Identity_ServiceAPI *identity;
+static GNUNET_Identity_ServiceAPI *identity;
-static Transport_ServiceAPI *transport;
+static GNUNET_Transport_ServiceAPI *transport;
-static Pingpong_ServiceAPI *pingpong;
+static GNUNET_Pingpong_ServiceAPI *pingpong;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
/**
* How many peers are we connected to in relation
@@ -208,20 +208,20 @@
if (0 == memcmp (coreAPI->myIdentity,
&indexMatch.match, sizeof (GNUNET_PeerIdentity)))
{
- GE_BREAK (ectx, 0); /* should not happen, at least not often... */
+ GNUNET_GE_BREAK (ectx, 0); /* should not happen, at least not
often... */
return;
}
if (coreAPI->computeIndex (&indexMatch.match) != index)
{
- GE_BREAK (ectx, 0); /* should REALLY not happen */
+ GNUNET_GE_BREAK (ectx, 0); /* should REALLY not happen */
return;
}
#if DEBUG_TOPOLOGY
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&indexMatch.match.hashPubKey, &enc));
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Topology: trying to connect to `%s'.\n", &enc);
#endif
if (GNUNET_NO == identity->isBlacklisted (&indexMatch.match, GNUNET_YES))
@@ -245,7 +245,7 @@
GNUNET_EncName enc;
GNUNET_hash_to_enc (&hostId->hashPubKey, &enc);
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Received pong from `%s', telling core that peer is still alive.\n",
(char *) &enc);
#endif
@@ -271,7 +271,7 @@
now = GNUNET_get_time ();
if (GNUNET_SYSERR == coreAPI->getLastActivityOf (peer, &act))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return; /* this should not happen... */
}
@@ -284,8 +284,8 @@
*hi = *peer;
#if DEBUG_TOPOLOGY
GNUNET_hash_to_enc (&hi->hashPubKey, &enc);
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Sending ping to `%s' to prevent connection timeout.\n",
(char *) &enc);
#endif
@@ -308,7 +308,7 @@
int active;
int autoconnect;
- autoconnect = GC_get_configuration_value_yesno (coreAPI->cfg,
+ autoconnect = GNUNET_GC_get_configuration_value_yesno (coreAPI->cfg,
"GNUNETD",
"DISABLE-AUTOCONNECT",
GNUNET_NO);
@@ -345,8 +345,8 @@
*/
static int
rereadConfiguration (void *ctx,
- struct GC_Configuration *cfg,
- struct GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
const char *section, const char *option)
{
char *fn;
@@ -360,15 +360,15 @@
return 0;
GNUNET_array_grow (friends, friendCount, 0);
fn = NULL;
- GC_get_configuration_value_filename (cfg,
+ GNUNET_GC_get_configuration_value_filename (cfg,
"F2F",
"FRIENDS",
- VAR_DAEMON_DIRECTORY "/friends", &fn);
+ GNUNET_DEFAULT_DAEMON_VAR_DIRECTORY
"/friends", &fn);
if ((0 == GNUNET_disk_file_test (ectx, fn)) ||
(GNUNET_OK != GNUNET_disk_file_size (ectx, fn, &size, GNUNET_YES)))
{
- GE_LOG (ectx,
- GE_USER | GE_ADMIN | GE_ERROR | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_USER | GNUNET_GE_ADMIN | GNUNET_GE_ERROR |
GNUNET_GE_IMMEDIATE,
"Could not read friends list `%s'\n", fn);
GNUNET_free (fn);
return GNUNET_SYSERR;
@@ -376,8 +376,8 @@
data = GNUNET_malloc (size);
if (size != GNUNET_disk_file_read (ectx, fn, size, data))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Failed to read friends list from `%s'\n"), fn);
GNUNET_free (fn);
GNUNET_free (data);
@@ -392,8 +392,8 @@
memcpy (&enc, &data[pos], sizeof (GNUNET_EncName));
if (!isspace (enc.encoding[sizeof (GNUNET_EncName) - 1]))
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_
("Syntax error in topology specification, skipping
bytes.\n"));
continue;
@@ -406,8 +406,8 @@
}
else
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_
("Syntax error in topology specification, skipping bytes
`%s'.\n"),
&enc);
@@ -419,23 +419,23 @@
return 0;
}
-Topology_ServiceAPI *
-provide_module_topology_f2f (CoreAPIForApplication * capi)
+GNUNET_Topology_ServiceAPI *
+provide_module_topology_f2f (GNUNET_CoreAPIForPlugins * capi)
{
- static Topology_ServiceAPI api;
+ static GNUNET_Topology_ServiceAPI api;
coreAPI = capi;
ectx = capi->ectx;
identity = capi->requestService ("identity");
if (identity == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return NULL;
}
transport = capi->requestService ("transport");
if (transport == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
capi->releaseService (identity);
identity = NULL;
return NULL;
@@ -443,17 +443,17 @@
pingpong = capi->requestService ("pingpong");
if (pingpong == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
capi->releaseService (identity);
identity = NULL;
capi->releaseService (transport);
transport = NULL;
return NULL;
}
- if (0 != GC_attach_change_listener (coreAPI->cfg,
+ if (0 != GNUNET_GC_attach_change_listener (coreAPI->cfg,
&rereadConfiguration, NULL))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
capi->releaseService (identity);
identity = NULL;
capi->releaseService (transport);
@@ -477,7 +477,7 @@
{
GNUNET_cron_del_job (coreAPI->cron, &cronCheckLiveness, LIVE_SCAN_FREQUENCY,
NULL);
- GC_detach_change_listener (coreAPI->cfg, &rereadConfiguration, NULL);
+ GNUNET_GC_detach_change_listener (coreAPI->cfg, &rereadConfiguration, NULL);
coreAPI->releaseService (identity);
identity = NULL;
coreAPI->releaseService (transport);
@@ -493,7 +493,7 @@
* Update topology module.
*/
void
-update_module_topology_default (UpdateAPI * uapi)
+update_module_topology_default (GNUNET_UpdateAPI * uapi)
{
uapi->updateModule ("state");
uapi->updateModule ("identity");
@@ -501,18 +501,18 @@
uapi->updateModule ("pingpong");
}
-static CoreAPIForApplication *myCapi;
+static GNUNET_CoreAPIForPlugins *myCapi;
-static Topology_ServiceAPI *myTopology;
+static GNUNET_Topology_ServiceAPI *myTopology;
int
-initialize_module_topology_f2f (CoreAPIForApplication * capi)
+initialize_module_topology_f2f (GNUNET_CoreAPIForPlugins * capi)
{
myCapi = capi;
myTopology = capi->requestService ("topology");
- GE_ASSERT (ectx, myTopology != NULL);
- GE_ASSERT (capi->ectx,
- 0 == GC_set_configuration_value_string (capi->cfg,
+ GNUNET_GE_ASSERT (ectx, myTopology != NULL);
+ GNUNET_GE_ASSERT (capi->ectx,
+ 0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
capi->ectx,
"ABOUT",
"topology",
Modified: GNUnet/src/applications/tracekit/gnunet-tracekit.c
===================================================================
--- GNUnet/src/applications/tracekit/gnunet-tracekit.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/tracekit/gnunet-tracekit.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -33,9 +33,9 @@
static char *cfgFilename;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
/**
* All gnunet-tracekit command line options
@@ -56,7 +56,7 @@
{'P', "priority", "PRIO",
gettext_noop ("use PRIO for the priority of the trace request"), 1,
&GNUNET_getopt_configure_set_option, "GNUNET-TRACEKIT:PRIORITY"},
- GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
+ GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGNUNET_GE_VERSION), /* -v */
{'W', "wait", "DELAY",
gettext_noop ("wait DELAY seconds for replies"), 1,
&GNUNET_getopt_configure_set_option, "GNUNET-TRACEKIT:WAIT"},
@@ -68,7 +68,7 @@
{
unsigned long long val;
- GC_get_configuration_value_number (cfg, sec, opt, 0, max, 0, &val);
+ GNUNET_GC_get_configuration_value_number (cfg, sec, opt, 0, max, 0, &val);
return (unsigned int) val;
}
@@ -102,7 +102,7 @@
peersResponding = GNUNET_malloc (prSize * sizeof (GNUNET_PeerIdentity));
buffer = GNUNET_malloc (GNUNET_MAX_BUFFER_SIZE);
if (-1 ==
- GC_get_configuration_value_number (cfg,
+ GNUNET_GC_get_configuration_value_number (cfg,
"GNUNET-TRACEKIT",
"FORMAT", 0, 2, 0, &format))
{
@@ -129,7 +129,7 @@
ntohs (buffer->header.size) - sizeof (CS_tracekit_reply_MESSAGE);
if (count < 0)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
break; /* faulty reply */
}
GNUNET_hash_to_enc (&buffer->responderId.hashPubKey, &enc);
@@ -152,7 +152,7 @@
sizeof (CS_tracekit_reply_MESSAGE) +
count * sizeof (GNUNET_PeerIdentity))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
break;
}
if (count == 0)
@@ -180,7 +180,7 @@
match = GNUNET_NO;
for (j = 0; j < psCount; j++)
if (0 ==
- memcmp (&((CS_tracekit_reply_MESSAGE_GENERIC *) buffer)->
+ memcmp (&((CS_tracekit_reply_MESSAGNUNET_GE_GENERIC *)
buffer)->
peerList[i].hashPubKey, &peersSeen[j].hashPubKey,
sizeof (GNUNET_HashCode)))
match = GNUNET_YES;
@@ -189,13 +189,13 @@
if (psCount == psSize)
GNUNET_array_grow (peersSeen, psSize, psSize * 2);
memcpy (&peersSeen[psCount++],
- &((CS_tracekit_reply_MESSAGE_GENERIC *) buffer)->
+ &((CS_tracekit_reply_MESSAGNUNET_GE_GENERIC *)
buffer)->
peerList[i].hashPubKey,
sizeof (GNUNET_PeerIdentity));
}
GNUNET_hash_to_enc (&
- ((CS_tracekit_reply_MESSAGE_GENERIC *)
+ ((CS_tracekit_reply_MESSAGNUNET_GE_GENERIC *)
buffer)->peerList[i].hashPubKey, &other);
switch (format)
{
@@ -302,7 +302,7 @@
void *unused;
CS_tracekit_probe_MESSAGE probe;
int sleepTime;
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
struct GNUNET_CronManager *cron;
int res;
@@ -327,19 +327,19 @@
messageReceiveThread =
GNUNET_thread_create (&receiveThread, sock, 128 * 1024);
if (messageReceiveThread == NULL)
- GE_DIE_STRERROR (ectx,
- GE_FATAL | GE_IMMEDIATE | GE_ADMIN, "pthread_create");
+ GNUNET_GE_DIE_STRERROR (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_IMMEDIATE | GNUNET_GE_ADMIN,
"pthread_create");
probe.header.size = htons (sizeof (CS_tracekit_probe_MESSAGE));
- probe.header.type = htons (CS_PROTO_tracekit_PROBE);
+ probe.header.type = htons (GNUNET_CS_PROTO_TRACEKIT_PROBE);
probe.hops
= htonl (getConfigurationInt ("GNUNET-TRACEKIT", "HOPS", 0xFFFFFFFF));
probe.priority
= htonl (getConfigurationInt ("GNUNET-TRACEKIT", "PRIORITY", 0xFFFFFFFF));
if (GNUNET_SYSERR == GNUNET_client_connection_write (sock, &probe.header))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Could not send request to gnunetd.\n"));
return -1;
}
Modified: GNUnet/src/applications/tracekit/tracekit.c
===================================================================
--- GNUnet/src/applications/tracekit/tracekit.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/tracekit/tracekit.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -29,15 +29,15 @@
#include "gnunet_protocols.h"
#include "tracekit.h"
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
static struct GNUNET_Mutex *lock;
static unsigned int clientCount;
-static struct ClientHandle **clients;
+static struct GNUNET_ClientHandle **clients;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
typedef struct
{
@@ -69,16 +69,16 @@
sizeof (P2P_tracekit_reply_MESSAGE) +
hostCount * sizeof (GNUNET_PeerIdentity))
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Received invalid `%s' message from `%s'.\n"),
"P2P_tracekit_probe_MESSAGE", &sen);
return GNUNET_SYSERR;
}
reply = (P2P_tracekit_reply_MESSAGE *) message;
GNUNET_hash_to_enc (&reply->initiatorId.hashPubKey, &initiator);
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"TRACEKIT: Sending reply back to initiator `%s'.\n", &initiator);
GNUNET_mutex_lock (lock);
for (i = 0; i < MAXROUTE; i++)
@@ -92,8 +92,8 @@
&reply->initiatorId.hashPubKey,
sizeof (GNUNET_HashCode))))
{
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"TRACEKIT: found matching entry in routing table\n");
if (0 == memcmp (&coreAPI->myIdentity->hashPubKey,
&routeTable[i]->replyTo.hashPubKey,
@@ -103,18 +103,18 @@
CS_tracekit_reply_MESSAGE *csReply;
idx = ntohl (reply->clientId);
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"TRACEKIT: I am initiator, sending to client.\n");
if (idx >= clientCount)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
continue; /* discard */
}
if (clients[idx] == NULL)
{
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"TRACEKIT: received response on slot %u, but client
already exited.\n",
idx);
continue; /* discard */
@@ -128,11 +128,11 @@
=
htons (sizeof (CS_tracekit_reply_MESSAGE) +
hostCount * sizeof (GNUNET_PeerIdentity));
- csReply->header.type = htons (CS_PROTO_tracekit_REPLY);
+ csReply->header.type = htons (GNUNET_CS_PROTO_TRACEKIT_REPLY);
csReply->responderId = reply->responderId;
- memcpy (&((CS_tracekit_reply_MESSAGE_GENERIC *) csReply)->
+ memcpy (&((CS_tracekit_reply_MESSAGNUNET_GE_GENERIC *) csReply)->
peerList[0],
- &((P2P_tracekit_reply_MESSAGE_GENERIC *) reply)->
+ &((P2P_tracekit_reply_MESSAGNUNET_GE_GENERIC *) reply)->
peerList[0], hostCount * sizeof (GNUNET_PeerIdentity));
coreAPI->sendToClient (clients[idx], &csReply->header,
GNUNET_YES);
@@ -143,8 +143,8 @@
GNUNET_EncName hop;
GNUNET_hash_to_enc (&routeTable[i]->replyTo.hashPubKey, &hop);
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"TRACEKIT: forwarding to next hop `%s'\n", &hop);
coreAPI->unicast (&routeTable[i]->replyTo,
message, routeTable[i]->priority, 0);
@@ -206,20 +206,20 @@
GNUNET_hash_to_enc (&sender->hashPubKey, &sen);
if (ntohs (message->size) != sizeof (P2P_tracekit_probe_MESSAGE))
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Received invalid `%s' message from `%s'.\n"),
"P2P_tracekit_probe_MESSAGE", &sen);
return GNUNET_SYSERR;
}
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER, "TRACEKIT: received probe\n");
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, "TRACEKIT:
received probe\n");
GNUNET_get_time_int32 (&now);
msg = (P2P_tracekit_probe_MESSAGE *) message;
if ((GNUNET_Int32Time) ntohl (msg->timestamp) > 3600 + now)
{
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"TRACEKIT: probe has timestamp in the far future (%d > %d),
dropping\n",
ntohl (msg->timestamp), 3600 + now);
return GNUNET_SYSERR; /* Timestamp is more than 1h in the future.
Invalid! */
@@ -237,8 +237,8 @@
&msg->initiatorId.hashPubKey,
sizeof (GNUNET_HashCode)))
{
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"TRACEKIT-PROBE %d from `%s' received twice (slot %d),
ignored\n",
ntohl (msg->timestamp), &init, i);
GNUNET_mutex_unlock (lock);
@@ -271,8 +271,8 @@
if (sel == -1)
{
GNUNET_mutex_unlock (lock);
- GE_LOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("TRACEKIT: routing table full, trace request dropped\n"));
return GNUNET_OK;
}
@@ -283,8 +283,8 @@
routeTable[sel]->initiator = msg->initiatorId;
routeTable[sel]->replyTo = *sender;
GNUNET_mutex_unlock (lock);
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"TRACEKIT-PROBE started at %d by peer `%s' received, processing in
slot %d with %u hops\n",
ntohl (msg->timestamp), &init, sel, ntohl (msg->hopsToGo));
hops = ntohl (msg->hopsToGo);
@@ -309,7 +309,7 @@
count * sizeof (GNUNET_PeerIdentity);
reply = GNUNET_malloc (size);
reply->header.size = htons (size);
- reply->header.type = htons (P2P_PROTO_tracekit_REPLY);
+ reply->header.type = htons (GNUNET_P2P_PROTO_TRACEKIT_REPLY);
reply->initiatorId = msg->initiatorId;
reply->responderId = *(coreAPI->myIdentity);
reply->initiatorTimestamp = msg->timestamp;
@@ -334,23 +334,23 @@
}
static int
-csHandle (struct ClientHandle *client, const GNUNET_MessageHeader * message)
+csHandle (struct GNUNET_ClientHandle *client, const GNUNET_MessageHeader *
message)
{
int i;
int idx;
CS_tracekit_probe_MESSAGE *csProbe;
P2P_tracekit_probe_MESSAGE p2pProbe;
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"TRACEKIT: client sends probe request\n");
/* build probe, broadcast */
csProbe = (CS_tracekit_probe_MESSAGE *) message;
if (ntohs (csProbe->header.size) != sizeof (CS_tracekit_probe_MESSAGE))
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("TRACEKIT: received invalid `%s' message\n"),
"CS_tracekit_probe_MESSAGE");
return GNUNET_SYSERR;
@@ -378,12 +378,12 @@
}
clients[idx] = client;
GNUNET_mutex_unlock (lock);
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"TRACEKIT: client joins in slot %u.\n", idx);
p2pProbe.header.size = htons (sizeof (P2P_tracekit_probe_MESSAGE));
- p2pProbe.header.type = htons (P2P_PROTO_tracekit_PROBE);
+ p2pProbe.header.type = htons (GNUNET_P2P_PROTO_TRACEKIT_PROBE);
p2pProbe.clientId = htonl (idx);
p2pProbe.hopsToGo = csProbe->hops;
p2pProbe.timestamp = htonl (GNUNET_get_time_int32 (NULL));
@@ -395,7 +395,7 @@
}
static void
-clientExitHandler (struct ClientHandle *c)
+clientExitHandler (struct GNUNET_ClientHandle *c)
{
int i;
@@ -403,8 +403,8 @@
for (i = 0; i < clientCount; i++)
if (clients[i] == c)
{
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"TRACEKIT: client in slot %u exits.\n", i);
clients[i] = NULL;
break;
@@ -419,32 +419,32 @@
}
int
-initialize_module_tracekit (CoreAPIForApplication * capi)
+initialize_module_tracekit (GNUNET_CoreAPIForPlugins * capi)
{
int ok = GNUNET_OK;
ectx = capi->ectx;
lock = GNUNET_mutex_create (GNUNET_NO);
coreAPI = capi;
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"TRACEKIT registering handlers %d %d and %d\n",
- P2P_PROTO_tracekit_PROBE,
- P2P_PROTO_tracekit_REPLY, CS_PROTO_tracekit_PROBE);
+ GNUNET_P2P_PROTO_TRACEKIT_PROBE,
+ GNUNET_P2P_PROTO_TRACEKIT_REPLY, GNUNET_CS_PROTO_TRACEKIT_PROBE);
memset (routeTable, 0, MAXROUTE * sizeof (RTE *));
- if (GNUNET_SYSERR == capi->registerHandler (P2P_PROTO_tracekit_PROBE,
+ if (GNUNET_SYSERR == capi->registerHandler (GNUNET_P2P_PROTO_TRACEKIT_PROBE,
&handlep2pProbe))
ok = GNUNET_SYSERR;
- if (GNUNET_SYSERR == capi->registerHandler (P2P_PROTO_tracekit_REPLY,
+ if (GNUNET_SYSERR == capi->registerHandler (GNUNET_P2P_PROTO_TRACEKIT_REPLY,
&handlep2pReply))
ok = GNUNET_SYSERR;
if (GNUNET_SYSERR == capi->registerClientExitHandler (&clientExitHandler))
ok = GNUNET_SYSERR;
- if (GNUNET_SYSERR == capi->registerClientHandler (CS_PROTO_tracekit_PROBE,
- (CSHandler) & csHandle))
+ if (GNUNET_SYSERR == capi->registerClientHandler
(GNUNET_CS_PROTO_TRACEKIT_PROBE,
+
(GNUNET_ClientRequestHandler) & csHandle))
ok = GNUNET_SYSERR;
- GE_ASSERT (capi->ectx,
- 0 == GC_set_configuration_value_string (capi->cfg,
+ GNUNET_GE_ASSERT (capi->ectx,
+ 0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
capi->ectx,
"ABOUT",
"tracekit",
@@ -458,10 +458,10 @@
{
int i;
- coreAPI->unregisterHandler (P2P_PROTO_tracekit_PROBE, &handlep2pProbe);
- coreAPI->unregisterHandler (P2P_PROTO_tracekit_REPLY, &handlep2pReply);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_TRACEKIT_PROBE,
&handlep2pProbe);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_TRACEKIT_REPLY,
&handlep2pReply);
coreAPI->unregisterClientExitHandler (&clientExitHandler);
- coreAPI->unregisterClientHandler (CS_PROTO_tracekit_PROBE, &csHandle);
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_TRACEKIT_PROBE, &csHandle);
for (i = 0; i < MAXROUTE; i++)
{
GNUNET_free_non_null (routeTable[i]);
Modified: GNUnet/src/applications/tracekit/tracekit.h
===================================================================
--- GNUnet/src/applications/tracekit/tracekit.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/tracekit/tracekit.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -98,7 +98,7 @@
* currently connected to.
*/
GNUNET_PeerIdentity peerList[1];
-} P2P_tracekit_reply_MESSAGE_GENERIC;
+} P2P_tracekit_reply_MESSAGNUNET_GE_GENERIC;
typedef struct
@@ -137,6 +137,6 @@
* currently connected to.
*/
GNUNET_PeerIdentity peerList[1];
-} CS_tracekit_reply_MESSAGE_GENERIC;
+} CS_tracekit_reply_MESSAGNUNET_GE_GENERIC;
#endif
Modified: GNUnet/src/applications/traffic/clientapi.c
===================================================================
--- GNUnet/src/applications/traffic/clientapi.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/traffic/clientapi.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -37,7 +37,7 @@
* @param sock socket to query gnunetd over
* @param timeframe what time interval should be considered
* @param type what type of message do we care about?
- * @param direction TC_RECEIVED of TC_SEND?
+ * @param direction GNUNET_TRAFFIC_TYPE_RECEIVED of TC_SEND?
* @param count set to number of messages
* @param avg_size set to average size
* @param peers set to number of peers involved
@@ -57,7 +57,7 @@
int i;
req.header.size = htons (sizeof (CS_traffic_request_MESSAGE));
- req.header.type = htons (CS_PROTO_traffic_QUERY);
+ req.header.type = htons (GNUNET_CS_PROTO_TRAFFIC_QUERY);
req.timePeriod = htonl (timeframe);
if (GNUNET_SYSERR == GNUNET_client_connection_write (sock, &req.header))
return GNUNET_SYSERR;
@@ -66,24 +66,24 @@
GNUNET_client_connection_read (sock, (GNUNET_MessageHeader **) & info))
return GNUNET_SYSERR;
if ((ntohs (info->header.type) !=
- CS_PROTO_traffic_INFO) ||
+ GNUNET_CS_PROTO_TRAFFIC_INFO) ||
(ntohs (info->header.size) !=
sizeof (CS_traffic_info_MESSAGE) +
ntohl (info->count) * sizeof (TRAFFIC_COUNTER)))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
for (i = ntohl (info->count) - 1; i >= 0; i--)
{
const TRAFFIC_COUNTER *tc =
- &((CS_traffic_info_MESSAGE_GENERIC *) info)->counters[i];
- if ((tc->flags & TC_TYPE_MASK) == direction)
+ &((CS_traffic_info_MESSAGNUNET_GE_GENERIC *) info)->counters[i];
+ if ((tc->flags & GNUNET_TRAFFIC_TYPE_MASK) == direction)
{
*count = ntohl (tc->count);
*avg_size = ntohl (tc->avrg_size);
- *peers = ntohs (tc->flags) & TC_DIVERSITY_MASK;
+ *peers = ntohs (tc->flags) & GNUNET_TRAFFIC_DIVERSITY_MASK;
*time = ntohl (tc->time_slots);
} /* end if received */
} /* end for all counters */
Modified: GNUnet/src/applications/traffic/traffic.c
===================================================================
--- GNUnet/src/applications/traffic/traffic.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/traffic/traffic.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -44,19 +44,19 @@
/**
* How many time-units back do we keep the history of? (must really
* be <=32 since we use the 32 bit in an unsigned int). The memory
- * impact of this value n is 4 * 3 * MAX_MESSAGE_ID * n, which is for
- * the default of n=32 with the current MAX_MESSAGE_ID being roughly a
+ * impact of this value n is 4 * 3 * MAX_MESSAGNUNET_GE_ID * n, which is for
+ * the default of n=32 with the current MAX_MESSAGNUNET_GE_ID being roughly a
* dozen less than 2k.
*/
#define HISTORY_SIZE 32
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
-static int stat_traffic_received_by_type[P2P_PROTO_MAX_USED];
+static int stat_traffic_received_by_type[GNUNET_P2P_PROTO_MAX_USED];
-static int stat_pt_traffic_received_by_type[P2P_PROTO_MAX_USED];
+static int stat_pt_traffic_received_by_type[GNUNET_P2P_PROTO_MAX_USED];
-static int stat_traffic_transmitted_by_type[P2P_PROTO_MAX_USED];
+static int stat_traffic_transmitted_by_type[GNUNET_P2P_PROTO_MAX_USED];
/**
* Macro to access the slot at time "t" in the history.
@@ -66,7 +66,7 @@
/**
* Of how many peers do we keep track per message type
* about "recent" interactions? The memory impact of
- * this value n is 8 * 3 * MAX_MESSAGE_ID * n. The current
+ * this value n is 8 * 3 * MAX_MESSAGNUNET_GE_ID * n. The current
* number of messages is roughly a dozen, so the memory
* impact is about 200 bytes * n, or for the default
* of n=15 it is 3kb.
@@ -163,7 +163,7 @@
static unsigned long long server_port;
#endif
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
/**
* Update the use table dtc. A message of the given
@@ -184,10 +184,10 @@
unsigned int slot;
now = GNUNET_get_time ();
- unitNow = now / TRAFFIC_TIME_UNIT;
+ unitNow = now / GNUNET_TRAFFIC_TIME_UNIT;
delta = now - dtc->lastUpdate;
dtc->lastUpdate = now;
- deltaUnits = delta / TRAFFIC_TIME_UNIT;
+ deltaUnits = delta / GNUNET_TRAFFIC_TIME_UNIT;
if (GNUNET_NO == expireOnly)
{
@@ -262,7 +262,7 @@
updateUse (dtc, 0, 0, GNUNET_YES); /* expire old entries */
now = GNUNET_get_time ();
- unitNow = now / TRAFFIC_TIME_UNIT;
+ unitNow = now / GNUNET_TRAFFIC_TIME_UNIT;
/* count number of peers that we interacted with in
the last countTimeUnits */
@@ -313,7 +313,7 @@
}
reply = GNUNET_malloc (sizeof (CS_traffic_info_MESSAGE) +
count * sizeof (TRAFFIC_COUNTER));
- reply->header.type = htons (CS_PROTO_traffic_INFO);
+ reply->header.type = htons (GNUNET_CS_PROTO_TRAFFIC_INFO);
reply->header.size = htons (sizeof (CS_traffic_info_MESSAGE) +
count * sizeof (TRAFFIC_COUNTER));
reply->count = htonl (count);
@@ -322,12 +322,12 @@
if (counters[i] != NULL)
{
if (counters[i]->send.slots != 0)
- buildSummary (&((CS_traffic_info_MESSAGE_GENERIC *) reply)->
- counters[count++], &counters[i]->send, TC_SENT,
+ buildSummary (&((CS_traffic_info_MESSAGNUNET_GE_GENERIC *) reply)->
+ counters[count++], &counters[i]->send,
GNUNET_TRAFFIC_TYPE_SENT,
countTimeUnits, i);
if (counters[i]->receive.slots != 0)
- buildSummary (&((CS_traffic_info_MESSAGE_GENERIC *) reply)->
- counters[count++], &counters[i]->receive, TC_RECEIVED,
+ buildSummary (&((CS_traffic_info_MESSAGNUNET_GE_GENERIC *) reply)->
+ counters[count++], &counters[i]->receive,
GNUNET_TRAFFIC_TYPE_RECEIVED,
countTimeUnits, i);
}
@@ -336,7 +336,7 @@
}
static int
-trafficQueryHandler (struct ClientHandle *sock,
+trafficQueryHandler (struct GNUNET_ClientHandle *sock,
const GNUNET_MessageHeader * message)
{
const CS_traffic_request_MESSAGE *msg;
@@ -358,7 +358,7 @@
* were received or send of a given type.
*
* @param messageType the type of the message
- * @param sendReceive TC_SENT for sending, TC_RECEIVED for receiving
+ * @param sendReceive GNUNET_TRAFFIC_TYPE_SENT for sending,
GNUNET_TRAFFIC_TYPE_RECEIVED for receiving
* @param timePeriod how many TRAFFIC_TIME_UNITs to take
* into consideration (limited by HISTORY_SIZE)
* @param avgMessageSize average size of the messages (set)
@@ -394,13 +394,13 @@
return GNUNET_OK;
}
- if (sendReceive == TC_SENT)
+ if (sendReceive == GNUNET_TRAFFIC_TYPE_SENT)
dtc = &counters[messageType]->send;
else
dtc = &counters[messageType]->receive;
updateUse (dtc, 0, 0, GNUNET_YES);
- nowUnit = GNUNET_get_time () / TRAFFIC_TIME_UNIT;
+ nowUnit = GNUNET_get_time () / GNUNET_TRAFFIC_TIME_UNIT;
*peerCount = 0;
*messageCount = 0;
totSize = 0;
@@ -445,7 +445,7 @@
static void
updateTrafficSendCounter (unsigned short ptyp, unsigned short plen)
{
- if (ptyp >= P2P_PROTO_MAX_USED)
+ if (ptyp >= GNUNET_P2P_PROTO_MAX_USED)
return; /* not tracked */
if (0 == stat_traffic_transmitted_by_type[ptyp])
{
@@ -461,7 +461,7 @@
static void
updateTrafficReceiveCounter (unsigned short ptyp, unsigned short plen)
{
- if (ptyp < P2P_PROTO_MAX_USED)
+ if (ptyp < GNUNET_P2P_PROTO_MAX_USED)
{
if (0 == stat_traffic_received_by_type[ptyp])
{
@@ -479,7 +479,7 @@
updatePlaintextTrafficReceiveCounter (unsigned short ptyp,
unsigned short plen)
{
- if (ptyp < P2P_PROTO_MAX_USED)
+ if (ptyp < GNUNET_P2P_PROTO_MAX_USED)
{
if (0 == stat_pt_traffic_received_by_type[ptyp])
{
@@ -549,7 +549,7 @@
*/
static int
plaintextReceive (const GNUNET_PeerIdentity * receiver,
- const GNUNET_MessageHeader * header, TSession * session)
+ const GNUNET_MessageHeader * header, GNUNET_TSession *
session)
{
unsigned short port;
@@ -564,30 +564,30 @@
/**
* Initialize the traffic module.
*/
-Traffic_ServiceAPI *
-provide_module_traffic (CoreAPIForApplication * capi)
+GNUNET_Traffic_ServiceAPI *
+provide_module_traffic (GNUNET_CoreAPIForPlugins * capi)
{
- static Traffic_ServiceAPI api;
+ static GNUNET_Traffic_ServiceAPI api;
int i;
coreAPI = capi;
#if DEBUG
- GC_get_configuration_value_number (capi->cfg,
+ GNUNET_GC_get_configuration_value_number (capi->cfg,
"NETWORK",
"PORT", 0, 65536, 2087, &server_port);
#endif
api.get = &getTrafficStats;
- for (i = 0; i < P2P_PROTO_MAX_USED; i++)
+ for (i = 0; i < GNUNET_P2P_PROTO_MAX_USED; i++)
stat_traffic_transmitted_by_type[i] = 0;
coreAPI->registerSendNotify (&trafficSend);
- for (i = 0; i < P2P_PROTO_MAX_USED; i++)
+ for (i = 0; i < GNUNET_P2P_PROTO_MAX_USED; i++)
{
stat_traffic_received_by_type[i] = 0;
coreAPI->registerHandler (i, &trafficReceive);
coreAPI->registerPlaintextHandler (i, &plaintextReceive);
}
- GE_ASSERT (coreAPI->ectx, counters == NULL);
+ GNUNET_GE_ASSERT (coreAPI->ectx, counters == NULL);
lock = GNUNET_mutex_create (GNUNET_NO);
stats = capi->requestService ("stats");
return &api;
@@ -601,7 +601,7 @@
{
unsigned int i;
- for (i = 0; i < P2P_PROTO_MAX_USED; i++)
+ for (i = 0; i < GNUNET_P2P_PROTO_MAX_USED; i++)
{
coreAPI->unregisterHandler (i, &trafficReceive);
coreAPI->unregisterPlaintextHandler (i, &plaintextReceive);
@@ -619,27 +619,27 @@
-static Traffic_ServiceAPI *myApi;
-static CoreAPIForApplication *myCoreAPI;
+static GNUNET_Traffic_ServiceAPI *myApi;
+static GNUNET_CoreAPIForPlugins *myCoreAPI;
/**
* Initialize the traffic module.
*/
int
-initialize_module_traffic (CoreAPIForApplication * capi)
+initialize_module_traffic (GNUNET_CoreAPIForPlugins * capi)
{
- GE_ASSERT (capi->ectx, myCoreAPI == NULL);
+ GNUNET_GE_ASSERT (capi->ectx, myCoreAPI == NULL);
myCoreAPI = capi;
myApi = capi->requestService ("traffic");
if (myApi == NULL)
{
- GE_BREAK (capi->ectx, 0);
+ GNUNET_GE_BREAK (capi->ectx, 0);
myCoreAPI = NULL;
return GNUNET_SYSERR;
}
- capi->registerClientHandler (CS_PROTO_traffic_QUERY, &trafficQueryHandler);
- GE_ASSERT (capi->ectx,
- 0 == GC_set_configuration_value_string (capi->cfg,
+ capi->registerClientHandler (GNUNET_CS_PROTO_TRAFFIC_QUERY,
&trafficQueryHandler);
+ GNUNET_GE_ASSERT (capi->ectx,
+ 0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
capi->ectx,
"ABOUT",
"traffic",
@@ -654,10 +654,10 @@
void
done_module_traffic ()
{
- GE_ASSERT (NULL, myCoreAPI != NULL);
- GE_ASSERT (myCoreAPI->ectx,
+ GNUNET_GE_ASSERT (NULL, myCoreAPI != NULL);
+ GNUNET_GE_ASSERT (myCoreAPI->ectx,
GNUNET_SYSERR !=
- myCoreAPI->unregisterClientHandler (CS_PROTO_traffic_QUERY,
+ myCoreAPI->unregisterClientHandler (GNUNET_CS_PROTO_TRAFFIC_QUERY,
&trafficQueryHandler));
myCoreAPI->releaseService (myApi);
myApi = NULL;
Modified: GNUnet/src/applications/traffic/traffic.h
===================================================================
--- GNUnet/src/applications/traffic/traffic.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/traffic/traffic.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -95,7 +95,7 @@
*/
TRAFFIC_COUNTER counters[1];
-} CS_traffic_info_MESSAGE_GENERIC;
+} CS_traffic_info_MESSAGNUNET_GE_GENERIC;
/**
* Request for CS_traffic_info_MESSAGE.
Modified: GNUnet/src/applications/transport/check.c
===================================================================
--- GNUnet/src/applications/transport/check.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/transport/check.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -15,7 +15,7 @@
/**
* Our tsession.
*/
- TSession *tsession;
+ GNUNET_TSession *tsession;
/**
* mutex for synchronized access to 'users'
@@ -50,14 +50,14 @@
} TCPSession;
static void
-check (TSession * session)
+check (GNUNET_TSession * session)
{
TCPSession *tcp;
- if (session->ttype != TCP_PROTOCOL_NUMBER)
+ if (session->ttype != GNUNET_TRANSPORT_PROTOCOL_NUMBER_TCP)
return;
tcp = session->internal;
- GE_ASSERT (NULL, tcp->users >= session->token_count);
+ GNUNET_GE_ASSERT (NULL, tcp->users >= session->token_count);
}
#define CHECK(s) check(s)
Modified: GNUnet/src/applications/transport/transport.c
===================================================================
--- GNUnet/src/applications/transport/transport.c 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/applications/transport/transport.c 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -36,9 +36,9 @@
static CoreAPIForTransport ctapi;
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
-static Identity_ServiceAPI *identity;
+static GNUNET_Identity_ServiceAPI *identity;
/**
* Note that this array MUST not be modified
@@ -55,7 +55,7 @@
static struct GNUNET_Mutex *lock;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
#define HELLO_RECREATE_FREQ (5 * GNUNET_CRON_MINUTES)
@@ -72,13 +72,13 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
static int
-assertAssociated (TSession * tsession, const char *token)
+assertAssociated (GNUNET_TSession * tsession, const char *token)
{
int i;
if (tsession == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
GNUNET_mutex_lock (lock);
@@ -92,7 +92,7 @@
}
if (i != -1)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
@@ -122,7 +122,7 @@
coreAPI->myIdentity, sizeof (GNUNET_PeerIdentity));
tapi->hello->expirationTime =
htonl (GNUNET_get_time_int32 (NULL) + hello_live);
- tapi->hello->header.type = htons (p2p_PROTO_hello);
+ tapi->hello->header.type = htons (GNUNET_P2P_PROTO_HELLO);
tapi->hello->header.size = htons (GNUNET_sizeof_hello (tapi->hello));
if (GNUNET_SYSERR == identity->signData (&(tapi->hello)->senderIdentity,
GNUNET_sizeof_hello (tapi->
@@ -134,7 +134,7 @@
{
GNUNET_free (tapi->hello);
tapi->hello = NULL;
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
}
GNUNET_mutex_unlock (tapis_lock);
}
@@ -163,7 +163,7 @@
GNUNET_array_grow (tapis, tapis_count, tapi->protocolNumber + 1);
if (tapis[tapi->protocolNumber] != NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
tapis[tapi->protocolNumber] = tapi;
@@ -186,8 +186,8 @@
prot = ntohs (hello->protocol);
if ((prot >= tapis_count) || (tapis[prot] == NULL))
{
- GE_LOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_
("Converting peer address to string failed, transport type %d
not supported\n"),
ntohs (hello->protocol));
@@ -202,7 +202,7 @@
* @param data second argument to callback
*/
static int
-forEachTransport (TransportCallback callback, void *data)
+forEachTransport (GNUNET_TransportCallback callback, void *data)
{
int i;
int ret;
@@ -230,18 +230,18 @@
* re-used?
* @return session on success, NULL on error
*/
-static TSession *
+static GNUNET_TSession *
transportConnect (const GNUNET_MessageHello * hello,
const char *token, int may_reuse)
{
unsigned short prot;
- TSession *tsession;
+ GNUNET_TSession *tsession;
prot = ntohs (hello->protocol);
if ((prot >= tapis_count) || (tapis[prot] == NULL))
{
- GE_LOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER | GE_ADMIN,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER |
GNUNET_GE_ADMIN,
_
("Transport connection attempt failed, transport type %d not
supported\n"),
prot);
@@ -255,18 +255,18 @@
GNUNET_array_append (tsession->tokens, tsession->token_count, token);
CHECK (tsession);
GNUNET_mutex_unlock (lock);
- GE_BREAK (NULL, GNUNET_OK == assertAssociated (tsession, token));
+ GNUNET_GE_BREAK (NULL, GNUNET_OK == assertAssociated (tsession, token));
return tsession;
}
-static TSession *
+static GNUNET_TSession *
transportConnectFreely (const GNUNET_PeerIdentity * peer, int useTempList,
const char *token)
{
int i;
GNUNET_MessageHello *hello;
unsigned int *perm;
- TSession *ret;
+ GNUNET_TSession *ret;
unsigned int hc;
#if DEBUG_TRANSPORT
GNUNET_EncName enc;
@@ -293,8 +293,8 @@
{
#if DEBUG_TRANSPORT
GNUNET_hash_to_enc (&peer->hashPubKey, &enc);
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_ADMIN,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_ADMIN,
_
("Transport failed to connect to peer `%s' (%u HELLOs known,
none worked)\n"),
&enc, hc);
@@ -315,7 +315,7 @@
* GNUNET_SYSERR if not.
*/
static int
-transportAssociate (TSession * tsession, const char *token)
+transportAssociate (GNUNET_TSession * tsession, const char *token)
{
int ret;
@@ -329,7 +329,7 @@
CHECK (tsession);
GNUNET_mutex_unlock (lock);
if (ret == GNUNET_OK)
- GE_BREAK (NULL, GNUNET_OK == assertAssociated (tsession, token));
+ GNUNET_GE_BREAK (NULL, GNUNET_OK == assertAssociated (tsession, token));
return ret;
}
@@ -354,24 +354,24 @@
* temporary error
*/
static int
-transportSend (TSession * tsession,
+transportSend (GNUNET_TSession * tsession,
const void *msg, unsigned int size, int important)
{
if (tsession == NULL)
{
- GE_LOG (ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"Transmission attempted on uni-directional pipe, failing.\n");
return GNUNET_SYSERR; /* can't do that, can happen for
unidirectional pipes
- that call core with TSession being NULL. */
+ that call core with GNUNET_TSession being
NULL. */
}
GNUNET_mutex_lock (lock);
CHECK (tsession);
GNUNET_mutex_unlock (lock);
if ((tsession->ttype >= tapis_count) || (tapis[tsession->ttype] == NULL))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Transmission attempt failed, transport type %d unknown.\n"),
tsession->ttype);
return GNUNET_SYSERR;
@@ -384,18 +384,18 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
static int
-transportDisconnect (TSession * tsession, const char *token)
+transportDisconnect (GNUNET_TSession * tsession, const char *token)
{
int i;
if (tsession == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
if ((tsession->ttype >= tapis_count) || (tapis[tsession->ttype] == NULL))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
GNUNET_mutex_lock (lock);
@@ -414,9 +414,9 @@
}
if (i != -1)
{
- GE_BREAK (ectx, 0);
- GE_LOG (ectx,
- GE_ERROR | GE_DEVELOPER | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_BREAK (ectx, 0);
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_DEVELOPER | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE,
"Illegal call to `%s', do not have token `%s'\n",
__FUNCTION__, token);
GNUNET_mutex_unlock (lock);
@@ -424,7 +424,7 @@
}
GNUNET_mutex_unlock (lock);
i = tapis[tsession->ttype]->disconnect (tsession);
- GE_BREAK (NULL, i == GNUNET_OK); /* should never fail */
+ GNUNET_GE_BREAK (NULL, i == GNUNET_OK); /* should never fail */
return i;
}
@@ -440,7 +440,7 @@
unsigned short prot;
if ((ntohs (hello->header.size) != GNUNET_sizeof_hello (hello)) ||
- (ntohs (hello->header.type) != p2p_PROTO_hello))
+ (ntohs (hello->header.type) != GNUNET_P2P_PROTO_HELLO))
return GNUNET_SYSERR; /* invalid */
prot = ntohs (hello->protocol);
if ((prot >= tapis_count) || (tapis[prot] == NULL))
@@ -470,7 +470,7 @@
GNUNET_MessageHello *hello;
GNUNET_mutex_lock (tapis_lock);
- if (ttype == ANY_PROTOCOL_NUMBER)
+ if (ttype == GNUNET_TRANSPORT_PROTOCOL_NUMBER_ANY)
{
unsigned int *perm;
@@ -492,8 +492,8 @@
}
if ((ttype >= tapis_count) || (tapis[ttype] == NULL))
{
- GE_LOG (ectx,
- GE_DEBUG | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_USER,
_("No transport of type %d known.\n"), ttype);
GNUNET_mutex_unlock (tapis_lock);
return NULL;
@@ -551,8 +551,8 @@
GNUNET_mutex_unlock (tapis_lock);
if (tcount == 0)
{
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_REQUEST,
_("No transport succeeded in creating a hello!\n"));
GNUNET_free (hellos);
return GNUNET_SYSERR;
@@ -573,8 +573,8 @@
GNUNET_free (hellos[i]);
GNUNET_free (hellos);
if (used == 0)
- GE_LOG (ectx,
- GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_REQUEST,
"No HELLOs fit in %u bytes.\n", maxLen);
return used;
}
@@ -683,7 +683,7 @@
* GNUNET_SYSERR if the size/session is invalid
*/
static int
-testWouldTry (TSession * tsession, unsigned int size, int important)
+testWouldTry (GNUNET_TSession * tsession, unsigned int size, int important)
{
if (tsession == NULL)
return GNUNET_SYSERR;
@@ -695,10 +695,10 @@
/**
* Initialize the transport layer.
*/
-Transport_ServiceAPI *
-provide_module_transport (CoreAPIForApplication * capi)
+GNUNET_Transport_ServiceAPI *
+provide_module_transport (GNUNET_CoreAPIForPlugins * capi)
{
- static Transport_ServiceAPI ret;
+ static GNUNET_Transport_ServiceAPI ret;
TransportAPI *tapi;
TransportMainMethod tptr;
char *dso;
@@ -708,20 +708,20 @@
GNUNET_EncName myself;
ectx = capi->ectx;
- if (-1 == GC_get_configuration_value_number (capi->cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_number (capi->cfg,
"GNUNETD",
"HELLOEXPIRES",
1,
- MAX_HELLO_EXPIRES / 60,
+ GNUNET_MAX_HELLO_EXPIRES / 60,
60, &hello_live))
return NULL;
hello_live *= 60;
- GE_ASSERT (ectx, sizeof (GNUNET_MessageHello) == 600);
+ GNUNET_GE_ASSERT (ectx, sizeof (GNUNET_MessageHello) == 600);
identity = capi->requestService ("identity");
if (identity == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return NULL;
}
coreAPI = capi;
@@ -736,22 +736,22 @@
ctapi.releaseService = coreAPI->releaseService;
ctapi.assertUnused = coreAPI->assertUnused;
- GNUNET_array_grow (tapis, tapis_count, UDP_PROTOCOL_NUMBER + 1);
+ GNUNET_array_grow (tapis, tapis_count, GNUNET_TRANSPORT_PROTOCOL_NUMBER_UDP
+ 1);
tapis_lock = GNUNET_mutex_create (GNUNET_YES);
lock = GNUNET_mutex_create (GNUNET_NO);
/* now load transports */
dso = NULL;
- GE_ASSERT (ectx,
- -1 != GC_get_configuration_value_string (capi->cfg,
+ GNUNET_GE_ASSERT (ectx,
+ -1 != GNUNET_GC_get_configuration_value_string (capi->cfg,
"GNUNETD",
"TRANSPORTS",
"udp tcp nat", &dso));
if (strlen (dso) != 0)
{
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Loading transports `%s'\n"), dso);
next = dso;
do
@@ -769,8 +769,8 @@
lib = GNUNET_plugin_load (ectx, "libgnunettransport_", pos);
if (lib == NULL)
{
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE,
_("Could not load transport plugin `%s'\n"), pos);
continue;
}
@@ -779,9 +779,9 @@
GNUNET_YES);
if (tptr == NULL)
{
- GE_LOG (ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_DEVELOPER |
- GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_DEVELOPER |
+ GNUNET_GE_IMMEDIATE,
_
("Transport library `%s' did not provide required
function '%s%s'.\n"),
pos, "inittransport_", pos);
@@ -810,8 +810,8 @@
}
else
{
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Loaded transport `%s'\n"), pos);
}
}
@@ -820,10 +820,10 @@
GNUNET_free (dso);
IF_GELOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&coreAPI->myIdentity->hashPubKey, &myself));
- GE_LOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER, _("I am peer `%s'.\n"), &myself);
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER, _("I am peer
`%s'.\n"), &myself);
forEachTransport (&initHelper, NULL);
ret.start = &startTransports;
Modified: GNUnet/src/applications/vpn/gnunet-vpn.c
===================================================================
--- GNUnet/src/applications/vpn/gnunet-vpn.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/applications/vpn/gnunet-vpn.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -54,7 +54,7 @@
{'s', "silent", NULL,
gettext_noop ("Suppress display of asynchronous log messages"),
0, &GNUNET_getopt_configure_set_one, &silent},
- GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
+ GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGNUNET_GE_VERSION), /* -v */
GNUNET_COMMAND_LINE_OPTION_END,
};
@@ -70,15 +70,15 @@
{
switch (ntohs (buf->type))
{
- case CS_PROTO_VPN_DEBUGOFF:
- case CS_PROTO_VPN_DEBUGON:
- case CS_PROTO_VPN_TUNNELS:
- case CS_PROTO_VPN_ROUTES:
- case CS_PROTO_VPN_REALISED:
- case CS_PROTO_VPN_RESET:
- case CS_PROTO_VPN_REALISE:
- case CS_PROTO_VPN_ADD:
- case CS_PROTO_VPN_TRUST:
+ case GNUNET_CS_PROTO_VPN_DEBUGOFF:
+ case GNUNET_CS_PROTO_VPN_DEBUGON:
+ case GNUNET_CS_PROTO_VPN_TUNNELS:
+ case GNUNET_CS_PROTO_VPN_ROUTES:
+ case GNUNET_CS_PROTO_VPN_REALISED:
+ case GNUNET_CS_PROTO_VPN_RESET:
+ case GNUNET_CS_PROTO_VPN_REALISE:
+ case GNUNET_CS_PROTO_VPN_ADD:
+ case GNUNET_CS_PROTO_VPN_TRUST:
if (ntohs (buf->size) > sizeof (GNUNET_MessageHeader))
{
fwrite (buffer + sizeof (GNUNET_MessageHeader),
@@ -98,10 +98,10 @@
}
GNUNET_mutex_unlock (lock);
break;;
- case CS_PROTO_VPN_MSG:
+ case GNUNET_CS_PROTO_VPN_MSG:
if (silent == GNUNET_YES)
break;;
- case CS_PROTO_VPN_REPLY:
+ case GNUNET_CS_PROTO_VPN_REPLY:
if (ntohs (buf->size) > sizeof (GNUNET_MessageHeader))
{
@@ -131,8 +131,8 @@
void *unused;
char buffer[sizeof (GNUNET_MessageHeader) + 1024];
int rancommand = 0;
- struct GC_Configuration *cfg;
- struct GE_Context *ectx;
+ struct GNUNET_GC_Configuration *cfg;
+ struct GNUNET_GE_Context *ectx;
int i;
i = GNUNET_init (argc,
@@ -160,8 +160,8 @@
messageReceiveThread =
GNUNET_thread_create (&receiveThread, sock, 128 * 1024);
if (messageReceiveThread == NULL)
- GE_DIE_STRERROR (ectx,
- GE_FATAL | GE_ADMIN | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_DIE_STRERROR (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE,
"pthread_create");
@@ -176,7 +176,7 @@
if (strncmp (buffer, "debug0", 6) == 0)
{
((GNUNET_MessageHeader *) & buffer)->type =
- htons (CS_PROTO_VPN_DEBUGOFF);
+ htons (GNUNET_CS_PROTO_VPN_DEBUGOFF);
((GNUNET_MessageHeader *) & buffer)->size =
htons (sizeof (GNUNET_MessageHeader));
if (GNUNET_SYSERR ==
@@ -190,7 +190,7 @@
else if (strncmp (buffer, "debug1", 6) == 0)
{
((GNUNET_MessageHeader *) & buffer)->type =
- htons (CS_PROTO_VPN_DEBUGON);
+ htons (GNUNET_CS_PROTO_VPN_DEBUGON);
((GNUNET_MessageHeader *) & buffer)->size =
htons (sizeof (GNUNET_MessageHeader));
if (GNUNET_SYSERR ==
@@ -204,7 +204,7 @@
else if (strncmp (buffer, "tunnels", 7) == 0)
{
((GNUNET_MessageHeader *) & buffer)->type =
- htons (CS_PROTO_VPN_TUNNELS);
+ htons (GNUNET_CS_PROTO_VPN_TUNNELS);
((GNUNET_MessageHeader *) & buffer)->size =
htons (sizeof (GNUNET_MessageHeader));
if (GNUNET_SYSERR ==
@@ -218,7 +218,7 @@
else if (strncmp (buffer, "route", 5) == 0)
{
((GNUNET_MessageHeader *) & buffer)->type =
- htons (CS_PROTO_VPN_ROUTES);
+ htons (GNUNET_CS_PROTO_VPN_ROUTES);
((GNUNET_MessageHeader *) & buffer)->size =
htons (sizeof (GNUNET_MessageHeader));
if (GNUNET_SYSERR ==
@@ -232,7 +232,7 @@
else if (strncmp (buffer, "realised", 8) == 0)
{
((GNUNET_MessageHeader *) & buffer)->type =
- htons (CS_PROTO_VPN_REALISED);
+ htons (GNUNET_CS_PROTO_VPN_REALISED);
((GNUNET_MessageHeader *) & buffer)->size =
htons (sizeof (GNUNET_MessageHeader));
if (GNUNET_SYSERR ==
@@ -246,7 +246,7 @@
else if (strncmp (buffer, "reset", 5) == 0)
{
((GNUNET_MessageHeader *) & buffer)->type =
- htons (CS_PROTO_VPN_RESET);
+ htons (GNUNET_CS_PROTO_VPN_RESET);
((GNUNET_MessageHeader *) & buffer)->size =
htons (sizeof (GNUNET_MessageHeader));
if (GNUNET_SYSERR ==
@@ -260,7 +260,7 @@
else if (strncmp (buffer, "realise", 7) == 0)
{
((GNUNET_MessageHeader *) & buffer)->type =
- htons (CS_PROTO_VPN_REALISE);
+ htons (GNUNET_CS_PROTO_VPN_REALISE);
((GNUNET_MessageHeader *) & buffer)->size =
htons (sizeof (GNUNET_MessageHeader));
if (GNUNET_SYSERR ==
@@ -274,7 +274,7 @@
else if (strncmp (buffer, "trust", 5) == 0)
{
((GNUNET_MessageHeader *) & buffer)->type =
- htons (CS_PROTO_VPN_TRUST);
+ htons (GNUNET_CS_PROTO_VPN_TRUST);
((GNUNET_MessageHeader *) & buffer)->size =
htons (sizeof (GNUNET_MessageHeader));
if (GNUNET_SYSERR ==
@@ -293,7 +293,7 @@
if (strlen (&buffer[4]) > 1)
{
((GNUNET_MessageHeader *) & buffer)->type =
- htons (CS_PROTO_VPN_ADD);
+ htons (GNUNET_CS_PROTO_VPN_ADD);
((GNUNET_MessageHeader *) & buffer)->size =
htons (sizeof (GNUNET_MessageHeader) + strlen (&buffer[5]));
if (GNUNET_SYSERR ==
Modified: GNUnet/src/applications/vpn/vpn.c
===================================================================
--- GNUnet/src/applications/vpn/vpn.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/applications/vpn/vpn.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -101,12 +101,12 @@
/**
* Identity service, to reset the core.
*/
-static Identity_ServiceAPI *identity;
-static Session_ServiceAPI *session;
+static GNUNET_Identity_ServiceAPI *identity;
+static GNUNET_Session_ServiceAPI *session;
-static CoreAPIForApplication *coreAPI;
+static GNUNET_CoreAPIForPlugins *coreAPI;
-static struct ClientHandle **clients_store;
+static struct GNUNET_ClientHandle **clients_store;
static int clients_entries;
static int clients_capacity;
@@ -116,7 +116,7 @@
static struct GNUNET_ThreadHandle *tunThreadInfo;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
/* id = number portion of interface name. I.e. 0 = gnu0, 1= gnu1 ...
* hd = filedescriptor of this tunnel
@@ -201,7 +201,7 @@
/** send given string to client */
static void
-cprintf (struct ClientHandle *c, int t, const char *format, ...)
+cprintf (struct GNUNET_ClientHandle *c, int t, const char *format, ...)
{
va_list args;
int r = -1;
@@ -254,7 +254,7 @@
GNUNET_free (b);
}
-#define VLOG if ((cdebug & (GE_DEBUG | GE_DEVELOPER | GE_REQUEST)) > 0)
cprintf(NULL,CS_PROTO_VPN_MSG,
+#define VLOG if ((cdebug & (GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_REQUEST)) > 0) cprintf(NULL,GNUNET_CS_PROTO_VPN_MSG,
/** Test if two GNUNET_RSA_PublicKey are equal or not */
static int
@@ -465,13 +465,13 @@
char info[100];
if (len > (65535 - sizeof (struct tun_pi)))
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("RFC4193 Frame length %d is too big for GNUnet!\n"), len);
return GNUNET_NO;
}
if (len < sizeof (struct tun_pi))
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("RFC4193 Frame length %d too small\n"), len);
return GNUNET_NO;
}
@@ -487,7 +487,7 @@
VLOG "-> GNUnet(%d) : %s\n", len - sizeof (struct tun_pi), info);
return GNUNET_YES;
}
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("RFC4193 Ethertype %x and IP version %x do not match!\n"),
ntohs (tp->proto), ((struct iphdr *) fp)->version);
return GNUNET_NO;
@@ -512,7 +512,7 @@
* Convert a PeerIdentify into a "random" RFC4193 prefix
* actually we make the first 40 bits of the GNUNET_hash into the prefix!
*/
-static void id2ip (struct ClientHandle *cx, const GNUNET_PeerIdentity * them)
+static void id2ip (struct GNUNET_ClientHandle *cx, const GNUNET_PeerIdentity *
them)
{
unsigned char a, b, c, d, e;
a = (them->hashPubKey.bits[0] >> 8) & 0xff;
@@ -520,7 +520,7 @@
c = (them->hashPubKey.bits[1] >> 8) & 0xff;
d = (them->hashPubKey.bits[1] >> 0) & 0xff;
e = (them->hashPubKey.bits[2] >> 8) & 0xff;
- cprintf (cx, CS_PROTO_VPN_REPLY, "fd%02x:%02x%02x:%02x%02x", a, b, c, d, e);
+ cprintf (cx, GNUNET_CS_PROTO_VPN_REPLY, "fd%02x:%02x%02x:%02x%02x", a, b, c,
d, e);
}
/* convert GNUNET_PeerIdentity into network octet order IPv6 address */
@@ -556,15 +556,15 @@
int i, used, fd, id = 0;
- GE_LOG (ectx, GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_REQUEST,
_("RFC4193 Going to try and make a tunnel in slot %d\n"), n);
fd = open ("/dev/net/tun", O_RDWR);
if (fd < 0)
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Cannot open tunnel device because of %s"), strerror (fd));
- GE_DIE_STRERROR (ectx, GE_FATAL | GE_ADMIN | GE_BULK, "open");
+ GNUNET_GE_DIE_STRERROR (ectx, GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "open");
}
memset (&ifr, 0, sizeof (ifr));
@@ -593,7 +593,7 @@
{
if ((store1 + i)->id == id)
{
- GE_LOG (ectx, GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_REQUEST,
_
("RFC4193 Create skips gnu%d as we are already using
it\n"),
id);
@@ -606,7 +606,7 @@
sprintf (ifr.ifr_name, "gnu%d", id);
if (ioctl (fd, TUNSETIFF, (void *) &ifr) < 0)
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("Cannot set tunnel name to %s because of %s\n"),
ifr.ifr_name, strerror (errno));
id++;
@@ -614,7 +614,7 @@
}
else
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("Configured tunnel name to %s\n"), ifr.ifr_name);
}
}
@@ -646,7 +646,7 @@
/* Run some system commands to set it up... */
/* sprintf(cmd, "sudo ifconfig %s up", name);
- * GE_LOG(ectx, GE_DEBUG | GE_DEVELOPER | GE_REQUEST, _("RFC4193 Calling
%s\n"), cmd);
+ * GNUNET_GE_LOG(ectx, GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_REQUEST, _("RFC4193 Calling %s\n"), cmd);
* system(cmd);
*/
@@ -655,7 +655,7 @@
/* not needed, we already have the iface name ... strncpy(ifr.ifr_name,
name, IFNAMSIZ); */
if (ioctl (admin_fd, SIOCGIFFLAGS, &ifr) < 0)
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Cannot get socket flags for gnu%d because %s\n"), id,
strerror (errno));
}
@@ -664,7 +664,7 @@
ifr.ifr_flags |= IFF_UP | IFF_RUNNING;
if (ioctl (admin_fd, SIOCSIFFLAGS, &ifr) < 0)
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("Cannot set socket flags for gnu%d because %s\n"), id,
strerror (errno));
}
@@ -674,7 +674,7 @@
ifr.ifr_mtu = 1280;
if (ioctl (admin_fd, SIOCSIFMTU, &ifr) < 0)
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Cannot set MTU for gnu%d because %s\n"), id,
strerror (errno));
}
@@ -682,7 +682,7 @@
/* lets add an IP address... aka "sudo ifconfig %s add %s:%04x::1/64" */
if (ioctl (admin_fd, SIOCGIFINDEX, &ifr) < 0)
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Cannot get interface index for gnu%d because %s\n"), id,
strerror (errno));
}
@@ -694,7 +694,7 @@
ifr6.ifr6_ifindex = ifr.ifr_ifindex;
id2net (&ifr6.ifr6_addr, coreAPI->myIdentity);
ifr6.ifr6_addr.s6_addr16[3] = htons (n + VC_START);
- GE_LOG (ectx, GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_REQUEST,
_("IPv6 ifaddr gnu%d - %x:%x:%x:%x:%x:%x:%x:%x/%d\n"), id,
ntohs (ifr6.ifr6_addr.s6_addr16[0]),
ntohs (ifr6.ifr6_addr.s6_addr16[1]),
@@ -706,7 +706,7 @@
ntohs (ifr6.ifr6_addr.s6_addr16[7]), ifr6.ifr6_prefixlen);
if (ioctl (admin_fd, SIOCSIFADDR, &ifr6) < 0)
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_USER,
_
("Cannot set interface IPv6 address for gnu%d because %s\n"),
id, strerror (errno));
@@ -720,7 +720,7 @@
rt.rtmsg_flags = RTF_UP;
rt.rtmsg_metric = 1; /* how many hops to owner of public key */
rt.rtmsg_dst_len = 48; /* network prefix len is 48 by standard */
- GE_LOG (ectx, GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_REQUEST,
_
("IPv6 route gnu%d - destination %x:%x:%x:%x:%x:%x:%x:%x/%d\n"),
id, ntohs (rt.rtmsg_dst.s6_addr16[0]),
@@ -733,7 +733,7 @@
ntohs (rt.rtmsg_dst.s6_addr16[7]), rt.rtmsg_dst_len);
if (ioctl (admin_fd, SIOCADDRT, &rt) < 0)
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("Cannot add route IPv6 address for gnu%s because %s\n"),
id, strerror (errno));
}
@@ -751,7 +751,7 @@
tunnel_info *rstore1;
int rcapacity1;
- /* GE_LOG(ectx, GE_DEBUG | GE_DEVELOPER | GE_REQUEST, _("RFC4193 Going to
checkensure peer %x then\n"), them->hashPubKey.bits[0]); */
+ /* GNUNET_GE_LOG(ectx, GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_REQUEST, _("RFC4193 Going to checkensure peer %x then\n"),
them->hashPubKey.bits[0]); */
/* first entry in array will be known as gnu0 */
/* if a tunnel is already setup, we don't setup another */
@@ -774,7 +774,7 @@
rstore1 = GNUNET_realloc (store1, rcapacity1);
if (rstore1 == NULL)
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_USER,
_
("RFC4193 We have run out of memory and so I can't store a
tunnel for this peer.\n"));
entries1--;
@@ -784,7 +784,7 @@
capacity1 = rcapacity1;
}
- /* GE_LOG(ectx, GE_DEBUG | GE_DEVELOPER | GE_REQUEST, _("RFC4193 Extending
array for new tunnel\n")); */
+ /* GNUNET_GE_LOG(ectx, GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_REQUEST, _("RFC4193 Extending array for new tunnel\n")); */
setup_tunnel ((entries1 - 1), them);
}
@@ -823,7 +823,7 @@
tp = ((struct tun_pi *) fp) - 1;
gp = ((GNUNET_MessageHeader *) fp) - 1;
running = 1;
- GE_LOG (ectx, GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_REQUEST,
_("RFC4193 Thread running (frame %d tunnel %d f2f %d) ...\n"), fp,
tp, gp);
@@ -843,7 +843,7 @@
}
else
{
- GE_DIE_STRERROR (ectx, GE_FATAL | GE_ADMIN | GE_BULK, "fstat");
+ GNUNET_GE_DIE_STRERROR (ectx, GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "fstat");
}
for (i = 0; i < entries1; i++)
{
@@ -857,7 +857,7 @@
ret = SELECT (max + 1, &readSet, &writeSet, &errorSet, &timeout);
if (ret < 0)
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_USER,
"From the vpn select: %s\n", strerror (errno));
running = 0;
break;
@@ -865,8 +865,8 @@
if (FD_ISSET (signalingPipe[0], &readSet))
{
if (0 >= READ (signalingPipe[0], &tmp[0], MAXSIG_BUF))
- GE_LOG_STRERROR (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK |
GNUNET_GE_USER,
"vpn could not read from exit control pipe\n");
}
GNUNET_mutex_lock (lock);
@@ -882,12 +882,12 @@
*/
if (valid_incoming (ret, tp, fp))
{
- gp->type = htons (P2P_PROTO_aip_IP);
+ gp->type = htons (GNUNET_P2P_PROTO_AIP_IP);
gp->size =
htons (sizeof (GNUNET_MessageHeader) + ret -
sizeof (struct tun_pi));
coreAPI->unicast (&((store1 + i)->peer), gp,
- EXTREME_PRIORITY, 1);
+ GNUNET_EXTREME_PRIORITY, 1);
coreAPI->preferTrafficFrom (&((store1 + i)->peer), 1000);
}
}
@@ -896,14 +896,14 @@
{
if (close ((store1 + i)->fd) == 0)
{
- GE_LOG (ectx, GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_INFO | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
_("VPN dropping connection %x\n"), i);
*(store1 + i) = *(store1 + (entries1 - 1));
entries1--;
}
else
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("VPN cannot drop connection %x\n"), i);
}
}
@@ -913,7 +913,7 @@
for (i = 0; i < entries1; i++) {
if (((store1+i)->active) > 0) {
if
(identity->isBlacklisted(&((store1+i)->peer)), GNUNET_YES) {
- GE_LOG(ectx, GE_INFO | GE_REQUEST |
GE_USER, _("RFC4193 --- whitelist of peer %x\n"),
+ GNUNET_GE_LOG(ectx, GNUNET_GE_INFO |
GNUNET_GE_REQUEST | GNUNET_GE_USER, _("RFC4193 --- whitelist of peer %x\n"),
(store1+i)->peer.hashPubKey.bits[0]);
identity->whitelistHost(&((store1+i)->peer));
}
@@ -922,7 +922,7 @@
}
*/
}
- GE_LOG (ectx, GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_REQUEST,
_("RFC4193 Thread exiting\n"));
GNUNET_mutex_unlock (lock);
return NULL;
@@ -951,7 +951,7 @@
switch (ntohs (gp->type))
{
- case P2P_PROTO_aip_IP:
+ case GNUNET_P2P_PROTO_AIP_IP:
tp->flags = 0;
/* better check src/dst IP for anonymity preservation requirements
here...
@@ -969,24 +969,24 @@
tp->proto = htons (ETH_P_IPV6);
if (ntohs (fp->ip6_src.s6_addr16[0]) < 0xFD00)
{
- GE_LOG (ectx, GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_REQUEST,
_("VPN IP src not anonymous. drop..\n"));
return GNUNET_OK;
}
if (ntohs (fp->ip6_dst.s6_addr16[0]) < 0xFD00)
{
- GE_LOG (ectx, GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_REQUEST,
_("VPN IP not anonymous, drop.\n"));
return GNUNET_OK;
}
break;
case 4:
tp->proto = htons (ETH_P_IP);
- GE_LOG (ectx, GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_REQUEST,
_("VPN Received, not anonymous, drop.\n"));
return GNUNET_OK;
default:
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("VPN Received unknown IP version %d...\n"),
((struct iphdr *) fp)->version);
return GNUNET_OK;
@@ -1022,16 +1022,16 @@
/* do not normally get here... but checkensure so any future packets
could be routed... */
checkensure_peer (sender, NULL);
GNUNET_mutex_unlock (lock);
- GE_LOG (ectx, GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_REQUEST,
_
("Could not write the tunnelled IP to the OS... Did to setup a
tunnel?\n"));
return GNUNET_OK;
- case p2p_PROTO_PONG:
+ case GNUNET_P2P_PROTO_PONG:
GNUNET_mutex_lock (lock);
checkensure_peer (sender, NULL);
GNUNET_mutex_unlock (lock);
return GNUNET_OK;
- case P2P_PROTO_hangup:
+ case GNUNET_P2P_PROTO_HANG_UP:
GNUNET_mutex_lock (lock);
for (i = 0; i < entries1; i++)
{
@@ -1043,7 +1043,7 @@
}
GNUNET_mutex_unlock (lock);
return GNUNET_OK;
- case P2P_PROTO_aip_GETROUTE:
+ case GNUNET_P2P_PROTO_AIP_GETROUTE:
/** peer wants an entry from our routing table */
VLOG _("Receive route request\n"));
if (ntohs (gp->size) == (sizeof (GNUNET_MessageHeader) + sizeof (int)))
@@ -1064,7 +1064,7 @@
rgp->size =
htons (sizeof (GNUNET_MessageHeader) +
sizeof (transit_route));
- rgp->type = htons (P2P_PROTO_aip_ROUTE);
+ rgp->type = htons (GNUNET_P2P_PROTO_AIP_ROUTE);
((transit_route *) (rgp + 1))->owner =
(realised_store + i)->owner;
((transit_route *) (rgp + 1))->hops =
@@ -1072,7 +1072,7 @@
GNUNET_mutex_unlock (lock);
VLOG _("Send route announcement %d with route announce\n"), i);
/* it must be delivered if possible, but it can wait longer than
IP */
- coreAPI->unicast (sender, rgp, EXTREME_PRIORITY, 15);
+ coreAPI->unicast (sender, rgp, GNUNET_EXTREME_PRIORITY, 15);
GNUNET_free (rgp);
return GNUNET_OK;
}
@@ -1084,15 +1084,15 @@
return GNUNET_OK;
}
rgp->size = htons (sizeof (GNUNET_MessageHeader) + sizeof (int));
- rgp->type = htons (P2P_PROTO_aip_ROUTES);
+ rgp->type = htons (GNUNET_P2P_PROTO_AIP_ROUTES);
*((int *) (rgp + 1)) = htonl (realised_entries);
GNUNET_mutex_unlock (lock);
- coreAPI->unicast (sender, rgp, EXTREME_PRIORITY, 15);
+ coreAPI->unicast (sender, rgp, GNUNET_EXTREME_PRIORITY, 15);
GNUNET_free (rgp);
return GNUNET_OK;
}
return GNUNET_OK;
- case P2P_PROTO_aip_ROUTE:
+ case GNUNET_P2P_PROTO_AIP_ROUTE:
VLOG _("Receive route announce.\n"));
/** peer sent us a route, insert it into routing table, then req next
entry */
if (ntohs (gp->size) ==
@@ -1121,7 +1121,7 @@
GNUNET_mutex_unlock (lock);
return GNUNET_OK;
}
- rgp->type = htons (P2P_PROTO_aip_GETROUTE);
+ rgp->type = htons (GNUNET_P2P_PROTO_AIP_GETROUTE);
rgp->size =
htons (sizeof (GNUNET_MessageHeader) + sizeof (int));
*((int *) (rgp + 1)) =
@@ -1129,7 +1129,7 @@
VLOG _("Request level %d from peer %d\n"),
(store1 + i)->route_entry, i);
coreAPI->unicast (&((store1 + i)->peer), rgp,
- EXTREME_PRIORITY, 60);
+ GNUNET_EXTREME_PRIORITY, 60);
GNUNET_free (rgp);
}
break;
@@ -1138,7 +1138,7 @@
GNUNET_mutex_unlock (lock);
}
return GNUNET_OK;
- case P2P_PROTO_aip_ROUTES:
+ case GNUNET_P2P_PROTO_AIP_ROUTES:
if (ntohs (gp->size) == (sizeof (GNUNET_MessageHeader) + sizeof (int)))
{
/* if this is the last route message, we do route realisation
@@ -1164,7 +1164,7 @@
/* here we copy the prototype route table we are collecting from peers to the
actual
* "realised" route table we distribute to peers, and to the kernel's table.
*/
-static void realise (struct ClientHandle *c)
+static void realise (struct GNUNET_ClientHandle *c)
{
int i, j, found;
GNUNET_PeerIdentity id;
@@ -1174,7 +1174,7 @@
GNUNET_mutex_lock (lock);
/* make sure realised table can take the new routes - if it wont, abort now!
*/
- GE_LOG (ectx, GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_REQUEST,
_("realise alloc ram\n"));
if (route_entries > realised_entries)
{
@@ -1184,7 +1184,7 @@
reqstore = GNUNET_realloc (realised_store, reqcapacity);
if (reqstore == NULL)
{
- cprintf (c, CS_PROTO_VPN_REPLY,
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY,
"I cannot up the ram for realised routes.\n");
GNUNET_mutex_unlock (lock);
return;
@@ -1194,7 +1194,7 @@
}
}
/* add routes that are in the new table but not the old */
- GE_LOG (ectx, GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_REQUEST,
_("realise add routes\n"));
for (i = 0; i < route_entries; i++)
{
@@ -1226,7 +1226,7 @@
rt.rtmsg_metric = (route_store + i)->hops;
/* how many hops to owner of public key */
rt.rtmsg_dst_len = 48; /* always 48 as per RFC4193 */
- cprintf (c, CS_PROTO_VPN_REPLY,
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY,
"Add route gnu%d hops %d dst %x:%x:%x:%x:%x:%x:%x:%x/%d\n",
id, rt.rtmsg_metric, ntohs (rt.rtmsg_dst.s6_addr16[0]),
ntohs (rt.rtmsg_dst.s6_addr16[1]),
@@ -1238,14 +1238,14 @@
ntohs (rt.rtmsg_dst.s6_addr16[7]), rt.rtmsg_dst_len);
if (ioctl (admin_fd, SIOCADDRT, &rt) < 0)
{
- cprintf (c, CS_PROTO_VPN_REPLY,
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY,
"Cannot add route IPv6 address for gnu%s because %s\n",
id, strerror (errno));
}
}
}
- cprintf (c, CS_PROTO_VPN_REPLY, "Removing routes\n");
- GE_LOG (ectx, GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY, "Removing routes\n");
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_REQUEST,
_("realise pull routes\n"));
/* pull routes that are in the old table but not the new */
for (i = 0; i < realised_entries; i++)
@@ -1279,7 +1279,7 @@
rt.rtmsg_metric = (realised_store + i)->hops;
/* how many hops to owner of public key */
rt.rtmsg_dst_len = 48; /* always 48 as per RFC4193 */
- cprintf (c, CS_PROTO_VPN_REPLY,
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY,
"Delete route gnu%d hops %d dst
%x:%x:%x:%x:%x:%x:%x:%x/%d\n",
id, rt.rtmsg_metric, ntohs (rt.rtmsg_dst.s6_addr16[0]),
ntohs (rt.rtmsg_dst.s6_addr16[1]),
@@ -1291,14 +1291,14 @@
ntohs (rt.rtmsg_dst.s6_addr16[7]), rt.rtmsg_dst_len);
if (ioctl (admin_fd, SIOCDELRT, &rt) < 0)
{
- cprintf (c, CS_PROTO_VPN_REPLY,
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY,
"Cannot del route IPv6 address for gnu%s because %s\n",
id, strerror (errno));
}
}
}
- cprintf (c, CS_PROTO_VPN_REPLY, "Copying table\n");
- GE_LOG (ectx, GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY, "Copying table\n");
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_REQUEST,
_("realise copy table\n"));
realised_entries = route_entries;
memcpy (realised_store, route_store, sizeof (route_info) * route_entries);
@@ -1306,9 +1306,9 @@
GNUNET_mutex_unlock (lock);
}
-static void add_client (struct ClientHandle *c)
+static void add_client (struct GNUNET_ClientHandle *c)
{
- struct ClientHandle **rstore;
+ struct GNUNET_ClientHandle **rstore;
int i, rcapacity;
/* we already have them, equality is assumed if the filehandles match */
@@ -1320,7 +1320,7 @@
clients_entries++;
/* do we need more ram to hold the client handle? */
- rcapacity = clients_entries * sizeof (struct ClientHandle *);
+ rcapacity = clients_entries * sizeof (struct GNUNET_ClientHandle *);
if (rcapacity > clients_capacity)
{
rstore = GNUNET_realloc (clients_store, rcapacity);
@@ -1330,7 +1330,7 @@
/* not enough ram, warn in the logs that they
* will forego receiving logging
*/
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("Cannot store client info\n"));
return;
}
@@ -1340,7 +1340,7 @@
*(clients_store + (clients_entries - 1)) = c;
}
-static void remove_client (struct ClientHandle *c)
+static void remove_client (struct GNUNET_ClientHandle *c)
{
int i;
for (i = 0; i < clients_entries; i++)
@@ -1355,7 +1355,7 @@
}
/** The console client is used to admin/debug vpn */
-static int csHandle (struct ClientHandle *c,
+static int csHandle (struct GNUNET_ClientHandle *c,
const GNUNET_MessageHeader * message)
{
GNUNET_MessageHeader *rgp = NULL;
@@ -1369,46 +1369,46 @@
add_client (c);
GNUNET_mutex_unlock (lock);
/* issued command from client */
- if (ntohs (message->type) == CS_PROTO_VPN_MSG)
+ if (ntohs (message->type) == GNUNET_CS_PROTO_VPN_MSG)
{
if (ntohs (message->size) == 0)
return GNUNET_OK;
}
/* while ((l < ll) && (*(ccmd+cl) > 32)) cl++; */
- if (ntohs (message->type) == CS_PROTO_VPN_DEBUGOFF)
+ if (ntohs (message->type) == GNUNET_CS_PROTO_VPN_DEBUGOFF)
{
GNUNET_mutex_lock (lock);
cdebug = 0;
GNUNET_mutex_unlock (lock);
- cprintf (c, CS_PROTO_VPN_DEBUGOFF, "LOG NOTHING\n");
+ cprintf (c, GNUNET_CS_PROTO_VPN_DEBUGOFF, "LOG NOTHING\n");
return GNUNET_OK;
}
- if (ntohs (message->type) == CS_PROTO_VPN_DEBUGON)
+ if (ntohs (message->type) == GNUNET_CS_PROTO_VPN_DEBUGON)
{
GNUNET_mutex_lock (lock);
- cdebug = GE_DEBUG | GE_DEVELOPER | GE_REQUEST;
+ cdebug = GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_REQUEST;
GNUNET_mutex_unlock (lock);
- cprintf (c, CS_PROTO_VPN_DEBUGON, "LOG DEBUG\n");
+ cprintf (c, GNUNET_CS_PROTO_VPN_DEBUGON, "LOG DEBUG\n");
return GNUNET_OK;
}
- if (ntohs (message->type) == CS_PROTO_VPN_TUNNELS)
+ if (ntohs (message->type) == GNUNET_CS_PROTO_VPN_TUNNELS)
{
GNUNET_mutex_lock (lock);
id2ip (c, coreAPI->myIdentity);
- cprintf (c, CS_PROTO_VPN_REPLY, "::/48 This Node\n");
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY, "::/48 This Node\n");
for (i = 0; i < entries1; i++)
{
id2ip (c, &(store1 + i)->peer);
- cprintf (c, CS_PROTO_VPN_REPLY,
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY,
"::/48 gnu%d active=%s routeentry=%d\n", (store1 + i)->id,
(store1 + i)->active ? _("Yes") : _("No"),
(store1 + i)->route_entry);
}
- cprintf (c, CS_PROTO_VPN_TUNNELS, "%d Tunnels\n", entries1);
+ cprintf (c, GNUNET_CS_PROTO_VPN_TUNNELS, "%d Tunnels\n", entries1);
GNUNET_mutex_unlock (lock);
}
- if (ntohs (message->type) == CS_PROTO_VPN_ROUTES)
+ if (ntohs (message->type) == GNUNET_CS_PROTO_VPN_ROUTES)
{
GNUNET_mutex_lock (lock);
for (i = 0; i < route_entries; i++)
@@ -1417,19 +1417,19 @@
id2ip (c, &id);
if ((route_store + i)->hops == 0)
{
- cprintf (c, CS_PROTO_VPN_REPLY, "::/48 hops 0 (This Node)\n");
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY, "::/48 hops 0 (This
Node)\n");
}
else
{
- cprintf (c, CS_PROTO_VPN_REPLY, "::/48 hops %d tunnel gnu%d\n",
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY, "::/48 hops %d tunnel
gnu%d\n",
(route_store + i)->hops,
(store1 + ((route_store + i)->tunnel))->id);
}
}
- cprintf (c, CS_PROTO_VPN_ROUTES, "%d Routes\n", route_entries);
+ cprintf (c, GNUNET_CS_PROTO_VPN_ROUTES, "%d Routes\n", route_entries);
GNUNET_mutex_unlock (lock);
}
- if (ntohs (message->type) == CS_PROTO_VPN_REALISED)
+ if (ntohs (message->type) == GNUNET_CS_PROTO_VPN_REALISED)
{
GNUNET_mutex_lock (lock);
for (i = 0; i < realised_entries; i++)
@@ -1438,28 +1438,28 @@
id2ip (c, &id);
if ((realised_store + i)->hops == 0)
{
- cprintf (c, CS_PROTO_VPN_REPLY, "::/48 hops 0 (This Node)\n");
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY, "::/48 hops 0 (This
Node)\n");
}
else
{
- cprintf (c, CS_PROTO_VPN_REPLY, "::/48 hops %d tunnel gnu%d\n",
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY, "::/48 hops %d tunnel
gnu%d\n",
(realised_store + i)->hops,
(store1 + ((realised_store + i)->tunnel))->id);
}
}
- cprintf (c, CS_PROTO_VPN_REALISED, "%d Realised\n", realised_entries);
+ cprintf (c, GNUNET_CS_PROTO_VPN_REALISED, "%d Realised\n",
realised_entries);
GNUNET_mutex_unlock (lock);
}
/* add routes in route but not realised to OS
* delete routes in realised but not route from OS
* memcpy routes to realised metric
*/
- if (ntohs (message->type) == CS_PROTO_VPN_REALISE)
+ if (ntohs (message->type) == GNUNET_CS_PROTO_VPN_REALISE)
{
realise (c);
- cprintf (c, CS_PROTO_VPN_REALISE, "Realise done\n");
+ cprintf (c, GNUNET_CS_PROTO_VPN_REALISE, "Realise done\n");
}
- if (ntohs (message->type) == CS_PROTO_VPN_RESET)
+ if (ntohs (message->type) == GNUNET_CS_PROTO_VPN_RESET)
{
GNUNET_mutex_lock (lock);
init_router ();
@@ -1473,38 +1473,38 @@
{
break;
}
- rgp->type = htons (P2P_PROTO_aip_GETROUTE);
+ rgp->type = htons (GNUNET_P2P_PROTO_AIP_GETROUTE);
rgp->size = htons (sizeof (GNUNET_MessageHeader) + sizeof (int));
*((int *) (rgp + 1)) = htonl ((store1 + i)->route_entry);
- cprintf (c, CS_PROTO_VPN_REPLY, "Request level %d from peer %d ",
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY, "Request level %d from peer
%d ",
(store1 + i)->route_entry, i);
id2ip (c, &((store1 + i)->peer));
- cprintf (c, CS_PROTO_VPN_REPLY, "\n");
- coreAPI->unicast (&((store1 + i)->peer), rgp, EXTREME_PRIORITY, 60);
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY, "\n");
+ coreAPI->unicast (&((store1 + i)->peer), rgp,
GNUNET_EXTREME_PRIORITY, 60);
GNUNET_free (rgp);
/* } */
}
GNUNET_mutex_unlock (lock);
- cprintf (c, CS_PROTO_VPN_RESET, "Rebuilding routing tables done\n");
+ cprintf (c, GNUNET_CS_PROTO_VPN_RESET, "Rebuilding routing tables
done\n");
}
- if (ntohs (message->type) == CS_PROTO_VPN_TRUST)
+ if (ntohs (message->type) == GNUNET_CS_PROTO_VPN_TRUST)
{
GNUNET_mutex_lock (lock);
for (i = 0; i < entries1; i++)
{
if ((store1 + i)->active == GNUNET_YES)
{
- cprintf (c, CS_PROTO_VPN_REPLY, "Uprating peer ");
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY, "Uprating peer ");
id2ip (c, &(store1 + i)->peer);
- cprintf (c, CS_PROTO_VPN_REPLY, " with credit %d\n",
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY, " with credit %d\n",
identity->changeHostTrust (&(store1 + i)->peer, 1000));
}
}
- cprintf (c, CS_PROTO_VPN_TRUST,
+ cprintf (c, GNUNET_CS_PROTO_VPN_TRUST,
"Gave credit to active nodes of %d nodes...\n", entries1);
GNUNET_mutex_unlock (lock);
}
- if (ntohs (message->type) == CS_PROTO_VPN_ADD)
+ if (ntohs (message->type) == GNUNET_CS_PROTO_VPN_ADD)
{
if (parameter > 0)
{
@@ -1512,7 +1512,7 @@
{
strncpy (parm, ccmd, parameter);
*(parm + parameter) = 0;
- cprintf (c, CS_PROTO_VPN_REPLY, "Connect ");
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY, "Connect ");
if (GNUNET_OK == GNUNET_enc_to_hash (parm, &(id.hashPubKey)))
{
id2ip (c, &id);
@@ -1529,37 +1529,37 @@
switch (session->tryConnect (&id))
{
case GNUNET_YES:
- cprintf (c, CS_PROTO_VPN_REPLY,
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY,
" already connected.\n");
break;
case GNUNET_NO:
- cprintf (c, CS_PROTO_VPN_REPLY,
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY,
" schedule connection.\n");
break;
case GNUNET_SYSERR:
- cprintf (c, CS_PROTO_VPN_REPLY, " core refused.\n");
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY, " core
refused.\n");
break;
default:
- cprintf (c, CS_PROTO_VPN_REPLY, " misc error.\n");
+ cprintf (c, GNUNET_CS_PROTO_VPN_REPLY, " misc error.\n");
break;
}
/* req route level 0
rgp = GNUNET_malloc(sizeof(GNUNET_MessageHeader) +
sizeof(int));
if (rgp != NULL) {
- rgp->type = htons(P2P_PROTO_aip_GETROUTE);
+ rgp->type = htons(GNUNET_P2P_PROTO_AIP_GETROUTE);
rgp->size = htons(sizeof(GNUNET_MessageHeader) +
sizeof(int));
*((int*)(rgp+1)) = 0;
- coreAPI->unicast(&id,rgp,EXTREME_PRIORITY,4);
+ coreAPI->unicast(&id,rgp,GNUNET_EXTREME_PRIORITY,4);
cprintf(c, " Sent");
GNUNET_free(rgp);
} */
- cprintf (c, CS_PROTO_VPN_ADD, "\n");
+ cprintf (c, GNUNET_CS_PROTO_VPN_ADD, "\n");
}
else
{
- cprintf (c, CS_PROTO_VPN_ADD,
+ cprintf (c, GNUNET_CS_PROTO_VPN_ADD,
"Could not decode PeerId %s from parameter.\n",
parm);
@@ -1568,18 +1568,18 @@
}
else
{
- cprintf (c, CS_PROTO_VPN_ADD, "Could not allocate for key.\n");
+ cprintf (c, GNUNET_CS_PROTO_VPN_ADD, "Could not allocate for
key.\n");
}
}
else
{
- cprintf (c, CS_PROTO_VPN_ADD, "Require key for parameter\n");
+ cprintf (c, GNUNET_CS_PROTO_VPN_ADD, "Require key for parameter\n");
}
}
return GNUNET_OK;
}
-static void clientExitHandler (struct ClientHandle *c)
+static void clientExitHandler (struct GNUNET_ClientHandle *c)
{
GNUNET_mutex_lock (lock);
remove_client (c);
@@ -1612,8 +1612,8 @@
flags |= O_NONBLOCK;
if (-1 == fcntl (handle, F_SETFL, flags))
{
- GE_LOG_STRERROR (ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE,
"fcntl");
return GNUNET_SYSERR;
}
@@ -1628,7 +1628,7 @@
* Also enumerate all current peers and create taps for them.
*
*/
-int initialize_module_vpn (CoreAPIForApplication * capi)
+int initialize_module_vpn (GNUNET_CoreAPIForPlugins * capi)
{
int pfd;
char *str = "OK\r\n";
@@ -1658,10 +1658,10 @@
admin_fd = socket (AF_INET6, SOCK_DGRAM, 0);
- GE_LOG (ectx, GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_REQUEST,
_("`%s' initialising RFC4913 module %d and %d\n"), "template",
- CS_PROTO_MAX_USED, P2P_PROTO_MAX_USED);
- GE_LOG (ectx, GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_CS_PROTO_MAX_USED, GNUNET_P2P_PROTO_MAX_USED);
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_REQUEST,
_("RFC4193 my First 4 hex digits of host id are %x\n"),
capi->myIdentity->hashPubKey.bits[0]);
@@ -1669,63 +1669,63 @@
/* get a PONG = peer is online */
/* get a HANGUP = peer is offline */
if (GNUNET_SYSERR ==
- capi->registerHandler (P2P_PROTO_aip_IP, &handlep2pMSG))
+ capi->registerHandler (GNUNET_P2P_PROTO_AIP_IP, &handlep2pMSG))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerHandler (P2P_PROTO_aip_GETROUTE, &handlep2pMSG))
+ capi->registerHandler (GNUNET_P2P_PROTO_AIP_GETROUTE, &handlep2pMSG))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerHandler (P2P_PROTO_aip_ROUTE, &handlep2pMSG))
+ capi->registerHandler (GNUNET_P2P_PROTO_AIP_ROUTE, &handlep2pMSG))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerHandler (P2P_PROTO_aip_ROUTES, &handlep2pMSG))
+ capi->registerHandler (GNUNET_P2P_PROTO_AIP_ROUTES, &handlep2pMSG))
return GNUNET_SYSERR;
- if (GNUNET_SYSERR == capi->registerHandler (p2p_PROTO_PONG, &handlep2pMSG))
+ if (GNUNET_SYSERR == capi->registerHandler (GNUNET_P2P_PROTO_PONG,
&handlep2pMSG))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerHandler (P2P_PROTO_hangup, &handlep2pMSG))
+ capi->registerHandler (GNUNET_P2P_PROTO_HANG_UP, &handlep2pMSG))
return GNUNET_SYSERR;
if (GNUNET_SYSERR == capi->registerClientExitHandler (&clientExitHandler))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (CS_PROTO_VPN_MSG, &csHandle))
+ capi->registerClientHandler (GNUNET_CS_PROTO_VPN_MSG, &csHandle))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (CS_PROTO_VPN_DEBUGOFF, &csHandle))
+ capi->registerClientHandler (GNUNET_CS_PROTO_VPN_DEBUGOFF, &csHandle))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (CS_PROTO_VPN_DEBUGON, &csHandle))
+ capi->registerClientHandler (GNUNET_CS_PROTO_VPN_DEBUGON, &csHandle))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (CS_PROTO_VPN_TUNNELS, &csHandle))
+ capi->registerClientHandler (GNUNET_CS_PROTO_VPN_TUNNELS, &csHandle))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (CS_PROTO_VPN_ROUTES, &csHandle))
+ capi->registerClientHandler (GNUNET_CS_PROTO_VPN_ROUTES, &csHandle))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (CS_PROTO_VPN_REALISED, &csHandle))
+ capi->registerClientHandler (GNUNET_CS_PROTO_VPN_REALISED, &csHandle))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (CS_PROTO_VPN_RESET, &csHandle))
+ capi->registerClientHandler (GNUNET_CS_PROTO_VPN_RESET, &csHandle))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (CS_PROTO_VPN_REALISE, &csHandle))
+ capi->registerClientHandler (GNUNET_CS_PROTO_VPN_REALISE, &csHandle))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (CS_PROTO_VPN_ADD, &csHandle))
+ capi->registerClientHandler (GNUNET_CS_PROTO_VPN_ADD, &csHandle))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (CS_PROTO_VPN_TRUST, &csHandle))
+ capi->registerClientHandler (GNUNET_CS_PROTO_VPN_TRUST, &csHandle))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (CS_PROTO_VPN_REPLY, &csHandle))
+ capi->registerClientHandler (GNUNET_CS_PROTO_VPN_REPLY, &csHandle))
return GNUNET_SYSERR;
identity = coreAPI->requestService ("identity");
session = coreAPI->requestService ("session");
- GE_ASSERT (ectx, identity != NULL);
- GE_ASSERT (ectx, session != NULL);
+ GNUNET_GE_ASSERT (ectx, identity != NULL);
+ GNUNET_GE_ASSERT (ectx, session != NULL);
init_router (); /* reqire identity */
init_realised (); /* reqire identity */
@@ -1744,8 +1744,8 @@
128 * 1024);
/* use capi->unicast to send messages to connected peers */
- GE_ASSERT (capi->ectx,
- 0 == GC_set_configuration_value_string (capi->cfg,
+ GNUNET_GE_ASSERT (capi->ectx,
+ 0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
capi->ectx,
"ABOUT",
"vpn",
@@ -1764,26 +1764,26 @@
int ret;
void *returnval;
- coreAPI->unregisterHandler (P2P_PROTO_aip_IP, &handlep2pMSG);
- coreAPI->unregisterHandler (P2P_PROTO_aip_GETROUTE, &handlep2pMSG);
- coreAPI->unregisterHandler (P2P_PROTO_aip_ROUTE, &handlep2pMSG);
- coreAPI->unregisterHandler (P2P_PROTO_aip_ROUTES, &handlep2pMSG);
- coreAPI->unregisterHandler (p2p_PROTO_PONG, &handlep2pMSG);
- coreAPI->unregisterHandler (P2P_PROTO_hangup, &handlep2pMSG);
- coreAPI->unregisterClientHandler (CS_PROTO_VPN_MSG, &csHandle);
- coreAPI->unregisterClientHandler (CS_PROTO_VPN_DEBUGOFF, &csHandle);
- coreAPI->unregisterClientHandler (CS_PROTO_VPN_DEBUGON, &csHandle);
- coreAPI->unregisterClientHandler (CS_PROTO_VPN_TUNNELS, &csHandle);
- coreAPI->unregisterClientHandler (CS_PROTO_VPN_ROUTES, &csHandle);
- coreAPI->unregisterClientHandler (CS_PROTO_VPN_REALISED, &csHandle);
- coreAPI->unregisterClientHandler (CS_PROTO_VPN_RESET, &csHandle);
- coreAPI->unregisterClientHandler (CS_PROTO_VPN_REALISE, &csHandle);
- coreAPI->unregisterClientHandler (CS_PROTO_VPN_ADD, &csHandle);
- coreAPI->unregisterClientHandler (CS_PROTO_VPN_TRUST, &csHandle);
- coreAPI->unregisterClientHandler (CS_PROTO_VPN_REPLY, &csHandle);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_AIP_IP, &handlep2pMSG);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_AIP_GETROUTE, &handlep2pMSG);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_AIP_ROUTE, &handlep2pMSG);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_AIP_ROUTES, &handlep2pMSG);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_PONG, &handlep2pMSG);
+ coreAPI->unregisterHandler (GNUNET_P2P_PROTO_HANG_UP, &handlep2pMSG);
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_VPN_MSG, &csHandle);
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_VPN_DEBUGOFF, &csHandle);
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_VPN_DEBUGON, &csHandle);
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_VPN_TUNNELS, &csHandle);
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_VPN_ROUTES, &csHandle);
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_VPN_REALISED, &csHandle);
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_VPN_RESET, &csHandle);
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_VPN_REALISE, &csHandle);
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_VPN_ADD, &csHandle);
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_VPN_TRUST, &csHandle);
+ coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_VPN_REPLY, &csHandle);
coreAPI->unregisterClientExitHandler (&clientExitHandler);
- GE_LOG (ectx, GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("RFC4193 Waiting for tun thread to end\n"));
running = 0;
@@ -1791,13 +1791,13 @@
ret = write (signalingPipe[1], &running, sizeof (char));
if (ret != sizeof (char))
if (errno != EAGAIN)
- GE_LOG_STRERROR (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
"RFC4193 can not tell thread to exit");
/* wait for it to exit */
GNUNET_thread_join (tunThreadInfo, &returnval);
- GE_LOG (ectx, GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("RFC4193 The tun thread has ended\n"));
coreAPI->releaseService (identity);
@@ -1813,8 +1813,8 @@
{
if (((store1 + i)->fd) != 0)
{
- GE_LOG (ectx,
- GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_REQUEST,
_("RFC4193 Closing tunnel %d fd %d\n"), i,
(store1 + i)->fd);
close ((store1 + i)->fd);
Modified: GNUnet/src/include/Makefile.am
===================================================================
--- GNUnet/src/include/Makefile.am 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/include/Makefile.am 2007-11-25 12:04:45 UTC (rev 5755)
@@ -34,6 +34,7 @@
gnunet_namespace_lib.h \
gnunet_pingpong_service.h \
gnunet_protocols.h \
+ gnunet_rpc_lib.h \
gnunet_rpc_service.h \
gnunet_session_service.h \
gnunet_setup_lib.h \
Modified: GNUnet/src/include/core.h
===================================================================
--- GNUnet/src/include/core.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/include/core.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -33,8 +33,8 @@
/**
* Initialize the CORE's globals.
*/
-int initCore (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+int initCore (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
struct GNUNET_CronManager *cron,
struct GNUNET_LoadMonitor *monitor);
Modified: GNUnet/src/include/ecrs_core.h
===================================================================
--- GNUnet/src/include/ecrs_core.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/include/ecrs_core.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -27,8 +27,8 @@
* @author Christian Grothoff
*/
-#ifndef ECRS_CORE_H
-#define ECRS_CORE_H
+#ifndef GNUNET_ECRS_CORE_H
+#define GNUNET_ECRS_CORE_H
#include "gnunet_util.h"
#include "gnunet_datastore_service.h"
@@ -151,8 +151,8 @@
/**
* Interval (in seconds) how often the publisher intends to produce
- * an updated SBlock; ECRS_SBLOCK_UPDATE_NONE(0) is used for
- * non-updateable SBlocks, ECRS_SBLOCK_UPDATE_SPORADIC(-1) is used
+ * an updated SBlock; GNUNET_ECRS_SBLOCK_UPDATE_NONE(0) is used for
+ * non-updateable SBlocks, GNUNET_ECRS_SBLOCK_UPDATE_SPORADIC(-1) is used
* for entries without a fixed update frequency; in network byte
* order
*/
@@ -241,7 +241,7 @@
*/
int fileBlockEncode (const DBlock * data,
unsigned int len,
- const GNUNET_HashCode * query, Datastore_Value ** value);
+ const GNUNET_HashCode * query, GNUNET_DatastoreValue **
value);
/**
* Get the query that will be used to query for
Modified: GNUnet/src/include/fs.h
===================================================================
--- GNUnet/src/include/fs.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/include/fs.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -78,7 +78,7 @@
/**
* Server to client: content (in response to a CS_fs_request_search_MESSAGE).
The
* header is followed by variable size data (the data portion
- * of the Datastore_Value).
+ * of the GNUNET_DatastoreValue).
*/
typedef struct
{
@@ -235,7 +235,7 @@
*/
typedef struct
{
- DataContainer dc;
+ GNUNET_DataContainer dc;
unsigned int reserved; /* for 64-bit alignment */
unsigned long long timeout;
} GapWrapper;
Modified: GNUnet/src/include/gnunet_blockstore.h
===================================================================
--- GNUnet/src/include/gnunet_blockstore.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_blockstore.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -48,7 +48,7 @@
* of data.
*/
unsigned int size;
-} DataContainer;
+} GNUNET_DataContainer;
/**
* Callback function type for items in the GAP datastore.
@@ -58,8 +58,8 @@
* @param cls argument passed for context (closure)
* @return GNUNET_OK to continue with iteration, GNUNET_SYSERR to abort
*/
-typedef int (*DataProcessor) (const GNUNET_HashCode * key,
- const DataContainer * value, void *cls);
+typedef int (*GNUNET_DataProcessor) (const GNUNET_HashCode * key,
+ const GNUNET_DataContainer * value, void *cls);
/**
* GAP and DHT clients must implement this interface to tell
@@ -71,7 +71,7 @@
* routing, the other parts are just passed along and untouched by the
* routing code. The type is typically used to tell what they refer
* to. The assumption is that they (including the type) can be
- * reproduced from the DataContainer and thus the Iterator
+ * reproduced from the GNUNET_DataContainer and thus the Iterator
* methods do not communicate those values.
*
* The put method is (ab)used to check an item that is merely routed
@@ -106,7 +106,7 @@
unsigned int prio,
unsigned int keyCount,
const GNUNET_HashCode * keys,
- DataProcessor resultCallback, void *resCallbackClosure);
+ GNUNET_DataProcessor resultCallback, void *resCallbackClosure);
/**
* Store an item in the datastore.
@@ -120,7 +120,7 @@
*/
int (*put) (void *closure,
const GNUNET_HashCode * key,
- const DataContainer * value, unsigned int prio);
+ const GNUNET_DataContainer * value, unsigned int prio);
/**
* Remove an item from the datastore.
@@ -130,7 +130,7 @@
* @return GNUNET_OK if the value could be removed, GNUNET_SYSERR if not
(i.e. not present)
*/
int (*del) (void *closure,
- const GNUNET_HashCode * key, const DataContainer * value);
+ const GNUNET_HashCode * key, const GNUNET_DataContainer * value);
/**
* Iterate over all keys in the local datastore
@@ -139,9 +139,9 @@
* @param cls argument to processor
* @return number of results, GNUNET_SYSERR on error
*/
- int (*iterate) (void *closure, DataProcessor processor, void *cls);
+ int (*iterate) (void *closure, GNUNET_DataProcessor processor, void *cls);
-} Blockstore;
+} GNUNET_Blockstore;
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_bootstrap_service.h
===================================================================
--- GNUnet/src/include/gnunet_bootstrap_service.h 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/include/gnunet_bootstrap_service.h 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -41,13 +41,13 @@
* Definition of a callback function that processes
* hello messages generated by the bootstrap API.
*/
-typedef void (*bootstrap_hello_callback) (const GNUNET_MessageHello * helo,
+typedef void (*GNUNET_BootstrapHelloCallback) (const GNUNET_MessageHello *
helo,
void *arg);
/**
* @return GNUNET_YES to continue, GNUNET_NO to abort
*/
-typedef int (*bootstrap_terminate_callback) (void *arg);
+typedef int (*GNUNET_BootstrapTerminateCallback) (void *arg);
/**
* @brief Definition of the bootstrap API.
@@ -62,11 +62,11 @@
* @param callback the method to call
* @param arg extra argument to the method
*/
- void (*bootstrap) (bootstrap_hello_callback callback,
+ void (*bootstrap) (GNUNET_BootstrapHelloCallback callback,
void *arg,
- bootstrap_terminate_callback term, void *targ);
+ GNUNET_BootstrapTerminateCallback term, void *targ);
-} Bootstrap_ServiceAPI;
+} GNUNET_Bootstrap_ServiceAPI;
#if 0 /* keep Emacsens' auto-indent happy */
Modified: GNUnet/src/include/gnunet_chat_lib.h
===================================================================
--- GNUnet/src/include/gnunet_chat_lib.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_chat_lib.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -95,8 +95,8 @@
* List all of the (publically visible) chat rooms.
* @return number of rooms on success, GNUNET_SYSERR if iterator aborted
*/
-int GNUNET_CHAT_list_rooms (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+int GNUNET_CHAT_list_rooms (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
GNUNET_CHAT_RoomIterator it, void *cls);
@@ -137,8 +137,8 @@
* @param cls argument to callback
* @return NULL on error
*/
-struct GNUNET_CHAT_Room *GNUNET_CHAT_join_room (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+struct GNUNET_CHAT_Room *GNUNET_CHAT_join_room (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration
*cfg,
const char *nickname,
const GNUNET_RSA_PublicKey *
me,
Modified: GNUnet/src/include/gnunet_collection_lib.h
===================================================================
--- GNUnet/src/include/gnunet_collection_lib.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_collection_lib.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -40,36 +40,36 @@
/**
* Initialize collection module.
*/
-void CO_init (struct GE_Context *ectx, struct GC_Configuration *cfg);
+void GNUNET_CO_init (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg);
/**
* Shutdown collection module.
*/
-void CO_done (void);
+void GNUNET_CO_done (void);
/**
* Start a collection (also automatically stops
* an existing collection).
*/
-int CO_startCollection (unsigned int anonymityLevel,
+int GNUNET_CO_collection_start (unsigned int anonymityLevel,
unsigned int priority,
GNUNET_Int32Time updateInterval,
- const char *name, const struct ECRS_MetaData *meta);
+ const char *name, const struct GNUNET_ECRS_MetaData
*meta);
/**
* Stop collection.
*
* @return GNUNET_OK on success, GNUNET_SYSERR if no collection is active
*/
-int CO_stopCollection (void);
+int GNUNET_CO_collection_stop (void);
/**
* Are we using a collection?
*
* @return NULL if there is no collection, otherwise its name
*/
-char *CO_getCollection (void);
+char *GNUNET_CO_collection_get_name (void);
/**
* GNUNET_ND_UPLOAD an update of the current collection information to the
@@ -86,7 +86,7 @@
* However, clients may want to call this function if explicit
* publication of an update at another time is desired.
*/
-void CO_publishCollectionNow (void);
+void GNUNET_CO_collection_publish_now (void);
/**
* If we are currently building a collection, publish the given file
@@ -99,7 +99,7 @@
* maybe useful if you're inserting files using libECRS directly or
* need other ways to explicitly extend a collection.
*/
-void CO_publishToCollection (const ECRS_FileInfo * fi);
+void GNUNET_CO_collection_add_item (const GNUNET_ECRS_FileInfo * fi);
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_core.h
===================================================================
--- GNUnet/src/include/gnunet_core.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/include/gnunet_core.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -56,12 +56,12 @@
* Priority for special administrative messages that
* for example overrules drop-rules.
*/
-#define EXTREME_PRIORITY 0xFFFFFF
+#define GNUNET_EXTREME_PRIORITY 0xFFFFFF
/**
* Highest legal priority or trust value
*/
-#define MAX_PRIO 0x7FFFFFFF
+#define GNUNET_MAX_PRIORITY 0x7FFFFFFF
/**
* Overhead of the core for encapsulating P2P messages.
@@ -69,7 +69,7 @@
* the amount of space available for an unfragmented
* message.
*/
-#define P2P_MESSAGE_OVERHEAD 76
+#define GNUNET_P2P_MESSAGNUNET_GE_OVERHEAD 76
/**
* Opaque handle for a session representation on the transport
@@ -86,29 +86,29 @@
unsigned int token_count;
unsigned short ttype;
-} TSession;
+} GNUNET_TSession;
/**
* Opaque handle for client connections passed by
* the core to the CSHandlers.
*/
-struct ClientHandle;
+struct GNUNET_ClientHandle;
/**
* Type of a handler for messages from clients.
*/
-typedef int (*CSHandler) (struct ClientHandle * client,
+typedef int (*GNUNET_ClientRequestHandler) (struct GNUNET_ClientHandle *
client,
const GNUNET_MessageHeader * message);
/**
* Method called whenever a given client disconnects.
*/
-typedef void (*ClientExitHandler) (struct ClientHandle * client);
+typedef void (*GNUNET_ClientExitHandler) (struct GNUNET_ClientHandle * client);
/**
* Type of a handler for some message type.
*/
-typedef int (*MessagePartHandler) (const GNUNET_PeerIdentity * sender,
+typedef int (*GNUNET_P2PRequestHandler) (const GNUNET_PeerIdentity * sender,
const GNUNET_MessageHeader * message);
/**
@@ -116,16 +116,16 @@
* be certain about the sender's identity, it is NOT passed to
* the callback.
*/
-typedef int (*PlaintextMessagePartHandler) (const GNUNET_PeerIdentity *
+typedef int (*GNUNET_P2PPlaintextRequestHandler) (const GNUNET_PeerIdentity *
sender,
const GNUNET_MessageHeader *
- message, TSession * session);
+ message, GNUNET_TSession *
session);
/**
* Type of a handler for some message type.
* @param identity the id of the node
*/
-typedef void (*PerNodeCallback) (const GNUNET_PeerIdentity * identity,
+typedef void (*GNUNET_NodeIteratorCallback) (const GNUNET_PeerIdentity *
identity,
void *data);
/**
@@ -138,7 +138,7 @@
* @return the number of bytes written to
* that buffer (must be a positive number).
*/
-typedef unsigned int (*BufferFillCallback) (const GNUNET_PeerIdentity *
+typedef unsigned int (*GNUNET_BufferFillCallback) (const GNUNET_PeerIdentity *
receiver, void *position,
unsigned int padding);
@@ -154,7 +154,7 @@
* to discard the message!
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-typedef int (*BuildMessageCallback) (void *buf,
+typedef int (*GNUNET_BuildMessageCallback) (void *buf,
void *closure, unsigned short len);
/**
@@ -166,7 +166,7 @@
*
* @param force GNUNET_YES if this message MUST be queued
*/
-typedef int (*SendToClientCallback) (struct ClientHandle * handle,
+typedef int (*GNUNET_SendToClientCallback) (struct GNUNET_ClientHandle *
handle,
const GNUNET_MessageHeader * message,
int force);
@@ -190,12 +190,12 @@
/**
* System error context
*/
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
/**
* System configuration
*/
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
/**
* System load monitor
@@ -267,10 +267,10 @@
* from the GNUnet core.
*
* @param session the transport session
- * @param msg the message to transmit, should contain MESSAGE_HEADERs
+ * @param msg the message to transmit, should contain MESSAGNUNET_GE_HEADERs
* @return GNUNET_OK on success, GNUNET_SYSERR on failure
*/
- int (*sendPlaintext) (TSession * session,
+ int (*sendPlaintext) (GNUNET_TSession * session,
const char *msg, unsigned int size);
/**
@@ -297,7 +297,7 @@
* @param maxdelay how long can the message wait?
*/
void (*unicastCallback) (const GNUNET_PeerIdentity * receiver,
- BuildMessageCallback callback,
+ GNUNET_BuildMessageCallback callback,
void *closure,
unsigned short len,
unsigned int importance, unsigned int maxdelay);
@@ -310,7 +310,7 @@
* @param arg the second argument to the method
* @return the number of connected hosts
*/
- int (*forAllConnectedNodes) (PerNodeCallback method, void *arg);
+ int (*forAllConnectedNodes) (GNUNET_NodeIteratorCallback method, void *arg);
/**
* Register a callback method that should be invoked whenever a message
@@ -333,14 +333,14 @@
* @return GNUNET_OK if the handler was registered, GNUNET_SYSERR on error
*/
int (*registerSendCallback) (const unsigned int minimumPadding,
- BufferFillCallback callback);
+ GNUNET_BufferFillCallback callback);
/**
* Unregister a handler that was registered with registerSendCallback.
* @return GNUNET_OK if the handler was removed, GNUNET_SYSERR on error
*/
int (*unregisterSendCallback) (const unsigned int minimumPadding,
- BufferFillCallback callback);
+ GNUNET_BufferFillCallback callback);
/**
* Register a handler that is to be called for each
@@ -350,7 +350,7 @@
* P2P message part that is transmitted
* @return GNUNET_OK on success, GNUNET_SYSERR if there is a problem
*/
- int (*registerSendNotify) (MessagePartHandler callback);
+ int (*registerSendNotify) (GNUNET_P2PRequestHandler callback);
/**
* Unregister a handler that is to be called for each
@@ -360,7 +360,7 @@
* P2P message part that is transmitted
* @return GNUNET_OK on success, GNUNET_SYSERR if there is a problem
*/
- int (*unregisterSendNotify) (MessagePartHandler callback);
+ int (*unregisterSendNotify) (GNUNET_P2PRequestHandler callback);
/* ********************* handlers ***************** */
@@ -374,7 +374,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if there is already a
* handler for that type
*/
- int (*registerHandler) (unsigned short type, MessagePartHandler callback);
+ int (*registerHandler) (unsigned short type, GNUNET_P2PRequestHandler
callback);
/**
* Unregister a method as a handler for specific message
@@ -385,7 +385,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if there is a different
* handler for that type
*/
- int (*unregisterHandler) (unsigned short type, MessagePartHandler callback);
+ int (*unregisterHandler) (unsigned short type, GNUNET_P2PRequestHandler
callback);
/**
* Is a handler registered for messages of the given type?
@@ -411,7 +411,7 @@
* handler for that type
*/
int (*registerPlaintextHandler) (unsigned short type,
- PlaintextMessagePartHandler callback);
+ GNUNET_P2PPlaintextRequestHandler callback);
/**
* Unregister a method as a handler for specific message
@@ -424,7 +424,7 @@
* handler for that type
*/
int (*unregisterPlaintextHandler) (unsigned short type,
- PlaintextMessagePartHandler callback);
+ GNUNET_P2PPlaintextRequestHandler
callback);
/* ***************** traffic management ******************* */
@@ -438,7 +438,7 @@
* the session, it will also be disconnected.
*/
void (*offerTSessionFor) (const GNUNET_PeerIdentity * peer,
- TSession * session);
+ GNUNET_TSession * session);
/**
* Assign a session key for traffic from or to a given peer.
@@ -515,7 +515,7 @@
* on the other hand does NOT confirm delivery since the actual
* transfer happens asynchronously.
*/
- int (*sendValueToClient) (struct ClientHandle * handle, int value);
+ int (*sendValueToClient) (struct GNUNET_ClientHandle * handle, int value);
/**
* Send a message to the client identified by the handle. Note that
@@ -524,7 +524,7 @@
* on the other hand does NOT confirm delivery since the actual
* transfer happens asynchronously.
*/
- SendToClientCallback sendToClient;
+ GNUNET_SendToClientCallback sendToClient;
/**
* Register a method as a handler for specific message
@@ -535,7 +535,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if there is already a
* handler for that type
*/
- int (*registerClientHandler) (unsigned short type, CSHandler callback);
+ int (*registerClientHandler) (unsigned short type,
GNUNET_ClientRequestHandler callback);
/**
* Remove a method as a handler for specific message
@@ -546,7 +546,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if there is a different
* handler for that type
*/
- int (*unregisterClientHandler) (unsigned short type, CSHandler callback);
+ int (*unregisterClientHandler) (unsigned short type,
GNUNET_ClientRequestHandler callback);
/**
* Register a handler to call if any client exits.
@@ -554,7 +554,7 @@
* of every client that disconnected.
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
- int (*registerClientExitHandler) (ClientExitHandler callback);
+ int (*registerClientExitHandler) (GNUNET_ClientExitHandler callback);
/**
* Unregister a handler to call if any client exits.
@@ -562,13 +562,13 @@
* of every client that disconnected.
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
- int (*unregisterClientExitHandler) (ClientExitHandler callback);
+ int (*unregisterClientExitHandler) (GNUNET_ClientExitHandler callback);
/**
* Terminate the connection with the given client (asynchronous
* detection of a protocol violation).
*/
- void (*terminateClientConnection) (struct ClientHandle * handle);
+ void (*terminateClientConnection) (struct GNUNET_ClientHandle * handle);
/* ************************ MISC ************************ */
@@ -586,7 +586,7 @@
void (*injectMessage) (const GNUNET_PeerIdentity * sender,
const char *msg,
unsigned int size,
- int wasEncrypted, TSession * session);
+ int wasEncrypted, GNUNET_TSession * session);
/**
* Compute the index (small, positive, pseudo-unique identification
@@ -631,15 +631,15 @@
* on the other hand does NOT confirm delivery since the actual
* transfer happens asynchronously.
*/
- int (*sendErrorMessageToClient) (struct ClientHandle * handle,
- GE_KIND kind, const char *value);
+ int (*sendErrorMessageToClient) (struct GNUNET_ClientHandle * handle,
+ GNUNET_GE_KIND kind, const char *value);
- struct GE_Context *(*createClientLogContext) (GE_KIND mask,
- struct ClientHandle * handle);
+ struct GNUNET_GE_Context *(*createClientLogContext) (GNUNET_GE_KIND mask,
+ struct GNUNET_ClientHandle *
handle);
- int (*assertUnused) (TSession * tsession);
+ int (*assertUnused) (GNUNET_TSession * tsession);
-} CoreAPIForApplication;
+} GNUNET_CoreAPIForPlugins;
/**
@@ -648,13 +648,13 @@
*
* @param capi the core API
*/
-typedef int (*ApplicationInitMethod) (CoreAPIForApplication * capi);
+typedef int (*GNUNET_ApplicationPluginInitializationMethod)
(GNUNET_CoreAPIForPlugins * capi);
/**
* Type of the shutdown method implemented by GNUnet protocol
* plugins.
*/
-typedef void (*ApplicationDoneMethod) (void);
+typedef void (*GNUNET_ApplicationPluginShutdownMethod) (void);
/**
* Type of the initialization method implemented by GNUnet service
@@ -662,20 +662,20 @@
*
* @param capi the core API
*/
-typedef void *(*ServiceInitMethod) (CoreAPIForApplication * capi);
+typedef void *(*GNUNET_ServicePluginInitializationMethod)
(GNUNET_CoreAPIForPlugins * capi);
/**
* Type of the shutdown method implemented by GNUnet service
* plugins.
*/
-typedef void (*ServiceDoneMethod) (void);
+typedef void (*GNUNET_ServicePluginShutdownMethod) (void);
/**
* API for version updates. Each module may define a function
* update_MODULE-NAME which must have the signature of an
- * UpdateMethod. Whenever the GNUnet version changes, gnunet-update
+ * GNUNET_UpdatePluginMainMethod. Whenever the GNUnet version changes,
gnunet-update
* will then call that function to allow the module to perform the
* necessary updates.
*/
@@ -685,12 +685,12 @@
/**
* System error context
*/
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
/**
* System configuration
*/
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
/**
* Trigger updates for another module.
@@ -720,9 +720,9 @@
int (*releaseService) (void *service);
-} UpdateAPI;
+} GNUNET_UpdateAPI;
-typedef void (*UpdateMethod) (UpdateAPI * uapi);
+typedef void (*GNUNET_UpdatePluginMainMethod) (GNUNET_UpdateAPI * uapi);
#if 0 /* keep Emacsens' auto-indent happy */
Modified: GNUnet/src/include/gnunet_datastore_service.h
===================================================================
--- GNUnet/src/include/gnunet_datastore_service.h 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/include/gnunet_datastore_service.h 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -81,7 +81,7 @@
*/
GNUNET_CronTime expirationTime;
-} Datastore_Value;
+} GNUNET_DatastoreValue;
/**
* An iterator over a set of Datastore items.
@@ -94,8 +94,8 @@
* @return GNUNET_SYSERR to abort the iteration, GNUNET_OK to continue,
* GNUNET_NO to delete the item and continue (if supported)
*/
-typedef int (*Datum_Iterator) (const GNUNET_HashCode * key,
- const Datastore_Value * value, void *closure,
+typedef int (*GNUNET_DatastoreValueIterator) (const GNUNET_HashCode * key,
+ const GNUNET_DatastoreValue * value, void
*closure,
unsigned long long uid);
@@ -134,7 +134,7 @@
* to justify removing something else, GNUNET_SYSERR on
* other serious error (i.e. IO permission denied)
*/
- int (*put) (const GNUNET_HashCode * key, const Datastore_Value * value);
+ int (*put) (const GNUNET_HashCode * key, const GNUNET_DatastoreValue *
value);
/**
* Store an item in the datastore. If the item is already present,
@@ -147,7 +147,7 @@
* other serious error (i.e. IO permission denied)
*/
int (*putUpdate) (const GNUNET_HashCode * key,
- const Datastore_Value * value);
+ const GNUNET_DatastoreValue * value);
/**
* Iterate over the results for a particular key
@@ -163,7 +163,7 @@
* GNUNET_SYSERR unless the iterator aborted!
*/
int (*get) (const GNUNET_HashCode * key,
- unsigned int type, Datum_Iterator iter, void *closure);
+ unsigned int type, GNUNET_DatastoreValueIterator iter, void
*closure);
/**
* Do a quick test if we MAY have the content.
@@ -177,14 +177,14 @@
* @param value set to an approximate match
* @return GNUNET_OK if a value was found, GNUNET_SYSERR if not
*/
- int (*getRandom) (GNUNET_HashCode * key, Datastore_Value ** value);
+ int (*getRandom) (GNUNET_HashCode * key, GNUNET_DatastoreValue ** value);
/**
* Explicitly remove some content from the database.
*/
- int (*del) (const GNUNET_HashCode * query, const Datastore_Value * value);
+ int (*del) (const GNUNET_HashCode * query, const GNUNET_DatastoreValue *
value);
-} Datastore_ServiceAPI;
+} GNUNET_Datastore_ServiceAPI;
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_dht_lib.h
===================================================================
--- GNUnet/src/include/gnunet_dht_lib.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/include/gnunet_dht_lib.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -50,12 +50,12 @@
* GNUNET_SYSERR
* @return number of results on success, GNUNET_SYSERR on error (i.e. timeout)
*/
-int DHT_LIB_get (struct GC_Configuration *cfg,
- struct GE_Context *ectx,
+int GNUNET_DHT_get (struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
unsigned int type,
const GNUNET_HashCode * key,
GNUNET_CronTime timeout,
- DataProcessor resultCallback, void *resCallbackClosure);
+ GNUNET_DataProcessor resultCallback, void
*resCallbackClosure);
/**
* Perform a synchronous put operation.
@@ -65,11 +65,11 @@
* @param value what to store
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int DHT_LIB_put (struct GC_Configuration *cfg,
- struct GE_Context *ectx,
+int GNUNET_DHT_put (struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
const GNUNET_HashCode * key,
unsigned int type,
- GNUNET_CronTime expire, const DataContainer * value);
+ GNUNET_CronTime expire, const GNUNET_DataContainer * value);
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_dht_service.h
===================================================================
--- GNUnet/src/include/gnunet_dht_service.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_dht_service.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -42,12 +42,12 @@
#endif
#endif
-struct DHT_GET_RECORD;
+struct GNUNET_DHT_GetHandle;
/**
* DHT operation 'complete' (i.e timed out).
*/
-typedef void (*DHT_OP_Complete) (void *closure);
+typedef void (*GNUNET_DHT_OperationCompleteCallback) (void *closure);
/**
* Functions of the DHT Service API.
@@ -68,18 +68,18 @@
* @param closure extra argument to callback
* @return handle to stop the async get
*/
- struct DHT_GET_RECORD *(*get_start) (unsigned int type,
+ struct GNUNET_DHT_GetHandle *(*get_start) (unsigned int type,
const GNUNET_HashCode * key,
GNUNET_CronTime timeout,
- DataProcessor callback,
+ GNUNET_DataProcessor callback,
void *cls,
- DHT_OP_Complete callbackComplete,
+ GNUNET_DHT_OperationCompleteCallback
callbackComplete,
void *closure);
/**
* Stop async DHT-get. Frees associated resources.
*/
- int (*get_stop) (struct DHT_GET_RECORD * record);
+ int (*get_stop) (struct GNUNET_DHT_GetHandle * record);
/**
* Perform a PUT operation on the DHT identified by 'table' storing
@@ -92,7 +92,7 @@
unsigned int type,
unsigned int size, GNUNET_CronTime expire, const char *data);
-} DHT_ServiceAPI;
+} GNUNET_DHT_ServiceAPI;
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_directories.h
===================================================================
--- GNUnet/src/include/gnunet_directories.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_directories.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -28,9 +28,9 @@
#ifndef GNUNET_DIRECTORIES
#define GNUNET_DIRECTORIES
-#define DEFAULT_CLIENT_CONFIG_FILE "~/.gnunet/gnunet.conf"
-#define DEFAULT_DAEMON_CONFIG_FILE "/etc/gnunetd.conf"
-#define VAR_DAEMON_DIRECTORY "$GNUNETD_HOME"
-#define GNUNET_HOME_DIRECTORY "$GNUNET_HOME"
+#define GNUNET_DEFAULT_CLIENT_CONFIG_FILE "~/.gnunet/gnunet.conf"
+#define GNUNET_DEFAULT_DAEMON_CONFIG_FILE "/etc/gnunetd.conf"
+#define GNUNET_DEFAULT_DAEMON_VAR_DIRECTORY "$GNUNETD_HOME"
+#define GNUNET_DEFAULT_HOME_DIRECTORY "$GNUNET_HOME"
#endif
Modified: GNUnet/src/include/gnunet_dstore_service.h
===================================================================
--- GNUnet/src/include/gnunet_dstore_service.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_dstore_service.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -42,7 +42,7 @@
#endif
#endif
-typedef void (*ResultHandler) (const GNUNET_HashCode * key,
+typedef void (*GNUNET_ResultProcessor) (const GNUNET_HashCode * key,
unsigned int type,
unsigned int size,
const char *data, void *cls);
@@ -74,9 +74,9 @@
* iter is non-NULL and aborted the iteration
*/
int (*get) (const GNUNET_HashCode * key,
- unsigned int type, ResultHandler handler, void *closure);
+ unsigned int type, GNUNET_ResultProcessor handler, void
*closure);
-} Dstore_ServiceAPI;
+} GNUNET_Dstore_ServiceAPI;
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_ecrs_lib.h
===================================================================
--- GNUnet/src/include/gnunet_ecrs_lib.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_ecrs_lib.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -55,18 +55,18 @@
* 5.0.x: with location URIs
* 6.x.x: who knows? :-)
*/
-#define AFS_VERSION "5.0.0"
+#define GNUNET_ECRS_VERSION "5.0.0"
#define GNUNET_DIRECTORY_MIME "application/gnunet-directory"
#define GNUNET_DIRECTORY_MAGIC "\211GND\r\n\032\n"
#define GNUNET_DIRECTORY_EXT ".gnd"
-#define ECRS_URI_PREFIX "gnunet://ecrs/"
-#define ECRS_SEARCH_INFIX "ksk/"
-#define ECRS_SUBSPACE_INFIX "sks/"
-#define ECRS_FILE_INFIX "chk/"
-#define ECRS_LOCATION_INFIX "loc/"
+#define GNUNET_ECRS_URI_PREFIX "gnunet://ecrs/"
+#define GNUNET_ECRS_SEARCH_INFIX "ksk/"
+#define GNUNET_ECRS_SUBSPACE_INFIX "sks/"
+#define GNUNET_ECRS_FILE_INFIX "chk/"
+#define GNUNET_ECRS_LOCATION_INFIX "loc/"
/**
@@ -74,8 +74,8 @@
* are interpreted as durations (in seconds) for periodical
* updates.
*/
-#define ECRS_SBLOCK_UPDATE_SPORADIC -1
-#define ECRS_SBLOCK_UPDATE_NONE 0
+#define GNUNET_ECRS_SBLOCK_UPDATE_SPORADIC -1
+#define GNUNET_ECRS_SBLOCK_UPDATE_NONE 0
@@ -84,77 +84,77 @@
/**
* Meta data to associate with a file, directory or namespace.
*/
-struct ECRS_MetaData;
+struct GNUNET_ECRS_MetaData;
/**
* Iterator over meta data.
* @return GNUNET_OK to continue to iterate, GNUNET_SYSERR to abort
*/
-typedef int (*ECRS_MetaDataIterator) (EXTRACTOR_KeywordType type,
+typedef int (*GNUNET_ECRS_MetaDataProcessor) (EXTRACTOR_KeywordType type,
const char *data, void *closure);
/**
* Iterator over keywords
* @return GNUNET_OK to continue to iterate, GNUNET_SYSERR to abort
*/
-typedef int (*ECRS_KeywordIterator) (const char *data, void *closure);
+typedef int (*GNUNET_ECRS_KeywordIterator) (const char *data, void *closure);
/**
* Create a fresh MetaData token.
*/
-struct ECRS_MetaData *ECRS_createMetaData (void);
+struct GNUNET_ECRS_MetaData *GNUNET_ECRS_meta_data_create (void);
/**
* Duplicate a MetaData token.
*/
-struct ECRS_MetaData *ECRS_dupMetaData (const struct ECRS_MetaData *meta);
+struct GNUNET_ECRS_MetaData *GNUNET_ECRS_meta_data_duplicate (const struct
GNUNET_ECRS_MetaData *meta);
/**
* Free meta data.
*/
-void ECRS_freeMetaData (struct ECRS_MetaData *md);
+void GNUNET_ECRS_meta_data_destroy (struct GNUNET_ECRS_MetaData *md);
/**
* Test if two MDs are equal.
*/
-int ECRS_equalsMetaData (const struct ECRS_MetaData *md1,
- const struct ECRS_MetaData *md2);
+int GNUNET_ECRS_meta_data_test_equal (const struct GNUNET_ECRS_MetaData *md1,
+ const struct GNUNET_ECRS_MetaData *md2);
/**
* Extend metadata.
* @return GNUNET_OK on success, GNUNET_SYSERR if this entry already exists
*/
-int ECRS_addToMetaData (struct ECRS_MetaData *md,
+int GNUNET_ECRS_meta_data_inser (struct GNUNET_ECRS_MetaData *md,
EXTRACTOR_KeywordType type, const char *data);
/**
* Remove an item.
* @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist in md
*/
-int ECRS_delFromMetaData (struct ECRS_MetaData *md,
+int GNUNET_ECRS_meta_data_delete (struct GNUNET_ECRS_MetaData *md,
EXTRACTOR_KeywordType type, const char *data);
/**
* Add the current time as the publication date
* to the meta-data.
*/
-void ECRS_addPublicationDateToMetaData (struct ECRS_MetaData *md);
+void GNUNET_ECRS_meta_data_add_publication_date (struct GNUNET_ECRS_MetaData
*md);
/**
* Iterate over MD entries, excluding thumbnails.
*
* @return number of entries
*/
-int ECRS_getMetaData (const struct ECRS_MetaData *md,
- ECRS_MetaDataIterator iterator, void *closure);
+int GNUNET_ECRS_meta_data_get_contents (const struct GNUNET_ECRS_MetaData *md,
+ GNUNET_ECRS_MetaDataProcessor iterator, void *closure);
/**
* Get the first MD entry of the given type.
* @return NULL if we do not have any such entry,
* otherwise client is responsible for freeing the value!
*/
-char *ECRS_getFromMetaData (const struct ECRS_MetaData *md,
+char *GNUNET_ECRS_meta_data_get_by_type (const struct GNUNET_ECRS_MetaData *md,
EXTRACTOR_KeywordType type);
/**
@@ -163,7 +163,7 @@
* @return NULL if we do not have any such entry,
* otherwise client is responsible for freeing the value!
*/
-char *ECRS_getFirstFromMetaData (const struct ECRS_MetaData *md, ...);
+char *GNUNET_ECRS_meta_data_get_first_by_types (const struct
GNUNET_ECRS_MetaData *md, ...);
/**
* Get a thumbnail from the meta-data (if present).
@@ -172,7 +172,7 @@
* freed by the caller!
* @return number of bytes in thumbnail, 0 if not available
*/
-size_t ECRS_getThumbnailFromMetaData (const struct ECRS_MetaData *md,
+size_t GNUNET_ECRS_meta_data_get_thumbnail (const struct GNUNET_ECRS_MetaData
*md,
unsigned char **thumb);
/**
@@ -181,19 +181,19 @@
* @return GNUNET_SYSERR on error, otherwise the number
* of meta-data items obtained
*/
-int ECRS_extractMetaData (struct GE_Context *ectx,
- struct ECRS_MetaData *md,
+int GNUNET_ECRS_meta_data_extract_from_file (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_ECRS_MetaData *md,
const char *filename,
EXTRACTOR_ExtractorList * extractors);
/* = 0 */
-#define ECRS_SERIALIZE_FULL GNUNET_NO
+#define GNUNET_ECRS_SERIALIZE_FULL GNUNET_NO
/* = 1 */
-#define ECRS_SERIALIZE_PART GNUNET_YES
+#define GNUNET_ECRS_SERIALIZE_PART GNUNET_YES
/* disallow compression (if speed is important) */
-#define ECRS_SERIALIZE_NO_COMPRESS 2
+#define GNUNET_ECRS_SERIALIZE_NO_COMPRESS 2
/**
@@ -207,8 +207,8 @@
* GNUNET_SYSERR on error (typically: not enough
* space)
*/
-int ECRS_serializeMetaData (struct GE_Context *ectx,
- const struct ECRS_MetaData *md,
+int GNUNET_ECRS_meta_data_serialize (struct GNUNET_GE_Context *ectx,
+ const struct GNUNET_ECRS_MetaData *md,
char *target, unsigned int size, int part);
/**
@@ -216,7 +216,7 @@
* serialized form.
* @part flags (partial ok, may compress?)
*/
-unsigned int ECRS_sizeofMetaData (const struct ECRS_MetaData *md, int part);
+unsigned int GNUNET_ECRS_meta_data_get_serialized_size (const struct
GNUNET_ECRS_MetaData *md, int part);
/**
* Deserialize meta-data. Initializes md.
@@ -224,7 +224,7 @@
* @return MD on success, NULL on error (i.e.
* bad format)
*/
-struct ECRS_MetaData *ECRS_deserializeMetaData (struct GE_Context *ectx,
+struct GNUNET_ECRS_MetaData *GNUNET_ECRS_meta_data_deserialize (struct
GNUNET_GE_Context *ectx,
const char *input,
unsigned int size);
@@ -235,61 +235,55 @@
* @return GNUNET_YES if it is, GNUNET_NO if it is not, GNUNET_SYSERR if
* we have no mime-type information (treat as 'GNUNET_NO')
*/
-int ECRS_isDirectory (const struct ECRS_MetaData *md);
+int GNUNET_ECRS_meta_data_test_for_directory (const struct
GNUNET_ECRS_MetaData *md);
/**
* Suggest a better filename for a file (and do the
* renaming).
*/
-char *ECRS_suggestFilename (struct GE_Context *ectx, const char *filename);
+char *GNUNET_ECRS_suggest_better_filename (struct GNUNET_GE_Context *ectx,
const char *filename);
/* ******************** URI (uri.c) ************************ */
/**
* A URI (in internal representation).
*/
-struct ECRS_URI;
+struct GNUNET_ECRS_URI;
/**
* Convert a URI to a UTF-8 String.
*/
-char *ECRS_uriToString (const struct ECRS_URI *uri);
+char *GNUNET_ECRS_uri_to_string (const struct GNUNET_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 (struct GE_Context *ectx, const char *uri);
+struct GNUNET_ECRS_URI *GNUNET_ECRS_string_to_uri (struct GNUNET_GE_Context
*ectx, const char *uri);
/**
* Free URI.
*/
-void ECRS_freeUri (struct ECRS_URI *uri);
+void GNUNET_ECRS_uri_destroy (struct GNUNET_ECRS_URI *uri);
/**
* How many keywords are ANDed in this keyword URI?
* @return 0 if this is not a keyword URI
*/
-unsigned int ECRS_countKeywordsOfUri (const struct ECRS_URI *uri);
+unsigned int GNUNET_ECRS_uri_get_keyword_count_from_ksk (const struct
GNUNET_ECRS_URI *uri);
/**
* Iterate over all keywords in this keyword URI?
* @return -1 if this is not a keyword URI, otherwise number of
* keywords iterated over until iterator aborted
*/
-int ECRS_getKeywordsFromUri (const struct ECRS_URI *uri,
- ECRS_KeywordIterator iterator, void *cls);
+int GNUNET_ECRS_uri_get_keywords_from_ksk (const struct GNUNET_ECRS_URI *uri,
+ GNUNET_ECRS_KeywordIterator iterator, void *cls);
/**
* Obtain the identity of the peer offering the data
* @return -1 if this is not a location URI, otherwise GNUNET_OK
*/
-int ECRS_getPeerFromUri (const struct ECRS_URI *uri,
+int GNUNET_ECRS_uri_get_peer_identity_from_loc (const struct GNUNET_ECRS_URI
*uri,
GNUNET_PeerIdentity * peer);
/**
@@ -297,13 +291,13 @@
*
* @return NULL if argument is not a location URI
*/
-struct ECRS_URI *ECRS_getContentUri (const struct ECRS_URI *uri);
+struct GNUNET_ECRS_URI * GNUNET_ECRS_uri_get_content_uri_from_loc (const
struct GNUNET_ECRS_URI *uri);
/**
* Function that produces a signature for
* a particular piece of content.
*/
-typedef int (*ECRS_SignFunction) (void *cls,
+typedef int (*GNUNET_ECRS_SignFunction) (void *cls,
unsigned short size,
const void *data,
GNUNET_RSA_Signature * result);
@@ -318,26 +312,32 @@
* RSA signatures for "sender".
* @return the location URI
*/
-struct ECRS_URI *ECRS_uriFromLocation (const struct ECRS_URI *baseUri,
+struct GNUNET_ECRS_URI *GNUNET_ECRS_location_to_uri (const struct
GNUNET_ECRS_URI *baseUri,
const GNUNET_RSA_PublicKey * peer,
GNUNET_Int32Time expirationTime,
- ECRS_SignFunction signer,
+ GNUNET_ECRS_SignFunction signer,
void *signer_cls);
/**
* Duplicate URI.
*/
-struct ECRS_URI *ECRS_dupUri (const struct ECRS_URI *uri);
+struct GNUNET_ECRS_URI *GNUNET_ECRS_uri_duplicate (const struct
GNUNET_ECRS_URI *uri);
/**
* Expand a keyword-URI by duplicating all keywords,
* adding the current date (YYYY-MM-DD) after each
* keyword.
*/
-struct ECRS_URI *ECRS_dateExpandKeywordUri (const struct ECRS_URI *uri);
+struct GNUNET_ECRS_URI *GNUNET_ECRS_uri_expand_keywords_with_date (const
struct GNUNET_ECRS_URI *uri);
/**
+ * Convert a NULL-terminated array of keywords
+ * to an ECRS URI.
+ */
+struct GNUNET_ECRS_URI *GNUNET_ECRS_keyword_strings_to_uri (const char
*keyword[]);
+
+/**
* Create an ECRS URI from a single user-supplied string of keywords.
* The string may contain the reserved word 'AND' to create a boolean
* search over multiple keywords.
@@ -345,7 +345,7 @@
* @return an ECRS URI for the given keywords, NULL
* if keywords is not legal (i.e. empty).
*/
-struct ECRS_URI *ECRS_parseCharKeywordURI (struct GE_Context *ectx, const char
*keywords); /* helper.c */
+struct GNUNET_ECRS_URI *GNUNET_ECRS_keyword_string_to_uri (struct
GNUNET_GE_Context *ectx, const char *keywords); /* helper.c */
/**
* Create an ECRS URI from a user-supplied command line of keywords.
@@ -355,7 +355,7 @@
* @return an ECRS URI for the given keywords, NULL
* if keywords is not legal (i.e. empty).
*/
-struct ECRS_URI *ECRS_parseArgvKeywordURI (struct GE_Context *ectx, unsigned
int argc, const char **argv); /* helper.c */
+struct GNUNET_ECRS_URI *GNUNET_ECRS_keyword_command_line_to_uri (struct
GNUNET_GE_Context *ectx, unsigned int argc, const char **argv); /*
helper.c */
/**
* Create an ECRS URI from a user-supplied list of keywords.
@@ -365,19 +365,19 @@
* @return an ECRS URI for the given keywords, NULL
* if keywords is not legal (i.e. empty).
*/
-struct ECRS_URI *ECRS_parseListKeywordURI (struct GE_Context *ectx,
+struct GNUNET_ECRS_URI *GNUNET_ECRS_keyword_list_to_uri (struct
GNUNET_GE_Context *ectx,
unsigned int num_keywords,
const char **keywords);
/**
* Test if two URIs are equal.
*/
-int ECRS_equalsUri (const struct ECRS_URI *u1, const struct ECRS_URI *u2);
+int GNUNET_ECRS_uri_test_equal (const struct GNUNET_ECRS_URI *u1, const struct
GNUNET_ECRS_URI *u2);
/**
* Is this a namespace URI?
*/
-int ECRS_isNamespaceUri (const struct ECRS_URI *uri);
+int GNUNET_ECRS_uri_test_sks (const struct GNUNET_ECRS_URI *uri);
/**
* Get the (globally unique) name for the given
@@ -386,40 +386,40 @@
* @return the name (GNUNET_hash) of the namespace, caller
* must free it.
*/
-char *ECRS_getNamespaceName (const GNUNET_HashCode * nsid);
+char *GNUNET_ECRS_get_namespace_name (const GNUNET_HashCode * nsid);
/**
* Get the ID of a namespace from the given
* namespace URI.
*/
-int ECRS_getNamespaceId (const struct ECRS_URI *uri, GNUNET_HashCode * nsid);
+int GNUNET_ECRS_uri_get_namespace_from_sks (const struct GNUNET_ECRS_URI *uri,
GNUNET_HashCode * nsid);
/**
* Get the content ID of an SKS URI.
*/
-int ECRS_getSKSContentHash (const struct ECRS_URI *uri,
+int GNUNET_ECRS_uri_get_content_hash_from_sks (const struct GNUNET_ECRS_URI
*uri,
GNUNET_HashCode * nsid);
/**
* Is this a keyword URI?
*/
-int ECRS_isKeywordUri (const struct ECRS_URI *uri);
+int GNUNET_ECRS_uri_test_ksk (const struct GNUNET_ECRS_URI *uri);
/**
* Is this a file (or directory) URI?
*/
-int ECRS_isFileUri (const struct ECRS_URI *uri);
+int GNUNET_ECRS_uri_test_chk (const struct GNUNET_ECRS_URI *uri);
/**
* What is the size of the file that this URI
* refers to?
*/
-unsigned long long ECRS_fileSize (const struct ECRS_URI *uri);
+unsigned long long GNUNET_ECRS_uri_get_file_siz (const struct GNUNET_ECRS_URI
*uri);
/**
* Is this a location URI?
*/
-int ECRS_isLocationUri (const struct ECRS_URI *uri);
+int GNUNET_ECRS_uri_test_loc (const struct GNUNET_ECRS_URI *uri);
@@ -428,27 +428,27 @@
* in the meta-data and construct one large keyword URI
* that lists all keywords that can be found in the meta-data).
*/
-struct ECRS_URI *ECRS_metaDataToUri (const struct ECRS_MetaData *md);
+struct GNUNET_ECRS_URI *GNUNET_ECRS_meta_data_to_uri (const struct
GNUNET_ECRS_MetaData *md);
typedef struct
{
- struct ECRS_MetaData *meta;
- struct ECRS_URI *uri;
-} ECRS_FileInfo;
+ struct GNUNET_ECRS_MetaData *meta;
+ struct GNUNET_ECRS_URI *uri;
+} GNUNET_ECRS_FileInfo;
/**
- * @param scls must be of type "struct ECRS_URI **"
+ * @param scls must be of type "struct GNUNET_ECRS_URI **"
*/
-int gnunet_getopt_configure_set_keywords (GNUNET_CommandLineProcessorContext *
+int GNUNET_ECRS_getopt_configure_set_keywords
(GNUNET_CommandLineProcessorContext *
ctx, void *scls, const char *option,
const char *value);
/**
- * @param scls must be of type "struct ECRS_MetaData **"
+ * @param scls must be of type "struct GNUNET_ECRS_MetaData **"
*/
-int gnunet_getopt_configure_set_metadata (GNUNET_CommandLineProcessorContext *
+int GNUNET_ECRS_getopt_configure_set_metadata
(GNUNET_CommandLineProcessorContext *
ctx, void *scls, const char *option,
const char *value);
@@ -464,7 +464,7 @@
* @param completedBytes number of bytes that have been inserted
* @param eta absolute estimated time for the completion of the operation
*/
-typedef void (*ECRS_UploadProgressCallback)
+typedef void (*GNUNET_ECRS_UploadProgressCallback)
(unsigned long long totalBytes,
unsigned long long completedBytes, GNUNET_CronTime eta, void *closure);
@@ -481,7 +481,7 @@
* @return GNUNET_OK to continue, GNUNET_SYSERR to abort with deleting
* temporary files, GNUNET_NO to abort without deleting temporary files
*/
-typedef int (*ECRS_TestTerminate) (void *closure);
+typedef int (*GNUNET_ECRS_TestTerminate) (void *closure);
/**
* Index or insert a file.
@@ -494,8 +494,8 @@
* @return GNUNET_SYSERR if the upload failed (i.e. not enough space
* or gnunetd not running)
*/
-int ECRS_uploadFile (struct GE_Context *ectx, struct GC_Configuration *cfg,
const char *filename, int doIndex, unsigned int anonymityLevel, unsigned int
priority, GNUNET_CronTime expirationTime, /* absolute time */
- ECRS_UploadProgressCallback upcb, void *upcbClosure,
ECRS_TestTerminate tt, void *ttClosure, struct ECRS_URI **uri); /*
upload.c */
+int GNUNET_ECRS_file_upload (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const char *filename, int doIndex, unsigned int
anonymityLevel, unsigned int priority, GNUNET_CronTime expirationTime, /*
absolute time */
+ GNUNET_ECRS_UploadProgressCallback upcb, void
*upcbClosure, GNUNET_ECRS_TestTerminate tt, void *ttClosure, struct
GNUNET_ECRS_URI **uri); /* upload.c */
/**
* Test if a file is indexed.
@@ -506,13 +506,13 @@
* in either case, if GNUNET_SYSERR is returned the user should probably
* be notified that 'something is wrong')
*/
-int ECRS_isFileIndexed (struct GE_Context *ectx,
- struct GC_Configuration *cfg, const char *filename);
+int GNUNET_ECRS_file_test_indexed (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg, const char
*filename);
/**
* @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort
*/
-typedef int (*ECRS_FileIterator) (const char *filename, void *cls);
+typedef int (*GNUNET_ECRS_FileProcessor) (const char *filename, void *cls);
/**
* Iterate over all indexed files.
@@ -526,16 +526,16 @@
*
* @return number of files indexed, GNUNET_SYSERR if iterator aborted
*/
-int ECRS_iterateIndexedFiles (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- ECRS_FileIterator iterator, void *closure);
+int GNUNET_ECRS_get_indexed_files (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ GNUNET_ECRS_FileProcessor iterator, void
*closure);
/**
* Unindex a file.
*
* @return GNUNET_SYSERR if the unindexing failed (i.e. not indexed)
*/
-int ECRS_unindexFile (struct GE_Context *ectx, struct GC_Configuration *cfg,
const char *filename, ECRS_UploadProgressCallback upcb, void *upcbClosure,
ECRS_TestTerminate tt, void *ttClosure); /* unindex.c */
+int GNUNET_ECRS_file_uninde (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const char *filename,
GNUNET_ECRS_UploadProgressCallback upcb, void *upcbClosure,
GNUNET_ECRS_TestTerminate tt, void *ttClosure); /* unindex.c */
/**
@@ -558,7 +558,7 @@
*
* @return URI on success, NULL on error (namespace already exists)
*/
-struct ECRS_URI *ECRS_createNamespace (struct GE_Context *ectx, struct
GC_Configuration *cfg, const char *name, const struct ECRS_MetaData *meta,
unsigned int anonymityLevel, unsigned int priority, GNUNET_CronTime expiration,
const struct ECRS_URI *advertisementURI, const GNUNET_HashCode * rootEntry);
/* namespace.c */
+struct GNUNET_ECRS_URI *GNUNET_ECRS_namespace_create (struct GNUNET_GE_Context
*ectx, struct GNUNET_GC_Configuration *cfg, const char *name, const struct
GNUNET_ECRS_MetaData *meta, unsigned int anonymityLevel, unsigned int priority,
GNUNET_CronTime expiration, const struct GNUNET_ECRS_URI *advertisementURI,
const GNUNET_HashCode * rootEntry); /* namespace.c */
/**
* Check if the given namespace exists (locally).
@@ -566,8 +566,8 @@
* hc of the public key
* @return GNUNET_OK if the namespace exists, GNUNET_SYSERR if not
*/
-int ECRS_testNamespaceExists (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+int GNUNET_ECRS_namespace_test_exists (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *name, const GNUNET_HashCode * hc);
/**
@@ -577,14 +577,14 @@
*
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int ECRS_deleteNamespace (struct GE_Context *ectx, struct GC_Configuration
*cfg, const char *namespaceName); /* namespace.c */
+int GNUNET_ECRS_namespace_delete (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const char *namespaceName); /* namespace.c */
/**
* Callback with information about local (!) namespaces.
* Contains the name of the local namespace and the global
* ID.
*/
-typedef int (*ECRS_NamespaceInfoCallback) (const GNUNET_HashCode * id,
+typedef int (*GNUNET_ECRS_NamespaceInfoProcessor) (const GNUNET_HashCode * id,
const char *name, void *closure);
/**
@@ -595,7 +595,7 @@
* @param list where to store the names (is allocated, caller frees)
* @return GNUNET_SYSERR on error, otherwise the number of pseudonyms in list
*/
-int ECRS_listNamespaces (struct GE_Context *ectx, struct GC_Configuration
*cfg, ECRS_NamespaceInfoCallback cb, void *cls); /* namespace.c */
+int GNUNET_ECRS_get_namespaces (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, GNUNET_ECRS_NamespaceInfoProcessor cb, void
*cls); /* namespace.c */
/**
* Add an entry into a namespace.
@@ -607,7 +607,7 @@
* entry?
* @return URI on success, NULL on error
*/
-struct ECRS_URI *ECRS_addToNamespace (struct GE_Context *ectx, struct
GC_Configuration *cfg, const char *name, unsigned int anonymityLevel, unsigned
int priority, GNUNET_CronTime expirationTime, GNUNET_Int32Time creationTime,
GNUNET_Int32Time updateInterval, const GNUNET_HashCode * thisId, const
GNUNET_HashCode * nextId, const struct ECRS_URI *dst, const struct
ECRS_MetaData *md); /* namespace.c */
+struct GNUNET_ECRS_URI *GNUNET_ECRS_namespace_add_content (struct
GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration *cfg, const char *name,
unsigned int anonymityLevel, unsigned int priority, GNUNET_CronTime
expirationTime, GNUNET_Int32Time creationTime, GNUNET_Int32Time updateInterval,
const GNUNET_HashCode * thisId, const GNUNET_HashCode * nextId, const struct
GNUNET_ECRS_URI *dst, const struct GNUNET_ECRS_MetaData *md); /* namespace.c */
/**
* Add an entry into the K-space (keyword space).
@@ -618,7 +618,7 @@
* @param md what meta-data should be associated with the
* entry?
*/
-int ECRS_addToKeyspace (struct GE_Context *ectx, struct GC_Configuration *cfg,
const struct ECRS_URI *uri, unsigned int anonymityLevel, unsigned int priority,
GNUNET_CronTime expirationTime, const struct ECRS_URI *dst, const struct
ECRS_MetaData *md); /* keyspace.c */
+int GNUNET_ECRS_publish_under_keyword (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const struct GNUNET_ECRS_URI *uri, unsigned int
anonymityLevel, unsigned int priority, GNUNET_CronTime expirationTime, const
struct GNUNET_ECRS_URI *dst, const struct GNUNET_ECRS_MetaData *md); /*
keyspace.c */
/**
* The search has found another result. Callback to notify
@@ -631,8 +631,8 @@
* @param md a description for the URI
* @return GNUNET_OK, GNUNET_SYSERR to abort
*/
-typedef int (*ECRS_SearchProgressCallback)
- (const ECRS_FileInfo * fi,
+typedef int (*GNUNET_ECRS_SearchResultProcessor)
+ (const GNUNET_ECRS_FileInfo * fi,
const GNUNET_HashCode * key, int isRoot, void *closure);
/**
@@ -642,7 +642,7 @@
* @param uri specifies the search parameters
* @param uri set to the URI of the uploaded file
*/
-int ECRS_search (struct GE_Context *ectx, struct GC_Configuration *cfg, const
struct ECRS_URI *uri, unsigned int anonymityLevel, GNUNET_CronTime timeout,
ECRS_SearchProgressCallback spcb, void *spcbClosure, ECRS_TestTerminate tt,
void *ttClosure); /* search.c */
+int GNUNET_ECRS_search (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const struct GNUNET_ECRS_URI *uri, unsigned int
anonymityLevel, GNUNET_CronTime timeout, GNUNET_ECRS_SearchResultProcessor
spcb, void *spcbClosure, GNUNET_ECRS_TestTerminate tt, void *ttClosure); /*
search.c */
/**
* Notification of ECRS to a client about the progress of an insertion
@@ -658,7 +658,7 @@
* @param lastBlock plaintext of the last block that was downloaded
* @param lastBlockSize size of the last block that was downloaded
*/
-typedef void (*ECRS_DownloadProgressCallback)
+typedef void (*GNUNET_ECRS_DownloadProgressCallback)
(unsigned long long totalBytes,
unsigned long long completedBytes,
GNUNET_CronTime eta,
@@ -671,7 +671,7 @@
* @param uri the URI of the file (determines what to download)
* @param filename where to store the file
*/
-int ECRS_downloadFile (struct GE_Context *ectx, struct GC_Configuration *cfg,
const struct ECRS_URI *uri, const char *filename, unsigned int anonymityLevel,
ECRS_DownloadProgressCallback dpcb, void *dpcbClosure, ECRS_TestTerminate tt,
void *ttClosure); /* download.c */
+int GNUNET_ECRS_file_download (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const struct GNUNET_ECRS_URI *uri, const char
*filename, unsigned int anonymityLevel, GNUNET_ECRS_DownloadProgressCallback
dpcb, void *dpcbClosure, GNUNET_ECRS_TestTerminate tt, void *ttClosure); /*
download.c */
/**
* GNUNET_ND_DOWNLOAD parts of a file. Note that this will store
@@ -692,14 +692,14 @@
* @param start starting offset
* @param length length of the download (starting at offset)
*/
-int ECRS_downloadPartialFile (struct GE_Context *ectx, struct GC_Configuration
*cfg, const struct ECRS_URI *uri, const char *filename, unsigned long long
offset, unsigned long long length, unsigned int anonymityLevel, int
no_temporaries, ECRS_DownloadProgressCallback dpcb, void *dpcbClosure,
ECRS_TestTerminate tt, void *ttClosure); /* download.c */
+int GNUNET_ECRS_file_download_partial (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const struct GNUNET_ECRS_URI *uri, const char
*filename, unsigned long long offset, unsigned long long length, unsigned int
anonymityLevel, int no_temporaries, GNUNET_ECRS_DownloadProgressCallback dpcb,
void *dpcbClosure, GNUNET_ECRS_TestTerminate tt, void *ttClosure); /*
download.c */
/**
* Iterate over all entries in a directory. Note that directories
* are structured such that it is possible to iterate over the
* individual blocks as well as over the entire directory. Thus
* a client can call this function on the lastBlock in the
- * ECRS_DownloadProgressCallback.
+ * GNUNET_ECRS_DownloadProgressCallback.
*
* @param data pointer to the beginning of the directory
* @param len number of bytes in data
@@ -708,7 +708,7 @@
* @return number of entries on success, GNUNET_SYSERR if the
* directory is malformed
*/
-int ECRS_listDirectory (struct GE_Context *ectx, const char *data, unsigned
long long len, struct ECRS_MetaData **md, ECRS_SearchProgressCallback spcb,
void *spcbClosure); /* directory.c */
+int GNUNET_ECRS_directory_list_contents (struct GNUNET_GE_Context *ectx, const
char *data, unsigned long long len, struct GNUNET_ECRS_MetaData **md,
GNUNET_ECRS_SearchResultProcessor spcb, void *spcbClosure); /* directory.c
*/
/**
* Create a directory.
@@ -723,7 +723,7 @@
* is extended with the mime-type for a GNUnet directory.
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int ECRS_createDirectory (struct GE_Context *ectx, char **data, unsigned long
long *len, unsigned int count, const ECRS_FileInfo * fis, struct ECRS_MetaData
*meta); /* directory.c */
+int GNUNET_ECRS_directory_create (struct GNUNET_GE_Context *ectx, char **data,
unsigned long long *len, unsigned int count, const GNUNET_ECRS_FileInfo * fis,
struct GNUNET_ECRS_MetaData *meta); /* directory.c */
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_fragmentation_service.h
===================================================================
--- GNUnet/src/include/gnunet_fragmentation_service.h 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/include/gnunet_fragmentation_service.h 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -58,9 +58,9 @@
unsigned int prio,
unsigned int targetTime,
unsigned int len,
- BuildMessageCallback bmc, void *bmcClosure);
+ GNUNET_BuildMessageCallback bmc, void *bmcClosure);
-} Fragmentation_ServiceAPI;
+} GNUNET_Fragmentation_ServiceAPI;
#if 0 /* keep Emacsens' auto-indent happy */
Modified: GNUnet/src/include/gnunet_fs_lib.h
===================================================================
--- GNUnet/src/include/gnunet_fs_lib.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/include/gnunet_fs_lib.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -44,15 +44,15 @@
#endif
-struct FS_SEARCH_CONTEXT;
+struct GNUNET_FS_SearchContext;
-struct FS_SEARCH_CONTEXT *FS_SEARCH_makeContext (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+struct GNUNET_FS_SearchContext *GNUNET_FS_create_search_context (struct
GNUNET_GE_Context *ectx,
+ struct
GNUNET_GC_Configuration *cfg,
struct GNUNET_Mutex *lock);
-void FS_SEARCH_destroyContext (struct FS_SEARCH_CONTEXT *ctx);
+void GNUNET_FS_destroy_search_context (struct GNUNET_FS_SearchContext *ctx);
-struct FS_SEARCH_HANDLE;
+struct GNUNET_FS_SearchHandle;
/**
* Search for blocks matching the given key and type.
@@ -66,7 +66,7 @@
* @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,
+struct GNUNET_FS_SearchHandle *GNUNET_FS_start_search (struct
GNUNET_FS_SearchContext *ctx,
const GNUNET_PeerIdentity * target,
unsigned int type,
unsigned int keyCount,
@@ -74,64 +74,64 @@
unsigned int anonymityLevel,
unsigned int prio,
GNUNET_CronTime timeout,
- Datum_Iterator callback,
+ GNUNET_DatastoreValueIterator
callback,
void *closure);
/**
* Stop searching.
*/
-void FS_stop_search (struct FS_SEARCH_CONTEXT *ctx,
- struct FS_SEARCH_HANDLE *handle);
+void GNUNET_FS_stop_search (struct GNUNET_FS_SearchContext *ctx,
+ struct GNUNET_FS_SearchHandle *handle);
/**
* What is the current average priority of entries
* in the routing table like? Returns -1 on error.
*/
-int FS_getAveragePriority (struct GNUNET_ClientServerConnection *sock);
+int GNUNET_FS_get_current_average_priority (struct
GNUNET_ClientServerConnection *sock);
/**
* Insert a block. Note that while the API is VERY similar to
- * FS_index in terms of signature, the block for FS_index must be in
- * plaintext, whereas the block passed to FS_insert must be encrypted!
+ * GNUNET_FS_index in terms of signature, the block for GNUNET_FS_index must
be in
+ * plaintext, whereas the block passed to GNUNET_FS_insert must be encrypted!
*
* @param block the block (properly encoded and all)
* @return GNUNET_OK on success, GNUNET_SYSERR on error
* @see ecrs_core.h::fileBlockEncode
*/
-int FS_insert (struct GNUNET_ClientServerConnection *sock,
- const Datastore_Value * block);
+int GNUNET_FS_insert (struct GNUNET_ClientServerConnection *sock,
+ const GNUNET_DatastoreValue * block);
/**
* Initialize to index a file. Tries to do the symlinking.
*/
-int FS_initIndex (struct GNUNET_ClientServerConnection *sock,
+int GNUNET_FS_prepare_to_inde (struct GNUNET_ClientServerConnection *sock,
const GNUNET_HashCode * fileHc, const char *fn);
/**
* Index a block. Note that while the API is VERY similar to
- * FS_insert in terms of signature, the block for FS_index must be in
- * plaintext, whereas the block passed to FS_insert must be encrypted!
+ * GNUNET_FS_insert in terms of signature, the block for GNUNET_FS_index must
be in
+ * plaintext, whereas the block passed to GNUNET_FS_insert must be encrypted!
*
* @param fileHc the GNUNET_hash of the entire file
* @param block the data from the file (in plaintext)
* @param offset the offset of the block into the file
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int FS_index (struct GNUNET_ClientServerConnection *sock,
+int GNUNET_FS_index (struct GNUNET_ClientServerConnection *sock,
const GNUNET_HashCode * fileHc,
- const Datastore_Value * block, unsigned long long offset);
+ const GNUNET_DatastoreValue * block, unsigned long long offset);
/**
* Delete a block. The arguments are the same as the ones for
- * FS_insert.
+ * GNUNET_FS_insert.
*
* @param block the block (properly encoded and all)
* @return number of items deleted on success,
* GNUNET_SYSERR on error
*/
-int FS_delete (struct GNUNET_ClientServerConnection *sock,
- const Datastore_Value * block);
+int GNUNET_FS_delete (struct GNUNET_ClientServerConnection *sock,
+ const GNUNET_DatastoreValue * block);
/**
* Unindex a file.
@@ -139,7 +139,7 @@
* @param hc the GNUNET_hash of the entire file
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int FS_unindex (struct GNUNET_ClientServerConnection *sock,
+int GNUNET_FS_unindex (struct GNUNET_ClientServerConnection *sock,
unsigned int blocksize, const GNUNET_HashCode * hc);
/**
@@ -148,7 +148,7 @@
* @param hc the GNUNET_hash of the entire file
* @return GNUNET_YES if so, GNUNET_NO if not, GNUNET_SYSERR on error
*/
-int FS_testIndexed (struct GNUNET_ClientServerConnection *sock,
+int GNUNET_FS_test_indexed (struct GNUNET_ClientServerConnection *sock,
const GNUNET_HashCode * hc);
#if 0 /* keep Emacsens' auto-indent happy */
Modified: GNUnet/src/include/gnunet_fsui_lib.h
===================================================================
--- GNUnet/src/include/gnunet_fsui_lib.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_fsui_lib.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -25,23 +25,23 @@
* @see include/gnunet_ecrs_lib.h
*
* Writing a UI for GNUnet is now easier then ever before. Basically,
- * the UI first calls FSUI_start, passing a callback that the UI uses
+ * the UI first calls GNUNET_FSUI_start, passing a callback that the UI uses
* to process events (like completed downloads, search results, etc.).
* The event processor does not have to be re-entrant, FSUI will only
* call it once at a time (but possibly from different threads, the
* event processor also may have to worry about synchronizing itself
* with the GUI library to display updates).<p>
*
- * After creating a FSUI_Context with FSUI_start the UI can start,
+ * After creating a GNUNET_FSUI_Context with GNUNET_FSUI_start the UI can
start,
* abort and stop uploads, downloads, deletions or searches.
- * The FSUI_Context can be destroyed, when it is created again
+ * The GNUNET_FSUI_Context can be destroyed, when it is created again
* the next time all pending operations are resumed (!).
* Clients can use the various iterator functions to obtain
* information about pending actions.<p>
*
- * Note that there can only be one FSUI_Context for a given
+ * Note that there can only be one GNUNET_FSUI_Context for a given
* client application name if resuming is enabled.
- * Creating an FSUI_Context may _fail_ if any other UI is currently
+ * Creating an GNUNET_FSUI_Context may _fail_ if any other UI is currently
* running (for the same user and application name).<p>
*
* Clients may use SOME functions of GNUnet's ECRS library, in
@@ -50,7 +50,7 @@
* keeps state, performs additional tracking operations and avoids
* blocking the client while operations are pending).<p>
*
- * Closing an FSUI_Context may take a while as the context may need
+ * Closing an GNUNET_FSUI_Context may take a while as the context may need
* to serialize some state and complete operations that may not be
* interrupted (such as communications with gnunetd). Clients
* may want to open a window informing the user about the pending
@@ -64,8 +64,8 @@
* client may call abortXXX" which will result in an "aborted"
* event. In either case, the event itself will NOT result in
* the memory being released by FSUI -- the client must still
- * call "FSUI_stopXXX" explicitly. Clients that call
- * "FSUI_stopXXX" before an aborted, error or completed event
+ * call "GNUNET_FSUI_stopXXX" explicitly. Clients that call
+ * "GNUNET_FSUI_stopXXX" before an aborted, error or completed event
* will be blocked until either of the three events happens.<p>
*
* Using the Event mechanism, clients can associate an arbitrary
@@ -102,13 +102,13 @@
* FSUI hands out references of this type to allow clients to access
* information about active downloads.
*/
-struct FSUI_DownloadList;
+struct GNUNET_FSUI_DownloadList;
-struct FSUI_UploadList;
+struct GNUNET_FSUI_UploadList;
-struct FSUI_SearchList;
+struct GNUNET_FSUI_SearchList;
-struct FSUI_UnindexList;
+struct GNUNET_FSUI_UnindexList;
/**
* @brief types of FSUI events.
@@ -124,40 +124,40 @@
* Searches "complete" if they time out or the maximum
* number of results has been found.
*/
-enum FSUI_EventType
+enum GNUNET_FSUI_EventType
{
- FSUI_search_started,
- FSUI_search_stopped,
- FSUI_search_result,
- FSUI_search_completed,
- FSUI_search_aborted,
- FSUI_search_error,
- FSUI_search_suspended,
- FSUI_search_resumed,
- FSUI_download_started,
- FSUI_download_stopped,
- FSUI_download_progress,
- FSUI_download_completed,
- FSUI_download_aborted,
- FSUI_download_error,
- FSUI_download_suspended,
- FSUI_download_resumed,
- FSUI_upload_started,
- FSUI_upload_stopped,
- FSUI_upload_progress,
- FSUI_upload_completed,
- FSUI_upload_aborted,
- FSUI_upload_error,
- FSUI_upload_suspended,
- FSUI_upload_resumed,
- FSUI_unindex_started,
- FSUI_unindex_stopped,
- FSUI_unindex_progress,
- FSUI_unindex_completed,
- FSUI_unindex_aborted,
- FSUI_unindex_error,
- FSUI_unindex_suspended,
- FSUI_unindex_resumed,
+ GNUNET_FSUI_search_started,
+ GNUNET_FSUI_search_stopped,
+ GNUNET_FSUI_search_result,
+ GNUNET_FSUI_search_completed,
+ GNUNET_FSUI_search_aborted,
+ GNUNET_FSUI_search_error,
+ GNUNET_FSUI_search_suspended,
+ GNUNET_FSUI_search_resumed,
+ GNUNET_FSUI_download_started,
+ GNUNET_FSUI_download_stopped,
+ GNUNET_FSUI_download_progress,
+ GNUNET_FSUI_download_completed,
+ GNUNET_FSUI_download_aborted,
+ GNUNET_FSUI_download_error,
+ GNUNET_FSUI_download_suspended,
+ GNUNET_FSUI_download_resumed,
+ GNUNET_FSUI_upload_started,
+ GNUNET_FSUI_upload_stopped,
+ GNUNET_FSUI_upload_progress,
+ GNUNET_FSUI_upload_completed,
+ GNUNET_FSUI_upload_aborted,
+ GNUNET_FSUI_upload_error,
+ GNUNET_FSUI_upload_suspended,
+ GNUNET_FSUI_upload_resumed,
+ GNUNET_FSUI_unindex_started,
+ GNUNET_FSUI_unindex_stopped,
+ GNUNET_FSUI_unindex_progress,
+ GNUNET_FSUI_unindex_completed,
+ GNUNET_FSUI_unindex_aborted,
+ GNUNET_FSUI_unindex_error,
+ GNUNET_FSUI_unindex_suspended,
+ GNUNET_FSUI_unindex_resumed,
};
@@ -208,16 +208,16 @@
*/
typedef enum
{
- FSUI_PENDING = 0,
- FSUI_ACTIVE = 1,
- FSUI_COMPLETED = 2,
- FSUI_COMPLETED_JOINED = 3,
- FSUI_ABORTED = 4,
- FSUI_ABORTED_JOINED = 5,
- FSUI_ERROR = 6,
- FSUI_ERROR_JOINED = 7,
- FSUI_SUSPENDING = 8,
-} FSUI_State;
+ GNUNET_FSUI_PENDING = 0,
+ GNUNET_FSUI_ACTIVE = 1,
+ GNUNET_FSUI_COMPLETED = 2,
+ GNUNET_FSUI_COMPLETED_JOINED = 3,
+ GNUNET_FSUI_ABORTED = 4,
+ GNUNET_FSUI_ABORTED_JOINED = 5,
+ GNUNET_FSUI_ERROR = 6,
+ GNUNET_FSUI_ERROR_JOINED = 7,
+ GNUNET_FSUI_SUSPENDING = 8,
+} GNUNET_FSUI_State;
/**
* @brief Description of a download. Gives the
@@ -233,7 +233,7 @@
* What file in the download tree are we
* refering to?
*/
- struct FSUI_DownloadList *pos;
+ struct GNUNET_FSUI_DownloadList *pos;
void *cctx;
@@ -241,7 +241,7 @@
* What is our parent download in the download tree?
* NULL if this is the top-level download.
*/
- struct FSUI_DownloadList *ppos;
+ struct GNUNET_FSUI_DownloadList *ppos;
void *pcctx;
@@ -249,7 +249,7 @@
* If this download is associated with a search,
* what is the search?
*/
- struct FSUI_SearchList *spos;
+ struct GNUNET_FSUI_SearchList *spos;
/**
* If this download is associated with a search,
@@ -257,7 +257,7 @@
*/
void *sctx;
-} FSUI_DownloadContext;
+} GNUNET_FSUI_DownloadContext;
typedef struct
{
@@ -266,7 +266,7 @@
* What file in the upload tree are we
* refering to?
*/
- struct FSUI_UploadList *pos;
+ struct GNUNET_FSUI_UploadList *pos;
void *cctx;
@@ -274,54 +274,54 @@
* What is our parent upload in the upload tree?
* NULL if this is the top-level upload.
*/
- struct FSUI_UploadList *ppos;
+ struct GNUNET_FSUI_UploadList *ppos;
void *pcctx;
-} FSUI_UploadContext;
+} GNUNET_FSUI_UploadContext;
typedef struct
{
- struct FSUI_SearchList *pos;
+ struct GNUNET_FSUI_SearchList *pos;
void *cctx;
-} FSUI_SearchContext;
+} GNUNET_FSUI_SearchContext;
typedef struct
{
- struct FSUI_UnindexList *pos;
+ struct GNUNET_FSUI_UnindexList *pos;
void *cctx;
-} FSUI_UnindexContext;
+} GNUNET_FSUI_UnindexContext;
/**
* @brief FSUI Event.
*/
typedef struct
{
- enum FSUI_EventType type;
+ enum GNUNET_FSUI_EventType type;
union
{
struct
{
- FSUI_SearchContext sc;
+ GNUNET_FSUI_SearchContext sc;
/**
* File-Info of the data that was found.
*/
- ECRS_FileInfo fi;
+ GNUNET_ECRS_FileInfo fi;
/**
* The URI of the search for which data was
* found.
*/
- const struct ECRS_URI *searchURI;
+ const struct GNUNET_ECRS_URI *searchURI;
} SearchResult;
@@ -329,21 +329,21 @@
struct
{
- FSUI_SearchContext sc;
+ GNUNET_FSUI_SearchContext sc;
} SearchCompleted;
struct
{
- FSUI_SearchContext sc;
+ GNUNET_FSUI_SearchContext sc;
} SearchAborted;
struct
{
- FSUI_SearchContext sc;
+ GNUNET_FSUI_SearchContext sc;
const char *message;
@@ -352,33 +352,33 @@
struct
{
- FSUI_SearchContext sc;
+ GNUNET_FSUI_SearchContext sc;
} SearchSuspended;
struct
{
- FSUI_SearchContext sc;
+ GNUNET_FSUI_SearchContext sc;
- struct ECRS_URI *searchURI;
+ struct GNUNET_ECRS_URI *searchURI;
- const ECRS_FileInfo *fis;
+ const GNUNET_ECRS_FileInfo *fis;
unsigned int anonymityLevel;
unsigned int fisSize;
- FSUI_State state;
+ GNUNET_FSUI_State state;
} SearchResumed;
struct
{
- FSUI_SearchContext sc;
+ GNUNET_FSUI_SearchContext sc;
- const struct ECRS_URI *searchURI;
+ const struct GNUNET_ECRS_URI *searchURI;
unsigned int anonymityLevel;
@@ -387,7 +387,7 @@
struct
{
- FSUI_SearchContext sc;
+ GNUNET_FSUI_SearchContext sc;
} SearchStopped;
@@ -396,7 +396,7 @@
struct
{
- FSUI_DownloadContext dc;
+ GNUNET_FSUI_DownloadContext dc;
/**
* How far are we?
@@ -427,7 +427,7 @@
/**
* Original URI.
*/
- const struct ECRS_URI *uri;
+ const struct GNUNET_ECRS_URI *uri;
/**
* The last block (in plaintext)
@@ -445,7 +445,7 @@
struct
{
- FSUI_DownloadContext dc;
+ GNUNET_FSUI_DownloadContext dc;
/**
* How large is the total download (as far
@@ -461,7 +461,7 @@
/**
* Original URI.
*/
- const struct ECRS_URI *uri;
+ const struct GNUNET_ECRS_URI *uri;
} DownloadCompleted;
@@ -469,7 +469,7 @@
struct
{
- FSUI_DownloadContext dc;
+ GNUNET_FSUI_DownloadContext dc;
/**
* Error message.
@@ -482,7 +482,7 @@
struct
{
- FSUI_DownloadContext dc;
+ GNUNET_FSUI_DownloadContext dc;
} DownloadAborted;
@@ -490,7 +490,7 @@
struct
{
- FSUI_DownloadContext dc;
+ GNUNET_FSUI_DownloadContext dc;
} DownloadStopped;
@@ -498,7 +498,7 @@
struct
{
- FSUI_DownloadContext dc;
+ GNUNET_FSUI_DownloadContext dc;
} DownloadSuspended;
@@ -506,7 +506,7 @@
struct
{
- FSUI_DownloadContext dc;
+ GNUNET_FSUI_DownloadContext dc;
/**
* How large is the total download (as far
@@ -522,7 +522,7 @@
/**
* Original URI.
*/
- ECRS_FileInfo fi;
+ GNUNET_ECRS_FileInfo fi;
unsigned int anonymityLevel;
@@ -531,7 +531,7 @@
struct
{
- FSUI_DownloadContext dc;
+ GNUNET_FSUI_DownloadContext dc;
/**
* How far are we?
@@ -554,11 +554,11 @@
*/
const char *filename;
- ECRS_FileInfo fi;
+ GNUNET_ECRS_FileInfo fi;
unsigned int anonymityLevel;
- FSUI_State state;
+ GNUNET_FSUI_State state;
} DownloadResumed;
@@ -566,7 +566,7 @@
struct
{
- FSUI_UploadContext uc;
+ GNUNET_FSUI_UploadContext uc;
/**
* How far are we? (for the current file)
@@ -594,7 +594,7 @@
struct
{
- FSUI_UploadContext uc;
+ GNUNET_FSUI_UploadContext uc;
/**
* How large is the total upload.
@@ -609,7 +609,7 @@
/**
* URI of the uploaded file.
*/
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
} UploadCompleted;
@@ -617,7 +617,7 @@
struct
{
- FSUI_UploadContext uc;
+ GNUNET_FSUI_UploadContext uc;
} UploadAborted;
@@ -625,7 +625,7 @@
struct
{
- FSUI_UploadContext uc;
+ GNUNET_FSUI_UploadContext uc;
const char *message;
@@ -634,14 +634,14 @@
struct
{
- FSUI_UploadContext uc;
+ GNUNET_FSUI_UploadContext uc;
} UploadSuspended;
struct
{
- FSUI_UploadContext uc;
+ GNUNET_FSUI_UploadContext uc;
} UploadStopped;
@@ -649,7 +649,7 @@
struct
{
- FSUI_UploadContext uc;
+ GNUNET_FSUI_UploadContext uc;
/**
* How large is the total upload (for the current file)
@@ -668,7 +668,7 @@
struct
{
- FSUI_UploadContext uc;
+ GNUNET_FSUI_UploadContext uc;
/**
* How far are we? (for the current file)
@@ -692,13 +692,13 @@
unsigned int anonymityLevel;
- FSUI_State state;
+ GNUNET_FSUI_State state;
/**
* Set to the URI of the upload if upload is
* complete. Otherwise NULL.
*/
- struct ECRS_URI *uri;
+ struct GNUNET_ECRS_URI *uri;
} UploadResumed;
@@ -706,7 +706,7 @@
struct
{
- FSUI_UnindexContext uc;
+ GNUNET_FSUI_UnindexContext uc;
unsigned long long total;
@@ -722,7 +722,7 @@
struct
{
- FSUI_UnindexContext uc;
+ GNUNET_FSUI_UnindexContext uc;
unsigned long long total;
@@ -734,14 +734,14 @@
struct
{
- FSUI_UnindexContext uc;
+ GNUNET_FSUI_UnindexContext uc;
} UnindexAborted;
struct
{
- FSUI_UnindexContext uc;
+ GNUNET_FSUI_UnindexContext uc;
} UnindexStopped;
@@ -749,7 +749,7 @@
struct
{
- FSUI_UnindexContext uc;
+ GNUNET_FSUI_UnindexContext uc;
} UnindexSuspended;
@@ -757,7 +757,7 @@
struct
{
- FSUI_UnindexContext uc;
+ GNUNET_FSUI_UnindexContext uc;
unsigned long long total;
@@ -767,14 +767,14 @@
const char *filename;
- FSUI_State state;
+ GNUNET_FSUI_State state;
} UnindexResumed;
struct
{
- FSUI_UnindexContext uc;
+ GNUNET_FSUI_UnindexContext uc;
unsigned long long total;
@@ -786,7 +786,7 @@
struct
{
- FSUI_UnindexContext uc;
+ GNUNET_FSUI_UnindexContext uc;
const char *message;
@@ -794,12 +794,12 @@
} data;
-} FSUI_Event;
+} GNUNET_FSUI_Event;
/**
* @brief opaque FSUI context
*/
-struct FSUI_Context;
+struct GNUNET_FSUI_Context;
/**
* Generic callback for all kinds of FSUI progress and error messages.
@@ -812,12 +812,12 @@
*
* @return cctx for resume events, otherwise NULL
*/
-typedef void *(*FSUI_EventCallback) (void *cls, const FSUI_Event * event);
+typedef void *(*GNUNET_FSUI_EventProcessor) (void *cls, const
GNUNET_FSUI_Event * event);
/**
* @brief Start the FSUI manager. Use the given progress callback to
* notify the UI about events. May resume processing pending
- * activities that were running when FSUI_stop was called
+ * activities that were running when GNUNET_FSUI_stop was called
* previously.<p>
*
* The basic idea is that graphical user interfaces use their UI name
@@ -845,7 +845,7 @@
* @param closure extra argument to cb
* @return NULL on error
*/
-struct FSUI_Context *FSUI_start (struct GE_Context *ectx, struct
GC_Configuration *cfg, const char *name, unsigned int threadPoolSize, int
doResume, FSUI_EventCallback cb, void *closure); /* fsui.c */
+struct GNUNET_FSUI_Context *GNUNET_FSUI_start (struct GNUNET_GE_Context *ectx,
struct GNUNET_GC_Configuration *cfg, const char *name, unsigned int
threadPoolSize, int doResume, GNUNET_FSUI_EventProcessor cb, void *closure);
/* fsui.c */
/**
* Stop all processes under FSUI control (may serialize
@@ -853,7 +853,7 @@
* uninterruptable activities complete (you may want to
* signal the user that this may take a while).
*/
-void FSUI_stop (struct FSUI_Context *ctx); /* fsui.c */
+void GNUNET_FSUI_stop (struct GNUNET_FSUI_Context *ctx); /* fsui.c */
/**
@@ -861,28 +861,28 @@
*
* @return NULL on error
*/
-struct FSUI_SearchList *FSUI_startSearch (struct FSUI_Context *ctx, unsigned
int anonymityLevel, unsigned int maxResults, GNUNET_CronTime timeout, const
struct ECRS_URI *uri); /* search.c */
+struct GNUNET_FSUI_SearchList *GNUNET_FSUI_search_start (struct
GNUNET_FSUI_Context *ctx, unsigned int anonymityLevel, unsigned int maxResults,
GNUNET_CronTime timeout, const struct GNUNET_ECRS_URI *uri); /* search.c */
/**
* Abort a search.
*
* @return GNUNET_SYSERR if such a search is not known
*/
-int FSUI_abortSearch (struct FSUI_Context *ctx, struct FSUI_SearchList *sl);
/* search.c */
+int GNUNET_FSUI_search_abort (struct GNUNET_FSUI_Context *ctx, struct
GNUNET_FSUI_SearchList *sl); /* search.c */
/**
* Stop a search.
*
* @return GNUNET_SYSERR if such a search is not known
*/
-int FSUI_stopSearch (struct FSUI_Context *ctx, struct FSUI_SearchList *sl);
/* search.c */
+int GNUNET_FSUI_search_stop (struct GNUNET_FSUI_Context *ctx, struct
GNUNET_FSUI_SearchList *sl); /* search.c */
/**
* Start to download a file or directory.
*
* @return NULL on error
*/
-struct FSUI_DownloadList *FSUI_startDownload (struct FSUI_Context *ctx,
unsigned int anonymityLevel, int doRecursive, const struct ECRS_URI *uri, const
struct ECRS_MetaData *meta, const char *filename, struct FSUI_SearchList
*parentSearch, struct FSUI_DownloadList *parentDownload); /* download.c */
+struct GNUNET_FSUI_DownloadList *GNUNET_FSUI_download_start (struct
GNUNET_FSUI_Context *ctx, unsigned int anonymityLevel, int doRecursive, const
struct GNUNET_ECRS_URI *uri, const struct GNUNET_ECRS_MetaData *meta, const
char *filename, struct GNUNET_FSUI_SearchList *parentSearch, struct
GNUNET_FSUI_DownloadList *parentDownload); /* download.c */
/**
* Abort a download. If the dl is for a recursive
@@ -890,7 +890,7 @@
*
* @return GNUNET_SYSERR on error
*/
-int FSUI_abortDownload (struct FSUI_Context *ctx, struct FSUI_DownloadList
*dl); /* download.c */
+int GNUNET_FSUI_download_abort (struct GNUNET_FSUI_Context *ctx, struct
GNUNET_FSUI_DownloadList *dl); /* download.c */
/**
* Stop a download. If the dl is for a recursive
@@ -898,7 +898,7 @@
*
* @return GNUNET_SYSERR on error
*/
-int FSUI_stopDownload (struct FSUI_Context *ctx, struct FSUI_DownloadList
*dl); /* download.c */
+int GNUNET_FSUI_download_stop (struct GNUNET_FSUI_Context *ctx, struct
GNUNET_FSUI_DownloadList *dl); /* download.c */
/**
* Method that can be used to select files that
@@ -908,7 +908,7 @@
* select all files of the directory for the
* upload.
*/
-typedef int (*DirectoryScanCallback) (void *data,
+typedef int (*GNUNET_FSUI_DirectoryScanCallback) (void *data,
const char *filename,
GNUNET_DirectoryEntryCallback dec,
void *decClosure);
@@ -927,9 +927,9 @@
* @param keyURI keywords for top-level file
* @return NULL on error
*/
-struct FSUI_UploadList *FSUI_startUpload (struct FSUI_Context *ctx,
+struct GNUNET_FSUI_UploadList *GNUNET_FSUI_upload_star (struct
GNUNET_FSUI_Context *ctx,
const char *filename,
- DirectoryScanCallback dsc,
+ GNUNET_FSUI_DirectoryScanCallback
dsc,
void *dscClosure,
unsigned int anonymityLevel,
unsigned int priority,
@@ -937,10 +937,10 @@
int doExtract,
int individualKeywords,
GNUNET_CronTime expiration,
- const struct ECRS_MetaData
+ const struct GNUNET_ECRS_MetaData
*topLevelMetaData,
- const struct ECRS_URI *globalURI,
- const struct ECRS_URI *keyUri);
+ const struct GNUNET_ECRS_URI
*globalURI,
+ const struct GNUNET_ECRS_URI
*keyUri);
/**
@@ -949,7 +949,7 @@
*
* @return GNUNET_SYSERR on error
*/
-int FSUI_abortUpload (struct FSUI_Context *ctx, struct FSUI_UploadList *ul);
+int GNUNET_FSUI_upload_abort (struct GNUNET_FSUI_Context *ctx, struct
GNUNET_FSUI_UploadList *ul);
/**
* Stop an upload. Only to be called for the top-level
@@ -957,7 +957,7 @@
*
* @return GNUNET_SYSERR on error
*/
-int FSUI_stopUpload (struct FSUI_Context *ctx, struct FSUI_UploadList *ul);
+int GNUNET_FSUI_upload_stop (struct GNUNET_FSUI_Context *ctx, struct
GNUNET_FSUI_UploadList *ul);
/**
@@ -966,7 +966,7 @@
*
* @return NULL on error
*/
-struct FSUI_UnindexList *FSUI_startUnindex (struct FSUI_Context *ctx,
+struct GNUNET_FSUI_UnindexList *GNUNET_FSUI_unindex_start (struct
GNUNET_FSUI_Context *ctx,
const char *filename);
@@ -975,7 +975,7 @@
*
* @return GNUNET_SYSERR on error
*/
-int FSUI_abortUnindex (struct FSUI_Context *ctx, struct FSUI_UnindexList *ul);
+int GNUNET_FSUI_unindex_abort (struct GNUNET_FSUI_Context *ctx, struct
GNUNET_FSUI_UnindexList *ul);
/**
@@ -983,7 +983,7 @@
*
* @return GNUNET_SYSERR on error
*/
-int FSUI_stopUnindex (struct FSUI_Context *ctx, struct FSUI_UnindexList *ul);
+int GNUNET_FSUI_unindex_stop (struct GNUNET_FSUI_Context *ctx, struct
GNUNET_FSUI_UnindexList *ul);
#if 0 /* keep Emacsens' auto-indent happy */
Modified: GNUnet/src/include/gnunet_gap_service.h
===================================================================
--- GNUnet/src/include/gnunet_gap_service.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_gap_service.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -46,7 +46,7 @@
* Estimated size of most blocks transported with
* the GAP protocol. 32k DBlocks plus overhead.
*/
-#define GAP_ESTIMATED_DATA_SIZE (33*1024)
+#define GNUNET_GAP_ESTIMATED_DATA_SIZE (33*1024)
/**
* Function that helps the routing code to find out if
@@ -54,7 +54,7 @@
* request.
* @param verify check that content is valid? (GNUNET_YES/GNUNET_NO)
*/
-typedef int (*UniqueReplyIdentifier) (const DataContainer * content,
+typedef int (*GNUNET_UniqueReplyIdentifierCallback) (const
GNUNET_DataContainer * content,
unsigned int query_type,
int verify,
const GNUNET_HashCode * primaryKey);
@@ -64,7 +64,7 @@
* GNUNET_hash of the content that can then be used
* to sort out duplicates.
*/
-typedef int (*ReplyHashFunction) (const DataContainer * data,
+typedef int (*GNUNET_ReplyHashingCallback) (const GNUNET_DataContainer * data,
GNUNET_HashCode * hc);
/**
@@ -79,8 +79,8 @@
* @param datastore the storage callbacks to use for storing data
* @return GNUNET_SYSERR on error, GNUNET_OK on success
*/
- int (*init) (Blockstore * datastore,
- UniqueReplyIdentifier uri, ReplyHashFunction rhf);
+ int (*init) (GNUNET_Blockstore * datastore,
+ GNUNET_UniqueReplyIdentifierCallback uri,
GNUNET_ReplyHashingCallback rhf);
/**
* Perform a GET operation using 'key' as the key. Note that no
@@ -120,7 +120,7 @@
* @return the number of bytes written to
* that buffer (must be a positive number).
*/
- unsigned int (*tryMigrate) (const DataContainer * data,
+ unsigned int (*tryMigrate) (const GNUNET_DataContainer * data,
const GNUNET_HashCode * primaryKey,
char *position, unsigned int padding);
@@ -130,7 +130,7 @@
*/
unsigned int (*getAvgPriority) (void);
-} GAP_ServiceAPI;
+} GNUNET_GAP_ServiceAPI;
#if 0 /* keep Emacsens' auto-indent happy */
Modified: GNUnet/src/include/gnunet_identity_service.h
===================================================================
--- GNUnet/src/include/gnunet_identity_service.h 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/include/gnunet_identity_service.h 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -45,7 +45,7 @@
* change (would break compatibility with peers that have a different
* limit).
*/
-#define MAX_HELLO_EXPIRES (60 * 60 * 24 * 10)
+#define GNUNET_MAX_HELLO_EXPIRES (60 * 60 * 24 * 10)
/**
* Type of an iterator over the hosts. Note that each
@@ -58,7 +58,7 @@
* @param data callback closure
* @return GNUNET_OK to continue iteration
*/
-typedef int (*HostIterator) (const GNUNET_PeerIdentity * identity,
+typedef int (*GNUNET_HostProcessor) (const GNUNET_PeerIdentity * identity,
unsigned short protocol,
int confirmed, void *data);
@@ -131,16 +131,16 @@
* @param data an argument to pass to the method
* @return the number of known hosts matching
*/
- int (*forEachHost) (GNUNET_CronTime now, HostIterator callback, void *data);
+ int (*forEachHost) (GNUNET_CronTime now, GNUNET_HostProcessor callback, void
*data);
/**
* Obtain the public key and address of a known host. If no specific
- * protocol is specified (ANY_PROTOCOL_NUMBER), the hello for the
+ * protocol is specified (GNUNET_TRANSPORT_PROTOCOL_NUMBER_ANY), the hello
for the
* cheapest confirmed protocol is returned.
*
* @param hostId the host id
* @param protocol the protocol that we need,
- * ANY_PROTOCOL_NUMBER if we do not care which protocol
+ * GNUNET_TRANSPORT_PROTOCOL_NUMBER_ANY if we do not care which
protocol
* @return NULL on failure, the hello on success
*/
GNUNET_MessageHello *(*identity2Hello) (const GNUNET_PeerIdentity * hostId,
@@ -213,7 +213,7 @@
*/
unsigned int (*getHostTrust) (const GNUNET_PeerIdentity * hostId);
-} Identity_ServiceAPI;
+} GNUNET_Identity_ServiceAPI;
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_kvstore_service.h
===================================================================
--- GNUnet/src/include/gnunet_kvstore_service.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_kvstore_service.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -45,7 +45,7 @@
{
char *table;
char *db;
-} KVHandle;
+} GNUNET_KeyValueRecord;
/**
* @brief Callback for multiple results from Key/Value-Tables
@@ -54,7 +54,7 @@
* @param vallen the length von val
* @return GNUNET_OK on success
*/
-typedef int (*KVCallback) (void *closure, void *val, int vallen);
+typedef int (*GNUNET_KeyValueProcessor) (void *closure, void *val, int vallen);
/**
@@ -67,7 +67,7 @@
* @param table the name of the Key/Value-Table
* @return a handle
*/
- KVHandle *(*getTable) (const char *database, const char *table);
+ GNUNET_KeyValueRecord *(*getTable) (const char *database, const char *table);
/**
* @brief Get data from a Key/Value-Table
@@ -79,11 +79,11 @@
* @param handler callback function to be called for every result (may be
NULL)
* @param closure optional parameter for handler
*/
- void *(*get) (KVHandle * kv,
+ void *(*get) (GNUNET_KeyValueRecord * kv,
void *key,
int keylen,
unsigned int sort,
- unsigned int limit, KVCallback handler, void *closure);
+ unsigned int limit, GNUNET_KeyValueProcessor handler, void
*closure);
/**
* @brief Store Key/Value-Pair in a table
@@ -95,7 +95,7 @@
* @param optional creation time
* @return GNUNET_OK on success, GNUNET_SYSERR otherwise
*/
- int (*put) (KVHandle * kv,
+ int (*put) (GNUNET_KeyValueRecord * kv,
void *key,
int keylen, void *val, int vallen, unsigned long long age);
@@ -106,27 +106,27 @@
* @param age age of the items to delete (may be 0)
* @return GNUNET_OK on success, GNUNET_SYSERR otherwise
*/
- int (*del) (KVHandle * kv, void *key, int keylen, unsigned long long age);
+ int (*del) (GNUNET_KeyValueRecord * kv, void *key, int keylen, unsigned long
long age);
/**
* @brief Close a handle to a Key/Value-Table
* @param kv the handle to close
*/
- void (*closeTable) (KVHandle * kv);
+ void (*closeTable) (GNUNET_KeyValueRecord * kv);
/**
* @brief Drop a Key/Value-Table
* @param the handle to the table
* @return GNUNET_OK on success, GNUNET_SYSERR otherwise
*/
- int (*dropTable) (KVHandle * kv);
+ int (*dropTable) (GNUNET_KeyValueRecord * kv);
/**
* @brief Delete the database.
*/
void (*dropDatabase) (const char *name);
-} KVstore_ServiceAPI;
+} GNUNET_KVstore_ServiceAPI;
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_namespace_lib.h
===================================================================
--- GNUnet/src/include/gnunet_namespace_lib.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_namespace_lib.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -43,10 +43,10 @@
* @param rating the local rating of the namespace
* @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort
*/
-typedef int (*NS_NamespaceIterator) (void *cls,
+typedef int (*GNUNET_NS_NamespaceIterator) (void *cls,
const char *namespaceName,
const GNUNET_HashCode * namespaceId,
- const struct ECRS_MetaData * md,
+ const struct GNUNET_ECRS_MetaData * md,
int rating);
/**
@@ -60,8 +60,8 @@
* next update (0 for sporadic updates)
* @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort
*/
-typedef int (*NS_UpdateIterator) (void *cls,
- const ECRS_FileInfo * uri,
+typedef int (*GNUNET_NS_UpdateIterator) (void *cls,
+ const GNUNET_ECRS_FileInfo * uri,
const GNUNET_HashCode * lastId,
const GNUNET_HashCode * nextId,
GNUNET_Int32Time publicationFrequency,
@@ -75,7 +75,7 @@
* @param meta meta-data about the namespace (maybe NULL)
* @return URI on success, NULL on error (namespace already exists)
*/
-struct ECRS_URI *NS_createNamespace (struct GE_Context *ectx, struct
GC_Configuration *cfg, unsigned int anonymityLevel, unsigned int
insertPriority, GNUNET_CronTime insertExpiration, const char *namespaceName,
const struct ECRS_MetaData *meta, const struct ECRS_URI *advertisementURI,
const GNUNET_HashCode * rootEntry); /* namespace_info.c */
+struct GNUNET_ECRS_URI *GNUNET_NS_namespace_create (struct GNUNET_GE_Context
*ectx, struct GNUNET_GC_Configuration *cfg, unsigned int anonymityLevel,
unsigned int insertPriority, GNUNET_CronTime insertExpiration, const char
*namespaceName, const struct GNUNET_ECRS_MetaData *meta, const struct
GNUNET_ECRS_URI *advertisementURI, const GNUNET_HashCode * rootEntry); /*
namespace_info.c */
/**
* Delete a local namespace. Only prevents future insertions into the
@@ -83,18 +83,18 @@
*
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int NS_deleteNamespace (struct GE_Context *ectx, struct GC_Configuration *cfg,
const char *namespaceName); /* namespace.c */
+int GNUNET_NS_namespace_delete (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const char *namespaceName); /* namespace.c */
/**
* Change the ranking of a (non-local) namespace.
*
* @param ns the name of the namespace, as obtained
- * from ECRS_getNamespaceName
+ * from GNUNET_ECRS_get_namespace_name
* @param delta by how much should the rating be
* changed?
* @return new rating of the namespace
*/
-int NS_rankNamespace (struct GE_Context *ectx, struct GC_Configuration *cfg,
const char *ns, int delta); /* namespace_info.c */
+int GNUNET_NS_namespace_rank (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const char *ns, int delta); /*
namespace_info.c */
/**
* Add a namespace to the set of known namespaces. For all namespace
@@ -103,41 +103,42 @@
*
* @param ns the namespace identifier
*/
-void NS_addNamespaceInfo (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- const struct ECRS_URI *uri,
- const struct ECRS_MetaData *meta);
+void GNUNET_NS_namespace_add_information (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const struct GNUNET_ECRS_URI *uri,
+ const struct GNUNET_ECRS_MetaData *meta);
/**
* Get the root of the namespace (if we have one).
* @return GNUNET_SYSERR on error, GNUNET_OK on success
*/
-int NS_getNamespaceRoot (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+int GNUNET_NS_namespace_get_root (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *ns, GNUNET_HashCode * root);
-void NS_setNamespaceRoot (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- const struct ECRS_URI *uri);
+void GNUNET_NS_namespace_set_root (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const struct GNUNET_ECRS_URI *uri);
/**
* List all available (local or non-local) namespaces.
*/
-int NS_listNamespaces (struct GE_Context *ectx, struct GC_Configuration *cfg,
NS_NamespaceIterator iterator, void *closure); /* namespace_info.c */
+int GNUNET_NS_namespace_list_all (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, GNUNET_NS_NamespaceIterator iterator, void
*closure); /* namespace_info.c */
+
/**
* Register callback to be invoked whenever we discover
* a new namespace.
*/
-int NS_registerDiscoveryCallback (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- NS_NamespaceIterator iterator,
+int GNUNET_NS_register_discovery_callback (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ GNUNET_NS_NamespaceIterator iterator,
void *closure);
/**
* Unregister namespace discovery callback.
*/
-int NS_unregisterDiscoveryCallback (NS_NamespaceIterator iterator,
+int GNUNET_NS_unregister_discovery_callback (GNUNET_NS_NamespaceIterator
iterator,
void *closure);
@@ -181,7 +182,7 @@
* entry?
* @return the resulting URI, NULL on error
*/
-struct ECRS_URI *NS_addToNamespace (struct GE_Context *ectx, struct
GC_Configuration *cfg, unsigned int anonymityLevel, unsigned int
insertPriority, GNUNET_CronTime insertExpiration, const char *name,
GNUNET_Int32Time updateInterval, const GNUNET_HashCode * lastId, const
GNUNET_HashCode * thisId, const GNUNET_HashCode * nextId, const struct ECRS_URI
*dst, const struct ECRS_MetaData *md); /* namespace_info.c */
+struct GNUNET_ECRS_URI *GNUNET_NS_add_to_namespace (struct GNUNET_GE_Context
*ectx, struct GNUNET_GC_Configuration *cfg, unsigned int anonymityLevel,
unsigned int insertPriority, GNUNET_CronTime insertExpiration, const char
*name, GNUNET_Int32Time updateInterval, const GNUNET_HashCode * lastId, const
GNUNET_HashCode * thisId, const GNUNET_HashCode * nextId, const struct
GNUNET_ECRS_URI *dst, const struct GNUNET_ECRS_MetaData *md); /*
namespace_info.c */
/**
* Compute the next ID for peridodically updated content.
@@ -189,8 +190,8 @@
* @param thisId MUST be known to NS
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int NS_computeNextId (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+int GNUNET_NS_compute_next_identifier (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *name,
const GNUNET_HashCode * lastId,
const GNUNET_HashCode * thisId,
@@ -200,7 +201,7 @@
/**
* List all updateable content in a given namespace.
*/
-int NS_listNamespaceContent (struct GE_Context *ectx, struct GC_Configuration
*cfg, const char *name, NS_UpdateIterator iterator, void *closure); /*
namespace_info.c */
+int GNUNET_NS_namespace_list_contents (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const char *name, GNUNET_NS_UpdateIterator
iterator, void *closure); /* namespace_info.c */
Modified: GNUnet/src/include/gnunet_peerinfo_lib.h
===================================================================
--- GNUnet/src/include/gnunet_peerinfo_lib.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_peerinfo_lib.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -38,7 +38,7 @@
#endif
#endif
-#define PEERINFO_VERSION "0.0.0"
+#define GNUNET_PEERINFO_VERSION "0.0.0"
/**
* @param name the name of the peer
@@ -47,7 +47,7 @@
*
* @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
*/
-typedef int (*PEERINFO_PeerProcessor) (const char *name,
+typedef int (*GNUNET_PEERINFO_PeerProcessor) (const char *name,
const GNUNET_PeerIdentity * id,
unsigned int trust, void *cls);
@@ -59,10 +59,10 @@
* @param connected_only only list currently connected peers
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int PEERINFO_getInfo (struct GE_Context *ectx,
+int GNUNET_PEERINFO_get_information (struct GNUNET_GE_Context *ectx,
struct GNUNET_ClientServerConnection *sock,
int connected_only,
- PEERINFO_PeerProcessor processor, void *cls);
+ GNUNET_PEERINFO_PeerProcessor processor, void *cls);
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_pingpong_service.h
===================================================================
--- GNUnet/src/include/gnunet_pingpong_service.h 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/include/gnunet_pingpong_service.h 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -77,7 +77,7 @@
unsigned int ping_size;
-} Pingpong_ServiceAPI;
+} GNUNET_Pingpong_ServiceAPI;
#if 0 /* keep Emacsens' auto-indent happy */
Modified: GNUnet/src/include/gnunet_protocols.h
===================================================================
--- GNUnet/src/include/gnunet_protocols.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_protocols.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -55,58 +55,48 @@
/**
* protocol number for "unspecified"
*/
-#define ANY_PROTOCOL_NUMBER 0
+#define GNUNET_TRANSPORT_PROTOCOL_NUMBER_ANY 0
/**
* protocol number for 'NAT'. Used as the advertisements for peers behind
* a NAT box.
*/
-#define NAT_PROTOCOL_NUMBER 1
+#define GNUNET_TRANSPORT_PROTOCOL_NUMBER_NAT 1
/**
* protocol number of TCP.
*/
-#define TCP_PROTOCOL_NUMBER 2
+#define GNUNET_TRANSPORT_PROTOCOL_NUMBER_TCP 2
/**
* protocol number of UDP.
*/
-#define UDP_PROTOCOL_NUMBER 3
+#define GNUNET_TRANSPORT_PROTOCOL_NUMBER_UDP 3
/**
* Protocol number for TCP on IPv6 (TCP+6)
*/
-#define TCP6_PROTOCOL_NUMBER 4
+#define GNUNET_TRANSPORT_PROTOCOL_NUMBER_TCP6 4
/**
* Protocol number for UDP on IPv6 (UDP+6)
*/
-#define UDP6_PROTOCOL_NUMBER 5
+#define GNUNET_TRANSPORT_PROTOCOL_NUMBER_UDP6 5
/**
- * protocol number of TCP.
- */
-#define TCP_OLD_PROTOCOL_NUMBER 6
-
-/**
* protocol number for HTTP (80 is too big, so 8 will have to do)
*/
-#define HTTP_PROTOCOL_NUMBER 8
+#define GNUNET_TRANSPORT_PROTOCOL_NUMBER_HTTP 8
/**
- * protocol number of UDP. Do NEVER change, also used in other context!
- */
-#define UDP_OLD_PROTOCOL_NUMBER 17
-
-/**
* protocol number for SMTP
*/
-#define SMTP_PROTOCOL_NUMBER 25
+#define GNUNET_TRANSPORT_PROTOCOL_NUMBER_SMTP 25
/**
* Largest protocol number.
*/
-#define MAX_PROTOCOL_NUMBER 26
+#define GNUNET_TRANSPORT_PROTOCOL_NUMBER_MAX 26
/* ********* client-server protocol (over TCP) ********** */
/* ********* CS CORE messages ********** */
@@ -114,27 +104,27 @@
/**
* return value for remote calls (generic message)
*/
-#define CS_PROTO_RETURN_VALUE 0
+#define GNUNET_CS_PROTO_RETURN_VALUE 0
/**
* client to gnunetd: shutdown
*/
-#define CS_PROTO_SHUTDOWN_REQUEST 1
+#define GNUNET_CS_PROTO_SHUTDOWN_REQUEST 1
/**
* client to gnunetd: get configuration option
*/
-#define CS_PROTO_GET_OPTION_REQUEST 2
+#define GNUNET_CS_PROTO_GET_OPTION_REQUEST 2
/**
* gnunetd to client: option value
*/
-#define CS_PROTO_GET_OPTION_REPLY 3
+#define GNUNET_CS_PROTO_GET_OPTION_REPLY 3
/**
* gnunetd to client: error message
*/
-#define CS_PROTO_RETURN_ERROR 4
+#define GNUNET_CS_PROTO_RETURN_ERROR 4
/* ********** CS FS application messages ********** */
@@ -142,53 +132,53 @@
/**
* client to gnunetd: send queries
*/
-#define CS_PROTO_gap_QUERY_START 8
+#define GNUNET_CS_PROTO_GAP_QUERY_START 8
/**
* client to gnunetd: stop query
*/
-#define CS_PROTO_gap_QUERY_STOP 9
+#define GNUNET_CS_PROTO_GAP_QUERY_STOP 9
/**
* gnunetd to client: here is your answer
*/
-#define CS_PROTO_gap_RESULT 9
+#define GNUNET_CS_PROTO_GAP_RESULT 9
/**
* client to gnunetd: insert CHK content (no index)
*/
-#define CS_PROTO_gap_INSERT 10
+#define GNUNET_CS_PROTO_GAP_INSERT 10
/**
* client to gnunetd: index content
*/
-#define CS_PROTO_gap_INDEX 11
+#define GNUNET_CS_PROTO_GAP_INDEX 11
/**
* client to gnunetd: delete content
*/
-#define CS_PROTO_gap_DELETE 12
+#define GNUNET_CS_PROTO_GAP_DELETE 12
/**
* client to gnunetd: unindex content
*/
-#define CS_PROTO_gap_UNINDEX 13
+#define GNUNET_CS_PROTO_GAP_UNINDEX 13
/**
* client to gnunetd: test if content is indexed
*/
-#define CS_PROTO_gap_TESTINDEX 14
+#define GNUNET_CS_PROTO_GAP_TESTINDEX 14
/**
* Client to gnunetd: what is the average priority of entries in the
* routing table?
*/
-#define CS_PROTO_gap_GET_AVG_PRIORITY 15
+#define GNUNET_CS_PROTO_GAP_GET_AVG_PRIORITY 15
/**
* client to gnunetd: initialize to index file
*/
-#define CS_PROTO_gap_INIT_INDEX 16
+#define GNUNET_CS_PROTO_GAP_INIT_INDEX 16
/* *********** messages for identity module ************* */
@@ -197,41 +187,41 @@
* Client asks daemon for information about
* all known peers
*/
-#define CS_PROTO_identity_request_INFO 25
+#define GNUNET_CS_PROTO_IDENTITY_REQUEST_INFO 25
/**
* Deamon responds with information about a peer.
*/
-#define CS_PROTO_identity_INFO 26
+#define GNUNET_CS_PROTO_IDENTITY_INFO 26
/**
* Client asks the Daemon about how to contact
* it.
*/
-#define CS_PROTO_identity_request_HELLO 27
+#define GNUNET_CS_PROTO_IDENTITY_REQUEST_HELLO 27
/**
* Client informs the Daemon about how to contact
* a particular peer -- or daemon informs client
* about how other peers should contact it.
*/
-#define CS_PROTO_identity_HELLO 28
+#define GNUNET_CS_PROTO_IDENTITY_HELLO 28
/**
* Client asks the Daemon to GNUNET_RSA_sign a message.
*/
-#define CS_PROTO_identity_request_SIGN 29
+#define GNUNET_CS_PROTO_IDENTITY_REQUEST_SIGNATURE 29
/**
* Daemon sends client a signature
*/
-#define CS_PROTO_identity_SIGNATURE 30
+#define GNUNET_CS_PROTO_IDENTITY_SIGNATURE 30
/**
* Client asks the daemon to try to connect to
* a particular peer.
*/
-#define CS_PROTO_identity_CONNECT 31
+#define GNUNET_CS_PROTO_IDENTITY_CONNECT 31
/* *********** messages for traffic module ************* */
@@ -240,17 +230,17 @@
* client to traffic module: to how many nodes are we connected?
* reply is a CS_returnvalue_MESSAGE message.
*/
-#define CS_PROTO_traffic_COUNT 32
+#define GNUNET_CS_PROTO_TRAFFIC_COUNT 32
/**
* Client to traffic module: how much traffic do we have at the moment?
*/
-#define CS_PROTO_traffic_QUERY 33
+#define GNUNET_CS_PROTO_TRAFFIC_QUERY 33
/**
* traffic module to client: traffic statistics
*/
-#define CS_PROTO_traffic_INFO 34
+#define GNUNET_CS_PROTO_TRAFFIC_INFO 34
/* *********** messages for stats module ************* */
@@ -258,39 +248,39 @@
/**
* client to stats module: request statistics
*/
-#define CS_PROTO_stats_GET_STATISTICS 36
+#define GNUNET_CS_PROTO_STATS_GET_STATISTICS 36
/**
* stats module to client: statistics
*/
-#define CS_PROTO_stats_STATISTICS 37
+#define GNUNET_CS_PROTO_STATS_STATISTICS 37
/**
* client to stats module: is client server message supported
*/
-#define CS_PROTO_stats_GET_CS_MESSAGE_SUPPORTED 38
+#define GNUNET_CS_PROTO_STATS_GET_CS_MESSAGNUNET_GE_SUPPORTED 38
/**
* client to stats module: is p2p message supported
*/
-#define CS_PROTO_stats_GET_P2P_MESSAGE_SUPPORTED 39
+#define GNUNET_CS_PROTO_STATS_GET_P2P_MESSAGNUNET_GE_SUPPORTED 39
/* ********** CS TBENCH application messages ********** */
-#define CS_PROTO_tbench_REQUEST 40
-#define CS_PROTO_tbench_REPLY 41
+#define GNUNET_CS_PROTO_TBENCH_REQUEST 40
+#define GNUNET_CS_PROTO_TBENCH_REPLY 41
/* ********** CS TRACEKIT application messages ********* */
-#define CS_PROTO_tracekit_PROBE 42
-#define CS_PROTO_tracekit_REPLY 43
+#define GNUNET_CS_PROTO_TRACEKIT_PROBE 42
+#define GNUNET_CS_PROTO_TRACEKIT_REPLY 43
/* ********** CS CHAT application messages ********** */
-#define CS_PROTO_chat_MSG 44
+#define GNUNET_CS_PROTO_CHAT_MSG 44
/* ********** CS DHT application messages ********** */
@@ -298,19 +288,19 @@
/**
* Client to CS or CS to client: get from table
*/
-#define CS_PROTO_dht_REQUEST_GET 48
+#define GNUNET_CS_PROTO_DHT_REQUEST_GET 48
/**
* Client to CS or CS to client: put into table
*/
-#define CS_PROTO_dht_REQUEST_PUT 49
+#define GNUNET_CS_PROTO_DHT_REQUEST_PUT 49
/* ********** CS TESTBED application messages ********** */
-#define CS_PROTO_testbed_REQUEST 50
+#define GNUNET_CS_PROTO_TESTBED_REQUEST 50
-#define CS_PROTO_testbed_REPLY 51
+#define GNUNET_CS_PROTO_TESTBED_REPLY 51
@@ -324,20 +314,20 @@
* instead of the VPN_REPLY so the UI knows it has
* seen all the output.
*/
-#define CS_PROTO_VPN_MSG 92
-#define CS_PROTO_VPN_REPLY 93
-#define CS_PROTO_VPN_DEBUGOFF 94
-#define CS_PROTO_VPN_DEBUGON 95
-#define CS_PROTO_VPN_TUNNELS 96
-#define CS_PROTO_VPN_ROUTES 97
-#define CS_PROTO_VPN_REALISED 98
-#define CS_PROTO_VPN_RESET 99
-#define CS_PROTO_VPN_REALISE 100
-#define CS_PROTO_VPN_ADD 101
-#define CS_PROTO_VPN_TRUST 102
+#define GNUNET_CS_PROTO_VPN_MSG 92
+#define GNUNET_CS_PROTO_VPN_REPLY 93
+#define GNUNET_CS_PROTO_VPN_DEBUGOFF 94
+#define GNUNET_CS_PROTO_VPN_DEBUGON 95
+#define GNUNET_CS_PROTO_VPN_TUNNELS 96
+#define GNUNET_CS_PROTO_VPN_ROUTES 97
+#define GNUNET_CS_PROTO_VPN_REALISED 98
+#define GNUNET_CS_PROTO_VPN_RESET 99
+#define GNUNET_CS_PROTO_VPN_REALISE 100
+#define GNUNET_CS_PROTO_VPN_ADD 101
+#define GNUNET_CS_PROTO_VPN_TRUST 102
-#define CS_PROTO_MAX_USED 80
+#define GNUNET_CS_PROTO_MAX_USED 80
/* ******** node-to-node (p2p) messages (over anything) ********* */
@@ -346,38 +336,38 @@
/**
* announcement of public key
*/
-#define p2p_PROTO_hello 0
+#define GNUNET_P2P_PROTO_HELLO 0
/**
* session key exchange, session key is encrypted with hostkey
*/
-#define P2P_PROTO_setkey 1
+#define GNUNET_P2P_PROTO_SET_KEY 1
/**
* PING
*/
-#define p2p_PROTO_PING 2
+#define GNUNET_P2P_PROTO_PING 2
/**
* PONG (response to PING)
*/
-#define p2p_PROTO_PONG 3
+#define GNUNET_P2P_PROTO_PONG 3
/**
* termination of connection (other host is nice
* and tells us, there is GNUNET_NO requirement to do so!)
*/
-#define P2P_PROTO_hangup 4
+#define GNUNET_P2P_PROTO_HANG_UP 4
/**
* Fragmented message.
*/
-#define P2P_PROTO_fragment 5
+#define GNUNET_P2P_PROTO_MESSAGNUNET_GE_FRAGMENT 5
/**
* noise, used to fill packets to sizes >1k.
*/
-#define P2P_PROTO_noise 6
+#define GNUNET_P2P_PROTO_NOISE 6
/* ************* p2p GAP application messages *********** */
@@ -385,61 +375,61 @@
/**
* Query for content.
*/
-#define P2P_PROTO_gap_QUERY 16
+#define GNUNET_P2P_PROTO_GAP_QUERY 16
/**
* receive content
*/
-#define P2P_PROTO_gap_RESULT 17
+#define GNUNET_P2P_PROTO_GAP_RESULT 17
/* ************** p2p CHAT application messages *********** */
/**
* chat message
*/
-#define P2P_PROTO_chat_MSG 32
+#define GNUNET_P2P_PROTO_CHAT_MSG 32
/* *************** p2p TRACEKIT application messages ******** */
-#define P2P_PROTO_tracekit_PROBE 36
+#define GNUNET_P2P_PROTO_TRACEKIT_PROBE 36
-#define P2P_PROTO_tracekit_REPLY 37
+#define GNUNET_P2P_PROTO_TRACEKIT_REPLY 37
/* ********** p2p TBENCH application messages ********** */
/**
* benchmark message: send back reply asap
*/
-#define P2P_PROTO_tbench_REQUEST 40
-#define P2P_PROTO_tbench_REPLY 41
+#define GNUNET_P2P_PROTO_TBENCH_REQUEST 40
+#define GNUNET_P2P_PROTO_TBENCH_REPLY 41
/************** p2p RPC application messages ************/
-#define P2P_PROTO_rpc_REQ 42
-#define P2P_PROTO_rpc_RES 43
-#define P2P_PROTO_rpc_ACK 44
+#define GNUNET_P2P_PROTO_RPC_REQ 42
+#define GNUNET_P2P_PROTO_RPC_RES 43
+#define GNUNET_P2P_PROTO_RPC_ACK 44
/************** p2p DHT application messages ************/
-#define P2P_PROTO_DHT_DISCOVERY 45
-#define P2P_PROTO_DHT_ASK_HELLO 46
-#define P2P_PROTO_DHT_GET 47
-#define P2P_PROTO_DHT_PUT 48
-#define P2P_PROTO_DHT_RESULT 49
+#define GNUNET_P2P_PROTO_DHT_DISCOVERY 45
+#define GNUNET_P2P_PROTO_DHT_ASK_HELLO 46
+#define GNUNET_P2P_PROTO_DHT_GET 47
+#define GNUNET_P2P_PROTO_DHT_PUT 48
+#define GNUNET_P2P_PROTO_DHT_RESULT 49
/* ************* p2p VPN messages ************* */
-#define P2P_PROTO_aip_IP 64 /* contains IPv6 frame */
+#define GNUNET_P2P_PROTO_AIP_IP 64 /* contains IPv6 frame */
-#define P2P_PROTO_aip_ROUTE 65 /* a route to a node */
+#define GNUNET_P2P_PROTO_AIP_ROUTE 65 /* a route to a node */
-#define P2P_PROTO_aip_ROUTES 66 /* no more routes in my table */
+#define GNUNET_P2P_PROTO_AIP_ROUTES 66 /* no more routes in my table */
-#define P2P_PROTO_aip_GETROUTE 67 /* request for a table entry from a
peer */
+#define GNUNET_P2P_PROTO_AIP_GETROUTE 67 /* request for a table entry
from a peer */
-#define P2P_PROTO_MAX_USED 68
+#define GNUNET_P2P_PROTO_MAX_USED 68
@@ -448,47 +438,47 @@
/**
* Reserved number for "any type".
*/
-#define ANY_BLOCK 0
+#define GNUNET_GNUNET_ECRS_BLOCKTYPE_ANY 0
/**
* Data block (leaf or inner block).
*/
-#define D_BLOCK 1
+#define GNUNET_GNUNET_ECRS_BLOCKTYPE_DATA 1
/**
* Namespace binding (subspace entry)
*/
-#define S_BLOCK 2
+#define GNUNET_GNUNET_ECRS_BLOCKTYPE_SIGNED 2
/**
* Keyword binding (entry in keyword space)
*/
-#define K_BLOCK 3
+#define GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD 3
/**
* Namespace advertisement.
*/
-#define N_BLOCK 4
+#define GNUNET_GNUNET_ECRS_BLOCKTYPE_NAMESPACE 4
/**
* Namespace advertisement in keyword space.
*/
-#define KN_BLOCK 5
+#define GNUNET_GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE 5
/**
* DHT String2String (for dht-testing)
*/
-#define DHT_STRING2STRING_BLOCK 7
+#define GNUNET_GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING 7
/**
* Reserved for internal usage
*/
-#define RESERVED_BLOCK 0xFFFFFFFE
+#define GNUNET_GNUNET_ECRS_BLOCKTYPE_RESERVED 0xFFFFFFFE
/**
* Type of OnDemand encoded blocks.
*/
-#define ONDEMAND_BLOCK 0xFFFFFFFF
+#define GNUNET_GNUNET_ECRS_BLOCKTYPE_ONDEMAND 0xFFFFFFFF
Added: GNUnet/src/include/gnunet_rpc_lib.h
===================================================================
--- GNUnet/src/include/gnunet_rpc_lib.h (rev 0)
+++ GNUnet/src/include/gnunet_rpc_lib.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -0,0 +1,125 @@
+/*
+ This file is part of GNUnet
+ (C) 2004, 2005, 2006 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_rpc_lib.h
+ * @brief Definition of the RPC library routines
+ * @author Antti Salonen, Christian Grothoff
+ */
+
+#ifndef GNUNET_RPC_LIB_H
+#define GNUNET_RPC_LIB_H
+
+#include "gnunet_core.h"
+#include "gnunet_util.h"
+#include "gnunet_blockstore.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#if 0 /* keep Emacsens' auto-indent happy */
+}
+#endif
+#endif
+
+/**
+ * Type of RPC arguments.
+ */
+#define GNUNET_RPC_CallParameters struct GNUNET_Vector
+
+/**
+ * RPC argument handling helper functions.
+ */
+GNUNET_RPC_CallParameters *GNUNET_RPC_parameters_create (void);
+
+void GNUNET_RPC_parameters_destroy (GNUNET_RPC_CallParameters * param);
+
+unsigned int GNUNET_RPC_parameters_count (GNUNET_RPC_CallParameters * param);
+
+void GNUNET_RPC_parameters_add (GNUNET_RPC_CallParameters * param,
+ const char *name,
+ unsigned int dataLength, const void *data);
+
+void GNUNET_RPC_parameters_add_data_container (GNUNET_RPC_CallParameters *
param,
+ const char *name, const GNUNET_DataContainer *
data);
+
+const char *GNUNET_RPC_parameters_get_name (GNUNET_RPC_CallParameters * param,
unsigned int i);
+
+unsigned int GNUNET_RPC_get_index_by_name (GNUNET_RPC_CallParameters * param,
const char *name);
+
+/**
+ * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ */
+int GNUNET_RPC_parameters_get_value_by_name (GNUNET_RPC_CallParameters * param,
+ const char *name,
+ unsigned int *dataLength, void **data);
+
+/**
+ * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ */
+int GNUNET_RPC_parameters_get_value_by_index (GNUNET_RPC_CallParameters *
param,
+ unsigned int i,
+ unsigned int *dataLength, void **data);
+
+/**
+ * Return the value of the given parameter in the RPC parameter structure.
+ *
+ * @param param Target RPC parameter structure
+ * @param value set to the value of the parameter
+ */
+GNUNET_DataContainer *GNUNET_RPC_parameters_get_data_container_by_index
(GNUNET_RPC_CallParameters * param,
+ unsigned int i);
+
+/**
+ * Return the value of the named parameter in the RPC parameter
+ * structure.
+ *
+ * @param param Target RPC parameter structure
+ * @param value set to the value of the named parameter
+ * @return GNUNET_SYSERR on error
+ */
+GNUNET_DataContainer *GNUNET_RPC_parameters_get_data_container_by_name
(GNUNET_RPC_CallParameters * param,
+ const char *name);
+
+/**
+ * Serialize the param array. target must point to at least
+ * GNUNET_RPC_parameters_get_serialized_size(param) bytes of memory.
+ */
+void GNUNET_RPC_parameters_serialize (GNUNET_RPC_CallParameters * param, char
*target);
+
+/**
+ * Deserialize parameters from buffer.
+ */
+GNUNET_RPC_CallParameters *GNUNET_RPC_parameters_deserialize (char *buffer,
size_t size);
+
+/**
+ * How many bytes are required to serialize the param array?
+ */
+size_t GNUNET_RPC_parameters_get_serialized_size (GNUNET_RPC_CallParameters *
param);
+
+
+#if 0 /* keep Emacsens' auto-indent happy */
+{
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GNUNET_RPC_SERVICE_H */
Property changes on: GNUnet/src/include/gnunet_rpc_lib.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: GNUnet/src/include/gnunet_rpc_service.h
===================================================================
--- GNUnet/src/include/gnunet_rpc_service.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_rpc_service.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -30,6 +30,7 @@
#include "gnunet_core.h"
#include "gnunet_util_containers.h"
#include "gnunet_blockstore.h"
+#include "gnunet_rpc_lib.h"
#ifdef __cplusplus
extern "C"
@@ -43,74 +44,69 @@
* The function was called successfully and the return values
* are included in the message.
*/
-#define RPC_ERROR_OK 0
+#define GNUNET_RPC_ERROR_OK 0
/**
* The peer does not know anything about the desired RPC function.
*/
-#define RPC_ERROR_UNKNOWN_FUNCTION 1
+#define GNUNET_RPC_ERROR_UNKNOWN_FUNCTION 1
/**
* The return value cannot be put into a single message (but
* otherwise the call was received and processed).
*/
-#define RPC_ERROR_RETURN_VALUE_TOO_LARGE 2
+#define GNUNET_RPC_ERROR_RETURN_VALUE_TOO_LARGE 2
/**
* The RPC call timed out
*/
-#define RPC_ERROR_TIMEOUT 3
+#define GNUNET_RPC_ERROR_TIMEOUT 3
/**
* An unknown error occured during processing of the RPC call.
*/
-#define RPC_ERROR_UNKNOWN 4
+#define GNUNET_RPC_ERROR_UNKNOWN 4
/**
* Invalid reply format.
*/
-#define RPC_ERROR_REPLY_MALFORMED 5
+#define GNUNET_RPC_ERROR_REPLY_MALFORMED 5
/**
- * Type of RPC arguments.
- */
-#define RPC_Param struct GNUNET_Vector
-
-/**
* Prototype for synchronous RPC functions.
*/
-typedef void (*RPC_Function) (const GNUNET_PeerIdentity * caller,
- RPC_Param * arguments, RPC_Param * results);
+typedef void (*GNUNET_RPC_SynchronousFunction) (const GNUNET_PeerIdentity *
caller,
+ GNUNET_RPC_CallParameters * arguments,
GNUNET_RPC_CallParameters * results);
/**
* Opaque RPC internal per-RPC data.
*/
-struct CallInstance;
+struct GNUNET_RPC_CallHandle;
/**
* GNUNET_RSA_Signature of the callback function for the ASYNC_RPC to
* be called upon completion of the ASYNC function.
*/
-typedef void (*Async_RPC_Complete_Callback) (RPC_Param * results,
+typedef void (*GNUNET_RPC_CompleteCallback) (GNUNET_RPC_CallParameters *
results,
int errorCode,
- struct CallInstance * context);
+ struct GNUNET_RPC_CallHandle *
context);
/**
* Prototype for asynchronous RPC functions.
*/
-typedef void (*ASYNC_RPC_Function) (const GNUNET_PeerIdentity * caller,
- RPC_Param * arguments,
- Async_RPC_Complete_Callback callback,
- struct CallInstance * context);
+typedef void (*GNUNET_RPC_AsynchronousFunction) (const GNUNET_PeerIdentity *
caller,
+ GNUNET_RPC_CallParameters * arguments,
+ GNUNET_RPC_CompleteCallback callback,
+ struct GNUNET_RPC_CallHandle * context);
/**
* Function to call once an asynchronous RPC completes.
*/
-typedef void (*RPC_Complete) (const GNUNET_PeerIdentity * responder,
- RPC_Param * results, void *closure);
+typedef void (*GNUNET_RPC_AsynchronousCompletionCallback) (const
GNUNET_PeerIdentity * responder,
+ GNUNET_RPC_CallParameters * results, void
*closure);
-struct RPC_Record;
+struct GNUNET_RPC_RequestHandle;
/**
* The RPC service API.
@@ -123,30 +119,30 @@
*/
int (*RPC_execute) (const GNUNET_PeerIdentity * receiver,
const char *name,
- RPC_Param * request_param,
- RPC_Param * return_param,
+ GNUNET_RPC_CallParameters * request_param,
+ GNUNET_RPC_CallParameters * return_param,
unsigned int importance, GNUNET_CronTime timeout);
/**
* Register a synchronous RPC function.
*/
- int (*RPC_register) (const char *name, RPC_Function func);
+ int (*RPC_register) (const char *name, GNUNET_RPC_SynchronousFunction func);
/**
* Unregister a synchronous RPC function.
*/
- int (*RPC_unregister) (const char *name, RPC_Function func);
+ int (*RPC_unregister) (const char *name, GNUNET_RPC_SynchronousFunction
func);
/**
* Register an asynchronous RPC function.
*/
- int (*RPC_register_async) (const char *name, ASYNC_RPC_Function func);
+ int (*RPC_register_async) (const char *name, GNUNET_RPC_AsynchronousFunction
func);
/**
* Unregister an asynchronous RPC function.
*/
- int (*RPC_unregister_async) (const char *name, ASYNC_RPC_Function func);
+ int (*RPC_unregister_async) (const char *name,
GNUNET_RPC_AsynchronousFunction func);
/**
* Start an asynchronous RPC.
@@ -158,97 +154,24 @@
* @return value required to stop the RPC (and the RPC must
* be explicitly stopped to free resources!)
*/
- struct RPC_Record *(*RPC_start) (const GNUNET_PeerIdentity * receiver,
+ struct GNUNET_RPC_RequestHandle *(*RPC_start) (const GNUNET_PeerIdentity *
receiver,
const char *name,
- RPC_Param * request_param,
+ GNUNET_RPC_CallParameters * request_param,
unsigned int importance,
GNUNET_CronTime timeout,
- RPC_Complete callback, void *closure);
+ GNUNET_RPC_AsynchronousCompletionCallback
callback, void *closure);
/**
* Stop an asynchronous RPC.
*
* @param record the return value from RPC_start
- * @return RPC_ERROR_OK if the RPC was successful
+ * @return GNUNET_RPC_ERROR_OK if the RPC was successful
*/
- int (*RPC_stop) (struct RPC_Record * record);
+ int (*RPC_stop) (struct GNUNET_RPC_RequestHandle * record);
-} RPC_ServiceAPI;
+} GNUNET_RPC_ServiceAPI;
-/* **************** RPC library functions ****************** */
-
-/**
- * RPC argument handling helper functions.
- */
-RPC_Param *RPC_paramNew (void);
-
-void RPC_paramFree (RPC_Param * param);
-
-unsigned int RPC_paramCount (RPC_Param * param);
-
-void RPC_paramAdd (RPC_Param * param,
- const char *name,
- unsigned int dataLength, const void *data);
-
-void RPC_paramAddDataContainer (RPC_Param * param,
- const char *name, const DataContainer * data);
-
-const char *RPC_paramName (RPC_Param * param, unsigned int i);
-
-unsigned int RPC_paramIndex (RPC_Param * param, const char *name);
-
-/**
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
- */
-int RPC_paramValueByName (RPC_Param * param,
- const char *name,
- unsigned int *dataLength, void **data);
-
-/**
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
- */
-int RPC_paramValueByPosition (RPC_Param * param,
- unsigned int i,
- unsigned int *dataLength, void **data);
-
-/**
- * Return the value of the given parameter in the RPC parameter structure.
- *
- * @param param Target RPC parameter structure
- * @param value set to the value of the parameter
- */
-DataContainer *RPC_paramDataContainerByPosition (RPC_Param * param,
- unsigned int i);
-
-/**
- * Return the value of the named parameter in the RPC parameter
- * structure.
- *
- * @param param Target RPC parameter structure
- * @param value set to the value of the named parameter
- * @return GNUNET_SYSERR on error
- */
-DataContainer *RPC_paramDataContainerByName (RPC_Param * param,
- const char *name);
-
-/**
- * Serialize the param array. target must point to at least
- * RPC_paramSize(param) bytes of memory.
- */
-void RPC_paramSerialize (RPC_Param * param, char *target);
-
-/**
- * Deserialize parameters from buffer.
- */
-RPC_Param *RPC_paramDeserialize (char *buffer, size_t size);
-
-/**
- * How many bytes are required to serialize the param array?
- */
-size_t RPC_paramSize (RPC_Param * param);
-
-
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
Modified: GNUnet/src/include/gnunet_session_service.h
===================================================================
--- GNUnet/src/include/gnunet_session_service.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_session_service.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -55,7 +55,7 @@
*/
int (*tryConnect) (const GNUNET_PeerIdentity * peer);
-} Session_ServiceAPI;
+} GNUNET_Session_ServiceAPI;
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_setup_lib.h
===================================================================
--- GNUnet/src/include/gnunet_setup_lib.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_setup_lib.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -27,7 +27,7 @@
* <li>libguile must be initialized by the main method of any
* program using it
* <li>the API does not support concurrent calls
- * <li>GNS_TreeChangeListener callbacks must not call back
+ * <li>GNUNET_GNS_TreeChangeListener callbacks must not call back
* into the API (in particular not unregister themselves)
* <li>clients may only read the tree, not modify it
* <li>values and visibility flags in the tree may change
@@ -50,45 +50,45 @@
*/
typedef enum
{
- GNS_Root = 0,
- GNS_Node = 1,
- GNS_Leaf = 2,
- GNS_KindMask = 3,
+ GNUNET_GNS_KIND_ROOT = 0,
+ GNUNET_GNS_KIND_NODE = 1,
+ GNUNET_GNS_KIND_LEAF = 2,
+ GNUNET_GNS_KIND_MASK = 3,
/**
* Binary type (yes/no).
*/
- GNS_Boolean = 4,
+ GNUNET_GNS_TYPE_BOOLEAN = 4,
/**
* Unsigned integer type.
*/
- GNS_UInt64 = 8,
+ GNUNET_GNS_TYPE_UINT64 = 8,
/**
* Double value type.
*/
- GNS_Double = 16,
+ GNUNET_GNS_TYPE_DOUBLE = 16,
/**
* Free-form string (possibly with suggestions)
*/
- GNS_String = 32,
+ GNUNET_GNS_TYPE_STRING = 32,
/**
* Multiple choice (results in space-seperated
* strings, one for each choice).
*/
- GNS_MC = 64,
+ GNUNET_GNS_TYPE_MULTIPLE_CHOICE = 64,
/**
* Single choice (results in individual string
* representing the choice).
*/
- GNS_SC = 128,
+ GNUNET_GNS_TYPE_SINGLE_CHOICE = 128,
- GNS_TypeMask = 252,
-} GNS_Type;
+ GNUNET_GNS_TYPE_MASK = 252,
+} GNUNET_GNS_TreeNodeKindAndType;
/**
* @brief configuration value
@@ -121,7 +121,7 @@
} Double;
/**
- * Data for GNS_String, GNS_MC and GNS_SC.
+ * Data for GNUNET_GNS_TYPE_STRING, GNUNET_GNS_TYPE_MULTIPLE_CHOICE and
GNUNET_GNS_TYPE_SINGLE_CHOICE.
*/
struct
{
@@ -140,7 +140,7 @@
} String;
-} GNS_Value;
+} GNUNET_GNS_Value;
/**
* @brief node in the configuration tree
@@ -152,7 +152,7 @@
* may change are the concrete values and the visibility
* attribute, but not the overall tree structure.
*/
-typedef struct GNS_Tree
+typedef struct GNUNET_GNS_TreeNode
{
/**
@@ -179,7 +179,7 @@
* NULL-terminated list of subnodes (must be empty for
* nodes of type "leaf")
*/
- struct GNS_Tree **children;
+ struct GNUNET_GNS_TreeNode **children;
/**
* Is this node visible to the user at this point?
@@ -189,20 +189,20 @@
/**
* Type of the node (bitmask).
*/
- GNS_Type type;
+ GNUNET_GNS_TreeNodeKindAndType type;
/**
* Value for this node (type of pointer is determined
* by the type field)
*/
- GNS_Value value;
+ GNUNET_GNS_Value value;
-} GNS_Tree;
+} GNUNET_GNS_TreeNode;
/**
* @brief gnunet setup context
*/
-struct GNS_Context;
+struct GNUNET_GNS_Context;
/**
* Start the setup process by loading a scheme file that
@@ -213,32 +213,32 @@
* @param specification name of the guile file containing the spec
* @return NULL on error (i.e. specification file not found)
*/
-struct GNS_Context *GNS_load_specification (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+struct GNUNET_GNS_Context *GNUNET_GNS_load_specification (struct
GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration
*cfg,
const char *specification);
/**
- * Obtain the GNS_Tree from the GNS system. The tree is only valid
- * until GNS_free_specification is called. Note that visibility and
+ * Obtain the GNUNET_GNS_TreeNode from the GNS system. The tree is only valid
+ * until GNUNET_GNS_free_specification is called. Note that visibility and
* values in the tree may change whenever the configuration of the GNS
* context changes.
*
* @return NULL on error
*/
-struct GNS_Tree *GNS_get_tree (struct GNS_Context *ctx);
+struct GNUNET_GNS_TreeNode *GNUNET_GNS_get_tree_root (struct
GNUNET_GNS_Context *ctx);
/**
* Free resources associated with the GNS context.
*/
-void GNS_free_specification (struct GNS_Context *ctx);
+void GNUNET_GNS_free_specification (struct GNUNET_GNS_Context *ctx);
/**
- * Callback that GNS will call whenever the GNS_Tree
+ * Callback that GNS will call whenever the GNUNET_GNS_TreeNode
* is changed.
*
* @param node the node that has changed
*/
-typedef void (*GNS_TreeChangeListener) (const struct GNS_Tree * node,
+typedef void (*GNUNET_GNS_TreeChangeListener) (const struct
GNUNET_GNS_TreeNode * node,
void *cls);
/**
@@ -247,8 +247,8 @@
* @param listener callback to call whenever the tree changes
*/
void
-GNS_register_tree_change_listener (struct GNS_Context *ctx,
- GNS_TreeChangeListener listener,
+GNUNET_GNS_register_tree_change_listener (struct GNUNET_GNS_Context *ctx,
+ GNUNET_GNS_TreeChangeListener listener,
void *cls);
/**
@@ -256,8 +256,8 @@
* in the future for change events).
*/
void
-GNS_unregister_tree_change_listener (struct GNS_Context *ctx,
- GNS_TreeChangeListener listener,
+GNUNET_GNS_unregister_tree_change_listener (struct GNUNET_GNS_Context *ctx,
+ GNUNET_GNS_TreeChangeListener listener,
void *cls);
/**
@@ -266,7 +266,7 @@
*
* @return NULL on error
*/
-char *GNS_get_default_value_as_string (GNS_Type type,
- const GNS_Value * value);
+char *GNUNET_GNS_get_default_value_as_string (GNUNET_GNS_TreeNodeKindAndType
type,
+ const GNUNET_GNS_Value * value);
#endif
Modified: GNUnet/src/include/gnunet_sqstore_service.h
===================================================================
--- GNUnet/src/include/gnunet_sqstore_service.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_sqstore_service.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -64,7 +64,7 @@
*
* @return GNUNET_OK on success, GNUNET_SYSERR on error, GNUNET_NO on
temporary error
*/
- int (*put) (const GNUNET_HashCode * key, const Datastore_Value * value);
+ int (*put) (const GNUNET_HashCode * key, const GNUNET_DatastoreValue *
value);
/**
* Iterate over the results for a particular key
@@ -78,7 +78,7 @@
* iter is non-NULL and aborted the iteration
*/
int (*get) (const GNUNET_HashCode * key,
- unsigned int type, Datum_Iterator iter, void *closure);
+ unsigned int type, GNUNET_DatastoreValueIterator iter, void
*closure);
/**
* Update the priority for a particular key in the datastore. If
@@ -115,7 +115,7 @@
* iter is non-NULL and aborted the iteration
*/
int (*iterateLowPriority) (unsigned int type,
- Datum_Iterator iter, void *closure);
+ GNUNET_DatastoreValueIterator iter, void
*closure);
/**
* Iterate over content with anonymity zero.
@@ -127,7 +127,7 @@
* iter is non-NULL and aborted the iteration
*/
int (*iterateNonAnonymous) (unsigned int type,
- Datum_Iterator iter, void *closure);
+ GNUNET_DatastoreValueIterator iter, void
*closure);
/**
* Iterate over the items in the datastore in ascending
@@ -140,7 +140,7 @@
* iter is non-NULL and aborted the iteration
*/
int (*iterateExpirationTime) (unsigned int type,
- Datum_Iterator iter, void *closure);
+ GNUNET_DatastoreValueIterator iter, void
*closure);
/**
@@ -151,7 +151,7 @@
* @return the number of results, GNUNET_SYSERR if the
* iter is non-NULL and aborted the iteration
*/
- int (*iterateMigrationOrder) (Datum_Iterator iter, void *closure);
+ int (*iterateMigrationOrder) (GNUNET_DatastoreValueIterator iter, void
*closure);
/**
* Iterate over all the items in the datastore
@@ -163,7 +163,7 @@
* @return the number of results, GNUNET_SYSERR if the
* iter is non-NULL and aborted the iteration
*/
- int (*iterateAllNow) (Datum_Iterator iter, void *closure);
+ int (*iterateAllNow) (GNUNET_DatastoreValueIterator iter, void *closure);
/**
* Delete the database. The next operation is
@@ -171,7 +171,7 @@
*/
void (*drop) (void);
-} SQstore_ServiceAPI;
+} GNUNET_SQstore_ServiceAPI;
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_state_service.h
===================================================================
--- GNUnet/src/include/gnunet_state_service.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_state_service.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -50,7 +50,7 @@
* (*result should be NULL, sufficient space is allocated)
* @return the number of bytes read on success, -1 on failure
*/
- int (*read) (struct GE_Context * ectx, const char *name, void **result);
+ int (*read) (struct GNUNET_GE_Context * ectx, const char *name, void
**result);
/**
* Append content to file.
@@ -60,7 +60,7 @@
* @param block the data to store
* @return GNUNET_SYSERR on error, GNUNET_OK if ok.
*/
- int (*append) (struct GE_Context * ectx,
+ int (*append) (struct GNUNET_GE_Context * ectx,
const char *name, int len, const void *block);
/**
@@ -71,7 +71,7 @@
* @param block the data to store
* @return GNUNET_SYSERR on error, GNUNET_OK if ok.
*/
- int (*write) (struct GE_Context * ectx,
+ int (*write) (struct GNUNET_GE_Context * ectx,
const char *name, int len, const void *block);
/**
@@ -79,9 +79,9 @@
* @param name the hashcode representing the name of the file
* (without directory)
*/
- int (*unlink) (struct GE_Context * ectx, const char *name);
+ int (*unlink) (struct GNUNET_GE_Context * ectx, const char *name);
-} State_ServiceAPI;
+} GNUNET_State_ServiceAPI;
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_stats_lib.h
===================================================================
--- GNUnet/src/include/gnunet_stats_lib.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_stats_lib.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -38,24 +38,24 @@
#endif
#endif
-#define STATS_VERSION "4.0.0"
+#define GNUNET_STATS_VERSION "5.0.0"
/**
* Return a descriptive name for a p2p message type
*/
-const char *STATS_p2pMessageName (unsigned short type);
+const char *GNUNET_STATS_p2p_message_type_to_string (unsigned short type);
/**
* Return a descriptive name for a client server message type
*/
-const char *STATS_csMessageName (unsigned short type);
+const char *GNUNET_STATS_cs_message_type_to_string (unsigned short type);
/**
* @param name the name of the datum
* @param value the value
* @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
*/
-typedef int (*STATS_StatProcessor) (const char *name,
+typedef int (*GNUNET_STATS_StatisticsProcessor) (const char *name,
unsigned long long value, void *cls);
/**
@@ -64,16 +64,16 @@
* @param processor function to call on each value
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int STATS_getStatistics (struct GE_Context *ectx,
+int GNUNET_STATS_get_statistics (struct GNUNET_GE_Context *ectx,
struct GNUNET_ClientServerConnection *sock,
- STATS_StatProcessor processor, void *cls);
+ GNUNET_STATS_StatisticsProcessor processor, void
*cls);
/**
* @param type the type ID of the message
* @param isP2P GNUNET_YES for P2P, GNUNET_NO for CS types
* @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
*/
-typedef int (*STATS_ProtocolProcessor) (unsigned short type,
+typedef int (*GNUNET_STATS_ProtocolProcessor) (unsigned short type,
int isP2P, void *cls);
/**
@@ -82,9 +82,9 @@
* @param processor function to call on each value
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int STATS_getAvailableProtocols (struct GE_Context *ectx,
+int GNUNET_STATS_get_available_protocols (struct GNUNET_GE_Context *ectx,
struct GNUNET_ClientServerConnection *sock,
- STATS_ProtocolProcessor processor,
+ GNUNET_STATS_ProtocolProcessor processor,
void *cls);
#if 0 /* keep Emacsens' auto-indent happy */
Modified: GNUnet/src/include/gnunet_stats_service.h
===================================================================
--- GNUnet/src/include/gnunet_stats_service.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_stats_service.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -75,7 +75,7 @@
*/
void (*change) (const int handle, const int delta);
-} Stats_ServiceAPI;
+} GNUNET_Stats_ServiceAPI;
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_topology_service.h
===================================================================
--- GNUnet/src/include/gnunet_topology_service.h 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/include/gnunet_topology_service.h 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -81,7 +81,7 @@
int (*allowConnectionFrom) (const GNUNET_PeerIdentity * peer);
-} Topology_ServiceAPI;
+} GNUNET_Topology_ServiceAPI;
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_traffic_lib.h
===================================================================
--- GNUnet/src/include/gnunet_traffic_lib.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_traffic_lib.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -45,7 +45,7 @@
* @param sock socket to query gnunetd over
* @param timeframe what time interval should be considered
* @param type what type of message do we care about?
- * @param direction TC_RECEIVED of TC_SEND?
+ * @param direction GNUNET_TRAFFIC_TYPE_RECEIVED of TC_SEND?
* @param count set to number of messages
* @param avg_size set to average size
* @param peers set to number of peers involved
Modified: GNUnet/src/include/gnunet_traffic_service.h
===================================================================
--- GNUnet/src/include/gnunet_traffic_service.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_traffic_service.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -40,27 +40,27 @@
/**
* This type is for messages that we send.
*/
-#define TC_SENT 0x8000
+#define GNUNET_TRAFFIC_TYPE_SENT 0x8000
/**
* This type is for messages that we receive.
*/
-#define TC_RECEIVED 0x4000
+#define GNUNET_TRAFFIC_TYPE_RECEIVED 0x4000
-#define TC_TYPE_MASK (TC_RECEIVED|TC_SENT)
+#define GNUNET_TRAFFIC_TYPE_MASK
(GNUNET_TRAFFIC_TYPE_RECEIVED|GNUNET_TRAFFIC_TYPE_SENT)
/**
* From/To how many different peers did we receive/send
* messages of this type? (bitmask)
*/
-#define TC_DIVERSITY_MASK 0xFFF
+#define GNUNET_TRAFFIC_DIVERSITY_MASK 0xFFF
/**
* What is the unit of time (in GNUNET_CronTime) for the traffic module? This
* constant essentially specifies the resolution of the distribution
* function that is applied for sampling traffic. Default is 1s.
*/
-#define TRAFFIC_TIME_UNIT GNUNET_CRON_SECONDS
+#define GNUNET_TRAFFIC_TIME_UNIT GNUNET_CRON_SECONDS
/**
* @brief API to the traffic service.
@@ -78,7 +78,7 @@
*
* @param timeframe what time interval should be considered
* @param type what type of message do we care about?
- * @param direction TC_RECEIVED of TC_SEND?
+ * @param direction GNUNET_TRAFFIC_TYPE_RECEIVED of TC_SEND?
* @param msgCount set to number of messages
* @param avg_size set to average size
* @param peerCount set to number of peers involved
@@ -94,7 +94,7 @@
unsigned int *peerCount,
unsigned int *avg_size, unsigned int *time);
-} Traffic_ServiceAPI;
+} GNUNET_Traffic_ServiceAPI;
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_transport.h
===================================================================
--- GNUnet/src/include/gnunet_transport.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_transport.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -61,7 +61,7 @@
* in order to send replies on a bi-directional pipe (if
* possible).
*/
- TSession *tsession;
+ GNUNET_TSession *tsession;
/**
* The identity of the sender node
@@ -113,12 +113,12 @@
/**
* System error context
*/
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
/**
* System configuration
*/
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
/**
* System load monitor
@@ -158,7 +158,7 @@
*/
int (*releaseService) (void *service);
- int (*assertUnused) (TSession * tsession);
+ int (*assertUnused) (GNUNET_TSession * tsession);
} CoreAPIForTransport;
@@ -260,7 +260,7 @@
* @param may_reuse can an existing connection be re-used?
* @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
*/
- int (*connect) (const GNUNET_MessageHello * hello, TSession ** tsession,
+ int (*connect) (const GNUNET_MessageHello * hello, GNUNET_TSession **
tsession,
int may_reuse);
/**
@@ -277,7 +277,7 @@
* using the session afterwards (useful if the other
* side closed the connection).
*/
- int (*send) (TSession * tsession,
+ int (*send) (GNUNET_TSession * tsession,
const void *msg, unsigned int size, int important);
/**
@@ -299,7 +299,7 @@
* @return GNUNET_OK if the session could be associated,
* GNUNET_SYSERR if not.
*/
- int (*associate) (TSession * tsession);
+ int (*associate) (GNUNET_TSession * tsession);
/**
* Disconnect from a remote node. A session can be closed
@@ -314,7 +314,7 @@
* @param tsession the session that is to be closed
* @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
*/
- int (*disconnect) (TSession * tsession);
+ int (*disconnect) (GNUNET_TSession * tsession);
/**
* Start the server process to receive inbound traffic.
@@ -348,7 +348,7 @@
* GNUNET_NO if the transport would just drop the message,
* GNUNET_SYSERR if the size/session is invalid
*/
- int (*testWouldTry) (TSession * tsession, unsigned int size, int important);
+ int (*testWouldTry) (GNUNET_TSession * tsession, unsigned int size, int
important);
} TransportAPI;
Modified: GNUnet/src/include/gnunet_transport_service.h
===================================================================
--- GNUnet/src/include/gnunet_transport_service.h 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/include/gnunet_transport_service.h 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -40,7 +40,7 @@
/**
* Type of the per-transport callback method.
*/
-typedef void (*TransportCallback) (TransportAPI * tapi, void *data);
+typedef void (*GNUNET_TransportCallback) (TransportAPI * tapi, void *data);
/**
* @brief Transport service definition.
@@ -76,7 +76,7 @@
* @param data second argument to callback
* @return number of transports, GNUNET_SYSERR on error
*/
- int (*forEach) (TransportCallback callback, void *data);
+ int (*forEach) (GNUNET_TransportCallback callback, void *data);
/**
* Connect to a remote host using the advertised transport
@@ -90,7 +90,7 @@
* (must match when disconnect is called)
* @return session handle on success, NULL on error
*/
- TSession *(*connect) (const GNUNET_MessageHello * hello, const char *token,
+ GNUNET_TSession *(*connect) (const GNUNET_MessageHello * hello, const char
*token,
int may_reuse);
/**
@@ -104,7 +104,7 @@
* (must match when disconnect is called)
* @return session handle on success, NULL on error
*/
- TSession *(*connectFreely) (const GNUNET_PeerIdentity * peer,
+ GNUNET_TSession *(*connectFreely) (const GNUNET_PeerIdentity * peer,
int allowTempList, const char *token);
/**
@@ -122,7 +122,7 @@
* @return GNUNET_OK if the session could be associated,
* GNUNET_SYSERR if not.
*/
- int (*associate) (TSession * tsession, const char *token);
+ int (*associate) (GNUNET_TSession * tsession, const char *token);
/**
* Get the cost of a message in for the given transport mechanism.
@@ -139,7 +139,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on persistent error,
GNUNET_NO on
* temporary error
*/
- int (*send) (TSession * session,
+ int (*send) (GNUNET_TSession * session,
const void *msg, unsigned int size, int important);
/**
@@ -150,7 +150,7 @@
*
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
- int (*disconnect) (TSession * session, const char *token);
+ int (*disconnect) (GNUNET_TSession * session, const char *token);
/**
* Verify that a hello is ok. Call a method
@@ -207,15 +207,15 @@
* GNUNET_NO if the transport would just drop the message,
* GNUNET_SYSERR if the size/session is invalid
*/
- int (*testWouldTry) (TSession * tsession, unsigned int size, int important);
+ int (*testWouldTry) (GNUNET_TSession * tsession, unsigned int size, int
important);
/**
* Verify that this session is associated (with the given
* token).
*/
- int (*assertAssociated) (TSession * tsession, const char *token);
+ int (*assertAssociated) (GNUNET_TSession * tsession, const char *token);
-} Transport_ServiceAPI;
+} GNUNET_Transport_ServiceAPI;
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_upnp_service.h
===================================================================
--- GNUnet/src/include/gnunet_upnp_service.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_upnp_service.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -52,7 +52,7 @@
int (*get_ip) (unsigned short port, const char *protocol,
GNUNET_IPv4Address * address);
-} UPnP_ServiceAPI;
+} GNUNET_UPnP_ServiceAPI;
#if 0 /* keep Emacsens' auto-indent happy */
Modified: GNUnet/src/include/gnunet_uritrack_lib.h
===================================================================
--- GNUnet/src/include/gnunet_uritrack_lib.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_uritrack_lib.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -43,26 +43,26 @@
* @param onOff GNUNET_YES to enable tracking, GNUNET_NO to disable
* disabling tracking
*/
-void URITRACK_trackURIS (struct GE_Context *ectx, struct GC_Configuration
*cfg, int onOff); /* file_info.c */
+void GNUNET_URITRACK_toggle_tracking (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, int onOff); /* file_info.c */
/**
* Deletes all entries in the URITRACK tracking cache.
*/
-void URITRACK_clearTrackedURIS (struct GE_Context *ectx, struct
GC_Configuration *cfg); /* file_info.c */
+void GNUNET_URITRACK_clear (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg); /* file_info.c */
/**
* Get the URITRACK URI tracking status.
*
* @return GNUNET_YES of tracking is enabled, GNUNET_NO if not
*/
-int URITRACK_trackStatus (struct GE_Context *ectx, struct GC_Configuration
*cfg); /* file_info.c */
+int GNUNET_URITRACK_get_tracking_status (struct GNUNET_GE_Context *ectx,
struct GNUNET_GC_Configuration *cfg); /* file_info.c */
/**
* Makes a URI available for directory building. This function is
* automatically called by all URITRACK functions and only in the
* interface for clients that call ECRS directly.
*/
-void URITRACK_trackURI (struct GE_Context *ectx, struct GC_Configuration *cfg,
const ECRS_FileInfo * fi); /* file_info.c */
+void GNUNET_URITRACK_track (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const GNUNET_ECRS_FileInfo * fi); /*
file_info.c */
/**
* List all URIs.
@@ -70,7 +70,7 @@
* @param need_metadata GNUNET_YES if metadata should be
* provided, GNUNET_NO if metadata is not needed (faster)
*/
-int URITRACK_listURIs (struct GE_Context *ectx, struct GC_Configuration *cfg,
int need_metadata, ECRS_SearchProgressCallback iterator, void *closure); /*
file_info.c */
+int GNUNET_URITRACK_list (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, int need_metadata,
GNUNET_ECRS_SearchResultProcessor iterator, void *closure); /* file_info.c */
/**
* Register a handler that is called whenever
@@ -78,51 +78,51 @@
* the database, the callback will be called
* for all existing URIs as well.
*/
-int URITRACK_registerTrackCallback (struct GE_Context *ectx, struct
GC_Configuration *cfg, ECRS_SearchProgressCallback iterator, void *closure);
/* callbacks.c */
+int GNUNET_URITRACK_register_track_callback (struct GNUNET_GE_Context *ectx,
struct GNUNET_GC_Configuration *cfg, GNUNET_ECRS_SearchResultProcessor
iterator, void *closure); /* callbacks.c */
/**
* Unregister a URI callback.
*/
-int URITRACK_unregisterTrackCallback (ECRS_SearchProgressCallback iterator,
void *closure); /* callbacks.c */
+int GNUNET_URITRACK_unregister_track_callback
(GNUNET_ECRS_SearchResultProcessor iterator, void *closure); /* callbacks.c
*/
/**
* Possible ways in which a given URI has been used or encountered.
* Note that we only have 8-bits when storing this on the disk,
* so do not add additional entries (without changing uri_info).
*/
-enum URITRACK_STATE
+enum GNUNET_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_DIRECTORY_FOUND = 128,
+ GNUNET_URITRACK_FRESH = 0,
+ GNUNET_URITRACK_INSERTED = 1,
+ GNUNET_URITRACK_INDEXED = 2,
+ GNUNET_URITRACK_DIRECTORY_ADDED = 4,
+ GNUNET_URITRACK_DOWNLOAD_STARTED = 8,
+ GNUNET_URITRACK_DOWNLOAD_ABORTED = 16,
+ GNUNET_URITRACK_DOWNLOAD_COMPLETED = 32,
+ GNUNET_URITRACK_SEARCH_RESULT = 64,
+ GNUNET_URITRACK_DIRECTORY_FOUND = 128,
};
/**
* Find out what we know about a given URI's past. Note that we only
* track the states for a (finite) number of URIs and that the
* information that we give back maybe inaccurate (returning
- * URITRACK_FRESH if the URI did not fit into our bounded-size map,
+ * GNUNET_URITRACK_FRESH if the URI did not fit into our bounded-size map,
* even if the URI is not fresh anymore; also, if the URI has a
* GNUNET_hash-collision in the map, there is a 1:256 chance that we will
* return information from the wrong URI without detecting it).
*/
-enum URITRACK_STATE
-URITRACK_getState (struct GE_Context *ectx,
- struct GC_Configuration *cfg, const struct ECRS_URI *uri);
+enum GNUNET_URITRACK_STATE
+GNUNET_URITRACK_get_state (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg, const struct
GNUNET_ECRS_URI *uri);
/**
* Add additional information about a given URI's past.
*/
-void URITRACK_addState (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- const struct ECRS_URI *uri,
- enum URITRACK_STATE state);
+void GNUNET_URITRACK_add_state (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const struct GNUNET_ECRS_URI *uri,
+ enum GNUNET_URITRACK_STATE state);
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_util_boot.h
===================================================================
--- GNUnet/src/include/gnunet_util_boot.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_util_boot.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -56,12 +56,12 @@
const char *binaryName,
char **configurationFileName,
const struct GNUNET_CommandLineOption *options,
- struct GE_Context **ectx, struct GC_Configuration **cfg);
+ struct GNUNET_GE_Context **ectx, struct
GNUNET_GC_Configuration **cfg);
/**
* Free resources allocated during GNUnet_init.
*/
-void GNUNET_fini (struct GE_Context *ectx, struct GC_Configuration *cfg);
+void GNUNET_fini (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg);
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_util_config.h
===================================================================
--- GNUnet/src/include/gnunet_util_config.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_util_config.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -40,9 +40,9 @@
#endif
#endif
-struct GC_Configuration;
+struct GNUNET_GC_Configuration;
-void GC_free (struct GC_Configuration *cfg);
+void GNUNET_GC_free (struct GNUNET_GC_Configuration *cfg);
/**
* Set the context for reporting configuration IO errors
@@ -56,15 +56,15 @@
* @param ectx may be NULL, in that case errors will no longer
* be reported
*/
-void GC_set_error_context (struct GC_Configuration *cfg,
- struct GE_Context *ectx);
+void GNUNET_GC_set_error_context (struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx);
/**
* Parse a configuration file, add all of the options in the
* file to the configuration environment.
* @return 0 on success, -1 on error
*/
-int GC_parse_configuration (struct GC_Configuration *cfg,
+int GNUNET_GC_parse_configuration (struct GNUNET_GC_Configuration *cfg,
const char *filename);
/**
@@ -72,13 +72,13 @@
* changed since the last save.
* @return 0 if clean, 1 if dirty, -1 on error (i.e. last save failed)
*/
-int GC_test_dirty (struct GC_Configuration *cfg);
+int GNUNET_GC_test_dirty (struct GNUNET_GC_Configuration *cfg);
/**
* Write configuration file.
* @return 0 on success, -1 on error
*/
-int GC_write_configuration (struct GC_Configuration *cfg,
+int GNUNET_GC_write_configuration (struct GNUNET_GC_Configuration *cfg,
const char *filename);
/**
@@ -88,7 +88,7 @@
* @param default default value (use indicated by return value)
* @return 0 on success, -1 on error, 1 for default
*/
-int GC_get_configuration_value_number (struct GC_Configuration *cfg,
+int GNUNET_GC_get_configuration_value_number (struct GNUNET_GC_Configuration
*cfg,
const char *section,
const char *option,
unsigned long long min,
@@ -100,7 +100,7 @@
* Test if we have a value for a particular option
* @return GNUNET_YES if so, GNUNET_NO if not.
*/
-int GC_have_configuration_value (struct GC_Configuration *cfg,
+int GNUNET_GC_have_configuration_value (struct GNUNET_GC_Configuration *cfg,
const char *section, const char *option);
/**
@@ -111,7 +111,7 @@
* value, or NULL if option is not specified and no default given
* @return 0 on success, -1 on error, 1 for default
*/
-int GC_get_configuration_value_string (struct GC_Configuration *cfg,
+int GNUNET_GC_get_configuration_value_string (struct GNUNET_GC_Configuration
*cfg,
const char *section,
const char *option,
const char *def, char **value);
@@ -126,7 +126,7 @@
* value, or NULL if option is not specified and no default given
* @return 0 on success, -1 on error, 1 for default
*/
-int GC_get_configuration_value_filename (struct GC_Configuration *cfg,
+int GNUNET_GC_get_configuration_value_filename (struct GNUNET_GC_Configuration
*cfg,
const char *section,
const char *option,
const char *def, char **value);
@@ -142,7 +142,7 @@
* or NULL if option is not specified and no default given
* @return 0 on success, -1 on error, 1 for default
*/
-int GC_get_configuration_value_choice (struct GC_Configuration *cfg,
+int GNUNET_GC_get_configuration_value_choice (struct GNUNET_GC_Configuration
*cfg,
const char *section,
const char *option,
const char **choices,
@@ -156,7 +156,7 @@
* will NOT be aliased, maybe NULL)
* @return GNUNET_YES, GNUNET_NO or GNUNET_SYSERR
*/
-int GC_get_configuration_value_yesno (struct GC_Configuration *cfg,
+int GNUNET_GC_get_configuration_value_yesno (struct GNUNET_GC_Configuration
*cfg,
const char *section,
const char *option, int def);
@@ -168,7 +168,7 @@
* @param old string to $-expand (will be freed!)
* @return $-expanded string
*/
-char *GC_configuration_expand_dollar (struct GC_Configuration *cfg,
+char *GNUNET_GC_configuration_expand_dollar (struct GNUNET_GC_Configuration
*cfg,
char *old);
/**
@@ -176,8 +176,8 @@
* @return 0 on success, -1 on error (i.e. out of memory,
* or update refused by registered callback)
*/
-int GC_set_configuration_value_number (struct GC_Configuration *cfg,
- struct GE_Context *ectx,
+int GNUNET_GC_set_configuration_value_number (struct GNUNET_GC_Configuration
*cfg,
+ struct GNUNET_GE_Context *ectx,
const char *section,
const char *option,
unsigned long long number);
@@ -189,8 +189,8 @@
* @return 0 on success, -1 on error (i.e. out of memory,
* or update refused by registered callback)
*/
-int GC_set_configuration_value_string (struct GC_Configuration *cfg,
- struct GE_Context *ectx,
+int GNUNET_GC_set_configuration_value_string (struct GNUNET_GC_Configuration
*cfg,
+ struct GNUNET_GE_Context *ectx,
const char *section,
const char *option, const char *value);
@@ -201,8 +201,8 @@
* @return 0 on success, -1 on error (i.e. out of memory,
* or update refused by registered callback)
*/
-int GC_set_configuration_value_choice (struct GC_Configuration *cfg,
- struct GE_Context *ectx,
+int GNUNET_GC_set_configuration_value_choice (struct GNUNET_GC_Configuration
*cfg,
+ struct GNUNET_GE_Context *ectx,
const char *section,
const char *option,
const char *choice);
@@ -216,9 +216,9 @@
* @return 0 if the change is ok, -1 if the change must be
* refused
*/
-typedef int (*GC_ChangeListener) (void *ctx,
- struct GC_Configuration * cfg,
- struct GE_Context * ectx,
+typedef int (*GNUNET_GC_ChangeListener) (void *ctx,
+ struct GNUNET_GC_Configuration * cfg,
+ struct GNUNET_GE_Context * ectx,
const char *section, const char *option);
/**
@@ -227,21 +227,21 @@
*
* @return 0 on success, -1 on error
*/
-int GC_attach_change_listener (struct GC_Configuration *cfg,
- GC_ChangeListener callback, void *ctx);
+int GNUNET_GC_attach_change_listener (struct GNUNET_GC_Configuration *cfg,
+ GNUNET_GC_ChangeListener callback, void *ctx);
/**
* Attach a callback that is notified whenever a
* configuration option changes.
* @return 0 on success, -1 on error, 1 for no such handler registered
*/
-int GC_detach_change_listener (struct GC_Configuration *cfg,
- GC_ChangeListener callback, void *ctx);
+int GNUNET_GC_detach_change_listener (struct GNUNET_GC_Configuration *cfg,
+ GNUNET_GC_ChangeListener callback, void *ctx);
/**
- * Create a GC_Configuration
+ * Create a GNUNET_GC_Configuration
*/
-struct GC_Configuration *GC_create (void);
+struct GNUNET_GC_Configuration *GNUNET_GC_create (void);
#if 0 /* keep Emacsens' auto-indent happy */
Modified: GNUnet/src/include/gnunet_util_containers.h
===================================================================
--- GNUnet/src/include/gnunet_util_containers.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_util_containers.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -69,7 +69,7 @@
* element (number of bits set per element in the set)
* @return the bloomfilter
*/
-struct GNUNET_BloomFilter *GNUNET_bloomfilter_load (struct GE_Context *ectx,
+struct GNUNET_BloomFilter *GNUNET_bloomfilter_load (struct GNUNET_GE_Context
*ectx,
const char *filename,
unsigned int size,
unsigned int k);
Modified: GNUnet/src/include/gnunet_util_cron.h
===================================================================
--- GNUnet/src/include/gnunet_util_cron.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_util_cron.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -47,7 +47,7 @@
struct GNUNET_CronManager;
-struct GNUNET_CronManager *cron_create (struct GE_Context *ectx);
+struct GNUNET_CronManager *cron_create (struct GNUNET_GE_Context *ectx);
void GNUNET_cron_destroy (struct GNUNET_CronManager *mgr);
Modified: GNUnet/src/include/gnunet_util_crypto.h
===================================================================
--- GNUnet/src/include/gnunet_util_crypto.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_util_crypto.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -274,7 +274,7 @@
* Compute the GNUNET_hash of an entire file.
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int GNUNET_hash_file (struct GE_Context *ectx,
+int GNUNET_hash_file (struct GNUNET_GE_Context *ectx,
const char *filename, GNUNET_HashCode * ret);
void GNUNET_create_random_hash (GNUNET_HashCode * result);
Modified: GNUnet/src/include/gnunet_util_disk.h
===================================================================
--- GNUnet/src/include/gnunet_util_disk.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_util_disk.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -49,7 +49,7 @@
* @param part a file on the partition to check
* @return -1 on errors, otherwise the number of free blocks
*/
-long GNUNET_disk_get_blocks_available (struct GE_Context *ectx,
+long GNUNET_disk_get_blocks_available (struct GNUNET_GE_Context *ectx,
const char *part);
/**
@@ -59,7 +59,7 @@
* @returns GNUNET_YES if yes, GNUNET_NO if not a file, GNUNET_SYSERR if
something
* else (will print an error message in that case, too).
*/
-int GNUNET_disk_file_test (struct GE_Context *ectx, const char *fil);
+int GNUNET_disk_file_test (struct GNUNET_GE_Context *ectx, const char *fil);
/**
* Get the size of the file (or directory)
@@ -70,7 +70,7 @@
*
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int GNUNET_disk_file_size (struct GE_Context *ectx,
+int GNUNET_disk_file_size (struct GNUNET_GE_Context *ectx,
const char *filename,
unsigned long long *size, int includeSymLinks);
@@ -79,13 +79,13 @@
*
* @return file handle, -1 on error
*/
-int GNUNET_disk_file_open (struct GE_Context *ectx,
+int GNUNET_disk_file_open (struct GNUNET_GE_Context *ectx,
const char *filename, int oflag, ...);
/**
* Wrapper around "close()". Closes a file.
*/
-void GNUNET_disk_file_close (struct GE_Context *ectx, const char *filename,
+void GNUNET_disk_file_close (struct GNUNET_GE_Context *ectx, const char
*filename,
int fd);
/**
@@ -96,7 +96,7 @@
* @param result the buffer to write the result to
* @return the number of bytes read on success, -1 on failure
*/
-int GNUNET_disk_file_read (struct GE_Context *ectx,
+int GNUNET_disk_file_read (struct GNUNET_GE_Context *ectx,
const char *fileName, int len, void *result);
/**
@@ -107,7 +107,7 @@
* @param mode the mode for file permissions
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int GNUNET_disk_file_write (struct GE_Context *ectx,
+int GNUNET_disk_file_write (struct GNUNET_GE_Context *ectx,
const char *fileName,
const void *buffer, unsigned int n,
const char *mode);
@@ -116,7 +116,7 @@
* Copy a file.
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int GNUNET_disk_file_copy (struct GE_Context *ectx,
+int GNUNET_disk_file_copy (struct GNUNET_GE_Context *ectx,
const char *src, const char *dst);
/**
@@ -137,7 +137,7 @@
* @param data argument to pass to callback
* @return the number of files found, -1 on error
*/
-int GNUNET_disk_directory_scan (struct GE_Context *ectx,
+int GNUNET_disk_directory_scan (struct GNUNET_GE_Context *ectx,
const char *dirName,
GNUNET_DirectoryEntryCallback callback,
void *data);
@@ -150,7 +150,7 @@
* @param filename name of a file in the directory
* @returns GNUNET_OK on success, GNUNET_SYSERR on failure
*/
-int GNUNET_disk_directory_create_for_file (struct GE_Context *ectx,
+int GNUNET_disk_directory_create_for_file (struct GNUNET_GE_Context *ectx,
const char *filename);
/**
@@ -162,7 +162,7 @@
* @return GNUNET_YES if yes, GNUNET_NO if does not exist, GNUNET_SYSERR
* on any error and if exists but not directory
*/
-int GNUNET_disk_directory_test (struct GE_Context *ectx, const char *fil);
+int GNUNET_disk_directory_test (struct GNUNET_GE_Context *ectx, const char
*fil);
/**
* Remove all files in a directory (rm -rf). Call with
@@ -171,7 +171,7 @@
* @param fileName the file to remove
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int GNUNET_disk_directory_remove (struct GE_Context *ectx,
+int GNUNET_disk_directory_remove (struct GNUNET_GE_Context *ectx,
const char *fileName);
/**
@@ -180,7 +180,7 @@
* @param dir the directory to create
* @returns GNUNET_SYSERR on failure, GNUNET_OK otherwise
*/
-int GNUNET_disk_directory_create (struct GE_Context *ectx, const char *dir);
+int GNUNET_disk_directory_create (struct GNUNET_GE_Context *ectx, const char
*dir);
/**
* @brief Removes special characters as ':' from a filename.
Modified: GNUnet/src/include/gnunet_util_error.h
===================================================================
--- GNUnet/src/include/gnunet_util_error.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_util_error.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -43,122 +43,122 @@
/**
* Context required to log messages.
*/
-struct GE_Context;
+struct GNUNET_GE_Context;
/**
* Classes of log messages.
*/
typedef enum
{
- GE_NOTHING = 0x00000000,
+ GNUNET_GE_NOTHING = 0x00000000,
/* type of event */
- GE_FATAL = 0x00000001, /* FATAL/FAILURE/NOTHING */
- GE_ERROR = 0x00000002,
- GE_WARNING = 0x00000004,
- GE_INFO = 0x00000008, /* normal program response */
- GE_STATUS = 0x00000010, /* status message */
- GE_DEBUG = 0x00000020, /* DEBUG/CRON/EVERYTHING */
- GE_EVENTKIND = 0x000000FF, /* bitmask */
+ GNUNET_GE_FATAL = 0x00000001, /* FATAL/FAILURE/NOTHING */
+ GNUNET_GE_ERROR = 0x00000002,
+ GNUNET_GE_WARNING = 0x00000004,
+ GNUNET_GE_INFO = 0x00000008, /* normal program response */
+ GNUNET_GE_STATUS = 0x00000010, /* status message */
+ GNUNET_GE_DEBUG = 0x00000020, /* DEBUG/CRON/EVERYTHING */
+ GNUNET_GE_EVENTKIND = 0x000000FF, /* bitmask */
/* who should see the message? */
/**
* These messages are sent to the console / UI.
* Note that when running as an administrative
- * daemon, messages tagged just as GE_USER will
+ * daemon, messages tagged just as GNUNET_GE_USER will
* be discarded.
*/
- GE_USER = 0x01000000, /* current user, if possible */
+ GNUNET_GE_USER = 0x01000000, /* current user, if possible */
/**
* These messages are sent to the logfile for the
* administrator. Note that normal users may not
* always look there.
*/
- GE_ADMIN = 0x02000000, /* system administrator */
+ GNUNET_GE_ADMIN = 0x02000000, /* system administrator */
/**
* These messages are usually not logged or given
* to the user. They can be obtained when the tool
* is run in debug mode.
*/
- GE_DEVELOPER = 0x04000000, /* GNUnet developers (bug!) */
+ GNUNET_GE_DEVELOPER = 0x04000000, /* GNUnet developers (bug!) */
/**
* Mask for the type of user that should see the
* message.
*/
- GE_USERKIND = 0x0F000000, /* bitmask */
+ GNUNET_GE_USERKIND = 0x0F000000, /* bitmask */
/* how event should be routed */
/**
* The message should only be shown upon specific
* request.
*/
- GE_REQUEST = 0x20000000, /* display on request only (i.e. low-priority
log, user demands verbose events) */
+ GNUNET_GE_REQUEST = 0x20000000, /* display on request only (i.e.
low-priority log, user demands verbose events) */
/**
* This type of message is not urgent and is likely
* to occur in bulk. Suitable for logging to a file
* or in a generic, scrolling message window.
*/
- GE_BULK = 0x40000000, /* display in bulk output (i.e. log-file,
scroll window, console) */
+ GNUNET_GE_BULK = 0x40000000, /* display in bulk output (i.e.
log-file, scroll window, console) */
/**
* This is a message that is urgent and should be
* communicated as soon as possible. Sending an
* e-mail alert or opening a pop-up window maybe
* appropriate.
*/
- GE_IMMEDIATE = 0x80000000, /* display immediately (i.e. pop-up, e-mail) */
+ GNUNET_GE_IMMEDIATE = 0x80000000, /* display immediately (i.e. pop-up,
e-mail) */
/**
* Mask for the routing type.
*/
- GE_ROUTEKIND = 0xF0000000, /* bitmask */
- GE_ALL = 0xFFFFFFFF,
- GE_INVALID = 0x08000000, /* unused bit */
-} GE_KIND;
+ GNUNET_GE_ROUTEKIND = 0xF0000000, /* bitmask */
+ GNUNET_GE_ALL = 0xFFFFFFFF,
+ GNUNET_GE_INVALID = 0x08000000, /* unused bit */
+} GNUNET_GE_KIND;
-void GE_LOG (struct GE_Context *ctx, GE_KIND kind, const char *message, ...);
+void GNUNET_GE_LOG (struct GNUNET_GE_Context *ctx, GNUNET_GE_KIND kind, const
char *message, ...);
/**
* @brief Get user confirmation (e.g. before the app shuts down and closes the
* error message
*/
-void GE_CONFIRM (struct GE_Context *ctx);
+void GNUNET_GE_CONFIRM (struct GNUNET_GE_Context *ctx);
-void GE_setDefaultContext (struct GE_Context *ctx);
+void GNUNET_GE_setDefaultContext (struct GNUNET_GE_Context *ctx);
/**
* User-defined handler for log events.
*/
-typedef void (*GE_LogHandler) (void *ctx,
- GE_KIND kind,
+typedef void (*GNUNET_GE_LogHandler) (void *ctx,
+ GNUNET_GE_KIND kind,
const char *date, const char *msg);
/**
* User-defined method to free handler context.
*/
-typedef void (*GE_CtxFree) (void *ctx);
+typedef void (*GNUNET_GE_CtxFree) (void *ctx);
/**
* User-defined method to wait for user confirmation
*/
-typedef void (*GE_Confirm) (void *ctx);
+typedef void (*GNUNET_GE_Confirm) (void *ctx);
/**
* Create a log context that calls a callback function
* for matching events.
*
* @param mask which events is this handler willing to process?
- * an event must be non-zero in all 3 GE_MASK categories
+ * an event must be non-zero in all 3 GNUNET_GE_MASK categories
* to be passed to this handler
* @param liberator callback to free ctx, maybe NULL
*/
-struct GE_Context *GE_create_context_callback (GE_KIND mask,
- GE_LogHandler handler,
+struct GNUNET_GE_Context *GNUNET_GE_create_context_callback (GNUNET_GE_KIND
mask,
+ GNUNET_GE_LogHandler handler,
void *ctx,
- GE_CtxFree liberator,
- GE_Confirm confirm);
+ GNUNET_GE_CtxFree liberator,
+ GNUNET_GE_Confirm confirm);
/**
* Free a log context.
*/
-void GE_free_context (struct GE_Context *ctx);
+void GNUNET_GE_free_context (struct GNUNET_GE_Context *ctx);
/**
* Does the given event match the mask?
@@ -167,7 +167,7 @@
* @param mask the filter mask
* @return GNUNET_YES or GNUNET_NO
*/
-int GE_applies (GE_KIND have, GE_KIND mask);
+int GNUNET_GE_applies (GNUNET_GE_KIND have, GNUNET_GE_KIND mask);
/**
* Would an event of this kind be possibly
@@ -177,47 +177,47 @@
* @param have the kind of event
* @return GNUNET_YES or GNUNET_NO
*/
-int GE_isLogged (struct GE_Context *ctx, GE_KIND kind);
+int GNUNET_GE_isLogged (struct GNUNET_GE_Context *ctx, GNUNET_GE_KIND kind);
/**
* Convert a textual description of a loglevel
- * to the respective GE_KIND.
- * @returns GE_INVALID if log does not parse
+ * to the respective GNUNET_GE_KIND.
+ * @returns GNUNET_GE_INVALID if log does not parse
*/
-GE_KIND GE_getKIND (const char *log);
+GNUNET_GE_KIND GNUNET_GE_getKIND (const char *log);
/**
* Convert KIND to String
*/
-const char *GE_kindToString (GE_KIND kind);
+const char *GNUNET_GE_kindToString (GNUNET_GE_KIND kind);
/**
* Create a context that sends events to two other contexts.
* Note that the client must stop using ctx1/ctx2 henceforth.
*/
-struct GE_Context *GE_create_context_multiplexer (struct GE_Context *ctx1,
- struct GE_Context *ctx2);
+struct GNUNET_GE_Context *GNUNET_GE_create_context_multiplexer (struct
GNUNET_GE_Context *ctx1,
+ struct GNUNET_GE_Context
*ctx2);
-const char *GE_strerror (int errnum);
+const char *GNUNET_GE_strerror (int errnum);
/**
* If this context would log an event of the given kind,
* execute statement "a".
*/
-#define IF_GELOG(ctx, kind, a) do { if (GE_isLogged(ctx, kind)) { a; } }
while(0)
+#define IF_GELOG(ctx, kind, a) do { if (GNUNET_GE_isLogged(ctx, kind)) { a; }
} while(0)
/**
* Use this for fatal errors that cannot be handled
*/
-#define GE_ASSERT(ctx, cond) do { if (! (cond)) { GE_LOG(ctx, (GE_KIND)
(GE_DEVELOPER | GE_USER | GE_FATAL | GE_IMMEDIATE), _("Internal error:
assertion failed at %s:%d in %s.\n"), __FILE__, __LINE__, __FUNCTION__);
GE_CONFIRM(ctx); abort(); } } while(0)
+#define GNUNET_GE_ASSERT(ctx, cond) do { if (! (cond)) { GNUNET_GE_LOG(ctx,
(GNUNET_GE_KIND) (GNUNET_GE_DEVELOPER | GNUNET_GE_USER | GNUNET_GE_FATAL |
GNUNET_GE_IMMEDIATE), _("Internal error: assertion failed at %s:%d in %s.\n"),
__FILE__, __LINE__, __FUNCTION__); GNUNET_GE_CONFIRM(ctx); abort(); } } while(0)
-#define GE_ASSERT_FLF(ctx, cond, file, line, function) do { if (! (cond)) {
GE_LOG(ctx, (GE_KIND) (GE_DEVELOPER | GE_USER | GE_FATAL | GE_IMMEDIATE),
_("Internal error: assertion failed at %s:%d in %s.\n"), file, line, function);
GE_CONFIRM(ctx); abort(); } } while(0)
+#define GNUNET_GE_ASSERT_FLF(ctx, cond, file, line, function) do { if (!
(cond)) { GNUNET_GE_LOG(ctx, (GNUNET_GE_KIND) (GNUNET_GE_DEVELOPER |
GNUNET_GE_USER | GNUNET_GE_FATAL | GNUNET_GE_IMMEDIATE), _("Internal error:
assertion failed at %s:%d in %s.\n"), file, line, function);
GNUNET_GE_CONFIRM(ctx); abort(); } } while(0)
/**
* Use this for internal assertion violations that are
* not fatal (can be handled) but should not occur.
*/
-#define GE_BREAK(ctx, cond) do { if (! (cond)) { GE_LOG(ctx, (GE_KIND)
(GE_DEVELOPER | GE_USER | GE_FATAL | GE_IMMEDIATE), _("Internal error:
assertion failed at %s:%d in %s.\n"), __FILE__, __LINE__, __FUNCTION__); } }
while(0)
+#define GNUNET_GE_BREAK(ctx, cond) do { if (! (cond)) { GNUNET_GE_LOG(ctx,
(GNUNET_GE_KIND) (GNUNET_GE_DEVELOPER | GNUNET_GE_USER | GNUNET_GE_FATAL |
GNUNET_GE_IMMEDIATE), _("Internal error: assertion failed at %s:%d in %s.\n"),
__FILE__, __LINE__, __FUNCTION__); } } while(0)
/**
* Use this for assertion violations caused by other
@@ -227,55 +227,55 @@
* we still want to see these problems during
* development and testing. "OP == other peer".
*/
-#define GE_BREAK_OP(ctx, cond) do { if (! (cond)) { GE_LOG(ctx, (GE_KIND)
(GE_DEVELOPER | GE_FATAL | GE_IMMEDIATE), _("External protocol violation:
assertion failed at %s:%d in %s (no need to panic, we can handle this).\n"),
__FILE__, __LINE__, __FUNCTION__); } } while(0)
+#define GNUNET_GE_BREAK_OP(ctx, cond) do { if (! (cond)) { GNUNET_GE_LOG(ctx,
(GNUNET_GE_KIND) (GNUNET_GE_DEVELOPER | GNUNET_GE_FATAL | GNUNET_GE_IMMEDIATE),
_("External protocol violation: assertion failed at %s:%d in %s (no need to
panic, we can handle this).\n"), __FILE__, __LINE__, __FUNCTION__); } } while(0)
/**
- * Just like GE_BREAK just with file/line/function
+ * Just like GNUNET_GE_BREAK just with file/line/function
* information given as part of the call.
*/
-#define GE_BREAK_FLF(ctx, cond, file, line, function) do { if (! (cond)) {
GE_LOG(ctx, (GE_KIND) (GE_DEVELOPER | GE_USER | GE_FATAL | GE_IMMEDIATE),
_("Internal error: assertion failed at %s:%d in %s.\n"), file, line, function);
} } while(0)
+#define GNUNET_GE_BREAK_FLF(ctx, cond, file, line, function) do { if (!
(cond)) { GNUNET_GE_LOG(ctx, (GNUNET_GE_KIND) (GNUNET_GE_DEVELOPER |
GNUNET_GE_USER | GNUNET_GE_FATAL | GNUNET_GE_IMMEDIATE), _("Internal error:
assertion failed at %s:%d in %s.\n"), file, line, function); } } while(0)
/**
* Log an error message at log-level 'level' that indicates
* a failure of the command 'cmd' with the message given
* by strerror(errno).
*/
-#define GE_LOG_STRERROR(ctx, level, cmd) do { GE_LOG(ctx, level, _("`%s'
failed at %s:%d in %s with error: %s\n"), cmd, __FILE__, __LINE__,
__FUNCTION__, STRERROR(errno)); } while(0)
+#define GNUNET_GE_LOG_STRERROR(ctx, level, cmd) do { GNUNET_GE_LOG(ctx, level,
_("`%s' failed at %s:%d in %s with error: %s\n"), cmd, __FILE__, __LINE__,
__FUNCTION__, STRERROR(errno)); } while(0)
/**
* Log an error message at log-level 'level' that indicates
* a failure of the command 'cmd' with the message given
* by strerror(errno).
*/
-#define GE_DIE_STRERROR(ctx, level, cmd) do { GE_LOG(ctx, level, _("`%s'
failed at %s:%d in %s with error: %s\n"), cmd, __FILE__, __LINE__,
__FUNCTION__, STRERROR(errno)); GE_CONFIRM(ctx); abort(); } while(0)
+#define GNUNET_GE_DIE_STRERROR(ctx, level, cmd) do { GNUNET_GE_LOG(ctx, level,
_("`%s' failed at %s:%d in %s with error: %s\n"), cmd, __FILE__, __LINE__,
__FUNCTION__, STRERROR(errno)); GNUNET_GE_CONFIRM(ctx); abort(); } while(0)
/**
* Log an error message at log-level 'level' that indicates
* a failure of the command 'cmd' with the message given
* by strerror(errno).
*/
-#define GE_DIE_STRERROR_FLF(ctx, level, cmd, file, line, function) do {
GE_LOG(ctx, level, _("`%s' failed at %s:%d in %s with error: %s\n"), cmd, file,
line, function, STRERROR(errno)); GE_CONFIRM(ctx); abort(); } while(0)
+#define GNUNET_GE_DIE_STRERROR_FLF(ctx, level, cmd, file, line, function) do {
GNUNET_GE_LOG(ctx, level, _("`%s' failed at %s:%d in %s with error: %s\n"),
cmd, file, line, function, STRERROR(errno)); GNUNET_GE_CONFIRM(ctx); abort(); }
while(0)
/**
* Log an error message at log-level 'level' that indicates
* a failure of the command 'cmd' with the message given
* by strerror(errno).
*/
-#define GE_LOG_STRERROR_FLF(ctx, level, cmd, file, line, function) do {
GE_LOG(ctx, level, _("`%s' failed at %s:%d in %s with error: %s\n"), cmd, file,
line, function, STRERROR(errno)); } while(0)
+#define GNUNET_GE_LOG_STRERROR_FLF(ctx, level, cmd, file, line, function) do {
GNUNET_GE_LOG(ctx, level, _("`%s' failed at %s:%d in %s with error: %s\n"),
cmd, file, line, function, STRERROR(errno)); } while(0)
/**
* Log an error message at log-level 'level' that indicates
* a failure of the command 'cmd' with the message given
* by strerror(errno).
*/
-#define GE_LOG_STRERROR_FILE(ctx, level, cmd, filename) do { GE_LOG(ctx,
level, _("`%s' failed on file `%s' at %s:%d in %s with error: %s\n"), cmd,
filename,__FILE__, __LINE__, __FUNCTION__, STRERROR(errno)); } while(0)
+#define GNUNET_GE_LOG_STRERROR_FILE(ctx, level, cmd, filename) do {
GNUNET_GE_LOG(ctx, level, _("`%s' failed on file `%s' at %s:%d in %s with
error: %s\n"), cmd, filename,__FILE__, __LINE__, __FUNCTION__,
STRERROR(errno)); } while(0)
/**
* Die with an error message that indicates
* a failure of the command 'cmd' on file 'filename'
* with the message given by strerror(errno).
*/
-#define GE_DIE_STRERROR_FILE(ctx, level, cmd, filename) do { GE_LOG(ctx,
level, _("`%s' failed on file `%s' at %s:%d in %s with error: %s\n"), cmd,
filename,__FILE__, __LINE__, __FUNCTION__, STRERROR(errno)); GE_CONFIRM(ctx);
abort(); } while(0)
+#define GNUNET_GE_DIE_STRERROR_FILE(ctx, level, cmd, filename) do {
GNUNET_GE_LOG(ctx, level, _("`%s' failed on file `%s' at %s:%d in %s with
error: %s\n"), cmd, filename,__FILE__, __LINE__, __FUNCTION__,
STRERROR(errno)); GNUNET_GE_CONFIRM(ctx); abort(); } while(0)
#if 0 /* keep Emacsens' auto-indent happy */
Modified: GNUnet/src/include/gnunet_util_error_loggers.h
===================================================================
--- GNUnet/src/include/gnunet_util_error_loggers.h 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/include/gnunet_util_error_loggers.h 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -38,7 +38,7 @@
#include "gnunet_util_error.h"
-struct GE_Memory;
+struct GNUNET_GE_Memory;
/**
@@ -52,8 +52,8 @@
* value specifies after how many days logs should be deleted)
* (use 0 for no rotation)
*/
-struct GE_Context *GE_create_context_logfile (struct GE_Context *ectx,
- GE_KIND mask,
+struct GNUNET_GE_Context *GNUNET_GE_create_context_logfile (struct
GNUNET_GE_Context *ectx,
+ GNUNET_GE_KIND mask,
const char *filename,
const char *owner,
int logDate, int logrotate);
@@ -64,21 +64,21 @@
*
* @param mask which events should be logged?
*/
-struct GE_Context *GE_create_context_stderr (int logDate, GE_KIND mask);
+struct GNUNET_GE_Context *GNUNET_GE_create_context_stderr (int logDate,
GNUNET_GE_KIND mask);
/**
* Create a logger that writes events to stderr
*
* @param mask which events should be logged?
*/
-struct GE_Context *GE_create_context_stdout (int logDate, GE_KIND mask);
+struct GNUNET_GE_Context *GNUNET_GE_create_context_stdout (int logDate,
GNUNET_GE_KIND mask);
/**
* Create a logger that keeps events in memory (to be
* queried later in bulk).
*/
-struct GE_Context *GE_create_context_memory (GE_KIND mask,
- struct GE_Memory *memory);
+struct GNUNET_GE_Context *GNUNET_GE_create_context_memory (GNUNET_GE_KIND mask,
+ struct GNUNET_GE_Memory *memory);
#if FICTION
/**
@@ -87,11 +87,11 @@
* @param server hostname of SMTP gateway, NULL for using local "mail" command
* @param port port to use for SMTP
* @param logDate should the date be each of the log lines?
- * @param bulkSize for GE_BULK messages, how many lines of messages
+ * @param bulkSize for GNUNET_GE_BULK messages, how many lines of messages
* should be accumulated before an e-mail is transmitted?
*/
-struct GE_Context *GE_create_context_email (struct GE_Context *ectx,
- GE_KIND mask,
+struct GNUNET_GE_Context *GNUNET_GE_create_context_email (struct
GNUNET_GE_Context *ectx,
+ GNUNET_GE_KIND mask,
const char *address,
const char *server,
unsigned short port,
@@ -110,23 +110,23 @@
* (if more than maxSize messages are received, message number maxSize
* will be set to a corresponding warning)
*/
-struct GE_Memory *GE_memory_create (unsigned int maxSize);
+struct GNUNET_GE_Memory *GNUNET_GE_memory_create (unsigned int maxSize);
/**
* For all messages stored in the memory, call the handler.
* Also clears the memory.
*/
-void GE_memory_poll (struct GE_Memory *memory,
- GE_LogHandler handler, void *ctx);
+void GNUNET_GE_memory_poll (struct GNUNET_GE_Memory *memory,
+ GNUNET_GE_LogHandler handler, void *ctx);
-void GE_memory_reset (struct GE_Memory *memory);
+void GNUNET_GE_memory_reset (struct GNUNET_GE_Memory *memory);
/**
* Get a particular log message from the store.
*/
-const char *GE_memory_get (struct GE_Memory *memory, unsigned int index);
+const char *GNUNET_GE_memory_get (struct GNUNET_GE_Memory *memory, unsigned
int index);
-void GE_memory_free (struct GE_Memory *memory);
+void GNUNET_GE_memory_free (struct GNUNET_GE_Memory *memory);
#if 0 /* keep Emacsens' auto-indent happy */
Modified: GNUnet/src/include/gnunet_util_getopt.h
===================================================================
--- GNUnet/src/include/gnunet_util_getopt.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_util_getopt.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -77,12 +77,12 @@
/**
* For logging errors
*/
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
/**
* For configuration
*/
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
} GNUNET_CommandLineProcessorContext;
@@ -205,8 +205,8 @@
* argument, or -1 on error
*/
int GNUNET_parse_options (const char *binaryName,
- struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const GNUNET_CommandLineOption * allOptions,
unsigned int argc, char *const *argv);
Modified: GNUnet/src/include/gnunet_util_network.h
===================================================================
--- GNUnet/src/include/gnunet_util_network.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_util_network.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -124,7 +124,7 @@
{
/**
- * The CS header (values: sizeof(CS_returnvalue_MESSAGE) + error-size,
CS_PROTO_RETURN_VALUE)
+ * The CS header (values: sizeof(CS_returnvalue_MESSAGE) + error-size,
GNUNET_CS_PROTO_RETURN_VALUE)
*/
GNUNET_MessageHeader header;
@@ -142,14 +142,14 @@
{
/**
- * The CS header (values: sizeof(CS_returnvalue_MESSAGE) + error-size,
CS_PROTO_RETURN_VALUE)
+ * The CS header (values: sizeof(CS_returnvalue_MESSAGE) + error-size,
GNUNET_CS_PROTO_RETURN_VALUE)
*/
GNUNET_MessageHeader header;
/**
* The return value (network byte order)
*/
- GE_KIND kind;
+ GNUNET_GE_KIND kind;
} GNUNET_MessageReturnErrorMessage;
@@ -266,7 +266,7 @@
* @return the converted list, NULL if the synatx is flawed
*/
struct GNUNET_IPv4NetworkSet *GNUNET_parse_ipv4_network_specification (struct
-
GE_Context
+
GNUNET_GE_Context
*ectx,
const
char
@@ -284,7 +284,7 @@
* @return the converted list, NULL if the synatx is flawed
*/
struct GNUNET_IPv6NetworkSet *GNUNET_parse_ipv6_network_specification (struct
-
GE_Context
+
GNUNET_GE_Context
*ectx,
const
char
@@ -320,7 +320,7 @@
*
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int GNUNET_get_host_by_name (struct GE_Context *ectx,
+int GNUNET_get_host_by_name (struct GNUNET_GE_Context *ectx,
const char *hostname, GNUNET_IPv4Address * ip);
/* ********************* low-level socket operations **************** */
@@ -330,7 +330,7 @@
* The OS socket should henceforth be no longer used
* directly. GNUNET_socket_destroy will close it.
*/
-struct GNUNET_SocketHandle *socket_create (struct GE_Context *ectx,
+struct GNUNET_SocketHandle *socket_create (struct GNUNET_GE_Context *ectx,
struct GNUNET_LoadMonitor *mon,
int osSocket);
@@ -436,7 +436,7 @@
*/
struct GNUNET_SelectHandle *GNUNET_select_create (const char *desc,
int is_udp,
- struct GE_Context *ectx,
+ struct GNUNET_GE_Context
*ectx,
struct GNUNET_LoadMonitor
*mon, int sock,
unsigned int max_addr_len,
@@ -535,8 +535,8 @@
* Get the IP address for the local machine.
* @return NULL on error, IP as string otherwise
*/
-char *GNUNET_get_local_ip (struct GC_Configuration *cfg,
- struct GE_Context *ectx,
+char *GNUNET_get_local_ip (struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
GNUNET_IPv4Address * addr);
@@ -545,7 +545,7 @@
* to non-blocking IO.
* @return GNUNET_OK on success
*/
-int GNUNET_pipe_make_nonblocking (struct GE_Context *ectx, int pipe);
+int GNUNET_pipe_make_nonblocking (struct GNUNET_GE_Context *ectx, int pipe);
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_util_network_client.h
===================================================================
--- GNUnet/src/include/gnunet_util_network_client.h 2007-11-25 03:50:33 UTC
(rev 5754)
+++ GNUnet/src/include/gnunet_util_network_client.h 2007-11-25 12:04:45 UTC
(rev 5755)
@@ -48,10 +48,10 @@
* Get a connection with gnunetd.
*/
struct GNUNET_ClientServerConnection *GNUNET_client_connection_create (struct
-
GE_Context
+
GNUNET_GE_Context
*ectx,
struct
-
GC_Configuration
+
GNUNET_GC_Configuration
*cfg);
/**
@@ -185,13 +185,13 @@
/**
* Checks if gnunetd is running
*
- * Uses CS_PROTO_traffic_COUNT query to determine if gnunetd is
+ * Uses GNUNET_CS_PROTO_TRAFFIC_COUNT query to determine if gnunetd is
* running.
*
* @return GNUNET_OK if gnunetd is running, GNUNET_SYSERR if not
*/
-int GNUNET_test_daemon_running (struct GE_Context *ectx,
- struct GC_Configuration *cfg);
+int GNUNET_test_daemon_running (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg);
/**
* Wait until the gnunet daemon is
@@ -200,8 +200,8 @@
* @param timeout how long to wait at most in ms
* @return GNUNET_OK if gnunetd is now running
*/
-int GNUNET_wait_for_daemon_running (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+int GNUNET_wait_for_daemon_running (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
GNUNET_CronTime timeout);
#if 0 /* keep Emacsens' auto-indent happy */
Modified: GNUnet/src/include/gnunet_util_os.h
===================================================================
--- GNUnet/src/include/gnunet_util_os.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/include/gnunet_util_os.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -85,7 +85,7 @@
struct GNUNET_LoadMonitor;
-struct GNUNET_IPC_Semaphore *GNUNET_IPC_semaphore_create (struct GE_Context
+struct GNUNET_IPC_Semaphore *GNUNET_IPC_semaphore_create (struct
GNUNET_GE_Context
*ectx,
const char
*basename,
@@ -105,7 +105,7 @@
/**
* Load plugin
*/
-struct GNUNET_PluginHandle *GNUNET_plugin_load (struct GE_Context *ectx,
+struct GNUNET_PluginHandle *GNUNET_plugin_load (struct GNUNET_GE_Context *ectx,
const char *libprefix,
const char *dsoname);
@@ -123,10 +123,10 @@
void GNUNET_plugin_unload (struct GNUNET_PluginHandle *plugin);
-struct GNUNET_LoadMonitor *GNUNET_network_monitor_create (struct GE_Context
+struct GNUNET_LoadMonitor *GNUNET_network_monitor_create (struct
GNUNET_GE_Context
*ectx,
struct
- GC_Configuration
+
GNUNET_GC_Configuration
*cfg);
void GNUNET_network_monitor_destroy (struct GNUNET_LoadMonitor *mon);
@@ -163,7 +163,7 @@
* @brief Enumerate all network interfaces
* @param callback the callback function
*/
-void GNUNET_list_network_interfaces (struct GE_Context *ectx,
+void GNUNET_list_network_interfaces (struct GNUNET_GE_Context *ectx,
GNUNET_NetworkInterfaceProcessor proc,
void *cls);
@@ -171,13 +171,13 @@
* @brief Set maximum number of open file descriptors
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int GNUNET_set_fd_limit (struct GE_Context *ectx, int n);
+int GNUNET_set_fd_limit (struct GNUNET_GE_Context *ectx, int n);
/**
* Set our process priority
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int GNUNET_set_process_priority (struct GE_Context *ectx, const char *str);
+int GNUNET_set_process_priority (struct GNUNET_GE_Context *ectx, const char
*str);
/**
* @brief Make "application" start automatically
@@ -209,7 +209,7 @@
* Unix
* 2 startup script could not be opened
*/
-int GNUNET_configure_autostart (struct GE_Context *ectx,
+int GNUNET_configure_autostart (struct GNUNET_GE_Context *ectx,
int testCapability,
int doAutoStart,
const char *application,
@@ -241,12 +241,12 @@
* user
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int GNUNET_change_user (struct GE_Context *ectx, const char *user);
+int GNUNET_change_user (struct GNUNET_GE_Context *ectx, const char *user);
/**
* @brief Change owner of a file
*/
-int GNUNET_file_change_owner (struct GE_Context *ectx,
+int GNUNET_file_change_owner (struct GNUNET_GE_Context *ectx,
const char *filename, const char *user);
/**
@@ -256,8 +256,8 @@
* @return -1 on error, otherwise load value (between 0 and 100,
* (100 is equivalent to full load for one CPU)
*/
-int GNUNET_cpu_get_load (struct GE_Context *ectx,
- struct GC_Configuration *cfg);
+int GNUNET_cpu_get_load (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg);
/**
* Get the current IO load.
@@ -268,8 +268,8 @@
* 100 means that we spend all of our cycles waiting for
* the disk)
*/
-int GNUNET_disk_get_load (struct GE_Context *ectx,
- struct GC_Configuration *cfg);
+int GNUNET_disk_get_load (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg);
/**
* Start gnunetd process
@@ -279,8 +279,8 @@
* @return pid_t of gnunetd if NOT daemonized, 0 if
* daemonized sucessfully, -1 on error
*/
-int GNUNET_daemon_start (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+int GNUNET_daemon_start (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *cfgFile, int daemonize);
/**
@@ -294,7 +294,7 @@
* failed, GNUNET_NO if gnunetd shutdown with
* some error
*/
-int GNUNET_daemon_stop (struct GE_Context *ectx, int pid);
+int GNUNET_daemon_stop (struct GNUNET_GE_Context *ectx, int pid);
/**
* List of install paths
@@ -324,15 +324,15 @@
*
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int GNUNET_pid_file_write (struct GE_Context *ectx,
- struct GC_Configuration *cfg, unsigned int pid);
+int GNUNET_pid_file_write (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg, unsigned int
pid);
/**
* Delete the PID file (to be called when the daemon
* shuts down)
*/
-int GNUNET_pid_file_delete (struct GE_Context *ectx,
- struct GC_Configuration *cfg);
+int GNUNET_pid_file_delete (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg);
/**
@@ -343,14 +343,14 @@
* @param filedes pointer to an array of 2 file descriptors
* to complete the detachment protocol (handshake)
*/
-int GNUNET_terminal_detach (struct GE_Context *ectx,
- struct GC_Configuration *cfg, int *filedes);
+int GNUNET_terminal_detach (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg, int *filedes);
/**
* Complete the handshake of detaching from the terminal.
* @param success use GNUNET_NO for error, GNUNET_YES for successful start
*/
-void GNUNET_terminal_detach_complete (struct GE_Context *ectx,
+void GNUNET_terminal_detach_complete (struct GNUNET_GE_Context *ectx,
int *filedes, int success);
/**
@@ -358,7 +358,7 @@
* @param ectx logging context, NULL means stderr
* @returns GNUNET_OK on success, GNUNET_SYSERR otherwise
*/
-int GNUNET_os_init (struct GE_Context *ectx);
+int GNUNET_os_init (struct GNUNET_GE_Context *ectx);
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_util_string.h
===================================================================
--- GNUnet/src/include/gnunet_util_string.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/include/gnunet_util_string.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -172,7 +172,7 @@
*
* @return the converted string (0-terminated)
*/
-char *GNUNET_convert_string_to_utf8 (struct GE_Context *ectx,
+char *GNUNET_convert_string_to_utf8 (struct GNUNET_GE_Context *ectx,
const char *input,
size_t len, const char *charset);
@@ -184,7 +184,7 @@
* @returns the full file name,
* NULL is returned on error
*/
-char *GNUNET_expand_file_name (struct GE_Context *ectx, const char *fil);
+char *GNUNET_expand_file_name (struct GNUNET_GE_Context *ectx, const char
*fil);
/* ************** internal implementations, use macros above! ************** */
Modified: GNUnet/src/include/plibc.h
===================================================================
--- GNUnet/src/include/plibc.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/include/plibc.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -65,7 +65,7 @@
/* Conflicts with our definitions */
#define __G_WIN32_H__
-/* Convert LARGE_INTEGER to double */
+/* Convert LARGNUNET_GE_INTEGER to double */
#define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \
(double)((x).LowPart))
@@ -263,10 +263,10 @@
typedef struct
{
- LARGE_INTEGER IdleTime;
- LARGE_INTEGER KernelTime;
- LARGE_INTEGER UserTime;
- LARGE_INTEGER Reserved1[2];
+ LARGNUNET_GE_INTEGER IdleTime;
+ LARGNUNET_GE_INTEGER KernelTime;
+ LARGNUNET_GE_INTEGER UserTime;
+ LARGNUNET_GE_INTEGER Reserved1[2];
ULONG Reserved2;
} SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/server/connection.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -249,7 +249,7 @@
/**
* The callback method.
*/
- BufferFillCallback callback;
+ GNUNET_BufferFillCallback callback;
/**
* Minimum number of bytes that must be available
@@ -262,7 +262,7 @@
typedef struct fENHWrap
{
- PerNodeCallback method;
+ GNUNET_NodeIteratorCallback method;
void *arg;
} fENHWrap;
@@ -328,7 +328,7 @@
/**
* callback to call to create the message part
*/
- BuildMessageCallback callback;
+ GNUNET_BuildMessageCallback callback;
/**
* argument to callback, call GNUNET_free_non_null(closure) if we
@@ -362,7 +362,7 @@
/**
* The session handle specific for the transport service.
*/
- TSession *tsession;
+ GNUNET_TSession *tsession;
} Session;
@@ -542,32 +542,32 @@
/**
* Transport service
*/
-static Transport_ServiceAPI *transport;
+static GNUNET_Transport_ServiceAPI *transport;
/**
* Identity service
*/
-static Identity_ServiceAPI *identity;
+static GNUNET_Identity_ServiceAPI *identity;
/**
* Session service
*/
-static Session_ServiceAPI *session;
+static GNUNET_Session_ServiceAPI *session;
/**
* Fragmentation service
*/
-static Fragmentation_ServiceAPI *fragmentation;
+static GNUNET_Fragmentation_ServiceAPI *fragmentation;
/**
* Topology service
*/
-static Topology_ServiceAPI *topology;
+static GNUNET_Topology_ServiceAPI *topology;
/**
* Stats service (maybe NULL!)
*/
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
/**
* The buffer containing all current connections.
@@ -611,11 +611,11 @@
/**
* Registered Send-Notify handlers.
*/
-static MessagePartHandler *rsns;
+static GNUNET_P2PRequestHandler *rsns;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static struct GNUNET_LoadMonitor *load_monitor;
@@ -674,7 +674,7 @@
while (NULL != root)
{
if (root->session.tsession != NULL)
- GE_ASSERT (NULL,
+ GNUNET_GE_ASSERT (NULL,
GNUNET_OK ==
transport->assertAssociated (root->session.tsession,
__FILE__));
@@ -867,7 +867,7 @@
for (i = 0; i < count; i++)
if (entries[i]->len > 0)
max = gcd (max, entries[i]->len);
- GE_ASSERT (ectx, max != 0);
+ GNUNET_GE_ASSERT (ectx, max != 0);
available = available / max;
for (i = 0; i < count; i++)
efflen[i] = entries[i]->len / max;
@@ -930,7 +930,7 @@
}
}
}
- GE_ASSERT (ectx, j == 0);
+ GNUNET_GE_ASSERT (ectx, j == 0);
GNUNET_free (v);
GNUNET_free (efflen);
@@ -959,7 +959,7 @@
return GNUNET_SYSERR; /* => always drop */
if (load > 100)
{
- if (priority >= EXTREME_PRIORITY)
+ if (priority >= GNUNET_EXTREME_PRIORITY)
return GNUNET_OK; /* allow administrative msgs */
return GNUNET_SYSERR; /* but nothing else */
}
@@ -970,8 +970,8 @@
if (delta * delta * delta > priority)
{
#if DEBUG_POLICY
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Network load is too high (%d%%, priority is %u, require %d), "
"dropping outgoing.\n", load, priority, delta * delta * delta);
#endif
@@ -980,8 +980,8 @@
else
{
#if DEBUG_POLICY
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Network load is ok (%d%%, priority is %u >= %d), "
"sending outgoing.\n", load, priority, delta * delta * delta);
#endif
@@ -1003,7 +1003,7 @@
unsigned int i;
for (i = 0; i < be->sendBufferSize; i++)
- if (be->sendBuffer[i]->pri >= EXTREME_PRIORITY)
+ if (be->sendBuffer[i]->pri >= GNUNET_EXTREME_PRIORITY)
return GNUNET_OK;
if (be->max_bpm == 0)
@@ -1040,8 +1040,8 @@
if (be->lastSendAttempt + msf > GNUNET_get_time ())
{
#if DEBUG_CONNECTION
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Send frequency too high (CPU load), send deferred.\n");
#endif
return GNUNET_NO; /* frequency too high, wait */
@@ -1083,7 +1083,7 @@
{
entry = be->sendBuffer[i];
if ((totalMessageSize + entry->len < GNUNET_MAX_BUFFER_SIZE - 64) &&
- (entry->pri >= EXTREME_PRIORITY))
+ (entry->pri >= GNUNET_EXTREME_PRIORITY))
{
entry->knapsackSolution = GNUNET_YES;
if (entry->transmissionTime < deadline)
@@ -1132,7 +1132,7 @@
i++;
}
if ((totalMessageSize == sizeof (P2P_PACKET_HEADER)) ||
- (((*priority) < EXTREME_PRIORITY) &&
+ (((*priority) < GNUNET_EXTREME_PRIORITY) &&
((totalMessageSize / sizeof (P2P_PACKET_HEADER)) < 4) &&
(deadline > GNUNET_get_time () + 500 * GNUNET_CRON_MILLISECONDS) &&
(GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 16) != 0)))
@@ -1199,9 +1199,9 @@
if ((j == 0) ||
(totalMessageSize > be->session.mtu - sizeof (P2P_PACKET_HEADER)))
{
- GE_BREAK (ectx, 0);
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_DEVELOPER,
+ GNUNET_GE_BREAK (ectx, 0);
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_DEVELOPER,
_("`%s' selected %d out of %d messages (MTU: %d).\n"),
__FUNCTION__,
j,
@@ -1209,8 +1209,8 @@
be->session.mtu - sizeof (P2P_PACKET_HEADER));
for (j = 0; j < be->sendBufferSize; j++)
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_DEVELOPER,
_("Message details: %u: length %d, priority: %d\n"),
j, be->sendBuffer[j]->len, be->sendBuffer[j]->pri);
return 0;
@@ -1220,12 +1220,12 @@
{
/* if we have a very high priority, we may
want to ignore bandwidth availability (e.g. for HANGUP,
- which has EXTREME_PRIORITY) */
- if ((*priority) < EXTREME_PRIORITY)
+ which has GNUNET_EXTREME_PRIORITY) */
+ if ((*priority) < GNUNET_EXTREME_PRIORITY)
{
#if DEBUG_CONNECTION
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"bandwidth limits prevent sending (send window %u too
small).\n",
be->available_send_window);
#endif
@@ -1283,8 +1283,8 @@
if ((entry->transmissionTime <= expired) || (usedBytes > msgCap))
{
#if DEBUG_CONNECTION
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"expiring message, expired %ds ago, queue size is %llu
(bandwidth stressed)\n",
(int) ((GNUNET_get_time () -
entry->transmissionTime) / GNUNET_CRON_SECONDS),
@@ -1367,10 +1367,10 @@
hdr = (GNUNET_MessageHeader *) entry->closure;
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&be->session.sender.hashPubKey,
&enc));
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"Core selected message of type %u and size %u for sending
to peer `%s'.\n",
ntohs (hdr->type), ntohs (hdr->size), &enc);
}
@@ -1469,10 +1469,10 @@
for (i = 0; i < be->sendBufferSize; i++)
{
entry = be->sendBuffer[i];
- GE_ASSERT (ectx, entry != NULL);
+ GNUNET_GE_ASSERT (ectx, entry != NULL);
if (entry->knapsackSolution == GNUNET_YES)
{
- GE_ASSERT (ectx, entry->callback == NULL);
+ GNUNET_GE_ASSERT (ectx, entry->callback == NULL);
GNUNET_free_non_null (entry->closure);
GNUNET_free (entry);
be->sendBuffer[i] = NULL;
@@ -1586,13 +1586,13 @@
int ret;
SendEntry **entries;
unsigned int stotal;
- TSession *tsession;
+ GNUNET_TSession *tsession;
ENTRY ();
/* fast ways out */
if (be == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
if ((be->status != STAT_UP) ||
@@ -1621,17 +1621,17 @@
}
if (totalMessageSize == 0)
totalMessageSize = EXPECTED_MTU + sizeof (P2P_PACKET_HEADER);
- GE_ASSERT (ectx, totalMessageSize > sizeof (P2P_PACKET_HEADER));
+ GNUNET_GE_ASSERT (ectx, totalMessageSize > sizeof (P2P_PACKET_HEADER));
if ((be->session.mtu != 0) && (totalMessageSize > be->session.mtu))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
be->inSendBuffer = GNUNET_NO;
return GNUNET_NO;
}
ret = transport->testWouldTry (be->session.tsession,
totalMessageSize,
(priority >=
- EXTREME_PRIORITY) ? GNUNET_YES : GNUNET_NO);
+ GNUNET_EXTREME_PRIORITY) ? GNUNET_YES :
GNUNET_NO);
/* ret: GNUNET_YES: ok to send, GNUNET_NO: not ready yet, GNUNET_SYSERR:
session down
or serious internal error */
if (ret == GNUNET_SYSERR)
@@ -1647,10 +1647,10 @@
#if DEBUG_CONNECTION
GNUNET_EncName enc;
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
GNUNET_hash_to_enc (&be->session.sender.hashPubKey,
&enc));
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_DEVELOPER,
"Session is DOWN for `%s' due to transport disconnect\n",
&enc);
#endif
@@ -1701,7 +1701,7 @@
if ((stotal == 0) || (entries == NULL))
{
/* no messages selected!? */
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
be->inSendBuffer = GNUNET_NO;
GNUNET_free (entries);
return GNUNET_NO;
@@ -1724,7 +1724,7 @@
{
SendEntry *entry = entries[i];
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
(entry != NULL) &&
(entry->knapsackSolution == GNUNET_YES) &&
(entry->callback == NULL) &&
@@ -1736,7 +1736,7 @@
entries = NULL;
if (p > totalMessageSize)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_free (plaintextMsg);
be->inSendBuffer = GNUNET_NO;
return GNUNET_NO;
@@ -1750,10 +1750,10 @@
{
rsi = pos->callback (&be->session.sender,
&plaintextMsg[p], totalMessageSize - p);
- GE_BREAK (ectx, rsi + p <= totalMessageSize);
+ GNUNET_GE_BREAK (ectx, rsi + p <= totalMessageSize);
if ((rsi + p < p) || (rsi + p > totalMessageSize))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_free (plaintextMsg);
be->inSendBuffer = GNUNET_NO;
return GNUNET_NO;
@@ -1765,7 +1765,7 @@
if (((be->session.mtu != 0) &&
(p > be->session.mtu)) || (p > totalMessageSize))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_free (plaintextMsg);
be->inSendBuffer = GNUNET_NO;
return GNUNET_NO;
@@ -1780,7 +1780,7 @@
unsigned short noiseLen = totalMessageSize - p;
part.size = htons (noiseLen);
- part.type = htons (P2P_PROTO_noise);
+ part.type = htons (GNUNET_P2P_PROTO_NOISE);
memcpy (&plaintextMsg[p], &part, sizeof (GNUNET_MessageHeader));
for (i = p + sizeof (GNUNET_MessageHeader); i < totalMessageSize; i++)
plaintextMsg[i] = (char) rand ();
@@ -1791,7 +1791,7 @@
if (((be->session.mtu != 0) &&
(p > be->session.mtu)) || (p > totalMessageSize))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_free (plaintextMsg);
be->inSendBuffer = GNUNET_NO;
return GNUNET_NO;
@@ -1806,9 +1806,9 @@
sequenceNumber);
if (stats != NULL)
stats->change (stat_encrypted, p - sizeof (GNUNET_HashCode));
- GE_ASSERT (ectx, be->session.tsession != NULL);
+ GNUNET_GE_ASSERT (ectx, be->session.tsession != NULL);
ret = transport->send (be->session.tsession, encryptedMsg, p, GNUNET_NO);
- if ((ret == GNUNET_NO) && (priority >= EXTREME_PRIORITY))
+ if ((ret == GNUNET_NO) && (priority >= GNUNET_EXTREME_PRIORITY))
{
ret =
transport->send (be->session.tsession, encryptedMsg, p, GNUNET_YES);
@@ -1835,7 +1835,7 @@
unsigned short plen = ntohs (MAKE_UNALIGNED (part->size));
if (plen < sizeof (GNUNET_MessageHeader))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
break;
}
for (rsi = 0; rsi < rsnSize; rsi++)
@@ -1850,10 +1850,10 @@
#if DEBUG_CONNECTION
GNUNET_EncName enc;
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
GNUNET_hash_to_enc (&be->session.sender.hashPubKey, &enc));
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"Session is DOWN for `%s' due to transmission error\n", &enc);
#endif
tsession = be->session.tsession;
@@ -1901,7 +1901,7 @@
ENTRY ();
if ((se == NULL) || (se->len == 0))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_free_non_null (se);
return;
}
@@ -1925,10 +1925,10 @@
connection, do NOT queue messages! */
#if DEBUG_CONNECTION
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&be->session.sender.hashPubKey, &enc));
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"not connected to `%s', message dropped\n", &enc);
#endif
GNUNET_free (se->closure);
@@ -1960,7 +1960,7 @@
}
/* grow send buffer, insertion sort! */
ne = GNUNET_malloc ((be->sendBufferSize + 1) * sizeof (SendEntry *));
- GE_ASSERT (ectx, se->len != 0);
+ GNUNET_GE_ASSERT (ectx, se->len != 0);
apri = (float) se->pri / (float) se->len;
i = 0;
while ((i < be->sendBufferSize) &&
@@ -2122,7 +2122,7 @@
{
P2P_hangup_MESSAGE hangup;
unsigned int i;
- TSession *tsession;
+ GNUNET_TSession *tsession;
#if DEBUG_CONNECTION
GNUNET_EncName enc;
#endif
@@ -2130,10 +2130,10 @@
ENTRY ();
#if DEBUG_CONNECTION
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&be->session.sender.hashPubKey, &enc));
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Shutting down connection with `%s'\n", &enc);
#endif
if (be->status == STAT_DOWN)
@@ -2144,20 +2144,20 @@
#if DEBUG_CONNECTION
GNUNET_EncName enc;
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
GNUNET_hash_to_enc (&be->session.sender.hashPubKey, &enc));
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"Session DOWN for `%s' due to HANGUP received\n", &enc);
#endif
- hangup.header.type = htons (P2P_PROTO_hangup);
+ hangup.header.type = htons (GNUNET_P2P_PROTO_HANG_UP);
hangup.header.size = htons (sizeof (P2P_hangup_MESSAGE));
identity->getPeerIdentity (identity->getPublicPrivateKey (),
&hangup.sender);
se = GNUNET_malloc (sizeof (SendEntry));
se->len = sizeof (P2P_hangup_MESSAGE);
se->flags = SE_FLAG_PLACE_TAIL;
- se->pri = EXTREME_PRIORITY;
+ se->pri = GNUNET_EXTREME_PRIORITY;
se->transmissionTime = GNUNET_get_time (); /* now */
se->callback = NULL;
se->closure = GNUNET_malloc (sizeof (P2P_hangup_MESSAGE));
@@ -2353,7 +2353,7 @@
schedulableBandwidth = schedulableBandwidth * 100 / load;
/* compute recent activity profile of the peer */
adjustedRR = GNUNET_malloc (sizeof (long long) * activePeerCount);
- GE_ASSERT (ectx, timeDifference != 0);
+ GNUNET_GE_ASSERT (ectx, timeDifference != 0);
for (u = 0; u < activePeerCount; u++)
{
adjustedRR[u]
@@ -2365,10 +2365,10 @@
if (adjustedRR[u] > entries[u]->idealized_limit)
{
IF_GELOG (ectx,
- GE_INFO | GE_BULK | GE_USER,
+ GNUNET_GE_INFO | GNUNET_GE_BULK | GNUNET_GE_USER,
GNUNET_hash_to_enc (&entries[u]->session.sender.
hashPubKey, &enc));
- GE_LOG (ectx, GE_INFO | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_INFO | GNUNET_GE_BULK |
GNUNET_GE_USER,
"peer `%s' transmitted above limit: %llu bpm > %u bpm\n",
&enc, adjustedRR[u], entries[u]->idealized_limit);
}
@@ -2388,10 +2388,10 @@
{
#if DEBUG_CONNECTION
IF_GELOG (ectx,
- GE_INFO | GE_BULK | GE_DEVELOPER,
+ GNUNET_GE_INFO | GNUNET_GE_BULK | GNUNET_GE_DEVELOPER,
GNUNET_hash_to_enc (&entries[u]->session.sender.
hashPubKey, &enc));
- GE_LOG (ectx, GE_INFO | GE_BULK | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_INFO | GNUNET_GE_BULK |
GNUNET_GE_DEVELOPER,
"blacklisting `%s': sent repeatedly %llu bpm "
"(limit %u bpm, target %u bpm)\n", &enc, adjustedRR[u],
entries[u]->max_transmitted_limit,
@@ -2605,10 +2605,10 @@
{
#if DEBUG_CONNECTION
IF_GELOG (ectx,
- GE_DEBUG | GE_BULK | GE_USER,
+ GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_USER,
GNUNET_hash_to_enc (&entries[u]->session.sender.hashPubKey,
&enc));
- GE_LOG (ectx, GE_DEBUG | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_USER,
"inbound limit for peer %u: %4s set to %u bpm (ARR: %lld,
uptime: %llus, value: %lf)\n",
u, &enc, entries[u]->idealized_limit, adjustedRR[u],
(GNUNET_get_time () -
@@ -2646,10 +2646,10 @@
{
#if DEBUG_CONNECTION
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
GNUNET_hash_to_enc (&be->session.sender.hashPubKey,
&enc));
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_DEVELOPER,
"Number of connections too high, shutting down low-traffic
connection to `%s' (had only %u bpm)\n",
&enc, be->idealized_limit);
#endif
@@ -2706,7 +2706,7 @@
unsigned long long total_send_buffer_size;
int load_nup;
int load_cpu;
- TSession *tsession;
+ GNUNET_TSession *tsession;
ENTRY ();
load_cpu = GNUNET_cpu_get_load (ectx, cfg);
@@ -2751,10 +2751,10 @@
/* switch state form UP to DOWN: too much inactivity */
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_DEVELOPER,
GNUNET_hash_to_enc (&root->session.sender.
hashPubKey, &enc));
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_DEVELOPER,
"Closing connection with `%s': "
"too much inactivity (%llu ms)\n", &enc,
now - root->isAlive);
@@ -2768,9 +2768,9 @@
if ((root->consider_transport_switch == GNUNET_YES)
&& (load_cpu < GNUNET_IDLE_LOAD_THRESHOLD))
{
- TSession *alternative;
+ GNUNET_TSession *alternative;
- GE_BREAK (NULL, root->session.mtu != 0);
+ GNUNET_GE_BREAK (NULL, root->session.mtu != 0);
alternative =
transport->connectFreely (&root->session.sender,
GNUNET_NO, __FILE__);
@@ -2820,7 +2820,7 @@
0, 5 * GNUNET_CRON_MINUTES);
if (mSize > hSize)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
hSize = 0;
}
else
@@ -2843,10 +2843,10 @@
GNUNET_EncName enc;
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_DEVELOPER,
GNUNET_hash_to_enc (&root->session.sender.
hashPubKey, &enc));
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_DEVELOPER,
"closing connection to %s: %s not answered.\n",
&enc,
(root->status ==
@@ -2906,15 +2906,15 @@
GNUNET_EncName enc;
ENTRY ();
- GE_ASSERT (ectx, msg != NULL);
- GE_ASSERT (ectx, sender != NULL);
+ GNUNET_GE_ASSERT (ectx, msg != NULL);
+ GNUNET_GE_ASSERT (ectx, sender != NULL);
if (size < sizeof (P2P_PACKET_HEADER))
{
IF_GELOG (ectx,
- GE_WARNING | GE_BULK | GE_DEVELOPER,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_DEVELOPER,
GNUNET_hash_to_enc (&sender->hashPubKey, &enc));
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_DEVELOPER,
_("Message from `%s' discarded: invalid format.\n"), &enc);
EXIT ();
return GNUNET_SYSERR;
@@ -2939,10 +2939,10 @@
{
#if DEBUG_CONNECTION
IF_GELOG (ectx,
- GE_INFO | GE_BULK | GE_DEVELOPER,
+ GNUNET_GE_INFO | GNUNET_GE_BULK | GNUNET_GE_DEVELOPER,
GNUNET_hash_to_enc (&sender->hashPubKey, &enc));
- GE_LOG (ectx,
- GE_INFO | GE_BULK | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_BULK | GNUNET_GE_DEVELOPER,
"Decrypting message from host `%s' failed, no sessionkey
(yet)!\n",
&enc);
#endif
@@ -2964,10 +2964,10 @@
{
#if DEBUG_CONNECTION
IF_GELOG (ectx,
- GE_INFO | GE_BULK | GE_DEVELOPER,
+ GNUNET_GE_INFO | GNUNET_GE_BULK | GNUNET_GE_DEVELOPER,
GNUNET_hash_to_enc (&sender->hashPubKey, &enc));
- GE_LOG (ectx,
- GE_INFO | GE_BULK | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_BULK | GNUNET_GE_DEVELOPER,
"Decrypting message from host `%s' failed, wrong sessionkey!\n",
&enc);
#endif
@@ -3000,8 +3000,8 @@
if (res == GNUNET_SYSERR)
{
#if DEBUG_CONNECTION
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
_("Invalid sequence number"
" %u <= %u, dropping message.\n"),
sequenceNumber, be->lastSequenceNumberReceived);
@@ -3022,8 +3022,8 @@
if (stamp + 1 * GNUNET_CRON_DAYS < GNUNET_get_time_int32 (NULL))
{
#if DEBUG_CONNECTION
- GE_LOG (ectx,
- GE_INFO | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Message received more than one day old. Dropped.\n"));
#endif
GNUNET_mutex_unlock (lock);
@@ -3073,10 +3073,10 @@
return GNUNET_SYSERR;
#if DEBUG_CONNECTION
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
GNUNET_hash_to_enc (&sender->hashPubKey, &enc));
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"received HANGUP from `%s'\n", &enc);
#endif
GNUNET_mutex_lock (lock);
@@ -3172,10 +3172,10 @@
#if DEBUG_CONNECTION
GNUNET_EncName enc;
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
GNUNET_hash_to_enc (&peer->hashPubKey, &enc));
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"Received confirmation that session is UP for `%s'\n",
&enc);
#endif
@@ -3328,18 +3328,18 @@
* @param sender the identity of the other node
*/
void
-considerTakeover (const GNUNET_PeerIdentity * sender, TSession * tsession)
+considerTakeover (const GNUNET_PeerIdentity * sender, GNUNET_TSession *
tsession)
{
BufferEntry *be;
unsigned int cost;
- TSession *ts;
+ GNUNET_TSession *ts;
ENTRY ();
if (tsession == NULL)
return;
if (0 != memcmp (sender, &tsession->peer, sizeof (GNUNET_PeerIdentity)))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return;
}
GNUNET_mutex_lock (lock);
@@ -3369,7 +3369,7 @@
(transport->getMTU (tsession->ttype) == 0))) &&
(GNUNET_OK == transport->associate (tsession, __FILE__)))
{
- GE_ASSERT (NULL,
+ GNUNET_GE_ASSERT (NULL,
GNUNET_OK == transport->assertAssociated (tsession,
__FILE__));
ts = be->session.tsession;
@@ -3399,8 +3399,8 @@
*/
static int
connectionConfigChangeCallback (void *ctx,
- struct GC_Configuration *cfg,
- struct GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
const char *section, const char *option)
{
unsigned long long new_max_bpm;
@@ -3408,10 +3408,10 @@
if (0 != strcmp (section, "LOAD"))
return 0; /* fast path */
- if (-1 == GC_get_configuration_value_number (cfg, "LOAD",
"MAXNETDOWNBPSTOTAL", 0, ((unsigned long long) -1) / 60, 50000, /* default:
50 kbps */
+ if (-1 == GNUNET_GC_get_configuration_value_number (cfg, "LOAD",
"MAXNETDOWNBPSTOTAL", 0, ((unsigned long long) -1) / 60, 50000, /* default:
50 kbps */
&new_max_bpm))
return GNUNET_SYSERR;
- GC_get_configuration_value_number (cfg, "LOAD", "MAXNETUPBPSTOTAL", 0,
((unsigned long long) -1) / 60, 50000, /* default: 50 kbps */
+ GNUNET_GC_get_configuration_value_number (cfg, "LOAD", "MAXNETUPBPSTOTAL",
0, ((unsigned long long) -1) / 60, 50000, /* default: 50 kbps */
&max_bpm_up);
max_bpm_up *= 60; /* bps -> bpm */
GNUNET_mutex_lock (lock);
@@ -3436,8 +3436,8 @@
olen = CONNECTION_MAX_HOSTS_;
CONNECTION_MAX_HOSTS_ = newMAXHOSTS;
- GE_BREAK (ectx,
- 0 == GC_set_configuration_value_number (cfg,
+ GNUNET_GE_BREAK (ectx,
+ 0 == GNUNET_GC_set_configuration_value_number (cfg,
ectx,
"gnunetd",
"connection-max-hosts",
@@ -3469,14 +3469,14 @@
GNUNET_free_non_null (CONNECTION_buffer_);
CONNECTION_buffer_ = newBuffer;
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"connection goal is %s%d peers (%llu BPM bandwidth
downstream)\n",
(olen == 0) ? "" : "now ", CONNECTION_MAX_HOSTS_, max_bpm);
}
}
- disable_random_padding = GC_get_configuration_value_yesno (cfg,
+ disable_random_padding = GNUNET_GC_get_configuration_value_yesno (cfg,
"GNUNETD-EXPERIMENTAL",
"PADDING",
GNUNET_NO);
@@ -3488,26 +3488,26 @@
* Initialize this module.
*/
void
-initConnection (struct GE_Context *e,
- struct GC_Configuration *c,
+initConnection (struct GNUNET_GE_Context *e,
+ struct GNUNET_GC_Configuration *c,
struct GNUNET_LoadMonitor *m, struct GNUNET_CronManager *cm)
{
ectx = e;
cfg = c;
load_monitor = m;
cron = cm;
- GE_ASSERT (ectx, P2P_MESSAGE_OVERHEAD == sizeof (P2P_PACKET_HEADER));
- GE_ASSERT (ectx, sizeof (P2P_hangup_MESSAGE) == 68);
+ GNUNET_GE_ASSERT (ectx, GNUNET_P2P_MESSAGNUNET_GE_OVERHEAD == sizeof
(P2P_PACKET_HEADER));
+ GNUNET_GE_ASSERT (ectx, sizeof (P2P_hangup_MESSAGE) == 68);
ENTRY ();
scl_nextHead = NULL;
scl_nextTail = NULL;
connectionConfigChangeCallback (NULL, cfg, ectx, "LOAD", "NOTHING");
- GE_ASSERT (ectx,
- 0 == GC_attach_change_listener (cfg,
+ GNUNET_GE_ASSERT (ectx,
+ 0 == GNUNET_GC_attach_change_listener (cfg,
&connectionConfigChangeCallback,
NULL));
- GE_ASSERT (ectx, CONNECTION_MAX_HOSTS_ != 0);
- registerp2pHandler (P2P_PROTO_hangup, &handleHANGUP);
+ GNUNET_GE_ASSERT (ectx, CONNECTION_MAX_HOSTS_ != 0);
+ registerp2pHandler (GNUNET_P2P_PROTO_HANG_UP, &handleHANGUP);
GNUNET_cron_add_job (cron,
&cronDecreaseLiveness, CDL_FREQUENCY, CDL_FREQUENCY,
NULL);
@@ -3516,15 +3516,15 @@
#endif
transport = requestService ("transport");
- GE_ASSERT (ectx, transport != NULL);
+ GNUNET_GE_ASSERT (ectx, transport != NULL);
identity = requestService ("identity");
- GE_ASSERT (ectx, identity != NULL);
+ GNUNET_GE_ASSERT (ectx, identity != NULL);
session = requestService ("session");
- GE_ASSERT (ectx, session != NULL);
+ GNUNET_GE_ASSERT (ectx, session != NULL);
fragmentation = requestService ("fragmentation");
- GE_ASSERT (ectx, fragmentation != NULL);
+ GNUNET_GE_ASSERT (ectx, fragmentation != NULL);
topology = requestService ("topology");
- GE_ASSERT (ectx, topology != NULL);
+ GNUNET_GE_ASSERT (ectx, topology != NULL);
stats = requestService ("stats");
if (stats != NULL)
{
@@ -3595,7 +3595,7 @@
SendCallbackList *scl;
ENTRY ();
- GC_detach_change_listener (cfg, &connectionConfigChangeCallback, NULL);
+ GNUNET_GC_detach_change_listener (cfg, &connectionConfigChangeCallback,
NULL);
GNUNET_cron_del_job (cron, &cronDecreaseLiveness, CDL_FREQUENCY, NULL);
for (i = 0; i < CONNECTION_MAX_HOSTS_; i++)
{
@@ -3606,8 +3606,8 @@
while (be != NULL)
{
#if DEBUG_CONNECTION
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Closing connection: shutdown\n");
#endif
shutdownConnection (be);
@@ -3663,7 +3663,7 @@
* @return number of connected nodes
*/
int
-forEachConnectedNode (PerNodeCallback method, void *arg)
+forEachConnectedNode (GNUNET_NodeIteratorCallback method, void *arg)
{
fENHWrap wrap;
int ret;
@@ -3711,8 +3711,8 @@
ttype = 0;
if (tmp->session.tsession != NULL)
ttype = tmp->session.tsession->ttype;
- GE_LOG (ectx,
- GE_INFO | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"CONNECTION-TABLE: %3d-%1d-%2d-%4ds"
" (of %ds) BPM %4llu %8ut-%3u: %s-%s-%s\n",
i,
@@ -3752,7 +3752,7 @@
*/
int
registerSendCallback (const unsigned int minimumPadding,
- BufferFillCallback callback)
+ GNUNET_BufferFillCallback callback)
{
SendCallbackList *scl;
@@ -3792,7 +3792,7 @@
*/
int
unregisterSendCallback (const unsigned int minimumPadding,
- BufferFillCallback callback)
+ GNUNET_BufferFillCallback callback)
{
SendCallbackList *pos;
SendCallbackList *prev;
@@ -3834,23 +3834,23 @@
* from the GNUnet core.
*
* @param session the transport session
- * @param msg the message to transmit, should contain MESSAGE_HEADERs
+ * @param msg the message to transmit, should contain MESSAGNUNET_GE_HEADERs
* @return GNUNET_OK on success, GNUNET_SYSERR on failure, GNUNET_NO on
temporary failure
*/
int
-sendPlaintext (TSession * tsession, const char *msg, unsigned int size)
+sendPlaintext (GNUNET_TSession * tsession, const char *msg, unsigned int size)
{
char *buf;
int ret;
P2P_PACKET_HEADER *hdr;
ENTRY ();
- GE_ASSERT (ectx, tsession != NULL);
+ GNUNET_GE_ASSERT (ectx, tsession != NULL);
if ((transport->getMTU (tsession->ttype) > 0) &&
(transport->getMTU (tsession->ttype) <
size + sizeof (P2P_PACKET_HEADER)))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
buf = GNUNET_malloc (size + sizeof (P2P_PACKET_HEADER));
@@ -3883,7 +3883,7 @@
*/
void
unicastCallback (const GNUNET_PeerIdentity * hostId,
- BuildMessageCallback callback,
+ GNUNET_BuildMessageCallback callback,
void *closure,
unsigned short len,
unsigned int importance, unsigned int maxdelay)
@@ -3943,8 +3943,8 @@
len = ntohs (msg->size);
if (len == 0)
{
- GE_LOG (ectx,
- GE_DEBUG | GE_BULK | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_DEVELOPER,
"Empty message send (hopefully used to initiate connection
attempt)\n");
EXIT ();
return;
@@ -3969,7 +3969,7 @@
ENTRY ();
res = (((unsigned int) hostId->hashPubKey.bits[0]) &
((unsigned int) (CONNECTION_MAX_HOSTS_ - 1)));
- GE_ASSERT (ectx, res < CONNECTION_MAX_HOSTS_);
+ GNUNET_GE_ASSERT (ectx, res < CONNECTION_MAX_HOSTS_);
return res;
}
@@ -3981,7 +3981,7 @@
struct GNUNET_Mutex *
getConnectionModuleLock ()
{
- GE_ASSERT (NULL, lock != NULL);
+ GNUNET_GE_ASSERT (NULL, lock != NULL);
return lock;
}
@@ -4051,10 +4051,10 @@
GNUNET_EncName enc;
IF_GELOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
GNUNET_hash_to_enc (&node->hashPubKey, &enc));
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
"Closing connection to `%s' as requested by application.\n",
&enc);
#endif
@@ -4077,7 +4077,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if there is a problem
*/
int
-registerSendNotify (MessagePartHandler callback)
+registerSendNotify (GNUNET_P2PRequestHandler callback)
{
if (callback == NULL)
return GNUNET_SYSERR;
@@ -4099,7 +4099,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if there is a problem
*/
int
-unregisterSendNotify (MessagePartHandler callback)
+unregisterSendNotify (GNUNET_P2PRequestHandler callback)
{
int i;
@@ -4129,7 +4129,7 @@
* @return GNUNET_OK if that is true, GNUNET_SYSERR if not.
*/
int
-assertUnused (TSession * tsession)
+assertUnused (GNUNET_TSession * tsession)
{
int i;
BufferEntry *root;
@@ -4143,7 +4143,7 @@
{
if (root->session.tsession == tsession)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_mutex_unlock (lock);
EXIT ();
return GNUNET_SYSERR;
Modified: GNUnet/src/server/connection.h
===================================================================
--- GNUnet/src/server/connection.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/server/connection.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -57,8 +57,8 @@
/**
* Initialize this module.
*/
-void initConnection (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+void initConnection (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
struct GNUNET_LoadMonitor *mon,
struct GNUNET_CronManager *cron);
@@ -99,14 +99,14 @@
* @param sender the identity of the other node
*/
void considerTakeover (const GNUNET_PeerIdentity * sender,
- TSession * tsession);
+ GNUNET_TSession * tsession);
/* ***************** CORE API methods ************* */
/**
* Call method for every connected node.
*/
-int forEachConnectedNode (PerNodeCallback method, void *arg);
+int forEachConnectedNode (GNUNET_NodeIteratorCallback method, void *arg);
/**
@@ -118,10 +118,10 @@
* from the GNUnet core.
*
* @param session the transport session
- * @param msg the message to transmit, should contain MESSAGE_HEADERs
+ * @param msg the message to transmit, should contain MESSAGNUNET_GE_HEADERs
* @return GNUNET_OK on success, GNUNET_SYSERR on failure
*/
-int sendPlaintext (TSession * tsession, const char *msg, unsigned int size);
+int sendPlaintext (GNUNET_TSession * tsession, const char *msg, unsigned int
size);
/**
* Compute the hashtable index of a host id.
@@ -149,14 +149,14 @@
* @return GNUNET_OK if the handler was registered, GNUNET_SYSERR on error
*/
int registerSendCallback (const unsigned int minimumPadding,
- BufferFillCallback callback);
+ GNUNET_BufferFillCallback callback);
/**
* Unregister a handler that was registered with registerSendCallback.
* @return GNUNET_OK if the handler was removed, GNUNET_SYSERR on error
*/
int unregisterSendCallback (const unsigned int minimumPadding,
- BufferFillCallback callback);
+ GNUNET_BufferFillCallback callback);
/**
* Send an encrypted, on-demand build message to another node.
@@ -169,7 +169,7 @@
* @param maxdelay how long can the message wait?
*/
void unicastCallback (const GNUNET_PeerIdentity * hostId,
- BuildMessageCallback callback,
+ GNUNET_BuildMessageCallback callback,
void *closure,
unsigned short len,
unsigned int importance, unsigned int maxdelay);
@@ -288,7 +288,7 @@
* P2P message part that is transmitted
* @return GNUNET_OK on success, GNUNET_SYSERR if there is a problem
*/
-int registerSendNotify (MessagePartHandler callback);
+int registerSendNotify (GNUNET_P2PRequestHandler callback);
/**
* Unregister a handler that is to be called for each
@@ -298,13 +298,13 @@
* P2P message part that is transmitted
* @return GNUNET_OK on success, GNUNET_SYSERR if there is a problem
*/
-int unregisterSendNotify (MessagePartHandler callback);
+int unregisterSendNotify (GNUNET_P2PRequestHandler callback);
/**
* Verify that the given session handle is not in use.
* @return GNUNET_OK if that is true, GNUNET_SYSERR if not.
*/
-int assertUnused (TSession * tsession);
+int assertUnused (GNUNET_TSession * tsession);
#endif
/* end of connection.h */
Modified: GNUnet/src/server/core.c
===================================================================
--- GNUnet/src/server/core.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/server/core.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -73,7 +73,7 @@
/**
* Global for the core API.
*/
-static CoreAPIForApplication applicationCore;
+static GNUNET_CoreAPIForPlugins applicationCore;
/**
* List of loaded modules and their status.
@@ -87,7 +87,7 @@
*/
static GNUNET_PeerIdentity myIdentity;
-static Identity_ServiceAPI *identity;
+static GNUNET_Identity_ServiceAPI *identity;
/**
* Load the application module named "pos".
@@ -99,16 +99,16 @@
int ok;
ShutdownList *nxt;
ShutdownList *spos;
- ApplicationInitMethod mptr;
+ GNUNET_ApplicationPluginInitializationMethod mptr;
struct GNUNET_PluginHandle *library;
char *name;
char *pos;
pos = NULL;
- if (-1 == GC_get_configuration_value_string (applicationCore.cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_string (applicationCore.cfg,
"MODULES", rpos, rpos, &pos))
return GNUNET_SYSERR;
- GE_ASSERT (applicationCore.ectx, pos != NULL);
+ GNUNET_GE_ASSERT (applicationCore.ectx, pos != NULL);
name = GNUNET_malloc (strlen (pos) + strlen ("module_") + 1);
strcpy (name, "module_");
strcat (name, pos);
@@ -121,8 +121,8 @@
{
if (nxt->applicationInitialized == GNUNET_YES)
{
- GE_LOG (applicationCore.ectx,
- GE_WARNING | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (applicationCore.ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
_("Application module `%s' already initialized!\n"),
name);
GNUNET_free (name);
@@ -173,8 +173,8 @@
if (GNUNET_OK != ok)
{
/* undo loading */
- GE_LOG (applicationCore.ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (applicationCore.ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_BULK,
_("Failed to load plugin `%s' at %s:%d. Unloading plugin.\n"),
name, __FILE__, __LINE__);
/* Note: we cannot assert that shutdownList == nxt here,
@@ -192,7 +192,7 @@
spos = spos->next;
if (spos == NULL)
{
- GE_BREAK (applicationCore.ectx, 0); /* should never
happen! */
+ GNUNET_GE_BREAK (applicationCore.ectx, 0); /* should never
happen! */
return ok;
}
}
@@ -213,7 +213,7 @@
{
ShutdownList *pos;
ShutdownList *prev;
- ApplicationDoneMethod mptr;
+ GNUNET_ApplicationPluginShutdownMethod mptr;
prev = NULL;
pos = shutdownList;
@@ -222,16 +222,16 @@
if (pos == NULL)
{
- GE_LOG (applicationCore.ectx,
- GE_ERROR | GE_USER | GE_BULK | GE_DEVELOPER,
+ GNUNET_GE_LOG (applicationCore.ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_BULK |
GNUNET_GE_DEVELOPER,
_("Could not shutdown `%s': application not loaded\n"), name);
return GNUNET_SYSERR;
}
if (pos->applicationInitialized != GNUNET_YES)
{
- GE_LOG (applicationCore.ectx,
- GE_WARNING | GE_USER | GE_BULK | GE_DEVELOPER,
+ GNUNET_GE_LOG (applicationCore.ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK |
GNUNET_GE_DEVELOPER,
_("Could not shutdown application `%s': not initialized\n"),
name);
return GNUNET_SYSERR;
@@ -239,8 +239,8 @@
mptr = GNUNET_plugin_resolve_function (pos->library, "done_", GNUNET_YES);
if (mptr == NULL)
{
- GE_LOG (applicationCore.ectx,
- GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (applicationCore.ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK,
_("Could not find '%s%s' method in library `%s'.\n"),
"done_", pos->dsoName, pos->dsoName);
return GNUNET_SYSERR;
@@ -275,7 +275,7 @@
requestService (const char *rpos)
{
ShutdownList *nxt;
- ServiceInitMethod mptr;
+ GNUNET_ServicePluginInitializationMethod mptr;
void *library;
char *name;
void *api;
@@ -283,10 +283,10 @@
/* subtyping, GNUnet style */
pos = NULL;
- if (-1 == GC_get_configuration_value_string (applicationCore.cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_string (applicationCore.cfg,
"MODULES", rpos, rpos, &pos))
return NULL;
- GE_ASSERT (applicationCore.ectx, pos != NULL);
+ GNUNET_GE_ASSERT (applicationCore.ectx, pos != NULL);
name = GNUNET_malloc (strlen (pos) + strlen ("module_") + 1);
strcpy (name, "module_");
strcat (name, pos);
@@ -348,8 +348,8 @@
nxt->serviceCount = 1;
nxt->servicePTR = NULL;
shutdownList = nxt;
- GE_LOG (applicationCore.ectx,
- GE_INFO | GE_USER | GE_REQUEST, "Loading service `%s'\n", pos);
+ GNUNET_GE_LOG (applicationCore.ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_REQUEST, "Loading
service `%s'\n", pos);
api = mptr (&applicationCore);
if (api != NULL)
{
@@ -357,8 +357,8 @@
}
else
{
- GE_LOG (applicationCore.ectx,
- GE_WARNING | GE_ADMIN | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (applicationCore.ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE,
"Failed to load service `%s'\n", pos);
nxt->serviceCount = 0;
}
@@ -371,7 +371,7 @@
{
ShutdownList *pos;
ShutdownList *prev;
- ApplicationDoneMethod mptr;
+ GNUNET_ApplicationPluginShutdownMethod mptr;
if (service == NULL)
return GNUNET_OK;
@@ -382,8 +382,8 @@
if (pos == NULL)
{
- GE_LOG (applicationCore.ectx,
- GE_BULK | GE_DEVELOPER | GE_ERROR,
+ GNUNET_GE_LOG (applicationCore.ectx,
+ GNUNET_GE_BULK | GNUNET_GE_DEVELOPER | GNUNET_GE_ERROR,
_("Could not release %p: service not loaded\n"), service);
return GNUNET_SYSERR;
}
@@ -392,8 +392,8 @@
pos->serviceCount--;
return GNUNET_OK; /* service still in use elsewhere! */
}
- GE_LOG (applicationCore.ectx,
- GE_INFO | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (applicationCore.ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Unloading service `%s'.\n", pos->dsoName);
mptr =
GNUNET_plugin_resolve_function (pos->library, "release_", GNUNET_YES);
@@ -436,13 +436,13 @@
ok = GNUNET_OK;
dso = NULL;
- if (-1 == GC_get_configuration_value_string (applicationCore.cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_string (applicationCore.cfg,
"GNUNETD",
"APPLICATIONS",
"advertising fs getoption stats
traffic",
&dso))
return GNUNET_SYSERR;
- GE_ASSERT (applicationCore.ectx, dso != NULL);
+ GNUNET_GE_ASSERT (applicationCore.ectx, dso != NULL);
next = dso;
do
{
@@ -462,8 +462,8 @@
}
if (strlen (pos) > 0)
{
- GE_LOG (applicationCore.ectx,
- GE_INFO | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (applicationCore.ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_BULK,
"Loading application `%s'\n", pos);
if (GNUNET_OK != loadApplicationModule (pos))
ok = GNUNET_SYSERR;
@@ -489,8 +489,8 @@
if ((pos->applicationInitialized == GNUNET_YES) &&
(GNUNET_OK != unloadApplicationModule (pos->dsoName)))
{
- GE_LOG (applicationCore.ectx,
- GE_ERROR | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (applicationCore.ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
_("Could not properly shutdown application `%s'.\n"),
pos->dsoName);
ok = GNUNET_SYSERR;
@@ -504,8 +504,8 @@
* Initialize the CORE's globals.
*/
int
-initCore (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+initCore (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
struct GNUNET_CronManager *cron, struct GNUNET_LoadMonitor *monitor)
{
applicationCore.ectx = ectx;
@@ -626,8 +626,8 @@
pos = shutdownList;
while (pos != NULL)
{
- GE_LOG (applicationCore.ectx,
- GE_ERROR | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (applicationCore.ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
_("Could not properly unload service `%s'!\n"), pos->dsoName);
pos = pos->next;
}
Modified: GNUnet/src/server/gnunet-peer-info.c
===================================================================
--- GNUnet/src/server/gnunet-peer-info.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/server/gnunet-peer-info.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -33,13 +33,13 @@
#include "gnunet_core.h"
#include "core.h"
-static Transport_ServiceAPI *transport;
+static GNUNET_Transport_ServiceAPI *transport;
-static Identity_ServiceAPI *identity;
+static GNUNET_Identity_ServiceAPI *identity;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static char *cfgFilename = DEFAULT_DAEMON_CONFIG_FILE;
+static char *cfgFilename = GNUNET_DEFAULT_DAEMON_CONFIG_FILE;
static int no_resolve = GNUNET_NO;
@@ -54,7 +54,7 @@
{'n', "numeric", NULL,
gettext_noop ("don't resolve host names"),
0, &GNUNET_getopt_configure_set_one, &no_resolve},
- GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
+ GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGNUNET_GE_VERSION), /* -v */
GNUNET_COMMAND_LINE_OPTION_END,
};
@@ -115,8 +115,8 @@
hello = identity->identity2Hello (id, proto, GNUNET_NO);
if (NULL == hello)
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Could not get address of peer `%s'.\n"), &enc);
return GNUNET_OK;
}
@@ -128,8 +128,8 @@
&hello->signature,
&hello->publicKey))
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("hello message invalid (signature invalid).\n"));
}
addr = NULL;
@@ -148,8 +148,8 @@
}
if (info == NULL)
{
- GE_LOG (ectx,
- GE_DEBUG | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Could not get address of peer `%s'.\n"), &enc);
printf (_("Peer `%s' with trust %8u\n"),
(char *) &enc, identity->getHostTrust (id));
@@ -164,7 +164,7 @@
int
main (int argc, char *const *argv)
{
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
struct GNUNET_CronManager *cron;
int ret;
@@ -177,8 +177,8 @@
GNUNET_fini (ectx, cfg);
return -1;
}
- GE_ASSERT (ectx,
- 0 == GC_set_configuration_value_string (cfg,
+ GNUNET_GE_ASSERT (ectx,
+ 0 == GNUNET_GC_set_configuration_value_string (cfg,
ectx,
"TCPSERVER",
"DISABLE", "YES"));
Modified: GNUnet/src/server/gnunet-transport-check.c
===================================================================
--- GNUnet/src/server/gnunet-transport-check.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/server/gnunet-transport-check.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -48,13 +48,13 @@
static unsigned long long timeout;
-static Transport_ServiceAPI *transport;
+static GNUNET_Transport_ServiceAPI *transport;
-static Identity_ServiceAPI *identity;
+static GNUNET_Identity_ServiceAPI *identity;
-static Pingpong_ServiceAPI *pingpong;
+static GNUNET_Pingpong_ServiceAPI *pingpong;
-static Bootstrap_ServiceAPI *bootstrap;
+static GNUNET_Bootstrap_ServiceAPI *bootstrap;
static int ok;
@@ -64,13 +64,13 @@
static unsigned long long expectedSize;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
static struct GNUNET_CronManager *cron;
-static char *cfgFilename = DEFAULT_DAEMON_CONFIG_FILE;
+static char *cfgFilename = GNUNET_DEFAULT_DAEMON_CONFIG_FILE;
static void
semUp (void *arg)
@@ -83,7 +83,7 @@
static int
noiseHandler (const GNUNET_PeerIdentity * peer,
- const GNUNET_MessageHeader * msg, TSession * s)
+ const GNUNET_MessageHeader * msg, GNUNET_TSession * s)
{
if ((ntohs (msg->size) ==
sizeof (GNUNET_MessageHeader) + expectedSize) &&
@@ -101,7 +101,7 @@
{
int *res = ctx;
GNUNET_MessageHello *helo;
- TSession *tsession;
+ GNUNET_TSession *tsession;
unsigned long long repeat;
unsigned long long total;
GNUNET_CronTime start;
@@ -109,8 +109,8 @@
GNUNET_MessageHeader *noise;
int ret;
- GE_ASSERT (ectx, tapi != NULL);
- if (tapi->protocolNumber == NAT_PROTOCOL_NUMBER)
+ GNUNET_GE_ASSERT (ectx, tapi != NULL);
+ if (tapi->protocolNumber == GNUNET_TRANSPORT_PROTOCOL_NUMBER_NAT)
{
*res = GNUNET_OK;
return; /* NAT cannot be tested */
@@ -131,7 +131,7 @@
return;
}
GNUNET_free (helo);
- if (-1 == GC_get_configuration_value_number (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_number (cfg,
"TRANSPORT-CHECK",
"REPEAT",
1,
@@ -145,7 +145,7 @@
sem = GNUNET_semaphore_create (0);
start = GNUNET_get_time ();
noise = GNUNET_malloc (expectedSize + sizeof (GNUNET_MessageHeader));
- noise->type = htons (P2P_PROTO_noise);
+ noise->type = htons (GNUNET_P2P_PROTO_NOISE);
noise->size = htons (expectedSize + sizeof (GNUNET_MessageHeader));
memcpy (&noise[1], expectedValue, expectedSize);
while ((repeat > 0) && (GNUNET_shutdown_test () == GNUNET_NO))
@@ -209,7 +209,7 @@
testPING (const GNUNET_MessageHello * xhello, void *arg)
{
int *stats = arg;
- TSession *tsession;
+ GNUNET_TSession *tsession;
GNUNET_MessageHello *hello;
GNUNET_MessageHello *myHello;
GNUNET_MessageHeader *ping;
@@ -221,17 +221,17 @@
stats[0]++; /* one more seen */
if (GNUNET_NO == transport->isAvailable (ntohs (xhello->protocol)))
{
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_(" Transport %d is not being tested\n"),
ntohs (xhello->protocol));
return;
}
- if (ntohs (xhello->protocol) == NAT_PROTOCOL_NUMBER)
+ if (ntohs (xhello->protocol) == GNUNET_TRANSPORT_PROTOCOL_NUMBER_NAT)
return; /* NAT cannot be tested */
stats[1]++; /* one more with transport 'available' */
- GC_get_configuration_value_number (cfg,
+ GNUNET_GC_get_configuration_value_number (cfg,
"GNUNET",
"VERBOSE",
0, (unsigned long long) -1, 0, &verbose);
@@ -263,7 +263,7 @@
myHello = transport->createhello (ntohs (xhello->protocol));
if (myHello == NULL)
/* try NAT */
- myHello = transport->createhello (NAT_PROTOCOL_NUMBER);
+ myHello = transport->createhello (GNUNET_TRANSPORT_PROTOCOL_NUMBER_NAT);
if (myHello == NULL)
{
GNUNET_free (hello);
@@ -282,7 +282,7 @@
}
if (tsession == NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
fprintf (stderr, _(" Connection failed (bug?)\n"));
return;
}
@@ -311,7 +311,7 @@
fprintf (stderr, ".");
/* check: received pong? */
#if DEBUG_TRANSPORT_CHECK
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER, "Waiting for PONG\n");
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Waiting for PONG\n");
#endif
terminate = GNUNET_NO;
GNUNET_cron_add_job (cron, &semUp, timeout, 5 * GNUNET_CRON_SECONDS, sem);
@@ -368,7 +368,7 @@
{'u', "user", "LOGIN",
gettext_noop ("run as user LOGIN"),
1, &GNUNET_getopt_configure_set_option, "GNUNETD:USER"},
- GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
+ GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGNUNET_GE_VERSION), /* -v */
GNUNET_COMMAND_LINE_OPTION_VERBOSE,
{'X', "Xrepeat", "X",
gettext_noop ("repeat each test X times"),
@@ -395,7 +395,7 @@
return -1;
}
- if (-1 == GC_get_configuration_value_number (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_number (cfg,
"TRANSPORT-CHECK",
"SIZE",
1, 60000, 12, &expectedSize))
@@ -403,7 +403,7 @@
GNUNET_fini (ectx, cfg);
return 1;
}
- if (-1 == GC_get_configuration_value_number (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_number (cfg,
"TRANSPORT-CHECK",
"TIMEOUT",
1,
@@ -422,7 +422,7 @@
expectedValue[pos] = 'A' + (pos % 26);
trans = NULL;
- if (-1 == GC_get_configuration_value_string (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_string (cfg,
"GNUNETD",
"TRANSPORTS",
"udp tcp http", &trans))
@@ -431,7 +431,7 @@
GNUNET_fini (ectx, cfg);
return 1;
}
- GE_ASSERT (ectx, trans != NULL);
+ GNUNET_GE_ASSERT (ectx, trans != NULL);
if (ping)
printf (_("Testing transport(s) %s\n"), trans);
else
@@ -440,11 +440,11 @@
if (!ping)
{
/* disable blacklists (loopback is often blacklisted)... */
- GC_set_configuration_value_string (cfg, ectx, "TCP", "BLACKLIST", "");
- GC_set_configuration_value_string (cfg, ectx, "TCP6", "BLACKLIST", "");
- GC_set_configuration_value_string (cfg, ectx, "UDP", "BLACKLIST", "");
- GC_set_configuration_value_string (cfg, ectx, "UDP6", "BLACKLIST", "");
- GC_set_configuration_value_string (cfg, ectx, "HTTP", "BLACKLIST", "");
+ GNUNET_GC_set_configuration_value_string (cfg, ectx, "TCP", "BLACKLIST",
"");
+ GNUNET_GC_set_configuration_value_string (cfg, ectx, "TCP6",
"BLACKLIST", "");
+ GNUNET_GC_set_configuration_value_string (cfg, ectx, "UDP", "BLACKLIST",
"");
+ GNUNET_GC_set_configuration_value_string (cfg, ectx, "UDP6",
"BLACKLIST", "");
+ GNUNET_GC_set_configuration_value_string (cfg, ectx, "HTTP",
"BLACKLIST", "");
}
cron = cron_create (ectx);
if (GNUNET_OK != initCore (ectx, cfg, cron, NULL))
@@ -455,14 +455,14 @@
return 1;
}
initConnection (ectx, cfg, NULL, cron);
- registerPlaintextHandler (P2P_PROTO_noise, &noiseHandler);
+ registerPlaintextHandler (GNUNET_P2P_PROTO_NOISE, &noiseHandler);
enableCoreProcessing ();
identity = requestService ("identity");
transport = requestService ("transport");
pingpong = requestService ("pingpong");
GNUNET_cron_start (cron);
- GC_get_configuration_value_number (cfg,
+ GNUNET_GC_get_configuration_value_number (cfg,
"TRANSPORT-CHECK",
"X-REPEAT",
1, (unsigned long long) -1, 1, &Xrepeat);
@@ -490,7 +490,7 @@
releaseService (transport);
releaseService (pingpong);
disableCoreProcessing ();
- unregisterPlaintextHandler (P2P_PROTO_noise, &noiseHandler);
+ unregisterPlaintextHandler (GNUNET_P2P_PROTO_NOISE, &noiseHandler);
doneConnection ();
doneCore ();
GNUNET_free (expectedValue);
Modified: GNUnet/src/server/gnunet-update.c
===================================================================
--- GNUnet/src/server/gnunet-update.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/server/gnunet-update.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -41,17 +41,17 @@
*/
#define DSO_PREFIX "libgnunet"
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
static char **processed;
static unsigned int processedCount;
-static UpdateAPI uapi;
+static GNUNET_UpdateAPI uapi;
-static char *cfgFilename = DEFAULT_DAEMON_CONFIG_FILE;
+static char *cfgFilename = GNUNET_DEFAULT_DAEMON_CONFIG_FILE;
/**
@@ -61,7 +61,7 @@
static int
updateModule (const char *rpos)
{
- UpdateMethod mptr;
+ GNUNET_UpdatePluginMainMethod mptr;
struct GNUNET_PluginHandle *library;
char *name;
int i;
@@ -76,10 +76,10 @@
processed[processedCount - 1] = GNUNET_strdup (rpos);
pos = NULL;
- if (-1 == GC_get_configuration_value_string (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_string (cfg,
"MODULES", rpos, rpos, &pos))
return GNUNET_SYSERR;
- GE_ASSERT (ectx, pos != NULL);
+ GNUNET_GE_ASSERT (ectx, pos != NULL);
name = GNUNET_malloc (strlen (pos) + strlen ("module_") + 1);
strcpy (name, "module_");
@@ -116,13 +116,13 @@
char *pos;
dso = NULL;
- if (-1 == GC_get_configuration_value_string (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_string (cfg,
"GNUNETD",
"APPLICATIONS",
"advertising fs getoption stats
traffic",
&dso))
return;
- GE_ASSERT (ectx, dso != NULL);
+ GNUNET_GE_ASSERT (ectx, dso != NULL);
next = dso;
do
{
@@ -140,12 +140,12 @@
}
if (strlen (pos) > 0)
{
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Updating data for module `%s'\n"), pos);
if (GNUNET_OK != updateModule (pos))
- GE_LOG (ectx,
- GE_ERROR | GE_DEVELOPER | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("Failed to update data for module `%s'\n"), pos);
}
}
@@ -169,9 +169,9 @@
*ent = '\0';
ent++;
}
- if (GNUNET_YES == GC_have_configuration_value (cfg, sec, ent))
+ if (GNUNET_YES == GNUNET_GC_have_configuration_value (cfg, sec, ent))
{
- GC_get_configuration_value_string (cfg, sec, ent, NULL, &val);
+ GNUNET_GC_get_configuration_value_string (cfg, sec, ent, NULL, &val);
printf ("%s\n", val);
GNUNET_free (val);
}
@@ -192,7 +192,7 @@
cron = cron_create (ectx);
if (initCore (ectx, cfg, cron, NULL) != GNUNET_OK)
{
- GE_LOG (ectx, GE_FATAL | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_FATAL | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE,
_("Core initialization failed.\n"));
return;
@@ -223,7 +223,7 @@
set_client_config (GNUNET_CommandLineProcessorContext * ctx,
void *scls, const char *option, const char *value)
{
- cfgFilename = DEFAULT_CLIENT_CONFIG_FILE;
+ cfgFilename = GNUNET_DEFAULT_CLIENT_CONFIG_FILE;
return GNUNET_OK;
}
@@ -246,7 +246,7 @@
gettext_noop
("run in client mode (for getting client configuration values)"),
0, &set_client_config, NULL},
- GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
+ GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGNUNET_GE_VERSION), /* -v */
GNUNET_COMMAND_LINE_OPTION_VERBOSE,
GNUNET_COMMAND_LINE_OPTION_END,
};
@@ -268,7 +268,7 @@
return -1;
}
get = NULL;
- GC_get_configuration_value_string (cfg, "GNUNET-UPDATE", "GET", "", &get);
+ GNUNET_GC_get_configuration_value_string (cfg, "GNUNET-UPDATE", "GET", "",
&get);
if (strlen (get) > 0)
doGet (get);
else
Modified: GNUnet/src/server/gnunetd.c
===================================================================
--- GNUnet/src/server/gnunetd.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/server/gnunetd.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -37,13 +37,13 @@
#include "startup.h"
#include "version.h"
-static struct GC_Configuration *cfg;
-static struct GE_Context *ectx = NULL;
+static struct GNUNET_GC_Configuration *cfg;
+static struct GNUNET_GE_Context *ectx = NULL;
static struct GNUNET_CronManager *cron;
static struct GNUNET_LoadMonitor *mon;
-static char *cfgFilename = DEFAULT_DAEMON_CONFIG_FILE;
+static char *cfgFilename = GNUNET_DEFAULT_DAEMON_CONFIG_FILE;
static int debug_flag;
@@ -56,8 +56,8 @@
static void
reread_config_helper (void *unused)
{
- GE_ASSERT (NULL, cfgFilename != NULL);
- GC_parse_configuration (cfg, cfgFilename);
+ GNUNET_GE_ASSERT (NULL, cfgFilename != NULL);
+ GNUNET_GC_parse_configuration (cfg, cfgFilename);
}
/**
@@ -76,14 +76,14 @@
* Park main thread until shutdown has been signaled.
*/
static void
-waitForSignalHandler (struct GE_Context *ectx)
+waitForSignalHandler (struct GNUNET_GE_Context *ectx)
{
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_REQUEST,
_("`%s' startup complete.\n"), "gnunetd");
GNUNET_shutdown_wait_for ();
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_REQUEST,
_("`%s' is shutting down.\n"), "gnunetd");
}
@@ -110,14 +110,14 @@
return GNUNET_SYSERR;
}
cron = cron_create (ectx);
- GE_ASSERT (ectx, cron != NULL);
+ GNUNET_GE_ASSERT (ectx, cron != NULL);
#ifndef WINDOWS
shc_hup = GNUNET_signal_handler_install (SIGHUP, &reread_config);
#endif
if (GNUNET_OK != initCore (ectx, cfg, cron, mon))
{
- GE_LOG (ectx,
- GE_FATAL | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
_("Core initialization failed.\n"));
GNUNET_cron_destroy (cron);
@@ -191,7 +191,7 @@
gettext_noop ("specify username as which gnunetd should run"), 1,
&GNUNET_getopt_configure_set_option, "GNUNETD:USERNAME"},
#endif
- GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
+ GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGNUNET_GE_VERSION), /* -v */
GNUNET_COMMAND_LINE_OPTION_END,
};
@@ -235,35 +235,35 @@
{
int dev;
char *user_log_level;
- GE_KIND ull;
+ GNUNET_GE_KIND ull;
- GE_setDefaultContext (NULL);
- GE_free_context (ectx);
- GC_get_configuration_value_string (cfg,
+ GNUNET_GE_setDefaultContext (NULL);
+ GNUNET_GE_free_context (ectx);
+ GNUNET_GC_get_configuration_value_string (cfg,
"LOGGING",
"USER-LEVEL",
"WARNING", &user_log_level);
- dev = GC_get_configuration_value_yesno (cfg,
+ dev = GNUNET_GC_get_configuration_value_yesno (cfg,
"LOGGING", "DEVELOPER",
GNUNET_NO);
- ull = GE_getKIND (user_log_level);
+ ull = GNUNET_GE_getKIND (user_log_level);
ull |= (ull - 1); /* set bits for all lower log-levels */
if (dev == GNUNET_YES)
- ull |= GE_DEVELOPER | GE_REQUEST;
+ ull |= GNUNET_GE_DEVELOPER | GNUNET_GE_REQUEST;
if (loud_flag == 1)
- ectx = GE_create_context_stderr (GNUNET_YES, GE_ALL);
+ ectx = GNUNET_GE_create_context_stderr (GNUNET_YES, GNUNET_GE_ALL);
else
- ectx = GE_create_context_stderr (GNUNET_YES,
- GE_USER | GE_ADMIN
- | ull | GE_BULK | GE_IMMEDIATE);
- GE_setDefaultContext (ectx);
+ ectx = GNUNET_GE_create_context_stderr (GNUNET_YES,
+ GNUNET_GE_USER | GNUNET_GE_ADMIN
+ | ull | GNUNET_GE_BULK |
GNUNET_GE_IMMEDIATE);
+ GNUNET_GE_setDefaultContext (ectx);
GNUNET_free (user_log_level);
}
setFdLimit (ectx, cfg);
if (GNUNET_OK != checkUpToDate (ectx, cfg))
{
- GE_LOG (ectx,
- GE_USER | GE_FATAL | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_USER | GNUNET_GE_FATAL | GNUNET_GE_IMMEDIATE,
_
("Configuration or GNUnet version changed. You need to run
`%s'!\n"),
"gnunet-update");
@@ -273,7 +273,7 @@
}
#ifdef MINGW
- if (GC_get_configuration_value_yesno (cfg,
+ if (GNUNET_GC_get_configuration_value_yesno (cfg,
"GNUNETD", "WINSERVICE",
GNUNET_NO) == GNUNET_YES)
{
Modified: GNUnet/src/server/handler.c
===================================================================
--- GNUnet/src/server/handler.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/server/handler.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -68,12 +68,12 @@
/**
* Transport service
*/
-static Transport_ServiceAPI *transport;
+static GNUNET_Transport_ServiceAPI *transport;
/**
* Identity service
*/
-static Identity_ServiceAPI *identity;
+static GNUNET_Identity_ServiceAPI *identity;
static P2P_PACKET *bufferQueue_[QUEUE_LENGTH];
@@ -103,7 +103,7 @@
/**
* Array of arrays of message handlers.
*/
-static MessagePartHandler **handlers = NULL;
+static GNUNET_P2PRequestHandler **handlers = NULL;
/**
* Number of handlers in the array (max, there
@@ -114,7 +114,7 @@
/**
* Array of arrays of the message handlers for plaintext messages.
*/
-static PlaintextMessagePartHandler **plaintextHandlers = NULL;
+static GNUNET_P2PPlaintextRequestHandler **plaintextHandlers = NULL;
/**
* Number of handlers in the plaintextHandlers array (max, there
@@ -127,11 +127,11 @@
*/
static struct GNUNET_Mutex *handlerLock;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
#if MEASURE_TIME
-static GNUNET_CronTime time_by_type[P2P_PROTO_MAX_USED];
-static unsigned int count_by_type[P2P_PROTO_MAX_USED];
+static GNUNET_CronTime time_by_type[GNUNET_P2P_PROTO_MAX_USED];
+static unsigned int count_by_type[GNUNET_P2P_PROTO_MAX_USED];
#endif
@@ -149,13 +149,13 @@
* and updates to the handler list are illegal!
*/
int
-registerp2pHandler (unsigned short type, MessagePartHandler callback)
+registerp2pHandler (unsigned short type, GNUNET_P2PRequestHandler callback)
{
unsigned int last;
if (threads_running == GNUNET_YES)
{
- GE_BREAK (ectx, NULL);
+ GNUNET_GE_BREAK (ectx, NULL);
return GNUNET_SYSERR;
}
GNUNET_mutex_lock (handlerLock);
@@ -192,14 +192,14 @@
* and updates to the handler list are illegal!
*/
int
-unregisterp2pHandler (unsigned short type, MessagePartHandler callback)
+unregisterp2pHandler (unsigned short type, GNUNET_P2PRequestHandler callback)
{
unsigned int pos;
unsigned int last;
if (threads_running == GNUNET_YES)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
GNUNET_mutex_lock (handlerLock);
@@ -246,13 +246,13 @@
*/
int
registerPlaintextHandler (unsigned short type,
- PlaintextMessagePartHandler callback)
+ GNUNET_P2PPlaintextRequestHandler callback)
{
unsigned int last;
if (threads_running == GNUNET_YES)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
GNUNET_mutex_lock (handlerLock);
@@ -291,14 +291,14 @@
*/
int
unregisterPlaintextHandler (unsigned short type,
- PlaintextMessagePartHandler callback)
+ GNUNET_P2PPlaintextRequestHandler callback)
{
unsigned int pos;
unsigned int last;
if (threads_running == GNUNET_YES)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
GNUNET_mutex_lock (handlerLock);
@@ -353,7 +353,7 @@
return isCSHandlerRegistered (type);
if (handlerType > 3)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
ret = 0;
@@ -391,7 +391,7 @@
void
injectMessage (const GNUNET_PeerIdentity * sender,
const char *msg,
- unsigned int size, int wasEncrypted, TSession * session)
+ unsigned int size, int wasEncrypted, GNUNET_TSession * session)
{
unsigned int pos;
const GNUNET_MessageHeader *part;
@@ -422,16 +422,16 @@
if (sender != NULL)
{
IF_GELOG (ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
GNUNET_hash_to_enc (&sender->hashPubKey, &enc));
- GE_LOG (ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Received corrupt message from peer `%s'in %s:%d.\n"),
&enc, __FILE__, __LINE__);
}
else
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
}
return;
}
@@ -457,21 +457,21 @@
#if DEBUG_HANDLER
if (sender != NULL)
{
- IF_GELOG (ectx, GE_DEBUG,
+ IF_GELOG (ectx, GNUNET_GE_DEBUG,
GNUNET_hash_to_enc (&sender->hashPubKey, &enc));
- GE_LOG (ectx, GE_DEBUG,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG,
"Received %s message of type %u from peer `%s'\n",
wasEncrypted ? "encrypted" : "plaintext", ptyp, &enc);
}
#endif
if (GNUNET_YES == wasEncrypted)
{
- MessagePartHandler callback;
+ GNUNET_P2PRequestHandler callback;
if ((ptyp >= max_registeredType) || (NULL == handlers[ptyp][0]))
{
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Encrypted message of type '%d' not understood (no
handler registered).\n",
ptyp);
continue; /* no handler registered, go to next part */
@@ -489,8 +489,8 @@
if (GNUNET_SYSERR == callback (sender, part))
{
#if DEBUG_HANDLER
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
"Handler aborted message processing after receiving
message of type '%d'.\n",
ptyp);
#endif
@@ -503,8 +503,8 @@
}
#if VALIDATE_CLIENT
if (0 != memcmp (old_value, part, plen))
- GE_LOG (ectx,
- GE_ERROR | GE_DEVELOPER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_DEVELOPER |
GNUNET_GE_IMMEDIATE,
"Handler %d at %p violated const!\n", ptyp, callback);
GNUNET_free (old_value);
#endif
@@ -512,7 +512,7 @@
last++;
}
#if MEASURE_TIME
- if (ptyp < P2P_PROTO_MAX_USED)
+ if (ptyp < GNUNET_P2P_PROTO_MAX_USED)
{
time_by_type[ptyp] += GNUNET_get_time () - now;
count_by_type[ptyp]++;
@@ -521,13 +521,13 @@
}
else
{ /* isEncrypted == GNUNET_NO */
- PlaintextMessagePartHandler callback;
+ GNUNET_P2PPlaintextRequestHandler callback;
if ((ptyp >= plaintextmax_registeredType) ||
(NULL == plaintextHandlers[ptyp][0]))
{
- GE_LOG (ectx,
- GE_REQUEST | GE_DEBUG | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_REQUEST | GNUNET_GE_DEBUG | GNUNET_GE_USER,
"Plaintext message of type '%d' not understood (no
handler registered).\n",
ptyp);
continue; /* no handler registered, go to next part */
@@ -541,8 +541,8 @@
if (GNUNET_SYSERR == callback (sender, part, session))
{
#if DEBUG_HANDLER
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
"Handler aborted message processing after receiving
message of type '%d'.\n",
ptyp);
#endif
@@ -553,7 +553,7 @@
last++;
}
#if MEASURE_TIME
- if (ptyp < P2P_PROTO_MAX_USED)
+ if (ptyp < GNUNET_P2P_PROTO_MAX_USED)
{
time_by_type[ptyp] += GNUNET_get_time () - now;
count_by_type[ptyp]++;
@@ -575,7 +575,7 @@
* @param size the size of the message
*/
static void
-handleMessage (TSession * tsession,
+handleMessage (GNUNET_TSession * tsession,
const GNUNET_PeerIdentity * sender,
const char *msg, unsigned int size)
{
@@ -585,7 +585,7 @@
(sender != NULL) &&
(0 != memcmp (sender, &tsession->peer, sizeof (GNUNET_PeerIdentity))))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return;
}
ret = checkHeader (sender, (P2P_PACKET_HEADER *) msg, size);
@@ -646,7 +646,7 @@
memcmp (&mp->sender, &mp->tsession->peer,
sizeof (GNUNET_PeerIdentity))))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
GNUNET_free (mp->msg);
GNUNET_free (mp);
return;
@@ -658,8 +658,8 @@
GNUNET_mutex_lock (globalLock_);
discarded++;
if (0 == discarded % 64)
- GE_LOG (ectx,
- GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_REQUEST,
"Accepted: %u discarded: %u blacklisted: %u, ratio: %f\n",
accepted,
discarded,
@@ -674,10 +674,10 @@
#if DEBUG_HANDLER
GNUNET_EncName enc;
IF_GELOG (ectx,
- GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_REQUEST,
GNUNET_hash_to_enc (&mp->sender.hashPubKey, &enc));
- GE_LOG (ectx,
- GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_REQUEST,
"Strictly blacklisted peer `%s' sent message, dropping for
now.\n",
(char *) &enc);
#endif
@@ -685,8 +685,8 @@
GNUNET_mutex_lock (globalLock_);
blacklisted++;
if (0 == blacklisted % 64)
- GE_LOG (ectx,
- GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_REQUEST,
"Accepted: %u discarded: %u blacklisted: %u, ratio: %f\n",
accepted,
discarded,
@@ -704,8 +704,8 @@
/* discard message, buffer is full or
we're shut down! */
#if 0
- GE_LOG (ectx,
- GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_REQUEST,
"Discarding message of size %u -- buffer full!\n", mp->size);
#endif
GNUNET_free (mp->msg);
@@ -715,8 +715,8 @@
GNUNET_mutex_lock (globalLock_);
discarded++;
if (0 == discarded % 64)
- GE_LOG (ectx,
- GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_REQUEST,
"Accepted: %u discarded: %u blacklisted: %u, ratio: %f\n",
accepted,
discarded,
@@ -738,8 +738,8 @@
#if TRACK_DISCARD
accepted++;
if (0 == accepted % 64)
- GE_LOG (ectx,
- GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_REQUEST,
"Accepted: %u discarded: %u blacklisted: %u, ratio: %f\n",
accepted,
discarded,
@@ -769,7 +769,7 @@
{
threads_[i] = GNUNET_thread_create (&threadMain, &i, 128 * 1024);
if (threads_[i] == NULL)
- GE_LOG_STRERROR (ectx, GE_ERROR, "pthread_create");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ERROR, "pthread_create");
}
}
@@ -805,14 +805,14 @@
* Initialize message handling module.
*/
void
-initHandler (struct GE_Context *e)
+initHandler (struct GNUNET_GE_Context *e)
{
ectx = e;
handlerLock = GNUNET_mutex_create (GNUNET_NO);
transport = requestService ("transport");
- GE_ASSERT (ectx, transport != NULL);
+ GNUNET_GE_ASSERT (ectx, transport != NULL);
identity = requestService ("identity");
- GE_ASSERT (ectx, identity != NULL);
+ GNUNET_GE_ASSERT (ectx, identity != NULL);
/* initialize sync mechanisms for message handling threads */
bufferQueueRead_ = GNUNET_semaphore_create (0);
bufferQueueWrite_ = GNUNET_semaphore_create (QUEUE_LENGTH);
@@ -862,12 +862,12 @@
releaseService (identity);
identity = NULL;
#if MEASURE_TIME
- for (i = 0; i < P2P_PROTO_MAX_USED; i++)
+ for (i = 0; i < GNUNET_P2P_PROTO_MAX_USED; i++)
{
if (count_by_type[i] == 0)
continue;
- GE_LOG (ectx,
- GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_REQUEST,
"%10u msgs of type %2u took %16llu ms (%llu on average)\n",
count_by_type[i],
i, time_by_type[i], time_by_type[i] / count_by_type[i]);
Modified: GNUnet/src/server/handler.h
===================================================================
--- GNUnet/src/server/handler.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/server/handler.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -33,7 +33,7 @@
* Initialize message handling module (make ready to register
* handlers).
*/
-void initHandler (struct GE_Context *e);
+void initHandler (struct GNUNET_GE_Context *e);
/**
* Shutdown message handling module.
@@ -59,7 +59,7 @@
*/
void injectMessage (const GNUNET_PeerIdentity * sender,
const char *msg,
- unsigned int size, int wasEncrypted, TSession * session);
+ unsigned int size, int wasEncrypted, GNUNET_TSession *
session);
/**
* Processing of a message from the transport layer (receive
@@ -80,7 +80,7 @@
* handler for that type
*/
int registerp2pHandler (const unsigned short type,
- MessagePartHandler callback);
+ GNUNET_P2PRequestHandler callback);
/**
@@ -93,7 +93,7 @@
* handler for that type
*/
int unregisterp2pHandler (const unsigned short type,
- MessagePartHandler callback);
+ GNUNET_P2PRequestHandler callback);
/**
@@ -110,7 +110,7 @@
* and updates to the handler list are illegal!
*/
int registerPlaintextHandler (const unsigned short type,
- PlaintextMessagePartHandler callback);
+ GNUNET_P2PPlaintextRequestHandler callback);
/**
@@ -125,7 +125,7 @@
* and updates to the handler list are illegal!
*/
int unregisterPlaintextHandler (const unsigned short type,
- PlaintextMessagePartHandler callback);
+ GNUNET_P2PPlaintextRequestHandler callback);
/**
* Is a handler registered for messages of the given type?
Modified: GNUnet/src/server/startup.c
===================================================================
--- GNUnet/src/server/startup.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/server/startup.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -51,10 +51,10 @@
* @param sig signal code that causes shutdown, optional
*/
void
-shutdown_gnunetd (struct GC_Configuration *cfg, int sig)
+shutdown_gnunetd (struct GNUNET_GC_Configuration *cfg, int sig)
{
#ifdef MINGW
- if (!cfg || GC_get_configuration_value_yesno (cfg,
+ if (!cfg || GNUNET_GC_get_configuration_value_yesno (cfg,
"GNUNETD",
"WINSERVICE",
GNUNET_NO) == GNUNET_YES)
@@ -128,12 +128,12 @@
int
-changeUser (struct GE_Context *ectx, struct GC_Configuration *cfg)
+changeUser (struct GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration
*cfg)
{
char *user;
user = NULL;
- if (0 == GC_get_configuration_value_string (cfg,
+ if (0 == GNUNET_GC_get_configuration_value_string (cfg,
"GNUNETD",
"USER",
"", &user) && strlen (user))
@@ -149,12 +149,12 @@
}
int
-setFdLimit (struct GE_Context *ectx, struct GC_Configuration *cfg)
+setFdLimit (struct GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration
*cfg)
{
unsigned long long limit;
limit = 0;
- if (0 == GC_get_configuration_value_number (cfg,
+ if (0 == GNUNET_GC_get_configuration_value_number (cfg,
"GNUNETD",
"FDLIMIT",
0, 65536, 1024, &limit))
@@ -174,14 +174,14 @@
* @param cfg configuration manager
*/
void
-capFSQuotaSize (struct GE_Context *ectx, struct GC_Configuration *cfg)
+capFSQuotaSize (struct GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration
*cfg)
{
#ifdef WINDOWS
unsigned long long quota, cap;
char *afsdir, fs[MAX_PATH + 1];
DWORD flags;
- if (-1 == GC_get_configuration_value_number (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_number (cfg,
"FS",
"QUOTA",
0,
@@ -189,12 +189,12 @@
1024 / 1024, 1024, "a))
return;
- GC_get_configuration_value_filename (cfg,
+ GNUNET_GC_get_configuration_value_filename (cfg,
"FS",
"DIR",
- VAR_DAEMON_DIRECTORY "/data/fs/",
+ GNUNET_DEFAULT_DAEMON_VAR_DIRECTORY
"/data/fs/",
&afsdir);
- GE_ASSERT (ectx, strlen (afsdir) > 2);
+ GNUNET_GE_ASSERT (ectx, strlen (afsdir) > 2);
/* get root directory */
afsdir[3] = '\0';
@@ -202,8 +202,8 @@
if (!GetVolumeInformation (afsdir,
NULL, 0, NULL, NULL, &flags, fs, _MAX_PATH + 1))
{
- GE_LOG (ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE,
_("Unable to obtain filesystem information for `%s': %u\n"),
afsdir, GetLastError ());
@@ -219,8 +219,8 @@
else
{
/* unknown FS */
- GE_LOG (ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE,
_("Filesystem `%s' of partition `%s' is unknown. Please "
"contact address@hidden"), fs, afsdir);
@@ -232,21 +232,21 @@
if ((cap != 0) && (cap < quota))
{
- GE_LOG (ectx,
- GE_WARNING | GE_ADMIN | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE,
_
("Limiting datastore size to %llu GB, because the `%s'
filesystem does "
"not support larger files. Please consider storing the database
on "
"a NTFS partition!\n"), cap / 1000, fs);
- GC_set_configuration_value_number (cfg, ectx, "FS", "QUOTA", cap);
+ GNUNET_GC_set_configuration_value_number (cfg, ectx, "FS", "QUOTA", cap);
}
#endif
}
int
-checkPermission (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+checkPermission (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *section,
const char *option,
const char *def, int is_directory, int mode)
@@ -254,7 +254,7 @@
char *fn;
int i;
- GC_get_configuration_value_filename (cfg, section, option, def, &fn);
+ GNUNET_GC_get_configuration_value_filename (cfg, section, option, def, &fn);
if (is_directory)
GNUNET_disk_directory_create (ectx, fn);
else
@@ -270,8 +270,8 @@
}
if (0 != ACCESS (fn, mode))
{
- GE_LOG (ectx,
- GE_FATAL | GE_USER | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE,
_("Insufficient access permissions for `%s': %s\n"),
fn, STRERROR (errno));
GNUNET_free (fn);
@@ -284,7 +284,7 @@
#define CHECK(a,b,c,d,e) if (GNUNET_OK != checkPermission(ectx, cfg, a, b, c,
d, e)) return GNUNET_SYSERR;
int
-checkPermissions (struct GE_Context *ectx, struct GC_Configuration *cfg)
+checkPermissions (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg)
{
CHECK ("PATHS", "GNUNETD_HOME", "/var/lib/gnunet", GNUNET_YES, W_OK | X_OK);
CHECK ("GNUNETD", "LOGFILE", "$GNUNETD_HOME/daemon-logs", GNUNET_NO, W_OK);
Modified: GNUnet/src/server/startup.h
===================================================================
--- GNUnet/src/server/startup.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/server/startup.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -31,11 +31,11 @@
#include "gnunet_util.h"
#include "platform.h"
-int changeUser (struct GE_Context *ectx, struct GC_Configuration *cfg);
+int changeUser (struct GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration
*cfg);
-int setFdLimit (struct GE_Context *ectx, struct GC_Configuration *cfg);
+int setFdLimit (struct GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration
*cfg);
-int checkPermissions (struct GE_Context *ectx, struct GC_Configuration *cfg);
+int checkPermissions (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg);
/**
* @brief Cap datastore limit to the filesystem's capabilities
@@ -43,14 +43,14 @@
* @param ectx error handler
* @param cfg configuration manager
*/
-void capFSQuotaSize (struct GE_Context *ectx, struct GC_Configuration *cfg);
+void capFSQuotaSize (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg);
/**
* Shutdown gnunetd
* @param cfg configuration
* @param sig signal code that causes shutdown, optional
*/
-void shutdown_gnunetd (struct GC_Configuration *cfg, int sig);
+void shutdown_gnunetd (struct GNUNET_GC_Configuration *cfg, int sig);
#ifdef MINGW
Modified: GNUnet/src/server/tcpserver.c
===================================================================
--- GNUnet/src/server/tcpserver.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/server/tcpserver.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -41,7 +41,7 @@
/**
* Array of the message handlers.
*/
-static CSHandler *handlers = NULL;
+static GNUNET_ClientRequestHandler *handlers = NULL;
/**
* Number of handlers in the array (max, there
@@ -52,7 +52,7 @@
/**
* Handlers to call if client exits.
*/
-static ClientExitHandler *exitHandlers;
+static GNUNET_ClientExitHandler *exitHandlers;
/**
* How many entries are in exitHandlers?
@@ -69,14 +69,14 @@
*/
static struct GNUNET_SelectHandle *selector;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
/**
* Per-client data structure.
*/
-typedef struct ClientHandle
+typedef struct GNUNET_ClientHandle
{
struct GNUNET_SocketHandle *sock;
@@ -98,21 +98,21 @@
}
static int
-shutdownHandler (struct ClientHandle *client,
+shutdownHandler (struct GNUNET_ClientHandle *client,
const GNUNET_MessageHeader * msg)
{
int ret;
if (ntohs (msg->size) != sizeof (GNUNET_MessageHeader))
{
- GE_LOG (NULL,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
_("The `%s' request received from client is malformed.\n"),
"shutdown");
return GNUNET_SYSERR;
}
- GE_LOG (NULL,
- GE_INFO | GE_USER | GE_REQUEST,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"shutdown request accepted from client\n");
ret = sendTCPResultToClient (client, GNUNET_OK);
shutdown_gnunetd (cfg, 0);
@@ -120,7 +120,7 @@
}
int
-registerClientExitHandler (ClientExitHandler callback)
+registerClientExitHandler (GNUNET_ClientExitHandler callback)
{
GNUNET_mutex_lock (handlerlock);
GNUNET_array_grow (exitHandlers, exitHandlerCount, exitHandlerCount + 1);
@@ -130,7 +130,7 @@
}
int
-unregisterClientExitHandler (ClientExitHandler callback)
+unregisterClientExitHandler (GNUNET_ClientExitHandler callback)
{
int i;
@@ -156,7 +156,7 @@
struct GNUNET_SocketHandle *sock,
const void *addr, unsigned int addr_len)
{
- struct ClientHandle *session;
+ struct GNUNET_ClientHandle *session;
GNUNET_IPv4Address ip;
struct sockaddr_in *a;
@@ -196,12 +196,12 @@
* @param force GNUNET_YES if this message MUST be queued
*/
int
-sendToClient (struct ClientHandle *handle,
+sendToClient (struct GNUNET_ClientHandle *handle,
const GNUNET_MessageHeader * message, int force)
{
#if DEBUG_TCPHANDLER
- GE_LOG (ectx,
- GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_REQUEST,
"%s: sending reply to client\n", __FUNCTION__);
#endif
return GNUNET_select_write (selector, handle->sock, message, GNUNET_YES,
@@ -209,7 +209,7 @@
}
void
-terminateClientConnection (struct ClientHandle *sock)
+terminateClientConnection (struct GNUNET_ClientHandle *sock)
{
GNUNET_select_disconnect (selector, sock->sock);
}
@@ -220,9 +220,9 @@
struct GNUNET_SocketHandle *sock,
void *sock_ctx, const GNUNET_MessageHeader * msg)
{
- struct ClientHandle *sender = sock_ctx;
+ struct GNUNET_ClientHandle *sender = sock_ctx;
unsigned short ptyp;
- CSHandler callback;
+ GNUNET_ClientRequestHandler callback;
#if TIME_HANDLERS
GNUNET_CronTime start;
#endif
@@ -231,8 +231,8 @@
GNUNET_mutex_lock (handlerlock);
if (ptyp >= max_registeredType)
{
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_BULK,
"%s: Message of type %d not understood: no handler registered\n",
__FUNCTION__, ptyp, max_registeredType);
GNUNET_mutex_unlock (handlerlock);
@@ -241,8 +241,8 @@
callback = handlers[ptyp];
if (callback == NULL)
{
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_BULK,
"%s: Message of type %d not understood: no handler registered\n",
__FUNCTION__, ptyp);
GNUNET_mutex_unlock (handlerlock);
@@ -256,8 +256,8 @@
if (GNUNET_OK != callback (sender, msg))
{
#if 0
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_BULK,
"%s: Message of type %d caused error in handler\n",
__FUNCTION__, ptyp);
#endif
@@ -266,8 +266,8 @@
}
#if TIME_HANDLERS
if (GNUNET_get_time () - start > GNUNET_CRON_SECONDS)
- GE_LOG (ectx,
- GE_INFO | GE_DEVELOPER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_DEVELOPER | GNUNET_GE_IMMEDIATE,
"Handling message of type %u took %llu s\n",
ptyp, (GNUNET_get_time () - start) / GNUNET_CRON_SECONDS);
#endif
@@ -284,7 +284,7 @@
{
unsigned long long port;
- if (-1 == GC_get_configuration_value_number (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_number (cfg,
"NETWORK",
"PORT", 1, 65535, 2087, &port))
port = 0;
@@ -305,8 +305,8 @@
listenerFD = SOCKET (PF_INET, SOCK_STREAM, 0);
if (listenerFD < 0)
{
- GE_LOG_STRERROR (ectx,
- GE_FATAL | GE_ADMIN | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE,
"socket");
return GNUNET_SYSERR;
}
@@ -316,14 +316,14 @@
serverAddr.sin_addr.s_addr = htonl (INADDR_ANY);
serverAddr.sin_port = htons (listenerPort);
if (SETSOCKOPT (listenerFD, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) < 0)
- GE_LOG_STRERROR (ectx, GE_ERROR | GE_ADMIN | GE_BULK, "setsockopt");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "setsockopt");
/* bind the socket */
if (BIND (listenerFD,
(struct sockaddr *) &serverAddr, sizeof (serverAddr)) < 0)
{
- GE_LOG_STRERROR (ectx, GE_ERROR | GE_ADMIN | GE_IMMEDIATE, "bind");
- GE_LOG (ectx,
- GE_FATAL | GE_ADMIN | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE, "bind");
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE,
_("`%s' failed for port %d. Is gnunetd already running?\n"),
"bind", listenerPort);
CLOSE (listenerFD);
@@ -355,7 +355,7 @@
for the benefit of gnunet-update
and other gnunet-tools that are
not gnunetd */
- unregisterCSHandler (CS_PROTO_SHUTDOWN_REQUEST, &shutdownHandler);
+ unregisterCSHandler (GNUNET_CS_PROTO_SHUTDOWN_REQUEST, &shutdownHandler);
GNUNET_array_grow (handlers, max_registeredType, 0);
GNUNET_array_grow (exitHandlers, exitHandlerCount, 0);
GNUNET_free (trustedNetworks_);
@@ -377,7 +377,7 @@
* Initialize the TCP port and listen for incoming client connections.
*/
int
-initTCPServer (struct GE_Context *e, struct GC_Configuration *c)
+initTCPServer (struct GNUNET_GE_Context *e, struct GNUNET_GC_Configuration *c)
{
char *ch;
@@ -386,17 +386,17 @@
/* move to reload-configuration method! */
ch = NULL;
- if (-1 == GC_get_configuration_value_string (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_string (cfg,
"NETWORK",
"TRUSTED",
"127.0.0.0/8;", &ch))
return GNUNET_SYSERR;
- GE_ASSERT (ectx, ch != NULL);
+ GNUNET_GE_ASSERT (ectx, ch != NULL);
trustedNetworks_ = GNUNET_parse_ipv4_network_specification (ectx, ch);
if (trustedNetworks_ == NULL)
{
- GE_LOG (ectx,
- GE_FATAL | GE_USER | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE,
_
("Malformed network specification in the configuration in
section `%s' for entry `%s': %s\n"),
"NETWORK", "TRUSTED", ch);
@@ -405,8 +405,8 @@
}
GNUNET_free (ch);
- registerCSHandler (CS_PROTO_SHUTDOWN_REQUEST, &shutdownHandler);
- if ((GNUNET_NO == GC_get_configuration_value_yesno (cfg,
+ registerCSHandler (GNUNET_CS_PROTO_SHUTDOWN_REQUEST, &shutdownHandler);
+ if ((GNUNET_NO == GNUNET_GC_get_configuration_value_yesno (cfg,
"TCPSERVER",
"DISABLE",
GNUNET_NO)) &&
@@ -444,7 +444,7 @@
* handler for that type
*/
int
-registerCSHandler (unsigned short type, CSHandler callback)
+registerCSHandler (unsigned short type, GNUNET_ClientRequestHandler callback)
{
GNUNET_mutex_lock (handlerlock);
if (type < max_registeredType)
@@ -452,8 +452,8 @@
if (handlers[type] != NULL)
{
GNUNET_mutex_unlock (handlerlock);
- GE_LOG (ectx,
- GE_WARNING | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
_("%s failed, message type %d already in use.\n"),
__FUNCTION__, type);
return GNUNET_SYSERR;
@@ -479,7 +479,7 @@
* handler for that type
*/
int
-unregisterCSHandler (unsigned short type, CSHandler callback)
+unregisterCSHandler (unsigned short type, GNUNET_ClientRequestHandler callback)
{
GNUNET_mutex_lock (handlerlock);
if (type < max_registeredType)
@@ -512,12 +512,12 @@
* send successfully
*/
int
-sendTCPResultToClient (struct ClientHandle *sock, int ret)
+sendTCPResultToClient (struct GNUNET_ClientHandle *sock, int ret)
{
GNUNET_MessageReturnValue rv;
rv.header.size = htons (sizeof (GNUNET_MessageReturnValue));
- rv.header.type = htons (CS_PROTO_RETURN_VALUE);
+ rv.header.type = htons (GNUNET_CS_PROTO_RETURN_VALUE);
rv.return_value = htonl (ret);
return sendToClient (sock, &rv.header, GNUNET_YES);
}
@@ -531,8 +531,8 @@
* send successfully
*/
int
-sendTCPErrorToClient (struct ClientHandle *sock,
- GE_KIND kind, const char *message)
+sendTCPErrorToClient (struct GNUNET_ClientHandle *sock,
+ GNUNET_GE_KIND kind, const char *message)
{
GNUNET_MessageReturnErrorMessage *rv;
size_t msgLen;
@@ -545,7 +545,7 @@
rv = GNUNET_malloc (sizeof (GNUNET_MessageReturnErrorMessage) + msgLen);
memset (rv, 0, sizeof (GNUNET_MessageReturnErrorMessage) + msgLen);
rv->header.size = htons (sizeof (GNUNET_MessageHeader) + msgLen);
- rv->header.type = htons (CS_PROTO_RETURN_ERROR);
+ rv->header.type = htons (GNUNET_CS_PROTO_RETURN_ERROR);
rv->kind = htonl (kind);
memcpy (&rv[1], message, strlen (message));
ret = sendToClient (sock, &rv->header, GNUNET_YES);
@@ -588,15 +588,15 @@
static void
logClientLogContext (void *ctx,
- GE_KIND kind, const char *date, const char *msg)
+ GNUNET_GE_KIND kind, const char *date, const char *msg)
{
sendTCPErrorToClient (ctx, kind, msg);
}
-struct GE_Context *
-createClientLogContext (GE_KIND mask, struct ClientHandle *handle)
+struct GNUNET_GE_Context *
+createClientLogContext (GNUNET_GE_KIND mask, struct GNUNET_ClientHandle
*handle)
{
- return GE_create_context_callback (mask,
+ return GNUNET_GE_create_context_callback (mask,
&logClientLogContext,
handle,
&freeClientLogContext,
Modified: GNUnet/src/server/tcpserver.h
===================================================================
--- GNUnet/src/server/tcpserver.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/server/tcpserver.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -33,7 +33,7 @@
* Initialize the TCP port and listen for incoming client connections.
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int initTCPServer (struct GE_Context *ectx, struct GC_Configuration *cfg);
+int initTCPServer (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg);
/**
* Stop the server (but do not yet destroy the data structures)
@@ -57,7 +57,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if there is already a
* handler for that type
*/
-int registerCSHandler (unsigned short type, CSHandler callback);
+int registerCSHandler (unsigned short type, GNUNET_ClientRequestHandler
callback);
/**
* Unregister a method as a handler for specific message
@@ -70,11 +70,11 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if there is no or another
* handler for that type
*/
-int unregisterCSHandler (unsigned short type, CSHandler callback);
+int unregisterCSHandler (unsigned short type, GNUNET_ClientRequestHandler
callback);
-int registerClientExitHandler (ClientExitHandler callback);
+int registerClientExitHandler (GNUNET_ClientExitHandler callback);
-int unregisterClientExitHandler (ClientExitHandler callback);
+int unregisterClientExitHandler (GNUNET_ClientExitHandler callback);
/**
* Send a message to the client identified by the handle. Note that
@@ -83,7 +83,7 @@
* on the other hand does NOT confirm delivery since the actual
* transfer happens asynchronously.
*/
-int sendToClient (struct ClientHandle *handle,
+int sendToClient (struct GNUNET_ClientHandle *handle,
const GNUNET_MessageHeader * message, int force);
@@ -95,7 +95,7 @@
* @return GNUNET_SYSERR on error, GNUNET_OK if the return value was
* send successfully
*/
-int sendTCPResultToClient (struct ClientHandle *sock, int ret);
+int sendTCPResultToClient (struct GNUNET_ClientHandle *sock, int ret);
/**
* Send an error message to the caller of a remote call via
@@ -105,10 +105,10 @@
* @return GNUNET_SYSERR on error, GNUNET_OK if the return value was
* send successfully
*/
-int sendTCPErrorToClient (struct ClientHandle *sock,
- GE_KIND kind, const char *message);
+int sendTCPErrorToClient (struct GNUNET_ClientHandle *sock,
+ GNUNET_GE_KIND kind, const char *message);
-void terminateClientConnection (struct ClientHandle *sock);
+void terminateClientConnection (struct GNUNET_ClientHandle *sock);
/**
* Check if a handler is registered for a given
@@ -119,8 +119,8 @@
*/
unsigned int isCSHandlerRegistered (unsigned short type);
-struct GE_Context *createClientLogContext (GE_KIND mask,
- struct ClientHandle *handle);
+struct GNUNET_GE_Context *createClientLogContext (GNUNET_GE_KIND mask,
+ struct GNUNET_ClientHandle *handle);
#endif
/* end of tcpserver.h */
Modified: GNUnet/src/server/version.c
===================================================================
--- GNUnet/src/server/version.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/server/version.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -39,7 +39,7 @@
* configuration file.
*/
static void
-dyncat (struct GC_Configuration *cfg,
+dyncat (struct GNUNET_GC_Configuration *cfg,
char **string, const char *section, const char *part)
{
int len;
@@ -50,7 +50,7 @@
len += strlen (section) + 1;
len += strlen (part) + 1;
val = NULL;
- GC_get_configuration_value_string (cfg, section, part, "", &val);
+ GNUNET_GC_get_configuration_value_string (cfg, section, part, "", &val);
if (val == NULL)
val = GNUNET_strdup ("");
len += strlen (val) + 2;
@@ -76,7 +76,7 @@
* require us to run gnunet-update!
*/
static void
-getVersionHash (struct GC_Configuration *cfg, GNUNET_EncName * enc)
+getVersionHash (struct GNUNET_GC_Configuration *cfg, GNUNET_EncName * enc)
{
GNUNET_HashCode hc;
char *string;
@@ -96,18 +96,18 @@
}
static char *
-getVersionFileName (struct GE_Context *ectx, struct GC_Configuration *cfg)
+getVersionFileName (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg)
{
char *en;
char *cn;
en = NULL;
- if (-1 == GC_get_configuration_value_filename (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_filename (cfg,
"GNUNETD",
"GNUNETD_HOME",
- VAR_DAEMON_DIRECTORY, &en))
+
GNUNET_DEFAULT_DAEMON_VAR_DIRECTORY, &en))
return NULL;
- GE_ASSERT (ectx, en != NULL);
+ GNUNET_GE_ASSERT (ectx, en != NULL);
cn = GNUNET_malloc (strlen (en) + strlen (VERSIONFILE) + 1);
strcpy (cn, en);
strcat (cn, VERSIONDIR);
@@ -125,7 +125,7 @@
* @return GNUNET_OK if we are
*/
int
-checkUpToDate (struct GE_Context *ectx, struct GC_Configuration *cfg)
+checkUpToDate (struct GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration
*cfg)
{
char version[MAX_VS];
int len;
@@ -135,8 +135,8 @@
fn = getVersionFileName (ectx, cfg);
if (fn == NULL)
{
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_BULK,
_
("Failed to determine filename used to store GNUnet version
information!\n"));
return GNUNET_OK; /* uh uh */
@@ -169,7 +169,7 @@
* Writes the version tag
*/
void
-upToDate (struct GE_Context *ectx, struct GC_Configuration *cfg)
+upToDate (struct GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration *cfg)
{
char version[MAX_VS];
int len;
@@ -178,7 +178,7 @@
fn = getVersionFileName (ectx, cfg);
len = strlen (VERSION) + 1 + sizeof (GNUNET_EncName);
- GE_ASSERT (ectx, len < MAX_VS);
+ GNUNET_GE_ASSERT (ectx, len < MAX_VS);
memcpy (version, VERSION, strlen (VERSION) + 1);
getVersionHash (cfg, &enc);
memcpy (&version[strlen (VERSION) + 1], &enc, sizeof (GNUNET_EncName));
Modified: GNUnet/src/server/version.h
===================================================================
--- GNUnet/src/server/version.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/server/version.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -33,11 +33,11 @@
* Check if we are up-to-date.
* @return GNUNET_OK if we are
*/
-int checkUpToDate (struct GE_Context *ectx, struct GC_Configuration *cfg);
+int checkUpToDate (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg);
/**
* We are up-to-date.
*/
-void upToDate (struct GE_Context *ectx, struct GC_Configuration *cfg);
+void upToDate (struct GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration
*cfg);
#endif
Modified: GNUnet/src/setup/gnunet-setup.c
===================================================================
--- GNUnet/src/setup/gnunet-setup.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/setup/gnunet-setup.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -33,18 +33,18 @@
typedef int (*ConfigurationPluginMain) (int argc,
char *const *argv,
struct GNUNET_PluginHandle * self,
- struct GE_Context * ectx,
- struct GC_Configuration * cfg,
- struct GNS_Context * gns,
+ struct GNUNET_GE_Context * ectx,
+ struct GNUNET_GC_Configuration * cfg,
+ struct GNUNET_GNS_Context * gns,
const char *filename, int is_daemon);
static int config_daemon;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
-static struct GNS_Context *gns;
+static struct GNUNET_GNS_Context *gns;
static char *cfgFilename;
@@ -57,13 +57,13 @@
gettext_noop ("generate configuration for gnunetd, the GNUnet daemon"),
0, &GNUNET_getopt_configure_set_one, &config_daemon},
GNUNET_COMMAND_LINE_OPTION_HELP (gettext_noop ("Tool to setup GNUnet.")),
/* -h */
- GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
+ GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGNUNET_GE_VERSION), /* -v */
GNUNET_COMMAND_LINE_OPTION_VERBOSE,
GNUNET_COMMAND_LINE_OPTION_END,
};
static void
-gns2cfg (struct GNS_Tree *pos)
+gns2cfg (struct GNUNET_GNS_TreeNode *pos)
{
int i;
char *val;
@@ -81,12 +81,12 @@
if ((pos->section == NULL) || (pos->option == NULL))
return;
if (GNUNET_NO ==
- GC_have_configuration_value (cfg, pos->section, pos->option))
+ GNUNET_GC_have_configuration_value (cfg, pos->section, pos->option))
{
- val = GNS_get_default_value_as_string (pos->type, &pos->value);
+ val = GNUNET_GNS_get_default_value_as_string (pos->type, &pos->value);
if (val != NULL)
{
- GC_set_configuration_value_string (cfg,
+ GNUNET_GC_set_configuration_value_string (cfg,
ectx,
pos->section, pos->option, val);
GNUNET_free (val);
@@ -150,22 +150,22 @@
char *specname;
int i;
- ectx = GE_create_context_stderr (GNUNET_NO,
- GE_WARNING | GE_ERROR | GE_FATAL |
- GE_USER | GE_ADMIN | GE_DEVELOPER |
- GE_IMMEDIATE | GE_BULK);
- GE_setDefaultContext (ectx);
+ ectx = GNUNET_GE_create_context_stderr (GNUNET_NO,
+ GNUNET_GE_WARNING | GNUNET_GE_ERROR |
GNUNET_GE_FATAL |
+ GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_DEVELOPER |
+ GNUNET_GE_IMMEDIATE | GNUNET_GE_BULK);
+ GNUNET_GE_setDefaultContext (ectx);
GNUNET_os_init (ectx);
- cfg = GC_create ();
- GE_ASSERT (ectx, cfg != NULL);
+ cfg = GNUNET_GC_create ();
+ GNUNET_GE_ASSERT (ectx, cfg != NULL);
i = GNUNET_parse_options (INFO,
ectx,
cfg,
gnunetsetupOptions, (unsigned int) argc, argv);
if (i < 0)
{
- GC_free (cfg);
- GE_free_context (ectx);
+ GNUNET_GC_free (cfg);
+ GNUNET_GE_free_context (ectx);
return -1;
}
if (i != argc - 1)
@@ -175,8 +175,8 @@
fprintf (stderr, _("Too many arguments.\n"));
return -1;
}
- GE_LOG (ectx,
- GE_WARNING | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("No interface specified, using default\n"));
operation = "config";
#if HAVE_DIALOG
@@ -194,8 +194,8 @@
config_daemon = GNUNET_YES; /* wizard implies daemon! */
if (cfgFilename == NULL)
cfgFilename = config_daemon
- ? GNUNET_strdup (DEFAULT_DAEMON_CONFIG_FILE)
- : GNUNET_strdup (DEFAULT_CLIENT_CONFIG_FILE);
+ ? GNUNET_strdup (GNUNET_DEFAULT_DAEMON_CONFIG_FILE)
+ : GNUNET_strdup (GNUNET_DEFAULT_CLIENT_CONFIG_FILE);
dirname = GNUNET_expand_file_name (ectx, cfgFilename);
GNUNET_free (cfgFilename);
cfgFilename = GNUNET_strdup (dirname);
@@ -213,15 +213,15 @@
GNUNET_disk_directory_create (ectx, dirname);
if (((0 != ACCESS (cfgFilename, W_OK)) &&
((errno != ENOENT) || (0 != ACCESS (dirname, W_OK)))))
- GE_DIE_STRERROR_FILE (ectx,
- GE_FATAL | GE_USER | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_DIE_STRERROR_FILE (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE,
"access", dirname);
GNUNET_free (dirname);
if (0 == ACCESS (cfgFilename, F_OK))
- GC_parse_configuration (cfg, cfgFilename);
+ GNUNET_GC_parse_configuration (cfg, cfgFilename);
dirname = GNUNET_get_installation_path (GNUNET_IPK_DATADIR);
- GE_ASSERT (ectx, dirname != NULL);
+ GNUNET_GE_ASSERT (ectx, dirname != NULL);
specname =
GNUNET_malloc (strlen (dirname) + strlen ("config-daemon.scm") + 1);
strcpy (specname, dirname);
@@ -230,16 +230,16 @@
strcat (specname, "config-daemon.scm");
else
strcat (specname, "config-client.scm");
- gns = GNS_load_specification (ectx, cfg, specname);
+ gns = GNUNET_GNS_load_specification (ectx, cfg, specname);
GNUNET_free (specname);
if (gns == NULL)
{
- GC_free (cfg);
- GE_free_context (ectx);
+ GNUNET_GC_free (cfg);
+ GNUNET_GE_free_context (ectx);
GNUNET_free (cfgFilename);
return -1;
}
- gns2cfg (GNS_get_tree (gns));
+ gns2cfg (GNUNET_GNS_get_tree_root (gns));
done = GNUNET_NO;
i = 0;
@@ -251,12 +251,12 @@
modules[i + 2], argc, argv,
cfgFilename) != GNUNET_YES)
{
- GE_LOG (ectx,
- GE_FATAL | GE_USER | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE,
_("`%s' is not available."), operation);
- GNS_free_specification (gns);
- GC_free (cfg);
- GE_free_context (ectx);
+ GNUNET_GNS_free_specification (gns);
+ GNUNET_GC_free (cfg);
+ GNUNET_GE_free_context (ectx);
GNUNET_free (cfgFilename);
return -1;
}
@@ -272,13 +272,13 @@
{
fprintf (stderr, _("Unknown operation `%s'\n"), operation);
fprintf (stderr, _("Use --help to get a list of options.\n"));
- GNS_free_specification (gns);
- GC_free (cfg);
- GE_free_context (ectx);
+ GNUNET_GNS_free_specification (gns);
+ GNUNET_GC_free (cfg);
+ GNUNET_GE_free_context (ectx);
return 1;
}
- GNS_free_specification (gns);
- GC_free (cfg);
- GE_free_context (ectx);
+ GNUNET_GNS_free_specification (gns);
+ GNUNET_GC_free (cfg);
+ GNUNET_GE_free_context (ectx);
return 0;
}
Modified: GNUnet/src/setup/gnunet-win-tool.c
===================================================================
--- GNUnet/src/setup/gnunet-win-tool.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/setup/gnunet-win-tool.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -42,7 +42,7 @@
0;
static char *hashFile = NULL;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
/**
* All gnunet-win-tool command line options
@@ -352,17 +352,17 @@
res = GNUNET_OK;
/* startup */
- ectx = GE_create_context_stderr (GNUNET_NO,
- GE_WARNING | GE_ERROR | GE_FATAL |
- GE_USER | GE_ADMIN | GE_DEVELOPER |
- GE_IMMEDIATE | GE_BULK);
+ ectx = GNUNET_GE_create_context_stderr (GNUNET_NO,
+ GNUNET_GE_WARNING | GNUNET_GE_ERROR |
GNUNET_GE_FATAL |
+ GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_DEVELOPER |
+ GNUNET_GE_IMMEDIATE | GNUNET_GE_BULK);
res = GNUNET_parse_options ("gnunet-win-tool [OPTIONS] [KEYWORDS]",
ectx,
NULL,
gnunetwinOptions, (unsigned int) argc, argv);
if (res == GNUNET_SYSERR)
{
- GE_free_context (ectx);
+ GNUNET_GE_free_context (ectx);
return -1;
}
@@ -377,7 +377,7 @@
if (hashFile)
doHash ();
- GE_free_context (ectx);
+ GNUNET_GE_free_context (ectx);
return (res == GNUNET_OK) ? 0 : 1;
}
Modified: GNUnet/src/setup/gtk/gconf.c
===================================================================
--- GNUnet/src/setup/gtk/gconf.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/setup/gtk/gconf.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -57,14 +57,14 @@
static GtkListStore *no_model;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
static const char *cfg_filename;
static void
-addToTree (GtkTreeStore * model, GtkTreeIter * parent, struct GNS_Tree *pos)
+addToTree (GtkTreeStore * model, GtkTreeIter * parent, struct
GNUNET_GNS_TreeNode *pos)
{
GtkTreeIter it;
GtkTreeIter it2;
@@ -99,9 +99,9 @@
SETUP_COMBO_VIS, FALSE,
SETUP_DESCRIPTION, pos->description,
SETUP_HELPTEXT, pos->help, -1);
- switch (pos->type & GNS_KindMask)
+ switch (pos->type & GNUNET_GNS_KIND_MASK)
{
- case GNS_Node:
+ case GNUNET_GNS_KIND_NODE:
i = 0;
while (pos->children[i] != NULL)
{
@@ -109,10 +109,10 @@
i++;
}
break;
- case GNS_Leaf:
- switch (pos->type & GNS_TypeMask)
+ case GNUNET_GNS_KIND_LEAF:
+ switch (pos->type & GNUNET_GNS_TYPE_MASK)
{
- case GNS_Boolean:
+ case GNUNET_GNS_TYPE_BOOLEAN:
cmodel = gtk_list_store_new (1, G_TYPE_STRING);
gtk_list_store_insert_with_values (cmodel, &it2, -1, 0, "YES", -1);
gtk_list_store_insert_with_values (cmodel, &it2, -1, 0, "NO", -1);
@@ -125,7 +125,7 @@
SETUP_TEXT_VALUE,
pos->value.Boolean.val ? "YES" : "NO", -1);
break;
- case GNS_String:
+ case GNUNET_GNS_TYPE_STRING:
cmodel = gtk_list_store_new (1, G_TYPE_STRING);
gtk_tree_store_set (model,
&it,
@@ -148,7 +148,7 @@
SETUP_TEXT_VIS, TRUE,
SETUP_COMBO_VIS, TRUE, -1);
break;
- case GNS_MC:
+ case GNUNET_GNS_TYPE_MULTIPLE_CHOICE:
cmodel = gtk_list_store_new (1, G_TYPE_STRING);
gtk_tree_store_set (model,
&it,
@@ -190,7 +190,7 @@
fprintf (stderr,
"Too many choices in multiple choice for `%s': %d\n",
pos->option, i);
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
}
GNUNET_free (tmp);
gtk_tree_store_set (model,
@@ -198,7 +198,7 @@
SETUP_TEXT_VIS, TRUE,
SETUP_COMBO_VIS, TRUE, -1);
break;
- case GNS_SC:
+ case GNUNET_GNS_TYPE_SINGLE_CHOICE:
cmodel = gtk_list_store_new (1, G_TYPE_STRING);
gtk_tree_store_set (model,
&it,
@@ -218,7 +218,7 @@
}
gtk_tree_store_set (model, &it, SETUP_COMBO_VIS, TRUE, -1);
break;
- case GNS_Double:
+ case GNUNET_GNS_TYPE_DOUBLE:
cmodel = gtk_list_store_new (1, G_TYPE_STRING);
GNUNET_snprintf (defStr, 128, "%f", pos->value.Double.def);
GNUNET_snprintf (valStr, 128, "%f", pos->value.Double.val);
@@ -236,7 +236,7 @@
SETUP_TEXT_VIS, TRUE,
SETUP_COMBO_MODEL, cmodel, -1);
break;
- case GNS_UInt64:
+ case GNUNET_GNS_TYPE_UINT64:
cmodel = gtk_list_store_new (1, G_TYPE_STRING);
GNUNET_snprintf (defStr, 128, "%llu", pos->value.UInt64.def);
GNUNET_snprintf (valStr, 128, "%llu", pos->value.UInt64.val);
@@ -255,14 +255,14 @@
SETUP_COMBO_MODEL, cmodel, -1);
break;
default:
- GE_ASSERT (NULL, 0);
+ GNUNET_GE_ASSERT (NULL, 0);
gtk_tree_store_remove (model, &it);
return;
}
break;
- case GNS_Root:
+ case GNUNET_GNS_KIND_ROOT:
default:
- GE_ASSERT (NULL, 0);
+ GNUNET_GE_ASSERT (NULL, 0);
gtk_tree_store_remove (model, &it);
return;
}
@@ -284,11 +284,11 @@
}
static void
-updateTreeModel (struct GNS_Context *gns)
+updateTreeModel (struct GNUNET_GNS_Context *gns)
{
GtkWidget *treeView;
GtkTreeStore *model;
- struct GNS_Tree *tree;
+ struct GNUNET_GNS_TreeNode *tree;
CR_Context crCTX;
GtkTreePath *path;
int i;
@@ -312,7 +312,7 @@
G_TYPE_STRING, /* description */
G_TYPE_STRING); /* help text */
- tree = GNS_get_tree (gns);
+ tree = GNUNET_GNS_get_tree_root (gns);
i = 0;
while (tree->children[i] != NULL)
{
@@ -343,7 +343,7 @@
editedTextHandler (GtkCellRendererToggle * rdner,
gchar * path, gchar * new_value, gpointer user_data)
{
- struct GNS_Context *gns = user_data;
+ struct GNUNET_GNS_Context *gns = user_data;
GtkTreePath *gtk_path;
GtkTreeIter iter;
GtkWidget *treeView;
@@ -356,7 +356,7 @@
gtk_path = gtk_tree_path_new_from_string (path);
if (TRUE != gtk_tree_model_get_iter (model, &iter, gtk_path))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
gtk_tree_path_free (gtk_path);
return;
}
@@ -364,14 +364,14 @@
gtk_tree_model_get (model,
&iter,
SETUP_SECTION, §ion, SETUP_OPTION, &option, -1);
- GC_set_configuration_value_string (cfg, ectx, section, option, new_value);
+ GNUNET_GC_set_configuration_value_string (cfg, ectx, section, option,
new_value);
updateTreeModel (gns);
free (section);
free (option);
}
static void
-initTreeView (struct GNS_Context *gns)
+initTreeView (struct GNUNET_GNS_Context *gns)
{
GtkWidget *treeView;
GtkTreeViewColumn *column;
@@ -481,7 +481,7 @@
{
GtkWidget *dialog;
- if (0 == GC_write_configuration (cfg, cfg_filename))
+ if (0 == GNUNET_GC_write_configuration (cfg, cfg_filename))
{
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_MODAL,
@@ -517,7 +517,7 @@
GtkWidget *dialog;
gint ret;
- if (GC_test_dirty (cfg))
+ if (GNUNET_GC_test_dirty (cfg))
{
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_MODAL,
@@ -529,7 +529,7 @@
switch (ret)
{
case GTK_RESPONSE_YES:
- if (0 != GC_write_configuration (cfg, cfg_filename))
+ if (0 != GNUNET_GC_write_configuration (cfg, cfg_filename))
{
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_MODAL,
@@ -564,9 +564,9 @@
int
gconf_main_post_init (struct GNUNET_PluginHandle *self,
- struct GE_Context *e,
- struct GC_Configuration *c,
- struct GNS_Context *gns,
+ struct GNUNET_GE_Context *e,
+ struct GNUNET_GC_Configuration *c,
+ struct GNUNET_GNS_Context *gns,
const char *filename, int is_daemon)
{
GtkWidget *mainWindow;
@@ -600,9 +600,9 @@
gconf_mainsetup_gtk (int argc,
const char **argv,
struct GNUNET_PluginHandle *self,
- struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- struct GNS_Context *gns,
+ struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GNS_Context *gns,
const char *filename, int is_daemon)
{
g_thread_init (NULL);
Modified: GNUnet/src/setup/gtk/gconf.h
===================================================================
--- GNUnet/src/setup/gtk/gconf.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/setup/gtk/gconf.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -31,15 +31,15 @@
int gconf_mainsetup_gtk (int argc,
const char **argv,
struct GNUNET_PluginHandle *self,
- struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- struct GNS_Context *gns,
+ struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GNS_Context *gns,
const char *filename, int is_daemon);
int gconf_main_post_init (struct GNUNET_PluginHandle *lib,
- struct GE_Context *e,
- struct GC_Configuration *c,
- struct GNS_Context *gns,
+ struct GNUNET_GE_Context *e,
+ struct GNUNET_GC_Configuration *c,
+ struct GNUNET_GNS_Context *gns,
const char *filename, int is_daemon);
#endif
Modified: GNUnet/src/setup/gtk/glade_support.c
===================================================================
--- GNUnet/src/setup/gtk/glade_support.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/setup/gtk/glade_support.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -33,7 +33,7 @@
static GladeXML *mainXML_;
GladeXML *
-getMainXML ()
+GNUNET_GTK_get_main_glade_XML ()
{
return mainXML_;
}
@@ -41,7 +41,7 @@
void
destroyMainXML ()
{
- GE_ASSERT (NULL, mainXML_ != NULL);
+ GNUNET_GE_ASSERT (NULL, mainXML_ != NULL);
g_object_unref (mainXML_);
mainXML_ = NULL;
}
@@ -71,7 +71,7 @@
GladeXML *xml = user_data;
void *method;
- GE_ASSERT (NULL, xml != NULL);
+ GNUNET_GE_ASSERT (NULL, xml != NULL);
method = GNUNET_plugin_resolve_function (library, handler_name, GNUNET_YES);
if (method == NULL)
return;
@@ -85,10 +85,10 @@
GladeXML *ret;
gladeFile = get_glade_filename ();
- ret = glade_xml_new (gladeFile, dialog_name, PACKAGE_NAME);
+ ret = glade_xml_new (gladeFile, dialog_name, PACKAGNUNET_GE_NAME);
if (ret == NULL)
- GE_DIE_STRERROR_FILE (NULL,
- GE_USER | GE_ADMIN | GE_FATAL | GE_IMMEDIATE,
+ GNUNET_GE_DIE_STRERROR_FILE (NULL,
+ GNUNET_GE_USER | GNUNET_GE_ADMIN | GNUNET_GE_FATAL |
GNUNET_GE_IMMEDIATE,
"open", gladeFile);
GNUNET_free (gladeFile);
glade_xml_signal_autoconnect_full (ret, &connector, ret);
@@ -120,10 +120,10 @@
GladeXML *myXML;
gladeFile = get_glade_filename ();
- myXML = glade_xml_new (gladeFile, name, PACKAGE_NAME);
+ myXML = glade_xml_new (gladeFile, name, PACKAGNUNET_GE_NAME);
if (mainXML_ == NULL)
- GE_DIE_STRERROR_FILE (NULL,
- GE_USER | GE_ADMIN | GE_FATAL | GE_IMMEDIATE,
+ GNUNET_GE_DIE_STRERROR_FILE (NULL,
+ GNUNET_GE_USER | GNUNET_GE_ADMIN | GNUNET_GE_FATAL |
GNUNET_GE_IMMEDIATE,
"open", gladeFile);
GNUNET_free (gladeFile);
glade_xml_signal_autoconnect_full (myXML, &connector, myXML);
Modified: GNUnet/src/setup/gtk/glade_support.h
===================================================================
--- GNUnet/src/setup/gtk/glade_support.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/setup/gtk/glade_support.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -25,9 +25,9 @@
#include <gtk/gtktext.h>
#include <glade/glade.h>
-#define mainXML getMainXML()
+#define mainXML GNUNET_GTK_get_main_glade_XML()
-GladeXML *getMainXML (void);
+GladeXML *GNUNET_GTK_get_main_glade_XML (void);
void destroyMainXML (void);
Modified: GNUnet/src/setup/gtk/ngconf.c
===================================================================
--- GNUnet/src/setup/gtk/ngconf.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/setup/gtk/ngconf.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -31,16 +31,16 @@
static GtkListStore *no_model;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
static const char *cfg_filename;
struct P2W
{
struct P2W *next;
- struct GNS_Tree *pos;
+ struct GNUNET_GNS_TreeNode *pos;
GtkWidget *w;
};
@@ -82,7 +82,7 @@
}
static void
-link_visibility (struct GNS_Tree *pos, GtkWidget * w)
+link_visibility (struct GNUNET_GNS_TreeNode *pos, GtkWidget * w)
{
struct P2W *pw;
pw = GNUNET_malloc (sizeof (struct P2W));
@@ -95,8 +95,8 @@
static void
boolean_toggled (GtkToggleButton * togglebutton, gpointer user_data)
{
- struct GNS_Tree *pos = user_data;
- GC_set_configuration_value_string (cfg,
+ struct GNUNET_GNS_TreeNode *pos = user_data;
+ GNUNET_GC_set_configuration_value_string (cfg,
ectx,
pos->section,
pos->option,
@@ -108,11 +108,11 @@
static void
radio_update (GtkRadioButton * button, gpointer user_data)
{
- struct GNS_Tree *pos = user_data;
+ struct GNUNET_GNS_TreeNode *pos = user_data;
const char *opt;
opt = g_object_get_data (G_OBJECT (button), "SC-value");
- GC_set_configuration_value_string (cfg,
+ GNUNET_GC_set_configuration_value_string (cfg,
ectx, pos->section, pos->option, opt);
update_visibility ();
}
@@ -120,7 +120,7 @@
static void
multi_update (GtkToggleButton * button, gpointer user_data)
{
- struct GNS_Tree *pos = user_data;
+ struct GNUNET_GNS_TreeNode *pos = user_data;
char *val;
char *opt;
char *ret;
@@ -128,9 +128,9 @@
char *s;
val = NULL;
- GC_get_configuration_value_string (cfg,
+ GNUNET_GC_get_configuration_value_string (cfg,
pos->section, pos->option, NULL, &val);
- GE_ASSERT (ectx, val != NULL);
+ GNUNET_GE_ASSERT (ectx, val != NULL);
opt = g_object_get_data (G_OBJECT (button), "MC-value");
if (gtk_toggle_button_get_active (button))
{
@@ -146,7 +146,7 @@
(((s[strlen (opt)] != '\0') &&
(s[strlen (opt)] != ' ')) || ((s != val) && (s[-1] != ' '))))
v = s + 1;
- GE_ASSERT (NULL, s != NULL);
+ GNUNET_GE_ASSERT (NULL, s != NULL);
ret = GNUNET_malloc (strlen (val));
s[0] = '\0';
if (s != val)
@@ -154,7 +154,7 @@
strcpy (ret, val);
strcat (ret, &s[strlen (opt)]);
}
- GC_set_configuration_value_string (cfg,
+ GNUNET_GC_set_configuration_value_string (cfg,
ectx, pos->section, pos->option, ret);
GNUNET_free (ret);
GNUNET_free (val);
@@ -164,8 +164,8 @@
static void
string_update (GtkEntry * entry, gpointer user_data)
{
- struct GNS_Tree *pos = user_data;
- GC_set_configuration_value_string (cfg,
+ struct GNUNET_GNS_TreeNode *pos = user_data;
+ GNUNET_GC_set_configuration_value_string (cfg,
ectx,
pos->section,
pos->option, gtk_entry_get_text (entry));
@@ -173,7 +173,7 @@
}
static int
-addLeafToTree (GtkWidget * parent, struct GNS_Tree *pos)
+addLeafToTree (GtkWidget * parent, struct GNUNET_GNS_TreeNode *pos)
{
GtkWidget *ebox;
GtkWidget *box;
@@ -186,9 +186,9 @@
box = gtk_hbox_new (FALSE, 0);
link_visibility (pos, box);
- switch (pos->type & GNS_TypeMask)
+ switch (pos->type & GNUNET_GNS_TYPE_MASK)
{
- case GNS_Boolean:
+ case GNUNET_GNS_TYPE_BOOLEAN:
w = gtk_check_button_new_with_label (pos->description);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w),
pos->value.Boolean.val);
@@ -196,7 +196,7 @@
g_signal_connect (w, "toggled", G_CALLBACK (&boolean_toggled), pos);
gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 10);
break;
- case GNS_String:
+ case GNUNET_GNS_TYPE_STRING:
ebox = gtk_vbox_new (FALSE, 10);
w = gtk_entry_new ();
label = gtk_label_new (pos->description);
@@ -208,7 +208,7 @@
gtk_box_pack_start (GTK_BOX (ebox), w, TRUE, TRUE, 10);
gtk_box_pack_start (GTK_BOX (box), ebox, TRUE, TRUE, 10);
break;
- case GNS_MC:
+ case GNUNET_GNS_TYPE_MULTIPLE_CHOICE:
i = 0;
label = gtk_label_new (pos->description);
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 10);
@@ -236,7 +236,7 @@
i++;
}
break;
- case GNS_SC:
+ case GNUNET_GNS_TYPE_SINGLE_CHOICE:
w = NULL;
i = 0;
choice = NULL;
@@ -261,7 +261,7 @@
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (choice), TRUE);
break;
- case GNS_Double:
+ case GNUNET_GNS_TYPE_DOUBLE:
GNUNET_snprintf (defStr, 128, "%llf", pos->value.Double.val);
w = gtk_entry_new ();
tooltip (w, pos->help);
@@ -272,7 +272,7 @@
gtk_entry_set_text (GTK_ENTRY (w), defStr);
gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 0);
break;
- case GNS_UInt64:
+ case GNUNET_GNS_TYPE_UINT64:
w = gtk_spin_button_new_with_range (pos->value.UInt64.min,
pos->value.UInt64.max, 1);
tooltip (w, pos->help);
@@ -286,7 +286,7 @@
gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 0);
break;
default:
- GE_ASSERT (NULL, 0);
+ GNUNET_GE_ASSERT (NULL, 0);
return 0;
}
gtk_box_pack_start (GTK_BOX (parent), box, FALSE, FALSE, 10);
@@ -294,10 +294,10 @@
}
static int
-addNodeToTree (GtkNotebook * parent, struct GNS_Tree *pos)
+addNodeToTree (GtkNotebook * parent, struct GNUNET_GNS_TreeNode *pos)
{
int i;
- struct GNS_Tree *child;
+ struct GNUNET_GNS_TreeNode *child;
GtkNotebook *notebook;
GtkWidget *vbox;
GtkWidget *label;
@@ -310,9 +310,9 @@
notebook = NULL;
while (NULL != (child = pos->children[i]))
{
- switch (child->type & GNS_KindMask)
+ switch (child->type & GNUNET_GNS_KIND_MASK)
{
- case GNS_Node:
+ case GNUNET_GNS_KIND_NODE:
if (notebook == NULL)
{
notebook = GTK_NOTEBOOK (gtk_notebook_new ());
@@ -321,12 +321,12 @@
}
have = have | addNodeToTree (notebook, child);
break;
- case GNS_Leaf:
+ case GNUNET_GNS_KIND_LEAF:
have = have | addLeafToTree (vbox, child);
break;
- case GNS_Root:
+ case GNUNET_GNS_KIND_ROOT:
default:
- GE_ASSERT (NULL, 0);
+ GNUNET_GE_ASSERT (NULL, 0);
break;
}
i++;
@@ -353,11 +353,11 @@
}
static void
-initView (struct GNS_Context *gns)
+initView (struct GNUNET_GNS_Context *gns)
{
GtkNotebook *notebook;
notebook = GTK_NOTEBOOK (lookup_widget ("configNotebook"));
- addNodeToTree (notebook, GNS_get_tree (gns));
+ addNodeToTree (notebook, GNUNET_GNS_get_tree_root (gns));
gtk_widget_show_all (GTK_WIDGET (notebook));
update_visibility ();
}
@@ -370,7 +370,7 @@
on_saveButton_activatesetup_gtk ()
{
GtkWidget *dialog;
- if (0 == GC_write_configuration (cfg, cfg_filename))
+ if (0 == GNUNET_GC_write_configuration (cfg, cfg_filename))
{
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_MODAL,
@@ -405,7 +405,7 @@
{
GtkWidget *dialog;
gint ret;
- if (GC_test_dirty (cfg))
+ if (GNUNET_GC_test_dirty (cfg))
{
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_MODAL,
@@ -417,7 +417,7 @@
switch (ret)
{
case GTK_RESPONSE_YES:
- if (0 != GC_write_configuration (cfg, cfg_filename))
+ if (0 != GNUNET_GC_write_configuration (cfg, cfg_filename))
{
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_MODAL,
@@ -455,12 +455,12 @@
GNUNET_PluginHandle
*self,
struct
- GE_Context *e,
+ GNUNET_GE_Context *e,
struct
- GC_Configuration
+ GNUNET_GC_Configuration
*c,
struct
- GNS_Context *gns, const char *filename, int is_daemon)
+ GNUNET_GNS_Context *gns, const char *filename, int
is_daemon)
{
GtkWidget *mainWindow;
cfg = c;
@@ -498,13 +498,13 @@
struct
GNUNET_PluginHandle
*self,
- struct GE_Context
+ struct GNUNET_GE_Context
*ectx,
struct
- GC_Configuration
+ GNUNET_GC_Configuration
*cfg,
struct
- GNS_Context *gns, const char *filename, int is_daemon)
+ GNUNET_GNS_Context *gns, const char *filename, int
is_daemon)
{
g_thread_init (NULL);
gtk_init (&argc, (char ***) &argv);
Modified: GNUnet/src/setup/gtk/wizard_gtk.c
===================================================================
--- GNUnet/src/setup/gtk/wizard_gtk.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/setup/gtk/wizard_gtk.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -47,9 +47,9 @@
static char *group_name = NULL;
-static struct GC_Configuration *editCfg = NULL;
+static struct GNUNET_GC_Configuration *editCfg = NULL;
-static struct GE_Context *err_ctx = NULL;
+static struct GNUNET_GE_Context *err_ctx = NULL;
static const char *cfg_fn = NULL;
@@ -65,8 +65,8 @@
static void
destroyCurrentWindow ()
{
- GE_ASSERT (err_ctx, mainXML != NULL);
- GE_ASSERT (err_ctx, curwnd != NULL);
+ GNUNET_GE_ASSERT (err_ctx, mainXML != NULL);
+ GNUNET_GE_ASSERT (err_ctx, curwnd != NULL);
quit = 0;
gtk_widget_destroy (curwnd);
curwnd = NULL;
@@ -121,9 +121,9 @@
#else
nic = entry;
#endif
- GC_set_configuration_value_string (editCfg,
+ GNUNET_GC_set_configuration_value_string (editCfg,
err_ctx, "NETWORK", "INTERFACE", nic);
- GC_set_configuration_value_string (editCfg,
+ GNUNET_GC_set_configuration_value_string (editCfg,
err_ctx, "LOAD", "INTERFACES", nic);
}
@@ -161,7 +161,7 @@
destroyCurrentWindow ();
curwnd = get_xml ("assi_step2");
cls.cmbNIC = lookup_widget ("cmbNIC");
- GE_ASSERT (err_ctx, cls.cmbNIC != NULL);
+ GNUNET_GE_ASSERT (err_ctx, cls.cmbNIC != NULL);
cls.nic_item_count = 0;
model = gtk_list_store_new (1, G_TYPE_STRING);
gtk_combo_box_set_model (GTK_COMBO_BOX (cls.cmbNIC),
@@ -172,7 +172,7 @@
if (cls.nic_item_count != 0)
{
- GC_get_configuration_value_string (editCfg,
+ GNUNET_GC_get_configuration_value_string (editCfg,
"NETWORK",
"INTERFACE", "eth0", &val);
gtk_combo_box_append_text (GTK_COMBO_BOX (cls.cmbNIC), val);
@@ -185,13 +185,13 @@
gtk_widget_set_usize (cls.cmbNIC, 10, -1);
entIP = lookup_widget ("entIP");
- GC_get_configuration_value_string (editCfg, "NETWORK", "IP", "", &val);
+ GNUNET_GC_get_configuration_value_string (editCfg, "NETWORK", "IP", "",
&val);
gtk_entry_set_text (GTK_ENTRY (entIP), val);
GNUNET_free (val);
chkFW = lookup_widget ("chkFW");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chkFW),
- GC_get_configuration_value_yesno (editCfg,
+ GNUNET_GC_get_configuration_value_yesno
(editCfg,
"NAT",
"LIMITED",
GNUNET_NO)
@@ -217,24 +217,24 @@
radGNUnet = lookup_widget ("radGNUnet");
radShare = lookup_widget ("radShare");
entCPU = lookup_widget ("entCPU");
- GC_get_configuration_value_string (editCfg,
+ GNUNET_GC_get_configuration_value_string (editCfg,
"LOAD",
"MAXNETUPBPSTOTAL", "50000", &val);
gtk_entry_set_text (GTK_ENTRY (entUp), val);
GNUNET_free (val);
- GC_get_configuration_value_string (editCfg,
+ GNUNET_GC_get_configuration_value_string (editCfg,
"LOAD",
"MAXNETDOWNBPSTOTAL", "50000", &val);
gtk_entry_set_text (GTK_ENTRY (entDown), val);
GNUNET_free (val);
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON
- ((GC_get_configuration_value_yesno (editCfg,
+ ((GNUNET_GC_get_configuration_value_yesno (editCfg,
"LOAD",
"BASICLIMITING",
GNUNET_NO) == GNUNET_YES)
? radGNUnet : radShare), TRUE);
- GC_get_configuration_value_string (editCfg,
+ GNUNET_GC_get_configuration_value_string (editCfg,
"LOAD", "MAXCPULOAD", "50", &val);
gtk_entry_set_text (GTK_ENTRY (entCPU), val);
GNUNET_free (val);
@@ -258,13 +258,13 @@
if (NULL != user_name)
{
- GC_get_configuration_value_string (editCfg,
+ GNUNET_GC_get_configuration_value_string (editCfg,
"GNUNETD", "USER", "gnunet", &uname);
}
if (NULL != group_name)
{
- GC_get_configuration_value_string (editCfg,
+ GNUNET_GC_get_configuration_value_string (editCfg,
"GNUNETD",
"GROUP", "gnunet", &gname);
}
@@ -348,12 +348,12 @@
chkStart = lookup_widget ("chkStart");
chkEnh = lookup_widget ("chkEnh");
- GC_get_configuration_value_string (editCfg, "FS", "QUOTA", "1024", &val);
+ GNUNET_GC_get_configuration_value_string (editCfg, "FS", "QUOTA", "1024",
&val);
gtk_entry_set_text (GTK_ENTRY (entQuota), val);
GNUNET_free (val);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chkMigr),
- GC_get_configuration_value_yesno (editCfg,
+ GNUNET_GC_get_configuration_value_yesno
(editCfg,
"FS",
"ACTIVEMIGRATION",
GNUNET_YES)
@@ -364,7 +364,7 @@
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chkStart),
- GC_get_configuration_value_yesno (editCfg,
+ GNUNET_GC_get_configuration_value_yesno
(editCfg,
"GNUNETD",
"AUTOSTART",
GNUNET_NO)
@@ -406,7 +406,7 @@
char *err;
const char *prefix;
- if (GC_write_configuration (editCfg, cfg_fn))
+ if (GNUNET_GC_write_configuration (editCfg, cfg_fn))
{
prefix = _("Unable to save configuration file `%s':");
@@ -508,7 +508,7 @@
gchar *ret;
ret = gtk_editable_get_chars (editable, 0, -1);
- GC_set_configuration_value_string (editCfg, err_ctx, "NETWORK", "IP", ret);
+ GNUNET_GC_set_configuration_value_string (editCfg, err_ctx, "NETWORK", "IP",
ret);
g_free (ret);
}
@@ -516,7 +516,7 @@
void
on_chkFW_toggledsetup_gtk (GtkToggleButton * togglebutton, gpointer user_data)
{
- GC_set_configuration_value_choice (editCfg, err_ctx, "NAT", "LIMITED",
+ GNUNET_GC_set_configuration_value_choice (editCfg, err_ctx, "NAT", "LIMITED",
gtk_toggle_button_get_active
(togglebutton) ? "YES" : "NO");
}
@@ -527,7 +527,7 @@
gchar *ret;
ret = gtk_editable_get_chars (editable, 0, -1);
- GC_set_configuration_value_string (editCfg,
+ GNUNET_GC_set_configuration_value_string (editCfg,
err_ctx,
"LOAD", "MAXNETUPBPSTOTAL", ret);
g_free (ret);
@@ -540,7 +540,7 @@
gchar *ret;
ret = gtk_editable_get_chars (editable, 0, -1);
- GC_set_configuration_value_string (editCfg,
+ GNUNET_GC_set_configuration_value_string (editCfg,
err_ctx,
"LOAD", "MAXNETDOWNBPSTOTAL", ret);
g_free (ret);
@@ -551,7 +551,7 @@
on_radGNUnet_toggledsetup_gtk (GtkToggleButton * togglebutton,
gpointer user_data)
{
- GC_set_configuration_value_choice (editCfg,
+ GNUNET_GC_set_configuration_value_choice (editCfg,
err_ctx,
"LOAD",
"BASICLIMITING",
@@ -564,7 +564,7 @@
on_radShare_toggledsetup_gtk (GtkToggleButton * togglebutton,
gpointer user_data)
{
- GC_set_configuration_value_choice (editCfg,
+ GNUNET_GC_set_configuration_value_choice (editCfg,
err_ctx,
"LOAD",
"BASICLIMITING",
@@ -581,7 +581,7 @@
ret = gtk_editable_get_chars (editable, 0, -1);
num = atoi (ret);
- GC_set_configuration_value_number (editCfg, err_ctx, "LOAD", "MAXCPULOAD",
+ GNUNET_GC_set_configuration_value_number (editCfg, err_ctx, "LOAD",
"MAXCPULOAD",
num);
g_free (ret);
}
@@ -590,7 +590,7 @@
on_chkMigr_toggledsetup_gtk (GtkToggleButton * togglebutton,
gpointer user_data)
{
- GC_set_configuration_value_choice (editCfg,
+ GNUNET_GC_set_configuration_value_choice (editCfg,
err_ctx,
"FS",
"ACTIVEMIGRATION",
@@ -604,7 +604,7 @@
gchar *ret;
ret = gtk_editable_get_chars (editable, 0, -1);
- GC_set_configuration_value_string (editCfg, err_ctx, "FS", "QUOTA", ret);
+ GNUNET_GC_set_configuration_value_string (editCfg, err_ctx, "FS", "QUOTA",
ret);
g_free (ret);
}
@@ -614,7 +614,7 @@
gpointer user_data)
{
doAutoStart = gtk_toggle_button_get_active (togglebutton);
- GC_set_configuration_value_choice (editCfg,
+ GNUNET_GC_set_configuration_value_choice (editCfg,
err_ctx,
"GNUNETD",
"AUTOSTART", doAutoStart ? "YES" : "NO");
@@ -641,8 +641,8 @@
gchar *ret;
ret = gtk_editable_get_chars (editable, 0, -1);
- GE_ASSERT (err_ctx, ret != NULL);
- GC_set_configuration_value_string (editCfg, err_ctx, "GNUNETD", "USER",
+ GNUNET_GE_ASSERT (err_ctx, ret != NULL);
+ GNUNET_GC_set_configuration_value_string (editCfg, err_ctx, "GNUNETD",
"USER",
ret);
GNUNET_free_non_null (user_name);
if (strlen (ret) != 0)
@@ -660,8 +660,8 @@
GNUNET_free_non_null (group_name);
ret = gtk_editable_get_chars (editable, 0, -1);
- GE_ASSERT (err_ctx, ret != NULL);
- GC_set_configuration_value_string (editCfg,
+ GNUNET_GE_ASSERT (err_ctx, ret != NULL);
+ GNUNET_GC_set_configuration_value_string (editCfg,
err_ctx, "GNUNETD", "GROUP", ret);
if (strlen (ret) != 0)
group_name = GNUNET_strdup (ret);
@@ -674,12 +674,12 @@
gtk_wizard_mainsetup_gtk (int argc,
char *const *argv,
struct GNUNET_PluginHandle *self,
- struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- struct GNS_Context *gns,
+ struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GNS_Context *gns,
const char *filename, int is_daemon)
{
- GE_ASSERT (ectx, is_daemon);
+ GNUNET_GE_ASSERT (ectx, is_daemon);
g_thread_init (NULL);
gtk_init (&argc, (char ***) &argv);
#ifdef ENABLE_NLS
Modified: GNUnet/src/setup/gtk/wizard_gtk.h
===================================================================
--- GNUnet/src/setup/gtk/wizard_gtk.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/setup/gtk/wizard_gtk.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -34,9 +34,9 @@
int gtk_wizard_mainsetup_gtk (int argc,
char *const *argv,
struct GNUNET_PluginHandle *self,
- struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- struct GNS_Context *gns,
+ struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GNS_Context *gns,
const char *filename, int is_daemon);
#endif
Modified: GNUnet/src/setup/lib/gns.c
===================================================================
--- GNUnet/src/setup/lib/gns.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/setup/lib/gns.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -33,7 +33,7 @@
typedef struct GNS_TCL
{
- GNS_TreeChangeListener l;
+ GNUNET_GNS_TreeChangeListener l;
void *c;
@@ -44,14 +44,14 @@
/**
* @brief gnunet setup context
*/
-struct GNS_Context
+struct GNUNET_GNS_Context
{
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
- struct GNS_Tree *root;
+ struct GNUNET_GNS_TreeNode *root;
GNS_TCL *listeners;
@@ -60,9 +60,9 @@
};
static void
-notify_listeners (void *ctx, struct GNS_Tree *tree)
+notify_listeners (void *ctx, struct GNUNET_GNS_TreeNode *tree)
{
- struct GNS_Context *g = ctx;
+ struct GNUNET_GNS_Context *g = ctx;
GNS_TCL *lpos;
if (g->in_notify > 0)
@@ -89,38 +89,38 @@
*/
int
configChangeListener (void *ctx,
- struct GC_Configuration *cfg,
- struct GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
const char *section, const char *option)
{
- struct GNS_Context *g = ctx;
- struct GNS_Tree *pos;
+ struct GNUNET_GNS_Context *g = ctx;
+ struct GNUNET_GNS_TreeNode *pos;
pos = tree_lookup (g->root, section, option);
if (pos == NULL)
{
- GE_LOG (g->ectx,
- GE_DEVELOPER | GE_BULK | GE_ERROR,
+ GNUNET_GE_LOG (g->ectx,
+ GNUNET_GE_DEVELOPER | GNUNET_GE_BULK | GNUNET_GE_ERROR,
"Tree lookup for unknown option `%s' in section `%s'!\n",
option, section);
return 0; /* or refuse? */
}
/* first, check if value is valid */
- if ((pos->type & GNS_KindMask) != GNS_Leaf)
+ if ((pos->type & GNUNET_GNS_KIND_MASK) != GNUNET_GNS_KIND_LEAF)
{
- GE_LOG (g->ectx,
- GE_DEVELOPER | GE_BULK | GE_ERROR,
+ GNUNET_GE_LOG (g->ectx,
+ GNUNET_GE_DEVELOPER | GNUNET_GE_BULK | GNUNET_GE_ERROR,
"Tree value change for non-leaf option `%s' in section `%s'!\n",
option, section);
return 0;
}
- switch (pos->type & GNS_TypeMask)
+ switch (pos->type & GNUNET_GNS_TYPE_MASK)
{
- case GNS_Boolean:
+ case GNUNET_GNS_TYPE_BOOLEAN:
{
int val;
- val = GC_get_configuration_value_yesno (cfg,
+ val = GNUNET_GC_get_configuration_value_yesno (cfg,
section,
option,
pos->value.Boolean.def);
@@ -131,11 +131,11 @@
pos->value.Boolean.val = val;
break;
}
- case GNS_UInt64:
+ case GNUNET_GNS_TYPE_UINT64:
{
unsigned long long val;
- if (GNUNET_SYSERR == GC_get_configuration_value_number (cfg,
+ if (GNUNET_SYSERR == GNUNET_GC_get_configuration_value_number (cfg,
section,
option,
pos->value.
@@ -151,13 +151,13 @@
pos->value.UInt64.val = val;
break;
}
- case GNS_Double:
+ case GNUNET_GNS_TYPE_DOUBLE:
{
char *s;
double d;
s = NULL;
- GC_get_configuration_value_string (cfg, section, option, NULL, &s);
+ GNUNET_GC_get_configuration_value_string (cfg, section, option, NULL,
&s);
if (s == NULL)
{
pos->value.Double.val = pos->value.Double.def;
@@ -166,8 +166,8 @@
{
if (1 != sscanf (s, "%lf", &d))
{
- GE_LOG (ectx,
- GE_USER | GE_ERROR | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_USER | GNUNET_GE_ERROR | GNUNET_GE_IMMEDIATE,
"`%s' is not a valid double-precision floating point
number.\n",
s);
GNUNET_free (s);
@@ -178,12 +178,12 @@
}
break;
}
- case GNS_String:
- case GNS_MC:
+ case GNUNET_GNS_TYPE_STRING:
+ case GNUNET_GNS_TYPE_MULTIPLE_CHOICE:
{
char *val;
- if (GNUNET_SYSERR == GC_get_configuration_value_string (cfg,
+ if (GNUNET_SYSERR == GNUNET_GC_get_configuration_value_string (cfg,
section,
option,
pos->value.
@@ -194,11 +194,11 @@
pos->value.String.val = val;
break;
}
- case GNS_SC:
+ case GNUNET_GNS_TYPE_SINGLE_CHOICE:
{
const char *ival;
- if (GNUNET_SYSERR == GC_get_configuration_value_choice (cfg,
+ if (GNUNET_SYSERR == GNUNET_GC_get_configuration_value_choice (cfg,
section,
option,
(const char
@@ -224,7 +224,7 @@
}
static void
-free_tree (struct GNS_Tree *t)
+free_tree (struct GNUNET_GNS_TreeNode *t)
{
int i;
@@ -234,17 +234,17 @@
free_tree (t->children[i]);
i++;
}
- switch (t->type & GNS_TypeMask)
+ switch (t->type & GNUNET_GNS_TYPE_MASK)
{
case 0:
break; /* no value */
- case GNS_Boolean:
- case GNS_UInt64:
- case GNS_Double:
+ case GNUNET_GNS_TYPE_BOOLEAN:
+ case GNUNET_GNS_TYPE_UINT64:
+ case GNUNET_GNS_TYPE_DOUBLE:
break; /* nothing to free */
- case GNS_String:
- case GNS_MC:
- case GNS_SC:
+ case GNUNET_GNS_TYPE_STRING:
+ case GNUNET_GNS_TYPE_MULTIPLE_CHOICE:
+ case GNUNET_GNS_TYPE_SINGLE_CHOICE:
i = 0;
while (t->value.String.legalRange[i] != NULL)
{
@@ -255,7 +255,7 @@
GNUNET_free (t->value.String.val);
break;
default:
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
break;
}
GNUNET_free (t->description);
@@ -274,26 +274,26 @@
* @param specification name of the guile file containing the spec
* @return NULL on error (i.e. specification file not found)
*/
-struct GNS_Context *
-GNS_load_specification (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+struct GNUNET_GNS_Context *
+GNUNET_GNS_load_specification (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *specification)
{
- struct GNS_Context *ctx;
- struct GNS_Tree *root;
+ struct GNUNET_GNS_Context *ctx;
+ struct GNUNET_GNS_TreeNode *root;
root = tree_parse (ectx, specification);
if (root == NULL)
return NULL;
- ctx = GNUNET_malloc (sizeof (struct GNS_Context));
+ ctx = GNUNET_malloc (sizeof (struct GNUNET_GNS_Context));
ctx->ectx = ectx;
ctx->cfg = cfg;
ctx->root = root;
ctx->in_notify = 0;
- if (-1 == GC_attach_change_listener (cfg, &configChangeListener, ctx))
+ if (-1 == GNUNET_GC_attach_change_listener (cfg, &configChangeListener, ctx))
{
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
_
("Configuration does not satisfy constraints of configuration
specification file `%s'!\n"),
specification);
@@ -305,15 +305,15 @@
}
/**
- * Obtain the GNS_Tree from the GNS system. The tree is only valid
- * until GNS_free_specification is called. Note that visibility and
+ * Obtain the GNUNET_GNS_TreeNode from the GNS system. The tree is only valid
+ * until GNUNET_GNS_free_specification is called. Note that visibility and
* values in the tree may change whenever the configuration of the GNS
* context changes.
*
* @return NULL on error
*/
-struct GNS_Tree *
-GNS_get_tree (struct GNS_Context *ctx)
+struct GNUNET_GNS_TreeNode *
+GNUNET_GNS_get_tree_root (struct GNUNET_GNS_Context *ctx)
{
return ctx->root;
}
@@ -322,11 +322,11 @@
* Free resources associated with the GNS context.
*/
void
-GNS_free_specification (struct GNS_Context *ctx)
+GNUNET_GNS_free_specification (struct GNUNET_GNS_Context *ctx)
{
- GC_detach_change_listener (ctx->cfg, &configChangeListener, ctx);
+ GNUNET_GC_detach_change_listener (ctx->cfg, &configChangeListener, ctx);
free_tree (ctx->root);
- GE_ASSERT (ctx->ectx, ctx->listeners == NULL);
+ GNUNET_GE_ASSERT (ctx->ectx, ctx->listeners == NULL);
GNUNET_free (ctx);
}
@@ -336,8 +336,8 @@
* @param listener callback to call whenever the tree changes
*/
void
-GNS_register_tree_change_listener (struct GNS_Context *ctx,
- GNS_TreeChangeListener listener, void *cls)
+GNUNET_GNS_register_tree_change_listener (struct GNUNET_GNS_Context *ctx,
+ GNUNET_GNS_TreeChangeListener listener,
void *cls)
{
GNS_TCL *n;
@@ -353,8 +353,8 @@
* in the future for change events).
*/
void
-GNS_unregister_tree_change_listener (struct GNS_Context *ctx,
- GNS_TreeChangeListener listener,
+GNUNET_GNS_unregister_tree_change_listener (struct GNUNET_GNS_Context *ctx,
+ GNUNET_GNS_TreeChangeListener listener,
void *cls)
{
GNS_TCL *pos;
@@ -385,28 +385,28 @@
* @return NULL on error
*/
char *
-GNS_get_default_value_as_string (GNS_Type type, const GNS_Value * value)
+GNUNET_GNS_get_default_value_as_string (GNUNET_GNS_TreeNodeKindAndType type,
const GNUNET_GNS_Value * value)
{
char buf[48];
if (value == NULL)
return NULL;
- switch (type & GNS_TypeMask)
+ switch (type & GNUNET_GNS_TYPE_MASK)
{
- case GNS_Boolean:
+ case GNUNET_GNS_TYPE_BOOLEAN:
if (value->Boolean.def)
return GNUNET_strdup ("YES");
return GNUNET_strdup ("NO");
- case GNS_String:
- case GNS_MC:
- case GNS_SC:
+ case GNUNET_GNS_TYPE_STRING:
+ case GNUNET_GNS_TYPE_MULTIPLE_CHOICE:
+ case GNUNET_GNS_TYPE_SINGLE_CHOICE:
if (value->String.def == NULL)
return NULL;
return GNUNET_strdup (value->String.def);
- case GNS_Double:
+ case GNUNET_GNS_TYPE_DOUBLE:
GNUNET_snprintf (buf, 48, "%f", value->Double.def);
return GNUNET_strdup (buf);
- case GNS_UInt64:
+ case GNUNET_GNS_TYPE_UINT64:
GNUNET_snprintf (buf, 48, "%llu", value->UInt64.def);
return GNUNET_strdup (buf);
default:
Modified: GNUnet/src/setup/lib/tree.c
===================================================================
--- GNUnet/src/setup/lib/tree.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/setup/lib/tree.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -35,8 +35,8 @@
{
VisibilityChangeListener vcl;
void *ctx;
- struct GNS_Tree *root;
- struct GC_Configuration *cfg;
+ struct GNUNET_GNS_TreeNode *root;
+ struct GNUNET_GC_Configuration *cfg;
} TC;
/* ********************** scheme smob boxing ***************** */
@@ -55,7 +55,7 @@
}
static SCM
-box_tree (struct GNS_Tree *tree)
+box_tree (struct GNUNET_GNS_TreeNode *tree)
{
SCM smob;
@@ -81,7 +81,7 @@
static int
print_tree (SCM tree_smob, SCM port, scm_print_state * pstate)
{
- /* struct GNS_Tree * tree = (struct GNS_Tree *) SCM_SMOB_DATA (tree_smob); */
+ /* struct GNUNET_GNS_TreeNode * tree = (struct GNUNET_GNS_TreeNode *)
SCM_SMOB_DATA (tree_smob); */
scm_puts ("Tree", port);
/* non-zero means success */
@@ -90,11 +90,11 @@
/* **************************** tree API ****************** */
-struct GNS_Tree *
-tree_lookup (struct GNS_Tree *root, const char *section, const char *option)
+struct GNUNET_GNS_TreeNode *
+tree_lookup (struct GNUNET_GNS_TreeNode *root, const char *section, const char
*option)
{
int i;
- struct GNS_Tree *ret;
+ struct GNUNET_GNS_TreeNode *ret;
if ((root->section != NULL) &&
(root->option != NULL) &&
@@ -118,7 +118,7 @@
TC *tc;
char *opt;
char *sec;
- struct GNS_Tree *t;
+ struct GNUNET_GNS_TreeNode *t;
SCM_ASSERT (SCM_SMOB_PREDICATE (tc_tag, smob), smob, SCM_ARG1,
"get_option");
@@ -130,22 +130,22 @@
t = tree_lookup (tc->root, sec, opt);
if (t == NULL)
return SCM_EOL;
- switch (t->type & GNS_TypeMask)
+ switch (t->type & GNUNET_GNS_TYPE_MASK)
{
case 0:
return SCM_EOL; /* no value */
- case GNS_Boolean:
+ case GNUNET_GNS_TYPE_BOOLEAN:
return (t->value.Boolean.val) ? SCM_BOOL_T : SCM_BOOL_F;
- case GNS_UInt64:
+ case GNUNET_GNS_TYPE_UINT64:
return scm_from_uint64 (t->value.UInt64.val);
- case GNS_Double:
+ case GNUNET_GNS_TYPE_DOUBLE:
return scm_from_double (t->value.Double.val);
- case GNS_String:
- case GNS_MC:
- case GNS_SC:
+ case GNUNET_GNS_TYPE_STRING:
+ case GNUNET_GNS_TYPE_MULTIPLE_CHOICE:
+ case GNUNET_GNS_TYPE_SINGLE_CHOICE:
return scm_from_locale_string (t->value.String.val);
}
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return SCM_EOL;
}
@@ -160,7 +160,7 @@
char *opt;
char *sec;
int val;
- struct GNS_Tree *t;
+ struct GNUNET_GNS_TreeNode *t;
SCM_ASSERT (SCM_SMOB_PREDICATE (tc_tag, smob), smob, SCM_ARG1,
"change_visible");
@@ -174,7 +174,7 @@
val = scm_is_true (yesno) ? 1 : 0;
if ((opt == NULL) || (sec == NULL))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return SCM_EOL;
}
t = tree_lookup (tc->root, sec, opt);
@@ -215,7 +215,7 @@
opt = scm_to_locale_string (option);
sec = scm_to_locale_string (section);
val = scm_to_locale_string (value);
- GC_set_configuration_value_string (tc->cfg, NULL, sec, opt, val);
+ GNUNET_GC_set_configuration_value_string (tc->cfg, NULL, sec, opt, val);
if (sec != NULL)
free (sec);
if (val != NULL)
@@ -239,7 +239,7 @@
SCM description,
SCM help, SCM children, SCM visible, SCM value, SCM range)
{
- struct GNS_Tree *tree;
+ struct GNUNET_GNS_TreeNode *tree;
SCM child;
int i;
int clen;
@@ -292,19 +292,19 @@
}
/* construct C object */
- tree = GNUNET_malloc (sizeof (struct GNS_Tree));
+ tree = GNUNET_malloc (sizeof (struct GNUNET_GNS_TreeNode));
tree->section = scm_to_locale_string (section);
tree->option = scm_to_locale_string (option);
tree->description = scm_to_locale_string (description);
tree->help = scm_to_locale_string (help);
- tree->children = GNUNET_malloc (sizeof (struct GNS_Tree *) * (clen + 1));
+ tree->children = GNUNET_malloc (sizeof (struct GNUNET_GNS_TreeNode *) *
(clen + 1));
for (i = 0; i < clen; i++)
{
child = scm_list_ref (children, scm_from_signed_integer (i));
- tree->children[i] = (struct GNS_Tree *) SCM_SMOB_DATA (child);
+ tree->children[i] = (struct GNUNET_GNS_TreeNode *) SCM_SMOB_DATA (child);
}
tree->children[clen] = NULL;
- tree->type = (clen == 0) ? GNS_Leaf : GNS_Node;
+ tree->type = (clen == 0) ? GNUNET_GNS_KIND_LEAF : GNUNET_GNS_KIND_NODE;
tree->visible = scm_is_true (visible);
if (scm_is_string (value))
@@ -329,19 +329,19 @@
(0)));
else
type = GNUNET_strdup ("*");
- GE_ASSERT (NULL, type != NULL);
+ GNUNET_GE_ASSERT (NULL, type != NULL);
if (0 == strcasecmp (type, "MC"))
{
- tree->type |= GNS_MC;
+ tree->type |= GNUNET_GNS_TYPE_MULTIPLE_CHOICE;
}
else if (0 == strcasecmp (type, "SC"))
{
- tree->type |= GNS_SC;
+ tree->type |= GNUNET_GNS_TYPE_SINGLE_CHOICE;
}
else
{
- GE_BREAK (NULL, 0 == strcasecmp (type, "*"));
- tree->type |= GNS_String;
+ GNUNET_GE_BREAK (NULL, 0 == strcasecmp (type, "*"));
+ tree->type |= GNUNET_GNS_TYPE_STRING;
}
GNUNET_free (type);
}
@@ -351,19 +351,19 @@
tree->value.UInt64.def = scm_to_uint64 (value);
tree->value.UInt64.min = scm_to_uint64 (SCM_CAR (range));
tree->value.UInt64.max = scm_to_uint64 (SCM_CDR (range));
- tree->type |= GNS_UInt64;
+ tree->type |= GNUNET_GNS_TYPE_UINT64;
}
else if (scm_is_true (scm_real_p (value)))
{
tree->value.Double.val = scm_to_double (value);
tree->value.Double.def = scm_to_double (value);
- tree->type |= GNS_Double;
+ tree->type |= GNUNET_GNS_TYPE_DOUBLE;
}
else if (scm_is_true (scm_boolean_p (value)))
{
tree->value.Boolean.val = scm_is_true (value);
tree->value.Boolean.def = scm_is_true (value);
- tree->type |= GNS_Boolean;
+ tree->type |= GNUNET_GNS_TYPE_BOOLEAN;
}
/* box and return */
return box_tree (tree);
@@ -387,14 +387,14 @@
}
-struct GNS_Tree *
-tree_parse (struct GE_Context *ectx, const char *specification)
+struct GNUNET_GNS_TreeNode *
+tree_parse (struct GNUNET_GE_Context *ectx, const char *specification)
{
- struct GNS_Tree *ret;
+ struct GNUNET_GNS_TreeNode *ret;
ret = parse_internal ((void *) specification);
if (ret != NULL)
- ret->type = GNS_Root;
+ ret->type = GNUNET_GNS_KIND_ROOT;
return ret;
}
@@ -419,11 +419,11 @@
* Update visibility (and notify about changes).
*/
void
-tree_notify_change (struct GC_Configuration *cfg,
+tree_notify_change (struct GNUNET_GC_Configuration *cfg,
VisibilityChangeListener vcl,
void *ctx,
- struct GE_Context *ectx,
- struct GNS_Tree *root, struct GNS_Tree *change)
+ struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GNS_TreeNode *root, struct
GNUNET_GNS_TreeNode *change)
{
TC tc;
@@ -474,7 +474,7 @@
scm_set_smob_free (tc_tag, free_box);
scm_set_smob_print (tc_tag, print_tc);
- tree_tag = scm_make_smob_type ("tc", sizeof (struct GNS_Tree));
+ tree_tag = scm_make_smob_type ("tc", sizeof (struct GNUNET_GNS_TreeNode));
scm_set_smob_mark (tree_tag, NULL);
scm_set_smob_free (tree_tag, free_box);
scm_set_smob_print (tree_tag, print_tree);
Modified: GNUnet/src/setup/lib/tree.h
===================================================================
--- GNUnet/src/setup/lib/tree.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/setup/lib/tree.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -28,20 +28,20 @@
* Parse the specification file and create the tree.
* Set all values to defaults.
*/
-struct GNS_Tree *tree_parse (struct GE_Context *ectx,
+struct GNUNET_GNS_TreeNode *tree_parse (struct GNUNET_GE_Context *ectx,
const char *specification);
-struct GNS_Tree *tree_lookup (struct GNS_Tree *root,
+struct GNUNET_GNS_TreeNode *tree_lookup (struct GNUNET_GNS_TreeNode *root,
const char *section, const char *option);
-typedef void (*VisibilityChangeListener) (void *ctx, struct GNS_Tree * tree);
+typedef void (*VisibilityChangeListener) (void *ctx, struct
GNUNET_GNS_TreeNode * tree);
/**
* A value in the tree has been changed.
* Update visibility (and notify about changes).
*/
-void tree_notify_change (struct GC_Configuration *cfg,
+void tree_notify_change (struct GNUNET_GC_Configuration *cfg,
VisibilityChangeListener vcl,
void *ctx,
- struct GE_Context *ectx,
- struct GNS_Tree *root, struct GNS_Tree *change);
+ struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GNS_TreeNode *root, struct
GNUNET_GNS_TreeNode *change);
Modified: GNUnet/src/setup/lib/wizard_util.c
===================================================================
--- GNUnet/src/setup/lib/wizard_util.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/setup/lib/wizard_util.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -32,12 +32,12 @@
* @brief Determine whether a NIC makes a good default
*/
int
-wiz_is_nic_default (struct GC_Configuration *cfg, const char *name,
+wiz_is_nic_default (struct GNUNET_GC_Configuration *cfg, const char *name,
int suggestion)
{
char *nic;
- GC_get_configuration_value_string (cfg, "NETWORK", "INTERFACE", "eth0",
+ GNUNET_GC_get_configuration_value_string (cfg, "NETWORK", "INTERFACE",
"eth0",
&nic);
#ifdef WINDOWS
Modified: GNUnet/src/setup/lib/wizard_util.h
===================================================================
--- GNUnet/src/setup/lib/wizard_util.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/setup/lib/wizard_util.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -27,7 +27,7 @@
#ifndef WIZARD_UTIL_H_
#define WIZARD_UTIL_H_
-int wiz_is_nic_default (struct GC_Configuration *cfg, const char *name,
+int wiz_is_nic_default (struct GNUNET_GC_Configuration *cfg, const char *name,
int suggestion);
int wiz_autostartService (int doAutoStart, char *username, char *groupname);
int wiz_createGroupUser (char *group_name, char *user_name);
Modified: GNUnet/src/setup/ncurses/mconf.c
===================================================================
--- GNUnet/src/setup/ncurses/mconf.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/setup/ncurses/mconf.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -38,7 +38,7 @@
#include <termios.h>
#endif
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
static void
show_help (const char *option, const char *helptext)
@@ -49,8 +49,8 @@
}
static void
-run_menu (struct GNS_Context *ctx,
- struct GNS_Tree *pos, struct GC_Configuration *cfg)
+run_menu (struct GNUNET_GNS_Context *ctx,
+ struct GNUNET_GNS_TreeNode *pos, struct GNUNET_GC_Configuration *cfg)
{
int st;
int i;
@@ -59,7 +59,7 @@
DIALOG_FORMITEM fitem;
unsigned long long lval;
double dval;
- GNS_Value *val;
+ GNUNET_GNS_Value *val;
char *tmp;
size_t tlen;
@@ -79,23 +79,23 @@
msel = 0;
while (1)
{
- switch (pos->type & GNS_KindMask)
+ switch (pos->type & GNUNET_GNS_KIND_MASK)
{
- case GNS_Root:
+ case GNUNET_GNS_KIND_ROOT:
dialog_vars.cancel_label = _("Exit");
break;
- case GNS_Node:
+ case GNUNET_GNS_KIND_NODE:
dialog_vars.cancel_label = _("Up");
break;
default:
dialog_vars.cancel_label = _("Cancel");
break;
}
- switch (pos->type & GNS_KindMask)
+ switch (pos->type & GNUNET_GNS_KIND_MASK)
{
- case GNS_Root:
+ case GNUNET_GNS_KIND_ROOT:
/* fall-through! */
- case GNS_Node:
+ case GNUNET_GNS_KIND_NODE:
st = 0;
i = 0;
while (pos->children[i] != NULL)
@@ -156,17 +156,17 @@
}
break;
- case GNS_Leaf:
- switch (pos->type & GNS_TypeMask)
+ case GNUNET_GNS_KIND_LEAF:
+ switch (pos->type & GNUNET_GNS_TYPE_MASK)
{
- case GNS_Boolean:
+ case GNUNET_GNS_TYPE_BOOLEAN:
st = dialog_yesno (pos->option,
gettext (pos->description), 5, 60);
switch (st)
{
case DLG_EXIT_OK:
case DLG_EXIT_CANCEL:
- if (0 != GC_set_configuration_value_string (cfg,
+ if (0 != GNUNET_GC_set_configuration_value_string (cfg,
ectx,
pos->section,
pos->option,
@@ -186,11 +186,11 @@
case DLG_EXIT_ESC:
return;
default:
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return;
}
break;
- case GNS_String:
+ case GNUNET_GNS_TYPE_STRING:
/* free form */
fitem.text = GNUNET_malloc (65536);
strcpy (fitem.text, pos->value.String.val);
@@ -201,7 +201,7 @@
switch (st)
{
case DLG_EXIT_OK:
- if (0 != GC_set_configuration_value_string (cfg,
+ if (0 != GNUNET_GC_set_configuration_value_string (cfg,
ectx,
pos->section,
pos->option,
@@ -228,13 +228,13 @@
GNUNET_free (fitem.text);
/* end free form */
break;
- case GNS_SC:
+ case GNUNET_GNS_TYPE_SINGLE_CHOICE:
/* begin single choice */
val = &pos->value;
i = 0;
while (val->String.legalRange[i] != NULL)
i++;
- GE_ASSERT (ectx, i != 0);
+ GNUNET_GE_ASSERT (ectx, i != 0);
items = GNUNET_malloc (sizeof (DIALOG_LISTITEM) * i);
i = 0;
msel = -1;
@@ -265,7 +265,7 @@
switch (st)
{
case DLG_EXIT_OK:
- if (0 != GC_set_configuration_value_choice (cfg,
+ if (0 != GNUNET_GC_set_configuration_value_choice (cfg,
ectx,
pos->section,
pos->option,
@@ -289,14 +289,14 @@
return;
}
break;
- case GNS_MC:
+ case GNUNET_GNS_TYPE_MULTIPLE_CHOICE:
/* begin multiple choice */
val = &pos->value;
i = 0;
tlen = 2;
while (val->String.legalRange[i] != NULL)
i++;
- GE_ASSERT (ectx, i != 0);
+ GNUNET_GE_ASSERT (ectx, i != 0);
items = GNUNET_malloc (sizeof (DIALOG_LISTITEM) * i);
i = 0;
msel = 0;
@@ -347,7 +347,7 @@
}
if (strlen (tmp) > 0)
tmp[strlen (tmp) - 1] = '\0';
- if (0 != GC_set_configuration_value_choice (cfg,
+ if (0 != GNUNET_GC_set_configuration_value_choice (cfg,
ectx,
pos->section,
pos->option,
@@ -374,7 +374,7 @@
}
GNUNET_free (items);
break;
- case GNS_Double:
+ case GNUNET_GNS_TYPE_DOUBLE:
fitem.text = GNUNET_malloc (64);
GNUNET_snprintf (fitem.text, 64, "%f", pos->value.Double.val);
fitem.text_len = strlen (fitem.text);
@@ -392,7 +392,7 @@
("Invalid input, expecting floating point
value."));
break;
}
- if (0 != GC_set_configuration_value_string (cfg,
+ if (0 != GNUNET_GC_set_configuration_value_string (cfg,
ectx,
pos->section,
pos->option,
@@ -414,7 +414,7 @@
GNUNET_free (fitem.text);
break;
- case GNS_UInt64:
+ case GNUNET_GNS_TYPE_UINT64:
fitem.text = GNUNET_malloc (64);
GNUNET_snprintf (fitem.text, 64, "%llu", pos->value.UInt64.val);
fitem.text_len = strlen (fitem.text);
@@ -443,7 +443,7 @@
("Value is not in legal range."));
continue;
}
- if (0 != GC_set_configuration_value_number (cfg,
+ if (0 != GNUNET_GC_set_configuration_value_number (cfg,
ectx,
pos->
section,
@@ -466,13 +466,13 @@
GNUNET_free (fitem.text);
return;
default:
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return;
} /* end switch type & type */
break;
default:
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
break;
} /* end switch type & Kind */
@@ -484,9 +484,9 @@
mconf_mainsetup_curses (int argc,
const char **argv,
struct GNUNET_PluginHandle *self,
- struct GE_Context *e,
- struct GC_Configuration *cfg,
- struct GNS_Context *gns,
+ struct GNUNET_GE_Context *e,
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GNS_Context *gns,
const char *filename, int is_daemon)
{
int ret;
@@ -502,10 +502,10 @@
init_dialog (stdin, stderr);
- run_menu (gns, GNS_get_tree (gns), cfg);
+ run_menu (gns, GNUNET_GNS_get_tree_root (gns), cfg);
ret = 0;
- if ((0 == GC_test_dirty (cfg)) && (0 == ACCESS (filename, R_OK)))
+ if ((0 == GNUNET_GC_test_dirty (cfg)) && (0 == ACCESS (filename, R_OK)))
{
end_dialog ();
printf (_("Configuration unchanged, no need to save.\n"));
@@ -519,7 +519,7 @@
end_dialog ();
if (ret == DLG_EXIT_OK)
{
- if (0 != GC_write_configuration (cfg, filename))
+ if (0 != GNUNET_GC_write_configuration (cfg, filename))
{
/* error message already printed... */
ret = 1;
Modified: GNUnet/src/setup/ncurses/mconf.h
===================================================================
--- GNUnet/src/setup/ncurses/mconf.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/setup/ncurses/mconf.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -31,9 +31,9 @@
int main_setup_ncurses (int argc,
const char **argv,
struct GNUNET_PluginHandle *self,
- struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- struct GNS_Context *gns,
+ struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GNS_Context *gns,
const char *filename, int is_daemon);
#endif
Modified: GNUnet/src/setup/ncurses/wizard_curs.c
===================================================================
--- GNUnet/src/setup/ncurses/wizard_curs.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/setup/ncurses/wizard_curs.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -47,9 +47,9 @@
#include <grp.h>
#endif
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static int last;
@@ -100,7 +100,7 @@
{
case DLG_EXIT_OK:
case DLG_EXIT_CANCEL:
- if (0 != GC_set_configuration_value_string (cfg,
+ if (0 != GNUNET_GC_set_configuration_value_string (cfg,
ectx,
section,
option,
@@ -119,7 +119,7 @@
case DLG_EXIT_EXTRA:
return -1; /* back */
default:
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
break;
}
}
@@ -166,7 +166,7 @@
switch (ret)
{
case DLG_EXIT_OK:
- if (0 != GC_set_configuration_value_string (cfg,
+ if (0 != GNUNET_GC_set_configuration_value_string (cfg,
ectx,
section,
option, fitem.text))
@@ -191,7 +191,7 @@
ret = -1; /* back */
break;
default:
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
ret = 0;
break;
}
@@ -280,7 +280,7 @@
switch (ret)
{
case DLG_EXIT_OK:
- if (0 != GC_set_configuration_value_choice (cfg,
+ if (0 != GNUNET_GC_set_configuration_value_choice (cfg,
ectx,
"NETWORK",
"INTERFACE",
@@ -451,8 +451,8 @@
ret = GNUNET_OK;
- if ((0 != GC_test_dirty (cfg)) &&
- (0 != GC_write_configuration (cfg, cfg_fn)))
+ if ((0 != GNUNET_GC_test_dirty (cfg)) &&
+ (0 != GNUNET_GC_write_configuration (cfg, cfg_fn)))
{
prefix = _("Unable to save configuration file `%s':");
err = GNUNET_malloc (strlen (cfg_fn) + strlen (prefix) + 1);
@@ -461,8 +461,8 @@
ret = GNUNET_SYSERR;
}
user_name = NULL;
- GC_get_configuration_value_string (cfg, "GNUNETD", "USER", "", &user_name);
- GC_get_configuration_value_string (cfg,
+ GNUNET_GC_get_configuration_value_string (cfg, "GNUNETD", "USER", "",
&user_name);
+ GNUNET_GC_get_configuration_value_string (cfg,
"GNUNETD", "GROUP", "", &group_name);
if (((strlen (user_name) > 0) ||
(strlen (group_name) > 0)) &&
@@ -477,7 +477,7 @@
showCursErr (_("Unable to create user account for daemon."), "");
ret = GNUNET_SYSERR;
}
- if ((GNUNET_YES == GC_get_configuration_value_yesno (cfg, "GNUNETD",
"AUTOSTART", GNUNET_NO)) && (GNUNET_YES != GNUNET_configure_autostart (ectx,
GNUNET_NO, GNUNET_YES, "gnunetd", /* specify full path? */
+ if ((GNUNET_YES == GNUNET_GC_get_configuration_value_yesno (cfg, "GNUNETD",
"AUTOSTART", GNUNET_NO)) && (GNUNET_YES != GNUNET_configure_autostart (ectx,
GNUNET_NO, GNUNET_YES, "gnunetd", /* specify full path? */
user_name,
group_name)))
{
@@ -511,7 +511,7 @@
case DLG_EXIT_EXTRA:
return -1; /* back */
default:
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
break;
}
return 1;
@@ -521,9 +521,9 @@
wizard_curs_mainsetup_curses (int argc,
const char **argv,
struct GNUNET_PluginHandle *self,
- struct GE_Context *e,
- struct GC_Configuration *c,
- struct GNS_Context *gns,
+ struct GNUNET_GE_Context *e,
+ struct GNUNET_GC_Configuration *c,
+ struct GNUNET_GNS_Context *gns,
const char *filename, int is_daemon)
{
struct termios ios_org;
@@ -588,7 +588,7 @@
ret = GNUNET_OK;
break;
default:
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
dir = 0;
break;
}
Modified: GNUnet/src/setup/ncurses/wizard_curs.h
===================================================================
--- GNUnet/src/setup/ncurses/wizard_curs.h 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/setup/ncurses/wizard_curs.h 2007-11-25 12:04:45 UTC (rev
5755)
@@ -31,9 +31,9 @@
int wizard_curs_mainsetup_curses (int argc,
const char **argv,
struct GNUNET_PluginHandle *self,
- struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- struct GNS_Context *gns,
+ struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GNS_Context *gns,
const char *filename, int is_daemon);
#endif
Modified: GNUnet/src/setup/text/conf.c
===================================================================
--- GNUnet/src/setup/text/conf.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/setup/text/conf.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -68,24 +68,24 @@
}
static char *
-getValueAsString (GNS_Type type, GNS_Value * val)
+getValueAsString (GNUNET_GNS_TreeNodeKindAndType type, GNUNET_GNS_Value * val)
{
char buf[92];
- switch (type & GNS_TypeMask)
+ switch (type & GNUNET_GNS_TYPE_MASK)
{
- case GNS_Boolean:
+ case GNUNET_GNS_TYPE_BOOLEAN:
if (val->Boolean.val)
return GNUNET_strdup (_("yes"));
return GNUNET_strdup (_("no"));
- case GNS_String:
- case GNS_SC:
- case GNS_MC:
+ case GNUNET_GNS_TYPE_STRING:
+ case GNUNET_GNS_TYPE_SINGLE_CHOICE:
+ case GNUNET_GNS_TYPE_MULTIPLE_CHOICE:
return GNUNET_strdup (val->String.val);
- case GNS_Double:
+ case GNUNET_GNS_TYPE_DOUBLE:
GNUNET_snprintf (buf, 92, "%f", val->Double.val);
return GNUNET_strdup (buf);
- case GNS_UInt64:
+ case GNUNET_GNS_TYPE_UINT64:
GNUNET_snprintf (buf, 92, "%llu", val->UInt64.val);
return GNUNET_strdup (buf);
}
@@ -93,21 +93,21 @@
}
static void
-printChoice (int indent, GNS_Type type, GNS_Value * val)
+printChoice (int indent, GNUNET_GNS_TreeNodeKindAndType type, GNUNET_GNS_Value
* val)
{
int i;
char defLet;
- switch (type & GNS_TypeMask)
+ switch (type & GNUNET_GNS_TYPE_MASK)
{
- case GNS_Boolean:
+ case GNUNET_GNS_TYPE_BOOLEAN:
iprintf (indent,
_("\tEnter yes (%s), no (%s) or help (%s): "),
val->Boolean.def ? "Y" : "y",
val->Boolean.def ? "n" : "N", "d", "?");
break;
- case GNS_String:
- case GNS_MC:
+ case GNUNET_GNS_TYPE_STRING:
+ case GNUNET_GNS_TYPE_MULTIPLE_CHOICE:
i = 0;
defLet = '\0';
if (val->String.legalRange[0] != NULL)
@@ -124,7 +124,7 @@
_("\tEnter string (type '%s' for default value `%s'): "), "d",
val->String.def);
break;
- case GNS_SC:
+ case GNUNET_GNS_TYPE_SINGLE_CHOICE:
i = 0;
defLet = '\0';
while (val->String.legalRange[i] != NULL)
@@ -137,16 +137,16 @@
defLet = (i < 10) ? '0' + i : 'a' + i - 10;
i++;
}
- GE_ASSERT (NULL, defLet != '\0');
+ GNUNET_GE_ASSERT (NULL, defLet != '\0');
iprintf (indent, "\n\t (?) Help\n");
iprintf (indent, _("\t Enter choice (default is %c): "), defLet);
break;
- case GNS_Double:
+ case GNUNET_GNS_TYPE_DOUBLE:
iprintf (indent,
_("\tEnter floating point (type '%s' for default value %f): "),
"d", val->Double.def);
break;
- case GNS_UInt64:
+ case GNUNET_GNS_TYPE_UINT64:
iprintf (indent,
_
("\tEnter unsigned integer in interval [%llu,%llu] (type '%s'
for default value %llu): "),
@@ -161,7 +161,7 @@
* @return GNUNET_OK on success, GNUNET_NO to display help, GNUNET_SYSERR to
abort
*/
static int
-readValue (GNS_Type type, GNS_Value * val)
+readValue (GNUNET_GNS_TreeNodeKindAndType type, GNUNET_GNS_Value * val)
{
int c;
char buf[1024];
@@ -169,9 +169,9 @@
int j;
unsigned long long l;
- switch (type & GNS_TypeMask)
+ switch (type & GNUNET_GNS_TYPE_MASK)
{
- case GNS_Boolean:
+ case GNUNET_GNS_TYPE_BOOLEAN:
while (1)
{
c = rd ();
@@ -201,8 +201,8 @@
}
}
break;
- case GNS_String:
- case GNS_MC:
+ case GNUNET_GNS_TYPE_STRING:
+ case GNUNET_GNS_TYPE_MULTIPLE_CHOICE:
i = 0;
while (1)
{
@@ -256,7 +256,7 @@
val->String.val = GNUNET_strdup (buf[0] == ' ' ? &buf[1] : buf);
printf ("\n");
return GNUNET_OK;
- case GNS_SC:
+ case GNUNET_GNS_TYPE_SINGLE_CHOICE:
while (1)
{
c = rd ();
@@ -296,7 +296,7 @@
return GNUNET_OK;
}
/* unreachable */
- case GNS_Double:
+ case GNUNET_GNS_TYPE_DOUBLE:
i = 0;
while (1)
{
@@ -354,7 +354,7 @@
fflush (stdout);
}
break;
- case GNS_UInt64:
+ case GNUNET_GNS_TYPE_UINT64:
i = 0;
while (1)
{
@@ -419,7 +419,7 @@
default:
fprintf (stderr,
_("Unknown kind %x (internal error). Skipping option.\n"),
- type & GNS_TypeMask);
+ type & GNUNET_GNS_TYPE_MASK);
return GNUNET_OK;
}
return GNUNET_OK;
@@ -427,8 +427,8 @@
static int
conf (int indent,
- struct GC_Configuration *cfg,
- struct GE_Context *ectx, struct GNS_Tree *tree)
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx, struct GNUNET_GNS_TreeNode *tree)
{
char choice;
char *value;
@@ -437,9 +437,9 @@
if (!tree->visible)
return GNUNET_OK;
- switch (tree->type & GNS_KindMask)
+ switch (tree->type & GNUNET_GNS_KIND_MASK)
{
- case GNS_Leaf:
+ case GNUNET_GNS_KIND_LEAF:
ovalue = getValueAsString (tree->type, &tree->value);
while (1)
{
@@ -461,7 +461,7 @@
}
value = getValueAsString (tree->type, &tree->value);
if ((0 != strcmp (value, ovalue)) &&
- (0 != GC_set_configuration_value_string (cfg,
+ (0 != GNUNET_GC_set_configuration_value_string (cfg,
ectx,
tree->section,
tree->option, value)))
@@ -473,7 +473,7 @@
GNUNET_free (value);
GNUNET_free (ovalue);
return GNUNET_OK;
- case GNS_Node:
+ case GNUNET_GNS_KIND_NODE:
choice = '\0';
while (choice == '\0')
{
@@ -507,7 +507,7 @@
}
}
/* fall-through! */
- case GNS_Root:
+ case GNUNET_GNS_KIND_ROOT:
i = 0;
while (tree->children[i] != NULL)
{
@@ -520,7 +520,7 @@
default:
fprintf (stderr,
_("Unknown kind %x (internal error). Aborting.\n"),
- tree->type & GNS_KindMask);
+ tree->type & GNUNET_GNS_KIND_MASK);
return GNUNET_SYSERR;
}
return GNUNET_SYSERR;
@@ -530,11 +530,11 @@
main_setup_text (int argc,
const char **argv,
struct GNUNET_PluginHandle *self,
- struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- struct GNS_Context *gns, const char *filename, int is_daemon)
+ struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GNS_Context *gns, const char *filename, int
is_daemon)
{
- struct GNS_Tree *root;
+ struct GNUNET_GNS_TreeNode *root;
struct termios oldT;
struct termios newT;
char c;
@@ -552,7 +552,7 @@
printf (_("You can always press ENTER to keep the current value.\n"));
printf (_("Use the '%s' key to abort.\n"), "q");
- root = GNS_get_tree (gns);
+ root = GNUNET_GNS_get_tree_root (gns);
c = 'r';
while (c == 'r')
{
@@ -561,7 +561,7 @@
ioctl (0, TCSETS, &oldT);
return 1;
}
- if ((0 == GC_test_dirty (cfg)) && (0 == ACCESS (filename, R_OK)))
+ if ((0 == GNUNET_GC_test_dirty (cfg)) && (0 == ACCESS (filename, R_OK)))
{
printf (_("Configuration unchanged, no need to save.\n"));
ioctl (0, TCSETS, &oldT);
@@ -581,7 +581,7 @@
}
if (c == 'y')
{
- ret = GC_write_configuration (cfg, filename);
+ ret = GNUNET_GC_write_configuration (cfg, filename);
if (ret == 1)
{
printf (_("Configuration was unchanged, no need to save.\n"));
@@ -608,9 +608,9 @@
dump_setup_text (int argc,
const char **argv,
struct GNUNET_PluginHandle *self,
- struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- struct GNS_Context *gns, const char *filename, int is_daemon)
+ struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GNS_Context *gns, const char *filename, int
is_daemon)
{
- return GC_write_configuration (cfg, filename);
+ return GNUNET_GC_write_configuration (cfg, filename);
}
Modified: GNUnet/src/setup/text/conf.h
===================================================================
--- GNUnet/src/setup/text/conf.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/setup/text/conf.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -34,17 +34,17 @@
int main_setup_text (int argc,
const char **argv,
struct GNUNET_PluginHandle *self,
- struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- struct GNS_Context *gns,
+ struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GNS_Context *gns,
const char *filename, int is_daemon);
int dump_setup_text (int argc,
const char **argv,
struct GNUNET_PluginHandle *self,
- struct GE_Context *ectx,
- struct GC_Configuration *cfg,
- struct GNS_Context *gns,
+ struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GNS_Context *gns,
const char *filename, int is_daemon);
#endif
Modified: GNUnet/src/transports/http.c
===================================================================
--- GNUnet/src/transports/http.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/transports/http.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -259,9 +259,9 @@
{
/**
- * TSession for this session.
+ * GNUNET_TSession for this session.
*/
- TSession *tsession;
+ GNUNET_TSession *tsession;
/**
* mutex for synchronized access to struct
@@ -388,7 +388,7 @@
*/
static CoreAPIForTransport *coreAPI;
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
static int stat_bytesReceived;
@@ -423,7 +423,7 @@
/**
* Array of currently active HTTP sessions.
*/
-static TSession **tsessions;
+static GNUNET_TSession **tsessions;
/**
* Number of valid entries in tsessions.
@@ -443,7 +443,7 @@
/**
* Universal plug & play (firewall hole punching)
*/
-static UPnP_ServiceAPI *upnp;
+static GNUNET_UPnP_ServiceAPI *upnp;
/**
* Lock for access to mutable state of the module,
@@ -502,8 +502,8 @@
else
{
#if DEBUG_HTTP
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"Rejecting HTTP connection\n");
#endif
EXIT ();
@@ -515,16 +515,16 @@
if (GNUNET_YES == ret)
{
#if DEBUG_HTTP
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"Rejecting HTTP connection\n");
#endif
EXIT ();
return MHD_NO;
}
#if DEBUG_HTTP
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK, "Accepting HTTP connection\n");
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK, "Accepting
HTTP connection\n");
#endif
EXIT ();
return MHD_YES;
@@ -544,7 +544,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
*/
static int
-httpDisconnect (TSession * tsession)
+httpDisconnect (GNUNET_TSession * tsession)
{
HTTPSession *httpsession = tsession->internal;
ENTER ();
@@ -561,7 +561,7 @@
}
static void
-destroy_tsession (TSession * tsession)
+destroy_tsession (GNUNET_TSession * tsession)
{
HTTPSession *httpsession = tsession->internal;
struct HTTPPutData *pos;
@@ -676,7 +676,7 @@
ENTER ();
if (httpsession == NULL)
return; /* oops */
- GE_ASSERT (NULL, !httpsession->is_client);
+ GNUNET_GE_ASSERT (NULL, !httpsession->is_client);
pprev = NULL;
ppos = httpsession->cs.server.puts;
while (ppos != NULL)
@@ -719,7 +719,7 @@
unsigned long long port;
ENTER ();
- if (-1 == GC_get_configuration_value_number (coreAPI->cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_number (coreAPI->cfg,
"HTTP",
"PORT", 0, 65535, 1080, &port))
port = 1080;
@@ -737,11 +737,11 @@
unsigned long long port;
ENTER ();
- if (!GC_have_configuration_value (coreAPI->cfg, "HTTP", "ADVERTISED-PORT"))
+ if (!GNUNET_GC_have_configuration_value (coreAPI->cfg, "HTTP",
"ADVERTISED-PORT"))
{
port = getGNUnetHTTPPort ();
}
- else if (-1 == GC_get_configuration_value_number (coreAPI->cfg,
+ else if (-1 == GNUNET_GC_get_configuration_value_number (coreAPI->cfg,
"HTTP",
"ADVERTISED-PORT", 0,
65535, 80, &port))
@@ -770,14 +770,14 @@
* GNUNET_SYSERR if not.
*/
static int
-httpAssociate (TSession * tsession)
+httpAssociate (GNUNET_TSession * tsession)
{
HTTPSession *httpSession;
ENTER ();
if (tsession == NULL)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
EXIT ();
return GNUNET_SYSERR;
}
@@ -814,13 +814,13 @@
haddr = (const HostAddress *) &hello[1];
if ((ntohs (hello->senderAddressSize) != sizeof (HostAddress)) ||
(ntohs (hello->header.size) != GNUNET_sizeof_hello (hello)) ||
- (ntohs (hello->header.type) != p2p_PROTO_hello) ||
- (ntohs (hello->protocol) != HTTP_PROTOCOL_NUMBER) ||
+ (ntohs (hello->header.type) != GNUNET_P2P_PROTO_HELLO) ||
+ (ntohs (hello->protocol) != GNUNET_TRANSPORT_PROTOCOL_NUMBER_HTTP) ||
(MHD_NO == acceptPolicyCallback (NULL,
(const struct sockaddr *) haddr,
sizeof (GNUNET_IPv4Address))))
{
- GE_BREAK_OP (NULL, 0);
+ GNUNET_GE_BREAK_OP (NULL, 0);
EXIT ();
return GNUNET_SYSERR; /* obviously invalid */
}
@@ -847,8 +847,8 @@
if (0 == port)
{
#if DEBUG_HTTP
- GE_LOG (NULL,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"HTTP port is 0, will only send using HTTP.\n");
#endif
EXIT ();
@@ -865,21 +865,21 @@
coreAPI->ectx, &haddr->ip))))
{
GNUNET_free (msg);
- GE_LOG (coreAPI->ectx,
- GE_WARNING | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
_("HTTP: Could not determine my public IP address.\n"));
return NULL;
}
#if DEBUG_HTTP
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"HTTP uses IP address %u.%u.%u.%u.\n",
GNUNET_PRIP (ntohl (*(int *) &haddr->ip)));
#endif
haddr->port = htons (port);
haddr->reserved = htons (0);
msg->senderAddressSize = htons (sizeof (HostAddress));
- msg->protocol = htons (HTTP_PROTOCOL_NUMBER);
+ msg->protocol = htons (GNUNET_TRANSPORT_PROTOCOL_NUMBER_HTTP);
msg->MTU = htonl (0);
EXIT ();
return msg;
@@ -893,7 +893,7 @@
* the return value is ignored.
*/
static unsigned int
-addTSession (TSession * tsession)
+addTSession (GNUNET_TSession * tsession)
{
unsigned int i;
@@ -940,8 +940,8 @@
mgd->woff = 0;
GNUNET_mutex_unlock (mgd->lock);
#if DEBUG_HTTP
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"HTTP returns %u bytes in MHD GET handler.\n", max);
#endif
if (stats != NULL)
@@ -967,7 +967,7 @@
struct MHDGetData *mgd = cls;
ENTER ();
- GE_ASSERT (NULL, mgd->get == NULL);
+ GNUNET_GE_ASSERT (NULL, mgd->get == NULL);
GNUNET_mutex_destroy (mgd->lock);
GNUNET_array_grow (mgd->wbuff, mgd->wsize, 0);
GNUNET_free (mgd);
@@ -992,7 +992,7 @@
unsigned int *upload_data_size,
void **httpSessionCache)
{
- TSession *tsession;
+ GNUNET_TSession *tsession;
struct MHDPutData *put;
struct MHDGetData *get;
HTTPSession *httpSession;
@@ -1011,7 +1011,7 @@
|| (GNUNET_OK != GNUNET_enc_to_hash (&url[1], &client)))
{
/* invalid request */
- /* GE_BREAK_OP (NULL, 0); -- this happens a lot, most likely
+ /* GNUNET_GE_BREAK_OP (NULL, 0); -- this happens a lot, most likely
somebody scanning for MyDoom.X-opened backdoors */
return MHD_NO;
}
@@ -1039,8 +1039,8 @@
if (httpSession == NULL)
{
#if DEBUG_HTTP
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"HTTP/MHD creates new session for request from `%s'.\n",
&url[1]);
#endif
@@ -1049,9 +1049,9 @@
httpSession->sender.hashPubKey = client;
httpSession->lock = GNUNET_mutex_create (GNUNET_YES);
httpSession->users = 0; /* MHD */
- tsession = GNUNET_malloc (sizeof (TSession));
- memset (tsession, 0, sizeof (TSession));
- tsession->ttype = HTTP_PROTOCOL_NUMBER;
+ tsession = GNUNET_malloc (sizeof (GNUNET_TSession));
+ memset (tsession, 0, sizeof (GNUNET_TSession));
+ tsession->ttype = GNUNET_TRANSPORT_PROTOCOL_NUMBER_HTTP;
tsession->internal = httpSession;
tsession->peer.hashPubKey = client;
httpSession->tsession = tsession;
@@ -1067,8 +1067,8 @@
if (0 == strcasecmp (MHD_HTTP_METHOD_GET, method))
{
#if DEBUG_HTTP
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"HTTP/MHD receives GET request from `%s'.\n", &url[1]);
#endif
@@ -1099,8 +1099,8 @@
if (0 == strcasecmp (MHD_HTTP_METHOD_PUT, method))
{
#if DEBUG_HTTP
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"HTTP/MHD receives PUT request from `%s' with %u bytes.\n",
&url[1], *upload_data_size);
#endif
@@ -1129,8 +1129,8 @@
put->done = GNUNET_YES;
/* end of upload, send response! */
#if DEBUG_HTTP
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"HTTP/MHD queues dummy response to completed PUT
request.\n");
#endif
STEP ();
@@ -1186,8 +1186,8 @@
mp->tsession = httpSession->tsession;
mp->size = ntohs (hdr->size) - sizeof (GNUNET_MessageHeader);
#if DEBUG_HTTP
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"HTTP/MHD passes %u bytes to core (received via PUT
request).\n",
mp->size);
#endif
@@ -1202,7 +1202,7 @@
return MHD_YES;
}
GNUNET_mutex_unlock (httpSession->lock);
- GE_BREAK_OP (NULL, 0); /* invalid request */
+ GNUNET_GE_BREAK_OP (NULL, 0); /* invalid request */
EXIT ();
return MHD_NO;
}
@@ -1225,8 +1225,8 @@
ENTER ();
httpSession->cs.client.last_get_activity = GNUNET_get_time ();
#if DEBUG_HTTP
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"HTTP/CURL receives %u bytes as response to GET.\n", size * nmemb);
#endif
while (have > 0)
@@ -1301,8 +1301,8 @@
memcpy (ptr, &put->msg[put->pos], max);
put->pos += max;
#if DEBUG_HTTP
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"HTTP/CURL sends %u bytes in PUT request.\n", max);
#endif
if (stats != NULL)
@@ -1311,7 +1311,7 @@
return max;
}
-#define CURL_EASY_SETOPT(c, a, b) do { ret = curl_easy_setopt(c, a, b); if
(ret != CURLE_OK) GE_LOG(coreAPI->ectx, GE_WARNING | GE_USER | GE_BULK, _("%s
failed at %s:%d: `%s'\n"), "curl_easy_setopt", __FILE__, __LINE__,
curl_easy_strerror(ret)); } while (0);
+#define CURL_EASY_SETOPT(c, a, b) do { ret = curl_easy_setopt(c, a, b); if
(ret != CURLE_OK) GNUNET_GE_LOG(coreAPI->ectx, GNUNET_GE_WARNING |
GNUNET_GE_USER | GNUNET_GE_BULK, _("%s failed at %s:%d: `%s'\n"),
"curl_easy_setopt", __FILE__, __LINE__, curl_easy_strerror(ret)); } while (0);
static void
create_session_url (HTTPSession * httpSession)
@@ -1398,8 +1398,8 @@
STEP ();
if (mret != CURLM_OK)
{
- GE_LOG (coreAPI->ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
_("%s failed at %s:%d: `%s'\n"),
"curl_multi_add_handle",
__FILE__, __LINE__, curl_multi_strerror (mret));
@@ -1411,8 +1411,8 @@
httpSession->cs.client.last_get_activity = GNUNET_get_time ();
httpSession->cs.client.get = curl_get;
#if DEBUG_HTTP
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"HTTP/CURL initiated GET request.\n");
#endif
EXIT ();
@@ -1428,11 +1428,11 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
*/
static int
-httpConnect (const GNUNET_MessageHello * hello, TSession ** tsessionPtr,
+httpConnect (const GNUNET_MessageHello * hello, GNUNET_TSession ** tsessionPtr,
int may_reuse)
{
const HostAddress *haddr = (const HostAddress *) &hello[1];
- TSession *tsession;
+ GNUNET_TSession *tsession;
HTTPSession *httpSession;
int i;
@@ -1468,10 +1468,10 @@
httpSession->users = 1; /* us only, core has not seen this tsession! */
httpSession->is_client = GNUNET_YES;
httpSession->cs.client.address = *haddr;
- tsession = GNUNET_malloc (sizeof (TSession));
- memset (tsession, 0, sizeof (TSession));
+ tsession = GNUNET_malloc (sizeof (GNUNET_TSession));
+ memset (tsession, 0, sizeof (GNUNET_TSession));
httpSession->tsession = tsession;
- tsession->ttype = HTTP_PROTOCOL_NUMBER;
+ tsession->ttype = GNUNET_TRANSPORT_PROTOCOL_NUMBER_HTTP;
tsession->internal = httpSession;
tsession->peer = hello->senderIdentity;
create_session_url (httpSession);
@@ -1488,8 +1488,8 @@
addTSession (tsession);
*tsessionPtr = tsession;
#if DEBUG_HTTP
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"HTTP/CURL initiated connection to `%s'.\n",
httpSession->cs.client.url);
#endif
@@ -1530,7 +1530,7 @@
ENTER ();
/* we should have initiated a GET earlier,
so URL must not be NULL here */
- GE_ASSERT (NULL, httpSession->cs.client.url != NULL);
+ GNUNET_GE_ASSERT (NULL, httpSession->cs.client.url != NULL);
STEP ();
curl_put = curl_easy_init ();
STEP ();
@@ -1569,8 +1569,8 @@
STEP ();
if (mret != CURLM_OK)
{
- GE_LOG (coreAPI->ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
_("%s failed at %s:%d: `%s'\n"),
"curl_multi_add_handle",
__FILE__, __LINE__, curl_multi_strerror (mret));
@@ -1581,8 +1581,8 @@
signal_select ();
put->curl_put = curl_put;
#if DEBUG_HTTP
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"HTTP/CURL initiated PUT request to `%s'.\n",
httpSession->cs.client.url);
#endif
@@ -1605,7 +1605,7 @@
* GNUNET_SYSERR if the size/session is invalid
*/
static int
-httpTestWouldTry (TSession * tsession, const unsigned int size, int important)
+httpTestWouldTry (GNUNET_TSession * tsession, const unsigned int size, int
important)
{
HTTPSession *httpSession = tsession->internal;
struct MHDGetData *get;
@@ -1614,12 +1614,12 @@
ENTER ();
if (size >= GNUNET_MAX_BUFFER_SIZE - sizeof (GNUNET_MessageHeader))
{
- GE_BREAK (coreAPI->ectx, 0);
+ GNUNET_GE_BREAK (coreAPI->ectx, 0);
return GNUNET_SYSERR;
}
if (size == 0)
{
- GE_BREAK (coreAPI->ectx, 0);
+ GNUNET_GE_BREAK (coreAPI->ectx, 0);
return GNUNET_SYSERR;
}
if (httpSession->is_client)
@@ -1664,7 +1664,7 @@
* @return GNUNET_SYSERR on error, GNUNET_OK on success, GNUNET_NO if queue is
full
*/
static int
-httpSend (TSession * tsession,
+httpSend (GNUNET_TSession * tsession,
const void *msg, unsigned int size, int important)
{
HTTPSession *httpSession = tsession->internal;
@@ -1683,7 +1683,7 @@
return GNUNET_SYSERR;
if (size == 0)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
if (important != GNUNET_YES)
@@ -1730,8 +1730,8 @@
/* httpSession->isClient == false, respond to a GET (we
hopefully have one or will have one soon) */
#if DEBUG_HTTP
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"HTTP/MHD queues %u bytes to be sent as response to GET as soon as
possible.\n",
size);
#endif
@@ -1835,8 +1835,8 @@
GNUNET_mutex_unlock (s->lock);
#if DO_GET
#if DEBUG_HTTP
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"HTTP transport destroys old (%llu ms) unused client
session\n",
now - s->cs.client.last_get_activity);
#endif
@@ -1939,8 +1939,8 @@
GNUNET_mutex_unlock (s->lock);
#if DO_GET
#if DEBUG_HTTP
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"HTTP transport destroys unused server session\n");
#endif
#endif
@@ -1975,8 +1975,8 @@
ENTER ();
#if DEBUG_HTTP
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"HTTP transport select thread started\n");
#endif
while (GNUNET_YES == http_running)
@@ -1992,8 +1992,8 @@
STEP ();
if (mret != CURLM_OK)
{
- GE_LOG (coreAPI->ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
_("%s failed at %s:%d: `%s'\n"),
"curl_multi_fdset",
__FILE__, __LINE__, curl_multi_strerror (mret));
@@ -2041,8 +2041,8 @@
if (FD_ISSET (signal_pipe[0], &rs))
read (signal_pipe[0], buf, 1);
if ((mret != CURLM_OK) && (mret != CURLM_CALL_MULTI_PERFORM))
- GE_LOG (coreAPI->ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
_("%s failed at %s:%d: `%s'\n"),
"curl_multi_perform",
__FILE__, __LINE__, curl_multi_strerror (mret));
@@ -2053,8 +2053,8 @@
cleanup_connections ();
}
#if DEBUG_HTTP
- GE_LOG (coreAPI->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"HTTP transport select thread exits.\n");
#endif
EXIT ();
@@ -2113,8 +2113,8 @@
http_running = GNUNET_YES;
curl_thread = GNUNET_thread_create (&curl_runner, NULL, 32 * 1024);
if (curl_thread == NULL)
- GE_DIE_STRERROR (coreAPI->ectx,
- GE_FATAL | GE_ADMIN | GE_IMMEDIATE, "pthread_create");
+ GNUNET_GE_DIE_STRERROR (coreAPI->ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_ADMIN | GNUNET_GE_IMMEDIATE,
"pthread_create");
EXIT ();
return GNUNET_OK;
}
@@ -2169,8 +2169,8 @@
*/
static int
reloadConfiguration (void *ctx,
- struct GC_Configuration *cfg,
- struct GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
const char *section, const char *option)
{
char *ch;
@@ -2181,7 +2181,7 @@
GNUNET_mutex_lock (httplock);
GNUNET_free_non_null (filteredNetworks_);
ch = NULL;
- GC_get_configuration_value_string (cfg, "HTTP", "BLACKLIST", "", &ch);
+ GNUNET_GC_get_configuration_value_string (cfg, "HTTP", "BLACKLIST", "", &ch);
filteredNetworks_ = GNUNET_parse_ipv4_network_specification (ectx, ch);
GNUNET_free (ch);
GNUNET_mutex_unlock (httplock);
@@ -2227,7 +2227,7 @@
coreAPI = core;
httplock = GNUNET_mutex_create (GNUNET_YES);
curllock = GNUNET_mutex_create (GNUNET_YES);
- if (0 != GC_attach_change_listener (coreAPI->cfg,
+ if (0 != GNUNET_GC_attach_change_listener (coreAPI->cfg,
&reloadConfiguration, NULL))
{
GNUNET_mutex_destroy (httplock);
@@ -2235,15 +2235,15 @@
}
if (0 != curl_global_init (CURL_GLOBAL_WIN32))
{
- GE_BREAK (NULL, 0);
- GC_detach_change_listener (coreAPI->cfg, &reloadConfiguration, NULL);
+ GNUNET_GE_BREAK (NULL, 0);
+ GNUNET_GC_detach_change_listener (coreAPI->cfg, &reloadConfiguration,
NULL);
GNUNET_mutex_destroy (httplock);
return NULL;
}
tsessionCount = 0;
tsessionArrayLength = 0;
GNUNET_array_grow (tsessions, tsessionArrayLength, 32);
- if (GC_get_configuration_value_yesno (coreAPI->cfg,
+ if (GNUNET_GC_get_configuration_value_yesno (coreAPI->cfg,
"HTTP", "UPNP",
GNUNET_YES) == GNUNET_YES)
{
@@ -2251,8 +2251,8 @@
if (upnp == NULL)
{
- GE_LOG (coreAPI->ectx,
- GE_ERROR | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
_
("The UPnP service could not be loaded. To disable UPnP, set
the "
"configuration option \"UPNP\" in section \"HTTP\" to
\"NO\"\n"));
@@ -2268,10 +2268,10 @@
stat_bytesDropped
= stats->create (gettext_noop ("# bytes dropped by HTTP (outgoing)"));
}
- GC_get_configuration_value_string (coreAPI->cfg,
+ GNUNET_GC_get_configuration_value_string (coreAPI->cfg,
"GNUNETD", "HTTP-PROXY", "", &proxy);
- httpAPI.protocolNumber = HTTP_PROTOCOL_NUMBER;
+ httpAPI.protocolNumber = GNUNET_TRANSPORT_PROTOCOL_NUMBER_HTTP;
httpAPI.mtu = 0;
httpAPI.cost = 20000; /* about equal to udp */
httpAPI.verifyHello = &verifyHello;
@@ -2293,7 +2293,7 @@
donetransport_http ()
{
ENTER ();
- GC_detach_change_listener (coreAPI->cfg, &reloadConfiguration, NULL);
+ GNUNET_GC_detach_change_listener (coreAPI->cfg, &reloadConfiguration, NULL);
if (stats != NULL)
{
coreAPI->releaseService (stats);
Modified: GNUnet/src/transports/ip.c
===================================================================
--- GNUnet/src/transports/ip.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/transports/ip.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -38,8 +38,8 @@
* @return GNUNET_SYSERR on error, GNUNET_OK on success
*/
int
-getPublicIPAddress (struct GC_Configuration *cfg,
- struct GE_Context *ectx, GNUNET_IPv4Address * address)
+getPublicIPAddress (struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx, GNUNET_IPv4Address *
address)
{
static GNUNET_IPv4Address myAddress;
static GNUNET_CronTime last;
@@ -55,8 +55,8 @@
ips = GNUNET_get_local_ip (cfg, ectx, &myAddress);
if (ips == NULL)
{
- GE_LOG (ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Failed to obtain my (external) %s address!\n"), "IP");
lastError = now;
return GNUNET_SYSERR;
Modified: GNUnet/src/transports/ip.h
===================================================================
--- GNUnet/src/transports/ip.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/transports/ip.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -45,8 +45,8 @@
*
* @return GNUNET_SYSERR on error, GNUNET_OK on success
*/
-int getPublicIPAddress (struct GC_Configuration *cfg,
- struct GE_Context *ectx,
+int getPublicIPAddress (struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
GNUNET_IPv4Address * address);
/**
Modified: GNUnet/src/transports/ip6.c
===================================================================
--- GNUnet/src/transports/ip6.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/transports/ip6.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -51,7 +51,7 @@
* @return GNUNET_SYSERR on failure, GNUNET_OK on success
*/
static int
-getAddress6FromHostname (struct GE_Context *ectx,
+getAddress6FromHostname (struct GNUNET_GE_Context *ectx,
GNUNET_IPv6Address * identity)
{
char hostname[MAX_HOSTNAME];
@@ -59,50 +59,50 @@
if (0 != gethostname (hostname, MAX_HOSTNAME))
{
- GE_LOG_STRERROR (ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
"gethostname");
return GNUNET_SYSERR;
}
- /* GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ /* GNUNET_GE_LOG(ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
" looking up $HOSTNAME (%s) to obtain local IP\n",
hostname); */
ip = gethostbyname2 (hostname, AF_INET6);
if (ip == NULL)
{
- GE_LOG (ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
_("Could not find IP of host `%s': %s\n"),
hostname, hstrerror (h_errno));
return GNUNET_SYSERR;
}
if (ip->h_addrtype != AF_INET6)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
- GE_ASSERT (ectx, sizeof (struct in6_addr) == sizeof (identity->addr));
+ GNUNET_GE_ASSERT (ectx, sizeof (struct in6_addr) == sizeof (identity->addr));
memcpy (&identity->addr[0], ip->h_addr_list[0], sizeof (struct in6_addr));
return GNUNET_OK;
}
#if HAVE_GETIFADDRS && HAVE_GNUNET_freeIFADDRS
static int
-getAddress6FromGetIfAddrs (struct GC_Configuration *cfg,
- struct GE_Context *ectx,
+getAddress6FromGetIfAddrs (struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
GNUNET_IPv6Address * identity)
{
char *interfaces;
struct ifaddrs *ifa_first;
- if (-1 == GC_get_configuration_value_string (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_string (cfg,
"NETWORK",
"INTERFACE",
"eth0", &interfaces))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("No interface specified in section `%s' under `%s'!\n"),
"NETWORK", "INTERFACE");
return GNUNET_SYSERR; /* that won't work! */
@@ -132,8 +132,8 @@
}
freeifaddrs (ifa_first);
}
- GE_LOG (ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Could not obtain IP for interface `%s' using `%s'.\n"),
interfaces, "getifaddrs");
GNUNET_free (interfaces);
@@ -146,37 +146,37 @@
* @return GNUNET_SYSERR on error, GNUNET_OK on success
*/
static int
-getAddress6 (struct GC_Configuration *cfg,
- struct GE_Context *ectx, GNUNET_IPv6Address * address)
+getAddress6 (struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx, GNUNET_IPv6Address * address)
{
char *ipString;
int retval;
struct hostent *ip; /* for the lookup of the IP in gnunet.conf */
retval = GNUNET_SYSERR;
- if (GC_have_configuration_value (cfg, "NETWORK", "IP6"))
+ if (GNUNET_GC_have_configuration_value (cfg, "NETWORK", "IP6"))
{
ipString = NULL;
- GC_get_configuration_value_string (cfg,
+ GNUNET_GC_get_configuration_value_string (cfg,
"NETWORK", "IP6", "", &ipString);
if (strlen (ipString) > 0)
{
ip = gethostbyname2 (ipString, AF_INET6);
if (ip == NULL)
{
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Could not resolve `%s': %s\n"),
ipString, hstrerror (h_errno));
}
else if (ip->h_addrtype != AF_INET6)
{
- GE_ASSERT (ectx, 0);
+ GNUNET_GE_ASSERT (ectx, 0);
retval = GNUNET_SYSERR;
}
else
{
- GE_ASSERT (ectx,
+ GNUNET_GE_ASSERT (ectx,
sizeof (struct in6_addr) == sizeof (address->addr));
memcpy (&address->addr[0],
ip->h_addr_list[0], sizeof (struct in6_addr));
@@ -200,8 +200,8 @@
* @return GNUNET_SYSERR on error, GNUNET_OK on success
*/
int
-getPublicIP6Address (struct GC_Configuration *cfg,
- struct GE_Context *ectx, GNUNET_IPv6Address * address)
+getPublicIP6Address (struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx, GNUNET_IPv6Address *
address)
{
static GNUNET_IPv6Address myAddress;
static GNUNET_CronTime last;
@@ -216,8 +216,8 @@
if (GNUNET_SYSERR == getAddress6 (cfg, ectx, &myAddress))
{
lastError = now;
- GE_LOG (ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Failed to obtain my (external) %s address!\n"), "IPv6");
return GNUNET_SYSERR;
}
Modified: GNUnet/src/transports/ip6.h
===================================================================
--- GNUnet/src/transports/ip6.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/transports/ip6.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -33,8 +33,8 @@
*
* @return GNUNET_SYSERR on error, GNUNET_OK on success
*/
-int getPublicIP6Address (struct GC_Configuration *cfg,
- struct GE_Context *ectx,
+int getPublicIP6Address (struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
GNUNET_IPv6Address * address);
#endif
Modified: GNUnet/src/transports/nat.c
===================================================================
--- GNUnet/src/transports/nat.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/transports/nat.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -64,9 +64,9 @@
{
if ((ntohs (hello->senderAddressSize) != sizeof (HostAddress)) ||
(ntohs (hello->header.size) != GNUNET_sizeof_hello (hello)) ||
- (ntohs (hello->header.type) != p2p_PROTO_hello))
+ (ntohs (hello->header.type) != GNUNET_P2P_PROTO_HELLO))
return GNUNET_SYSERR; /* obviously invalid */
- if (GNUNET_YES == GC_get_configuration_value_yesno (coreAPI->cfg,
+ if (GNUNET_YES == GNUNET_GC_get_configuration_value_yesno (coreAPI->cfg,
"NAT", "LIMITED",
GNUNET_NO))
{
@@ -93,13 +93,13 @@
{
GNUNET_MessageHello *msg;
- if (GNUNET_NO == GC_get_configuration_value_yesno (coreAPI->cfg,
+ if (GNUNET_NO == GNUNET_GC_get_configuration_value_yesno (coreAPI->cfg,
"NAT", "LIMITED",
GNUNET_NO))
return NULL;
msg = GNUNET_malloc (sizeof (GNUNET_MessageHello) + sizeof (HostAddress));
msg->senderAddressSize = htons (sizeof (HostAddress));
- msg->protocol = htons (NAT_PROTOCOL_NUMBER);
+ msg->protocol = htons (GNUNET_TRANSPORT_PROTOCOL_NUMBER_NAT);
msg->MTU = htonl (0);
return msg;
}
@@ -111,7 +111,7 @@
* @return always fails (returns GNUNET_SYSERR)
*/
static int
-natConnect (const GNUNET_MessageHello * hello, TSession ** tsessionPtr,
+natConnect (const GNUNET_MessageHello * hello, GNUNET_TSession ** tsessionPtr,
int may_reuse)
{
return GNUNET_SYSERR;
@@ -129,7 +129,7 @@
* GNUNET_SYSERR if not.
*/
int
-natAssociate (TSession * tsession)
+natAssociate (GNUNET_TSession * tsession)
{
return GNUNET_SYSERR; /* NAT connections can never be associated */
}
@@ -143,7 +143,7 @@
* @return GNUNET_SYSERR (always fails)
*/
static int
-natSend (TSession * tsession,
+natSend (GNUNET_TSession * tsession,
const void *message, const unsigned int size, int important)
{
return GNUNET_SYSERR;
@@ -156,7 +156,7 @@
* @return always GNUNET_SYSERR
*/
static int
-natDisconnect (TSession * tsession)
+natDisconnect (GNUNET_TSession * tsession)
{
return GNUNET_SYSERR;
}
@@ -193,7 +193,7 @@
}
static int
-testWouldTry (TSession * tsession, unsigned int size, int important)
+testWouldTry (GNUNET_TSession * tsession, unsigned int size, int important)
{
return GNUNET_SYSERR;
}
@@ -206,7 +206,7 @@
inittransport_nat (CoreAPIForTransport * core)
{
coreAPI = core;
- natAPI.protocolNumber = NAT_PROTOCOL_NUMBER;
+ natAPI.protocolNumber = GNUNET_TRANSPORT_PROTOCOL_NUMBER_NAT;
natAPI.mtu = 0;
natAPI.cost = 30000;
natAPI.verifyHello = &verifyHello;
Modified: GNUnet/src/transports/smtp.c
===================================================================
--- GNUnet/src/transports/smtp.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/transports/smtp.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -96,7 +96,7 @@
*/
static CoreAPIForTransport *coreAPI;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
static TransportAPI smtpAPI;
@@ -204,14 +204,14 @@
unsigned int ret = 0;
#define CHECK_CRLF while (data[i] == '\r' || data[i] == '\n') {\
- GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER, "ignoring
CR/LF\n"); \
+ GNUNET_GE_LOG(ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST
| GNUNET_GE_USER, "ignoring CR/LF\n"); \
i++; \
if (i >= len) goto END; \
}
*output = GNUNET_malloc ((len * 3 / 4) + 8);
#if DEBUG_SMTP
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"base64_decode decoding len=%d\n", len);
#endif
for (i = 0; i < len; ++i)
@@ -270,10 +270,10 @@
"PIPE",
_("You must specify the name of a "
"pipe for the SMTP transport in section `%s' under
`%s'.\n"));
- GE_ASSERT (ectx, pipename != NULL);
+ GNUNET_GE_ASSERT (ectx, pipename != NULL);
UNLINK (pipename);
if (0 != mkfifo (pipename, S_IWUSR | S_IRUSR))
- GE_DIE_STRERROR (ectx, GE_ADMIN | GE_BULK | GE_FATAL, "mkfifo");
+ GNUNET_GE_DIE_STRERROR (ectx, GNUNET_GE_ADMIN | GNUNET_GE_BULK |
GNUNET_GE_FATAL, "mkfifo");
LINESIZE = ((smtpAPI.mtu * 4 / 3) + 8) * (MAX_CHAR_PER_LINE + 2) /
MAX_CHAR_PER_LINE; /* maximum size of a line supported */
line = GNUNET_malloc (LINESIZE + 2); /* 2 bytes for off-by-one errors, just
to be safe... */
@@ -344,7 +344,7 @@
size = base64_decode (line, strlen (line) - 1, &out);
if (size < sizeof (SMTPMessage))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_free (out);
goto END;
}
@@ -352,12 +352,12 @@
mp = (SMTPMessage *) & out[size - sizeof (SMTPMessage)];
if (ntohs (mp->size) != size)
{
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_
("Received malformed message via SMTP (size
mismatch).\n"));
#if DEBUG_SMTP
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"Size returned by base64=%d, in the msg=%d.\n",
size, ntohl (mp->size));
#endif
@@ -369,8 +369,8 @@
coreMP->tsession = NULL;
memcpy (&coreMP->sender, &mp->sender, sizeof (GNUNET_PeerIdentity));
#if DEBUG_SMTP
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"SMTP message passed to the core.\n");
#endif
@@ -379,8 +379,8 @@
}
END:
#if DEBUG_SMTP
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER, "SMTP message processed.\n");
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, "SMTP
message processed.\n");
#endif
if (fdes != NULL)
fclose (fdes);
@@ -414,13 +414,13 @@
senderAddress[ntohs (helo->senderAddressSize) - 1 -
FILTER_STRING_SIZE] != '\0'))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR; /* obviously invalid */
}
else
{
#if DEBUG_SMTP
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"Verified SMTP helo from `%s'.\n", &maddr->senderAddress[0]);
#endif
return GNUNET_OK;
@@ -449,7 +449,7 @@
static int once;
if (once == 0)
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK |
GNUNET_GE_USER,
"No email-address specified, cannot create SMTP
advertisement.\n");
once = 1;
}
@@ -458,7 +458,7 @@
filter = getConfigurationString ("SMTP", "FILTER");
if (filter == NULL)
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_
("No filter for E-mail specified, cannot create SMTP
advertisement.\n"));
GNUNET_free (email);
@@ -467,7 +467,7 @@
if (strlen (filter) > FILTER_STRING_SIZE)
{
filter[FILTER_STRING_SIZE] = '\0';
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("SMTP filter string to long, capped to `%s'\n"), filter);
}
i = (strlen (email) + 8) & (~7); /* make multiple of 8 */
@@ -479,12 +479,12 @@
strcpy (&haddr->filter[0], filter);
memcpy (&haddr->senderAddress[0], email, strlen (email) + 1);
msg->senderAddressSize = htons (strlen (email) + 1 + sizeof (EmailAddress));
- msg->protocol = htons (SMTP_PROTOCOL_NUMBER);
+ msg->protocol = htons (GNUNET_TRANSPORT_PROTOCOL_NUMBER_SMTP);
msg->MTU = htonl (smtpAPI.mtu);
msg->header.size = htons (GNUNET_sizeof_hello (msg));
GNUNET_free (email);
if (verifyHelo (msg) == GNUNET_SYSERR)
- GE_ASSERT (ectx, 0);
+ GNUNET_GE_ASSERT (ectx, 0);
return msg;
}
@@ -495,11 +495,11 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
*/
static int
-smtpConnect (const GNUNET_MessageHello * hello, TSession ** tsessionPtr)
+smtpConnect (const GNUNET_MessageHello * hello, GNUNET_TSession ** tsessionPtr)
{
- TSession *tsession;
+ GNUNET_TSession *tsession;
- tsession = GNUNET_malloc (sizeof (TSession));
+ tsession = GNUNET_malloc (sizeof (GNUNET_TSession));
tsession->internal = GNUNET_malloc (GNUNET_sizeof_hello (hello));
tsession->peer = hello->senderIdentity;
memcpy (tsession->internal, hello, GNUNET_sizeof_hello (hello));
@@ -522,7 +522,7 @@
* GNUNET_SYSERR if not.
*/
int
-smtpAssociate (TSession * tsession)
+smtpAssociate (GNUNET_TSession * tsession)
{
return GNUNET_SYSERR; /* SMTP connections can never be associated */
}
@@ -536,7 +536,7 @@
* @return GNUNET_SYSERR on error, GNUNET_OK on success
*/
static int
-smtpSend (TSession * tsession,
+smtpSend (GNUNET_TSession * tsession,
const void *message, const unsigned int size, int important)
{
char *msg;
@@ -557,7 +557,7 @@
return GNUNET_SYSERR;
if ((size == 0) || (size > smtpAPI.mtu))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
helo = (GNUNET_MessageHello *) tsession->internal;
@@ -567,8 +567,8 @@
smtp_sock = smtp_create_session ();
if (smtp_sock == NULL)
{
- GE_LOG (ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE,
_("Failed to initialize libesmtp: %s.\n"),
smtp_strerror (smtp_errno (), ebuf, EBUF_LEN));
return NULL;
@@ -586,14 +586,14 @@
memcpy (msg, message, size);
ebody = NULL;
#if DEBUG_SMTP
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Base64-encoding %d byte message.\n", ssize);
#endif
ssize = base64_encode (msg, ssize, &ebody);
#if DEBUG_SMTP
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Base64-encoded message size is %d bytes.\n", ssize);
#endif
GNUNET_free (msg);
@@ -602,8 +602,8 @@
message = smtp_add_message (smtp_sock);
if (message == NULL)
{
- GE_LOG (ectx,
- GE_WARNING | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
"Failed to create smtp message: %s\n",
smtp_strerror (smtp_errno (), ebuf, EBUF_LEN));
return GNUNET_SYSERR;
@@ -626,8 +626,8 @@
/* FIXME */
}
if (res != GNUNET_OK)
- GE_LOG (ectx,
- GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_("Sending E-mail to `%s' failed.\n"), &haddr->senderAddress[0]);
incrementBytesSent (ssize);
GNUNET_free (ebody);
@@ -644,7 +644,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
*/
static int
-smtpDisconnect (TSession * tsession)
+smtpDisconnect (GNUNET_TSession * tsession)
{
if (tsession != NULL)
{
@@ -667,7 +667,7 @@
dispatchThread =
GNUNET_thread_create (&listenAndDistribute, NULL, 1024 * 4);
if (dispatchThread == NULL)
- GE_DIE_STRERROR (ectx, GE_ADMIN | GE_BULK | GE_FATAL, "pthread_create");
+ GNUNET_GE_DIE_STRERROR (ectx, GNUNET_GE_ADMIN | GNUNET_GE_BULK |
GNUNET_GE_FATAL, "pthread_create");
return GNUNET_OK;
}
@@ -709,7 +709,7 @@
/**
* The default maximum size of each outbound SMTP message.
*/
-#define MESSAGE_SIZE 65528
+#define MESSAGNUNET_GE_SIZE 65528
/**
* The exported method. Makes the core api available via a global and
@@ -724,16 +724,16 @@
ectx = core->ectx;
mtu = getConfigurationInt ("SMTP", "MTU");
if (mtu == 0)
- mtu = MESSAGE_SIZE;
+ mtu = MESSAGNUNET_GE_SIZE;
if (mtu < 1200)
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_
("MTU for `%s' is probably too low (fragmentation not
implemented!)\n"),
"SMTP");
- if (mtu > MESSAGE_SIZE)
- mtu = MESSAGE_SIZE;
- smtpAPI.protocolNumber = SMTP_PROTOCOL_NUMBER;
+ if (mtu > MESSAGNUNET_GE_SIZE)
+ mtu = MESSAGNUNET_GE_SIZE;
+ smtpAPI.protocolNumber = GNUNET_TRANSPORT_PROTOCOL_NUMBER_SMTP;
smtpAPI.mtu = mtu - sizeof (SMTPMessage);
smtpAPI.cost = 50;
smtpAPI.verifyHelo = &verifyHelo;
Modified: GNUnet/src/transports/tcp.c
===================================================================
--- GNUnet/src/transports/tcp.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/transports/tcp.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -82,13 +82,13 @@
static TransportAPI tcpAPI;
-static UPnP_ServiceAPI *upnp;
+static GNUNET_UPnP_ServiceAPI *upnp;
static struct GNUNET_IPv4NetworkSet *filteredNetworks_;
static struct GNUNET_IPv4NetworkSet *allowedNetworks_;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static struct GNUNET_Mutex *tcpblacklistlock;
@@ -113,8 +113,8 @@
else
{
#if DEBUG_TCP
- GE_LOG (ectx,
- GE_DEBUG | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"Rejecting connection (invalid address length %u)\n", addr_len);
#endif
return GNUNET_SYSERR;
@@ -126,8 +126,8 @@
GNUNET_mutex_unlock (tcpblacklistlock);
#if DEBUG_TCP
if (ret != GNUNET_NO)
- GE_LOG (ectx,
- GE_DEBUG | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"Rejecting connection from address %u.%u.%u.%u (blacklisted)\n",
GNUNET_PRIP (ntohl (*(int *) addr)));
#endif
@@ -155,8 +155,8 @@
else
{
#if DEBUG_TCP
- GE_LOG (ectx,
- GE_DEBUG | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"Rejecting connection (invalid address length %u)\n", addr_len);
#endif
return GNUNET_SYSERR;
@@ -169,8 +169,8 @@
if (ret != GNUNET_YES)
{
#if DEBUG_TCP
- GE_LOG (ectx,
- GE_DEBUG | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"Rejecting HELLO from address %u.%u.%u.%u (not whitelisted)\n",
GNUNET_PRIP (ntohl (*(int *) addr)));
#endif
@@ -199,7 +199,7 @@
struct servent *pse; /* pointer to service information entry
*/
unsigned long long port;
- if (-1 == GC_get_configuration_value_number (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_number (cfg,
"TCP",
"PORT", 0, 65535, 2086, &port))
{
@@ -228,8 +228,8 @@
haddr = (HostAddress *) & hello[1];
if ((ntohs (hello->senderAddressSize) != sizeof (HostAddress)) ||
(ntohs (hello->header.size) != GNUNET_sizeof_hello (hello)) ||
- (ntohs (hello->header.type) != p2p_PROTO_hello) ||
- (ntohs (hello->protocol) != TCP_PROTOCOL_NUMBER) ||
+ (ntohs (hello->header.type) != GNUNET_P2P_PROTO_HELLO) ||
+ (ntohs (hello->protocol) != GNUNET_TRANSPORT_PROTOCOL_NUMBER_TCP) ||
(GNUNET_YES == isBlacklisted (&haddr->ip,
sizeof (GNUNET_IPv4Address))) ||
(GNUNET_YES != isWhitelisted (&haddr->ip, sizeof (GNUNET_IPv4Address))))
@@ -238,8 +238,8 @@
GNUNET_EncName enc;
GNUNET_hash_to_enc (&hello->senderIdentity.hashPubKey, &enc);
- GE_LOG (ectx,
- GE_DEBUG | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"Rejecting HELLO from `%s'\n", &enc);
#endif
return GNUNET_SYSERR; /* obviously invalid */
@@ -270,8 +270,8 @@
{
once = 1;
#if DEBUG_TCP
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
"TCP port is 0, will only send using TCP.\n");
#endif
}
@@ -287,8 +287,8 @@
(GNUNET_SYSERR != getPublicIPAddress (cfg, ectx, &haddr->ip))))
{
GNUNET_free (msg);
- GE_LOG (ectx,
- GE_WARNING | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
_("TCP: Could not determine my public IP address.\n"));
return NULL;
}
@@ -296,14 +296,14 @@
haddr->reserved = htons (0);
if (0 != memcmp (haddr, &last_addr, sizeof (HostAddress)))
{
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
"TCP uses IP address %u.%u.%u.%u.\n",
GNUNET_PRIP (ntohl (*(int *) &haddr->ip)));
last_addr = *haddr;
}
msg->senderAddressSize = htons (sizeof (HostAddress));
- msg->protocol = htons (TCP_PROTOCOL_NUMBER);
+ msg->protocol = htons (GNUNET_TRANSPORT_PROTOCOL_NUMBER_TCP);
msg->MTU = htonl (tcpAPI.mtu);
return msg;
}
@@ -316,7 +316,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
*/
static int
-tcpConnect (const GNUNET_MessageHello * hello, TSession ** tsessionPtr,
+tcpConnect (const GNUNET_MessageHello * hello, GNUNET_TSession ** tsessionPtr,
int may_reuse)
{
static int zero = 0;
@@ -356,8 +356,8 @@
}
haddr = (HostAddress *) & hello[1];
#if DEBUG_TCP
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
"Creating TCP connection to %u.%u.%u.%u:%u.\n",
GNUNET_PRIP (ntohl (*(int *) &haddr->ip.addr)),
ntohs (haddr->port));
@@ -365,7 +365,7 @@
sock = SOCKET (PF_INET, SOCK_STREAM, 6); /* 6: TCP */
if (sock == -1)
{
- GE_LOG_STRERROR (ectx, GE_ERROR | GE_ADMIN | GE_BULK, "socket");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "socket");
return GNUNET_SYSERR;
}
s = socket_create (ectx, coreAPI->load_monitor, sock);
@@ -382,14 +382,14 @@
memset (&soaddr, 0, sizeof (soaddr));
soaddr.sin_family = AF_INET;
- GE_ASSERT (ectx, sizeof (struct in_addr) == sizeof (GNUNET_IPv4Address));
+ GNUNET_GE_ASSERT (ectx, sizeof (struct in_addr) == sizeof
(GNUNET_IPv4Address));
memcpy (&soaddr.sin_addr, &haddr->ip, sizeof (GNUNET_IPv4Address));
soaddr.sin_port = haddr->port;
i = CONNECT (sock, (struct sockaddr *) &soaddr, sizeof (soaddr));
if ((i < 0) && (errno != EINPROGRESS) && (errno != EWOULDBLOCK))
{
- GE_LOG (ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
_("Cannot connect to %u.%u.%u.%u:%u: %s\n"),
GNUNET_PRIP (ntohl (*(int *) &haddr->ip)),
ntohs (haddr->port), STRERROR (errno));
@@ -397,8 +397,8 @@
return GNUNET_SYSERR;
}
#if DEBUG_TCP
- GE_LOG (ectx,
- GE_DEBUG | GE_DEVELOPER | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_USER |
GNUNET_GE_BULK,
"Establishing connection to %u.%u.%u.%u:%u\n",
GNUNET_PRIP (ntohl (*(int *) &haddr->ip)), ntohs (haddr->port));
#endif
@@ -419,7 +419,7 @@
if (selector != NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
port = getGNUnetTCPPort ();
@@ -428,26 +428,26 @@
s = SOCKET (PF_INET, SOCK_STREAM, 0);
if (s < 0)
{
- GE_LOG_STRERROR (ectx, GE_ERROR | GE_ADMIN | GE_BULK, "socket");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "socket");
return GNUNET_SYSERR;
}
if (SETSOCKOPT (s, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) < 0)
- GE_DIE_STRERROR (ectx,
- GE_FATAL | GE_ADMIN | GE_IMMEDIATE, "setsockopt");
+ GNUNET_GE_DIE_STRERROR (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE, "setsockopt");
memset ((char *) &serverAddr, 0, sizeof (serverAddr));
serverAddr.sin_family = AF_INET;
serverAddr.sin_addr.s_addr = htonl (INADDR_ANY);
serverAddr.sin_port = htons (getGNUnetTCPPort ());
if (BIND (s, (struct sockaddr *) &serverAddr, sizeof (serverAddr)) < 0)
{
- GE_LOG_STRERROR (ectx, GE_ERROR | GE_ADMIN | GE_IMMEDIATE, "bind");
- GE_LOG (ectx,
- GE_ERROR | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE, "bind");
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_IMMEDIATE,
_("Failed to start transport service on port %d.\n"),
getGNUnetTCPPort ());
if (0 != CLOSE (s))
- GE_LOG_STRERROR (ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"close");
return GNUNET_SYSERR;
}
@@ -479,8 +479,8 @@
*/
static int
reloadConfiguration (void *ctx,
- struct GC_Configuration *cfg,
- struct GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
const char *section, const char *option)
{
char *ch;
@@ -492,11 +492,11 @@
GNUNET_free_non_null (filteredNetworks_);
GNUNET_free_non_null (allowedNetworks_);
ch = NULL;
- GC_get_configuration_value_string (cfg, "TCP", "BLACKLIST", "", &ch);
+ GNUNET_GC_get_configuration_value_string (cfg, "TCP", "BLACKLIST", "", &ch);
filteredNetworks_ = GNUNET_parse_ipv4_network_specification (ectx, ch);
GNUNET_free (ch);
ch = NULL;
- GC_get_configuration_value_string (cfg, "TCP", "WHITELIST", "", &ch);
+ GNUNET_GC_get_configuration_value_string (cfg, "TCP", "WHITELIST", "", &ch);
if (strlen (ch) > 0)
allowedNetworks_ = GNUNET_parse_ipv4_network_specification (ectx, ch);
else
@@ -539,12 +539,12 @@
{
ectx = core->ectx;
cfg = core->cfg;
- GE_ASSERT (ectx, sizeof (HostAddress) == 8);
- GE_ASSERT (ectx, sizeof (GNUNET_MessageHeader) == 4);
- GE_ASSERT (ectx, sizeof (TCPWelcome) == 68);
+ GNUNET_GE_ASSERT (ectx, sizeof (HostAddress) == 8);
+ GNUNET_GE_ASSERT (ectx, sizeof (GNUNET_MessageHeader) == 4);
+ GNUNET_GE_ASSERT (ectx, sizeof (TCPWelcome) == 68);
tcplock = GNUNET_mutex_create (GNUNET_YES);
tcpblacklistlock = GNUNET_mutex_create (GNUNET_YES);
- if (0 != GC_attach_change_listener (cfg, &reloadConfiguration, NULL))
+ if (0 != GNUNET_GC_attach_change_listener (cfg, &reloadConfiguration, NULL))
{
GNUNET_mutex_destroy (tcplock);
GNUNET_mutex_destroy (tcpblacklistlock);
@@ -553,15 +553,15 @@
return NULL;
}
coreAPI = core;
- if (GC_get_configuration_value_yesno (cfg, "TCP", "UPNP", GNUNET_YES) ==
+ if (GNUNET_GC_get_configuration_value_yesno (cfg, "TCP", "UPNP", GNUNET_YES)
==
GNUNET_YES)
{
upnp = coreAPI->requestService ("upnp");
if (upnp == NULL)
{
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
_
("The UPnP service could not be loaded. To disable UPnP, set
the "
"configuration option \"UPNP\" in section \"TCP\" to
\"NO\"\n"));
@@ -577,7 +577,7 @@
stat_bytesDropped
= stats->create (gettext_noop ("# bytes dropped by TCP (outgoing)"));
}
- tcpAPI.protocolNumber = TCP_PROTOCOL_NUMBER;
+ tcpAPI.protocolNumber = GNUNET_TRANSPORT_PROTOCOL_NUMBER_TCP;
tcpAPI.mtu = 0;
tcpAPI.cost = 20000; /* about equal to udp */
tcpAPI.verifyHello = &verifyHello;
@@ -597,7 +597,7 @@
void
donetransport_tcp ()
{
- GC_detach_change_listener (cfg, &reloadConfiguration, NULL);
+ GNUNET_GC_detach_change_listener (cfg, &reloadConfiguration, NULL);
if (stats != NULL)
{
coreAPI->releaseService (stats);
Modified: GNUnet/src/transports/tcp6.c
===================================================================
--- GNUnet/src/transports/tcp6.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/transports/tcp6.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -86,7 +86,7 @@
static struct GNUNET_IPv6NetworkSet *allowedNetworks_;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static struct GNUNET_Mutex *tcpblacklistlock;
@@ -173,7 +173,7 @@
struct servent *pse; /* pointer to service information entry
*/
unsigned long long port;
- if (-1 == GC_get_configuration_value_number (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_number (cfg,
"TCP6",
"PORT", 1, 65535, 2086, &port))
{
@@ -202,8 +202,8 @@
haddr = (Host6Address *) & hello[1];
if ((ntohs (hello->senderAddressSize) != sizeof (Host6Address)) ||
(ntohs (hello->header.size) != GNUNET_sizeof_hello (hello)) ||
- (ntohs (hello->header.type) != p2p_PROTO_hello) ||
- (ntohs (hello->protocol) != TCP6_PROTOCOL_NUMBER) ||
+ (ntohs (hello->header.type) != GNUNET_P2P_PROTO_HELLO) ||
+ (ntohs (hello->protocol) != GNUNET_TRANSPORT_PROTOCOL_NUMBER_TCP6) ||
(GNUNET_YES == isBlacklisted (&haddr->ip,
sizeof (GNUNET_IPv6Address))) ||
(GNUNET_YES != isWhitelisted (&haddr->ip, sizeof (GNUNET_IPv6Address))))
@@ -230,7 +230,7 @@
if (0 == port)
{
#if DEBUG_TCP6
- GE_LOG (ectx, GE_DEBUG, "TCP6 port is 0, will only send using TCP6\n");
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG, "TCP6 port is 0, will only send
using TCP6\n");
#endif
return NULL; /* TCP6 transport is configured SEND-only! */
}
@@ -242,15 +242,15 @@
if (GNUNET_SYSERR == getPublicIP6Address (cfg, ectx, &haddr->ip))
{
GNUNET_free (msg);
- GE_LOG (ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Could not determine my public IPv6 address.\n"));
return NULL;
}
haddr->port = htons (port);
haddr->reserved = htons (0);
msg->senderAddressSize = htons (sizeof (Host6Address));
- msg->protocol = htons (TCP6_PROTOCOL_NUMBER);
+ msg->protocol = htons (GNUNET_TRANSPORT_PROTOCOL_NUMBER_TCP6);
msg->MTU = htonl (tcp6API.mtu);
return msg;
}
@@ -263,7 +263,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
*/
static int
-tcp6Connect (const GNUNET_MessageHello * hello, TSession ** tsessionPtr,
+tcp6Connect (const GNUNET_MessageHello * hello, GNUNET_TSession ** tsessionPtr,
int may_reuse)
{
int i;
@@ -310,16 +310,16 @@
rtn = getaddrinfo (hostname, NULL, &hints, &res0);
if (rtn != 0)
{
- GE_LOG (ectx,
- GE_WARNING | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
_("`%s': unknown service: %s\n"),
__FUNCTION__, gai_strerror (rtn));
return GNUNET_SYSERR;
}
#if DEBUG_TCP6
- GE_LOG (ectx,
- GE_DEBUG,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG,
"Creating TCP6 connection to %s:%d\n",
inet_ntop (AF_INET6,
haddr,
@@ -335,7 +335,7 @@
sock = SOCKET (res->ai_family, res->ai_socktype, res->ai_protocol);
if (sock < 0)
{
- GE_LOG_STRERROR (ectx, GE_WARNING | GE_ADMIN | GE_BULK, "socket");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "socket");
sock = -1;
continue;
}
@@ -350,7 +350,7 @@
i = CONNECT (sock, res->ai_addr, res->ai_addrlen);
if ((i < 0) && (errno != EINPROGRESS) && (errno != EWOULDBLOCK))
{
- GE_LOG_STRERROR (ectx, GE_WARNING | GE_ADMIN | GE_BULK, "connect");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "connect");
GNUNET_socket_destroy (s);
s = NULL;
sock = -1;
@@ -361,7 +361,7 @@
freeaddrinfo (res0);
if (sock == -1)
return GNUNET_SYSERR;
- GE_ASSERT (ectx, s != NULL);
+ GNUNET_GE_ASSERT (ectx, s != NULL);
return tcpConnectHelper (hello, s, tcp6API.protocolNumber, tsessionPtr);
}
@@ -379,7 +379,7 @@
if (selector != NULL)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
port = getGNUnetTCP6Port ();
@@ -388,12 +388,12 @@
s = SOCKET (PF_INET6, SOCK_STREAM, 0);
if (s < 0)
{
- GE_LOG_STRERROR (ectx, GE_ERROR | GE_ADMIN | GE_BULK, "socket");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "socket");
return GNUNET_SYSERR;
}
if (SETSOCKOPT (s, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) < 0)
- GE_DIE_STRERROR (ectx,
- GE_FATAL | GE_ADMIN | GE_IMMEDIATE, "setsockopt");
+ GNUNET_GE_DIE_STRERROR (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE, "setsockopt");
memset ((char *) &serverAddr, 0, sizeof (serverAddr));
serverAddr.sin6_family = AF_INET6;
serverAddr.sin6_flowinfo = 0;
@@ -401,14 +401,14 @@
serverAddr.sin6_port = htons (getGNUnetTCP6Port ());
if (BIND (s, (struct sockaddr *) &serverAddr, sizeof (serverAddr)) < 0)
{
- GE_LOG_STRERROR (ectx, GE_ERROR | GE_ADMIN | GE_IMMEDIATE, "bind");
- GE_LOG (ectx,
- GE_ERROR | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE, "bind");
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_IMMEDIATE,
_("Failed to start transport service on port %d.\n"),
getGNUnetTCP6Port ());
if (0 != CLOSE (s))
- GE_LOG_STRERROR (ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"close");
return GNUNET_SYSERR;
}
@@ -440,8 +440,8 @@
*/
static int
reloadConfiguration (void *ctx,
- struct GC_Configuration *cfg,
- struct GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
const char *section, const char *option)
{
char *ch;
@@ -451,10 +451,10 @@
GNUNET_mutex_lock (tcpblacklistlock);
GNUNET_free_non_null (filteredNetworks_);
GNUNET_free_non_null (allowedNetworks_);
- GC_get_configuration_value_string (cfg, "TCP6", "BLACKLIST", "", &ch);
+ GNUNET_GC_get_configuration_value_string (cfg, "TCP6", "BLACKLIST", "", &ch);
filteredNetworks_ = GNUNET_parse_ipv6_network_specification (ectx, ch);
GNUNET_free (ch);
- GC_get_configuration_value_string (cfg, "TCP6", "WHITELIST", "", &ch);
+ GNUNET_GC_get_configuration_value_string (cfg, "TCP6", "WHITELIST", "", &ch);
if (strlen (ch) > 0)
allowedNetworks_ = GNUNET_parse_ipv6_network_specification (ectx, ch);
else
@@ -499,7 +499,7 @@
cfg = core->cfg;
tcplock = GNUNET_mutex_create (GNUNET_YES);
tcpblacklistlock = GNUNET_mutex_create (GNUNET_YES);
- if (0 != GC_attach_change_listener (cfg, &reloadConfiguration, NULL))
+ if (0 != GNUNET_GC_attach_change_listener (cfg, &reloadConfiguration, NULL))
{
GNUNET_mutex_destroy (tcplock);
GNUNET_mutex_destroy (tcpblacklistlock);
@@ -517,7 +517,7 @@
stat_bytesDropped
= stats->create (gettext_noop ("# bytes dropped by TCP6 (outgoing)"));
}
- tcp6API.protocolNumber = TCP6_PROTOCOL_NUMBER;
+ tcp6API.protocolNumber = GNUNET_TRANSPORT_PROTOCOL_NUMBER_TCP6;
tcp6API.mtu = 0;
tcp6API.cost = 19950; /* about equal to udp6 */
tcp6API.verifyHello = &verifyHello;
@@ -537,7 +537,7 @@
void
donetransport_tcp6 ()
{
- GC_detach_change_listener (cfg, &reloadConfiguration, NULL);
+ GNUNET_GC_detach_change_listener (cfg, &reloadConfiguration, NULL);
coreAPI->releaseService (stats);
stats = NULL;
GNUNET_free_non_null (filteredNetworks_);
Modified: GNUnet/src/transports/tcp_helper.c
===================================================================
--- GNUnet/src/transports/tcp_helper.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/transports/tcp_helper.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -28,7 +28,7 @@
/**
* Initial handshake message. Note that the beginning
- * must match the CS_MESSAGE_HEADER since we are using tcpio.
+ * must match the CS_MESSAGNUNET_GE_HEADER since we are using tcpio.
*/
typedef struct
{
@@ -56,7 +56,7 @@
/**
* Our tsession.
*/
- TSession *tsession;
+ GNUNET_TSession *tsession;
/**
* mutex for synchronized access to 'users'
@@ -97,7 +97,7 @@
*/
static CoreAPIForTransport *coreAPI;
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
static int stat_bytesReceived;
@@ -107,7 +107,7 @@
static struct GNUNET_SelectHandle *selector;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
static struct GNUNET_Mutex *tcplock;
@@ -143,21 +143,21 @@
pos = pos->next;
}
GNUNET_mutex_unlock (tcplock);
- GE_ASSERT (ectx, GNUNET_OK == coreAPI->assertUnused (tcpsession->tsession));
+ GNUNET_GE_ASSERT (ectx, GNUNET_OK == coreAPI->assertUnused
(tcpsession->tsession));
GNUNET_mutex_lock (tcplock);
GNUNET_free (tcpsession->tsession);
GNUNET_free (tcpsession);
}
static int
-tcpDisconnect (TSession * tsession)
+tcpDisconnect (GNUNET_TSession * tsession)
{
TCPSession *tcpsession = tsession->internal;
- GE_ASSERT (ectx, selector != NULL);
+ GNUNET_GE_ASSERT (ectx, selector != NULL);
GNUNET_mutex_lock (tcplock);
GNUNET_mutex_lock (tcpsession->lock);
- GE_ASSERT (ectx, tcpsession->users > 0);
+ GNUNET_GE_ASSERT (ectx, tcpsession->users > 0);
tcpsession->users--;
if ((tcpsession->users > 0) || (tcpsession->in_select == GNUNET_YES))
{
@@ -171,8 +171,8 @@
GNUNET_mutex_unlock (tcpsession->lock);
GNUNET_mutex_unlock (tcplock);
#if DEBUG_TCP
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
"TCP disconnect closes socket session.\n");
#endif
GNUNET_select_disconnect (selector, tcpsession->sock);
@@ -202,11 +202,11 @@
* GNUNET_SYSERR if not.
*/
static int
-tcpAssociate (TSession * tsession)
+tcpAssociate (GNUNET_TSession * tsession)
{
TCPSession *tcpSession;
- GE_ASSERT (ectx, tsession != NULL);
+ GNUNET_GE_ASSERT (ectx, tsession != NULL);
tcpSession = tsession->internal;
GNUNET_mutex_lock (tcpSession->lock);
if ((tcpSession->users == 0) && (tcpSession->in_select == GNUNET_YES))
@@ -229,7 +229,7 @@
struct GNUNET_SocketHandle *sock,
void *sock_ctx, const GNUNET_MessageHeader * msg)
{
- TSession *tsession = sock_ctx;
+ GNUNET_TSession *tsession = sock_ctx;
TCPSession *tcpSession;
unsigned int len;
P2P_PACKET *mp;
@@ -237,7 +237,7 @@
if (GNUNET_SYSERR == tcpAssociate (tsession))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
len = ntohs (msg->size);
@@ -247,13 +247,13 @@
if (GNUNET_YES == tcpSession->expectingWelcome)
{
/* at this point, we should be the only user! */
- GE_ASSERT (NULL, tcpSession->users == 1);
+ GNUNET_GE_ASSERT (NULL, tcpSession->users == 1);
welcome = (const TCPWelcome *) msg;
if ((ntohs (welcome->header.type) != 0) || (len != sizeof (TCPWelcome)))
{
- GE_LOG (ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
_
("Received malformed message instead of welcome message.
Closing.\n"));
tcpDisconnect (tsession);
@@ -271,8 +271,8 @@
/* send msg to core! */
if (len <= sizeof (GNUNET_MessageHeader))
{
- GE_LOG (ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
_
("Received malformed message from tcp-peer connection.
Closing.\n"));
tcpDisconnect (tsession);
@@ -303,21 +303,21 @@
const void *addr, unsigned int addr_len)
{
BlacklistedTester blt = ah_cls;
- TSession *tsession;
+ GNUNET_TSession *tsession;
TCPSession *tcpSession;
- GE_ASSERT (NULL, sock != NULL);
+ GNUNET_GE_ASSERT (NULL, sock != NULL);
if (GNUNET_NO != blt (addr, addr_len))
{
#if DEBUG_TCP
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
"Rejecting TCP connection (blacklisted).\n");
#endif
return NULL;
}
#if DEBUG_TCP
- GE_LOG (ectx, GE_DEBUG | GE_USER | GE_BULK, "Accepting TCP connection.\n");
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
"Accepting TCP connection.\n");
#endif
tcpSession = GNUNET_malloc (sizeof (TCPSession));
memset (tcpSession, 0, sizeof (TCPSession));
@@ -330,9 +330,9 @@
tcpSession->users = 0;
tcpSession->in_select = GNUNET_YES;
- tsession = GNUNET_malloc (sizeof (TSession));
- memset (tsession, 0, sizeof (TSession));
- tsession->ttype = TCP_PROTOCOL_NUMBER;
+ tsession = GNUNET_malloc (sizeof (GNUNET_TSession));
+ memset (tsession, 0, sizeof (GNUNET_TSession));
+ tsession->ttype = GNUNET_TRANSPORT_PROTOCOL_NUMBER_TCP;
tsession->internal = tcpSession;
tcpSession->tsession = tsession;
tsession->peer = *(coreAPI->myIdentity);
@@ -345,7 +345,7 @@
}
else
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
tcpSession->addr_len = 0;
tcpSession->accept_addr = NULL;
}
@@ -361,17 +361,17 @@
struct GNUNET_SelectHandle *sh,
struct GNUNET_SocketHandle *sock, void *sock_ctx)
{
- TSession *tsession = sock_ctx;
+ GNUNET_TSession *tsession = sock_ctx;
TCPSession *tcpSession = tsession->internal;
#if DEBUG_TCP
GNUNET_EncName enc;
IF_GELOG (ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
GNUNET_hash_to_enc (&tcpSession->sender.hashPubKey, &enc));
- GE_LOG (ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"Closed TCP socket of `%s'.\n", &enc);
#endif
GNUNET_mutex_lock (tcplock);
@@ -398,7 +398,7 @@
* @return GNUNET_SYSERR on error, GNUNET_OK on success
*/
static int
-tcpSend (TSession * tsession,
+tcpSend (GNUNET_TSession * tsession,
const void *msg, unsigned int size, int important)
{
TCPSession *tcpSession;
@@ -408,7 +408,7 @@
tcpSession = tsession->internal;
if (size >= GNUNET_MAX_BUFFER_SIZE - sizeof (GNUNET_MessageHeader))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR; /* too big */
}
if (tcpSession->in_select == GNUNET_NO)
@@ -417,10 +417,10 @@
GNUNET_EncName enc;
IF_GELOG (ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
GNUNET_hash_to_enc (&tcpSession->sender.hashPubKey, &enc));
- GE_LOG (ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"Cannot send message - TCP socket of `%s' already closed!\n",
&enc);
#endif
@@ -431,15 +431,15 @@
if (stats != NULL)
stats->change (stat_bytesDropped, size);
#if DEBUG_TCP
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
"Could not sent TCP message -- tcp transport is down.\n");
#endif
return GNUNET_SYSERR;
}
if (size == 0)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
if (tcpSession->sock == NULL)
@@ -447,8 +447,8 @@
if (stats != NULL)
stats->change (stat_bytesDropped, size);
#if DEBUG_TCP
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
"Could not sent TCP message -- other side closed connection.\n");
#endif
return GNUNET_SYSERR; /* other side closed connection */
@@ -458,8 +458,8 @@
mp->type = 0;
memcpy (&mp[1], msg, size);
#if DEBUG_TCP
- GE_LOG (ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"Transport asks select to queue message of size %u\n", size);
#endif
ok =
@@ -486,20 +486,20 @@
* GNUNET_SYSERR if the size/session is invalid
*/
static int
-tcpTestWouldTry (TSession * tsession, const unsigned int size, int important)
+tcpTestWouldTry (GNUNET_TSession * tsession, const unsigned int size, int
important)
{
TCPSession *tcpSession = tsession->internal;
if (size >= GNUNET_MAX_BUFFER_SIZE - sizeof (GNUNET_MessageHeader))
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
if (selector == NULL)
return GNUNET_SYSERR;
if (size == 0)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
if (tcpSession->sock == NULL)
@@ -519,10 +519,10 @@
static int
tcpConnectHelper (const GNUNET_MessageHello * hello,
struct GNUNET_SocketHandle *s,
- unsigned int protocolNumber, TSession ** tsessionPtr)
+ unsigned int protocolNumber, GNUNET_TSession ** tsessionPtr)
{
TCPWelcome welcome;
- TSession *tsession;
+ GNUNET_TSession *tsession;
TCPSession *tcpSession;
tcpSession = GNUNET_malloc (sizeof (TCPSession));
@@ -530,8 +530,8 @@
tcpSession->addr_len = 0;
tcpSession->accept_addr = NULL;
tcpSession->sock = s;
- tsession = GNUNET_malloc (sizeof (TSession));
- memset (tsession, 0, sizeof (TSession));
+ tsession = GNUNET_malloc (sizeof (GNUNET_TSession));
+ memset (tsession, 0, sizeof (GNUNET_TSession));
tsession->internal = tcpSession;
tsession->ttype = protocolNumber;
tsession->peer = hello->senderIdentity;
@@ -556,8 +556,8 @@
GNUNET_YES))
{
#if DEBUG_TCP
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
"Could not sent TCP welcome message, closing connection.\n");
#endif
/* disconnect caller -- error! */
Modified: GNUnet/src/transports/test.c
===================================================================
--- GNUnet/src/transports/test.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/transports/test.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -91,7 +91,7 @@
}
static int
-assertUnused (TSession * tsession)
+assertUnused (GNUNET_TSession * tsession)
{
return GNUNET_OK;
}
@@ -104,7 +104,7 @@
receive (P2P_PACKET * mp)
{
unsigned int retries;
- TSession *tsession;
+ GNUNET_TSession *tsession;
GNUNET_MessageHello *hello;
if (pid == 0)
@@ -172,7 +172,7 @@
char *trans;
int res;
int pos;
- TSession *tsession;
+ GNUNET_TSession *tsession;
GNUNET_MessageHello *hello;
memset (&api, 0, sizeof (CoreAPIForTransport));
@@ -199,33 +199,33 @@
if (NULL != strstr (trans, "-"))
strstr (trans, ".")[0] = '\0';
/* disable blacklists (loopback is often blacklisted)... */
- GC_set_configuration_value_string (api.cfg, api.ectx, "TCP", "BLACKLIST",
+ GNUNET_GC_set_configuration_value_string (api.cfg, api.ectx, "TCP",
"BLACKLIST",
"");
- GC_set_configuration_value_string (api.cfg, api.ectx, "TCP", "UPNP", "NO");
- GC_set_configuration_value_string (api.cfg, api.ectx, "TCP6", "BLACKLIST",
+ GNUNET_GC_set_configuration_value_string (api.cfg, api.ectx, "TCP", "UPNP",
"NO");
+ GNUNET_GC_set_configuration_value_string (api.cfg, api.ectx, "TCP6",
"BLACKLIST",
"");
- GC_set_configuration_value_string (api.cfg, api.ectx, "UDP", "BLACKLIST",
+ GNUNET_GC_set_configuration_value_string (api.cfg, api.ectx, "UDP",
"BLACKLIST",
"");
- GC_set_configuration_value_string (api.cfg, api.ectx, "UDP", "UPNP", "NO");
- GC_set_configuration_value_string (api.cfg, api.ectx, "UDP6", "BLACKLIST",
+ GNUNET_GC_set_configuration_value_string (api.cfg, api.ectx, "UDP", "UPNP",
"NO");
+ GNUNET_GC_set_configuration_value_string (api.cfg, api.ectx, "UDP6",
"BLACKLIST",
"");
- GC_set_configuration_value_string (api.cfg, api.ectx, "HTTP", "BLACKLIST",
+ GNUNET_GC_set_configuration_value_string (api.cfg, api.ectx, "HTTP",
"BLACKLIST",
"");
- GC_set_configuration_value_string (api.cfg, api.ectx, "HTTP", "UPNP", "NO");
+ GNUNET_GC_set_configuration_value_string (api.cfg, api.ectx, "HTTP", "UPNP",
"NO");
if (pid == 0)
pos = OFFSET;
else
pos = 0;
- GC_set_configuration_value_number (api.cfg, api.ectx, "TCP", "PORT",
+ GNUNET_GC_set_configuration_value_number (api.cfg, api.ectx, "TCP", "PORT",
4444 + pos);
- GC_set_configuration_value_number (api.cfg, api.ectx, "TCP6", "PORT",
+ GNUNET_GC_set_configuration_value_number (api.cfg, api.ectx, "TCP6", "PORT",
4445 + pos);
- GC_set_configuration_value_number (api.cfg, api.ectx, "UDP", "PORT",
+ GNUNET_GC_set_configuration_value_number (api.cfg, api.ectx, "UDP", "PORT",
4446 + pos);
- GC_set_configuration_value_number (api.cfg, api.ectx, "UDP6", "PORT",
+ GNUNET_GC_set_configuration_value_number (api.cfg, api.ectx, "UDP6", "PORT",
4447 + pos);
- GC_set_configuration_value_number (api.cfg, api.ectx, "HTTP", "PORT",
+ GNUNET_GC_set_configuration_value_number (api.cfg, api.ectx, "HTTP", "PORT",
4448 + pos);
GNUNET_create_random_hash (&me.hashPubKey);
plugin = GNUNET_plugin_load (api.ectx, "libgnunettransport_", trans);
@@ -259,7 +259,7 @@
goto cleanup;
}
transport->startTransportServer ();
- GE_ASSERT (NULL, (transport->mtu >= expectedSize) || (transport->mtu == 0));
+ GNUNET_GE_ASSERT (NULL, (transport->mtu >= expectedSize) || (transport->mtu
== 0));
GNUNET_thread_sleep (50 * GNUNET_CRON_MILLISECONDS); /* give other process
time to start */
if (pid == 0)
{
Modified: GNUnet/src/transports/test_repeat.c
===================================================================
--- GNUnet/src/transports/test_repeat.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/transports/test_repeat.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -93,7 +93,7 @@
}
static int
-assertUnused (TSession * tsession)
+assertUnused (GNUNET_TSession * tsession)
{
return GNUNET_OK;
}
@@ -106,7 +106,7 @@
receive (P2P_PACKET * mp)
{
unsigned int retries;
- TSession *tsession;
+ GNUNET_TSession *tsession;
GNUNET_MessageHello *hello;
if (pid == 0)
@@ -174,7 +174,7 @@
char *trans;
int res;
int pos;
- TSession *tsession;
+ GNUNET_TSession *tsession;
GNUNET_MessageHello *hello;
int xround;
@@ -202,33 +202,33 @@
if (NULL != strstr (trans, "-"))
strstr (trans, ".")[0] = '\0';
/* disable blacklists (loopback is often blacklisted)... */
- GC_set_configuration_value_string (api.cfg, api.ectx, "TCP", "BLACKLIST",
+ GNUNET_GC_set_configuration_value_string (api.cfg, api.ectx, "TCP",
"BLACKLIST",
"");
- GC_set_configuration_value_string (api.cfg, api.ectx, "TCP", "UPNP", "NO");
- GC_set_configuration_value_string (api.cfg, api.ectx, "TCP6", "BLACKLIST",
+ GNUNET_GC_set_configuration_value_string (api.cfg, api.ectx, "TCP", "UPNP",
"NO");
+ GNUNET_GC_set_configuration_value_string (api.cfg, api.ectx, "TCP6",
"BLACKLIST",
"");
- GC_set_configuration_value_string (api.cfg, api.ectx, "UDP", "BLACKLIST",
+ GNUNET_GC_set_configuration_value_string (api.cfg, api.ectx, "UDP",
"BLACKLIST",
"");
- GC_set_configuration_value_string (api.cfg, api.ectx, "UDP", "UPNP", "NO");
- GC_set_configuration_value_string (api.cfg, api.ectx, "UDP6", "BLACKLIST",
+ GNUNET_GC_set_configuration_value_string (api.cfg, api.ectx, "UDP", "UPNP",
"NO");
+ GNUNET_GC_set_configuration_value_string (api.cfg, api.ectx, "UDP6",
"BLACKLIST",
"");
- GC_set_configuration_value_string (api.cfg, api.ectx, "HTTP", "BLACKLIST",
+ GNUNET_GC_set_configuration_value_string (api.cfg, api.ectx, "HTTP",
"BLACKLIST",
"");
- GC_set_configuration_value_string (api.cfg, api.ectx, "HTTP", "UPNP", "NO");
+ GNUNET_GC_set_configuration_value_string (api.cfg, api.ectx, "HTTP", "UPNP",
"NO");
if (pid == 0)
pos = OFFSET;
else
pos = 0;
- GC_set_configuration_value_number (api.cfg, api.ectx, "TCP", "PORT",
+ GNUNET_GC_set_configuration_value_number (api.cfg, api.ectx, "TCP", "PORT",
4444 + pos);
- GC_set_configuration_value_number (api.cfg, api.ectx, "TCP6", "PORT",
+ GNUNET_GC_set_configuration_value_number (api.cfg, api.ectx, "TCP6", "PORT",
4445 + pos);
- GC_set_configuration_value_number (api.cfg, api.ectx, "UDP", "PORT",
+ GNUNET_GC_set_configuration_value_number (api.cfg, api.ectx, "UDP", "PORT",
4446 + pos);
- GC_set_configuration_value_number (api.cfg, api.ectx, "UDP6", "PORT",
+ GNUNET_GC_set_configuration_value_number (api.cfg, api.ectx, "UDP6", "PORT",
4447 + pos);
- GC_set_configuration_value_number (api.cfg, api.ectx, "HTTP", "PORT",
+ GNUNET_GC_set_configuration_value_number (api.cfg, api.ectx, "HTTP", "PORT",
4448 + pos);
GNUNET_create_random_hash (&me.hashPubKey);
plugin = GNUNET_plugin_load (api.ectx, "libgnunettransport_", trans);
@@ -262,7 +262,7 @@
goto cleanup;
}
transport->startTransportServer ();
- GE_ASSERT (NULL, (transport->mtu >= expectedSize) || (transport->mtu == 0));
+ GNUNET_GE_ASSERT (NULL, (transport->mtu >= expectedSize) || (transport->mtu
== 0));
GNUNET_thread_sleep (50 * GNUNET_CRON_MILLISECONDS); /* give other process
time to start */
if (pid == 0)
{
Modified: GNUnet/src/transports/udp.c
===================================================================
--- GNUnet/src/transports/udp.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/transports/udp.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -34,7 +34,7 @@
#define DEBUG_UDP GNUNET_NO
-static UPnP_ServiceAPI *upnp;
+static GNUNET_UPnP_ServiceAPI *upnp;
#include "udp_helper.c"
@@ -60,7 +60,7 @@
} HostAddress;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static struct GNUNET_LoadMonitor *load_monitor;
@@ -82,7 +82,7 @@
struct servent *pse; /* pointer to service information entry
*/
unsigned long long port;
- if (-1 == GC_get_configuration_value_number (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_number (cfg,
"UDP",
"PORT", 1, 65535, 2086, &port))
{
@@ -107,27 +107,27 @@
sock = SOCKET (PF_INET, SOCK_DGRAM, 17);
if (sock < 0)
{
- GE_DIE_STRERROR (ectx, GE_FATAL | GE_ADMIN | GE_IMMEDIATE, "socket");
+ GNUNET_GE_DIE_STRERROR (ectx, GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE, "socket");
return -1;
}
if (SETSOCKOPT (sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) < 0)
{
- GE_DIE_STRERROR (ectx,
- GE_FATAL | GE_ADMIN | GE_IMMEDIATE, "setsockopt");
+ GNUNET_GE_DIE_STRERROR (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE, "setsockopt");
return -1;
}
- GE_ASSERT (NULL, port != 0);
+ GNUNET_GE_ASSERT (NULL, port != 0);
memset (&sin, 0, sizeof (sin));
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = htons (port);
if (BIND (sock, (struct sockaddr *) &sin, sizeof (sin)) < 0)
{
- GE_LOG_STRERROR (ectx, GE_FATAL | GE_ADMIN | GE_IMMEDIATE, "bind");
- GE_LOG (ectx,
- GE_FATAL | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE, "bind");
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_ADMIN | GNUNET_GE_IMMEDIATE,
_("Failed to bind to UDP port %d.\n"), port);
- GE_DIE_STRERROR (ectx, GE_FATAL | GE_USER | GE_IMMEDIATE, "bind");
+ GNUNET_GE_DIE_STRERROR (ectx, GNUNET_GE_FATAL | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE, "bind");
return -1;
}
/* do not bind if port == 0, then we use
@@ -201,8 +201,8 @@
(GNUNET_YES != isWhitelisted (addr, addr_len)))
{
#if DEBUG_UDP
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
"Rejecting traffic from %u.%u.%u.%u.\n",
GNUNET_PRIP (ntohl (*(int *) addr)));
#endif
@@ -229,9 +229,9 @@
haddr = (const HostAddress *) &hello[1];
if ((ntohs (hello->senderAddressSize) != sizeof (HostAddress)) ||
(ntohs (hello->header.size) != GNUNET_sizeof_hello (hello)) ||
- (ntohs (hello->header.type) != p2p_PROTO_hello))
+ (ntohs (hello->header.type) != GNUNET_P2P_PROTO_HELLO))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
if ((GNUNET_YES == isBlacklisted (&haddr->ip,
@@ -239,8 +239,8 @@
(GNUNET_YES != isWhitelisted (&haddr->ip, sizeof (GNUNET_IPv4Address))))
{
#if DEBUG_UDP
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
"Rejecting UDP HELLO from %u.%u.%u.%u:%u due to
configuration.\n",
GNUNET_PRIP (ntohl (*(int *) &haddr->ip.addr)),
ntohs (haddr->port));
@@ -248,8 +248,8 @@
return GNUNET_SYSERR; /* obviously invalid */
}
#if DEBUG_UDP
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
"Verified UDP HELLO from %u.%u.%u.%u:%u.\n",
GNUNET_PRIP (ntohl (*(int *) &haddr->ip.addr)),
ntohs (haddr->port));
@@ -287,8 +287,8 @@
(GNUNET_SYSERR != getPublicIPAddress (cfg, ectx, &haddr->ip))))
{
GNUNET_free (msg);
- GE_LOG (ectx,
- GE_WARNING | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
_("UDP: Could not determine my public IP address.\n"));
return NULL;
}
@@ -296,14 +296,14 @@
haddr->reserved = htons (0);
if (0 != memcmp (haddr, &last_addr, sizeof (HostAddress)))
{
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
"UDP uses IP address %u.%u.%u.%u.\n",
GNUNET_PRIP (ntohl (*(int *) &haddr->ip)));
last_addr = *haddr;
}
msg->senderAddressSize = htons (sizeof (HostAddress));
- msg->protocol = htons (UDP_PROTOCOL_NUMBER);
+ msg->protocol = htons (GNUNET_TRANSPORT_PROTOCOL_NUMBER_UDP);
msg->MTU = htonl (udpAPI.mtu);
return msg;
}
@@ -317,7 +317,7 @@
* @return GNUNET_SYSERR on error, GNUNET_OK on success
*/
static int
-udpSend (TSession * tsession,
+udpSend (GNUNET_TSession * tsession,
const void *message, const unsigned int size, int important)
{
UDPMessage *mp;
@@ -328,17 +328,17 @@
int ssize;
size_t sent;
- GE_ASSERT (NULL, tsession != NULL);
+ GNUNET_GE_ASSERT (NULL, tsession != NULL);
if (udp_sock == NULL)
return GNUNET_SYSERR;
if (size == 0)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
if (size > udpAPI.mtu)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
hello = (GNUNET_MessageHello *) tsession->internal;
@@ -357,11 +357,11 @@
sin.sin_family = AF_INET;
sin.sin_port = haddr->port;
- GE_ASSERT (ectx, sizeof (struct in_addr) == sizeof (GNUNET_IPv4Address));
+ GNUNET_GE_ASSERT (ectx, sizeof (struct in_addr) == sizeof
(GNUNET_IPv4Address));
memcpy (&sin.sin_addr, &haddr->ip, sizeof (GNUNET_IPv4Address));
#if DEBUG_UDP
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
"Sending message of %d bytes via UDP to %u.%u.%u.%u:%u.\n",
ssize, GNUNET_PRIP (ntohl (*(int *) &sin.sin_addr)),
ntohs (sin.sin_port));
@@ -384,8 +384,8 @@
}
else
{
- GE_LOG (ectx,
- GE_WARNING | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
_
("Failed to send message of size %d via UDP to %u.%u.%u.%u:%u:
%s\n"),
ssize, GNUNET_PRIP (ntohl (*(int *) &sin.sin_addr)),
@@ -408,7 +408,7 @@
int sock;
unsigned short port;
- GE_ASSERT (ectx, selector == NULL);
+ GNUNET_GE_ASSERT (ectx, selector == NULL);
/* initialize UDP network */
port = getGNUnetUDPPort ();
if (port != 0)
@@ -434,13 +434,13 @@
#endif
if (sock == -1)
{
- GE_LOG_STRERROR (ectx, GE_ERROR | GE_ADMIN | GE_BULK, "socket");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "socket");
GNUNET_select_destroy (selector);
selector = NULL;
return GNUNET_SYSERR;
}
udp_sock = socket_create (ectx, load_monitor, sock);
- GE_ASSERT (ectx, udp_sock != NULL);
+ GNUNET_GE_ASSERT (ectx, udp_sock != NULL);
return GNUNET_OK;
}
@@ -456,11 +456,11 @@
GNUNET_free_non_null (filteredNetworks_);
GNUNET_free_non_null (allowedNetworks_);
ch = NULL;
- GC_get_configuration_value_string (cfg, "UDP", "BLACKLIST", "", &ch);
+ GNUNET_GC_get_configuration_value_string (cfg, "UDP", "BLACKLIST", "", &ch);
filteredNetworks_ = GNUNET_parse_ipv4_network_specification (ectx, ch);
GNUNET_free (ch);
ch = NULL;
- GC_get_configuration_value_string (cfg, "UDP", "WHITELIST", "", &ch);
+ GNUNET_GC_get_configuration_value_string (cfg, "UDP", "WHITELIST", "", &ch);
if (strlen (ch) > 0)
allowedNetworks_ = GNUNET_parse_ipv4_network_specification (ectx, ch);
else
@@ -494,7 +494,7 @@
* The default maximum size of each outbound UDP message,
* optimal value for Ethernet (10 or 100 MBit).
*/
-#define MESSAGE_SIZE 1472
+#define MESSAGNUNET_GE_SIZE 1472
/**
* The exported method. Makes the core api available via a global and
@@ -508,32 +508,32 @@
ectx = core->ectx;
cfg = core->cfg;
load_monitor = core->load_monitor;
- GE_ASSERT (ectx, sizeof (HostAddress) == 8);
- GE_ASSERT (ectx, sizeof (UDPMessage) == 68);
+ GNUNET_GE_ASSERT (ectx, sizeof (HostAddress) == 8);
+ GNUNET_GE_ASSERT (ectx, sizeof (UDPMessage) == 68);
coreAPI = core;
- if (-1 == GC_get_configuration_value_number (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_number (cfg,
"UDP",
"MTU",
sizeof (UDPMessage)
- + P2P_MESSAGE_OVERHEAD
+ +
GNUNET_P2P_MESSAGNUNET_GE_OVERHEAD
+
sizeof (GNUNET_MessageHeader) +
- 32, 65500, MESSAGE_SIZE, &mtu))
+ 32, 65500, MESSAGNUNET_GE_SIZE,
&mtu))
{
return NULL;
}
if (mtu < 1200)
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
_("MTU %llu for `%s' is probably too low!\n"), mtu, "UDP");
- if (GC_get_configuration_value_yesno (cfg, "UDP", "UPNP", GNUNET_YES) ==
+ if (GNUNET_GC_get_configuration_value_yesno (cfg, "UDP", "UPNP", GNUNET_YES)
==
GNUNET_YES)
{
upnp = coreAPI->requestService ("upnp");
if (upnp == NULL)
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
"The UPnP service could not be loaded. To disable UPnP, set
the "
"configuration option \"UPNP\" in section \"UDP\" to
\"NO\"\n");
}
@@ -550,7 +550,7 @@
}
configLock = GNUNET_mutex_create (GNUNET_NO);
reloadConfiguration ();
- udpAPI.protocolNumber = UDP_PROTOCOL_NUMBER;
+ udpAPI.protocolNumber = GNUNET_TRANSPORT_PROTOCOL_NUMBER_UDP;
udpAPI.mtu = mtu - sizeof (UDPMessage);
udpAPI.cost = 20000;
udpAPI.verifyHello = &verifyHello;
Modified: GNUnet/src/transports/udp6.c
===================================================================
--- GNUnet/src/transports/udp6.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/transports/udp6.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -60,7 +60,7 @@
/* *********** globals ************* */
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static struct GNUNET_LoadMonitor *load_monitor;
@@ -82,7 +82,7 @@
struct servent *pse; /* pointer to service information entry
*/
unsigned long long port;
- if (-1 == GC_get_configuration_value_number (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_number (cfg,
"UDP6",
"PORT", 1, 65535, 2086, &port))
{
@@ -106,9 +106,9 @@
sock = SOCKET (PF_INET6, SOCK_DGRAM, 17);
if (sock < 0)
- GE_DIE_STRERROR (ectx, GE_FATAL | GE_ADMIN | GE_IMMEDIATE, "socket");
+ GNUNET_GE_DIE_STRERROR (ectx, GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE, "socket");
if (SETSOCKOPT (sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) < 0)
- GE_DIE_STRERROR (ectx, GE_FATAL | GE_ADMIN | GE_IMMEDIATE, "setsockopt");
+ GNUNET_GE_DIE_STRERROR (ectx, GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE, "setsockopt");
if (port != 0)
{
memset (&sin, 0, sizeof (sin));
@@ -117,11 +117,11 @@
memcpy (&sin.sin6_addr, &in6addr_any, sizeof (GNUNET_IPv6Address));
if (BIND (sock, (struct sockaddr *) &sin, sizeof (sin)) < 0)
{
- GE_LOG_STRERROR (ectx, GE_FATAL | GE_ADMIN | GE_IMMEDIATE, "bind");
- GE_LOG (ectx,
- GE_FATAL | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE, "bind");
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_ADMIN | GNUNET_GE_IMMEDIATE,
_("Failed to bind to UDP port %d.\n"), port);
- GE_DIE_STRERROR (ectx, GE_FATAL | GE_USER | GE_IMMEDIATE, "bind");
+ GNUNET_GE_DIE_STRERROR (ectx, GNUNET_GE_FATAL | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE, "bind");
}
} /* do not bind if port == 0, then we use
send-only! */
return sock;
@@ -218,7 +218,7 @@
haddr = (Host6Address *) & hello[1];
if ((ntohs (hello->senderAddressSize) != sizeof (Host6Address)) ||
(ntohs (hello->header.size) != GNUNET_sizeof_hello (hello)) ||
- (ntohs (hello->header.type) != p2p_PROTO_hello) ||
+ (ntohs (hello->header.type) != GNUNET_P2P_PROTO_HELLO) ||
(GNUNET_YES == isBlacklisted (&haddr->ip,
sizeof (GNUNET_IPv6Address))) ||
(GNUNET_YES != isWhitelisted (&haddr->ip, sizeof (GNUNET_IPv6Address))))
@@ -227,7 +227,7 @@
{
#if DEBUG_UDP6
char inet6[INET6_ADDRSTRLEN];
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
"Verified UDP6 hello from %u.%u.%u.%u:%u.\n",
inet_ntop (AF_INET6,
&haddr->ip,
@@ -261,15 +261,15 @@
if (GNUNET_SYSERR == getPublicIP6Address (cfg, ectx, &haddr->ip))
{
GNUNET_free (msg);
- GE_LOG (ectx,
- GE_WARNING,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING,
_("UDP6: Could not determine my public IPv6 address.\n"));
return NULL;
}
haddr->port = htons (port);
haddr->reserved = htons (0);
msg->senderAddressSize = htons (sizeof (Host6Address));
- msg->protocol = htons (UDP6_PROTOCOL_NUMBER);
+ msg->protocol = htons (GNUNET_TRANSPORT_PROTOCOL_NUMBER_UDP6);
msg->MTU = htonl (udpAPI.mtu);
return msg;
}
@@ -283,7 +283,7 @@
* @return GNUNET_SYSERR on error, GNUNET_OK on success
*/
static int
-udp6Send (TSession * tsession,
+udp6Send (GNUNET_TSession * tsession,
const void *message, const unsigned int size, int importance)
{
UDPMessage *mp;
@@ -300,12 +300,12 @@
return GNUNET_SYSERR;
if (size == 0)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
if (size > udpAPI.mtu)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
hello = (GNUNET_MessageHello *) tsession->internal;
@@ -325,8 +325,8 @@
sin.sin6_port = haddr->port;
memcpy (&sin.sin6_addr, &haddr->ip.addr, sizeof (GNUNET_IPv6Address));
#if DEBUG_UDP6
- GE_LOG (ectx,
- GE_DEBUG,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG,
"Sending message of %u bytes via UDP6 to %s:%d..\n",
ssize,
inet_ntop (AF_INET6,
@@ -345,7 +345,7 @@
}
else
{
- GE_LOG_STRERROR (ectx, GE_WARNING, "sendto");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_WARNING, "sendto");
if (stats != NULL)
stats->change (stat_bytesDropped, ssize);
}
@@ -385,7 +385,7 @@
sock = SOCKET (PF_INET, SOCK_DGRAM, 17);
if (sock == -1)
{
- GE_LOG_STRERROR (ectx, GE_ERROR | GE_ADMIN | GE_BULK, "socket");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "socket");
GNUNET_select_destroy (selector);
selector = NULL;
return GNUNET_SYSERR;
@@ -404,10 +404,10 @@
GNUNET_mutex_lock (configLock);
GNUNET_free_non_null (filteredNetworks_);
- GC_get_configuration_value_string (cfg, "UDP6", "BLACKLIST", "", &ch);
+ GNUNET_GC_get_configuration_value_string (cfg, "UDP6", "BLACKLIST", "", &ch);
filteredNetworks_ = GNUNET_parse_ipv6_network_specification (ectx, ch);
GNUNET_free (ch);
- GC_get_configuration_value_string (cfg, "UDP6", "WHITELIST", "", &ch);
+ GNUNET_GC_get_configuration_value_string (cfg, "UDP6", "WHITELIST", "", &ch);
if (strlen (ch) > 0)
allowedNetworks_ = GNUNET_parse_ipv6_network_specification (ectx, ch);
else
@@ -441,7 +441,7 @@
* The default maximum size of each outbound UDP6 message,
* optimal value for Ethernet (10 or 100 MBit).
*/
-#define MESSAGE_SIZE 1452
+#define MESSAGNUNET_GE_SIZE 1452
/**
* The exported method. Makes the core api available via a global and
@@ -452,26 +452,26 @@
{
unsigned long long mtu;
- GE_ASSERT (ectx, sizeof (UDPMessage) == 68);
+ GNUNET_GE_ASSERT (ectx, sizeof (UDPMessage) == 68);
coreAPI = core;
ectx = core->ectx;
cfg = core->cfg;
configLock = GNUNET_mutex_create (GNUNET_NO);
reloadConfiguration ();
- if (-1 == GC_get_configuration_value_number (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_number (cfg,
"UDP6",
"MTU",
sizeof (UDPMessage) +
- P2P_MESSAGE_OVERHEAD +
+
GNUNET_P2P_MESSAGNUNET_GE_OVERHEAD +
sizeof (GNUNET_MessageHeader) +
- 32, 65500, MESSAGE_SIZE, &mtu))
+ 32, 65500, MESSAGNUNET_GE_SIZE,
&mtu))
{
return NULL;
}
if (mtu < 1200)
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
_("MTU %llu for `%s' is probably too low!\n"), mtu, "UDP6");
stats = coreAPI->requestService ("stats");
if (stats != NULL)
@@ -484,7 +484,7 @@
stat_udpConnected
= stats->create (gettext_noop ("# UDP6 connections (right now)"));
}
- udpAPI.protocolNumber = UDP6_PROTOCOL_NUMBER;
+ udpAPI.protocolNumber = GNUNET_TRANSPORT_PROTOCOL_NUMBER_UDP6;
udpAPI.mtu = mtu - sizeof (UDPMessage);
udpAPI.cost = 19950;
udpAPI.verifyHello = &verifyHello;
Modified: GNUnet/src/transports/udp_helper.c
===================================================================
--- GNUnet/src/transports/udp_helper.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/transports/udp_helper.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -49,7 +49,7 @@
static TransportAPI udpAPI;
-static Stats_ServiceAPI *stats;
+static GNUNET_Stats_ServiceAPI *stats;
static int stat_bytesReceived;
@@ -59,7 +59,7 @@
static int stat_udpConnected;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
/**
* thread that listens for inbound messages
@@ -90,15 +90,15 @@
len = ntohs (msg->size);
if (len <= sizeof (UDPMessage))
{
- GE_LOG (ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
_
("Received malformed message from udp-peer connection.
Closing.\n"));
return GNUNET_SYSERR;
}
#if DEBUG_UDP
- GE_LOG (ectx,
- GE_DEBUG | GE_USER | GE_BULK, "Received %d bytes via UDP\n", len);
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK, "Received %d
bytes via UDP\n", len);
#endif
um = (const UDPMessage *) msg;
mp = GNUNET_malloc (sizeof (P2P_PACKET));
@@ -146,13 +146,13 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
*/
static int
-udpConnect (const GNUNET_MessageHello * hello, TSession ** tsessionPtr,
+udpConnect (const GNUNET_MessageHello * hello, GNUNET_TSession ** tsessionPtr,
int may_reuse)
{
- TSession *tsession;
+ GNUNET_TSession *tsession;
- tsession = GNUNET_malloc (sizeof (TSession));
- memset (tsession, 0, sizeof (TSession));
+ tsession = GNUNET_malloc (sizeof (GNUNET_TSession));
+ memset (tsession, 0, sizeof (GNUNET_TSession));
tsession->internal = GNUNET_malloc (GNUNET_sizeof_hello (hello));
memcpy (tsession->internal, hello, GNUNET_sizeof_hello (hello));
tsession->ttype = udpAPI.protocolNumber;
@@ -175,7 +175,7 @@
* GNUNET_SYSERR if not.
*/
int
-udpAssociate (TSession * tsession)
+udpAssociate (GNUNET_TSession * tsession)
{
return GNUNET_SYSERR; /* UDP connections can never be associated */
}
@@ -187,7 +187,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
*/
static int
-udpDisconnect (TSession * tsession)
+udpDisconnect (GNUNET_TSession * tsession)
{
if (tsession != NULL)
{
@@ -207,7 +207,7 @@
static int
stopTransportServer ()
{
- GE_ASSERT (ectx, udp_sock != NULL);
+ GNUNET_GE_ASSERT (ectx, udp_sock != NULL);
if (selector != NULL)
{
GNUNET_select_destroy (selector);
@@ -232,7 +232,7 @@
* GNUNET_SYSERR if the size/session is invalid
*/
static int
-testWouldTry (TSession * tsession, unsigned int size, int important)
+testWouldTry (GNUNET_TSession * tsession, unsigned int size, int important)
{
const GNUNET_MessageHello *hello;
@@ -240,12 +240,12 @@
return GNUNET_SYSERR;
if (size == 0)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
if (size > udpAPI.mtu)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
hello = (const GNUNET_MessageHello *) tsession->internal;
Modified: GNUnet/src/transports/upnp/error.c
===================================================================
--- GNUnet/src/transports/upnp/error.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/transports/upnp/error.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -7,8 +7,8 @@
void
gaim_debug_error (char *facility, char *format, ...)
{
- GE_LOG (NULL,
- GE_WARNING | GE_DEVELOPER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_WARNING | GNUNET_GE_DEVELOPER | GNUNET_GE_ADMIN |
GNUNET_GE_BULK,
"%s: %s\n", facility, format);
}
@@ -18,5 +18,5 @@
void
gaim_debug_info (char *facility, char *format, ...)
{
- GE_LOG (NULL, GE_INFO | GE_ADMIN | GE_BULK, "%s: %s\n", facility, format);
+ GNUNET_GE_LOG (NULL, GNUNET_GE_INFO | GNUNET_GE_ADMIN | GNUNET_GE_BULK, "%s:
%s\n", facility, format);
}
Modified: GNUnet/src/transports/upnp/init.c
===================================================================
--- GNUnet/src/transports/upnp/init.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/transports/upnp/init.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -31,9 +31,9 @@
#include "gnunet_upnp_service.h"
#include "gnunet_core.h"
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static struct GNUNET_CronManager *cron;
@@ -151,10 +151,10 @@
/**
* Get the external IP address for the local machine.
*/
-UPnP_ServiceAPI *
-provide_module_upnp (CoreAPIForApplication * capi)
+GNUNET_UPnP_ServiceAPI *
+provide_module_upnp (GNUNET_CoreAPIForPlugins * capi)
{
- static UPnP_ServiceAPI api;
+ static GNUNET_UPnP_ServiceAPI api;
ectx = capi->ectx;
cfg = capi->cfg;
Modified: GNUnet/src/transports/upnp/ip.c
===================================================================
--- GNUnet/src/transports/upnp/ip.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/transports/upnp/ip.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -35,8 +35,8 @@
* @return NULL on error
*/
char *
-gaim_upnp_get_internal_ip (struct GC_Configuration *cfg,
- struct GE_Context *ectx)
+gaim_upnp_get_internal_ip (struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx)
{
GNUNET_IPv4Address address;
Modified: GNUnet/src/transports/upnp/ip.h
===================================================================
--- GNUnet/src/transports/upnp/ip.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/transports/upnp/ip.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -33,8 +33,8 @@
* Get the IP address for the local machine.
* @return NULL on error
*/
-char *gaim_upnp_get_internal_ip (struct GC_Configuration *cfg,
- struct GE_Context *ectx);
+char *gaim_upnp_get_internal_ip (struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx);
#endif
Modified: GNUnet/src/transports/upnp/upnp.c
===================================================================
--- GNUnet/src/transports/upnp/upnp.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/transports/upnp/upnp.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -353,7 +353,7 @@
return controlURL;
}
-#define CURL_EASY_SETOPT(c, a, b) do { ret = curl_easy_setopt(c, a, b); if
(ret != CURLE_OK) GE_LOG(NULL, GE_WARNING | GE_USER | GE_BULK, _("%s failed at
%s:%d: `%s'\n"), "curl_easy_setopt", __FILE__, __LINE__,
curl_easy_strerror(ret)); } while (0);
+#define CURL_EASY_SETOPT(c, a, b) do { ret = curl_easy_setopt(c, a, b); if
(ret != CURLE_OK) GNUNET_GE_LOG(NULL, GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK, _("%s failed at %s:%d: `%s'\n"), "curl_easy_setopt", __FILE__,
__LINE__, curl_easy_strerror(ret)); } while (0);
/**
* Do the generic curl setup.
@@ -389,7 +389,7 @@
char *soapMessage;
struct curl_slist *headers = NULL;
- GE_ASSERT (NULL, cb != NULL);
+ GNUNET_GE_ASSERT (NULL, cb != NULL);
if (0 != curl_global_init (CURL_GLOBAL_WIN32))
return GNUNET_SYSERR;
/* set the soap message */
@@ -424,8 +424,8 @@
ret = curl_easy_perform (curl);
#if 0
if (ret != CURLE_OK)
- GE_LOG (NULL,
- GE_ERROR | GE_ADMIN | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK,
_("%s failed for url `%s' and post-data `%s' at %s:%d: `%s'\n"),
"curl_easy_perform",
control_info.control_url,
@@ -470,8 +470,8 @@
if (temp2 - temp >= sizeof (control_info.publicip))
temp2 = temp + sizeof (control_info.publicip) - 1;
memcpy (control_info.publicip, temp + 1, temp2 - (temp + 1));
- GE_LOG (NULL,
- GE_INFO | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_BULK,
_("upnp: NAT Returned IP: %s\n"), control_info.publicip);
return len;
}
@@ -535,8 +535,8 @@
CURL_EASY_SETOPT (curl, CURLOPT_NOSIGNAL, 1);
ret = curl_easy_perform (curl);
if (ret != CURLE_OK)
- GE_LOG (NULL,
- GE_ERROR | GE_ADMIN | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK,
_("%s failed at %s:%d: `%s'\n"),
"curl_easy_perform",
__FILE__, __LINE__, curl_easy_strerror (ret));
@@ -548,8 +548,8 @@
}
int
-gaim_upnp_discover (struct GE_Context *ectx,
- struct GC_Configuration *cfg, int sock)
+gaim_upnp_discover (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg, int sock)
{
char *proxy;
struct hostent *hp;
@@ -649,7 +649,7 @@
dd.full_url = GNUNET_strdup (startDescURL);
dd.full_url[endDescURL - startDescURL] = '\0';
proxy = NULL;
- GC_get_configuration_value_string (cfg,
+ GNUNET_GC_get_configuration_value_string (cfg,
"GNUNETD", "HTTP-PROXY", "", &proxy);
ret = gaim_upnp_parse_description (proxy, &dd);
GNUNET_free (dd.full_url);
@@ -677,8 +677,8 @@
}
int
-gaim_upnp_change_port_mapping (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+gaim_upnp_change_port_mapping (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
int do_add,
unsigned short portmap, const char *protocol)
{
@@ -712,7 +712,7 @@
portmap, protocol);
}
proxy = NULL;
- GC_get_configuration_value_string (cfg,
+ GNUNET_GC_get_configuration_value_string (cfg,
"GNUNETD", "HTTP-PROXY", "", &proxy);
ret = gaim_upnp_generate_action_message_and_send (proxy,
action_name,
Modified: GNUnet/src/transports/upnp/upnp.h
===================================================================
--- GNUnet/src/transports/upnp/upnp.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/transports/upnp/upnp.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -45,8 +45,8 @@
* public IP address of the IGD, and control it for forwarding ports.
* The result will be cached for further use.
*/
-int gaim_upnp_discover (struct GE_Context *ectx,
- struct GC_Configuration *cfg, int sock);
+int gaim_upnp_discover (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg, int sock);
/**
* Gets the IP address from a UPnP enabled IGD that sits on the local
@@ -70,8 +70,8 @@
* addition is complete
* @param cb_data Extra data to be passed to the callback
*/
-int gaim_upnp_change_port_mapping (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+int gaim_upnp_change_port_mapping (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
int do_add,
unsigned short portmap,
const char *protocol);
Modified: GNUnet/src/transports/upnp/upnptest.c
===================================================================
--- GNUnet/src/transports/upnp/upnptest.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/transports/upnp/upnptest.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -35,47 +35,47 @@
int
main (int argc, const char *argv[])
{
- static CoreAPIForApplication capi;
- struct GE_Context *ectx;
- struct GC_Configuration *cfg;
+ static GNUNET_CoreAPIForPlugins capi;
+ struct GNUNET_GE_Context *ectx;
+ struct GNUNET_GC_Configuration *cfg;
GNUNET_IPv4Address addr;
int i;
- UPnP_ServiceAPI *upnp;
+ GNUNET_UPnP_ServiceAPI *upnp;
struct GNUNET_PluginHandle *plug;
- ServiceInitMethod init;
- ServiceDoneMethod done;
+ GNUNET_ServicePluginInitializationMethod init;
+ GNUNET_ServicePluginShutdownMethod done;
- ectx = GE_create_context_stderr (GNUNET_NO,
- GE_WARNING | GE_ERROR | GE_FATAL |
- GE_USER | GE_ADMIN | GE_DEVELOPER |
- GE_IMMEDIATE | GE_BULK);
- GE_setDefaultContext (ectx);
- cfg = GC_create ();
- GE_ASSERT (ectx, cfg != NULL);
+ ectx = GNUNET_GE_create_context_stderr (GNUNET_NO,
+ GNUNET_GE_WARNING | GNUNET_GE_ERROR |
GNUNET_GE_FATAL |
+ GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_DEVELOPER |
+ GNUNET_GE_IMMEDIATE | GNUNET_GE_BULK);
+ GNUNET_GE_setDefaultContext (ectx);
+ cfg = GNUNET_GC_create ();
+ GNUNET_GE_ASSERT (ectx, cfg != NULL);
GNUNET_os_init (ectx);
capi.ectx = ectx;
capi.cfg = cfg;
plug = GNUNET_plugin_load (ectx, "libgnunet", "module_upnp");
if (plug == NULL)
{
- GC_free (cfg);
- GE_free_context (ectx);
+ GNUNET_GC_free (cfg);
+ GNUNET_GE_free_context (ectx);
return 1;
}
init = GNUNET_plugin_resolve_function (plug, "provide_", GNUNET_YES);
if (init == NULL)
{
GNUNET_plugin_unload (plug);
- GC_free (cfg);
- GE_free_context (ectx);
+ GNUNET_GC_free (cfg);
+ GNUNET_GE_free_context (ectx);
return 1;
}
upnp = init (&capi);
if (upnp == NULL)
{
GNUNET_plugin_unload (plug);
- GC_free (cfg);
- GE_free_context (ectx);
+ GNUNET_GC_free (cfg);
+ GNUNET_GE_free_context (ectx);
return 1;
}
for (i = 0; i < 10; i++)
@@ -100,8 +100,8 @@
if (done != NULL)
done ();
GNUNET_plugin_unload (plug);
- GC_free (cfg);
- GE_free_context (ectx);
+ GNUNET_GC_free (cfg);
+ GNUNET_GE_free_context (ectx);
return 0;
}
Modified: GNUnet/src/util/boot/startup.c
===================================================================
--- GNUnet/src/util/boot/startup.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/boot/startup.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -30,24 +30,24 @@
#include "gnunet_util_error_loggers.h"
#include "platform.h"
-static GE_KIND
+static GNUNET_GE_KIND
convertLogLevel (const char *level)
{
- GE_KIND ret;
+ GNUNET_GE_KIND ret;
ret = 0;
if (ret || (0 == strcasecmp ("debug", level)))
- ret |= GE_DEBUG;
+ ret |= GNUNET_GE_DEBUG;
if (ret || (0 == strcasecmp ("status", level)))
- ret |= GE_STATUS;
+ ret |= GNUNET_GE_STATUS;
if (ret || (0 == strcasecmp ("info", level)))
- ret |= GE_INFO;
+ ret |= GNUNET_GE_INFO;
if (ret || (0 == strcasecmp ("warning", level)))
- ret |= GE_WARNING;
+ ret |= GNUNET_GE_WARNING;
if (ret || (0 == strcasecmp ("error", level)))
- ret |= GE_ERROR;
+ ret |= GNUNET_GE_ERROR;
if (ret || (0 == strcasecmp ("fatal", level)))
- ret = ret | GE_FATAL;
+ ret = ret | GNUNET_GE_FATAL;
return ret;
}
@@ -58,15 +58,15 @@
* @return 0 on success, 1 on error
*/
static int
-configure_logging (struct GE_Context **ectx, struct GC_Configuration *cfg)
+configure_logging (struct GNUNET_GE_Context **ectx, struct
GNUNET_GC_Configuration *cfg)
{
char *admin_log_file;
char *admin_log_level;
char *user_log_level;
- GE_KIND all;
- GE_KIND ull;
- struct GE_Context *nctx;
- struct GE_Context *tetx;
+ GNUNET_GE_KIND all;
+ GNUNET_GE_KIND ull;
+ struct GNUNET_GE_Context *nctx;
+ struct GNUNET_GE_Context *tetx;
unsigned long long logrotate;
int dev;
char * user;
@@ -79,25 +79,25 @@
admin_log_level = NULL;
user_log_level = NULL;
user = NULL;
- GC_get_configuration_value_string (cfg, "GNUNETD", "USER", "", &user);
+ GNUNET_GC_get_configuration_value_string (cfg, "GNUNETD", "USER", "", &user);
if (strlen(user) == 0) {
GNUNET_free(user);
user = NULL;
}
logrotate = 7;
- if (-1 == GC_get_configuration_value_number (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_number (cfg,
"GNUNETD",
"KEEPLOG",
0, 36500, 3, &logrotate))
return 1; /* error! */
- GC_get_configuration_value_filename (cfg,
+ GNUNET_GC_get_configuration_value_filename (cfg,
"GNUNETD",
"LOGFILE",
- VAR_DAEMON_DIRECTORY "/logs",
+ GNUNET_DEFAULT_DAEMON_VAR_DIRECTORY
"/logs",
&admin_log_file);
if (user != NULL) {
rdir = GNUNET_expand_file_name (NULL, admin_log_file);
- GE_ASSERT(NULL, rdir != NULL);
+ GNUNET_GE_ASSERT(NULL, rdir != NULL);
len = strlen (rdir);
pos = 1;
while (pos < len) {
@@ -108,8 +108,8 @@
rdir,
user);
} else if (errno != EEXIST) {
- GE_LOG_STRERROR_FILE (NULL,
- GE_ERROR | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (NULL,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_BULK,
"mkdir", rdir);
}
rdir[pos] = DIR_SEPARATOR;
@@ -118,50 +118,50 @@
}
GNUNET_free(rdir);
}
- GC_get_configuration_value_string (cfg,
+ GNUNET_GC_get_configuration_value_string (cfg,
"LOGGING",
"ADMIN-LEVEL",
"WARNING", &admin_log_level);
- GC_get_configuration_value_string (cfg,
+ GNUNET_GC_get_configuration_value_string (cfg,
"LOGGING",
"USER-LEVEL",
"WARNING", &user_log_level);
dev =
- GC_get_configuration_value_yesno (cfg, "LOGGING", "DEVELOPER", GNUNET_NO);
+ GNUNET_GC_get_configuration_value_yesno (cfg, "LOGGING", "DEVELOPER",
GNUNET_NO);
all = convertLogLevel (admin_log_level);
ull = convertLogLevel (user_log_level);
if (dev == GNUNET_YES)
{
- all |= GE_DEVELOPER | GE_REQUEST;
- ull |= GE_DEVELOPER | GE_REQUEST;
+ all |= GNUNET_GE_DEVELOPER | GNUNET_GE_REQUEST;
+ ull |= GNUNET_GE_DEVELOPER | GNUNET_GE_REQUEST;
}
GNUNET_free (admin_log_level);
GNUNET_free (user_log_level);
if (all != 0)
{
- nctx = GE_create_context_logfile (NULL,
+ nctx = GNUNET_GE_create_context_logfile (NULL,
all
- | GE_ADMIN
- | GE_BULK
- | GE_IMMEDIATE,
+ | GNUNET_GE_ADMIN
+ | GNUNET_GE_BULK
+ | GNUNET_GE_IMMEDIATE,
admin_log_file,
user, GNUNET_YES, (int) logrotate);
}
GNUNET_free (admin_log_file);
if (ull != 0)
{
- tetx = GE_create_context_stderr (GNUNET_YES,
+ tetx = GNUNET_GE_create_context_stderr (GNUNET_YES,
ull
- | GE_USERKIND
- | GE_BULK | GE_IMMEDIATE);
+ | GNUNET_GE_USERKIND
+ | GNUNET_GE_BULK | GNUNET_GE_IMMEDIATE);
if (nctx == NULL)
nctx = tetx;
else
- nctx = GE_create_context_multiplexer (nctx, tetx);
+ nctx = GNUNET_GE_create_context_multiplexer (nctx, tetx);
}
GNUNET_free_non_null(user);
- GE_setDefaultContext (nctx);
- GE_free_context (*ectx);
+ GNUNET_GE_setDefaultContext (nctx);
+ GNUNET_GE_free_context (*ectx);
*ectx = nctx;
return 0;
}
@@ -181,7 +181,7 @@
const char *binaryName,
char **cfgFileName,
const struct GNUNET_CommandLineOption *options,
- struct GE_Context **ectx, struct GC_Configuration **cfg)
+ struct GNUNET_GE_Context **ectx, struct GNUNET_GC_Configuration
**cfg)
{
int i;
char *path;
@@ -197,18 +197,18 @@
GNUNET_free (path);
textdomain ("GNUnet");
#endif
- is_daemon = 0 == strcmp (DEFAULT_DAEMON_CONFIG_FILE, *cfgFileName);
+ is_daemon = 0 == strcmp (GNUNET_DEFAULT_DAEMON_CONFIG_FILE, *cfgFileName);
/* during startup, log all warnings and higher
for anybody to stderr */
- *ectx = GE_create_context_stderr (GNUNET_YES,
- GE_WARNING | GE_ERROR | GE_FATAL |
- GE_USER | GE_ADMIN | GE_DEVELOPER |
- GE_IMMEDIATE | GE_BULK);
- GE_setDefaultContext (*ectx);
+ *ectx = GNUNET_GE_create_context_stderr (GNUNET_YES,
+ GNUNET_GE_WARNING | GNUNET_GE_ERROR |
GNUNET_GE_FATAL |
+ GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_DEVELOPER |
+ GNUNET_GE_IMMEDIATE | GNUNET_GE_BULK);
+ GNUNET_GE_setDefaultContext (*ectx);
GNUNET_os_init (*ectx);
- *cfg = GC_create ();
- GE_ASSERT (*ectx, *cfg != NULL);
+ *cfg = GNUNET_GC_create ();
+ GNUNET_GE_ASSERT (*ectx, *cfg != NULL);
i = GNUNET_parse_options (binaryName,
*ectx, *cfg, options, (unsigned int) argc, argv);
if (i == -1)
@@ -230,22 +230,22 @@
GNUNET_free (bindir);
ret = system (run);
if (0 != ret)
- GE_LOG (*ectx,
- GE_ERROR | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (*ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
_("Failed to run %s: %s %d\n"),
run, strerror (errno), WEXITSTATUS (ret));
GNUNET_free (run);
}
- if (0 != GC_parse_configuration (*cfg, *cfgFileName))
+ if (0 != GNUNET_GC_parse_configuration (*cfg, *cfgFileName))
return -1;
/* if PATHS/GNUNETD_HOME is not set, set it to
the default value! */
- GC_get_configuration_value_string (*cfg,
+ GNUNET_GC_get_configuration_value_string (*cfg,
"PATHS",
"GNUNETD_HOME",
"/var/lib/gnunet", &path);
GNUNET_free (path);
- GC_get_configuration_value_string (*cfg,
+ GNUNET_GC_get_configuration_value_string (*cfg,
"PATHS",
"GNUNET_HOME", "~/.gnunet", &path);
GNUNET_free (path);
@@ -258,11 +258,11 @@
* Free resources allocated during GNUnet_init.
*/
void
-GNUNET_fini (struct GE_Context *ectx, struct GC_Configuration *cfg)
+GNUNET_fini (struct GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration
*cfg)
{
- GC_free (cfg);
- GE_setDefaultContext (NULL);
- GE_free_context (ectx);
+ GNUNET_GC_free (cfg);
+ GNUNET_GE_setDefaultContext (NULL);
+ GNUNET_GE_free_context (ectx);
}
/* end of startup.c */
Modified: GNUnet/src/util/config/config.c
===================================================================
--- GNUnet/src/util/config/config.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/config/config.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -31,7 +31,7 @@
/**
* @brief configuration entry
*/
-typedef struct GC_Entry
+typedef struct GNUNET_GC_Entry
{
/**
@@ -48,12 +48,12 @@
* non-null during uncommited update
*/
char *dirty_val;
-} GC_Entry;
+} GNUNET_GC_Entry;
/**
* @brief configuration section
*/
-typedef struct GC_Section
+typedef struct GNUNET_GC_Section
{
/**
@@ -69,30 +69,30 @@
/**
* entries in the section
*/
- GC_Entry *entries;
-} GC_Section;
+ GNUNET_GC_Entry *entries;
+} GNUNET_GC_Section;
/**
- * @brief GC_ChangeListener and context
+ * @brief GNUNET_GC_ChangeListener and context
*/
-typedef struct GC_Listener
+typedef struct GNUNET_GC_Listener
{
/**
* Callback.
*/
- GC_ChangeListener listener;
+ GNUNET_GC_ChangeListener listener;
/**
* Context for callback.
*/
void *ctx;
-} GC_Listener;
+} GNUNET_GC_Listener;
/**
* @brief configuration data
*/
-typedef struct GC_Configuration
+typedef struct GNUNET_GC_Configuration
{
/**
@@ -103,7 +103,7 @@
/**
* Context for logging errors, maybe NULL.
*/
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
/**
* Modification indication since last save
@@ -119,7 +119,7 @@
/**
* Array with "ssize" entries.
*/
- GC_Section *sections;
+ GNUNET_GC_Section *sections;
/**
* How many listeners do we have?
@@ -129,15 +129,15 @@
/**
* Array with "lsize" entries.
*/
- GC_Listener *listeners;
+ GNUNET_GC_Listener *listeners;
-} GC_Configuration;
+} GNUNET_GC_Configuration;
void
-GC_free (struct GC_Configuration *cfg)
+GNUNET_GC_free (struct GNUNET_GC_Configuration *cfg)
{
- GC_Section *sec;
- GC_Entry *e;
+ GNUNET_GC_Section *sec;
+ GNUNET_GC_Entry *e;
int i;
int j;
@@ -149,25 +149,25 @@
e = &sec->entries[j];
GNUNET_free (e->key);
GNUNET_free_non_null (e->val);
- GE_ASSERT (cfg->ectx, e->dirty_val == NULL);
+ GNUNET_GE_ASSERT (cfg->ectx, e->dirty_val == NULL);
}
GNUNET_array_grow (sec->entries, sec->size, 0);
GNUNET_free (sec->name);
}
GNUNET_array_grow (cfg->sections, cfg->ssize, 0);
- GE_ASSERT (cfg->ectx, cfg->listeners == 0);
+ GNUNET_GE_ASSERT (cfg->ectx, cfg->listeners == 0);
GNUNET_mutex_destroy (cfg->lock);
GNUNET_free (cfg);
}
void
-GC_set_error_context (struct GC_Configuration *cfg, struct GE_Context *ectx)
+GNUNET_GC_set_error_context (struct GNUNET_GC_Configuration *cfg, struct
GNUNET_GE_Context *ectx)
{
cfg->ectx = ectx;
}
int
-GC_parse_configuration (struct GC_Configuration *cfg, const char *filename)
+GNUNET_GC_parse_configuration (struct GNUNET_GC_Configuration *cfg, const char
*filename)
{
int dirty;
char line[256];
@@ -186,9 +186,9 @@
dirty = cfg->dirty; /* back up value! */
if (NULL == (fp = FOPEN (fn, "r")))
{
- GE_LOG_STRERROR_FILE (cfg->ectx,
- GE_ERROR | GE_USER | GE_IMMEDIATE | GE_BULK |
- GE_REQUEST, "fopen", fn);
+ GNUNET_GE_LOG_STRERROR_FILE (cfg->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE | GNUNET_GE_BULK |
+ GNUNET_GE_REQUEST, "fopen", fn);
GNUNET_mutex_unlock (cfg->lock);
GNUNET_free (fn);
return -1;
@@ -221,7 +221,7 @@
/* @INLINE@ value */
char *expanded = GNUNET_expand_file_name (cfg->ectx,
value);
- if (0 != GC_parse_configuration (cfg, expanded))
+ if (0 != GNUNET_GC_parse_configuration (cfg, expanded))
ret = -1; /* failed to parse included config */
}
else if (1 == sscanf (line, "[%99[^]]]", value))
@@ -256,10 +256,10 @@
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 ((GNUNET_NO == GC_have_configuration_value (cfg,
+ if ((GNUNET_NO == GNUNET_GC_have_configuration_value (cfg,
section,
tag)) &&
- (0 != GC_set_configuration_value_string (cfg,
+ (0 != GNUNET_GC_set_configuration_value_string (cfg,
cfg->ectx,
section,
tag, &value[i])))
@@ -272,10 +272,10 @@
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 ((GNUNET_NO == GC_have_configuration_value (cfg,
+ if ((GNUNET_NO == GNUNET_GC_have_configuration_value (cfg,
section,
tag)) &&
- (0 != GC_set_configuration_value_string (cfg,
+ (0 != GNUNET_GC_set_configuration_value_string (cfg,
cfg->ectx,
section, tag, "")))
ret = -1; /* could not set value */
@@ -283,8 +283,8 @@
else
{
/* parse error */
- GE_LOG (cfg->ectx,
- GE_ERROR | GE_USER | GE_IMMEDIATE | GE_BULK,
+ GNUNET_GE_LOG (cfg->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE |
GNUNET_GE_BULK,
_("Syntax error in configuration file `%s' at line %d.\n"),
filename, nr);
ret = -1;
@@ -293,9 +293,9 @@
}
if (0 != fclose (fp))
{
- GE_LOG_STRERROR_FILE (cfg->ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE |
- GE_BULK | GE_REQUEST, "fclose", filename);
+ GNUNET_GE_LOG_STRERROR_FILE (cfg->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN
| GNUNET_GE_IMMEDIATE |
+ GNUNET_GE_BULK | GNUNET_GE_REQUEST, "fclose",
filename);
ret = -1;
}
/* restore dirty flag - anything we set in the meantime
@@ -307,16 +307,16 @@
}
int
-GC_test_dirty (struct GC_Configuration *cfg)
+GNUNET_GC_test_dirty (struct GNUNET_GC_Configuration *cfg)
{
return cfg->dirty;
}
int
-GC_write_configuration (struct GC_Configuration *data, const char *filename)
+GNUNET_GC_write_configuration (struct GNUNET_GC_Configuration *data, const
char *filename)
{
- GC_Section *sec;
- GC_Entry *e;
+ GNUNET_GC_Section *sec;
+ GNUNET_GC_Entry *e;
int i;
int j;
FILE *fp;
@@ -330,8 +330,8 @@
GNUNET_disk_directory_create_for_file (NULL, fn);
if (NULL == (fp = FOPEN (fn, "w")))
{
- GE_LOG_STRERROR_FILE (data->ectx,
- GE_ERROR | GE_USER | GE_IMMEDIATE, "fopen", fn);
+ GNUNET_GE_LOG_STRERROR_FILE (data->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE, "fopen", fn);
GNUNET_free (fn);
return -1;
}
@@ -350,7 +350,7 @@
for (j = 0; j < sec->size; j++)
{
e = &sec->entries[j];
- GE_ASSERT (data->ectx, e->dirty_val == NULL);
+ GNUNET_GE_ASSERT (data->ectx, e->dirty_val == NULL);
if (e->val != NULL)
{
val = GNUNET_malloc (strlen (e->val) * 2 + 1);
@@ -379,14 +379,14 @@
}
}
if (error != 0)
- GE_LOG_STRERROR_FILE (data->ectx,
- GE_ERROR | GE_USER | GE_IMMEDIATE | GE_BULK |
- GE_REQUEST, "fprintf", filename);
+ GNUNET_GE_LOG_STRERROR_FILE (data->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE | GNUNET_GE_BULK |
+ GNUNET_GE_REQUEST, "fprintf", filename);
if (0 != fclose (fp))
{
- GE_LOG_STRERROR_FILE (data->ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE |
- GE_BULK | GE_REQUEST, "fclose", filename);
+ GNUNET_GE_LOG_STRERROR_FILE (data->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN
| GNUNET_GE_IMMEDIATE |
+ GNUNET_GE_BULK | GNUNET_GE_REQUEST, "fclose",
filename);
error = 1;
}
if (error == 0)
@@ -406,8 +406,8 @@
/**
* Call only with lock held!
*/
-static GC_Section *
-findSection (GC_Configuration * data, const char *section)
+static GNUNET_GC_Section *
+findSection (GNUNET_GC_Configuration * data, const char *section)
{
int i;
for (i = data->ssize - 1; i >= 0; i--)
@@ -419,11 +419,11 @@
/**
* Call only with lock held!
*/
-static GC_Entry *
-findEntry (GC_Configuration * data, const char *section, const char *key)
+static GNUNET_GC_Entry *
+findEntry (GNUNET_GC_Configuration * data, const char *section, const char
*key)
{
int i;
- GC_Section *sec;
+ GNUNET_GC_Section *sec;
sec = findSection (data, section);
if (sec == NULL)
@@ -435,15 +435,15 @@
}
int
-GC_set_configuration_value_string (struct GC_Configuration *data,
- struct GE_Context *ectx,
+GNUNET_GC_set_configuration_value_string (struct GNUNET_GC_Configuration *data,
+ struct GNUNET_GE_Context *ectx,
const char *section,
const char *option, const char *value)
{
- GC_Section *sec;
- GC_Section nsec;
- GC_Entry *e;
- GC_Entry ne;
+ GNUNET_GC_Section *sec;
+ GNUNET_GC_Section nsec;
+ GNUNET_GC_Entry *e;
+ GNUNET_GC_Entry ne;
int ret;
int i;
@@ -475,7 +475,7 @@
else
{
/* recursive update to different value -- not allowed! */
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
ret = -1;
}
}
@@ -503,7 +503,7 @@
if (0 != data->listeners[i].listener (data->listeners[i].ctx,
data,
ectx, section, option))
- GE_ASSERT (ectx, 0); /* refused the refusal!? */
+ GNUNET_GE_ASSERT (ectx, 0); /* refused the refusal!? */
e = findEntry (data, section, option); /* side-effects of
callback are possible! */
i++;
}
@@ -521,8 +521,8 @@
}
}
if (ret == -1)
- GE_LOG (ectx,
- GE_USER | GE_BULK | GE_WARNING,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_USER | GNUNET_GE_BULK | GNUNET_GE_WARNING,
_
("Setting option `%s' in section `%s' to value `%s' was
refused.\n"),
option, section, value);
@@ -531,19 +531,19 @@
}
int
-GC_set_configuration_value_number (struct GC_Configuration *cfg,
- struct GE_Context *ectx,
+GNUNET_GC_set_configuration_value_number (struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
const char *section,
const char *option,
unsigned long long number)
{
char s[64];
GNUNET_snprintf (s, 64, "%llu", number);
- return GC_set_configuration_value_string (cfg, ectx, section, option, s);
+ return GNUNET_GC_set_configuration_value_string (cfg, ectx, section, option,
s);
}
int
-GC_get_configuration_value_number (struct GC_Configuration *cfg,
+GNUNET_GC_get_configuration_value_number (struct GNUNET_GC_Configuration *cfg,
const char *section,
const char *option,
unsigned long long min,
@@ -551,7 +551,7 @@
unsigned long long def,
unsigned long long *number)
{
- GC_Entry *e;
+ GNUNET_GC_Entry *e;
const char *val;
int ret;
@@ -568,8 +568,8 @@
}
else
{
- GE_LOG (cfg->ectx,
- GE_ERROR | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (cfg->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Configuration value '%llu' for '%s' "
"in section '%s' is out of legal bounds
[%llu,%llu]\n"),
*number, option, section, min, max);
@@ -578,8 +578,8 @@
}
else
{
- GE_LOG (cfg->ectx,
- GE_ERROR | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (cfg->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Configuration value '%s' for '%s'"
" in section '%s' should be a number\n"),
val, option, section, min, max);
@@ -589,7 +589,7 @@
else
{
*number = def;
- GC_set_configuration_value_number (cfg,
+ GNUNET_GC_set_configuration_value_number (cfg,
cfg->ectx, section, option, def);
ret = 1; /* default */
}
@@ -598,12 +598,12 @@
}
int
-GC_get_configuration_value_string (struct GC_Configuration *cfg,
+GNUNET_GC_get_configuration_value_string (struct GNUNET_GC_Configuration *cfg,
const char *section,
const char *option,
const char *def, char **value)
{
- GC_Entry *e;
+ GNUNET_GC_Entry *e;
const char *val;
int ret;
@@ -620,14 +620,14 @@
if (def == NULL)
{
GNUNET_mutex_unlock (cfg->lock);
- GE_LOG (cfg->ectx,
- GE_USER | GE_IMMEDIATE | GE_ERROR,
+ GNUNET_GE_LOG (cfg->ectx,
+ GNUNET_GE_USER | GNUNET_GE_IMMEDIATE | GNUNET_GE_ERROR,
"Configuration value for option `%s' in section `%s'
required.\n",
option, section);
return -1;
}
*value = GNUNET_strdup (def);
- GC_set_configuration_value_string (cfg,
+ GNUNET_GC_set_configuration_value_string (cfg,
cfg->ectx, section, option, def);
ret = 1; /* default */
}
@@ -636,13 +636,13 @@
}
int
-GC_get_configuration_value_choice (struct GC_Configuration *cfg,
+GNUNET_GC_get_configuration_value_choice (struct GNUNET_GC_Configuration *cfg,
const char *section,
const char *option,
const char **choices,
const char *def, const char **value)
{
- GC_Entry *e;
+ GNUNET_GC_Entry *e;
const char *val;
int i;
int ret;
@@ -661,8 +661,8 @@
}
if (choices[i] == NULL)
{
- GE_LOG (cfg->ectx,
- GE_ERROR | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (cfg->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Configuration value '%s' for '%s'"
" in section '%s' is not in set of legal choices\n"),
val, option, section);
@@ -691,10 +691,10 @@
* @return GNUNET_YES if so, GNUNET_NO if not.
*/
int
-GC_have_configuration_value (struct GC_Configuration *cfg,
+GNUNET_GC_have_configuration_value (struct GNUNET_GC_Configuration *cfg,
const char *section, const char *option)
{
- GC_Entry *e;
+ GNUNET_GC_Entry *e;
int ret;
GNUNET_mutex_lock (cfg->lock);
@@ -716,7 +716,7 @@
* @return $-expanded string
*/
char *
-GC_configuration_expand_dollar (struct GC_Configuration *cfg, char *orig)
+GNUNET_GC_configuration_expand_dollar (struct GNUNET_GC_Configuration *cfg,
char *orig)
{
int i;
char *prefix;
@@ -738,13 +738,13 @@
post = &orig[i + 1];
}
prefix = NULL;
- if (GNUNET_YES == GC_have_configuration_value (cfg, "PATHS", &orig[1]))
+ if (GNUNET_YES == GNUNET_GC_have_configuration_value (cfg, "PATHS",
&orig[1]))
{
- if (0 != GC_get_configuration_value_string (cfg,
+ if (0 != GNUNET_GC_get_configuration_value_string (cfg,
"PATHS",
&orig[1], NULL, &prefix))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return orig;
}
}
@@ -782,7 +782,7 @@
* @return 0 on success, -1 on error, 1 for default
*/
int
-GC_get_configuration_value_filename (struct GC_Configuration *data,
+GNUNET_GC_get_configuration_value_filename (struct GNUNET_GC_Configuration
*data,
const char *section,
const char *option,
const char *def, char **value)
@@ -791,10 +791,10 @@
char *tmp;
tmp = NULL;
- ret = GC_get_configuration_value_string (data, section, option, def, &tmp);
+ ret = GNUNET_GC_get_configuration_value_string (data, section, option, def,
&tmp);
if (tmp != NULL)
{
- tmp = GC_configuration_expand_dollar (data, tmp);
+ tmp = GNUNET_GC_configuration_expand_dollar (data, tmp);
*value = GNUNET_expand_file_name (data->ectx, tmp);
GNUNET_free (tmp);
}
@@ -806,30 +806,30 @@
}
int
-GC_set_configuration_value_choice (struct GC_Configuration *cfg,
- struct GE_Context *ectx,
+GNUNET_GC_set_configuration_value_choice (struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
const char *section,
const char *option, const char *choice)
{
- return GC_set_configuration_value_string (cfg, ectx, section, option,
+ return GNUNET_GC_set_configuration_value_string (cfg, ectx, section, option,
choice);
}
int
-GC_attach_change_listener (struct GC_Configuration *cfg,
- GC_ChangeListener callback, void *ctx)
+GNUNET_GC_attach_change_listener (struct GNUNET_GC_Configuration *cfg,
+ GNUNET_GC_ChangeListener callback, void *ctx)
{
- GC_Listener l;
+ GNUNET_GC_Listener l;
int i;
int j;
GNUNET_mutex_lock (cfg->lock);
for (i = 0; i < cfg->ssize; i++)
{
- GC_Section *s = &cfg->sections[i];
+ GNUNET_GC_Section *s = &cfg->sections[i];
for (j = 0; j < s->size; j++)
{
- GC_Entry *e = &s->entries[j];
+ GNUNET_GC_Entry *e = &s->entries[j];
if (0 != callback (ctx, cfg, cfg->ectx, s->name, e->key))
{
GNUNET_mutex_unlock (cfg->lock);
@@ -846,11 +846,11 @@
}
int
-GC_detach_change_listener (struct GC_Configuration *cfg,
- GC_ChangeListener callback, void *ctx)
+GNUNET_GC_detach_change_listener (struct GNUNET_GC_Configuration *cfg,
+ GNUNET_GC_ChangeListener callback, void *ctx)
{
int i;
- GC_Listener *l;
+ GNUNET_GC_Listener *l;
GNUNET_mutex_lock (cfg->lock);
for (i = cfg->lsize - 1; i >= 0; i--)
@@ -869,15 +869,15 @@
}
/**
- * Create a GC_Configuration.
+ * Create a GNUNET_GC_Configuration.
*/
-GC_Configuration *
-GC_create ()
+GNUNET_GC_Configuration *
+GNUNET_GC_create ()
{
- GC_Configuration *ret;
+ GNUNET_GC_Configuration *ret;
- ret = GNUNET_malloc (sizeof (GC_Configuration));
- memset (ret, 0, sizeof (GC_Configuration));
+ ret = GNUNET_malloc (sizeof (GNUNET_GC_Configuration));
+ memset (ret, 0, sizeof (GNUNET_GC_Configuration));
ret->lock = GNUNET_mutex_create (GNUNET_YES);
return ret;
}
@@ -891,7 +891,7 @@
* @return GNUNET_YES, GNUNET_NO or GNUNET_SYSERR
*/
int
-GC_get_configuration_value_yesno (struct GC_Configuration *cfg,
+GNUNET_GC_get_configuration_value_yesno (struct GNUNET_GC_Configuration *cfg,
const char *section,
const char *option, int def)
{
@@ -899,7 +899,7 @@
const char *val;
int ret;
- ret = GC_get_configuration_value_choice (cfg,
+ ret = GNUNET_GC_get_configuration_value_choice (cfg,
section,
option,
yesno,
Modified: GNUnet/src/util/config/configtest.c
===================================================================
--- GNUnet/src/util/config/configtest.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/config/configtest.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -28,7 +28,7 @@
#include "gnunet_util_config.h"
#include "gnunet_util_error_loggers.h"
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static int
testConfig ()
@@ -36,19 +36,19 @@
char *c;
unsigned long long l;
- if (0 != GC_get_configuration_value_string (cfg, "test", "b", NULL, &c))
+ if (0 != GNUNET_GC_get_configuration_value_string (cfg, "test", "b", NULL,
&c))
return 1;
if (0 != strcmp ("b", c))
return 1;
GNUNET_free (c);
- if (0 != GC_get_configuration_value_number (cfg,
+ if (0 != GNUNET_GC_get_configuration_value_number (cfg,
"test", "five", 0, 10, 9, &l))
return 1;
if (5 != l)
return 1;
- GC_set_configuration_value_string (cfg, NULL, "more", "c", "YES");
+ GNUNET_GC_set_configuration_value_string (cfg, NULL, "more", "c", "YES");
if (GNUNET_NO ==
- GC_get_configuration_value_yesno (cfg, "more", "c", GNUNET_NO))
+ GNUNET_GC_get_configuration_value_yesno (cfg, "more", "c", GNUNET_NO))
return 1;
return 0;
}
@@ -56,21 +56,21 @@
int
main (int argc, char *argv[])
{
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
int failureCount = 0;
- ectx = GE_create_context_stderr (GNUNET_NO,
- GE_WARNING | GE_ERROR | GE_FATAL |
- GE_USER | GE_ADMIN | GE_DEVELOPER |
- GE_IMMEDIATE | GE_BULK);
- GE_setDefaultContext (ectx);
- cfg = GC_create ();
- if (0 != GC_parse_configuration (cfg, "testconfig.conf"))
+ ectx = GNUNET_GE_create_context_stderr (GNUNET_NO,
+ GNUNET_GE_WARNING | GNUNET_GE_ERROR |
GNUNET_GE_FATAL |
+ GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_DEVELOPER |
+ GNUNET_GE_IMMEDIATE | GNUNET_GE_BULK);
+ GNUNET_GE_setDefaultContext (ectx);
+ cfg = GNUNET_GC_create ();
+ if (0 != GNUNET_GC_parse_configuration (cfg, "testconfig.conf"))
{
fprintf (stderr, "Failed to parse configuration file\n");
return 1;
}
- GE_ASSERT (ectx, cfg != NULL);
+ GNUNET_GE_ASSERT (ectx, cfg != NULL);
GNUNET_os_init (ectx);
failureCount += testConfig ();
Modified: GNUnet/src/util/config_impl/configtest.c
===================================================================
--- GNUnet/src/util/config_impl/configtest.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/util/config_impl/configtest.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -28,7 +28,7 @@
#include "gnunet_util_config.h"
#include "gnunet_util_error_loggers.h"
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static int
testConfig ()
@@ -36,19 +36,19 @@
char *c;
unsigned long long l;
- if (0 != GC_get_configuration_value_string (cfg, "test", "b", NULL, &c))
+ if (0 != GNUNET_GC_get_configuration_value_string (cfg, "test", "b", NULL,
&c))
return 1;
if (0 != strcmp ("b", c))
return 1;
GNUNET_free (c);
- if (0 != GC_get_configuration_value_number (cfg,
+ if (0 != GNUNET_GC_get_configuration_value_number (cfg,
"test", "five", 0, 10, 9, &l))
return 1;
if (5 != l)
return 1;
- GC_set_configuration_value_string (cfg, NULL, "more", "c", "YES");
+ GNUNET_GC_set_configuration_value_string (cfg, NULL, "more", "c", "YES");
if (GNUNET_NO ==
- GC_get_configuration_value_yesno (cfg, "more", "c", GNUNET_NO))
+ GNUNET_GC_get_configuration_value_yesno (cfg, "more", "c", GNUNET_NO))
return 1;
return 0;
}
@@ -56,21 +56,21 @@
int
main (int argc, char *argv[])
{
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
int failureCount = 0;
- ectx = GE_create_context_stderr (GNUNET_NO,
- GE_WARNING | GE_ERROR | GE_FATAL |
- GE_USER | GE_ADMIN | GE_DEVELOPER |
- GE_IMMEDIATE | GE_BULK);
- GE_setDefaultContext (ectx);
- cfg = GC_create ();
- if (0 != GC_parse_configuration (cfg, "testconfig.conf"))
+ ectx = GNUNET_GE_create_context_stderr (GNUNET_NO,
+ GNUNET_GE_WARNING | GNUNET_GE_ERROR |
GNUNET_GE_FATAL |
+ GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_DEVELOPER |
+ GNUNET_GE_IMMEDIATE | GNUNET_GE_BULK);
+ GNUNET_GE_setDefaultContext (ectx);
+ cfg = GNUNET_GC_create ();
+ if (0 != GNUNET_GC_parse_configuration (cfg, "testconfig.conf"))
{
fprintf (stderr, "Failed to parse configuration file\n");
return 1;
}
- GE_ASSERT (ectx, cfg != NULL);
+ GNUNET_GE_ASSERT (ectx, cfg != NULL);
GNUNET_os_init (ectx);
failureCount += testConfig ();
Modified: GNUnet/src/util/containers/bloomfilter.c
===================================================================
--- GNUnet/src/util/containers/bloomfilter.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/util/containers/bloomfilter.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -59,7 +59,7 @@
/**
* For error handling.
*/
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
/**
* Filename of the filter
@@ -167,8 +167,8 @@
targetLoc = bitIdx % 2;
if (fileSlot != (unsigned int) LSEEK (fd, fileSlot, SEEK_SET))
- GE_DIE_STRERROR (NULL,
- GE_ADMIN | GE_USER | GE_FATAL | GE_IMMEDIATE, "lseek");
+ GNUNET_GE_DIE_STRERROR (NULL,
+ GNUNET_GE_ADMIN | GNUNET_GE_USER | GNUNET_GE_FATAL |
GNUNET_GE_IMMEDIATE, "lseek");
value = 0;
READ (fd, &value, 1);
@@ -187,11 +187,11 @@
}
value = ((high << 4) | low);
if (fileSlot != (unsigned int) LSEEK (fd, fileSlot, SEEK_SET))
- GE_DIE_STRERROR (NULL,
- GE_ADMIN | GE_USER | GE_FATAL | GE_IMMEDIATE, "lseek");
+ GNUNET_GE_DIE_STRERROR (NULL,
+ GNUNET_GE_ADMIN | GNUNET_GE_USER | GNUNET_GE_FATAL |
GNUNET_GE_IMMEDIATE, "lseek");
if (1 != WRITE (fd, &value, 1))
- GE_DIE_STRERROR (NULL,
- GE_ADMIN | GE_USER | GE_FATAL | GE_IMMEDIATE, "write");
+ GNUNET_GE_DIE_STRERROR (NULL,
+ GNUNET_GE_ADMIN | GNUNET_GE_USER | GNUNET_GE_FATAL |
GNUNET_GE_IMMEDIATE, "write");
}
@@ -214,7 +214,7 @@
if (fd == -1)
return; /* cannot decrement! */
- GE_ASSERT (NULL, fd != -1);
+ GNUNET_GE_ASSERT (NULL, fd != -1);
/* Each char slot in the counter file holds two 4 bit counters */
fileSlot = bitIdx / 2;
targetLoc = bitIdx % 2;
@@ -247,8 +247,8 @@
value = ((high << 4) | low);
LSEEK (fd, fileSlot, SEEK_SET);
if (1 != WRITE (fd, &value, 1))
- GE_DIE_STRERROR (NULL,
- GE_ADMIN | GE_USER | GE_FATAL | GE_IMMEDIATE, "write");
+ GNUNET_GE_DIE_STRERROR (NULL,
+ GNUNET_GE_ADMIN | GNUNET_GE_USER | GNUNET_GE_FATAL |
GNUNET_GE_IMMEDIATE, "write");
}
#define BUFFSIZE 65536
@@ -287,8 +287,8 @@
}
if (res == -1)
{
- GE_DIE_STRERROR (NULL,
- GE_ADMIN | GE_USER | GE_FATAL | GE_IMMEDIATE,
+ GNUNET_GE_DIE_STRERROR (NULL,
+ GNUNET_GE_ADMIN | GNUNET_GE_USER | GNUNET_GE_FATAL
| GNUNET_GE_IMMEDIATE,
"write");
GNUNET_free (buffer);
return GNUNET_SYSERR;
@@ -408,7 +408,7 @@
* @return the bloomfilter
*/
Bloomfilter *
-GNUNET_bloomfilter_load (struct GE_Context *ectx,
+GNUNET_bloomfilter_load (struct GNUNET_GE_Context *ectx,
const char *filename, unsigned int size,
unsigned int k)
{
Modified: GNUnet/src/util/cron/cron.c
===================================================================
--- GNUnet/src/util/cron/cron.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/cron/cron.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -134,7 +134,7 @@
void *runningData_;
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
/**
* The cron thread.
@@ -180,7 +180,7 @@
struct GNUNET_CronManager *
-cron_create (struct GE_Context *ectx)
+cron_create (struct GNUNET_GE_Context *ectx)
{
struct GNUNET_CronManager *cron;
unsigned int i;
@@ -210,7 +210,7 @@
noJob (void *unused)
{
#if DEBUG_CRON
- GE_LOG (NULL, GE_STATUS | GE_DEVELOPER | GE_BULK, "In noJob.\n");
+ GNUNET_GE_LOG (NULL, GNUNET_GE_STATUS | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK, "In noJob.\n");
#endif
}
@@ -220,7 +220,7 @@
void *unused;
#if DEBUG_CRON
- GE_LOG (cron->ectx, GE_STATUS | GE_DEVELOPER | GE_BULK, "Stopping cron\n");
+ GNUNET_GE_LOG (cron->ectx, GNUNET_GE_STATUS | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK, "Stopping cron\n");
#endif
cron->cron_shutdown = GNUNET_YES;
GNUNET_cron_add_job (cron, &noJob, 0, 0, NULL);
@@ -229,7 +229,7 @@
cron->cron_signal = NULL;
GNUNET_thread_join (cron->cron_handle, &unused);
#if DEBUG_CRON
- GE_LOG (NULL, GE_STATUS | GE_DEVELOPER | GE_BULK, "Cron stopped\n");
+ GNUNET_GE_LOG (NULL, GNUNET_GE_STATUS | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK, "Cron stopped\n");
#endif
}
@@ -263,7 +263,7 @@
(cron->cron_shutdown == GNUNET_NO) &&
(GNUNET_NO != GNUNET_thread_test_self (cron->cron_handle)))
return;
- GE_ASSERT (NULL, GNUNET_NO == GNUNET_thread_test_self (cron->cron_handle));
+ GNUNET_GE_ASSERT (NULL, GNUNET_NO == GNUNET_thread_test_self
(cron->cron_handle));
GNUNET_mutex_lock (cron->inBlockLock_);
cron->inBlock++;
if (cron->inBlock == 1)
@@ -293,7 +293,7 @@
(cron->cron_shutdown == GNUNET_NO) &&
(GNUNET_NO != GNUNET_thread_test_self (cron->cron_handle)))
return;
- GE_ASSERT (NULL, cron->inBlock > 0);
+ GNUNET_GE_ASSERT (NULL, cron->inBlock > 0);
GNUNET_semaphore_up (cron->cron_signal_up);
}
@@ -324,8 +324,8 @@
while (jobId != -1)
{
tab = &cron->deltaList_[jobId];
- GE_LOG (NULL,
- GE_STATUS | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_STATUS | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"%3u: delta %8lld CU --- method %p --- repeat %8u CU\n",
jobId, tab->delta - now, (int) tab->method, tab->deltaRepeat);
jobId = tab->next;
@@ -344,8 +344,8 @@
int jobId;
#if DEBUG_CRON
- GE_LOG (NULL,
- GE_STATUS | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_STATUS | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"Advancing job %p-%p\n", method, data);
#endif
GNUNET_mutex_lock (cron->deltaListLock_);
@@ -394,8 +394,8 @@
int current;
#if DEBUG_CRON
- GE_LOG (cron->ectx,
- GE_STATUS | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (cron->ectx,
+ GNUNET_GE_STATUS | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"Adding job %p-%p to fire in %d CU\n", method, data, delta);
#endif
@@ -505,8 +505,8 @@
if (repeat > 0)
{
#if DEBUG_CRON
- GE_LOG (cron->ectx,
- GE_STATUS | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (cron->ectx,
+ GNUNET_GE_STATUS | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"adding periodic job %p-%p to run again in %u\n",
method, data, repeat);
#endif
@@ -514,16 +514,16 @@
}
/* run */
#if DEBUG_CRON
- GE_LOG (cron->ectx,
- GE_STATUS | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (cron->ectx,
+ GNUNET_GE_STATUS | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"running job %p-%p\n", method, data);
#endif
method (data);
GNUNET_mutex_lock (cron->deltaListLock_);
cron->runningJob_ = NULL;
#if DEBUG_CRON
- GE_LOG (cron->ectx,
- GE_STATUS | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (cron->ectx,
+ GNUNET_GE_STATUS | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"job %p-%p done\n", method, data);
#endif
}
@@ -553,15 +553,15 @@
if (next <= now)
{
#if DEBUG_CRON
- GE_LOG (cron->ectx,
- GE_STATUS | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (cron->ectx,
+ GNUNET_GE_STATUS | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"running cron job, table is\n");
printCronTab (cron);
#endif
runJob (cron);
#if DEBUG_CRON
- GE_LOG (cron->ectx,
- GE_STATUS | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (cron->ectx,
+ GNUNET_GE_STATUS | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"job run, new table is\n");
printCronTab (cron);
#endif
@@ -572,8 +572,8 @@
GNUNET_mutex_unlock (cron->deltaListLock_);
next = next - now; /* how long to sleep */
#if DEBUG_CRON
- GE_LOG (cron->ectx,
- GE_STATUS | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (cron->ectx,
+ GNUNET_GE_STATUS | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"Sleeping at %llu for %llu CU (%llu s, %llu CU)\n",
now, next, next / GNUNET_CRON_SECONDS, next);
#endif
@@ -582,16 +582,16 @@
if (cron->cron_shutdown == GNUNET_NO)
GNUNET_thread_sleep (next);
#if DEBUG_CRON
- GE_LOG (cron->ectx,
- GE_STATUS | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (cron->ectx,
+ GNUNET_GE_STATUS | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"woke up at %llu - %lld CS late\n",
GNUNET_get_time (), GNUNET_get_time () - (now + next));
#endif
}
GNUNET_semaphore_up (cron->cron_signal);
#if DEBUG_CRON
- GE_LOG (cron->ectx,
- GE_STATUS | GE_DEVELOPER | GE_BULK, "Cron thread exits.\n");
+ GNUNET_GE_LOG (cron->ectx,
+ GNUNET_GE_STATUS | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK, "Cron
thread exits.\n");
printCronTab (cron);
#endif
return NULL;
@@ -606,7 +606,7 @@
{
int i;
- GE_ASSERT (cron->ectx, cron->cron_signal == NULL);
+ GNUNET_GE_ASSERT (cron->ectx, cron->cron_signal == NULL);
i = cron->firstUsed_;
while (i != -1)
{
@@ -626,7 +626,7 @@
void
GNUNET_cron_start (struct GNUNET_CronManager *cron)
{
- GE_ASSERT (cron->ectx, cron->cron_signal == NULL);
+ GNUNET_GE_ASSERT (cron->ectx, cron->cron_signal == NULL);
cron->cron_shutdown = GNUNET_NO;
cron->cron_signal = GNUNET_semaphore_create (0);
/* large stack, we don't know for sure
@@ -634,8 +634,8 @@
cron->cron_handle =
GNUNET_thread_create (&cron_main_method, cron, 256 * 1024);
if (cron->cron_handle == 0)
- GE_DIE_STRERROR (cron->ectx,
- GE_FATAL | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_DIE_STRERROR (cron->ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
"pthread_create");
}
@@ -648,8 +648,8 @@
int jobId;
#if DEBUG_CRON
- GE_LOG (cron->ectx,
- GE_STATUS | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (cron->ectx,
+ GNUNET_GE_STATUS | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"deleting job %p-%p\n", method, data);
#endif
GNUNET_mutex_lock (cron->deltaListLock_);
Modified: GNUnet/src/util/crypto/crc32.c
===================================================================
--- GNUnet/src/util/crypto/crc32.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/crypto/crc32.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -79,7 +79,7 @@
static uLong
crc32 (uLong crc, const char *buf, size_t len)
{
- GE_ASSERT (NULL, crc_table[255] != 0);
+ GNUNET_GE_ASSERT (NULL, crc_table[255] != 0);
crc ^= 0xffffffff;
while (len--)
crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
Modified: GNUnet/src/util/crypto/hashing.c
===================================================================
--- GNUnet/src/util/crypto/hashing.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/crypto/hashing.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -379,7 +379,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
int
-GNUNET_hash_file (struct GE_Context *ectx, const char *filename,
+GNUNET_hash_file (struct GNUNET_GE_Context *ectx, const char *filename,
GNUNET_HashCode * ret)
{
unsigned char *buf;
@@ -396,8 +396,8 @@
fh = GNUNET_disk_file_open (ectx, filename, O_RDONLY | O_LARGEFILE);
if (fh == -1)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_REQUEST,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN
| GNUNET_GE_REQUEST,
"open", filename);
return GNUNET_SYSERR;
}
@@ -411,12 +411,12 @@
delta = len - pos;
if (delta != READ (fh, buf, delta))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"read", filename);
if (0 != CLOSE (fh))
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"close", filename);
GNUNET_free (buf);
return GNUNET_SYSERR;
@@ -428,8 +428,8 @@
break;
}
if (0 != CLOSE (fh))
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_BULK,
"close", filename);
sha512_final (&ctx, (unsigned char *) ret);
GNUNET_free (buf);
@@ -473,8 +473,8 @@
unsigned int bits;
unsigned int vbit;
- GE_ASSERT (NULL, block != NULL);
- GE_ASSERT (NULL, result != NULL);
+ GNUNET_GE_ASSERT (NULL, block != NULL);
+ GNUNET_GE_ASSERT (NULL, result != NULL);
vbit = 0;
wpos = 0;
rpos = 0;
@@ -489,15 +489,15 @@
if (vbit < 5)
{
bits <<= (5 - vbit); /* zero-padding */
- GE_ASSERT (NULL, vbit == 2); /* padding by 3: 512+3 mod 5 == 0 */
+ GNUNET_GE_ASSERT (NULL, vbit == 2); /* padding by 3: 512+3 mod 5 ==
0 */
vbit = 5;
}
- GE_ASSERT (NULL, wpos < sizeof (GNUNET_EncName) - 1);
+ GNUNET_GE_ASSERT (NULL, wpos < sizeof (GNUNET_EncName) - 1);
result->encoding[wpos++] = encTable__[(bits >> (vbit - 5)) & 31];
vbit -= 5;
}
- GE_ASSERT (NULL, wpos == sizeof (GNUNET_EncName) - 1);
- GE_ASSERT (NULL, vbit == 0);
+ GNUNET_GE_ASSERT (NULL, wpos == sizeof (GNUNET_EncName) - 1);
+ GNUNET_GE_ASSERT (NULL, vbit == 0);
result->encoding[wpos] = '\0';
}
@@ -525,7 +525,7 @@
bits = getValue__ (enc[--rpos]) >> 3;
while (wpos > 0)
{
- GE_ASSERT (NULL, rpos > 0);
+ GNUNET_GE_ASSERT (NULL, rpos > 0);
bits = (getValue__ (enc[--rpos]) << vbit) | bits;
vbit += 5;
if (vbit >= 8)
@@ -535,8 +535,8 @@
vbit -= 8;
}
}
- GE_ASSERT (NULL, rpos == 0);
- GE_ASSERT (NULL, vbit == 0);
+ GNUNET_GE_ASSERT (NULL, rpos == 0);
+ GNUNET_GE_ASSERT (NULL, vbit == 0);
return GNUNET_OK;
}
@@ -604,7 +604,7 @@
GNUNET_AES_SessionKey * skey,
GNUNET_AES_InitializationVector * iv)
{
- GE_ASSERT (NULL,
+ GNUNET_GE_ASSERT (NULL,
sizeof (GNUNET_HashCode) >=
GNUNET_SESSIONKEY_LEN +
sizeof (GNUNET_AES_InitializationVector));
@@ -625,7 +625,7 @@
{
if (bit >= 8 * sizeof (GNUNET_HashCode))
{
- GE_ASSERT (NULL, 0);
+ GNUNET_GE_ASSERT (NULL, 0);
return -1; /* error */
}
return (((unsigned char *) code)[bit >> 3] & (1 << bit & 7)) > 0;
Modified: GNUnet/src/util/crypto/hostkey_gcrypt.c
===================================================================
--- GNUnet/src/util/crypto/hostkey_gcrypt.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/util/crypto/hostkey_gcrypt.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -41,7 +41,7 @@
* Use LOG_ERROR for anything that should never happen
* (indicates a bug).
*/
-#define LOG_ERROR (GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK)
+#define LOG_ERROR (GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK)
/**
* The private information of an RSA key pair.
@@ -61,14 +61,14 @@
* a failure of the command 'cmd' with the message given
* by gcry_strerror(rc).
*/
-#define LOG_GCRY(ectx, level, cmd, rc) do { GE_LOG(ectx, level, _("`%s' failed
at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, gcry_strerror(rc)); }
while(0);
+#define LOG_GCRY(ectx, level, cmd, rc) do { GNUNET_GE_LOG(ectx, level, _("`%s'
failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__,
gcry_strerror(rc)); } while(0);
/**
* Die with an error message that indicates
* a failure of the command 'cmd' with the message given
* by gcry_strerror(rc).
*/
-#define DIE_GCRY(ectx, cmd, rc) do { GE_LOG(ectx, GE_FATAL | GE_USER |
GE_DEVELOPER | GE_IMMEDIATE, _("`%s' failed at %s:%d with error: %s\n"), cmd,
__FILE__, __LINE__, gcry_strerror(rc)); abort(); } while(0);
+#define DIE_GCRY(ectx, cmd, rc) do { GNUNET_GE_LOG(ectx, GNUNET_GE_FATAL |
GNUNET_GE_USER | GNUNET_GE_DEVELOPER | GNUNET_GE_IMMEDIATE, _("`%s' failed at
%s:%d with error: %s\n"), cmd, __FILE__, __LINE__, gcry_strerror(rc)); abort();
} while(0);
@@ -269,7 +269,7 @@
(ntohs (publicKey->len) !=
sizeof (GNUNET_RSA_PublicKey) - sizeof (publicKey->padding)))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return NULL;
}
size = GNUNET_RSA_DATA_ENCODING_LEN;
@@ -330,7 +330,7 @@
#if EXTRA_CHECKS
if (gcry_pk_testkey (hostkey->sexp))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
unlockGcrypt ();
return NULL;
}
@@ -382,7 +382,7 @@
sizes[i] = 0;
}
}
- GE_ASSERT (NULL, size < 65536);
+ GNUNET_GE_ASSERT (NULL, size < 65536);
retval = GNUNET_malloc (size);
retval->len = htons (size);
i = 0;
@@ -612,7 +612,7 @@
size_t erroff;
int rc;
- GE_ASSERT (NULL, size <= sizeof (GNUNET_HashCode));
+ GNUNET_GE_ASSERT (NULL, size <= sizeof (GNUNET_HashCode));
pubkey = public2PrivateKey (publicKey);
isize = size;
lockGcrypt ();
@@ -901,8 +901,8 @@
gcry_sexp_release (sigdata);
if (rc)
{
- GE_LOG (NULL,
- GE_WARNING | GE_USER | GE_BULK | GE_DEVELOPER,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK |
GNUNET_GE_DEVELOPER,
_("RSA signature verification failed at %s:%d: %s\n"),
__FILE__, __LINE__, gcry_strerror (rc));
unlockGcrypt ();
Modified: GNUnet/src/util/crypto/kblockkey.c
===================================================================
--- GNUnet/src/util/crypto/kblockkey.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/crypto/kblockkey.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -244,7 +244,7 @@
set_highbit (x, nbits - 2);
mpz_clrbit (x, nbits - 2);
}
- GE_ASSERT (NULL, mpz_cmp (x, nminus1) < 0 && mpz_cmp_ui (x, 1) > 0);
+ GNUNET_GE_ASSERT (NULL, mpz_cmp (x, nminus1) < 0 && mpz_cmp_ui (x,
1) > 0);
}
mpz_powm (y, x, q, n);
if (mpz_cmp_ui (y, 1) && mpz_cmp (y, nminus1))
@@ -281,7 +281,7 @@
int *mods;
mpz_t tmp;
- GE_ASSERT (NULL, nbits >= 16);
+ GNUNET_GE_ASSERT (NULL, nbits >= 16);
mods = GNUNET_malloc (no_of_small_prime_numbers * sizeof (*mods));
/* Make nbits fit into mpz_t implementation. */
@@ -485,7 +485,7 @@
*pkv[i]);
size += sizes[i];
}
- GE_ASSERT (NULL, size < 65536);
+ GNUNET_GE_ASSERT (NULL, size < 65536);
retval = GNUNET_malloc (size);
retval->len = htons (size);
i = 0;
Modified: GNUnet/src/util/crypto/kblockkey_test.c
===================================================================
--- GNUnet/src/util/crypto/kblockkey_test.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/util/crypto/kblockkey_test.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -48,7 +48,7 @@
hostkey = GNUNET_RSA_create_key_from_hash (&in);
if (hostkey == NULL)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
GNUNET_RSA_get_public_key (hostkey, &pkey);
@@ -63,7 +63,7 @@
hostkey = GNUNET_RSA_create_key_from_hash (&in);
if (hostkey == NULL)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
fprintf (stderr, " ERROR\n");
return GNUNET_SYSERR;
}
@@ -71,7 +71,7 @@
GNUNET_RSA_free_key (hostkey);
if (0 != memcmp (&pkey, &pkey1, sizeof (GNUNET_RSA_PublicKey)))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
fprintf (stderr, " ERROR\n");
return GNUNET_SYSERR;
}
Modified: GNUnet/src/util/crypto/random.c
===================================================================
--- GNUnet/src/util/crypto/random.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/crypto/random.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -41,7 +41,7 @@
#endif
unsigned int ret;
- GE_ASSERT (NULL, i > 0);
+ GNUNET_GE_ASSERT (NULL, i > 0);
if (mode == GNUNET_RANDOM_QUALITY_STRONG)
{
@@ -84,7 +84,7 @@
unsigned int tmp;
unsigned int x;
- GE_ASSERT (NULL, n > 0);
+ GNUNET_GE_ASSERT (NULL, n > 0);
ret = GNUNET_malloc (n * sizeof (int));
for (i = 0; i < n; i++)
ret[i] = i;
@@ -106,7 +106,7 @@
{
unsigned long long ret;
- GE_ASSERT (NULL, u > 0);
+ GNUNET_GE_ASSERT (NULL, u > 0);
if (mode == GNUNET_RANDOM_QUALITY_STRONG)
{
lockGcrypt ();
Modified: GNUnet/src/util/crypto/symcipher_gcrypt.c
===================================================================
--- GNUnet/src/util/crypto/symcipher_gcrypt.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/util/crypto/symcipher_gcrypt.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -43,14 +43,14 @@
* a failure of the command 'cmd' with the message given
* by gcry_strerror(rc).
*/
-#define LOG_GCRY(ectx, level, cmd, rc) do { GE_LOG(ectx, level, _("`%s' failed
at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, gcry_strerror(rc)); }
while(0);
+#define LOG_GCRY(ectx, level, cmd, rc) do { GNUNET_GE_LOG(ectx, level, _("`%s'
failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__,
gcry_strerror(rc)); } while(0);
/**
* Die with an error message that indicates
* a failure of the command 'cmd' with the message given
* by gcry_strerror(rc).
*/
-#define DIE_GCRY(ectx, cmd, rc) do { GE_LOG(ectx, GE_FATAL | GE_USER |
GE_DEVELOPER | GE_IMMEDIATE, _("`%s' failed at %s:%d with error: %s\n"), cmd,
__FILE__, __LINE__, gcry_strerror(rc)); abort(); } while(0);
+#define DIE_GCRY(ectx, cmd, rc) do { GNUNET_GE_LOG(ectx, GNUNET_GE_FATAL |
GNUNET_GE_USER | GNUNET_GE_DEVELOPER | GNUNET_GE_IMMEDIATE, _("`%s' failed at
%s:%d with error: %s\n"), cmd, __FILE__, __LINE__, gcry_strerror(rc)); abort();
} while(0);
/**
@@ -88,7 +88,7 @@
if (sessionkey->crc32 !=
htonl (GNUNET_crc32_n (sessionkey, GNUNET_SESSIONKEY_LEN)))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
lockGcrypt ();
@@ -97,7 +97,7 @@
if (rc)
{
LOG_GCRY (NULL,
- GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK,
"gcry_cipher_open", rc);
unlockGcrypt ();
return -1;
@@ -107,7 +107,7 @@
if (rc && ((char) rc != GPG_ERR_WEAK_KEY))
{
LOG_GCRY (NULL,
- GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK,
"gcry_cipher_setkey", rc);
gcry_cipher_close (handle);
unlockGcrypt ();
@@ -118,7 +118,7 @@
if (rc && ((char) rc != GPG_ERR_WEAK_KEY))
{
LOG_GCRY (NULL,
- GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK,
"gcry_cipher_setiv", rc);
gcry_cipher_close (handle);
unlockGcrypt ();
@@ -129,7 +129,7 @@
if (rc)
{
LOG_GCRY (NULL,
- GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK,
"gcry_cipher_encrypt", rc);
gcry_cipher_close (handle);
unlockGcrypt ();
@@ -162,7 +162,7 @@
if (sessionkey->crc32 !=
htonl (GNUNET_crc32_n (sessionkey, GNUNET_SESSIONKEY_LEN)))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
lockGcrypt ();
@@ -171,7 +171,7 @@
if (rc)
{
LOG_GCRY (NULL,
- GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK,
"gcry_cipher_open", rc);
unlockGcrypt ();
return -1;
@@ -181,7 +181,7 @@
if (rc && ((char) rc != GPG_ERR_WEAK_KEY))
{
LOG_GCRY (NULL,
- GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK,
"gcry_cipher_setkey", rc);
gcry_cipher_close (handle);
unlockGcrypt ();
@@ -193,7 +193,7 @@
if (rc && ((char) rc != GPG_ERR_WEAK_KEY))
{
LOG_GCRY (NULL,
- GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK,
"gcry_cipher_setiv", rc);
gcry_cipher_close (handle);
unlockGcrypt ();
@@ -203,7 +203,7 @@
if (rc)
{
LOG_GCRY (NULL,
- GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK,
"gcry_cipher_decrypt", rc);
gcry_cipher_close (handle);
unlockGcrypt ();
Modified: GNUnet/src/util/crypto/symciphertest.c
===================================================================
--- GNUnet/src/util/crypto/symciphertest.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/util/crypto/symciphertest.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -158,7 +158,7 @@
{
int failureCount = 0;
- GE_ASSERT (NULL,
+ GNUNET_GE_ASSERT (NULL,
strlen (INITVALUE) > sizeof (GNUNET_AES_InitializationVector));
failureCount += testSymcipher ();
failureCount += verifyCrypto ();
Modified: GNUnet/src/util/crypto/weakkeytest.c
===================================================================
--- GNUnet/src/util/crypto/weakkeytest.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/util/crypto/weakkeytest.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -98,7 +98,7 @@
if (size == -1)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return 1;
}
@@ -106,12 +106,12 @@
if ((strlen (WEAK_KEY_TESTSTRING) + 1) != size)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return 1;
}
if (0 != strcmp (res, WEAK_KEY_TESTSTRING))
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return 1;
}
else
Modified: GNUnet/src/util/disk/storage.c
===================================================================
--- GNUnet/src/util/disk/storage.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/disk/storage.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -67,7 +67,7 @@
typedef struct
{
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
unsigned long long total;
int include_sym_links;
} GetFileSizeData;
@@ -83,7 +83,7 @@
#endif
char *fn;
- GE_ASSERT (gfsd->ectx, filename != NULL);
+ GNUNET_GE_ASSERT (gfsd->ectx, filename != NULL);
if ((dirname != NULL) && (strlen (dirname) > 0))
{
fn = GNUNET_malloc (strlen (filename) + strlen (dirname) + 3);
@@ -110,16 +110,16 @@
#ifdef HAVE_STAT64
if (0 != STAT64 (fn, &buf))
{
- GE_LOG_STRERROR_FILE (gfsd->ectx,
- GE_WARNING | GE_USER | GE_REQUEST, "stat64", fn);
+ GNUNET_GE_LOG_STRERROR_FILE (gfsd->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_REQUEST, "stat64", fn);
GNUNET_free (fn);
return GNUNET_SYSERR;
}
#else
if (0 != STAT (fn, &buf))
{
- GE_LOG_STRERROR_FILE (gfsd->ectx,
- GE_WARNING | GE_USER | GE_REQUEST, "stat", fn);
+ GNUNET_GE_LOG_STRERROR_FILE (gfsd->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_REQUEST, "stat", fn);
GNUNET_free (fn);
return GNUNET_SYSERR;
}
@@ -148,14 +148,14 @@
* @return GNUNET_SYSERR on error, GNUNET_OK on success
*/
int
-GNUNET_disk_file_size (struct GE_Context *ectx,
+GNUNET_disk_file_size (struct GNUNET_GE_Context *ectx,
const char *filename,
unsigned long long *size, int includeSymLinks)
{
GetFileSizeData gfsd;
int ret;
- GE_ASSERT (ectx, size != NULL);
+ GNUNET_GE_ASSERT (ectx, size != NULL);
gfsd.ectx = ectx;
gfsd.total = 0;
gfsd.include_sym_links = includeSymLinks;
@@ -172,15 +172,15 @@
* @return -1 on errors, otherwise the number of free blocks
*/
long
-GNUNET_disk_get_blocks_available (struct GE_Context *ectx, const char *part)
+GNUNET_disk_get_blocks_available (struct GNUNET_GE_Context *ectx, const char
*part)
{
#ifdef SOLARIS
struct statvfs buf;
if (0 != statvfs (part, &buf))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"statfs", part);
return -1;
}
@@ -194,8 +194,8 @@
szDrive[3] = 0;
if (!GetDiskFreeSpace (szDrive, &dwDummy, &dwDummy, &dwBlocks, &dwDummy))
{
- GE_LOG (ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_BULK,
_("`%s' failed for drive `%s': %u\n"),
"GetDiskFreeSpace", szDrive, GetLastError ());
@@ -206,8 +206,8 @@
struct statfs s;
if (0 != statfs (part, &s))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"statfs", part);
return -1;
}
@@ -222,7 +222,7 @@
* does not exist
*/
int
-GNUNET_disk_directory_test (struct GE_Context *ectx, const char *fil)
+GNUNET_disk_directory_test (struct GNUNET_GE_Context *ectx, const char *fil)
{
struct stat filestat;
int ret;
@@ -232,8 +232,8 @@
{
if (errno != ENOENT)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_REQUEST,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_REQUEST,
"stat", fil);
return GNUNET_SYSERR;
}
@@ -243,8 +243,8 @@
return GNUNET_NO;
if (ACCESS (fil, R_OK | X_OK) < 0)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_REQUEST,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_REQUEST,
"access", fil);
return GNUNET_SYSERR;
}
@@ -258,7 +258,7 @@
* else (will print an error message in that case, too).
*/
int
-GNUNET_disk_file_test (struct GE_Context *ectx, const char *fil)
+GNUNET_disk_file_test (struct GNUNET_GE_Context *ectx, const char *fil)
{
struct stat filestat;
int ret;
@@ -273,8 +273,8 @@
{
if (errno != ENOENT)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_REQUEST,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_REQUEST,
"stat", rdir);
GNUNET_free (rdir);
return GNUNET_SYSERR;
@@ -289,8 +289,8 @@
}
if (ACCESS (rdir, R_OK) < 0)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_REQUEST,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_REQUEST,
"access", rdir);
GNUNET_free (rdir);
return GNUNET_SYSERR;
@@ -305,7 +305,7 @@
* @returns GNUNET_OK on success, GNUNET_SYSERR on failure
*/
int
-GNUNET_disk_directory_create (struct GE_Context *ectx, const char *dir)
+GNUNET_disk_directory_create (struct GNUNET_GE_Context *ectx, const char *dir)
{
char *rdir;
int len;
@@ -359,8 +359,8 @@
#endif
if ((ret != 0) && (errno != EEXIST))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_BULK,
"mkdir", rdir);
GNUNET_free (rdir);
return GNUNET_SYSERR;
@@ -383,7 +383,7 @@
* @returns GNUNET_OK on success, GNUNET_SYSERR on failure
*/
int
-GNUNET_disk_directory_create_for_file (struct GE_Context *ectx,
+GNUNET_disk_directory_create_for_file (struct GNUNET_GE_Context *ectx,
const char *dir)
{
char *rdir;
@@ -411,18 +411,18 @@
* @return the number of bytes read on success, -1 on failure
*/
int
-GNUNET_disk_file_read (struct GE_Context *ectx,
+GNUNET_disk_file_read (struct GNUNET_GE_Context *ectx,
const char *fileName, int len, void *result)
{
/* open file, must exist, open read only */
int handle;
int size;
- GE_ASSERT (ectx, fileName != NULL);
- GE_ASSERT (ectx, len > 0);
+ GNUNET_GE_ASSERT (ectx, fileName != NULL);
+ GNUNET_GE_ASSERT (ectx, len > 0);
if (len == 0)
return 0;
- GE_ASSERT (ectx, result != NULL);
+ GNUNET_GE_ASSERT (ectx, result != NULL);
handle = GNUNET_disk_file_open (ectx, fileName, O_RDONLY, S_IRUSR);
if (handle < 0)
return -1;
@@ -457,7 +457,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
int
-GNUNET_disk_file_write (struct GE_Context *ectx,
+GNUNET_disk_file_write (struct GNUNET_GE_Context *ectx,
const char *fileName,
const void *buffer, unsigned int n, const char *mode)
{
@@ -466,7 +466,7 @@
/* open file, open with 600, create if not
present, otherwise overwrite */
- GE_ASSERT (ectx, fileName != NULL);
+ GNUNET_GE_ASSERT (ectx, fileName != NULL);
fn = GNUNET_expand_file_name (ectx, fileName);
handle =
GNUNET_disk_file_open (ectx, fn, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
@@ -475,12 +475,12 @@
GNUNET_free (fn);
return GNUNET_SYSERR;
}
- GE_ASSERT (ectx, (n == 0) || (buffer != NULL));
+ GNUNET_GE_ASSERT (ectx, (n == 0) || (buffer != NULL));
/* write the buffer take length from the beginning */
if (n != WRITE (handle, buffer, n))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_IMMEDIATE, "write", fn);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE, "write", fn);
GNUNET_disk_file_close (ectx, fn, handle);
GNUNET_free (fn);
return GNUNET_SYSERR;
@@ -488,8 +488,8 @@
GNUNET_disk_file_close (ectx, fn, handle);
if (0 != CHMOD (fn, atoo (mode)))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_BULK, "chmod", fn);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK, "chmod", fn);
}
GNUNET_free (fn);
return GNUNET_OK;
@@ -506,7 +506,7 @@
* ieration aborted by callback returning GNUNET_SYSERR
*/
int
-GNUNET_disk_directory_scan (struct GE_Context *ectx,
+GNUNET_disk_directory_scan (struct GNUNET_GE_Context *ectx,
const char *dirName,
GNUNET_DirectoryEntryCallback callback,
void *data)
@@ -516,17 +516,17 @@
struct stat istat;
int count = 0;
- GE_ASSERT (ectx, dirName != NULL);
+ GNUNET_GE_ASSERT (ectx, dirName != NULL);
if (0 != STAT (dirName, &istat))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_BULK, "stat", dirName);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK, "stat", dirName);
return GNUNET_SYSERR;
}
if (!S_ISDIR (istat.st_mode))
{
- GE_LOG (ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Expected `%s' to be a directory!\n"), dirName);
return GNUNET_SYSERR;
}
@@ -534,8 +534,8 @@
dinfo = OPENDIR (dirName);
if ((errno == EACCES) || (dinfo == NULL))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK,
"opendir", dirName);
return GNUNET_SYSERR;
}
@@ -564,7 +564,7 @@
static int
rmHelper (const char *fil, const char *dir, void *ctx)
{
- struct GE_Context *ectx = ctx;
+ struct GNUNET_GE_Context *ectx = ctx;
char *fn;
size_t n;
@@ -589,7 +589,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
int
-GNUNET_disk_directory_remove (struct GE_Context *ectx, const char *fileName)
+GNUNET_disk_directory_remove (struct GNUNET_GE_Context *ectx, const char
*fileName)
{
struct stat istat;
@@ -603,8 +603,8 @@
So we also explicitly check "isDirectory" */
(GNUNET_YES != GNUNET_disk_directory_test (ectx, fileName)))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"rmdir", fileName);
return GNUNET_SYSERR;
}
@@ -613,8 +613,8 @@
return GNUNET_SYSERR;
if (0 != RMDIR (fileName))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"rmdir", fileName);
return GNUNET_SYSERR;
}
@@ -622,15 +622,15 @@
}
void
-GNUNET_disk_file_close (struct GE_Context *ectx, const char *filename, int fd)
+GNUNET_disk_file_close (struct GNUNET_GE_Context *ectx, const char *filename,
int fd)
{
if (0 != CLOSE (fd))
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_BULK, "close", filename);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
"close", filename);
}
int
-GNUNET_disk_file_open (struct GE_Context *ectx, const char *filename,
+GNUNET_disk_file_open (struct GNUNET_GE_Context *ectx, const char *filename,
int oflag, ...)
{
char *fn;
@@ -644,9 +644,9 @@
{
errno = ENOENT;
SetLastError (lRet);
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_DEVELOPER | GE_ADMIN |
- GE_BULK, "plibc_conv_to_win_path", filename);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_DEVELOPER | GNUNET_GE_ADMIN |
+ GNUNET_GE_BULK, "plibc_conv_to_win_path",
filename);
return -1;
}
fn = GNUNET_strdup (szFile);
@@ -670,7 +670,7 @@
#endif
ret = OPEN (fn, oflag, mode);
if (ret == -1)
- GE_LOG_STRERROR_FILE (ectx, GE_WARNING | GE_USER | GE_BULK, "open", fn);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx, GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK, "open", fn);
GNUNET_free (fn);
return ret;
}
@@ -682,7 +682,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
int
-GNUNET_disk_file_copy (struct GE_Context *ectx, const char *src,
+GNUNET_disk_file_copy (struct GNUNET_GE_Context *ectx, const char *src,
const char *dst)
{
char *buf;
Modified: GNUnet/src/util/error/error.c
===================================================================
--- GNUnet/src/util/error/error.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/error/error.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -31,18 +31,18 @@
#endif
/**
* Default context for logging errors; used
- * if NULL is passed to GE_LOG.
+ * if NULL is passed to GNUNET_GE_LOG.
*/
-static struct GE_Context *defaultContext;
+static struct GNUNET_GE_Context *defaultContext;
-typedef struct GE_Context
+typedef struct GNUNET_GE_Context
{
- GE_KIND mask;
- GE_LogHandler handler;
+ GNUNET_GE_KIND mask;
+ GNUNET_GE_LogHandler handler;
void *cls;
- GE_CtxFree destruct;
- GE_Confirm confirm;
-} GE_Context;
+ GNUNET_GE_CtxFree destruct;
+ GNUNET_GE_Confirm confirm;
+} GNUNET_GE_Context;
/**
* Does the given event match the mask?
@@ -50,15 +50,15 @@
* @param mask the filter mask
*/
int
-GE_applies (GE_KIND have, GE_KIND mask)
+GNUNET_GE_applies (GNUNET_GE_KIND have, GNUNET_GE_KIND mask)
{
- GE_KIND both = mask & have;
- return ((both & GE_EVENTKIND) &&
- (both & GE_USERKIND) && (both & GE_ROUTEKIND));
+ GNUNET_GE_KIND both = mask & have;
+ return ((both & GNUNET_GE_EVENTKIND) &&
+ (both & GNUNET_GE_USERKIND) && (both & GNUNET_GE_ROUTEKIND));
}
void
-GE_LOG (struct GE_Context *ctx, GE_KIND kind, const char *message, ...)
+GNUNET_GE_LOG (struct GNUNET_GE_Context *ctx, GNUNET_GE_KIND kind, const char
*message, ...)
{
va_list va;
char date[64];
@@ -70,11 +70,11 @@
if (ctx == NULL)
ctx = defaultContext;
- if ((ctx != NULL) && (!GE_applies (kind, ctx->mask)))
+ if ((ctx != NULL) && (!GNUNET_GE_applies (kind, ctx->mask)))
return;
if ((ctx == NULL) &&
- (((kind & (GE_IMMEDIATE | GE_BULK)) == 0) ||
- ((kind & (GE_FATAL | GE_ERROR | GE_WARNING)) == 0)))
+ (((kind & (GNUNET_GE_IMMEDIATE | GNUNET_GE_BULK)) == 0) ||
+ ((kind & (GNUNET_GE_FATAL | GNUNET_GE_ERROR | GNUNET_GE_WARNING)) ==
0)))
return;
va_start (va, message);
@@ -102,7 +102,7 @@
* error message
*/
void
-GE_CONFIRM (struct GE_Context *ctx)
+GNUNET_GE_CONFIRM (struct GNUNET_GE_Context *ctx)
{
if (ctx == NULL)
{
@@ -126,21 +126,21 @@
* for matching events.
*
* @param mask which events is this handler willing to process?
- * an event must be non-zero in all 3 GE_KIND categories
+ * an event must be non-zero in all 3 GNUNET_GE_KIND categories
* to be passed to this handler
*/
-struct GE_Context *
-GE_create_context_callback (GE_KIND mask,
- GE_LogHandler handler,
+struct GNUNET_GE_Context *
+GNUNET_GE_create_context_callback (GNUNET_GE_KIND mask,
+ GNUNET_GE_LogHandler handler,
void *ctx,
- GE_CtxFree liberator, GE_Confirm confirm)
+ GNUNET_GE_CtxFree liberator, GNUNET_GE_Confirm
confirm)
{
- GE_Context *ret;
+ GNUNET_GE_Context *ret;
- ret = malloc (sizeof (GE_Context));
+ ret = malloc (sizeof (GNUNET_GE_Context));
if (ret == NULL)
return NULL;
- memset (ret, 0, sizeof (GE_Context));
+ memset (ret, 0, sizeof (GNUNET_GE_Context));
ret->mask = mask;
ret->handler = handler;
ret->cls = ctx;
@@ -153,7 +153,7 @@
* Free a log context.
*/
void
-GE_free_context (GE_Context * ctx)
+GNUNET_GE_free_context (GNUNET_GE_Context * ctx)
{
if (ctx == NULL)
return;
@@ -169,78 +169,78 @@
* @param have the kind of event
*/
int
-GE_isLogged (GE_Context * ctx, GE_KIND kind)
+GNUNET_GE_isLogged (GNUNET_GE_Context * ctx, GNUNET_GE_KIND kind)
{
if (ctx == NULL)
return GNUNET_YES;
- return GE_applies (kind, ctx->mask);
+ return GNUNET_GE_applies (kind, ctx->mask);
}
/**
* Convert a textual description of a loglevel
- * to the respective GE_KIND.
- * @returns GE_INVALID if log does not parse
+ * to the respective GNUNET_GE_KIND.
+ * @returns GNUNET_GE_INVALID if log does not parse
*/
-GE_KIND
-GE_getKIND (const char *log)
+GNUNET_GE_KIND
+GNUNET_GE_getKIND (const char *log)
{
if (0 == strcasecmp (log, _("DEBUG")))
- return GE_DEBUG;
+ return GNUNET_GE_DEBUG;
if (0 == strcasecmp (log, _("STATUS")))
- return GE_STATUS;
+ return GNUNET_GE_STATUS;
if (0 == strcasecmp (log, _("WARNING")))
- return GE_WARNING;
+ return GNUNET_GE_WARNING;
if (0 == strcasecmp (log, _("ERROR")))
- return GE_ERROR;
+ return GNUNET_GE_ERROR;
if (0 == strcasecmp (log, _("FATAL")))
- return GE_FATAL;
+ return GNUNET_GE_FATAL;
if (0 == strcasecmp (log, _("USER")))
- return GE_USER;
+ return GNUNET_GE_USER;
if (0 == strcasecmp (log, _("ADMIN")))
- return GE_ADMIN;
+ return GNUNET_GE_ADMIN;
if (0 == strcasecmp (log, _("DEVELOPER")))
- return GE_DEVELOPER;
+ return GNUNET_GE_DEVELOPER;
if (0 == strcasecmp (log, _("REQUEST")))
- return GE_REQUEST;
+ return GNUNET_GE_REQUEST;
if (0 == strcasecmp (log, _("BULK")))
- return GE_BULK;
+ return GNUNET_GE_BULK;
if (0 == strcasecmp (log, _("IMMEDIATE")))
- return GE_IMMEDIATE;
+ return GNUNET_GE_IMMEDIATE;
if (0 == strcasecmp (log, _("ALL")))
- return GE_ALL;
+ return GNUNET_GE_ALL;
- return GE_INVALID;
+ return GNUNET_GE_INVALID;
}
/**
* Convert KIND to String
*/
const char *
-GE_kindToString (GE_KIND kind)
+GNUNET_GE_kindToString (GNUNET_GE_KIND kind)
{
- if ((kind & GE_DEBUG) > 0)
+ if ((kind & GNUNET_GE_DEBUG) > 0)
return _("DEBUG");
- if ((kind & GE_STATUS) > 0)
+ if ((kind & GNUNET_GE_STATUS) > 0)
return _("STATUS");
- if ((kind & GE_INFO) > 0)
+ if ((kind & GNUNET_GE_INFO) > 0)
return _("INFO");
- if ((kind & GE_WARNING) > 0)
+ if ((kind & GNUNET_GE_WARNING) > 0)
return _("WARNING");
- if ((kind & GE_ERROR) > 0)
+ if ((kind & GNUNET_GE_ERROR) > 0)
return _("ERROR");
- if ((kind & GE_FATAL) > 0)
+ if ((kind & GNUNET_GE_FATAL) > 0)
return _("FATAL");
- if ((kind & GE_USER) > 0)
+ if ((kind & GNUNET_GE_USER) > 0)
return _("USER");
- if ((kind & GE_ADMIN) > 0)
+ if ((kind & GNUNET_GE_ADMIN) > 0)
return _("ADMIN");
- if ((kind & GE_DEVELOPER) > 0)
+ if ((kind & GNUNET_GE_DEVELOPER) > 0)
return _("DEVELOPER");
- if ((kind & GE_REQUEST) > 0)
+ if ((kind & GNUNET_GE_REQUEST) > 0)
return _("REQUEST");
- if ((kind & GE_BULK) > 0)
+ if ((kind & GNUNET_GE_BULK) > 0)
return _("BULK");
- if ((kind & GE_IMMEDIATE) > 0)
+ if ((kind & GNUNET_GE_IMMEDIATE) > 0)
return _("IMMEDIATE");
return _("NOTHING");
}
@@ -248,18 +248,18 @@
typedef struct
{
- struct GE_Context *c1;
- struct GE_Context *c2;
+ struct GNUNET_GE_Context *c1;
+ struct GNUNET_GE_Context *c2;
} CPair;
static void
-multiplexer (void *ctx, GE_KIND kind, const char *date, const char *msg)
+multiplexer (void *ctx, GNUNET_GE_KIND kind, const char *date, const char *msg)
{
CPair *pair = ctx;
- if (GE_applies (kind, pair->c1->mask))
+ if (GNUNET_GE_applies (kind, pair->c1->mask))
pair->c1->handler (pair->c1->cls, kind, date, msg);
- if (GE_applies (kind, pair->c2->mask))
+ if (GNUNET_GE_applies (kind, pair->c2->mask))
pair->c2->handler (pair->c2->cls, kind, date, msg);
}
@@ -280,8 +280,8 @@
{
CPair *pair = ctx;
- GE_free_context (pair->c1);
- GE_free_context (pair->c2);
+ GNUNET_GE_free_context (pair->c1);
+ GNUNET_GE_free_context (pair->c2);
free (ctx);
}
@@ -289,25 +289,25 @@
* Create a context that sends events to two other contexts.
* Note that the client must stop using ctx1/ctx2 henceforth.
*/
-struct GE_Context *
-GE_create_context_multiplexer (struct GE_Context *ctx1,
- struct GE_Context *ctx2)
+struct GNUNET_GE_Context *
+GNUNET_GE_create_context_multiplexer (struct GNUNET_GE_Context *ctx1,
+ struct GNUNET_GE_Context *ctx2)
{
CPair *cls;
- GE_Context *ret;
+ GNUNET_GE_Context *ret;
cls = malloc (sizeof (CPair));
if (cls == NULL)
return NULL;
cls->c1 = ctx1;
cls->c2 = ctx2;
- ret = malloc (sizeof (GE_Context));
+ ret = malloc (sizeof (GNUNET_GE_Context));
if (ret == NULL)
{
free (cls);
return NULL;
}
- memset (ret, 0, sizeof (GE_Context));
+ memset (ret, 0, sizeof (GNUNET_GE_Context));
ret->cls = cls;
ret->handler = &multiplexer;
ret->mask = ctx1->mask | ctx2->mask;
@@ -318,13 +318,13 @@
void
-GE_setDefaultContext (struct GE_Context *ctx)
+GNUNET_GE_setDefaultContext (struct GNUNET_GE_Context *ctx)
{
defaultContext = ctx;
}
const char *
-GE_strerror (int errnum)
+GNUNET_GE_strerror (int errnum)
{
return STRERROR (errnum);
}
Modified: GNUnet/src/util/getopt/getopt.c
===================================================================
--- GNUnet/src/util/getopt/getopt.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/getopt/getopt.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -1000,8 +1000,8 @@
*/
int
GNUNET_parse_options (const char *binaryOptions,
- struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const GNUNET_CommandLineOption * allOptions,
unsigned int argc, char *const *argv)
{
@@ -1014,7 +1014,7 @@
int cont;
int c;
- GE_ASSERT (ectx, argc > 0);
+ GNUNET_GE_ASSERT (ectx, argc > 0);
clpc.binaryName = argv[0];
clpc.binaryOptions = binaryOptions;
clpc.allOptions = allOptions;
@@ -1066,8 +1066,8 @@
}
if (i == count)
{
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
_("Use --help to get a list of options.\n"));
cont = GNUNET_SYSERR;
}
Modified: GNUnet/src/util/getopt/setoption.c
===================================================================
--- GNUnet/src/util/getopt/setoption.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/getopt/setoption.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -37,23 +37,23 @@
const char *value)
{
char *section = GNUNET_strdup (scls);
- struct GC_Configuration *cfg = ctx->cfg;
+ struct GNUNET_GC_Configuration *cfg = ctx->cfg;
char *option;
int ret;
option = strstr (section, ":");
- GE_ASSERT (ctx->ectx, option != NULL);
+ GNUNET_GE_ASSERT (ctx->ectx, option != NULL);
option[0] = '\0';
option++;
if (value == NULL)
value = "YES";
- ret = GC_set_configuration_value_string (cfg,
+ ret = GNUNET_GC_set_configuration_value_string (cfg,
ctx->ectx, section, option, value);
if (ret != 0)
{
- GE_LOG (ctx->ectx,
- GE_USER | GE_BULK | GE_ERROR,
+ GNUNET_GE_LOG (ctx->ectx,
+ GNUNET_GE_USER | GNUNET_GE_BULK | GNUNET_GE_ERROR,
_
("Setting option `%s' in section `%s' to `%s' when processing
command line option `%s' was denied.\n"),
option, section, value, cmdLineOption);
@@ -71,16 +71,16 @@
const char *value)
{
char *section = GNUNET_strdup (scls);
- struct GC_Configuration *cfg = ctx->cfg;
+ struct GNUNET_GC_Configuration *cfg = ctx->cfg;
char *option;
int ret;
unsigned long long old;
option = strstr (section, ":");
- GE_ASSERT (ctx->ectx, option != NULL);
+ GNUNET_GE_ASSERT (ctx->ectx, option != NULL);
option[0] = '\0';
option++;
- ret = GC_get_configuration_value_number (cfg,
+ ret = GNUNET_GC_get_configuration_value_number (cfg,
section,
option,
0,
@@ -90,7 +90,7 @@
GNUNET_free (section);
return GNUNET_SYSERR;
}
- ret = GC_set_configuration_value_number (cfg,
+ ret = GNUNET_GC_set_configuration_value_number (cfg,
ctx->ectx,
section, option, old + 1);
GNUNET_free (section);
@@ -118,7 +118,7 @@
{
char **val = scls;
- GE_ASSERT (NULL, value != NULL);
+ GNUNET_GE_ASSERT (NULL, value != NULL);
*val = GNUNET_strdup (value);
return GNUNET_OK;
}
@@ -131,8 +131,8 @@
unsigned long long *val = scls;
if (1 != SSCANF (value, "%llu", val))
{
- GE_LOG (ctx->ectx,
- GE_ERROR | GE_IMMEDIATE | GE_USER,
+ GNUNET_GE_LOG (ctx->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_IMMEDIATE | GNUNET_GE_USER,
_("You must pass a number to the `%s' option.\n"), "-X");
return GNUNET_SYSERR;
}
@@ -148,8 +148,8 @@
if (1 != SSCANF (value, "%u", val))
{
- GE_LOG (ctx->ectx,
- GE_ERROR | GE_IMMEDIATE | GE_USER,
+ GNUNET_GE_LOG (ctx->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_IMMEDIATE | GNUNET_GE_USER,
_("You must pass a number to the `%s' option.\n"), "-X");
return GNUNET_SYSERR;
}
Modified: GNUnet/src/util/loggers/file.c
===================================================================
--- GNUnet/src/util/loggers/file.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/loggers/file.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -186,7 +186,7 @@
lcltime = *localtime (&curtime);
#endif
/* Format current date for filename */
- GE_ASSERT (NULL, 0 != strftime (date, 80, datefmt, &lcltime));
+ GNUNET_GE_ASSERT (NULL, 0 != strftime (date, 80, datefmt, &lcltime));
GNUNET_free (datefmt);
/* Remove special chars */
@@ -213,7 +213,7 @@
}
static void
-filelogger (void *cls, GE_KIND kind, const char *date, const char *msg)
+filelogger (void *cls, GNUNET_GE_KIND kind, const char *date, const char *msg)
{
FileContext *fctx = cls;
char *name;
@@ -262,12 +262,12 @@
{
ret = fprintf (fctx->handle,
"%s %s: %s",
- date, GE_kindToString (kind & GE_EVENTKIND), msg);
+ date, GNUNET_GE_kindToString (kind &
GNUNET_GE_EVENTKIND), msg);
}
else
{
ret = fprintf (fctx->handle,
- "%s: %s", GE_kindToString (kind & GE_EVENTKIND), msg);
+ "%s: %s", GNUNET_GE_kindToString (kind &
GNUNET_GE_EVENTKIND), msg);
}
if (ret < 0)
fprintf (stderr,
@@ -304,9 +304,9 @@
* @param logrotate after how many days should rotated log
* files be deleted (use 0 for no rotation)
*/
-struct GE_Context *
-GE_create_context_logfile (struct GE_Context *ectx,
- GE_KIND mask,
+struct GNUNET_GE_Context *
+GNUNET_GE_create_context_logfile (struct GNUNET_GE_Context *ectx,
+ GNUNET_GE_KIND mask,
const char *filename,
const char *owner, int logDate, int logrotate)
{
@@ -327,9 +327,9 @@
fd = FOPEN (name, "a+");
if (fd == NULL)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE |
- GE_BULK, "fopen", name);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN
| GNUNET_GE_IMMEDIATE |
+ GNUNET_GE_BULK, "fopen", name);
GNUNET_free (name);
return NULL; /* ERROR! */
}
@@ -346,7 +346,7 @@
fctx->logstart = start;
fctx->lock = GNUNET_mutex_create (GNUNET_YES);
purge_old_logs (fctx, name);
- return GE_create_context_callback (mask,
+ return GNUNET_GE_create_context_callback (mask,
&filelogger, fctx, &fileclose, NULL);
}
@@ -356,8 +356,8 @@
*
* @param mask which events should be logged?
*/
-struct GE_Context *
-GE_create_context_stderr (int logDate, GE_KIND mask)
+struct GNUNET_GE_Context *
+GNUNET_GE_create_context_stderr (int logDate, GNUNET_GE_KIND mask)
{
FileContext *fctx;
@@ -371,7 +371,7 @@
fctx->logstart = 0;
fctx->first_start = GNUNET_NO;
fctx->lock = GNUNET_mutex_create (GNUNET_YES);
- return GE_create_context_callback (mask,
+ return GNUNET_GE_create_context_callback (mask,
&filelogger, fctx, &fileclose, NULL);
}
@@ -381,8 +381,8 @@
*
* @param mask which events should be logged?
*/
-struct GE_Context *
-GE_create_context_stdout (int logDate, GE_KIND mask)
+struct GNUNET_GE_Context *
+GNUNET_GE_create_context_stdout (int logDate, GNUNET_GE_KIND mask)
{
FileContext *fctx;
@@ -396,7 +396,7 @@
fctx->user = NULL;
fctx->logstart = 0;
fctx->lock = GNUNET_mutex_create (GNUNET_YES);
- return GE_create_context_callback (mask,
+ return GNUNET_GE_create_context_callback (mask,
&filelogger, fctx, &fileclose, NULL);
}
Modified: GNUnet/src/util/loggers/memory.c
===================================================================
--- GNUnet/src/util/loggers/memory.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/loggers/memory.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -29,26 +29,26 @@
#include "gnunet_util.h"
#include "platform.h"
-typedef struct GE_Message
+typedef struct GNUNET_GE_Message
{
char *date;
char *msg;
- GE_KIND mask;
-} GE_Message;
+ GNUNET_GE_KIND mask;
+} GNUNET_GE_Message;
-typedef struct GE_Memory
+typedef struct GNUNET_GE_Memory
{
- GE_Message *messages;
+ GNUNET_GE_Message *messages;
struct GNUNET_Mutex *lock;
unsigned int maxSize;
unsigned int size;
unsigned int pos;
-} GE_Memory;
+} GNUNET_GE_Memory;
static void
-memorylogger (void *cls, GE_KIND kind, const char *date, const char *msg)
+memorylogger (void *cls, GNUNET_GE_KIND kind, const char *date, const char
*msg)
{
- GE_Memory *ctx = cls;
+ GNUNET_GE_Memory *ctx = cls;
unsigned int max;
GNUNET_mutex_lock (ctx->lock);
@@ -69,7 +69,7 @@
{
ctx->messages[ctx->pos].msg =
GNUNET_strdup (_("Out of memory (for logging)"));
- ctx->messages[ctx->pos].mask = GE_STATUS | GE_USER | GE_BULK;
+ ctx->messages[ctx->pos].mask = GNUNET_GE_STATUS | GNUNET_GE_USER |
GNUNET_GE_BULK;
}
else
{
@@ -84,10 +84,10 @@
* Create a logger that keeps events in memory (to be
* queried later in bulk).
*/
-struct GE_Context *
-GE_create_context_memory (GE_KIND mask, struct GE_Memory *memory)
+struct GNUNET_GE_Context *
+GNUNET_GE_create_context_memory (GNUNET_GE_KIND mask, struct GNUNET_GE_Memory
*memory)
{
- return GE_create_context_callback (mask, &memorylogger, memory, NULL, NULL);
+ return GNUNET_GE_create_context_callback (mask, &memorylogger, memory, NULL,
NULL);
}
/**
@@ -101,12 +101,12 @@
* (if more than maxSize messages are received, message number maxSize
* will be set to a corresponding warning)
*/
-struct GE_Memory *
-GE_memory_create (unsigned int maxSize)
+struct GNUNET_GE_Memory *
+GNUNET_GE_memory_create (unsigned int maxSize)
{
- GE_Memory *ret;
+ GNUNET_GE_Memory *ret;
- ret = GNUNET_malloc (sizeof (GE_Memory));
+ ret = GNUNET_malloc (sizeof (GNUNET_GE_Memory));
ret->maxSize = maxSize;
ret->size = 0;
ret->pos = 0;
@@ -119,7 +119,7 @@
* Get a particular log message from the store.
*/
const char *
-GE_memory_get (struct GE_Memory *memory, unsigned int index)
+GNUNET_GE_memory_get (struct GNUNET_GE_Memory *memory, unsigned int index)
{
if (index > memory->pos || memory->messages == NULL)
return NULL;
@@ -131,7 +131,7 @@
* Also clears the memory.
*/
void
-GE_memory_poll (struct GE_Memory *memory, GE_LogHandler handler, void *ctx)
+GNUNET_GE_memory_poll (struct GNUNET_GE_Memory *memory, GNUNET_GE_LogHandler
handler, void *ctx)
{
int i;
@@ -149,7 +149,7 @@
}
void
-GE_memory_reset (struct GE_Memory *memory)
+GNUNET_GE_memory_reset (struct GNUNET_GE_Memory *memory)
{
int i;
@@ -164,7 +164,7 @@
}
void
-GE_memory_free (struct GE_Memory *memory)
+GNUNET_GE_memory_free (struct GNUNET_GE_Memory *memory)
{
int i;
Modified: GNUnet/src/util/loggers/smtp.c
===================================================================
--- GNUnet/src/util/loggers/smtp.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/loggers/smtp.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -31,12 +31,12 @@
* @param server hostname of SMTP gateway, NULL for using local "mail" command
* @param port port to use for SMTP
* @param logDate should the date be each of the log lines?
- * @param bulkSize for GE_BULK messages, how many lines of messages
+ * @param bulkSize for GNUNET_GE_BULK messages, how many lines of messages
* should be accumulated before an e-mail is transmitted?
*/
-struct GE_Context *
-GE_create_context_email (struct GE_Context *ectx,
- GE_MASK mask,
+struct GNUNET_GE_Context *
+GNUNET_GE_create_context_email (struct GNUNET_GE_Context *ectx,
+ GNUNET_GE_MASK mask,
const char *address,
const char *server,
unsigned short port,
Modified: GNUnet/src/util/network/io.c
===================================================================
--- GNUnet/src/util/network/io.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/network/io.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -71,7 +71,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
int
-GNUNET_get_host_by_name (struct GE_Context *ectx, const char *hostname,
+GNUNET_get_host_by_name (struct GNUNET_GE_Context *ectx, const char *hostname,
GNUNET_IPv4Address * ip)
{
struct hostent *he;
@@ -81,8 +81,8 @@
he = GETHOSTBYNAME (hostname);
if (he == NULL)
{
- GE_LOG (ectx,
- GE_ERROR | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
_("Could not find IP of host `%s': %s\n"),
hostname, hstrerror (h_errno));
GNUNET_mutex_unlock (lock);
@@ -90,7 +90,7 @@
}
if (he->h_addrtype != AF_INET)
{
- GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, 0);
GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
@@ -104,7 +104,7 @@
struct GNUNET_SocketHandle *
-socket_create (struct GE_Context *ectx, struct GNUNET_LoadMonitor *mon,
+socket_create (struct GNUNET_GE_Context *ectx, struct GNUNET_LoadMonitor *mon,
int osSocket)
{
SocketHandle *ret;
@@ -120,17 +120,17 @@
void
GNUNET_socket_close (struct GNUNET_SocketHandle *s)
{
- GE_ASSERT (NULL, s != NULL);
+ GNUNET_GE_ASSERT (NULL, s != NULL);
if ((0 != SHUTDOWN (s->handle, SHUT_RDWR)) &&
#ifdef OSX
(errno != EINVAL) && /* OS X returns these instead of ENOTCONN */
(errno != EHOSTDOWN) && (errno != EHOSTUNREACH) &&
#endif
(errno != ENOTCONN))
- GE_LOG_STRERROR (s->ectx, GE_WARNING | GE_ADMIN | GE_BULK, "shutdown");
+ GNUNET_GE_LOG_STRERROR (s->ectx, GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "shutdown");
if (0 != CLOSE (s->handle))
- GE_LOG_STRERROR (s->ectx,
- GE_WARNING | GE_USER | GE_DEVELOPER | GE_BULK, "close");
+ GNUNET_GE_LOG_STRERROR (s->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_DEVELOPER
| GNUNET_GE_BULK, "close");
s->handle = -1;
s->checksum = 1;
}
@@ -138,7 +138,7 @@
void
GNUNET_socket_destroy (struct GNUNET_SocketHandle *s)
{
- GE_ASSERT (NULL, s != NULL);
+ GNUNET_GE_ASSERT (NULL, s != NULL);
if (s->handle != -1)
{
#ifdef LINUX
@@ -154,11 +154,11 @@
(errno != EHOSTDOWN) && (errno != EHOSTUNREACH) &&
#endif
(errno != ENOTCONN))
- GE_LOG_STRERROR (s->ectx,
- GE_WARNING | GE_ADMIN | GE_BULK, "shutdown");
+ GNUNET_GE_LOG_STRERROR (s->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"shutdown");
if (0 != CLOSE (s->handle))
- GE_LOG_STRERROR (s->ectx,
- GE_WARNING | GE_USER | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR (s->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"close");
}
GNUNET_free (s);
@@ -236,7 +236,7 @@
size_t pos;
size_t ret;
- GE_ASSERT (NULL, s->checksum == -s->handle);
+ GNUNET_GE_ASSERT (NULL, s->checksum == -s->handle);
GNUNET_socket_set_blocking (s, 0 != (nc & GNUNET_NC_BLOCKING));
flags = 0;
#ifdef CYGWIN
@@ -260,10 +260,10 @@
pos = 0;
do
{
- GE_ASSERT (NULL, s->checksum == -s->handle);
- GE_ASSERT (NULL, max > pos);
+ GNUNET_GE_ASSERT (NULL, s->checksum == -s->handle);
+ GNUNET_GE_ASSERT (NULL, max > pos);
ret = (size_t) RECV (s->handle, &((char *) buf)[pos], max - pos, flags);
- GE_ASSERT (NULL, s->checksum == -s->handle);
+ GNUNET_GE_ASSERT (NULL, s->checksum == -s->handle);
if ((ret == (size_t) - 1) &&
(errno == EINTR) && (0 != (nc & GNUNET_NC_IGNORE_INT)))
continue;
@@ -282,7 +282,7 @@
return (pos == 0) ? GNUNET_NO : GNUNET_YES;
}
#if DEBUG_IO
- GE_LOG_STRERROR (s->ectx, GE_DEBUG | GE_USER | GE_REQUEST, "recv");
+ GNUNET_GE_LOG_STRERROR (s->ectx, GNUNET_GE_DEBUG | GNUNET_GE_USER |
GNUNET_GE_REQUEST, "recv");
#endif
*read = pos;
return GNUNET_SYSERR;
@@ -296,7 +296,7 @@
if (s->mon != NULL)
GNUNET_network_monitor_notify_transmission (s->mon,
GNUNET_ND_DOWNLOAD, ret);
- GE_ASSERT (NULL, pos + ret >= pos);
+ GNUNET_GE_ASSERT (NULL, pos + ret >= pos);
pos += ret;
}
while ((pos < max) && (0 != (nc & GNUNET_NC_BLOCKING)));
@@ -359,8 +359,8 @@
*read = pos;
return (pos == 0) ? GNUNET_NO : GNUNET_YES;
}
- GE_LOG_STRERROR (s->ectx,
- GE_ERROR | GE_USER | GE_BULK | GE_DEVELOPER,
+ GNUNET_GE_LOG_STRERROR (s->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_BULK |
GNUNET_GE_DEVELOPER,
"recvfrom");
*read = pos;
return GNUNET_SYSERR;
@@ -433,7 +433,7 @@
return (pos == 0) ? GNUNET_NO : GNUNET_YES;
}
#if DEBUG_IO
- GE_LOG_STRERROR (s->ectx, GE_DEBUG | GE_USER | GE_REQUEST, "send");
+ GNUNET_GE_LOG_STRERROR (s->ectx, GNUNET_GE_DEBUG | GNUNET_GE_USER |
GNUNET_GE_REQUEST, "send");
#endif
*sent = pos;
return GNUNET_SYSERR;
@@ -511,8 +511,8 @@
return (pos == 0) ? GNUNET_NO : GNUNET_YES;
}
#if DEBUG_IO
- GE_LOG_STRERROR (s->ectx,
- GE_DEBUG | GE_USER | GE_REQUEST, "sendto");
+ GNUNET_GE_LOG_STRERROR (s->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER |
GNUNET_GE_REQUEST, "sendto");
#endif
*sent = pos;
return GNUNET_SYSERR;
Modified: GNUnet/src/util/network/ip.c
===================================================================
--- GNUnet/src/util/network/ip.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/network/ip.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -50,7 +50,7 @@
* @return GNUNET_SYSERR on failure, GNUNET_OK on success
*/
static int
-getAddressFromHostname (struct GE_Context *ectx,
+getAddressFromHostname (struct GNUNET_GE_Context *ectx,
GNUNET_IPv4Address * identity)
{
char hostname[MAX_HOSTNAME];
@@ -58,8 +58,8 @@
if (0 != gethostname (hostname, MAX_HOSTNAME))
{
- GE_LOG_STRERROR (ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
"gethostname");
return GNUNET_SYSERR;
}
@@ -69,20 +69,20 @@
#if HAVE_GETIFADDRS && HAVE_GNUNET_freeIFADDRS
static int
-getAddressFromGetIfAddrs (struct GC_Configuration *cfg,
- struct GE_Context *ectx,
+getAddressFromGetIfAddrs (struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
GNUNET_IPv4Address * identity)
{
char *interfaces;
struct ifaddrs *ifa_first;
- if (-1 == GC_get_configuration_value_string (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_string (cfg,
"NETWORK",
"INTERFACE",
"eth0", &interfaces))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("No interface specified in section `%s' under `%s'!\n"),
"NETWORK", "INTERFACE");
return GNUNET_SYSERR; /* that won't work! */
@@ -112,8 +112,8 @@
}
freeifaddrs (ifa_first);
}
- GE_LOG (ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Could not obtain IP for interface `%s' using `%s'.\n"),
interfaces, "getifaddrs");
GNUNET_free (interfaces);
@@ -125,8 +125,8 @@
#if LINUX || SOMEBSD || MINGW
#define MAX_INTERFACES 16
static int
-getAddressFromIOCTL (struct GC_Configuration *cfg,
- struct GE_Context *ectx, GNUNET_IPv4Address * identity)
+getAddressFromIOCTL (struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx, GNUNET_IPv4Address *
identity)
{
char *interfaces;
#ifndef MINGW
@@ -138,13 +138,13 @@
#endif
int i;
- if (-1 == GC_get_configuration_value_string (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_string (cfg,
"NETWORK",
"INTERFACE",
"eth0", &interfaces))
{
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
_("No interface specified in section `%s' under `%s'!\n"),
"NETWORK", "INTERFACE");
return GNUNET_SYSERR; /* that won't work! */
@@ -154,8 +154,8 @@
if (sockfd == -1)
{
GNUNET_free (interfaces);
- GE_LOG_STRERROR (ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "socket");
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "socket");
return GNUNET_SYSERR;
}
memset (&ifc, 0, sizeof (struct ifconf));
@@ -164,10 +164,10 @@
if (ioctl (sockfd, SIOCGIFCONF, &ifc) == -1)
{
- GE_LOG_STRERROR (ectx,
- GE_WARNING | GE_ADMIN | GE_USER | GE_BULK, "ioctl");
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "ioctl");
if (0 != CLOSE (sockfd))
- GE_LOG_STRERROR (ectx, GE_WARNING | GE_ADMIN | GE_BULK, "close");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "close");
GNUNET_free (interfaces);
return GNUNET_SYSERR;
}
@@ -188,12 +188,12 @@
&(((struct sockaddr_in *) &ifr[i].ifr_addr)->sin_addr),
sizeof (struct in_addr));
if (0 != CLOSE (sockfd))
- GE_LOG_STRERROR (ectx, GE_WARNING | GE_ADMIN | GE_BULK, "close");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "close");
GNUNET_free (interfaces);
return GNUNET_OK;
}
- GE_LOG (ectx,
- GE_WARNING | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
_("Could not find interface `%s' using `%s', "
"trying to find another interface.\n"), interfaces, "ioctl");
/* if no such interface exists, take any interface but loopback */
@@ -211,15 +211,15 @@
&(((struct sockaddr_in *) &ifr[i].ifr_addr)->sin_addr),
sizeof (struct in_addr));
if (0 != CLOSE (sockfd))
- GE_LOG_STRERROR (ectx, GE_WARNING | GE_ADMIN | GE_BULK, "close");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "close");
GNUNET_free (interfaces);
return GNUNET_OK;
}
if (0 != CLOSE (sockfd))
- GE_LOG_STRERROR (ectx, GE_WARNING | GE_ADMIN | GE_BULK, "close");
- GE_LOG (ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "close");
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Could not obtain IP for interface `%s' using `%s'.\n"),
interfaces, "ioctl");
GNUNET_free (interfaces);
@@ -266,7 +266,7 @@
if (!iAddrCount)
{
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("Could not find an IP address for "
"interface `%s'.\n"), interfaces);
@@ -275,7 +275,7 @@
return GNUNET_SYSERR;
}
else if (iAddrCount > 1)
- GE_LOG (ectx, GE_WARNING | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("There is more than one IP address specified"
" for interface `%s'.\nGNUnet will "
"use %u.%u.%u.%u.\n"), interfaces,
@@ -296,7 +296,7 @@
pHost = GETHOSTBYNAME ("www.example.com");
if (!pHost)
{
- GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_USER,
_("Could not resolve `%s' to "
"determine our IP address: %s\n"),
"www.example.com", STRERROR (errno));
@@ -311,21 +311,21 @@
(SOCKADDR *) & theHost,
sizeof (theHost)) == SOCKET_ERROR && errno != EWOULDBLOCK)
{
- GE_LOG_STRERROR (ectx, GE_ERROR | GE_BULK | GE_USER, "connect");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_USER, "connect");
return GNUNET_SYSERR;
}
i = sizeof (theHost);
if (GETSOCKNAME (s, (SOCKADDR *) & theHost, &i) == SOCKET_ERROR)
{
- GE_LOG_STRERROR (ectx, GE_ERROR | GE_BULK | GE_USER, "getsockname");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK |
GNUNET_GE_USER, "getsockname");
return GNUNET_SYSERR;
}
closesocket (s);
identity->addr = theHost.sin_addr.S_un.S_addr;
}
- GE_LOG (ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("GNUnet now uses the IP address %u.%u.%u.%u.\n"),
GNUNET_PRIP (ntohl (identity->addr)));
@@ -340,8 +340,8 @@
* @return NULL on error, IP as string otherwise
*/
char *
-GNUNET_get_local_ip (struct GC_Configuration *cfg,
- struct GE_Context *ectx, GNUNET_IPv4Address * addr)
+GNUNET_get_local_ip (struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx, GNUNET_IPv4Address * addr)
{
GNUNET_IPv4Address address;
char *ipString;
@@ -349,10 +349,10 @@
char buf[65];
retval = GNUNET_SYSERR;
- if (GC_have_configuration_value (cfg, "NETWORK", "IP"))
+ if (GNUNET_GC_have_configuration_value (cfg, "NETWORK", "IP"))
{
ipString = NULL;
- GC_get_configuration_value_string (cfg, "NETWORK", "IP", "", &ipString);
+ GNUNET_GC_get_configuration_value_string (cfg, "NETWORK", "IP", "",
&ipString);
if (strlen (ipString) > 0)
{
retval = GNUNET_get_host_by_name (ectx, ipString, &address);
Modified: GNUnet/src/util/network/ipcheck.c
===================================================================
--- GNUnet/src/util/network/ipcheck.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/network/ipcheck.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -60,7 +60,7 @@
* @return the converted list, NULL if the synatx is flawed
*/
CIDRNetwork *
-GNUNET_parse_ipv4_network_specification (struct GE_Context *ectx,
+GNUNET_parse_ipv4_network_specification (struct GNUNET_GE_Context *ectx,
const char *routeList)
{
unsigned int count;
@@ -100,8 +100,8 @@
for (j = 0; j < 8; j++)
if (temps[j] > 0xFF)
{
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
_("Invalid format for IP: `%s'\n"), &routeList[pos]);
GNUNET_free (result);
return NULL;
@@ -128,8 +128,8 @@
for (j = 0; j < 4; j++)
if (temps[j] > 0xFF)
{
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
_("Invalid format for IP: `%s'\n"), &routeList[pos]);
GNUNET_free (result);
return NULL;
@@ -156,8 +156,8 @@
}
else
{
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
_
("Invalid network notation ('/%d' is not legal in IPv4
CIDR)."),
slash);
@@ -175,8 +175,8 @@
for (j = 0; j < 4; j++)
if (temps[j] > 0xFF)
{
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
_("Invalid format for IP: `%s'\n"), &routeList[pos]);
GNUNET_free (result);
return NULL;
@@ -199,16 +199,16 @@
i++;
continue;
}
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
_("Invalid format for IP: `%s'\n"), &routeList[pos]);
GNUNET_free (result);
return NULL; /* error */
}
if (pos < strlen (routeList))
{
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
_("Invalid format for IP: `%s'\n"), &routeList[pos]);
GNUNET_free (result);
return NULL; /* oops */
@@ -229,7 +229,7 @@
* @return the converted list, NULL if the synatx is flawed
*/
CIDR6Network *
-GNUNET_parse_ipv6_network_specification (struct GE_Context * ectx,
+GNUNET_parse_ipv6_network_specification (struct GNUNET_GE_Context * ectx,
const char *routeListX)
{
unsigned int count;
@@ -254,8 +254,8 @@
count++;
if (routeList[len - 1] != ';')
{
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
_("Invalid network notation (does not end with ';': `%s')\n"),
routeList);
GNUNET_free (routeList);
@@ -286,8 +286,8 @@
&routeList[slash + 1], &result[i].netmask);
if (ret <= 0)
{
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
_("Wrong format `%s' for netmask: %s\n"),
&routeList[slash + 1], STRERROR (errno));
GNUNET_free (result);
@@ -299,8 +299,8 @@
ret = inet_pton (AF_INET6, &routeList[start], &result[i].network);
if (ret <= 0)
{
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
_("Wrong format `%s' for network: %s\n"),
&routeList[slash + 1], STRERROR (errno));
GNUNET_free (result);
Modified: GNUnet/src/util/network/network.h
===================================================================
--- GNUnet/src/util/network/network.h 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/network/network.h 2007-11-25 12:04:45 UTC (rev 5755)
@@ -33,7 +33,7 @@
struct GNUNET_LoadMonitor *mon;
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
int handle;
Modified: GNUnet/src/util/network/select.c
===================================================================
--- GNUnet/src/util/network/select.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/network/select.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -127,7 +127,7 @@
*/
struct GNUNET_SocketHandle *listen_sock;
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
struct GNUNET_LoadMonitor *load_monitor;
@@ -192,12 +192,12 @@
int ret;
#if DEBUG_SELECT
- GE_LOG (sh->ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK, "Signaling select %p.\n", sh);
+ GNUNET_GE_LOG (sh->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK, "Signaling
select %p.\n", sh);
#endif
ret = WRITE (sh->signal_pipe[1], &i, sizeof (char));
if (ret != sizeof (char))
- GE_LOG_STRERROR (sh->ectx, GE_ERROR | GE_ADMIN | GE_BULK, "write");
+ GNUNET_GE_LOG_STRERROR (sh->ectx, GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "write");
}
/**
@@ -222,8 +222,8 @@
return; /* already in process of destroying! */
s->locked = 2;
#if DEBUG_SELECT
- GE_LOG (sh->ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (sh->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"Destroying session %p of select %p with %u in read and %u in write
buffer.\n",
s, sh, s->rsize, s->wsize);
#endif
@@ -282,8 +282,8 @@
&session->rbuff[session->pos],
session->rsize - session->pos, &recvd);
#if DEBUG_SELECT
- GE_LOG (sh->ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (sh->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"Receiving from session %p of select %p return %d-%u (%s).\n",
sh, session, ret, recvd, STRERROR (errno));
#endif
@@ -301,8 +301,8 @@
/* check minimum size */
if (len < sizeof (GNUNET_MessageHeader))
{
- GE_LOG (sh->ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (sh->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
_
("Received malformed message (too small) from connection.
Closing.\n"));
destroySession (sh, session);
@@ -359,8 +359,8 @@
size_t size;
#if DEBUG_SELECT
- GE_LOG (sh->ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (sh->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"Write and process called for session %p of select %p status %d.\n",
sh, session, sh->shutdown);
#endif
@@ -372,15 +372,15 @@
&session->wbuff[session->wspos],
session->wapos - session->wspos, &size);
#if DEBUG_SELECT
- GE_LOG (sh->ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (sh->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"Sending %d bytes from session %p of select %p return %d.\n",
session->wapos - session->wspos, sh, session, ret);
#endif
if (ret == GNUNET_SYSERR)
{
- GE_LOG_STRERROR (sh->ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_BULK, "send");
+ GNUNET_GE_LOG_STRERROR (sh->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_BULK, "send");
destroySession (sh, session);
return GNUNET_SYSERR;
}
@@ -412,7 +412,7 @@
}
break;
}
- GE_ASSERT (sh->ectx, ret == GNUNET_NO);
+ GNUNET_GE_ASSERT (sh->ectx, ret == GNUNET_NO);
/* this should only happen under Win9x because
of a bug in the socket implementation (KB177346).
Let's sleep and try again. */
@@ -456,8 +456,8 @@
{
if (-1 == FSTAT (sh->signal_pipe[0], &buf))
{
- GE_LOG_STRERROR (sh->ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR (sh->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_USER | GNUNET_GE_BULK,
"fstat");
sh->signal_pipe[0] = -1; /* prevent us from error'ing all the
time */
}
@@ -472,8 +472,8 @@
if (!GNUNET_socket_test_valid (sh->listen_sock))
{
GNUNET_socket_destroy (sh->listen_sock);
- GE_LOG (sh->ectx,
- GE_USER | GE_ERROR | GE_BULK,
+ GNUNET_GE_LOG (sh->ectx,
+ GNUNET_GE_USER | GNUNET_GE_ERROR | GNUNET_GE_BULK,
_("select listen socket for `%s' not valid!\n"),
sh->description);
sh->listen_sock = NULL; /* prevent us from error'ing all the
time */
@@ -491,8 +491,8 @@
if (!GNUNET_socket_test_valid (sock))
{
#if DEBUG_SELECT
- GE_LOG (sh->ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (sh->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"Select %p destroys invalid client handle %p\n",
sh, session);
#endif
@@ -503,7 +503,7 @@
add_to_select_set (sock, &errorSet, &max);
if (session->no_read != GNUNET_YES)
add_to_select_set (sock, &readSet, &max);
- GE_ASSERT (NULL, session->wapos >= session->wspos);
+ GNUNET_GE_ASSERT (NULL, session->wapos >= session->wspos);
if (session->wapos > session->wspos)
add_to_select_set (sock, &writeSet, &max); /* do we have
a pending write request? */
}
@@ -519,13 +519,13 @@
errno = old_errno;
if (errno == EBADF)
{
- GE_LOG_STRERROR (sh->ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK, "select");
+ GNUNET_GE_LOG_STRERROR (sh->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK, "select");
}
else
{
- GE_DIE_STRERROR (sh->ectx,
- GE_FATAL | GE_ADMIN | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_DIE_STRERROR (sh->ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
"select");
}
continue;
@@ -543,10 +543,10 @@
(struct sockaddr *) clientAddr, &lenOfIncomingAddr);
if (s == -1)
{
- GE_LOG_STRERROR (sh->ectx,
- GE_WARNING | GE_ADMIN | GE_BULK, "accept");
- GE_LOG (sh->ectx,
- GE_WARNING | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR (sh->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "accept");
+ GNUNET_GE_LOG (sh->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"Select %s failed to accept!\n", sh->description);
if ((errno == EAGAIN) || (errno == EWOULDBLOCK))
continue; /* not good, but not fatal either */
@@ -556,16 +556,16 @@
{
SHUTDOWN (s, SHUT_WR);
if (0 != CLOSE (s))
- GE_LOG_STRERROR (sh->ectx,
- GE_WARNING | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR (sh->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
GNUNET_GE_BULK,
"close");
s = -1;
continue;
}
sh->socket_quota--;
#if DEBUG_SELECT
- GE_LOG (sh->ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (sh->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"Select %p is accepting connection: %d\n", sh, s);
#endif
sock = socket_create (sh->ectx, sh->load_monitor, s);
@@ -574,8 +574,8 @@
sh, sock, clientAddr, lenOfIncomingAddr);
GNUNET_mutex_lock (sh->lock);
#if DEBUG_SELECT
- GE_LOG (sh->ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (sh->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"Select %p is accepting connection: %p\n", sh, sctx);
#endif
if (sctx == NULL)
@@ -623,17 +623,17 @@
#endif
if ((error != 0) || (optlen != sizeof (pending)))
{
- GE_LOG_STRERROR (sh->ectx,
- GE_ERROR | GE_ADMIN | GE_BULK, "ioctl");
+ GNUNET_GE_LOG_STRERROR (sh->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "ioctl");
pending = 65535; /* max */
}
#if DEBUG_SELECT
- GE_LOG (sh->ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (sh->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"Select %p is preparing to receive %u bytes from UDP\n",
sh, pending);
#endif
- GE_ASSERT (sh->ectx, pending >= 0);
+ GNUNET_GE_ASSERT (sh->ectx, pending >= 0);
if (pending >= 65536)
pending = 65536;
if (pending == 0)
@@ -686,8 +686,8 @@
if (sctx != NULL)
{
#if DEBUG_SELECT
- GE_LOG (sh->ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (sh->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK,
"Select %p is passing %u bytes from UDP
to handler\n",
sh, size);
#endif
@@ -697,8 +697,8 @@
else
{
#if DEBUG_SELECT
- GE_LOG (sh->ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (sh->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK,
"Error in select %p -- connection
refused\n",
sh);
#endif
@@ -707,10 +707,10 @@
else
{
#if DEBUG_SELECT
- GE_BREAK (sh->ectx, size == pending);
- GE_BREAK (sh->ectx,
+ GNUNET_GE_BREAK (sh->ectx, size == pending);
+ GNUNET_GE_BREAK (sh->ectx,
size >= sizeof (GNUNET_MessageHeader));
- GE_BREAK (sh->ectx,
+ GNUNET_GE_BREAK (sh->ectx,
(size >= sizeof (GNUNET_MessageHeader))
&& (ntohs (hdr->size) == size));
#endif
@@ -729,8 +729,8 @@
/* just a signal to refresh sets, eat and continue */
if (0 >= READ (sh->signal_pipe[0], &buf[0], MAXSIG_BUF))
{
- GE_LOG_STRERROR (sh->ectx,
- GE_WARNING | GE_USER | GE_BULK, "read");
+ GNUNET_GE_LOG_STRERROR (sh->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK, "read");
}
}
for (i = 0; i < sh->sessionCount; i++)
@@ -773,7 +773,7 @@
}
int
-GNUNET_pipe_make_nonblocking (struct GE_Context *ectx, int handle)
+GNUNET_pipe_make_nonblocking (struct GNUNET_GE_Context *ectx, int handle)
{
#if MINGW
DWORD mode;
@@ -792,8 +792,8 @@
flags |= O_NONBLOCK;
if (-1 == fcntl (handle, F_SETFL, flags))
{
- GE_LOG_STRERROR (ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE,
"fcntl");
return GNUNET_SYSERR;
}
@@ -817,7 +817,7 @@
SelectHandle *
GNUNET_select_create (const char *description,
int is_udp,
- struct GE_Context * ectx,
+ struct GNUNET_GE_Context * ectx,
struct GNUNET_LoadMonitor * mon,
int sock,
unsigned int max_addr_len,
@@ -834,17 +834,17 @@
if ((is_udp == GNUNET_NO) && (sock != -1) && (0 != LISTEN (sock, 5)))
{
- GE_LOG_STRERROR (ectx, GE_ERROR | GE_USER | GE_IMMEDIATE, "listen");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE, "listen");
return NULL;
}
- GE_ASSERT (ectx, description != NULL);
+ GNUNET_GE_ASSERT (ectx, description != NULL);
sh = GNUNET_malloc (sizeof (SelectHandle));
memset (sh, 0, sizeof (SelectHandle));
sh->is_udp = is_udp;
sh->description = description;
if (0 != PIPE (sh->signal_pipe))
{
- GE_LOG_STRERROR (ectx, GE_ERROR | GE_USER | GE_IMMEDIATE, "pipe");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE, "pipe");
GNUNET_free (sh);
return NULL;
}
@@ -853,7 +853,7 @@
{
if ((0 != CLOSE (sh->signal_pipe[0])) ||
(0 != CLOSE (sh->signal_pipe[1])))
- GE_LOG_STRERROR (ectx, GE_ERROR | GE_IMMEDIATE | GE_ADMIN, "close");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ERROR | GNUNET_GE_IMMEDIATE |
GNUNET_GE_ADMIN, "close");
GNUNET_free (sh);
return NULL;
}
@@ -879,13 +879,13 @@
sh->thread = GNUNET_thread_create (&selectThread, sh, 256 * 1024);
if (sh->thread == NULL)
{
- GE_LOG_STRERROR (ectx,
- GE_ERROR | GE_IMMEDIATE | GE_ADMIN, "pthread_create");
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_IMMEDIATE |
GNUNET_GE_ADMIN, "pthread_create");
if (sh->listen_sock != NULL)
GNUNET_socket_destroy (sh->listen_sock);
if ((0 != CLOSE (sh->signal_pipe[0])) ||
(0 != CLOSE (sh->signal_pipe[1])))
- GE_LOG_STRERROR (ectx, GE_ERROR | GE_IMMEDIATE | GE_ADMIN, "close");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ERROR | GNUNET_GE_IMMEDIATE |
GNUNET_GE_ADMIN, "close");
GNUNET_mutex_destroy (sh->lock);
GNUNET_free (sh);
return NULL;
@@ -903,8 +903,8 @@
void *unused;
#if DEBUG_SELECT
- GE_LOG (sh->ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK, "Destroying select %p\n", sh);
+ GNUNET_GE_LOG (sh->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK, "Destroying
select %p\n", sh);
#endif
sh->shutdown = GNUNET_YES;
signalSelect (sh);
@@ -918,11 +918,11 @@
GNUNET_mutex_unlock (sh->lock);
GNUNET_mutex_destroy (sh->lock);
if (0 != CLOSE (sh->signal_pipe[1]))
- GE_LOG_STRERROR (sh->ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_BULK, "close");
+ GNUNET_GE_LOG_STRERROR (sh->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "close");
if (0 != CLOSE (sh->signal_pipe[0]))
- GE_LOG_STRERROR (sh->ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_BULK, "close");
+ GNUNET_GE_LOG_STRERROR (sh->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "close");
if (sh->listen_sock != NULL)
GNUNET_socket_destroy (sh->listen_sock);
GNUNET_free (sh);
@@ -952,8 +952,8 @@
unsigned int newBufferSize;
#if DEBUG_SELECT
- GE_LOG (sh->ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (sh->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"Adding message of size %u to %p of select %p\n",
ntohs (msg->size), sock, sh);
#endif
@@ -971,7 +971,7 @@
GNUNET_mutex_unlock (sh->lock);
return GNUNET_SYSERR;
}
- GE_ASSERT (NULL, session->wapos >= session->wspos);
+ GNUNET_GE_ASSERT (NULL, session->wapos >= session->wspos);
if ((force == GNUNET_NO) &&
(((sh->memory_quota > 0) &&
(session->wapos - session->wspos + len > sh->memory_quota)) ||
@@ -1006,7 +1006,7 @@
if ((sh->memory_quota > 0) &&
(newBufferSize > sh->memory_quota) && (force == GNUNET_NO))
newBufferSize = sh->memory_quota;
- GE_ASSERT (NULL,
+ GNUNET_GE_ASSERT (NULL,
newBufferSize >= len + session->wapos - session->wspos);
newBuffer = GNUNET_malloc (newBufferSize);
memcpy (newBuffer,
@@ -1019,7 +1019,7 @@
session->wspos = 0;
}
}
- GE_ASSERT (NULL, session->wapos + len <= session->wsize);
+ GNUNET_GE_ASSERT (NULL, session->wapos + len <= session->wsize);
memcpy (&session->wbuff[session->wapos], msg, len);
session->wapos += len;
if (mayBlock)
@@ -1053,7 +1053,7 @@
GNUNET_mutex_unlock (sh->lock);
return GNUNET_SYSERR;
}
- GE_ASSERT (NULL, session->sock_ctx == old_sock_ctx);
+ GNUNET_GE_ASSERT (NULL, session->sock_ctx == old_sock_ctx);
session->sock_ctx = new_sock_ctx;
GNUNET_mutex_unlock (sh->lock);
return GNUNET_OK;
@@ -1070,8 +1070,8 @@
Session *session;
#if DEBUG_SELECT
- GE_LOG (sh->ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (sh->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"Adding connection %p to selector %p\n", sock, sh);
#endif
session = GNUNET_malloc (sizeof (Session));
@@ -1112,8 +1112,8 @@
Session *session;
#if DEBUG_SELECT
- GE_LOG (sh->ectx,
- GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (sh->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"Removing connection %p from selector %p\n", sock, sh);
#endif
GNUNET_mutex_lock (sh->lock);
@@ -1180,7 +1180,7 @@
GNUNET_mutex_unlock (sh->lock);
return GNUNET_SYSERR;
}
- GE_ASSERT (NULL, session->wapos >= session->wspos);
+ GNUNET_GE_ASSERT (NULL, session->wapos >= session->wspos);
if ((sh->memory_quota > 0) &&
(session->wapos - session->wspos + size > sh->memory_quota) &&
(force == GNUNET_NO))
Modified: GNUnet/src/util/network/selecttest.c
===================================================================
--- GNUnet/src/util/network/selecttest.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/util/network/selecttest.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -134,7 +134,7 @@
{
static int ret_addr;
- GE_BREAK (NULL, in == NULL);
+ GNUNET_GE_BREAK (NULL, in == NULL);
in = sock;
return &ret_addr; /* dummy value for accept */
}
@@ -153,7 +153,7 @@
else if (sock == out)
out = NULL;
else
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
}
@@ -174,7 +174,7 @@
listen_sock = SOCKET (PF_INET, SOCK_STREAM, 6); /* 6: TCP */
if (listen_sock == -1)
{
- GE_BREAK (NULL, 0);
+ GNUNET_GE_BREAK (NULL, 0);
return 1;
}
#if TCP_SYNCNT
Modified: GNUnet/src/util/network_client/daemon.c
===================================================================
--- GNUnet/src/util/network_client/daemon.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/util/network_client/daemon.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -31,8 +31,8 @@
#include "gnunet_util_threads.h"
int
-GNUNET_test_daemon_running (struct GE_Context *ectx,
- struct GC_Configuration *cfg)
+GNUNET_test_daemon_running (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg)
{
struct GNUNET_ClientServerConnection *sock;
GNUNET_MessageHeader csHdr;
@@ -42,7 +42,7 @@
if (sock == NULL)
return GNUNET_SYSERR;
csHdr.size = htons (sizeof (GNUNET_MessageHeader));
- csHdr.type = htons (CS_PROTO_traffic_COUNT);
+ csHdr.type = htons (GNUNET_CS_PROTO_TRAFFIC_COUNT);
if (GNUNET_SYSERR == GNUNET_client_connection_write (sock, &csHdr))
{
GNUNET_client_connection_destroy (sock);
@@ -66,7 +66,7 @@
int ret;
csHdr.size = htons (sizeof (GNUNET_MessageHeader));
- csHdr.type = htons (CS_PROTO_SHUTDOWN_REQUEST);
+ csHdr.type = htons (GNUNET_CS_PROTO_SHUTDOWN_REQUEST);
if (GNUNET_SYSERR == GNUNET_client_connection_write (sock, &csHdr))
{
GNUNET_client_connection_close_temporarily (sock);
@@ -88,8 +88,8 @@
* @return GNUNET_OK if gnunetd is now running
*/
int
-GNUNET_wait_for_daemon_running (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+GNUNET_wait_for_daemon_running (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
GNUNET_CronTime timeout)
{
GNUNET_CronTime min;
Modified: GNUnet/src/util/network_client/tcpio.c
===================================================================
--- GNUnet/src/util/network_client/tcpio.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/util/network_client/tcpio.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -65,9 +65,9 @@
struct GNUNET_Mutex *destroylock;
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
int dead;
@@ -79,20 +79,20 @@
* @return 0 on error
*/
static unsigned short
-getGNUnetPort (struct GE_Context *ectx, struct GC_Configuration *cfg)
+getGNUnetPort (struct GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration
*cfg)
{
char *res;
char *pos;
unsigned int port;
res = NULL;
- if (-1 == GC_get_configuration_value_string (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_string (cfg,
"NETWORK",
"HOST",
"localhost:2087", &res))
{
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Could not find valid value for HOST in section NETWORK."));
return 2087;
}
@@ -105,8 +105,8 @@
pos++;
if (1 != SSCANF (pos, "%u", &port))
{
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_BULK,
_
("Syntax error in configuration entry HOST in section NETWORK:
`%s'"),
pos);
@@ -124,19 +124,19 @@
* @return the name of the host, NULL on error
*/
static char *
-getGNUnetdHost (struct GE_Context *ectx, struct GC_Configuration *cfg)
+getGNUnetdHost (struct GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration
*cfg)
{
char *res;
char *pos;
res = NULL;
- if (-1 == GC_get_configuration_value_string (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_string (cfg,
"NETWORK",
"HOST",
"localhost:2087", &res))
{
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Could not find valid value for HOST in section NETWORK."));
return NULL;
}
@@ -147,8 +147,8 @@
}
struct GNUNET_ClientServerConnection *
-GNUNET_client_connection_create (struct GE_Context *ectx,
- struct GC_Configuration *cfg)
+GNUNET_client_connection_create (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg)
{
ClientServerConnection *result;
@@ -167,7 +167,7 @@
GNUNET_ClientServerConnection
*sock)
{
- GE_ASSERT (NULL, sock != NULL);
+ GNUNET_GE_ASSERT (NULL, sock != NULL);
GNUNET_mutex_lock (sock->destroylock);
if (sock->sock != NULL)
{
@@ -186,7 +186,7 @@
GNUNET_client_connection_close_forever (struct GNUNET_ClientServerConnection
*sock)
{
- GE_ASSERT (NULL, sock != NULL);
+ GNUNET_GE_ASSERT (NULL, sock != NULL);
GNUNET_mutex_lock (sock->destroylock);
if (sock->sock != NULL)
{
@@ -209,7 +209,7 @@
void
GNUNET_client_connection_destroy (struct GNUNET_ClientServerConnection *sock)
{
- GE_ASSERT (NULL, sock != NULL);
+ GNUNET_GE_ASSERT (NULL, sock != NULL);
GNUNET_client_connection_close_forever (sock);
GNUNET_mutex_destroy (sock->readlock);
GNUNET_mutex_destroy (sock->writelock);
@@ -243,7 +243,7 @@
char *host;
GNUNET_IPv4Address ip;
- GE_ASSERT (NULL, sock != NULL);
+ GNUNET_GE_ASSERT (NULL, sock != NULL);
if (sock->sock != NULL)
return GNUNET_OK;
if (sock->dead == GNUNET_YES)
@@ -275,8 +275,8 @@
osock = SOCKET (PF_INET, SOCK_STREAM, 6); /* 6: TCP */
if (osock == -1)
{
- GE_LOG_STRERROR (sock->ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_BULK, "socket");
+ GNUNET_GE_LOG_STRERROR (sock->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "socket");
GNUNET_free (host);
GNUNET_mutex_unlock (sock->destroylock);
return GNUNET_SYSERR;
@@ -285,15 +285,15 @@
GNUNET_socket_set_blocking (sock->sock, GNUNET_NO);
memset (&soaddr, 0, sizeof (soaddr));
soaddr.sin_family = AF_INET;
- GE_ASSERT (sock->ectx,
+ GNUNET_GE_ASSERT (sock->ectx,
sizeof (struct in_addr) == sizeof (GNUNET_IPv4Address));
memcpy (&soaddr.sin_addr, &ip, sizeof (struct in_addr));
soaddr.sin_port = htons (port);
ret = CONNECT (osock, (struct sockaddr *) &soaddr, sizeof (soaddr));
if ((ret != 0) && (errno != EINPROGRESS) && (errno != EWOULDBLOCK))
{
- GE_LOG (sock->ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (sock->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Cannot connect to %s:%u: %s\n"),
host, port, STRERROR (errno));
GNUNET_socket_destroy (sock->sock);
@@ -319,8 +319,8 @@
if (ret == -1)
{
if (errno != EINTR)
- GE_LOG_STRERROR (sock->ectx,
- GE_WARNING | GE_USER | GE_BULK, "select");
+ GNUNET_GE_LOG_STRERROR (sock->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
"select");
GNUNET_socket_destroy (sock->sock);
sock->sock = NULL;
GNUNET_free (host);
@@ -329,8 +329,8 @@
}
if (FD_ISSET (osock, &eset))
{
- GE_LOG (sock->ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (sock->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Error connecting to %s:%u\n"), host, port);
GNUNET_socket_destroy (sock->sock);
sock->sock = NULL;
@@ -340,8 +340,8 @@
}
if (!FD_ISSET (osock, &wset))
{
- GE_LOG (sock->ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (sock->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Failed to connect to %s:%u in %ds\n"),
host, port, WAIT_SECONDS);
GNUNET_socket_destroy (sock->sock);
@@ -381,7 +381,7 @@
return GNUNET_SYSERR;
}
GNUNET_mutex_unlock (sock->destroylock);
- GE_ASSERT (NULL, sock->sock != NULL);
+ GNUNET_GE_ASSERT (NULL, sock->sock != NULL);
size = ntohs (buffer->size);
res =
GNUNET_socket_send (sock->sock, GNUNET_NC_COMPLETE_TRANSFER, buffer, size,
@@ -415,7 +415,7 @@
return GNUNET_SYSERR;
}
GNUNET_mutex_unlock (sock->destroylock);
- GE_ASSERT (NULL, sock->sock != NULL);
+ GNUNET_GE_ASSERT (NULL, sock->sock != NULL);
while (1)
{
pos = 0;
@@ -434,7 +434,7 @@
size = ntohs (size);
if (size < sizeof (GNUNET_MessageHeader))
{
- GE_BREAK (sock->ectx, 0);
+ GNUNET_GE_BREAK (sock->ectx, 0);
GNUNET_mutex_unlock (sock->readlock);
GNUNET_client_connection_close_temporarily (sock);
return GNUNET_SYSERR; /* invalid header */
@@ -454,20 +454,20 @@
return GNUNET_SYSERR;
}
#if DEBUG_TCPIO
- GE_LOG (sock->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (sock->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Successfully received %d bytes from TCP socket.\n", size);
#endif
*buffer = (GNUNET_MessageHeader *) buf;
(*buffer)->size = htons (size);
- if (ntohs ((*buffer)->type) != CS_PROTO_RETURN_ERROR)
+ if (ntohs ((*buffer)->type) != GNUNET_CS_PROTO_RETURN_ERROR)
break; /* got actual message! */
rem = (GNUNET_MessageReturnErrorMessage *) * buffer;
if (ntohs (rem->header.size) <
sizeof (GNUNET_MessageReturnErrorMessage))
{
- GE_BREAK (sock->ectx, 0);
+ GNUNET_GE_BREAK (sock->ectx, 0);
GNUNET_mutex_unlock (sock->readlock);
GNUNET_client_connection_close_temporarily (sock);
GNUNET_free (buf);
@@ -475,7 +475,7 @@
}
size =
ntohs (rem->header.size) - sizeof (GNUNET_MessageReturnErrorMessage);
- GE_LOG (sock->ectx, ntohl (rem->kind), "%.*s", (int) size, &rem[1]);
+ GNUNET_GE_LOG (sock->ectx, ntohl (rem->kind), "%.*s", (int) size,
&rem[1]);
GNUNET_free (rem);
} /* while (1) */
GNUNET_mutex_unlock (sock->readlock);
@@ -501,10 +501,10 @@
GNUNET_client_connection_read (sock, (GNUNET_MessageHeader **) & rv))
return GNUNET_SYSERR;
if ((ntohs (rv->header.size) != sizeof (GNUNET_MessageReturnValue)) ||
- (ntohs (rv->header.type) != CS_PROTO_RETURN_VALUE))
+ (ntohs (rv->header.type) != GNUNET_CS_PROTO_RETURN_VALUE))
{
- GE_LOG (sock->ectx,
- GE_WARNING | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (sock->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
_("`%s' failed, reply invalid!\n"), __FUNCTION__);
GNUNET_free (rv);
return GNUNET_SYSERR;
@@ -529,7 +529,7 @@
GNUNET_MessageReturnValue rv;
rv.header.size = htons (sizeof (GNUNET_MessageReturnValue));
- rv.header.type = htons (CS_PROTO_RETURN_VALUE);
+ rv.header.type = htons (GNUNET_CS_PROTO_RETURN_VALUE);
rv.return_value = htonl (ret);
return GNUNET_client_connection_write (sock, &rv.header);
}
Modified: GNUnet/src/util/network_client/tcpiotest.c
===================================================================
--- GNUnet/src/util/network_client/tcpiotest.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/util/network_client/tcpiotest.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -27,7 +27,7 @@
#include "gnunet_util_config_impl.h"
#include "platform.h"
-static struct GC_Configuration *cfg;
+static struct GNUNET_GC_Configuration *cfg;
static unsigned short
getGNUnetPort ()
@@ -48,7 +48,7 @@
listenerFD = SOCKET (PF_INET, SOCK_STREAM, 0);
if (listenerFD < 0)
{
- GE_LOG_STRERROR (NULL, GE_BULK | GE_ERROR | GE_USER, "socket");
+ GNUNET_GE_LOG_STRERROR (NULL, GNUNET_GE_BULK | GNUNET_GE_ERROR |
GNUNET_GE_USER, "socket");
return -1;
}
@@ -60,7 +60,7 @@
if (SETSOCKOPT (listenerFD, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) < 0)
{
- GE_LOG_STRERROR (NULL, GE_BULK | GE_ERROR | GE_USER, "setsockopt");
+ GNUNET_GE_LOG_STRERROR (NULL, GNUNET_GE_BULK | GNUNET_GE_ERROR |
GNUNET_GE_USER, "setsockopt");
CLOSE (listenerFD);
return -1;
}
@@ -69,7 +69,7 @@
if (BIND (listenerFD,
(struct sockaddr *) &serverAddr, sizeof (serverAddr)) < 0)
{
- GE_LOG_STRERROR (NULL, GE_BULK | GE_ERROR | GE_USER, "bind");
+ GNUNET_GE_LOG_STRERROR (NULL, GNUNET_GE_BULK | GNUNET_GE_ERROR |
GNUNET_GE_USER, "bind");
CLOSE (listenerFD);
return -1;
}
@@ -77,7 +77,7 @@
/* start listening for new connections */
if (0 != LISTEN (listenerFD, 5))
{
- GE_LOG_STRERROR (NULL, GE_BULK | GE_ERROR | GE_USER, "listen");
+ GNUNET_GE_LOG_STRERROR (NULL, GNUNET_GE_BULK | GNUNET_GE_ERROR |
GNUNET_GE_USER, "listen");
CLOSE (listenerFD);
return -1;
}
@@ -100,7 +100,7 @@
&lenOfIncomingAddr);
if (incomingFD < 0)
{
- GE_LOG_STRERROR (NULL, GE_BULK | GE_ERROR | GE_USER, "accept");
+ GNUNET_GE_LOG_STRERROR (NULL, GNUNET_GE_BULK | GNUNET_GE_ERROR |
GNUNET_GE_USER, "accept");
continue;
}
}
@@ -175,10 +175,10 @@
int acceptSocket;
struct GNUNET_SocketHandle *sh;
- cfg = GC_create ();
- if (-1 == GC_parse_configuration (cfg, "check.conf"))
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
{
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return -1;
}
serverSocket = openServerSocket ();
@@ -209,6 +209,6 @@
CLOSE (serverSocket);
if (ret > 0)
fprintf (stderr, "Error %d\n", ret);
- GC_free (cfg);
+ GNUNET_GC_free (cfg);
return ret;
}
Modified: GNUnet/src/util/os/console.c
===================================================================
--- GNUnet/src/util/os/console.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/os/console.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -36,14 +36,14 @@
static char *
-getPIDFile (struct GC_Configuration *cfg)
+getPIDFile (struct GNUNET_GC_Configuration *cfg)
{
char *pif;
- if (0 != GC_get_configuration_value_filename (cfg,
+ if (0 != GNUNET_GC_get_configuration_value_filename (cfg,
"GNUNETD",
"PIDFILE",
- VAR_DAEMON_DIRECTORY
+
GNUNET_DEFAULT_DAEMON_VAR_DIRECTORY
"/gnunetd/pid", &pif))
return NULL;
return pif;
@@ -56,8 +56,8 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
int
-GNUNET_pid_file_write (struct GE_Context *ectx,
- struct GC_Configuration *cfg, unsigned int pid)
+GNUNET_pid_file_write (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg, unsigned int pid)
{
FILE *pidfd;
char *pif;
@@ -68,7 +68,7 @@
pif = getPIDFile (cfg);
if (pif == NULL)
return GNUNET_OK; /* no PID file */
- GC_get_configuration_value_string (cfg, "GNUNETD", "USER", "", &user);
+ GNUNET_GC_get_configuration_value_string (cfg, "GNUNETD", "USER", "", &user);
rdir = GNUNET_strdup (pif);
len = strlen (rdir);
while ((len > 0) && (rdir[len] != DIR_SEPARATOR))
@@ -84,8 +84,8 @@
}
if (0 != ACCESS (rdir, W_OK | X_OK))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER
| GNUNET_GE_BULK,
"access", rdir);
GNUNET_free (rdir);
GNUNET_free (user);
@@ -95,18 +95,18 @@
pidfd = FOPEN (pif, "w");
if (pidfd == NULL)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_ADMIN | GE_BULK, "fopen", pif);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "fopen", pif);
GNUNET_free (pif);
GNUNET_free (user);
return GNUNET_SYSERR;
}
if (0 > FPRINTF (pidfd, "%u", pid))
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_ADMIN | GE_BULK, "fprintf", pif);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "fprintf", pif);
if (0 != fclose (pidfd))
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_ADMIN | GE_BULK, "fclose", pif);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "fclose", pif);
if (strlen (user))
GNUNET_file_change_owner (ectx, pif, user);
GNUNET_free (user);
@@ -115,7 +115,7 @@
}
int
-GNUNET_pid_file_delete (struct GE_Context *ectx, struct GC_Configuration *cfg)
+GNUNET_pid_file_delete (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg)
{
char *pif = getPIDFile (cfg);
if (pif == NULL)
@@ -124,8 +124,8 @@
{
if (0 != UNLINK (pif))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
GNUNET_GE_BULK,
"unlink", pif);
GNUNET_free (pif);
return GNUNET_SYSERR;
@@ -144,8 +144,8 @@
* to complete the detachment protocol (handshake)
*/
int
-GNUNET_terminal_detach (struct GE_Context *ectx,
- struct GC_Configuration *cfg, int *filedes)
+GNUNET_terminal_detach (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg, int *filedes)
{
pid_t pid;
int nullfd;
@@ -153,8 +153,8 @@
/* Don't hold the wrong FS mounted */
if (CHDIR ("/") < 0)
{
- GE_LOG_STRERROR (ectx,
- GE_FATAL | GE_USER | GE_ADMIN | GE_IMMEDIATE, "chdir");
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE, "chdir");
return GNUNET_SYSERR;
}
@@ -163,8 +163,8 @@
pid = fork ();
if (pid < 0)
{
- GE_LOG_STRERROR (ectx,
- GE_FATAL | GE_USER | GE_ADMIN | GE_IMMEDIATE, "fork");
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE, "fork");
return GNUNET_SYSERR;
}
if (pid)
@@ -173,7 +173,7 @@
char c;
if (0 != CLOSE (filedes[1]))
- GE_LOG_STRERROR (ectx, GE_WARNING | GE_USER | GE_BULK, "close");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK, "close");
ok = GNUNET_SYSERR;
while (0 < READ (filedes[0], &c, sizeof (char)))
{
@@ -192,12 +192,12 @@
}
}
if (0 != CLOSE (filedes[0]))
- GE_LOG_STRERROR (ectx, GE_WARNING | GE_USER | GE_BULK, "close");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK, "close");
nullfd = GNUNET_disk_file_open (ectx, "/dev/null", O_RDWR | O_APPEND);
if (nullfd < 0)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_FATAL | GE_USER | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_USER | GNUNET_GE_ADMIN
| GNUNET_GE_IMMEDIATE,
"fork", "/dev/null");
return GNUNET_SYSERR;
}
@@ -207,14 +207,14 @@
*/
if (dup2 (nullfd, 0) < 0 || dup2 (nullfd, 1) < 0 || dup2 (nullfd, 2) < 0)
{
- GE_LOG_STRERROR (ectx,
- GE_FATAL | GE_USER | GE_ADMIN | GE_IMMEDIATE, "dup2");
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE, "dup2");
return GNUNET_SYSERR;
}
pid = setsid (); /* Detach from controlling terminal */
if (pid == -1)
- GE_LOG_STRERROR (ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE, "setsid");
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE, "setsid");
#else
FreeConsole ();
#endif
@@ -222,7 +222,7 @@
}
void
-GNUNET_terminal_detach_complete (struct GE_Context *ectx,
+GNUNET_terminal_detach_complete (struct GNUNET_GE_Context *ectx,
int *filedes, int success)
{
#ifndef MINGW
@@ -232,7 +232,7 @@
c = '!';
WRITE (filedes[1], &c, sizeof (char)); /* signal success */
if (0 != CLOSE (filedes[1]))
- GE_LOG_STRERROR (ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_IMMEDIATE, "close");
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE, "close");
#endif
}
Modified: GNUnet/src/util/os/cpustatus.c
===================================================================
--- GNUnet/src/util/os/cpustatus.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/os/cpustatus.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -98,8 +98,8 @@
&cpu_msg_count);
if (kret != KERN_SUCCESS)
{
- GE_LOG (NULL,
- GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_BULK,
"host_processor_info failed.");
return GNUNET_SYSERR;
}
@@ -149,8 +149,8 @@
fflush (proc_stat);
if (NULL == fgets (line, 256, proc_stat))
{
- GE_LOG_STRERROR_FILE (NULL,
- GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (NULL,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"fgets", "/proc/stat");
fclose (proc_stat);
proc_stat = NULL; /* don't try again */
@@ -163,8 +163,8 @@
&system_read, &nice_read, &idle_read, &iowait_read);
if (ret < 4)
{
- GE_LOG_STRERROR_FILE (NULL,
- GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (NULL,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"fgets-sscanf", "/proc/stat");
fclose (proc_stat);
proc_stat = NULL; /* don't try again */
@@ -295,8 +295,8 @@
}
else
{
- GE_LOG (NULL,
- GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_BULK,
"host_processor_info failed.");
return GNUNET_SYSERR;
}
@@ -321,8 +321,8 @@
kc = kstat_open ();
if (kc == NULL)
{
- GE_LOG_STRERROR (NULL,
- GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR (NULL,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_BULK,
"kstat_open");
goto ABORT_KSTAT;
}
@@ -348,8 +348,8 @@
}
}
if (0 != kstat_close (kc))
- GE_LOG_STRERROR (NULL,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR (NULL,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
"kstat_close");
if ((idlecount == 0) && (totalcount == 0))
goto ABORT_KSTAT; /* no stats found => abort */
@@ -391,8 +391,8 @@
if (warnOnce == 0)
{
warnOnce = 1;
- GE_LOG_STRERROR (NULL,
- GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR (NULL,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"getloadavg");
}
return GNUNET_SYSERR;
@@ -456,8 +456,8 @@
if (once == 0)
{
once = 1;
- GE_LOG (NULL,
- GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_BULK,
_("Cannot query the CPU usage (Windows NT).\n"));
}
return GNUNET_SYSERR;
@@ -478,8 +478,8 @@
if (once == 0)
{
once = 1;
- GE_LOG (NULL,
- GE_USER | GE_ADMIN | GE_ERROR | GE_BULK,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_USER | GNUNET_GE_ADMIN | GNUNET_GE_ERROR |
GNUNET_GE_BULK,
_("Cannot query the CPU usage (Win 9x)\n"));
}
}
@@ -530,7 +530,7 @@
* that lock has already been obtained.
*/
static void
-updateAgedLoad (struct GE_Context *ectx, struct GC_Configuration *cfg)
+updateAgedLoad (struct GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration
*cfg)
{
static GNUNET_CronTime lastCall;
GNUNET_CronTime now;
@@ -588,7 +588,7 @@
* (100 is equivalent to full load)
*/
int
-GNUNET_cpu_get_load (struct GE_Context *ectx, struct GC_Configuration *cfg)
+GNUNET_cpu_get_load (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg)
{
unsigned long long maxCPULoad;
int ret;
@@ -599,7 +599,7 @@
GNUNET_mutex_unlock (statusMutex);
if (ret == -1)
return -1;
- if (-1 == GC_get_configuration_value_number (cfg, "LOAD", "MAXCPULOAD", 0,
10000, /* more than 1 CPU possible */
+ if (-1 == GNUNET_GC_get_configuration_value_number (cfg, "LOAD",
"MAXCPULOAD", 0, 10000, /* more than 1 CPU possible */
100, &maxCPULoad))
return GNUNET_SYSERR;
return (100 * ret) / maxCPULoad;
@@ -612,7 +612,7 @@
* (100 is equivalent to full load)
*/
int
-GNUNET_disk_get_load (struct GE_Context *ectx, struct GC_Configuration *cfg)
+GNUNET_disk_get_load (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg)
{
unsigned long long maxIOLoad;
int ret;
@@ -623,7 +623,7 @@
GNUNET_mutex_unlock (statusMutex);
if (ret == -1)
return -1;
- if (-1 == GC_get_configuration_value_number (cfg, "LOAD", "MAXIOLOAD", 0,
10000, /* more than 1 CPU possible */
+ if (-1 == GNUNET_GC_get_configuration_value_number (cfg, "LOAD",
"MAXIOLOAD", 0, 10000, /* more than 1 CPU possible */
100, &maxIOLoad))
return GNUNET_SYSERR;
return (100 * ret) / maxIOLoad;
@@ -640,8 +640,8 @@
#ifdef LINUX
proc_stat = fopen ("/proc/stat", "r");
if (NULL == proc_stat)
- GE_LOG_STRERROR_FILE (NULL,
- GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (NULL,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_BULK,
"fopen", "/proc/stat");
#elif OSX
initMachCpuStats ();
Modified: GNUnet/src/util/os/daemon.c
===================================================================
--- GNUnet/src/util/os/daemon.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/os/daemon.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -37,7 +37,7 @@
* daemonized sucessfully, -1 on error
*/
static pid_t
-launchWithExec (struct GE_Context *ectx, const char *cfgFile, int daemonize)
+launchWithExec (struct GNUNET_GE_Context *ectx, const char *cfgFile, int
daemonize)
{
pid_t pid;
@@ -97,7 +97,7 @@
#ifndef MINGW
nice (10); /* return value is not well-defined */
if (errno != 0)
- GE_LOG_STRERROR (ectx, GE_WARNING | GE_USER | GE_BULK, "nice");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK, "nice");
if (path != NULL)
i = execv (path, (char **) args);
@@ -111,8 +111,8 @@
#endif
GNUNET_free_non_null (path);
if (i == -1)
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_BULK,
"exec", path == NULL ? "gnunetd" : path);
#ifndef MINGW
_exit (-1);
@@ -127,7 +127,7 @@
ret = waitpid (pid, &status, 0);
if (ret == -1)
{
- GE_LOG_STRERROR (ectx, GE_ERROR | GE_USER | GE_BULK, "waitpid");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_BULK, "waitpid");
return GNUNET_SYSERR;
}
if ((WIFEXITED (status) && (0 != WEXITSTATUS (status))))
@@ -159,8 +159,8 @@
* daemonized sucessfully, -1 on error
*/
int
-GNUNET_daemon_start (struct GE_Context *ectx,
- struct GC_Configuration *cfg,
+GNUNET_daemon_start (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
const char *cfgFile, int daemonize)
{
#if LINUX || OSX || SOLARIS || SOMEBSD || MINGW
@@ -216,7 +216,7 @@
* some error
*/
int
-GNUNET_daemon_stop (struct GE_Context *ectx, int pid)
+GNUNET_daemon_stop (struct GNUNET_GE_Context *ectx, int pid)
{
pid_t p;
int status;
@@ -225,7 +225,7 @@
p = pid;
if (p != WAITPID (p, &status, 0))
{
- GE_LOG_STRERROR (ectx, GE_ERROR | GE_USER | GE_BULK, "waitpid");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_BULK, "waitpid");
return GNUNET_SYSERR;
}
if (WEXITSTATUS (status) == 0)
Modified: GNUnet/src/util/os/daemontest.c
===================================================================
--- GNUnet/src/util/os/daemontest.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/os/daemontest.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -33,23 +33,23 @@
main (int argc, const char *argv[])
{
int daemon;
- struct GE_Context *ectx;
- struct GC_Configuration *cfg;
+ struct GNUNET_GE_Context *ectx;
+ struct GNUNET_GC_Configuration *cfg;
- ectx = GE_create_context_stderr (GNUNET_NO,
- GE_WARNING | GE_ERROR | GE_FATAL |
- GE_USER | GE_ADMIN | GE_DEVELOPER |
- GE_IMMEDIATE | GE_BULK);
- GE_setDefaultContext (ectx);
- cfg = GC_create ();
- GE_ASSERT (ectx, cfg != NULL);
+ ectx = GNUNET_GE_create_context_stderr (GNUNET_NO,
+ GNUNET_GE_WARNING | GNUNET_GE_ERROR |
GNUNET_GE_FATAL |
+ GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_DEVELOPER |
+ GNUNET_GE_IMMEDIATE | GNUNET_GE_BULK);
+ GNUNET_GE_setDefaultContext (ectx);
+ cfg = GNUNET_GC_create ();
+ GNUNET_GE_ASSERT (ectx, cfg != NULL);
GNUNET_os_init (ectx);
daemon = GNUNET_daemon_start (ectx, cfg, "check.conf", GNUNET_NO);
if (daemon <= 0)
{
fprintf (stderr, "Failed to start daemon.\n");
- GC_free (cfg);
- GE_free_context (ectx);
+ GNUNET_GC_free (cfg);
+ GNUNET_GE_free_context (ectx);
return 1;
}
if (GNUNET_OK !=
@@ -58,20 +58,20 @@
fprintf (stderr, "Failed to confirm daemon running (after 30s).\n");
/* try killing anyway, just to be sure */
GNUNET_daemon_stop (ectx, daemon);
- GC_free (cfg);
- GE_free_context (ectx);
+ GNUNET_GC_free (cfg);
+ GNUNET_GE_free_context (ectx);
return 1;
}
if (GNUNET_OK != GNUNET_daemon_stop (ectx, daemon))
{
fprintf (stderr, "Failed to stop daemon.\n");
- GC_free (cfg);
- GE_free_context (ectx);
+ GNUNET_GC_free (cfg);
+ GNUNET_GE_free_context (ectx);
return 1;
}
- GC_free (cfg);
- GE_free_context (ectx);
+ GNUNET_GC_free (cfg);
+ GNUNET_GE_free_context (ectx);
return 0;
}
Modified: GNUnet/src/util/os/dso.c
===================================================================
--- GNUnet/src/util/os/dso.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/os/dso.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -30,7 +30,7 @@
typedef struct GNUNET_PluginHandle
{
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
char *libprefix;
char *dsoname;
void *handle;
@@ -101,7 +101,7 @@
}
struct GNUNET_PluginHandle *
-GNUNET_plugin_load (struct GE_Context *ectx,
+GNUNET_plugin_load (struct GNUNET_GE_Context *ectx,
const char *libprefix, const char *dsoname)
{
void *libhandle;
@@ -114,8 +114,8 @@
libhandle = lt_dlopenext (libname);
if (libhandle == NULL)
{
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE,
_("`%s' failed for library `%s' with error: %s\n"),
"lt_dlopenext", libname, lt_dlerror ());
GNUNET_free (libname);
@@ -155,8 +155,8 @@
if (mptr == NULL)
mptr = lt_dlsym (plug->handle, initName);
if ((mptr == NULL) && (logError))
- GE_LOG (plug->ectx,
- GE_ERROR | GE_USER | GE_DEVELOPER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (plug->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_DEVELOPER |
GNUNET_GE_IMMEDIATE,
_("`%s' failed to resolve method '%s' with error: %s\n"),
"lt_dlsym", &initName[1], lt_dlerror ());
GNUNET_free (initName);
Modified: GNUnet/src/util/os/init.c
===================================================================
--- GNUnet/src/util/os/init.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/os/init.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -33,7 +33,7 @@
* @returns GNUNET_OK on success, GNUNET_SYSERR otherwise
*/
int
-GNUNET_os_init (struct GE_Context *ectx)
+GNUNET_os_init (struct GNUNET_GE_Context *ectx)
{
#ifdef MINGW
if (InitWinEnv (ectx) != ERROR_SUCCESS)
Modified: GNUnet/src/util/os/installpath.c
===================================================================
--- GNUnet/src/util/os/installpath.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/os/installpath.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -59,8 +59,8 @@
size = readlink (fn, lnk, 1023);
if ((size == 0) || (size >= 1024))
{
- GE_LOG_STRERROR_FILE (NULL,
- GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_LOG_STRERROR_FILE (NULL,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN
| GNUNET_GE_IMMEDIATE,
"readlink", fn);
GNUNET_free (lnk);
return NULL;
Modified: GNUnet/src/util/os/osconfig.c
===================================================================
--- GNUnet/src/util/os/osconfig.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/os/osconfig.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -35,7 +35,7 @@
* @param callback the callback function
*/
void
-GNUNET_list_network_interfaces (struct GE_Context *ectx,
+GNUNET_list_network_interfaces (struct GNUNET_GE_Context *ectx,
GNUNET_NetworkInterfaceProcessor proc,
void *cls)
{
@@ -54,8 +54,8 @@
f = popen ("ifconfig 2> /dev/null", "r");
if (!f)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_USER | GE_ADMIN | GE_BULK | GE_WARNING,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_USER | GNUNET_GE_ADMIN | GNUNET_GE_BULK
| GNUNET_GE_WARNING,
"popen", "ifconfig");
return;
}
@@ -101,7 +101,7 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
int
-GNUNET_set_fd_limit (struct GE_Context *ectx, int n)
+GNUNET_set_fd_limit (struct GNUNET_GE_Context *ectx, int n)
{
if (n == 0)
return GNUNET_OK;
@@ -114,14 +114,14 @@
ret = setrlimit (RLIMIT_NOFILE, &rlim);
if (ret != 0)
{
- GE_LOG_STRERROR (ectx,
- GE_INFO | GE_USER | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE,
"setrlimit");
return GNUNET_SYSERR;
}
#else
- GE_LOG (ectx,
- GE_INFO | GE_USER | GE_ADMIN,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_ADMIN,
_("Setting open descriptor limit not supported.\n"));
#endif
return GNUNET_OK;
@@ -182,7 +182,7 @@
* 2 startup script could not be opened
*/
int
-GNUNET_configure_autostart (struct GE_Context *ectx,
+GNUNET_configure_autostart (struct GNUNET_GE_Context *ectx,
int testCapability,
int doAutoStart,
const char *application,
@@ -300,8 +300,8 @@
/* Unix */
if ((ACCESS ("/usr/sbin/update-rc.d", X_OK) != 0))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN
| GNUNET_GE_IMMEDIATE,
"access", "/usr/sbin/update-rc.d");
return GNUNET_SYSERR;
}
@@ -312,8 +312,8 @@
if (ACCESS (application, X_OK) != 0)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_IMMEDIATE,
"access", application);
}
if (STAT ("/etc/init.d/gnunetd", &buf) == -1)
@@ -322,9 +322,9 @@
FILE *f = FOPEN ("/etc/init.d/gnunetd", "w");
if (f == NULL)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_USER | GE_ADMIN |
- GE_IMMEDIATE, "fopen",
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_ADMIN |
+ GNUNET_GE_IMMEDIATE, "fopen",
"/etc/init.d/gnunetd");
return 2;
}
@@ -365,9 +365,9 @@
if (0 != CHMOD ("/etc/init.d/gnunetd",
S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_ADMIN |
- GE_IMMEDIATE, "chmod",
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_ADMIN |
+ GNUNET_GE_IMMEDIATE, "chmod",
"/etc/init.d/gnunetd");
return GNUNET_SYSERR;
}
@@ -380,15 +380,15 @@
{
if (errno != 0)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_ADMIN |
- GE_IMMEDIATE, "system",
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_ADMIN |
+ GNUNET_GE_IMMEDIATE, "system",
"/usr/sbin/update-rc.d");
}
else
{
- GE_LOG (ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_ADMIN
| GNUNET_GE_IMMEDIATE,
_("Command `%s' failed with error code %u\n"),
"/usr/sbin/update-rc.d gnunetd defaults",
WEXITSTATUS (ret));
@@ -402,18 +402,18 @@
{ /* REMOVE autostart */
if ((UNLINK ("/etc/init.d/gnunetd") == -1) && (errno != ENOENT))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_ADMIN |
- GE_IMMEDIATE, "unlink",
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_ADMIN |
+ GNUNET_GE_IMMEDIATE, "unlink",
"/etc/init.d/gnunetd");
return GNUNET_SYSERR;
}
errno = 0;
if (-1 != system ("/usr/sbin/update-rc.d gnunetd remove"))
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_ADMIN |
- GE_IMMEDIATE, "system",
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_ADMIN |
+ GNUNET_GE_IMMEDIATE, "system",
"/usr/sbin/update-rc.d");
return GNUNET_SYSERR;
}
Modified: GNUnet/src/util/os/priority.c
===================================================================
--- GNUnet/src/util/os/priority.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/os/priority.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -32,11 +32,11 @@
* Set our process priority
*/
int
-GNUNET_set_process_priority (struct GE_Context *ectx, const char *str)
+GNUNET_set_process_priority (struct GNUNET_GE_Context *ectx, const char *str)
{
int prio = 0;
- GE_ASSERT (ectx, str != NULL);
+ GNUNET_GE_ASSERT (ectx, str != NULL);
/* We support four levels (NORMAL, ABOVE NORMAL, BELOW NORMAL, HIGH and IDLE)
* and the usual numeric nice() increments */
if (strcmp (str, "NORMAL") == 0)
@@ -73,8 +73,8 @@
{
if (1 != sscanf (str, "%d", &prio))
{
- GE_LOG (ectx,
- GE_USER | GE_BULK | GE_ERROR,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_USER | GNUNET_GE_BULK | GNUNET_GE_ERROR,
_("Invalid process priority `%s'\n"), str);
return GNUNET_SYSERR;
}
@@ -102,7 +102,7 @@
nice (prio);
if (errno != 0)
{
- GE_LOG_STRERROR (ectx, GE_WARNING | GE_ADMIN | GE_BULK, "nice");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "nice");
return GNUNET_SYSERR;
}
#endif
Modified: GNUnet/src/util/os/semaphore.c
===================================================================
--- GNUnet/src/util/os/semaphore.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/os/semaphore.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -54,7 +54,7 @@
typedef struct GNUNET_IPC_Semaphore
{
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
#if SOLARIS || GNUNET_freeBSD5 || OSX
sem_t *internal;
#elif WINDOWS
@@ -126,8 +126,8 @@
{
if (errno != EINTR)
{
- GE_LOG_STRERROR (NULL,
- GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR (NULL,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"flock");
return;
}
@@ -141,13 +141,13 @@
int ret;
ret = LSEEK (fd, pos, mode);
if (ret == -1)
- GE_LOG_STRERROR (NULL, GE_ERROR | GE_USER | GE_ADMIN | GE_BULK, "lseek");
+ GNUNET_GE_LOG_STRERROR (NULL, GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_ADMIN | GNUNET_GE_BULK, "lseek");
return ret;
}
#endif
struct GNUNET_IPC_Semaphore *
-GNUNET_IPC_semaphore_create (struct GE_Context *ectx,
+GNUNET_IPC_semaphore_create (struct GNUNET_GE_Context *ectx,
const char *basename,
const unsigned int initialValue)
{
@@ -180,8 +180,8 @@
initialValue);
}
if (ret->internal == (void *) SEM_FAILED)
- GE_DIE_STRERROR_FILE (ectx,
- GE_FATAL | GE_USER | GE_DEVELOPER | GE_IMMEDIATE,
+ GNUNET_GE_DIE_STRERROR_FILE (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_USER |
GNUNET_GE_DEVELOPER | GNUNET_GE_IMMEDIATE,
"sem_open", noslashBasename);
GNUNET_free (noslashBasename);
return ret;
@@ -214,11 +214,11 @@
}
if (!ret->internal)
{
- GE_LOG (ectx,
- GE_FATAL | GE_USER | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_USER | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK,
_("Can't create semaphore: %i"), dwErr);
- GE_DIE_STRERROR_FILE (ectx,
- GE_FATAL | GE_USER | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_DIE_STRERROR_FILE (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_USER |
GNUNET_GE_DEVELOPER | GNUNET_GE_BULK,
"OpenSemaphore", noslashBasename);
}
GNUNET_free (noslashBasename);
@@ -243,8 +243,8 @@
fp = FOPEN (ebasename, "a+");
if (NULL == fp)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_USER | GE_BULK, "fopen", ebasename);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_BULK,
"fopen", ebasename);
GNUNET_free (ret);
GNUNET_free (ebasename);
return NULL;
@@ -259,30 +259,30 @@
IPC_CREAT | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
if (ret->internal == -1)
- GE_DIE_STRERROR (ectx, GE_FATAL | GE_USER | GE_IMMEDIATE, "semget");
+ GNUNET_GE_DIE_STRERROR (ectx, GNUNET_GE_FATAL | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE, "semget");
if (semop (ret->internal, &op_lock[0], 2) < 0)
{
if (errno == EINVAL)
goto again;
else
- GE_DIE_STRERROR (ectx, GE_FATAL | GE_USER | GE_IMMEDIATE, "semop");
+ GNUNET_GE_DIE_STRERROR (ectx, GNUNET_GE_FATAL | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE, "semop");
}
/* get process count */
if ((pcount = semctl (ret->internal, 1, GETVAL, 0)) < 0)
- GE_DIE_STRERROR (ectx, GE_FATAL | GE_USER | GE_IMMEDIATE, "semctl");
+ GNUNET_GE_DIE_STRERROR (ectx, GNUNET_GE_FATAL | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE, "semctl");
if (pcount == 0)
{
semctl_arg.val = initialValue;
if (semctl (ret->internal, 0, SETVAL, semctl_arg) < 0)
- GE_DIE_STRERROR (ectx, GE_FATAL | GE_USER | GE_IMMEDIATE, "semtcl");
+ GNUNET_GE_DIE_STRERROR (ectx, GNUNET_GE_FATAL | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE, "semtcl");
semctl_arg.val = PROCCOUNT;
if (semctl (ret->internal, 1, SETVAL, semctl_arg) < 0)
- GE_DIE_STRERROR (ectx, GE_FATAL | GE_USER | GE_IMMEDIATE, "semtcl");
+ GNUNET_GE_DIE_STRERROR (ectx, GNUNET_GE_FATAL | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE, "semtcl");
}
if (semop (ret->internal, &op_endcreate[0], 2) < 0)
- GE_DIE_STRERROR (ectx, GE_FATAL | GE_USER | GE_IMMEDIATE, "semop");
+ GNUNET_GE_DIE_STRERROR (ectx, GNUNET_GE_FATAL | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE, "semop");
ret->filename = ebasename;
return ret;
#elif SOMEBSD
@@ -316,8 +316,8 @@
}
if (fd == -1)
{
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_BULK,
"open", ret->filename);
GNUNET_mutex_destroy (&ret->internalLock);
GNUNET_free (ret->filename);
@@ -330,8 +330,8 @@
cnt = htonl (initialValue);
SEMA_LSEEK (fd, 0, SEEK_SET);
if (sizeof (int) != WRITE (fd, &cnt, sizeof (int)))
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
GNUNET_GE_BULK,
"write", basename);
}
SEMA_LSEEK (fd, sizeof (int), SEEK_SET);
@@ -341,8 +341,8 @@
cnt = htonl (ntohl (cnt) + 1);
SEMA_LSEEK (fd, sizeof (int), SEEK_SET);
if (sizeof (int) != WRITE (fd, &cnt, sizeof (int)))
- GE_LOG_STRERROR_FILE (ectx,
- GE_WARNING | GE_USER | GE_BULK, "write", basename);
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
"write", basename);
FLOCK (fd, LOCK_UN);
ret->fd = fd;
ret->initialValue = initialValue;
@@ -364,17 +364,17 @@
return;
#if SOLARIS || OSX || GNUNET_freeBSD5
if (0 != sem_post (sem->internal))
- GE_LOG_STRERROR (sem->ectx, GE_WARNING | GE_USER | GE_BULK, "sem_post");
+ GNUNET_GE_LOG_STRERROR (sem->ectx, GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK, "sem_post");
#elif WINDOWS
if (!ReleaseSemaphore (sem->internal, 1, NULL))
- GE_LOG (sem->ectx, GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (sem->ectx, GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK,
"ReleaseSemaphore signaled error: %i\n", GetLastError ());
#elif LINUX
{
struct sembuf sops = { 0, 1, SEM_UNDO };
if (0 != semop (sem->internal, &sops, 1))
- GE_LOG_STRERROR (sem->ectx, GE_WARNING | GE_USER | GE_BULK, "semop");
+ GNUNET_GE_LOG_STRERROR (sem->ectx, GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK, "semop");
}
#elif SOMEBSD
{
@@ -385,8 +385,8 @@
SEMA_LSEEK (sem->fd, 0, SEEK_SET);
if (sizeof (int) != READ (sem->fd, &cnt, sizeof (int)))
{
- GE_LOG_STRERROR_FILE (sem->ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (sem->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK,
"read", sem->filename);
FLOCK (sem->fd, LOCK_UN);
GNUNET_mutex_unlock (&sem->internalLock);
@@ -395,8 +395,8 @@
cnt = htonl (ntohl (cnt) + 1);
SEMA_LSEEK (sem->fd, 0, SEEK_SET);
if (sizeof (int) != WRITE (sem->fd, &cnt, sizeof (int)))
- GE_LOG_STRERROR_FILE (sem->ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (sem->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK,
"write", sem->filename);
FLOCK (sem->fd, LOCK_UN);
GNUNET_mutex_unlock (&sem->internalLock);
@@ -415,14 +415,14 @@
{
if ((errno == EINTR) || (errno == EAGAIN))
continue;
- GE_DIE_STRERROR (sem->ectx,
- GE_FATAL | GE_USER | GE_IMMEDIATE, "sem_wait");
+ GNUNET_GE_DIE_STRERROR (sem->ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
"sem_wait");
}
return GNUNET_OK;
#elif WINDOWS
if (WaitForSingleObject (sem->internal, INFINITE) == WAIT_FAILED)
- GE_LOG_STRERROR (sem->ectx,
- GE_WARNING | GE_USER | GE_BULK, "WaitForSingleObject");
+ GNUNET_GE_LOG_STRERROR (sem->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
"WaitForSingleObject");
return GNUNET_OK;
#elif LINUX
{
@@ -432,8 +432,8 @@
{
if ((errno == EINTR) || (errno == EAGAIN))
continue;
- GE_DIE_STRERROR (sem->ectx,
- GE_FATAL | GE_USER | GE_IMMEDIATE, "semop");
+ GNUNET_GE_DIE_STRERROR (sem->ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE, "semop");
}
return GNUNET_OK;
}
@@ -449,8 +449,8 @@
SEMA_LSEEK (sem->fd, 0, SEEK_SET);
if (sizeof (int) != READ (sem->fd, &cnt, sizeof (int)))
{
- GE_LOG_STRERROR_FILE (sem->ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (sem->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK,
"read", sem->filename);
FLOCK (sem->fd, LOCK_UN);
GNUNET_mutex_unlock (&sem->internalLock);
@@ -468,8 +468,8 @@
cnt = htonl (ntohl (cnt) - 1);
SEMA_LSEEK (sem->fd, 0, SEEK_SET);
if (sizeof (int) != WRITE (sem->fd, &cnt, sizeof (int)))
- GE_LOG_STRERROR_FILE (sem->ectx,
- GE_WARNING | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (sem->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK,
"write", sem->filename);
FLOCK (sem->fd, LOCK_UN);
GNUNET_mutex_unlock (&sem->internalLock);
@@ -487,36 +487,36 @@
return;
#if SOLARIS || OSX || GNUNET_freeBSD5
if (0 != sem_close (sem->internal))
- GE_LOG_STRERROR (sem->ectx, GE_USER | GE_WARNING | GE_BULK, "sem_close");
+ GNUNET_GE_LOG_STRERROR (sem->ectx, GNUNET_GE_USER | GNUNET_GE_WARNING |
GNUNET_GE_BULK, "sem_close");
#elif WINDOWS
if (!CloseHandle (sem->internal))
- GE_LOG (sem->ectx,
- GE_USER | GE_WARNING | GE_BULK,
+ GNUNET_GE_LOG (sem->ectx,
+ GNUNET_GE_USER | GNUNET_GE_WARNING | GNUNET_GE_BULK,
"CloseHandle signaled error: %i\n", GetLastError ());
#elif LINUX
{
int pcount;
if (semop (sem->internal, &op_close[0], 3) < 0)
- GE_LOG_STRERROR (sem->ectx, GE_USER | GE_WARNING | GE_BULK, "semop");
+ GNUNET_GE_LOG_STRERROR (sem->ectx, GNUNET_GE_USER | GNUNET_GE_WARNING |
GNUNET_GE_BULK, "semop");
if ((pcount = semctl (sem->internal, 1, GETVAL, 0)) < 0)
- GE_LOG_STRERROR (sem->ectx, GE_USER | GE_WARNING | GE_BULK, "semctl");
+ GNUNET_GE_LOG_STRERROR (sem->ectx, GNUNET_GE_USER | GNUNET_GE_WARNING |
GNUNET_GE_BULK, "semctl");
if (pcount > PROCCOUNT)
{
- GE_BREAK (sem->ectx, 0);
+ GNUNET_GE_BREAK (sem->ectx, 0);
}
else if (pcount == PROCCOUNT)
{
if (0 != semctl (sem->internal, 0, IPC_RMID, 0))
- GE_LOG_STRERROR (sem->ectx,
- GE_USER | GE_WARNING | GE_BULK, "semctl");
+ GNUNET_GE_LOG_STRERROR (sem->ectx,
+ GNUNET_GE_USER | GNUNET_GE_WARNING |
GNUNET_GE_BULK, "semctl");
UNLINK (sem->filename);
}
else
{
if (semop (sem->internal, &op_unlock[0], 1) < 0)
- GE_LOG_STRERROR (sem->ectx,
- GE_USER | GE_WARNING | GE_BULK, "semop");
+ GNUNET_GE_LOG_STRERROR (sem->ectx,
+ GNUNET_GE_USER | GNUNET_GE_WARNING |
GNUNET_GE_BULK, "semop");
}
GNUNET_free (sem->filename);
}
@@ -532,13 +532,13 @@
cnt = htonl (ntohl (cnt) - 1);
SEMA_LSEEK (sem->fd, sizeof (int), SEEK_SET);
if (sizeof (int) != WRITE (sem->fd, &cnt, sizeof (int)))
- GE_LOG_STRERROR (sem->ectx,
- GE_WARNING | GE_USER | GE_BULK, "write");
+ GNUNET_GE_LOG_STRERROR (sem->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK, "write");
if (ntohl (cnt) == 0)
UNLINK (sem->filename);
}
else
- GE_LOG_STRERROR (sem->ectx, GE_WARNING | GE_USER | GE_BULK, "read");
+ GNUNET_GE_LOG_STRERROR (sem->ectx, GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK, "read");
FLOCK (sem->fd, LOCK_UN);
GNUNET_disk_file_close (sem->ectx, sem->filename, sem->fd);
GNUNET_free (sem->filename);
Modified: GNUnet/src/util/os/semaphoretest.c
===================================================================
--- GNUnet/src/util/os/semaphoretest.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/os/semaphoretest.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -30,7 +30,7 @@
static struct GNUNET_IPC_Semaphore *ipc;
-static struct GE_Context *ectx;
+static struct GNUNET_GE_Context *ectx;
static int
testIPCSemaphore ()
@@ -128,12 +128,12 @@
}
else
{
- GE_LOG (ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"waiting for other process to exit.\n");
if (-1 == waitpid (me, &j, 0))
- GE_LOG (ectx,
- GE_ERROR | GE_BULK | GE_USER,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
"waitpid failed: %s\n", STRERROR (errno));
if ((!WIFEXITED (j)) || WEXITSTATUS (j) == 1)
ret = 1; /* error in child */
@@ -146,14 +146,14 @@
{
int ret = 0;
- ectx = GE_create_context_stderr (GNUNET_NO,
- GE_WARNING | GE_ERROR | GE_FATAL |
- GE_USER | GE_ADMIN | GE_DEVELOPER |
- GE_IMMEDIATE | GE_BULK);
- GE_setDefaultContext (ectx);
+ ectx = GNUNET_GE_create_context_stderr (GNUNET_NO,
+ GNUNET_GE_WARNING | GNUNET_GE_ERROR |
GNUNET_GE_FATAL |
+ GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_DEVELOPER |
+ GNUNET_GE_IMMEDIATE | GNUNET_GE_BULK);
+ GNUNET_GE_setDefaultContext (ectx);
GNUNET_os_init (ectx);
ret += testIPCSemaphore ();
fprintf (stderr, "\n");
- GE_free_context (ectx);
+ GNUNET_GE_free_context (ectx);
return ret;
}
Modified: GNUnet/src/util/os/statuscalls.c
===================================================================
--- GNUnet/src/util/os/statuscalls.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/os/statuscalls.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -130,9 +130,9 @@
*/
struct GNUNET_Mutex *statusMutex;
- struct GE_Context *ectx;
+ struct GNUNET_GE_Context *ectx;
- struct GC_Configuration *cfg;
+ struct GNUNET_GC_Configuration *cfg;
DirectionInfo upload_info;
@@ -190,8 +190,8 @@
"%llu %*s %*s %*s %*s %*s %*s %*s %llu",
&rxnew, &txnew))
{
- GE_LOG (monitor->ectx,
- GE_ERROR | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (monitor->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_BULK,
_
("Failed to parse interface data from `%s'.\n"),
PROC_NET_DEV);
@@ -242,8 +242,8 @@
continue;
else
{
- GE_LOG_STRERROR (monitor->ectx,
- GE_ERROR | GE_ADMIN | GE_BULK, "sysctl");
+ GNUNET_GE_LOG_STRERROR (monitor->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "sysctl");
break;
}
}
@@ -263,8 +263,8 @@
}
else
{
- GE_LOG_STRERROR (monitor->ectx,
- GE_ERROR | GE_ADMIN | GE_BULK, "sysctl");
+ GNUNET_GE_LOG_STRERROR (monitor->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
"sysctl");
}
#elif MINGW
NetworkStats *ifc;
@@ -309,8 +309,8 @@
{ /* Win 95 */
if ((command = popen ("netstat -e", "rt")) == NULL)
{
- GE_LOG_STRERROR_FILE (monitor->ectx,
- GE_ERROR | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (monitor->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_BULK,
"popen", "netstat -e");
return;
}
@@ -332,8 +332,8 @@
}
else
{
- GE_LOG (monitor->ectx,
- GE_ERROR | GE_ADMIN | GE_BULK,
+ GNUNET_GE_LOG (monitor->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
_("Failed to parse interface data from `%s'.\n"),
PROC_NET_DEV);
}
@@ -352,8 +352,8 @@
*/
static int
resetStatusCalls (void *cls,
- struct GC_Configuration *cfg,
- struct GE_Context *ectx, const char *sect, const char *op)
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx, const char *sect, const char
*op)
{
struct GNUNET_LoadMonitor *monitor = cls;
char *interfaces;
@@ -363,20 +363,20 @@
if (0 != strcmp (sect, "LOAD"))
return 0; /* fast path */
- basic = GC_get_configuration_value_yesno (cfg,
+ basic = GNUNET_GC_get_configuration_value_yesno (cfg,
"LOAD", "BASICLIMITING",
GNUNET_YES);
if (basic == GNUNET_SYSERR)
return GNUNET_SYSERR;
- if (-1 == GC_get_configuration_value_string (cfg,
+ if (-1 == GNUNET_GC_get_configuration_value_string (cfg,
"LOAD",
"INTERFACES",
"eth0", &interfaces))
return GNUNET_SYSERR;
if (interfaces == NULL)
{
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_BULK,
_
("No network interfaces defined in configuration section `%s'
under `%s'!\n"),
"LOAD", "INTERFACES");
@@ -385,8 +385,8 @@
if (strlen (interfaces) == 0)
{
GNUNET_free (interfaces);
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_BULK,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_BULK,
_
("No network interfaces defined in configuration section `%s'
under `%s'!\n"),
"LOAD", "INTERFACES");
@@ -411,7 +411,7 @@
}
}
monitor->ifcs[--numInterfaces].name = GNUNET_strdup (interfaces);
- GE_ASSERT (ectx, numInterfaces == 0);
+ GNUNET_GE_ASSERT (ectx, numInterfaces == 0);
for (i = 0; i < monitor->ifcsSize; i++)
{
monitor->ifcs[i].last_in = 0;
@@ -425,13 +425,13 @@
monitor->download_info.overload = 0;
GNUNET_free (interfaces);
monitor->useBasicMethod = basic;
- GC_get_configuration_value_number (cfg,
+ GNUNET_GC_get_configuration_value_number (cfg,
"LOAD",
"MAXNETDOWNBPSTOTAL",
0,
(unsigned long long) -1,
50000, &monitor->download_info.max);
- GC_get_configuration_value_number (cfg,
+ GNUNET_GC_get_configuration_value_number (cfg,
"LOAD",
"MAXNETUPBPSTOTAL",
0,
@@ -559,8 +559,8 @@
}
struct GNUNET_LoadMonitor *
-GNUNET_network_monitor_create (struct GE_Context *ectx,
- struct GC_Configuration *cfg)
+GNUNET_network_monitor_create (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg)
{
struct GNUNET_LoadMonitor *monitor;
@@ -571,12 +571,12 @@
#ifdef LINUX
monitor->proc_net_dev = fopen (PROC_NET_DEV, "r");
if (NULL == monitor->proc_net_dev)
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
"fopen", PROC_NET_DEV);
#endif
monitor->statusMutex = GNUNET_mutex_create (GNUNET_NO);
- if (-1 == GC_attach_change_listener (cfg, &resetStatusCalls, monitor))
+ if (-1 == GNUNET_GC_attach_change_listener (cfg, &resetStatusCalls, monitor))
{
GNUNET_network_monitor_destroy (monitor);
return NULL;
@@ -589,7 +589,7 @@
{
int i;
- GC_detach_change_listener (monitor->cfg, &resetStatusCalls, monitor);
+ GNUNET_GC_detach_change_listener (monitor->cfg, &resetStatusCalls, monitor);
#ifdef LINUX
if (monitor->proc_net_dev != NULL)
fclose (monitor->proc_net_dev);
Modified: GNUnet/src/util/os/statuscallstest.c
===================================================================
--- GNUnet/src/util/os/statuscallstest.c 2007-11-25 03:50:33 UTC (rev
5754)
+++ GNUnet/src/util/os/statuscallstest.c 2007-11-25 12:04:45 UTC (rev
5755)
@@ -33,16 +33,16 @@
static long k;
int ret;
GNUNET_CronTime start;
- struct GE_Context *ectx;
- struct GC_Configuration *cfg;
+ struct GNUNET_GE_Context *ectx;
+ struct GNUNET_GC_Configuration *cfg;
- ectx = GE_create_context_stderr (GNUNET_NO,
- GE_WARNING | GE_ERROR | GE_FATAL |
- GE_USER | GE_ADMIN | GE_DEVELOPER |
- GE_IMMEDIATE | GE_BULK);
- GE_setDefaultContext (ectx);
- cfg = GC_create ();
- GE_ASSERT (ectx, cfg != NULL);
+ ectx = GNUNET_GE_create_context_stderr (GNUNET_NO,
+ GNUNET_GE_WARNING | GNUNET_GE_ERROR |
GNUNET_GE_FATAL |
+ GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_DEVELOPER |
+ GNUNET_GE_IMMEDIATE | GNUNET_GE_BULK);
+ GNUNET_GE_setDefaultContext (ectx);
+ cfg = GNUNET_GC_create ();
+ GNUNET_GE_ASSERT (ectx, cfg != NULL);
GNUNET_os_init (ectx);
/* need to run each phase for more than 10s since
statuscalls only refreshes that often... */
@@ -63,7 +63,7 @@
{
ret = 0;
}
- GC_free (cfg);
- GE_free_context (ectx);
+ GNUNET_GC_free (cfg);
+ GNUNET_GE_free_context (ectx);
return ret;
}
Modified: GNUnet/src/util/os/user.c
===================================================================
--- GNUnet/src/util/os/user.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/os/user.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -121,7 +121,7 @@
* @brief Change user ID
*/
int
-GNUNET_change_user (struct GE_Context *ectx, const char *user)
+GNUNET_change_user (struct GNUNET_GE_Context *ectx, const char *user)
{
#ifndef MINGW
struct passwd *pws;
@@ -130,8 +130,8 @@
pws = getpwnam (user);
if (pws == NULL)
{
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE,
_("Cannot obtain information about user `%s': %s\n"),
user, errno == 0 ? _("No such user") : STRERROR (errno));
return GNUNET_SYSERR;
@@ -145,8 +145,8 @@
if ((0 != setregid (pws->pw_gid, pws->pw_gid)) ||
(0 != setreuid (pws->pw_uid, pws->pw_uid)))
{
- GE_LOG (ectx,
- GE_FATAL | GE_USER | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE,
_("Cannot change user/group to `%s': %s\n"),
user, STRERROR (errno));
return GNUNET_SYSERR;
@@ -163,7 +163,7 @@
* @brief Change owner of a file
*/
int
-GNUNET_file_change_owner (struct GE_Context *ectx,
+GNUNET_file_change_owner (struct GNUNET_GE_Context *ectx,
const char *filename, const char *user)
{
#ifndef MINGW
@@ -173,15 +173,15 @@
if (pws == NULL)
{
if (NULL != ectx)
- GE_LOG (ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE,
_("Cannot obtain information about user `%s': %s\n"),
user, STRERROR (errno));
return GNUNET_SYSERR;
}
if ((0 != chown (filename, pws->pw_uid, pws->pw_gid)) && (NULL != ectx))
- GE_LOG_STRERROR_FILE (ectx,
- GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE,
+ GNUNET_GE_LOG_STRERROR_FILE (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE,
"chown", filename);
#endif
return GNUNET_OK;
Modified: GNUnet/src/util/string/string.c
===================================================================
--- GNUnet/src/util/string/string.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/string/string.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -41,7 +41,7 @@
va_start (args, format);
ret = VSNPRINTF (buf, size, format, args);
va_end (args);
- GE_ASSERT (NULL, ret <= size);
+ GNUNET_GE_ASSERT (NULL, ret <= size);
return ret;
}
@@ -126,7 +126,7 @@
* string is returned.
*/
char *
-GNUNET_convert_string_to_utf8 (struct GE_Context *ectx,
+GNUNET_convert_string_to_utf8 (struct GNUNET_GE_Context *ectx,
const char *input, size_t len,
const char *charset)
{
@@ -141,8 +141,8 @@
cd = iconv_open ("UTF-8", charset);
if (cd == (iconv_t) - 1)
{
- GE_LOG_STRERROR (ectx,
- GE_USER | GE_ADMIN | GE_WARNING | GE_BULK,
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_USER | GNUNET_GE_ADMIN | GNUNET_GE_WARNING |
GNUNET_GE_BULK,
"iconv_open");
ret = GNUNET_malloc (len + 1);
memcpy (ret, input, len);
@@ -155,7 +155,7 @@
finSize = tmpSize;
if (iconv (cd, (char **) &input, &len, &itmp, &finSize) == (size_t) - 1)
{
- GE_LOG_STRERROR (ectx, GE_USER | GE_WARNING | GE_BULK, "iconv");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_USER | GNUNET_GE_WARNING |
GNUNET_GE_BULK, "iconv");
iconv_close (cd);
GNUNET_free (tmp);
ret = GNUNET_malloc (len + 1);
@@ -168,7 +168,7 @@
ret[tmpSize - finSize] = '\0';
GNUNET_free (tmp);
if (0 != iconv_close (cd))
- GE_LOG_STRERROR (ectx, GE_ADMIN | GE_WARNING | GE_REQUEST, "iconv_close");
+ GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ADMIN | GNUNET_GE_WARNING |
GNUNET_GE_REQUEST, "iconv_close");
return ret;
#else
ret = GNUNET_malloc (len + 1);
@@ -189,7 +189,7 @@
* NULL is returned on error
*/
char *
-GNUNET_expand_file_name (struct GE_Context *ectx, const char *fil)
+GNUNET_expand_file_name (struct GNUNET_GE_Context *ectx, const char *fil)
{
char *buffer;
#ifndef MINGW
@@ -214,8 +214,8 @@
fm = getenv ("HOME");
if (fm == NULL)
{
- GE_LOG (ectx,
- GE_USER | GE_ADMIN | GE_WARNING | GE_IMMEDIATE,
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_USER | GNUNET_GE_ADMIN | GNUNET_GE_WARNING |
GNUNET_GE_IMMEDIATE,
_
("Failed to expand `$HOME': environment variable `HOME' not
set"));
return NULL;
@@ -253,8 +253,8 @@
}
if (fm == NULL)
{
- GE_LOG_STRERROR (ectx,
- GE_USER | GE_WARNING | GE_IMMEDIATE, "getcwd");
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_USER | GNUNET_GE_WARNING |
GNUNET_GE_IMMEDIATE, "getcwd");
buffer = getenv ("PWD"); /* alternative */
if (buffer != NULL)
fm = GNUNET_strdup (buffer);
@@ -273,8 +273,8 @@
if ((lRet = plibc_conv_to_win_path (fil, fn)) != ERROR_SUCCESS)
{
SetErrnoFromWinError (lRet);
- GE_LOG_STRERROR (ectx,
- GE_USER | GE_WARNING | GE_IMMEDIATE,
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_USER | GNUNET_GE_WARNING |
GNUNET_GE_IMMEDIATE,
"plibc_conv_to_win_path");
return NULL;
}
@@ -286,8 +286,8 @@
if (lRet + strlen (fn) + 1 > (MAX_PATH + 1))
{
SetErrnoFromWinError (ERROR_BUFFER_OVERFLOW);
- GE_LOG_STRERROR (ectx,
- GE_USER | GE_WARNING | GE_IMMEDIATE,
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_USER | GNUNET_GE_WARNING |
GNUNET_GE_IMMEDIATE,
"GetCurrentDirectory");
return NULL;
}
Modified: GNUnet/src/util/string/xmalloc.c
===================================================================
--- GNUnet/src/util/string/xmalloc.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/string/xmalloc.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -50,7 +50,7 @@
{
/* As a security precaution, we generally do not allow very large
allocations using the default 'GNUNET_malloc' macro */
- GE_ASSERT_FLF (NULL,
+ GNUNET_GE_ASSERT_FLF (NULL,
size <= GNUNET_MAX_GNUNET_malloc_CHECKED, filename,
linenumber, function);
return GNUNET_xmalloc_unchecked_ (size, filename, linenumber, function);
@@ -63,11 +63,11 @@
{
void *result;
- GE_ASSERT_FLF (NULL, size < INT_MAX, filename, linenumber, function);
+ GNUNET_GE_ASSERT_FLF (NULL, size < INT_MAX, filename, linenumber, function);
result = malloc (size);
if (result == NULL)
- GE_DIE_STRERROR_FLF (NULL,
- GE_IMMEDIATE | GE_USER | GE_DEVELOPER | GE_FATAL,
+ GNUNET_GE_DIE_STRERROR_FLF (NULL,
+ GNUNET_GE_IMMEDIATE | GNUNET_GE_USER |
GNUNET_GE_DEVELOPER | GNUNET_GE_FATAL,
"malloc", filename, linenumber, function);
memset (result, 0, size); /* client code should not rely on this,
though... */
return result;
@@ -93,8 +93,8 @@
ptr = realloc (ptr, n);
if (!ptr)
- GE_DIE_STRERROR_FLF (NULL,
- GE_IMMEDIATE | GE_USER | GE_DEVELOPER | GE_FATAL,
+ GNUNET_GE_DIE_STRERROR_FLF (NULL,
+ GNUNET_GE_IMMEDIATE | GNUNET_GE_USER |
GNUNET_GE_DEVELOPER | GNUNET_GE_FATAL,
"realloc", filename, linenumber, function);
return ptr;
}
@@ -111,7 +111,7 @@
GNUNET_xfree_ (void *ptr, const char *filename, int linenumber,
const char *function)
{
- GE_ASSERT_FLF (NULL, ptr != NULL, filename, linenumber, function);
+ GNUNET_GE_ASSERT_FLF (NULL, ptr != NULL, filename, linenumber, function);
free (ptr);
}
@@ -129,7 +129,7 @@
{
char *res;
- GE_ASSERT_FLF (NULL, str != NULL, filename, linenumber, function);
+ GNUNET_GE_ASSERT_FLF (NULL, str != NULL, filename, linenumber, function);
res =
(char *) GNUNET_xmalloc_ (strlen (str) + 1, filename, linenumber,
function);
@@ -159,7 +159,7 @@
void *tmp;
size_t size;
- GE_ASSERT_FLF (NULL,
+ GNUNET_GE_ASSERT_FLF (NULL,
INT_MAX / elementSize > newCount,
filename, linenumber, function);
size = newCount * elementSize;
@@ -170,7 +170,7 @@
else
{
tmp = GNUNET_xmalloc_ (size, filename, linenumber, function);
- GE_ASSERT (NULL, tmp != NULL);
+ GNUNET_GE_ASSERT (NULL, tmp != NULL);
memset (tmp, 0, size); /* client code should not rely on this,
though... */
if (*oldCount > newCount)
*oldCount = newCount; /* shrink is also allowed! */
Modified: GNUnet/src/util/threads/mutex.c
===================================================================
--- GNUnet/src/util/threads/mutex.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/threads/mutex.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -84,15 +84,15 @@
if (isRecursive)
{
#if LINUX
- GE_ASSERT (NULL,
+ GNUNET_GE_ASSERT (NULL,
0 == pthread_mutexattr_setkind_np
(&attr, PTHREAD_MUTEX_RECURSIVE_NP));
#elif SOMEBSD || GNUNET_freeBSD || GNUNET_freeBSD5
- GE_ASSERT (NULL,
+ GNUNET_GE_ASSERT (NULL,
0 == pthread_mutexattr_setkind_np
(&attr, PTHREAD_MUTEX_RECURSIVE));
#elif SOLARIS || OSX || WINDOWS
- GE_ASSERT (NULL,
+ GNUNET_GE_ASSERT (NULL,
0 == pthread_mutexattr_settype
(&attr, PTHREAD_MUTEX_RECURSIVE));
#endif
@@ -100,18 +100,18 @@
else
{
#if LINUX
- GE_ASSERT (NULL,
+ GNUNET_GE_ASSERT (NULL,
0 == pthread_mutexattr_setkind_np
(&attr, PTHREAD_MUTEX_ERRORCHECK_NP));
#else
- GE_ASSERT (NULL,
+ GNUNET_GE_ASSERT (NULL,
0 == pthread_mutexattr_settype
(&attr, PTHREAD_MUTEX_ERRORCHECK));
#endif
}
mut = GNUNET_malloc (sizeof (Mutex));
memset (mut, 0, sizeof (Mutex));
- GE_ASSERT (NULL, 0 == pthread_mutex_init (&mut->pt, &attr));
+ GNUNET_GE_ASSERT (NULL, 0 == pthread_mutex_init (&mut->pt, &attr));
return mut;
}
@@ -119,10 +119,10 @@
GNUNET_mutex_destroy (Mutex * mutex)
{
int ret;
- GE_ASSERT (NULL, mutex != NULL);
+ GNUNET_GE_ASSERT (NULL, mutex != NULL);
errno = 0;
ret = pthread_mutex_destroy (&mutex->pt);
- GE_ASSERT (NULL, 0 == ret);
+ GNUNET_GE_ASSERT (NULL, 0 == ret);
GNUNET_free (mutex);
}
@@ -134,28 +134,28 @@
GNUNET_CronTime start;
GNUNET_CronTime end;
- GE_ASSERT (NULL, mutex != NULL);
+ GNUNET_GE_ASSERT (NULL, mutex != NULL);
start = GNUNET_get_time ();
ret = pthread_mutex_lock (&mutex->pt);
end = GNUNET_get_time ();
if ((end - start > GNUNET_REALTIME_LIMIT) && (GNUNET_REALTIME_LIMIT != 0))
{
- GE_LOG (NULL,
- GE_DEVELOPER | GE_WARNING | GE_IMMEDIATE,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_DEVELOPER | GNUNET_GE_WARNING | GNUNET_GE_IMMEDIATE,
_("Real-time delay violation (%llu ms) at %s:%u\n"),
end - start, file, line);
}
if (ret != 0)
{
if (ret == EINVAL)
- GE_LOG (NULL,
- GE_FATAL | GE_DEVELOPER | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_FATAL | GNUNET_GE_DEVELOPER | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE,
_("Invalid argument for `%s'.\n"), "pthread_mutex_lock");
if (ret == EDEADLK)
- GE_LOG (NULL,
- GE_FATAL | GE_DEVELOPER | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_FATAL | GNUNET_GE_DEVELOPER | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE,
_("Deadlock due to `%s'.\n"), "pthread_mutex_lock");
- GE_ASSERT (NULL, 0);
+ GNUNET_GE_ASSERT (NULL, 0);
}
if (mutex->locked_depth++ == 0)
{
@@ -171,14 +171,14 @@
int ret;
GNUNET_CronTime now;
- GE_ASSERT (NULL, mutex != NULL);
+ GNUNET_GE_ASSERT (NULL, mutex != NULL);
if (0 == --mutex->locked_depth)
{
now = GNUNET_get_time ();
if ((now - mutex->locked_time > GNUNET_REALTIME_LIMIT) &&
(GNUNET_REALTIME_LIMIT != 0))
- GE_LOG (NULL,
- GE_DEVELOPER | GE_WARNING | GE_IMMEDIATE,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_DEVELOPER | GNUNET_GE_WARNING | GNUNET_GE_IMMEDIATE,
_("Lock aquired for too long (%llu ms) at %s:%u\n"),
now - mutex->locked_time,
mutex->locked_file, mutex->locked_line);
@@ -190,14 +190,14 @@
if (ret != 0)
{
if (ret == EINVAL)
- GE_LOG (NULL,
- GE_FATAL | GE_DEVELOPER | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_FATAL | GNUNET_GE_DEVELOPER | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE,
_("Invalid argument for `%s'.\n"), "pthread_mutex_lock");
if (ret == EPERM)
- GE_LOG (NULL,
- GE_FATAL | GE_DEVELOPER | GE_USER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_FATAL | GNUNET_GE_DEVELOPER | GNUNET_GE_USER |
GNUNET_GE_IMMEDIATE,
_("Permission denied for `%s'.\n"), "pthread_mutex_unlock");
- GE_ASSERT (NULL, 0);
+ GNUNET_GE_ASSERT (NULL, 0);
}
}
Modified: GNUnet/src/util/threads/pthread.c
===================================================================
--- GNUnet/src/util/threads/pthread.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/threads/pthread.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -144,15 +144,15 @@
GNUNET_CronTime end;
int k;
- GE_ASSERT (NULL, handle != NULL);
- GE_ASSERT (NULL, GNUNET_NO == GNUNET_thread_test_self (handle));
+ GNUNET_GE_ASSERT (NULL, handle != NULL);
+ GNUNET_GE_ASSERT (NULL, GNUNET_NO == GNUNET_thread_test_self (handle));
start = GNUNET_get_time ();
k = pthread_join (handle->pt, ret);
end = GNUNET_get_time ();
if ((end - start > GNUNET_REALTIME_LIMIT) && (GNUNET_REALTIME_LIMIT != 0))
{
- GE_LOG (NULL,
- GE_DEVELOPER | GE_WARNING | GE_IMMEDIATE,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_DEVELOPER | GNUNET_GE_WARNING | GNUNET_GE_IMMEDIATE,
_("Real-time delay violation (%llu ms) at %s:%u\n"),
end - start, file, line);
}
@@ -162,28 +162,28 @@
case 0:
return;
case ESRCH:
- GE_LOG (NULL,
- GE_FATAL | GE_USER | GE_DEVELOPER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_FATAL | GNUNET_GE_USER | GNUNET_GE_DEVELOPER |
GNUNET_GE_IMMEDIATE,
_("`%s' failed with error code %s: %s\n"),
"pthread_join", "ESRCH", STRERROR (errno));
break;
case EINVAL:
- GE_LOG (NULL,
- GE_FATAL | GE_USER | GE_DEVELOPER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_FATAL | GNUNET_GE_USER | GNUNET_GE_DEVELOPER |
GNUNET_GE_IMMEDIATE,
_("`%s' failed with error code %s: %s\n"),
"pthread_join", "EINVAL", STRERROR (errno));
case EDEADLK:
- GE_LOG (NULL,
- GE_FATAL | GE_USER | GE_DEVELOPER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_FATAL | GNUNET_GE_USER | GNUNET_GE_DEVELOPER |
GNUNET_GE_IMMEDIATE,
_("`%s' failed with error code %s: %s\n"),
"pthread_join", "EDEADLK", STRERROR (errno));
default:
- GE_LOG (NULL,
- GE_FATAL | GE_USER | GE_DEVELOPER | GE_IMMEDIATE,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_FATAL | GNUNET_GE_USER | GNUNET_GE_DEVELOPER |
GNUNET_GE_IMMEDIATE,
_("`%s' failed with error code %d: %s\n"),
"pthread_join", k, STRERROR (errno));
}
- GE_ASSERT (NULL, 0);
+ GNUNET_GE_ASSERT (NULL, 0);
}
#ifdef WINDOWS
@@ -226,7 +226,7 @@
rem.tv_sec = 0;
rem.tv_nsec = 0;
if ((0 != nanosleep (&req, &rem)) && (errno != EINTR))
- GE_LOG_STRERROR (NULL, GE_WARNING | GE_USER | GE_BULK, "nanosleep");
+ GNUNET_GE_LOG_STRERROR (NULL, GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK, "nanosleep");
#elif WINDOWS
SleepEx (delay, TRUE);
@@ -237,7 +237,7 @@
= (delay - timeout.tv_sec * CRON_UNIT_TO_SECONDS) * MICROSEC_TO_CRON_UNIT;
ret = SELECT (0, NULL, NULL, NULL, &timeout);
if ((ret == -1) && (errno != EINTR))
- GE_LOG_STRERROR (NULL, GE_WARNING | GE_USER | GE_BULK, "select");
+ GNUNET_GE_LOG_STRERROR (NULL, GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK, "select");
#endif
}
@@ -261,8 +261,8 @@
case 0:
break; /* ok */
case EINVAL:
- GE_LOG (NULL,
- GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK,
_("`%s' failed with error code %s: %s\n"),
"pthread_kill", "EINVAL", STRERROR (ret));
break;
@@ -270,8 +270,8 @@
/* ignore, thread might have already exited by chance */
break;
default:
- GE_LOG (NULL,
- GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_DEVELOPER |
GNUNET_GE_BULK,
_("`%s' failed with error code %d: %s\n"),
"pthread_kill", ret, STRERROR (ret));
break;
@@ -296,7 +296,7 @@
sig.sa_flags = SA_NODEFER;
sig.sa_handler = &sigalrmHandler;
if (0 != sigaction (SIGALRM, &sig, &old))
- GE_LOG_STRERROR (NULL, GE_WARNING | GE_ADMIN | GE_BULK, "sigaction");
+ GNUNET_GE_LOG_STRERROR (NULL, GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "sigaction");
#else
InitWinEnv (NULL);
#endif
@@ -306,7 +306,7 @@
{
#ifndef MINGW
if (0 != sigaction (SIGALRM, &old, &sig))
- GE_LOG_STRERROR (NULL, GE_WARNING | GE_ADMIN | GE_BULK, "sigaction");
+ GNUNET_GE_LOG_STRERROR (NULL, GNUNET_GE_WARNING | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "sigaction");
#else
ShutdownWinEnv ();
#endif
Modified: GNUnet/src/util/threads/semaphore.c
===================================================================
--- GNUnet/src/util/threads/semaphore.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/threads/semaphore.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -101,27 +101,27 @@
pthread_mutexattr_init (&attr);
#if LINUX
- GE_ASSERT (NULL,
+ GNUNET_GE_ASSERT (NULL,
0 == pthread_mutexattr_setkind_np
(&attr, PTHREAD_MUTEX_ERRORCHECK_NP));
#else
- GE_ASSERT (NULL,
+ GNUNET_GE_ASSERT (NULL,
0 == pthread_mutexattr_settype
(&attr, PTHREAD_MUTEX_ERRORCHECK));
#endif
s = GNUNET_malloc (sizeof (Semaphore));
s->v = value;
- GE_ASSERT (NULL, 0 == pthread_mutex_init (&s->mutex, &attr));
- GE_ASSERT (NULL, 0 == pthread_cond_init (&s->cond, NULL));
+ GNUNET_GE_ASSERT (NULL, 0 == pthread_mutex_init (&s->mutex, &attr));
+ GNUNET_GE_ASSERT (NULL, 0 == pthread_cond_init (&s->cond, NULL));
return s;
}
void
GNUNET_semaphore_destroy (Semaphore * s)
{
- GE_ASSERT (NULL, s != NULL);
- GE_ASSERT (NULL, 0 == pthread_cond_destroy (&s->cond));
- GE_ASSERT (NULL, 0 == pthread_mutex_destroy (&s->mutex));
+ GNUNET_GE_ASSERT (NULL, s != NULL);
+ GNUNET_GE_ASSERT (NULL, 0 == pthread_cond_destroy (&s->cond));
+ GNUNET_GE_ASSERT (NULL, 0 == pthread_mutex_destroy (&s->mutex));
GNUNET_free (s);
}
@@ -130,11 +130,11 @@
{
int ret;
- GE_ASSERT (NULL, s != NULL);
- GE_ASSERT (NULL, 0 == pthread_mutex_lock (&s->mutex));
+ GNUNET_GE_ASSERT (NULL, s != NULL);
+ GNUNET_GE_ASSERT (NULL, 0 == pthread_mutex_lock (&s->mutex));
ret = ++(s->v);
- GE_ASSERT (NULL, 0 == pthread_cond_signal (&s->cond));
- GE_ASSERT (NULL, 0 == pthread_mutex_unlock (&s->mutex));
+ GNUNET_GE_ASSERT (NULL, 0 == pthread_cond_signal (&s->cond));
+ GNUNET_GE_ASSERT (NULL, 0 == pthread_mutex_unlock (&s->mutex));
return ret;
}
@@ -148,22 +148,22 @@
GNUNET_CronTime start;
GNUNET_CronTime end;
- GE_ASSERT (NULL, s != NULL);
+ GNUNET_GE_ASSERT (NULL, s != NULL);
start = GNUNET_get_time ();
- GE_ASSERT (NULL, 0 == pthread_mutex_lock (&s->mutex));
+ GNUNET_GE_ASSERT (NULL, 0 == pthread_mutex_lock (&s->mutex));
while ((s->v <= 0) && mayblock)
- GE_ASSERT (NULL, 0 == pthread_cond_wait (&s->cond, &s->mutex));
+ GNUNET_GE_ASSERT (NULL, 0 == pthread_cond_wait (&s->cond, &s->mutex));
if (s->v > 0)
ret = --(s->v);
else
ret = GNUNET_SYSERR;
- GE_ASSERT (NULL, 0 == pthread_mutex_unlock (&s->mutex));
+ GNUNET_GE_ASSERT (NULL, 0 == pthread_mutex_unlock (&s->mutex));
end = GNUNET_get_time ();
if ((longwait == GNUNET_NO) &&
(end - start > GNUNET_REALTIME_LIMIT) && (GNUNET_REALTIME_LIMIT != 0))
{
- GE_LOG (NULL,
- GE_DEVELOPER | GE_WARNING | GE_IMMEDIATE,
+ GNUNET_GE_LOG (NULL,
+ GNUNET_GE_DEVELOPER | GNUNET_GE_WARNING | GNUNET_GE_IMMEDIATE,
_("Real-time delay violation (%llu ms) at %s:%u\n"),
end - start, file, line);
}
Modified: GNUnet/src/util/threads/shutdown.c
===================================================================
--- GNUnet/src/util/threads/shutdown.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/threads/shutdown.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -48,7 +48,7 @@
void
GNUNET_shutdown_initiate ()
{
- GE_ASSERT (NULL, shutdown_signal != NULL);
+ GNUNET_GE_ASSERT (NULL, shutdown_signal != NULL);
shutdown_active = GNUNET_YES;
GNUNET_semaphore_up (shutdown_signal);
}
@@ -98,8 +98,8 @@
*/
void __attribute__ ((constructor)) shutdown_handlers_ltdl_init ()
{
- GE_ASSERT (NULL, shutdown_signal == NULL);
- GE_ASSERT (NULL, shutdown_active == GNUNET_NO);
+ GNUNET_GE_ASSERT (NULL, shutdown_signal == NULL);
+ GNUNET_GE_ASSERT (NULL, shutdown_active == GNUNET_NO);
shutdown_signal = GNUNET_semaphore_create (0);
#ifndef MINGW
shc_int = GNUNET_signal_handler_install (SIGINT, &run_shutdown);
Modified: GNUnet/src/util/threads/signal.c
===================================================================
--- GNUnet/src/util/threads/signal.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/threads/signal.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -66,7 +66,7 @@
{
struct sigaction sig;
- GE_ASSERT (NULL, (ctx->sig == signal) && (ctx->method == handler));
+ GNUNET_GE_ASSERT (NULL, (ctx->sig == signal) && (ctx->method == handler));
sigemptyset (&sig.sa_mask);
sigaction (signal, &ctx->oldsig, &sig);
GNUNET_free (ctx);
Modified: GNUnet/src/util/win/winproc.c
===================================================================
--- GNUnet/src/util/win/winproc.c 2007-11-25 03:50:33 UTC (rev 5754)
+++ GNUnet/src/util/win/winproc.c 2007-11-25 12:04:45 UTC (rev 5755)
@@ -32,7 +32,7 @@
#ifdef MINGW
static HINSTANCE hNTDLL, hIphlpapi, hAdvapi, hNetapi;
-static struct GE_Context *pEctx = NULL;
+static struct GNUNET_GE_Context *pEctx = NULL;
TNtQuerySystemInformation GNNtQuerySystemInformation;
TGetIfEntry GNGetIfEntry;
@@ -76,10 +76,10 @@
if (!pEctx)
fprintf (stderr, "%s", msg);
else
- GE_LOG (pEctx,
+ GNUNET_GE_LOG (pEctx,
((err ==
- INT_MAX) ? GE_DEBUG : GE_FATAL) | GE_USER | GE_ADMIN |
- GE_IMMEDIATE, "%s", msg);
+ INT_MAX) ? GNUNET_GE_DEBUG : GNUNET_GE_FATAL) | GNUNET_GE_USER |
GNUNET_GE_ADMIN |
+ GNUNET_GE_IMMEDIATE, "%s", msg);
}
/**
@@ -88,7 +88,7 @@
* @return Error code from winerror.h, ERROR_SUCCESS on success
*/
int
-InitWinEnv (struct GE_Context *ectx)
+InitWinEnv (struct GNUNET_GE_Context *ectx)
{
int ret, init;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r5755 - in GNUnet: . src/applications/advertising src/applications/bootstrap_http src/applications/chat src/applications/datastore src/applications/dht/module src/applications/dht/tools src/applications/dstore src/applications/fragmentation src/applications/fs 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/tools src/applications/fs/uritrack src/applications/gap src/applications/getoption src/applications/identity src/applications/kvstore_sqlite src/applications/pingpong src/applications/rpc src/applications/session src/applications/sqstore_mysql src/applications/sqstore_sqlite src/applications/state src/applications/stats src/applications/tbench src/applications/template src/applications/testbed src/applications/testing src/applications/topology_default src/applications/topology_f2f src/applications/tracekit src/applications/traffic src/applications/transport src/applications/vpn src/include src/server src/setup src/setup/gtk src/setup/lib src/setup/ncurses src/setup/text src/transports src/transports/upnp src/util/boot src/util/config src/util/config_impl src/util/containers src/util/cron src/util/crypto src/util/disk src/util/error src/util/getopt src/util/loggers src/util/network src/util/network_client src/util/os src/util/string src/util/threads src/util/win,
gnunet <=